]> Creatis software - creaImageIO.git/blob - src2/creaImageIOWxTreeView.cpp
Validate is now linear
[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         GimmickMessage(1,
393                         " Event type "<<event.GetEventType()
394                         <<std::endl);
395         if(event.m_itemIndex!=0)
396         {
397                 if(level<mLevelList.size()-1)
398                 {
399                 mSelected=GetSelected(level+2);
400                 }
401                 else if(mProcess)
402                 {
403                 mLastLevelSelected=GetSelected(level+2);
404                 }
405                 else
406                 {
407                         event.Veto();
408                 }
409                 
410                 if (level<mLevelList.size()-1) 
411                 {
412                         UpdateLevel( level + 2 ); 
413                         GetGimmickView()->ClearSelection();
414                 }
415                 if (level==mLevelList.size()-2) SelectLowerLevel();
416                 if (level==(mLevelList.size()-1)&&mProcess) 
417                 {
418                         if(event.GetEventType()==10145)
419                         {
420                         ValidateSelectedImages (true);
421                         }
422                         else
423                         {
424                                 ValidateSelectedImages (false);
425                         }
426                 }
427                 //SetColor(level,event.m_itemIndex);
428         }
429         else
430         {
431                 if(event.GetEventType()==10145)
432                 {
433                 
434                 GetCtrl(level)->SetItemText(0,crea::std2wx(""));
435                 GetCtrl(level)->EditLabel(event.m_itemIndex);
436                 }
437                 
438         }
439         
440         
441   }
442   //================================================================
443
444   //================================================================
445   void WxTreeView::SelectLowerLevel()
446   {
447         long item = -1;
448         int level=mLevelList.size()-1;
449         
450     for ( ;; )
451     {
452                 item = GetCtrl(level)->GetNextItem(item,
453                                      wxLIST_NEXT_ALL);
454         if ( item == -1 )
455             break;
456
457                 if(item==(GetCtrl(level)->GetItemCount()-1))
458                 {
459                         mProcess=true;
460                 }
461                 else
462                 {
463                         mProcess=false;
464                 }
465
466                 if(item!=0)
467                 {
468                 GetCtrl(level)->SetItemState(item,wxLIST_STATE_SELECTED, wxLIST_MASK_STATE 
469                 | wxLIST_MASK_TEXT |wxLIST_MASK_IMAGE | wxLIST_MASK_DATA | wxLIST_MASK_WIDTH | wxLIST_MASK_FORMAT);
470                 }
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(bool isSelection)
671   {
672     GimmickDebugMessage(7,
673                         "WxTreeView::ValidateSelectedImages" 
674                         <<std::endl);
675     std::vector<tree::Node*> sel(GetSelected(mLevelList.size()+1));
676         GetGimmickView()->OnSelectionChange(sel,isSelection,(mLastSelected-1), mProcess);
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::SetColor(int l, int item)
733   {
734           int colorId=12;
735           GetCtrl(l)->SetItemTextColour(item, wxColourDatabase().Find
736                    (crea::std2wx(mColorPalette[colorId])));
737           GetCtrl(l)->SetItemState(item,wxLIST_STATE_SELECTED | wxLIST_STATE_FOCUSED, wxLIST_STATE_SELECTED);  /*
738           int colorId=0;
739           //Setting the color according to the parent
740                 if(l==0)
741                 {
742                 item.SetBackgroundColour
743                   (wxColourDatabase().Find
744                    (crea::std2wx(mColorPalette[colorId]))); 
745                 mColorMap.insert
746                   (NodeColorPair
747                    (*j,wxColourDatabase().Find
748                     (crea::std2wx(mColorPalette[colorId]))));
749                 if(colorId<64)
750                   {
751                     colorId++;
752                   }
753                 else
754                         {
755                           colorId=0;
756                         }
757                 }
758                 else if(l!=mLevelList.size()-1)
759                   {
760                     item.SetBackgroundColour(mColorMap[*i]); 
761                         mColorMap.insert(NodeColorPair(*j,mColorMap[*i]));
762                 }
763                 else
764                 {
765                         item.SetBackgroundColour(mColorMap[*i]); 
766                 }*/
767   }
768   //================================================================
769   void WxTreeView::CreateColorPalette()
770   {
771   GimmickDebugMessage(6,"WxTreeView::CreateColorPalette");
772   mColorPalette.push_back("WHITE");
773   mColorPalette.push_back("LIGHT GREY");
774   mColorPalette.push_back("AQUAMARINE");
775   mColorPalette.push_back("MEDIUM FOREST GREEN");
776   mColorPalette.push_back("INDIAN RED");
777   mColorPalette.push_back("KHAKI");
778   mColorPalette.push_back("ORANGE");
779   mColorPalette.push_back("LIGHT BLUE");
780   mColorPalette.push_back("LIGHT STEEL BLUE");
781   mColorPalette.push_back("PINK");
782   mColorPalette.push_back("PLUM");
783   mColorPalette.push_back("PURPLE");
784   mColorPalette.push_back("RED");
785   mColorPalette.push_back("SEA GREEN");
786   mColorPalette.push_back("SIENNA");
787   mColorPalette.push_back("SKY BLUE");
788   mColorPalette.push_back("SLATE BLUE");
789   mColorPalette.push_back("SPRING GREEN");
790   mColorPalette.push_back("TAN");
791   mColorPalette.push_back("THISTLE");
792   mColorPalette.push_back("TURQUOISE");
793   mColorPalette.push_back("VIOLET");
794   mColorPalette.push_back("VIOLET RED");
795   mColorPalette.push_back("WHEAT");
796   mColorPalette.push_back("YELLOW");
797   mColorPalette.push_back("YELLOW GREEN");
798   mColorPalette.push_back("BLUE");
799   mColorPalette.push_back("BLUE VIOLET");
800   mColorPalette.push_back("BROWN");
801   mColorPalette.push_back("CADET BLUE");
802   mColorPalette.push_back("CORAL");
803   mColorPalette.push_back("CORNFLOWER BLUE");
804   mColorPalette.push_back("CYAN");
805   mColorPalette.push_back("DARK GREY");
806   mColorPalette.push_back("DARK GREEN");
807   mColorPalette.push_back("DARK OLIVE GREEN");
808   mColorPalette.push_back("DARK ORCHID");
809   mColorPalette.push_back("DARK SLATE BLUE");
810   mColorPalette.push_back("DARK SLATE GREY");
811   mColorPalette.push_back("DARK TURQUOISE");
812   mColorPalette.push_back("FIREBRICK");
813   mColorPalette.push_back("FOREST GREEN");
814   mColorPalette.push_back("GOLD");
815   mColorPalette.push_back("GOLDENROD");
816   mColorPalette.push_back("GREY");
817   mColorPalette.push_back("GREEN");
818   mColorPalette.push_back("GREEN YELLOW");
819   mColorPalette.push_back("LIME GREEN");
820   mColorPalette.push_back("MAGENTA");
821   mColorPalette.push_back("MAROON");
822   mColorPalette.push_back("MEDIUM AQUAMARINE");
823   mColorPalette.push_back("MEDIUM BLUE");
824   mColorPalette.push_back("MEDIUM GOLDENROD");
825   mColorPalette.push_back("MEDIUM ORCHID");
826   mColorPalette.push_back("MEDIUM SEA GREEN");
827   mColorPalette.push_back("MEDIUM SLATE BLUE");
828   mColorPalette.push_back("MEDIUM SPRING GREEN");
829   mColorPalette.push_back("MEDIUM TURQUOISE");
830   mColorPalette.push_back("MEDIUM VIOLET RED");
831   mColorPalette.push_back("MIDNIGHT BLUE");
832   mColorPalette.push_back("NAVY");
833   mColorPalette.push_back("ORANGE RED");
834   mColorPalette.push_back("ORCHID, PALE GREEN");
835   mColorPalette.push_back("STEEL BLUE");
836   mColorPalette.push_back("BLACK");
837
838
839   }
840   //================================================================
841   BEGIN_EVENT_TABLE(WxTreeView, wxPanel)
842   /*
843     EVT_SIZE(MyFrame::OnSize)
844
845     EVT_MENU(LIST_QUIT, MyFrame::OnQuit)
846     EVT_MENU(LIST_ABOUT, MyFrame::OnAbout)
847     EVT_MENU(LIST_LIST_VIEW, MyFrame::OnListView)
848     EVT_MENU(LIST_REPORT_VIEW, MyFrame::OnReportView)
849     EVT_MENU(LIST_ICON_VIEW, MyFrame::OnIconView)
850     EVT_MENU(LIST_ICON_TEXT_VIEW, MyFrame::OnIconTextView)
851     EVT_MENU(LIST_SMALL_ICON_VIEW, MyFrame::OnSmallIconView)
852     EVT_MENU(LIST_SMALL_ICON_TEXT_VIEW, MyFrame::OnSmallIconTextView)
853     EVT_MENU(LIST_VIRTUAL_VIEW, MyFrame::OnVirtualView)
854     EVT_MENU(LIST_SMALL_VIRTUAL_VIEW, MyFrame::OnSmallVirtualView)
855
856     EVT_MENU(LIST_FOCUS_LAST, MyFrame::OnFocusLast)
857     EVT_MENU(LIST_TOGGLE_FIRST, MyFrame::OnToggleFirstSel)
858     EVT_MENU(LIST_DESELECT_ALL, MyFrame::OnDeselectAll)
859     EVT_MENU(LIST_SELECT_ALL, MyFrame::OnSelectAll)
860     EVT_MENU(LIST_DELETE, MyFrame::OnDelete)
861     EVT_MENU(LIST_ADD, MyFrame::OnAdd)
862     EVT_MENU(LIST_EDIT, MyFrame::OnEdit)
863     EVT_MENU(LIST_DELETE_ALL, MyFrame::OnDeleteAll)
864     EVT_MENU(LIST_SORT, MyFrame::OnSort)
865     EVT_MENU(LIST_SET_FG_COL, MyFrame::OnSetFgColour)
866     EVT_MENU(LIST_SET_BG_COL, MyFrame::OnSetBgColour)
867     EVT_MENU(LIST_TOGGLE_MULTI_SEL, MyFrame::OnToggleMultiSel)
868     EVT_MENU(LIST_SHOW_COL_INFO, MyFrame::OnShowColInfo)
869     EVT_MENU(LIST_SHOW_SEL_INFO, MyFrame::OnShowSelInfo)
870     EVT_MENU(LIST_FREEZE, MyFrame::OnFreeze)
871     EVT_MENU(LIST_THAW, MyFrame::OnThaw)
872     EVT_MENU(LIST_TOGGLE_LINES, MyFrame::OnToggleLines)
873     EVT_MENU(LIST_MAC_USE_GENERIC, MyFrame::OnToggleMacUseGeneric)
874
875     EVT_UPDATE_UI(LIST_SHOW_COL_INFO, MyFrame::OnUpdateShowColInfo)
876     EVT_UPDATE_UI(LIST_TOGGLE_MULTI_SEL, MyFrame::OnUpdateToggleMultiSel)
877 END_EVENT_TABLE()
878
879 BEGIN_EVENT_TABLE(MyListCtrl, wxListCtrl)
880     EVT_LIST_BEGIN_DRAG(LIST_CTRL, MyListCtrl::OnBeginDrag)
881     EVT_LIST_BEGIN_RDRAG(LIST_CTRL, MyListCtrl::OnBeginRDrag)
882         */
883     EVT_LIST_BEGIN_LABEL_EDIT(-1, WxTreeView::OnBeginLabelEdit)
884     EVT_LIST_END_LABEL_EDIT(-1, WxTreeView::OnEndLabelEdit)
885         /*
886     EVT_LIST_DELETE_ITEM(LIST_CTRL, MyListCtrl::OnDeleteItem)
887     EVT_LIST_DELETE_ALL_ITEMS(LIST_CTRL, MyListCtrl::OnDeleteAllItems)
888 #if WXWIN_COMPATIBILITY_2_4
889     EVT_LIST_GET_INFO(LIST_CTRL, MyListCtrl::OnGetInfo)
890     EVT_LIST_SET_INFO(LIST_CTRL, MyListCtrl::OnSetInfo)
891 #endif
892   */
893     EVT_LIST_ITEM_SELECTED(-1, WxTreeView::OnSelectedChanged)
894   
895     EVT_LIST_ITEM_DESELECTED(-1, WxTreeView::OnSelectedChanged)
896         /*
897     EVT_LIST_KEY_DOWN(LIST_CTRL, MyListCtrl::OnListKeyDown)
898     EVT_LIST_ITEM_ACTIVATED(LIST_CTRL, MyListCtrl::OnActivated)
899     EVT_LIST_ITEM_FOCUSED(LIST_CTRL, MyListCtrl::OnFocused)
900
901     EVT_LIST_COL_RIGHT_CLICK(LIST_CTRL, MyListCtrl::OnColRightClick)
902         */
903     EVT_LIST_COL_CLICK(-1, WxTreeView::OnColClick)
904         /*
905     EVT_LIST_COL_BEGIN_DRAG(LIST_CTRL, MyListCtrl::OnColBeginDrag)
906     EVT_LIST_COL_DRAGGING(LIST_CTRL, MyListCtrl::OnColDragging)
907     EVT_LIST_COL_END_DRAG(LIST_CTRL, MyListCtrl::OnColEndDrag)
908
909     EVT_LIST_CACHE_HINT(LIST_CTRL, MyListCtrl::OnCacheHint)
910
911 #if USE_CONTEXT_MENU
912     EVT_CONTEXT_MENU(MyListCtrl::OnContextMenu)
913 #endif
914     EVT_CHAR(MyListCtrl::OnChar)
915
916     EVT_RIGHT_DOWN(MyListCtrl::OnRightClick)
917   */
918 END_EVENT_TABLE()
919   
920 } // EO namespace creaImageIO
921