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