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