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