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