]> Creatis software - creaImageIO.git/blob - src2/creaImageIOWxTreeView.cpp
*** empty log message ***
[creaImageIO.git] / src2 / creaImageIOWxTreeView.cpp
1 #include <creaImageIOWxTreeView.h>
2 #include <creaImageIOGimmickView.h>
3 #include <creaImageIOSystem.h>
4 #include <wx/splitter.h>
5 #include <wx/gdicmn.h>
6 ///Comparing function for ordering algorithm. Takes parameters as strings.
7 int wxCALLBACK CompareFunctionStrings(long item1, long item2, long sortData)
8 {       
9         std::string s1((char*)((long*)item1)[1]);
10         std::string s2((char*)((long*)item2)[1]);
11         if(sortData==1)
12         {
13                 // inverse the order
14                 if (s1 < s2)
15                         return 1;
16                 if (s1 > s2)
17                         return -1;
18
19                 return 0;
20         }
21         else
22         {
23                 if (s1 < s2)
24                         return -1;
25                 if (s1 > s2)
26                         return 1;
27
28                 return 0;
29
30         }
31         
32 }
33
34 ///Comparing function for ordering algorithm. Takes parameters as ints.
35 int wxCALLBACK CompareFunctionInts(long item1, long item2, long sortData)
36 {       
37         int val1=atoi((char*)((long*)item1)[1]);
38         int val2=atoi((char*)((long*)item2)[1]);
39         if(sortData==1)
40         {
41                 // inverse the order
42                 if (val1 < val2)
43                         return 1;
44                 if (val1 > val2)
45                         return -1;
46
47                 return 0;
48         }
49         else
50         {
51                 if (val1 < val2)
52                         return -1;
53                 if (val1 > val2)
54                         return 1;
55
56                 return 0;
57
58         }
59         
60 }
61
62 namespace creaImageIO
63 {
64   //=====================================================================
65   // CTor
66   WxTreeView::WxTreeView(TreeHandler* handler,
67                          GimmickView* gimmick,
68                          wxWindow* parent,
69                          const wxWindowID id)
70     : wxPanel(parent,id),
71       TreeView(handler,gimmick)
72   {
73     GimmickDebugMessage(1,"WxTreeView::WxTreeView"
74                         <<std::endl);
75
76     
77     // Split part below toolbar into notebook for views and panel
78     // for preview, messages...
79     // TO DO : Splitter
80     //    mSplitter = new wxSplitterWindow( this , -1);
81
82     // Global sizer
83     wxBoxSizer  *sizer = new wxBoxSizer(wxHORIZONTAL);
84     
85     int ctrl_style = wxLC_REPORT | /*wxLC_VRULES |*/ wxLC_EDIT_LABELS;
86     int col_style = wxLIST_FORMAT_LEFT;
87
88     // Creating the ListCtrl for the levels > 0 (not for Root level)
89     for (int i = 1;
90          i < handler->GetTree().GetNumberOfLevels();
91          ++i)
92       {
93
94         GimmickDebugMessage(5,"Creating view for level "<<i
95                             <<std::endl);
96         LevelType level;
97
98         // If the first level : parent = this
99         wxWindow* sparent = this;
100         // else parent = last splitter
101         if (i>1) sparent = mLevelList[i-2].wxSplitter;
102
103         level.wxSplitter = new wxSplitterWindow( sparent , -1);
104         //          level.wxSplitter->SetMinimumPaneSize(100);
105         
106         wxListCtrl* ctrl = new wxListCtrl(level.wxSplitter,
107                                           i,
108                                           wxDefaultPosition, 
109                                           wxDefaultSize,
110                                           ctrl_style);
111         level.wxCtrl = ctrl;
112         level.wxSplitter->Initialize(ctrl);
113
114         // Create the columns : one for each attribute of the level
115         int col = 0;
116         tree::LevelDescriptor::AttributeDescriptorListType::const_iterator a;
117         for (a  = handler->GetTree().GetAttributeDescriptorList(i).begin();
118              a != handler->GetTree().GetAttributeDescriptorList(i).end();
119              ++a)
120           {
121                   if(col==0)
122                   {
123                     wxListItem it;
124                     it.SetTextColour(*wxRED);
125                     it.SetText(_T("#C"));
126                 
127                     ctrl->InsertColumn(col,it);
128                     col++;
129                   }
130                   
131                 GimmickDebugMessage(5,"Creating column "<<col<<" : "
132                                 <<a->GetName()
133                                 <<std::endl);
134                 ctrl->InsertColumn(col, 
135                                 crea::std2wx(a->GetName()),
136                                 col_style);
137                 level.key.push_back(a->GetKey());
138                 //          ctrl->SetColumnWidth(col, wxLIST_AUTOSIZE );
139                 col++;
140                 
141                 
142           }
143           
144         mLevelList.push_back(level);
145       }
146     
147
148     /// Initialize the first level splitter
149  
150       sizer->Add( mLevelList[0].wxSplitter ,1, wxGROW  ,0);
151         mColumnSelected=1;
152         mLastSelected=0;
153         mDirection=true;
154         mSelectionMade=false;
155         CreateColorPalette();
156     UpdateLevel(1);
157
158     SetSizer( sizer );     
159     SetAutoLayout(true);
160     Layout();
161
162   }
163   //=====================================================================
164
165   //=====================================================================
166   /// Destructor
167   WxTreeView::~WxTreeView()
168   {
169     GimmickDebugMessage(1,"WxTreeView::~WxTreeView"
170                         <<std::endl);
171   }
172   //=====================================================================
173   
174   
175   //=====================================================================
176   struct ItemData
177   {
178     tree::Node* node;
179         int id;
180   };
181  
182   //=====================================================================
183    std::vector<tree::Node*> WxTreeView::GetSelected(int level)
184   {
185     int l = level - 1;
186     // the selection of upper level
187     std::vector<tree::Node*> sel;
188         
189     if (level == 1) 
190       {
191         sel.push_back(GetTreeHandler()->GetTree().GetTree());
192       }
193     else 
194       {
195         int n = GetCtrl(l-1)->GetItemCount();
196         for (int i = 0; i < n; i++)
197           {
198             if ( GetCtrl(l-1)->GetItemState(i,wxLIST_STATE_SELECTED))
199               {
200                 long adr = GetCtrl(l-1)->GetItemData(i);
201                 tree::Node* n = ((ItemData*)adr)->node;
202                         if(mLastSelected==i)
203                         {
204                                 std::vector<tree::Node*>::iterator it;
205                                 it = sel.begin();
206                                 it = sel.insert ( it , n );
207                         }
208                         else
209                         {
210                                 sel.push_back(n);
211                         }
212               }
213           }     
214       }
215          
216           return sel;
217   }
218
219   //=====================================================================
220   
221   ///Removes selected nodes on given level
222   void WxTreeView::RemoveSelected( int level )
223   {
224           std::vector<tree::Node*> sel=GetSelected(level+1);
225           bool erase=false;
226           if (wxMessageBox(_T("Delete file(s) ?"),
227                          _T("Remove Files"),
228                          wxYES_NO,this ) == wxYES)
229           {
230             erase = true;
231           }
232           if(erase)
233           {
234                 std::vector<tree::Node*>::iterator i;
235                 for (i=sel.begin(); i!=sel.end(); ++i)
236                 {
237                         GimmickDebugMessage(2,
238                                         "deleting '"
239                                         <<(*i)->GetLabel()
240                                         <<"'"<<level
241                                         <<std::endl);
242                                 GetTreeHandler()->Remove(*i);
243                 }
244
245                 UpdateLevel(level);
246           }
247           
248   }
249     
250
251   //=====================================================================
252
253  
254   //=====================================================================
255   /// Updates a level of the view (adds or removes children, proganizes, etc.)
256   void WxTreeView::UpdateLevel( int level )
257   {
258     GimmickDebugMessage(1,
259                         GetTreeHandler()->GetTree().GetLabel()
260                         <<" view : updating level "<<level
261                         <<std::endl);
262     
263     wxBusyCursor busy;
264     RecursiveUpdateLevel(level);
265     int i;
266     for (i=0; i<level-1; i++)
267       {
268         if (!GetSplitter(i)->IsSplit()) 
269           GetSplitter(i)->SplitVertically(  GetCtrl(i), GetSplitter(i+1),
270                                             100 );
271       }
272     if (GetSplitter(i)->IsSplit()) GetSplitter(i)->Unsplit();    
273     
274   }
275   //=====================================================================
276   
277   /// Recursive method called upon by UpdateLevel to refresh all windows
278   void WxTreeView::RecursiveUpdateLevel( int level )
279   {
280           GimmickDebugMessage(2,
281                         GetTreeHandler()->GetTree().GetLabel()
282                         <<" view : updating level (recursive)"<<level
283                         <<std::endl);
284
285
286     std::vector<tree::Node*> sel=GetSelected(level);
287
288           int l = level - 1;
289  
290     // to speed up inserting we hide the control temporarily
291     GetCtrl(l)->Hide();
292     GetCtrl(l)->DeleteAllItems();
293     
294     std::vector<tree::Node*>::iterator i;
295     //Adds the first item (filter)
296     GetCtrl(l)->InsertItem(0, _T("Filter:"));
297     for (i=sel.begin(); i!=sel.end(); ++i)
298       {
299         GimmickDebugMessage(2,
300                             "adding children of '"
301                             <<(*i)->GetLabel()
302                             <<"'"<<level
303                             <<std::endl);
304         int _id=1;
305         int colorId=0;
306
307         
308
309         //Adds items (other than the first) and sets their attributes 
310         GetTreeHandler()->LoadChildren(*i,1);
311         tree::Node::ChildrenListType::reverse_iterator j;
312         for (j = (*i)->GetChildrenList().rbegin(); 
313              j!= (*i)->GetChildrenList().rend(); 
314              ++j)
315           {
316             wxListItem item;
317             item.SetMask(wxLIST_MASK_STATE | 
318                          wxLIST_MASK_TEXT |
319                          //                      wxLIST_MASK_IMAGE |
320                          wxLIST_MASK_DATA |
321                          //                      wxLIST_MASK_WIDTH |
322                          wxLIST_MASK_FORMAT
323                          );
324
325             ItemData* data = new ItemData;
326             
327                 data->node = *j;
328                 item.SetId(_id);
329
330                 data->id = _id;
331             item.SetData(data);
332             
333                 _id++;
334             long id=GetCtrl(l)->InsertItem(item);
335                 
336                 //Setting first column (number of children)
337             std::ostringstream oss;
338             int n= GetTreeHandler()->GetNumberOfChildren(*j);
339             oss << n;
340             std::string s(oss.str());
341             item.SetText( crea::std2wx(s));
342         
343                 //Setting the color according to the parent
344                 if(l==0)
345                 {
346                 item.SetBackgroundColour
347                   (wxColourDatabase().Find
348                    (crea::std2wx(mColorPalette[colorId]))); 
349                 mColorMap.insert
350                   (NodeColorPair
351                    (*j,wxColourDatabase().Find
352                     (crea::std2wx(mColorPalette[colorId]))));
353                 if(colorId<64)
354                   {
355                     colorId++;
356                   }
357                 else
358                         {
359                           colorId=0;
360                         }
361                 }
362                 else if(l!=mLevelList.size()-1)
363                   {
364                     item.SetBackgroundColour(mColorMap[*i]); 
365                         mColorMap.insert(NodeColorPair(*j,mColorMap[*i]));
366                 }
367                 else
368                 {
369                         item.SetBackgroundColour(mColorMap[*i]); 
370                 }
371                 
372
373             item.SetColumn(0);
374             GetCtrl(l)->SetItem(item);
375                 
376                 //Setting other attributes
377           for (int k=1; k<GetCtrl(l)->GetColumnCount(); k++)
378               {
379   
380                 std::string val = (*j)->GetAttribute(mLevelList[l].key[k-1]);
381                 if (val.size()==0) val = "?";
382                 item.SetText( crea::std2wx(val));
383                 item.SetColumn(k);
384                 GetCtrl(l)->SetItem(item);      
385               }     
386           }
387       }
388     
389     GetCtrl(l)->Show();
390         
391     
392     if (level<mLevelList.size()) UpdateLevel(level+1);
393         
394  }
395   //=====================================================================
396
397
398   //================================================================
399   void WxTreeView::OnSelectedChanged(wxListEvent& event)
400   { 
401     GimmickDebugMessage(1,
402                         GetTreeHandler()->GetTree().GetLabel()
403                         <<" view : item selected "
404                         <<std::endl);
405
406     wxListItem info;
407     info.m_itemId = event.m_itemIndex;
408     mLastSelected=event.m_itemIndex;
409         // retrieve the level
410         wxObject* obj = event.GetEventObject();   
411         unsigned int level = 0;
412         for (level = 0; level<mLevelList.size(); ++level)
413         {
414         if ( GetCtrl(level) == obj ) break;
415         }
416         GimmickDebugMessage(1,
417                         " Level "<<level+1
418                         <<std::endl);
419
420         if(event.m_itemIndex!=0)
421         {
422                 if(level<mLevelList.size()-1)
423                 {
424                 mSelected=GetSelected(level+2);
425                 }
426                 else
427                 {
428                 mLastLevelSelected=GetSelected(level+2);
429                 }
430                 
431                 if (level<mLevelList.size()-1) 
432                 {
433                         UpdateLevel( level + 2 ); 
434                         GetGimmickView()->ClearSelection();
435                 }
436                 if (level==mLevelList.size()-2) SelectLowerLevel();
437                 if (level==mLevelList.size()-1) ValidateSelectedImages ();
438         }
439         else
440         {
441                 if(event.GetEventType()==10145)
442                 {
443                 
444                 GetCtrl(level)->SetItemText(0,crea::std2wx(""));
445                 GetCtrl(level)->EditLabel(event.m_itemIndex);
446                 }
447                 
448         }
449         
450   }
451   //================================================================
452
453   //================================================================
454   void WxTreeView::SelectLowerLevel()
455   {
456         long item = -1;
457         int level=mLevelList.size()-1;
458     for ( ;; )
459     {
460                 item = GetCtrl(level)->GetNextItem(item,
461                                      wxLIST_NEXT_ALL);
462         if ( item == -1 )
463             break;
464                 if(item!=0)
465                 {
466                 GetCtrl(level)->SetItemState(item,wxLIST_STATE_SELECTED, wxLIST_MASK_STATE 
467                 | wxLIST_MASK_TEXT |wxLIST_MASK_IMAGE | wxLIST_MASK_DATA | wxLIST_MASK_WIDTH | wxLIST_MASK_FORMAT);
468                 }
469     }
470
471         
472   }
473
474   //================================================================
475
476   //================================================================
477   void WxTreeView::OnColClick(wxListEvent& event)
478   {       
479         //Obtain the column name and the level that needs to be organized
480         mColumnSelected=event.m_col;
481     GimmickDebugMessage(1,
482                 " Column selected: " <<event.m_col
483                         <<std::endl);
484
485         if(mColumnSelected!=0)
486         {
487                 wxObject* ctrl = event.GetEventObject(); 
488                 unsigned int level = 0;
489                 for (level = 0; level<mLevelList.size(); ++level)
490                 {
491                 if ( GetCtrl(level) == ctrl ) break;
492                 }
493                 
494                 wxBusyCursor busy;
495          
496                 int l = level - 1;
497                 GetCtrl(level)->DeleteItem(0);
498                 //Sets the data for the items to be sorted
499                 std::string att;
500                 unsigned int ty=0;
501                 int n = GetCtrl(level)->GetItemCount();
502                 for (int i = 0; i < n; i++)
503                 {
504                           
505                         //Gets current item data
506                         long adr = GetCtrl(level)->GetItemData(i);
507                         //Extracts the node and the type of attribute
508                         tree::Node* nod = ((ItemData*)adr)->node;
509                         if(i==0)
510                         {
511                                 (*nod).GetAttributeDescriptor(mLevelList[level].key[mColumnSelected-1]).DecodeType(ty);
512                         }
513                         //Obtains the organizing attribute
514                         att=(*nod).GetAttribute(mLevelList[level].key[mColumnSelected-1]);
515                         
516                         char* d= new char [att.size()+1];
517                         strcpy (d, att.c_str());
518
519                         //Creates array
520                         long* lp= new long[2];
521                         lp[0]=adr;
522                         lp[1]=(long)d;
523                          
524                         //Sets it as the data
525                         GetCtrl(level)->SetItemData(i,(long)lp);
526                 }       
527                   
528                 if(mDirection)
529                 {
530                         if(ty==1)
531                         {
532                                 GetCtrl(level)->SortItems(CompareFunctionInts, 0);
533                         }
534                         else
535                         {
536                                 GetCtrl(level)->SortItems(CompareFunctionStrings, 0);
537                         }
538                         
539                         mDirection=false;
540                 }
541                 else
542                 {
543                         if(ty==1)
544                         {
545                                 GetCtrl(level)->SortItems(CompareFunctionInts, 1);
546                         }
547                         else
548                         {
549                                 GetCtrl(level)->SortItems(CompareFunctionStrings, 1);
550                         }
551                         mDirection=true;
552                 }
553
554                 //Resets original data
555                 std::vector<tree::Node*>::iterator selection;
556                 std::vector<long> change;
557                 long it = -1;
558                 for ( ;; )
559                 {
560                         it = GetCtrl(level)->GetNextItem(it,
561                                                                                 wxLIST_NEXT_ALL);
562                         if ( it == -1 )
563                                 break;
564                         
565                         //Gets current item data, extracts the node and resets it
566                         long item = GetCtrl(level)->GetItemData(it);
567                         GetCtrl(level)->SetItemData(it,((long*)item)[0]);
568                         tree::Node* n= ((ItemData*)((long*)item)[0])->node;
569                         if(level<mLevelList.size()-1)
570                         {
571                                 for(selection=mSelected.begin();selection!=mSelected.end();++selection)
572                                 {
573                                         if((*selection)->GetAttribute("ID").compare(n->GetAttribute("ID"))==0)
574                                         {
575                                                 change.push_back(it);   
576                                         }
577                                 }
578                         }
579                         else
580                         {
581                                 for(selection=mLastLevelSelected.begin();selection!=mLastLevelSelected.end();++selection)
582                                 {
583                                         if((*selection)->GetAttribute("ID").compare(n->GetAttribute("ID"))==0)
584                                         {
585                                                 change.push_back(it);   
586                                         }
587                                 }
588                         }
589                         
590                         
591                 }
592                 //Resets the selected items
593                 std::vector<long>::iterator selectedIts;
594                 for(selectedIts=change.begin();selectedIts!=change.end();++selectedIts)
595                 {
596                         GetCtrl(level)->SetItemState(*selectedIts,wxLIST_STATE_SELECTED, wxLIST_MASK_STATE 
597                 | wxLIST_MASK_TEXT |wxLIST_MASK_IMAGE | wxLIST_MASK_DATA | wxLIST_MASK_WIDTH | wxLIST_MASK_FORMAT);
598                         
599                 }
600                 GetCtrl(level)->InsertItem(0,_T("Filter:"));
601         }
602         
603    }
604   //================================================================
605   void WxTreeView::OnBeginLabelEdit(wxListEvent& event)
606   {
607         GimmickDebugMessage(7,
608                         "WxTreeView::OnBeginLabelEdit" 
609                         <<std::endl);
610         if(event.m_itemIndex!=0)
611         {
612                 event.Veto();
613         }
614
615   }
616
617   //================================================================
618   void WxTreeView::OnEndLabelEdit(wxListEvent& event)
619   {
620           GimmickDebugMessage(7,
621                         "WxTreeView::OnEndLabelEdit" 
622                         <<std::endl);
623           wxObject* ctrl = event.GetEventObject(); 
624                 unsigned int level = 0;
625                 for (level = 0; level<mLevelList.size(); ++level)
626                 {
627                 if ( GetCtrl(level) == ctrl ) break;
628                 }
629                 std::string filter = crea::wx2std(event.m_item.m_text.c_str());
630                 
631                 std::string att;
632                 
633                 long it = -1;
634                 UpdateLevel(level+1);
635                 
636                 for ( ;; )
637                 {
638                         bool contains=false;
639                         it = GetCtrl(level)->GetNextItem(it,
640                                                                                 wxLIST_NEXT_ALL);
641                         if ( it == -1 )
642                                 break;
643                         if(it!=0)
644                         {
645                                 long adr = GetCtrl(level)->GetItemData(it);
646                                 for (int j=1;j<GetCtrl(level)->GetColumnCount()-1&&!contains;j++)
647                                 {
648                                 tree::Node* nod = ((ItemData*)adr)->node;
649                                 att=(*nod).GetAttribute(mLevelList[level].key[j-1]);
650                         
651                                 if(att.find(filter)<900)
652                                 {
653                                         contains=true;
654                                 }
655                                 }
656                                 if(!contains)
657                                 {
658                                         GetCtrl(level)->DeleteItem(it);
659                                 }
660                         }
661                 }
662                 GetGimmickView()->ClearSelection();
663                 //GetCtrl(level)->DeleteAllItems();
664
665   }
666   //================================================================
667   void WxTreeView::ValidateSelectedImages()
668   {
669     GimmickDebugMessage(7,
670                         "WxTreeView::ValidateSelectedImages" 
671                         <<std::endl);
672     std::vector<tree::Node*> sel(GetSelected(mLevelList.size()+1));
673         GetGimmickView()->OnSelectionChange(sel);
674  
675   }
676   //================================================================
677
678
679   //================================================================
680   void WxTreeView::GetNodes(std::vector<tree::Node*>& nodes, bool direction)
681   {
682         long item = mLastSelected;
683         int level=mLevelList.size()-1;
684         //Gets current item data
685         long adr = GetCtrl(level)->GetItemData(item);
686         //Extracts the node
687         tree::Node* nod = ((ItemData*)adr)->node;
688     for ( ;; )
689     {
690                 if(direction)
691                 {
692                         item = GetCtrl(level)->GetNextItem(item,
693                                      wxLIST_NEXT_ABOVE);
694                 }
695                 else
696                 {
697                         item = GetCtrl(level)->GetNextItem(item,
698                                      wxLIST_NEXT_BELOW);
699                 }
700         if ( item == -1  )
701                 {
702             break;
703                 }
704                 if(GetCtrl(level)->GetItemState(item, wxLIST_STATE_SELECTED)==0 && item!=0)
705                 {
706                         adr = GetCtrl(level)->GetItemData(item);
707                         nod = ((ItemData*)adr)->node;
708                         nodes.push_back(nod);
709                 }
710     }
711
712   }
713
714   //================================================================
715   void WxTreeView::GetSelectedAsString(std::vector<std::string>&s)
716   {
717           int level=mLevelList.size();
718         std::vector<tree::Node*> sel=GetSelected(level+1);
719         std::vector<tree::Node*>::iterator i;
720         
721     for (i=sel.begin(); i!=sel.end(); ++i)
722       {
723                   std::string filename=(*i)->GetAttribute("FullFileName");
724                   s.push_back(filename);
725           }
726   }
727
728   //================================================================
729   void WxTreeView::CreateColorPalette()
730   {
731   GimmickDebugMessage(6,"WxTreeView::CreateColorPalette");
732   mColorPalette.push_back("WHITE");
733   mColorPalette.push_back("LIGHT GREY");
734   mColorPalette.push_back("AQUAMARINE");
735   mColorPalette.push_back("MEDIUM FOREST GREEN");
736   mColorPalette.push_back("INDIAN RED");
737   mColorPalette.push_back("KHAKI");
738   mColorPalette.push_back("ORANGE");
739   mColorPalette.push_back("LIGHT BLUE");
740   mColorPalette.push_back("LIGHT STEEL BLUE");
741   mColorPalette.push_back("PINK");
742   mColorPalette.push_back("PLUM");
743   mColorPalette.push_back("PURPLE");
744   mColorPalette.push_back("RED");
745   mColorPalette.push_back("SEA GREEN");
746   mColorPalette.push_back("SIENNA");
747   mColorPalette.push_back("SKY BLUE");
748   mColorPalette.push_back("SLATE BLUE");
749   mColorPalette.push_back("SPRING GREEN");
750   mColorPalette.push_back("TAN");
751   mColorPalette.push_back("THISTLE");
752   mColorPalette.push_back("TURQUOISE");
753   mColorPalette.push_back("VIOLET");
754   mColorPalette.push_back("VIOLET RED");
755   mColorPalette.push_back("WHEAT");
756   mColorPalette.push_back("YELLOW");
757   mColorPalette.push_back("YELLOW GREEN");
758   mColorPalette.push_back("BLUE");
759   mColorPalette.push_back("BLUE VIOLET");
760   mColorPalette.push_back("BROWN");
761   mColorPalette.push_back("CADET BLUE");
762   mColorPalette.push_back("CORAL");
763   mColorPalette.push_back("CORNFLOWER BLUE");
764   mColorPalette.push_back("CYAN");
765   mColorPalette.push_back("DARK GREY");
766   mColorPalette.push_back("DARK GREEN");
767   mColorPalette.push_back("DARK OLIVE GREEN");
768   mColorPalette.push_back("DARK ORCHID");
769   mColorPalette.push_back("DARK SLATE BLUE");
770   mColorPalette.push_back("DARK SLATE GREY");
771   mColorPalette.push_back("DARK TURQUOISE");
772   mColorPalette.push_back("FIREBRICK");
773   mColorPalette.push_back("FOREST GREEN");
774   mColorPalette.push_back("GOLD");
775   mColorPalette.push_back("GOLDENROD");
776   mColorPalette.push_back("GREY");
777   mColorPalette.push_back("GREEN");
778   mColorPalette.push_back("GREEN YELLOW");
779   mColorPalette.push_back("LIME GREEN");
780   mColorPalette.push_back("MAGENTA");
781   mColorPalette.push_back("MAROON");
782   mColorPalette.push_back("MEDIUM AQUAMARINE");
783   mColorPalette.push_back("MEDIUM BLUE");
784   mColorPalette.push_back("MEDIUM GOLDENROD");
785   mColorPalette.push_back("MEDIUM ORCHID");
786   mColorPalette.push_back("MEDIUM SEA GREEN");
787   mColorPalette.push_back("MEDIUM SLATE BLUE");
788   mColorPalette.push_back("MEDIUM SPRING GREEN");
789   mColorPalette.push_back("MEDIUM TURQUOISE");
790   mColorPalette.push_back("MEDIUM VIOLET RED");
791   mColorPalette.push_back("MIDNIGHT BLUE");
792   mColorPalette.push_back("NAVY");
793   mColorPalette.push_back("ORANGE RED");
794   mColorPalette.push_back("ORCHID, PALE GREEN");
795   mColorPalette.push_back("STEEL BLUE");
796   mColorPalette.push_back("BLACK");
797
798
799   }
800   //================================================================
801   BEGIN_EVENT_TABLE(WxTreeView, wxPanel)
802   /*
803     EVT_SIZE(MyFrame::OnSize)
804
805     EVT_MENU(LIST_QUIT, MyFrame::OnQuit)
806     EVT_MENU(LIST_ABOUT, MyFrame::OnAbout)
807     EVT_MENU(LIST_LIST_VIEW, MyFrame::OnListView)
808     EVT_MENU(LIST_REPORT_VIEW, MyFrame::OnReportView)
809     EVT_MENU(LIST_ICON_VIEW, MyFrame::OnIconView)
810     EVT_MENU(LIST_ICON_TEXT_VIEW, MyFrame::OnIconTextView)
811     EVT_MENU(LIST_SMALL_ICON_VIEW, MyFrame::OnSmallIconView)
812     EVT_MENU(LIST_SMALL_ICON_TEXT_VIEW, MyFrame::OnSmallIconTextView)
813     EVT_MENU(LIST_VIRTUAL_VIEW, MyFrame::OnVirtualView)
814     EVT_MENU(LIST_SMALL_VIRTUAL_VIEW, MyFrame::OnSmallVirtualView)
815
816     EVT_MENU(LIST_FOCUS_LAST, MyFrame::OnFocusLast)
817     EVT_MENU(LIST_TOGGLE_FIRST, MyFrame::OnToggleFirstSel)
818     EVT_MENU(LIST_DESELECT_ALL, MyFrame::OnDeselectAll)
819     EVT_MENU(LIST_SELECT_ALL, MyFrame::OnSelectAll)
820     EVT_MENU(LIST_DELETE, MyFrame::OnDelete)
821     EVT_MENU(LIST_ADD, MyFrame::OnAdd)
822     EVT_MENU(LIST_EDIT, MyFrame::OnEdit)
823     EVT_MENU(LIST_DELETE_ALL, MyFrame::OnDeleteAll)
824     EVT_MENU(LIST_SORT, MyFrame::OnSort)
825     EVT_MENU(LIST_SET_FG_COL, MyFrame::OnSetFgColour)
826     EVT_MENU(LIST_SET_BG_COL, MyFrame::OnSetBgColour)
827     EVT_MENU(LIST_TOGGLE_MULTI_SEL, MyFrame::OnToggleMultiSel)
828     EVT_MENU(LIST_SHOW_COL_INFO, MyFrame::OnShowColInfo)
829     EVT_MENU(LIST_SHOW_SEL_INFO, MyFrame::OnShowSelInfo)
830     EVT_MENU(LIST_FREEZE, MyFrame::OnFreeze)
831     EVT_MENU(LIST_THAW, MyFrame::OnThaw)
832     EVT_MENU(LIST_TOGGLE_LINES, MyFrame::OnToggleLines)
833     EVT_MENU(LIST_MAC_USE_GENERIC, MyFrame::OnToggleMacUseGeneric)
834
835     EVT_UPDATE_UI(LIST_SHOW_COL_INFO, MyFrame::OnUpdateShowColInfo)
836     EVT_UPDATE_UI(LIST_TOGGLE_MULTI_SEL, MyFrame::OnUpdateToggleMultiSel)
837 END_EVENT_TABLE()
838
839 BEGIN_EVENT_TABLE(MyListCtrl, wxListCtrl)
840     EVT_LIST_BEGIN_DRAG(LIST_CTRL, MyListCtrl::OnBeginDrag)
841     EVT_LIST_BEGIN_RDRAG(LIST_CTRL, MyListCtrl::OnBeginRDrag)
842         */
843     EVT_LIST_BEGIN_LABEL_EDIT(-1, WxTreeView::OnBeginLabelEdit)
844     EVT_LIST_END_LABEL_EDIT(-1, WxTreeView::OnEndLabelEdit)
845         /*
846     EVT_LIST_DELETE_ITEM(LIST_CTRL, MyListCtrl::OnDeleteItem)
847     EVT_LIST_DELETE_ALL_ITEMS(LIST_CTRL, MyListCtrl::OnDeleteAllItems)
848 #if WXWIN_COMPATIBILITY_2_4
849     EVT_LIST_GET_INFO(LIST_CTRL, MyListCtrl::OnGetInfo)
850     EVT_LIST_SET_INFO(LIST_CTRL, MyListCtrl::OnSetInfo)
851 #endif
852   */
853     EVT_LIST_ITEM_SELECTED(-1, WxTreeView::OnSelectedChanged)
854   
855     EVT_LIST_ITEM_DESELECTED(-1, WxTreeView::OnSelectedChanged)
856         /*
857     EVT_LIST_KEY_DOWN(LIST_CTRL, MyListCtrl::OnListKeyDown)
858     EVT_LIST_ITEM_ACTIVATED(LIST_CTRL, MyListCtrl::OnActivated)
859     EVT_LIST_ITEM_FOCUSED(LIST_CTRL, MyListCtrl::OnFocused)
860
861     EVT_LIST_COL_RIGHT_CLICK(LIST_CTRL, MyListCtrl::OnColRightClick)
862         */
863     EVT_LIST_COL_CLICK(-1, WxTreeView::OnColClick)
864         /*
865     EVT_LIST_COL_BEGIN_DRAG(LIST_CTRL, MyListCtrl::OnColBeginDrag)
866     EVT_LIST_COL_DRAGGING(LIST_CTRL, MyListCtrl::OnColDragging)
867     EVT_LIST_COL_END_DRAG(LIST_CTRL, MyListCtrl::OnColEndDrag)
868
869     EVT_LIST_CACHE_HINT(LIST_CTRL, MyListCtrl::OnCacheHint)
870
871 #if USE_CONTEXT_MENU
872     EVT_CONTEXT_MENU(MyListCtrl::OnContextMenu)
873 #endif
874     EVT_CHAR(MyListCtrl::OnChar)
875
876     EVT_RIGHT_DOWN(MyListCtrl::OnRightClick)
877   */
878 END_EVENT_TABLE()
879   
880 } // EO namespace creaImageIO
881