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