]> Creatis software - creaImageIO.git/blobdiff - src2/creaImageIOWxTreeView.cpp
Added filtering
[creaImageIO.git] / src2 / creaImageIOWxTreeView.cpp
index f615a6916af72a5743e9c733241710410bf2d04e..a790c03bf78b3b492021bcfe8f0e1873e3ff0c90 100644 (file)
@@ -1,15 +1,74 @@
 #include <creaImageIOWxTreeView.h>
+#include <creaImageIOGimmickView.h>
 #include <creaImageIOSystem.h>
 #include <wx/splitter.h>
+#include <wx/gdicmn.h>
+///Comparing function for ordering algorithm. Takes parameters as strings.
+int wxCALLBACK CompareFunctionStrings(long item1, long item2, long sortData)
+{      
+       std::string s1((char*)((long*)item1)[1]);
+       std::string s2((char*)((long*)item2)[1]);
+       if(sortData==1)
+       {
+               // inverse the order
+               if (s1 < s2)
+                       return 1;
+               if (s1 > s2)
+                       return -1;
+
+               return 0;
+       }
+       else
+       {
+               if (s1 < s2)
+                       return -1;
+               if (s1 > s2)
+                       return 1;
+
+               return 0;
+
+       }
+       
+}
+
+///Comparing function for ordering algorithm. Takes parameters as ints.
+int wxCALLBACK CompareFunctionInts(long item1, long item2, long sortData)
+{      
+       int val1=atoi((char*)((long*)item1)[1]);
+       int val2=atoi((char*)((long*)item2)[1]);
+       if(sortData==1)
+       {
+               // inverse the order
+               if (val1 < val2)
+                       return 1;
+               if (val1 > val2)
+                       return -1;
+
+               return 0;
+       }
+       else
+       {
+               if (val1 < val2)
+                       return -1;
+               if (val1 > val2)
+                       return 1;
+
+               return 0;
+
+       }
+       
+}
 
 namespace creaImageIO
 {
+  //=====================================================================
   // CTor
   WxTreeView::WxTreeView(TreeHandler* handler,
+                        GimmickView* gimmick,
                         wxWindow* parent,
                         const wxWindowID id)
     : wxPanel(parent,id),
-      TreeView(handler)
+      TreeView(handler,gimmick)
   {
     GimmickDebugMessage(1,"WxTreeView::WxTreeView"
                        <<std::endl);
@@ -23,7 +82,7 @@ namespace creaImageIO
     // Global sizer
     wxBoxSizer *sizer = new wxBoxSizer(wxHORIZONTAL);
     
-    int ctrl_style = wxLC_REPORT;
+    int ctrl_style = wxLC_REPORT | /*wxLC_VRULES |*/ wxLC_EDIT_LABELS;
     int col_style = wxLIST_FORMAT_LEFT;
 
     // Creating the ListCtrl for the levels > 0 (not for Root level)
@@ -31,15 +90,27 @@ namespace creaImageIO
         i < handler->GetTree().GetNumberOfLevels();
         ++i)
       {
-       GimmickDebugMessage(5,"Creating ListCtrl for level "<<i
+
+       GimmickDebugMessage(5,"Creating view for level "<<i
                            <<std::endl);
+       LevelType level;
 
-       wxListCtrl* ctrl = new wxListCtrl(this,
+       // If the first level : parent = this
+       wxWindow* sparent = this;
+       // else parent = last splitter
+       if (i>1) sparent = mLevelList[i-2].wxSplitter;
+
+       level.wxSplitter = new wxSplitterWindow( sparent , -1);
+       //          level.wxSplitter->SetMinimumPaneSize(100);
+       
+       wxListCtrl* ctrl = new wxListCtrl(level.wxSplitter,
                                          i,
                                          wxDefaultPosition, 
                                          wxDefaultSize,
                                          ctrl_style);
-       
+       level.wxCtrl = ctrl;
+       level.wxSplitter->Initialize(ctrl);
+
        // Create the columns : one for each attribute of the level
        int col = 0;
        tree::LevelDescriptor::AttributeDescriptorListType::const_iterator a;
@@ -47,39 +118,755 @@ namespace creaImageIO
             a != handler->GetTree().GetAttributeDescriptorList(i).end();
             ++a)
          {
-           GimmickDebugMessage(5,"Creating column "<<col<<" : "
+                 if(col==0)
+                 {
+                   wxListItem it;
+                   it.SetTextColour(*wxRED);
+                   it.SetText(_T("#C"));
+               
+                   ctrl->InsertColumn(col,it);
+                   col++;
+                 }
+                 
+               GimmickDebugMessage(5,"Creating column "<<col<<" : "
                                <<a->GetName()
                                <<std::endl);
-           ctrl->InsertColumn(col, 
-                              crea::std2wx(a->GetName()),
-                              col_style);
-           col++;
+               ctrl->InsertColumn(col, 
+                               crea::std2wx(a->GetName()),
+                               col_style);
+               level.key.push_back(a->GetKey());
+               //          ctrl->SetColumnWidth(col, wxLIST_AUTOSIZE );
+               col++;
+               
+               
          }
-       mListCtrl.push_back(ctrl);
-       sizer->Add( ctrl ,1, wxGROW  ,0);
+         
+       mLevelList.push_back(level);
       }
     
+
+    /// Initialize the first level splitter
+      sizer->Add( mLevelList[0].wxSplitter ,1, wxGROW  ,0);
+       mColumnSelected=1;
+       mLastSelected=0;
+       mDirection=true;
+       mSelectionMade=false;
+       CreateColorPalette();
+    UpdateLevel(1);
+
     SetSizer( sizer );     
     SetAutoLayout(true);
     Layout();
 
   }
+  //=====================================================================
 
+  //=====================================================================
   /// Destructor
   WxTreeView::~WxTreeView()
   {
     GimmickDebugMessage(1,"WxTreeView::~WxTreeView"
                        <<std::endl);
   }
+  //=====================================================================
   
   
-  //
-  void WxTreeView::UpdateView()
+  //=====================================================================
+  struct ItemData
   {
+    tree::Node* node;
+       int id;
+  };
+  //=====================================================================
+   std::vector<tree::Node*> WxTreeView::GetSelected(int level)
+  {
+    int l = level - 1;
+    // the selection of upper level
+    std::vector<tree::Node*> sel;
+       
+    if (level == 1) 
+      {
+       sel.push_back(GetTreeHandler()->GetTree().GetTree());
+      }
+    else 
+      {
+       int n = GetCtrl(l-1)->GetItemCount();
+       for (int i = 0; i < n; i++)
+         {
+           if ( GetCtrl(l-1)->GetItemState(i,wxLIST_STATE_SELECTED))
+             {
+               long adr = GetCtrl(l-1)->GetItemData(i);
+               tree::Node* n = ((ItemData*)adr)->node;
+                       if(mLastSelected==i)
+                       {
+                               std::vector<tree::Node*>::iterator it;
+                               it = sel.begin();
+                               it = sel.insert ( it , n );
+                       }
+                       else
+                       {
+                               sel.push_back(n);
+                       }
+             }
+         }     
+      }
+        
+         return sel;
   }
+
+  //=====================================================================
   
+  ///Removes selected nodes on given level
+  void WxTreeView::RemoveSelected( int level )
+  {
+         std::vector<tree::Node*> sel=GetSelected(level+1);
+         bool erase=false;
+         if (wxMessageBox(_T("Delete file(s) ?"),
+                        _T("Remove Files"),
+                        wxYES_NO,this ) == wxYES)
+         {
+           erase = true;
+         }
+         if(erase)
+         {
+               std::vector<tree::Node*>::iterator i;
+               for (i=sel.begin(); i!=sel.end(); ++i)
+               {
+                       GimmickDebugMessage(2,
+                                       "deleting '"
+                                       <<(*i)->GetLabel()
+                                       <<"'"<<level
+                                       <<std::endl);
+                               GetTreeHandler()->Remove(*i);
+               }
 
+               UpdateLevel(level);
+         }
+         
+  }
+    
+
+  //=====================================================================
+
+  //=====================================================================
+  /// Updates a level of the view (adds or removes children, proganizes, etc.)
+  void WxTreeView::UpdateLevel( int level )
+  {
+    GimmickDebugMessage(1,
+                       GetTreeHandler()->GetTree().GetLabel()
+                       <<" view : updating level "<<level
+                       <<std::endl);
+    
+    wxBusyCursor busy;
+    RecursiveUpdateLevel(level);
+    int i;
+    for (i=0; i<level-1; i++)
+      {
+       if (!GetSplitter(i)->IsSplit()) 
+         GetSplitter(i)->SplitVertically(  GetCtrl(i), GetSplitter(i+1),
+                                           100 );
+      }
+    if (GetSplitter(i)->IsSplit()) GetSplitter(i)->Unsplit();    
+    
+  }
+  //=====================================================================
   
-} // EO namespace creaImageIO
+  /// Recursive method called upon by UpdateLevel to refresh all windows
+  void WxTreeView::RecursiveUpdateLevel( int level )
+  {
+         GimmickDebugMessage(2,
+                       GetTreeHandler()->GetTree().GetLabel()
+                       <<" view : updating level (recursive)"<<level
+                       <<std::endl);
+
+
+    std::vector<tree::Node*> sel=GetSelected(level);
+
+         int l = level - 1;
+    // to speed up inserting we hide the control temporarily
+    GetCtrl(l)->Hide();
+    GetCtrl(l)->DeleteAllItems();
+    
+    std::vector<tree::Node*>::iterator i;
+       //Adds the first item (filter)
+       GetCtrl(l)->InsertItem(0, "Filter:");
+    for (i=sel.begin(); i!=sel.end(); ++i)
+      {
+       GimmickDebugMessage(2,
+                           "adding children of '"
+                           <<(*i)->GetLabel()
+                           <<"'"<<level
+                           <<std::endl);
+       int _id=1;
+       int colorId=0;
+
+       
+
+       //Adds items (other than the first) and sets their attributes 
+       GetTreeHandler()->LoadChildren(*i,1);
+       tree::Node::ChildrenListType::reverse_iterator j;
+       for (j = (*i)->GetChildrenList().rbegin(); 
+            j!= (*i)->GetChildrenList().rend(); 
+            ++j)
+         {
+           wxListItem item;
+           item.SetMask(wxLIST_MASK_STATE | 
+                        wxLIST_MASK_TEXT |
+                        //                      wxLIST_MASK_IMAGE |
+                        wxLIST_MASK_DATA |
+                        //                      wxLIST_MASK_WIDTH |
+                        wxLIST_MASK_FORMAT
+                        );
+
+           ItemData* data = new ItemData;
+           
+               data->node = *j;
+               item.SetId(_id);
+
+               data->id = _id;
+           item.SetData(data);
+           
+               _id++;
+           long id=GetCtrl(l)->InsertItem(item);
+               
+               //Setting first column (number of children)
+           std::ostringstream oss;
+           int n= GetTreeHandler()->GetNumberOfChildren(*j);
+           oss << n;
+           std::string s(oss.str());
+           item.SetText( crea::std2wx(s));
+       
+               //Setting the color according to the parent
+               if(l==0)
+               {
+               item.SetBackgroundColour(wxColourDatabase().Find(mColorPalette[colorId])); 
+                       mColorMap.insert(NodeColorPair(*j,wxColourDatabase().Find(mColorPalette[colorId])));
+                       if(colorId<64)
+                       {
+                       colorId++;
+                       }
+                       else
+                       {
+                       colorId=0;
+                       }
+               }
+               else if(l!=mLevelList.size()-1)
+               {
+                       item.SetBackgroundColour(mColorMap[*i]); 
+                       mColorMap.insert(NodeColorPair(*j,mColorMap[*i]));
+               }
+               else
+               {
+                       item.SetBackgroundColour(mColorMap[*i]); 
+               }
+               
+
+           item.SetColumn(0);
+           GetCtrl(l)->SetItem(item);
+               
+               //Setting other attributes
+         for (int k=1; k<GetCtrl(l)->GetColumnCount(); k++)
+             {
+  
+               std::string val = (*j)->GetAttribute(mLevelList[l].key[k-1]);
+               if (val.size()==0) val = "?";
+               item.SetText( crea::std2wx(val));
+               item.SetColumn(k);
+               GetCtrl(l)->SetItem(item);      
+             }     
+         }
+      }
+    
+    GetCtrl(l)->Show();
+       
+    
+    if (level<mLevelList.size()) UpdateLevel(level+1);
+       
+ }
+  //=====================================================================
+
+
+  //================================================================
+  void WxTreeView::OnSelectedChanged(wxListEvent& event)
+  { 
+    GimmickDebugMessage(1,
+                       GetTreeHandler()->GetTree().GetLabel()
+                       <<" view : item selected "
+                       <<std::endl);
+
+    wxListItem info;
+    info.m_itemId = event.m_itemIndex;
+    mLastSelected=event.m_itemIndex;
+       // retrieve the level
+       wxObject* obj = event.GetEventObject();   
+       unsigned int level = 0;
+       for (level = 0; level<mLevelList.size(); ++level)
+       {
+       if ( GetCtrl(level) == obj ) break;
+       }
+       GimmickDebugMessage(1,
+                       " Level "<<level+1
+                       <<std::endl);
+
+       if(event.m_itemIndex!=0)
+       {
+               if(level<mLevelList.size()-1)
+               {
+               mSelected=GetSelected(level+2);
+               }
+               else
+               {
+               mLastLevelSelected=GetSelected(level+2);
+               }
+               
+               if (level<mLevelList.size()-1) 
+               {
+                       UpdateLevel( level + 2 ); 
+                       GetGimmickView()->ClearSelection();
+               }
+               if (level==mLevelList.size()-2) SelectLowerLevel();
+               if (level==mLevelList.size()-1) ValidateSelectedImages ();
+       }
+       else
+       {
+               if(event.GetEventType()==10145)
+               {
+               
+               GetCtrl(level)->SetItemText(0,crea::std2wx(""));
+               GetCtrl(level)->EditLabel(event.m_itemIndex);
+               }
+               
+       }
+       
+  }
+  //================================================================
+
+  //================================================================
+  void WxTreeView::SelectLowerLevel()
+  {
+       long item = -1;
+       int level=mLevelList.size()-1;
+    for ( ;; )
+    {
+               item = GetCtrl(level)->GetNextItem(item,
+                                     wxLIST_NEXT_ALL);
+        if ( item == -1 )
+            break;
+               if(item!=0)
+               {
+               GetCtrl(level)->SetItemState(item,wxLIST_STATE_SELECTED, wxLIST_MASK_STATE 
+               | wxLIST_MASK_TEXT |wxLIST_MASK_IMAGE | wxLIST_MASK_DATA | wxLIST_MASK_WIDTH | wxLIST_MASK_FORMAT);
+               }
+    }
+
+       
+  }
 
+  //================================================================
+
+  //================================================================
+  void WxTreeView::OnColClick(wxListEvent& event)
+  {      
+       //Obtain the column name and the level that needs to be organized
+       mColumnSelected=event.m_col;
+    GimmickDebugMessage(1,
+               " Column selected: " <<event.m_col
+                       <<std::endl);
+
+       if(mColumnSelected!=0)
+       {
+               wxObject* ctrl = event.GetEventObject(); 
+               unsigned int level = 0;
+               for (level = 0; level<mLevelList.size(); ++level)
+               {
+               if ( GetCtrl(level) == ctrl ) break;
+               }
+               
+               wxBusyCursor busy;
+        
+               int l = level - 1;
+               GetCtrl(level)->DeleteItem(0);
+               //Sets the data for the items to be sorted
+               std::string att;
+               unsigned int ty=0;
+               int n = GetCtrl(level)->GetItemCount();
+               for (int i = 0; i < n; i++)
+               {
+                         
+                       //Gets current item data
+                       long adr = GetCtrl(level)->GetItemData(i);
+                       //Extracts the node and the type of attribute
+                       tree::Node* nod = ((ItemData*)adr)->node;
+                       if(i==0)
+                       {
+                               (*nod).GetAttributeDescriptor(mLevelList[level].key[mColumnSelected-1]).DecodeType(ty);
+                       }
+                       //Obtains the organizing attribute
+                       att=(*nod).GetAttribute(mLevelList[level].key[mColumnSelected-1]);
+                       
+                       char* d= new char [att.size()+1];
+                       strcpy (d, att.c_str());
+
+                       //Creates array
+                       long* lp= new long[2];
+                       lp[0]=adr;
+                       lp[1]=(long)d;
+                        
+                       //Sets it as the data
+                       GetCtrl(level)->SetItemData(i,(long)lp);
+               }       
+                 
+               if(mDirection)
+               {
+                       if(ty==1)
+                       {
+                               GetCtrl(level)->SortItems(CompareFunctionInts, 0);
+                       }
+                       else
+                       {
+                               GetCtrl(level)->SortItems(CompareFunctionStrings, 0);
+                       }
+                       
+                       mDirection=false;
+               }
+               else
+               {
+                       if(ty==1)
+                       {
+                               GetCtrl(level)->SortItems(CompareFunctionInts, 1);
+                       }
+                       else
+                       {
+                               GetCtrl(level)->SortItems(CompareFunctionStrings, 1);
+                       }
+                       mDirection=true;
+               }
+
+               //Resets original data
+               std::vector<tree::Node*>::iterator selection;
+               std::vector<long> change;
+               long it = -1;
+               for ( ;; )
+               {
+                       it = GetCtrl(level)->GetNextItem(it,
+                                                                               wxLIST_NEXT_ALL);
+                       if ( it == -1 )
+                               break;
+                       
+                       //Gets current item data, extracts the node and resets it
+                       long item = GetCtrl(level)->GetItemData(it);
+                       GetCtrl(level)->SetItemData(it,((long*)item)[0]);
+                       tree::Node* n= ((ItemData*)((long*)item)[0])->node;
+                       if(level<mLevelList.size()-1)
+                       {
+                               for(selection=mSelected.begin();selection!=mSelected.end();++selection)
+                               {
+                                       if((*selection)->GetAttribute("ID").compare(n->GetAttribute("ID"))==0)
+                                       {
+                                               change.push_back(it);   
+                                       }
+                               }
+                       }
+                       else
+                       {
+                               for(selection=mLastLevelSelected.begin();selection!=mLastLevelSelected.end();++selection)
+                               {
+                                       if((*selection)->GetAttribute("ID").compare(n->GetAttribute("ID"))==0)
+                                       {
+                                               change.push_back(it);   
+                                       }
+                               }
+                       }
+                       
+                       
+               }
+               //Resets the selected items
+               std::vector<long>::iterator selectedIts;
+               for(selectedIts=change.begin();selectedIts!=change.end();++selectedIts)
+               {
+                       GetCtrl(level)->SetItemState(*selectedIts,wxLIST_STATE_SELECTED, wxLIST_MASK_STATE 
+               | wxLIST_MASK_TEXT |wxLIST_MASK_IMAGE | wxLIST_MASK_DATA | wxLIST_MASK_WIDTH | wxLIST_MASK_FORMAT);
+                       
+               }
+               GetCtrl(level)->InsertItem(0,"Filter:");
+       }
+       
+   }
+  //================================================================
+  void WxTreeView::OnBeginLabelEdit(wxListEvent& event)
+  {
+       GimmickDebugMessage(7,
+                       "WxTreeView::OnBeginLabelEdit" 
+                       <<std::endl);
+
+  }
+
+  //================================================================
+  void WxTreeView::OnEndLabelEdit(wxListEvent& event)
+  {
+         GimmickDebugMessage(7,
+                       "WxTreeView::OnEndLabelEdit" 
+                       <<std::endl);
+         wxObject* ctrl = event.GetEventObject(); 
+               unsigned int level = 0;
+               for (level = 0; level<mLevelList.size(); ++level)
+               {
+               if ( GetCtrl(level) == ctrl ) break;
+               }
+               std::string filter=event.m_item.m_text.c_str();
+               
+               std::string att;
+               
+               long it = -1;
+               UpdateLevel(level+1);
+               
+               for ( ;; )
+               {
+                       bool contains=false;
+                       it = GetCtrl(level)->GetNextItem(it,
+                                                                               wxLIST_NEXT_ALL);
+                       if ( it == -1 )
+                               break;
+                       if(it!=0)
+                       {
+                               long adr = GetCtrl(level)->GetItemData(it);
+                               for (int j=1;j<GetCtrl(level)->GetColumnCount()-1&&!contains;j++)
+                               {
+                               tree::Node* nod = ((ItemData*)adr)->node;
+                               att=(*nod).GetAttribute(mLevelList[level].key[j-1]);
+                       
+                               if(att.find(filter)<900)
+                               {
+                                       contains=true;
+                               }
+                               }
+                               if(!contains)
+                               {
+                                       GetCtrl(level)->DeleteItem(it);
+                               }
+                       }
+               }
+               GetGimmickView()->ClearSelection();
+               //GetCtrl(level)->DeleteAllItems();
+
+  }
+  //================================================================
+  void WxTreeView::ValidateSelectedImages()
+  {
+    GimmickDebugMessage(7,
+                       "WxTreeView::ValidateSelectedImages" 
+                       <<std::endl);
+    std::vector<tree::Node*> sel(GetSelected(mLevelList.size()+1));
+       GetGimmickView()->OnSelectionChange(sel);
+  }
+  //================================================================
+
+
+  //================================================================
+  void WxTreeView::GetNodes(std::vector<tree::Node*>& nodes, bool direction)
+  {
+       long item = mLastSelected;
+       int level=mLevelList.size()-1;
+       //Gets current item data
+       long adr = GetCtrl(level)->GetItemData(item);
+       //Extracts the node
+       tree::Node* nod = ((ItemData*)adr)->node;
+    for ( ;; )
+    {
+               if(direction)
+               {
+                       item = GetCtrl(level)->GetNextItem(item,
+                                     wxLIST_NEXT_ABOVE);
+               }
+               else
+               {
+                       item = GetCtrl(level)->GetNextItem(item,
+                                     wxLIST_NEXT_BELOW);
+               }
+        if ( item == -1  )
+               {
+            break;
+               }
+               if(GetCtrl(level)->GetItemState(item, wxLIST_STATE_SELECTED)==0 && item!=0)
+               {
+                       adr = GetCtrl(level)->GetItemData(item);
+                       nod = ((ItemData*)adr)->node;
+                       nodes.push_back(nod);
+               }
+    }
+
+  }
+
+  //================================================================
+  void WxTreeView::GetSelectedAsString(std::vector<std::string>&s)
+  {
+         int level=mLevelList.size();
+       std::vector<tree::Node*> sel=GetSelected(level+1);
+       std::vector<tree::Node*>::iterator i;
+       
+    for (i=sel.begin(); i!=sel.end(); ++i)
+      {
+                 std::string filename=(*i)->GetAttribute("FullFileName");
+                 s.push_back(filename);
+         }
+  }
+
+  //================================================================
+  void WxTreeView::CreateColorPalette()
+  {
+  GimmickDebugMessage(6,"WxTreeView::CreateColorPalette");
+  mColorPalette.push_back("WHITE");
+  mColorPalette.push_back("LIGHT GREY");
+  mColorPalette.push_back("AQUAMARINE");
+  mColorPalette.push_back("MEDIUM FOREST GREEN");
+  mColorPalette.push_back("INDIAN RED");
+  mColorPalette.push_back("KHAKI");
+  mColorPalette.push_back("ORANGE");
+  mColorPalette.push_back("LIGHT BLUE");
+  mColorPalette.push_back("LIGHT STEEL BLUE");
+  mColorPalette.push_back("PINK");
+  mColorPalette.push_back("PLUM");
+  mColorPalette.push_back("PURPLE");
+  mColorPalette.push_back("RED");
+  mColorPalette.push_back("SEA GREEN");
+  mColorPalette.push_back("SIENNA");
+  mColorPalette.push_back("SKY BLUE");
+  mColorPalette.push_back("SLATE BLUE");
+  mColorPalette.push_back("SPRING GREEN");
+  mColorPalette.push_back("TAN");
+  mColorPalette.push_back("THISTLE");
+  mColorPalette.push_back("TURQUOISE");
+  mColorPalette.push_back("VIOLET");
+  mColorPalette.push_back("VIOLET RED");
+  mColorPalette.push_back("WHEAT");
+  mColorPalette.push_back("YELLOW");
+  mColorPalette.push_back("YELLOW GREEN");
+  mColorPalette.push_back("BLUE");
+  mColorPalette.push_back("BLUE VIOLET");
+  mColorPalette.push_back("BROWN");
+  mColorPalette.push_back("CADET BLUE");
+  mColorPalette.push_back("CORAL");
+  mColorPalette.push_back("CORNFLOWER BLUE");
+  mColorPalette.push_back("CYAN");
+  mColorPalette.push_back("DARK GREY");
+  mColorPalette.push_back("DARK GREEN");
+  mColorPalette.push_back("DARK OLIVE GREEN");
+  mColorPalette.push_back("DARK ORCHID");
+  mColorPalette.push_back("DARK SLATE BLUE");
+  mColorPalette.push_back("DARK SLATE GREY");
+  mColorPalette.push_back("DARK TURQUOISE");
+  mColorPalette.push_back("FIREBRICK");
+  mColorPalette.push_back("FOREST GREEN");
+  mColorPalette.push_back("GOLD");
+  mColorPalette.push_back("GOLDENROD");
+  mColorPalette.push_back("GREY");
+  mColorPalette.push_back("GREEN");
+  mColorPalette.push_back("GREEN YELLOW");
+  mColorPalette.push_back("LIME GREEN");
+  mColorPalette.push_back("MAGENTA");
+  mColorPalette.push_back("MAROON");
+  mColorPalette.push_back("MEDIUM AQUAMARINE");
+  mColorPalette.push_back("MEDIUM BLUE");
+  mColorPalette.push_back("MEDIUM GOLDENROD");
+  mColorPalette.push_back("MEDIUM ORCHID");
+  mColorPalette.push_back("MEDIUM SEA GREEN");
+  mColorPalette.push_back("MEDIUM SLATE BLUE");
+  mColorPalette.push_back("MEDIUM SPRING GREEN");
+  mColorPalette.push_back("MEDIUM TURQUOISE");
+  mColorPalette.push_back("MEDIUM VIOLET RED");
+  mColorPalette.push_back("MIDNIGHT BLUE");
+  mColorPalette.push_back("NAVY");
+  mColorPalette.push_back("ORANGE RED");
+  mColorPalette.push_back("ORCHID, PALE GREEN");
+  mColorPalette.push_back("STEEL BLUE");
+  mColorPalette.push_back("BLACK");
+
+
+  }
+  //================================================================
+  BEGIN_EVENT_TABLE(WxTreeView, wxPanel)
+  /*
+    EVT_SIZE(MyFrame::OnSize)
+
+    EVT_MENU(LIST_QUIT, MyFrame::OnQuit)
+    EVT_MENU(LIST_ABOUT, MyFrame::OnAbout)
+    EVT_MENU(LIST_LIST_VIEW, MyFrame::OnListView)
+    EVT_MENU(LIST_REPORT_VIEW, MyFrame::OnReportView)
+    EVT_MENU(LIST_ICON_VIEW, MyFrame::OnIconView)
+    EVT_MENU(LIST_ICON_TEXT_VIEW, MyFrame::OnIconTextView)
+    EVT_MENU(LIST_SMALL_ICON_VIEW, MyFrame::OnSmallIconView)
+    EVT_MENU(LIST_SMALL_ICON_TEXT_VIEW, MyFrame::OnSmallIconTextView)
+    EVT_MENU(LIST_VIRTUAL_VIEW, MyFrame::OnVirtualView)
+    EVT_MENU(LIST_SMALL_VIRTUAL_VIEW, MyFrame::OnSmallVirtualView)
+
+    EVT_MENU(LIST_FOCUS_LAST, MyFrame::OnFocusLast)
+    EVT_MENU(LIST_TOGGLE_FIRST, MyFrame::OnToggleFirstSel)
+    EVT_MENU(LIST_DESELECT_ALL, MyFrame::OnDeselectAll)
+    EVT_MENU(LIST_SELECT_ALL, MyFrame::OnSelectAll)
+    EVT_MENU(LIST_DELETE, MyFrame::OnDelete)
+    EVT_MENU(LIST_ADD, MyFrame::OnAdd)
+    EVT_MENU(LIST_EDIT, MyFrame::OnEdit)
+    EVT_MENU(LIST_DELETE_ALL, MyFrame::OnDeleteAll)
+    EVT_MENU(LIST_SORT, MyFrame::OnSort)
+    EVT_MENU(LIST_SET_FG_COL, MyFrame::OnSetFgColour)
+    EVT_MENU(LIST_SET_BG_COL, MyFrame::OnSetBgColour)
+    EVT_MENU(LIST_TOGGLE_MULTI_SEL, MyFrame::OnToggleMultiSel)
+    EVT_MENU(LIST_SHOW_COL_INFO, MyFrame::OnShowColInfo)
+    EVT_MENU(LIST_SHOW_SEL_INFO, MyFrame::OnShowSelInfo)
+    EVT_MENU(LIST_FREEZE, MyFrame::OnFreeze)
+    EVT_MENU(LIST_THAW, MyFrame::OnThaw)
+    EVT_MENU(LIST_TOGGLE_LINES, MyFrame::OnToggleLines)
+    EVT_MENU(LIST_MAC_USE_GENERIC, MyFrame::OnToggleMacUseGeneric)
+
+    EVT_UPDATE_UI(LIST_SHOW_COL_INFO, MyFrame::OnUpdateShowColInfo)
+    EVT_UPDATE_UI(LIST_TOGGLE_MULTI_SEL, MyFrame::OnUpdateToggleMultiSel)
+END_EVENT_TABLE()
+
+BEGIN_EVENT_TABLE(MyListCtrl, wxListCtrl)
+    EVT_LIST_BEGIN_DRAG(LIST_CTRL, MyListCtrl::OnBeginDrag)
+    EVT_LIST_BEGIN_RDRAG(LIST_CTRL, MyListCtrl::OnBeginRDrag)
+       */
+    EVT_LIST_BEGIN_LABEL_EDIT(-1, WxTreeView::OnBeginLabelEdit)
+    EVT_LIST_END_LABEL_EDIT(-1, WxTreeView::OnEndLabelEdit)
+       /*
+    EVT_LIST_DELETE_ITEM(LIST_CTRL, MyListCtrl::OnDeleteItem)
+    EVT_LIST_DELETE_ALL_ITEMS(LIST_CTRL, MyListCtrl::OnDeleteAllItems)
+#if WXWIN_COMPATIBILITY_2_4
+    EVT_LIST_GET_INFO(LIST_CTRL, MyListCtrl::OnGetInfo)
+    EVT_LIST_SET_INFO(LIST_CTRL, MyListCtrl::OnSetInfo)
+#endif
+  */
+    EVT_LIST_ITEM_SELECTED(-1, WxTreeView::OnSelectedChanged)
+  
+    EVT_LIST_ITEM_DESELECTED(-1, WxTreeView::OnSelectedChanged)
+       /*
+    EVT_LIST_KEY_DOWN(LIST_CTRL, MyListCtrl::OnListKeyDown)
+    EVT_LIST_ITEM_ACTIVATED(LIST_CTRL, MyListCtrl::OnActivated)
+    EVT_LIST_ITEM_FOCUSED(LIST_CTRL, MyListCtrl::OnFocused)
+
+    EVT_LIST_COL_RIGHT_CLICK(LIST_CTRL, MyListCtrl::OnColRightClick)
+       */
+    EVT_LIST_COL_CLICK(-1, WxTreeView::OnColClick)
+       /*
+    EVT_LIST_COL_BEGIN_DRAG(LIST_CTRL, MyListCtrl::OnColBeginDrag)
+    EVT_LIST_COL_DRAGGING(LIST_CTRL, MyListCtrl::OnColDragging)
+    EVT_LIST_COL_END_DRAG(LIST_CTRL, MyListCtrl::OnColEndDrag)
+
+    EVT_LIST_CACHE_HINT(LIST_CTRL, MyListCtrl::OnCacheHint)
+
+#if USE_CONTEXT_MENU
+    EVT_CONTEXT_MENU(MyListCtrl::OnContextMenu)
+#endif
+    EVT_CHAR(MyListCtrl::OnChar)
+
+    EVT_RIGHT_DOWN(MyListCtrl::OnRightClick)
+  */
+END_EVENT_TABLE()
+  
+} // EO namespace creaImageIO