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