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