1 #include <creaImageIOWxTreeView.h>
2 #include <creaImageIOGimmickView.h>
3 #include <creaImageIOSystem.h>
4 #include <wx/splitter.h>
6 #include <boost/date_time/gregorian/gregorian.hpp>
8 const std::string empty_string("");
10 //=====================================================================
13 //=====================================================================
14 /// Data stored by the list items
17 ItemData() : node(0), id(-1), attr(&empty_string) {}
18 // The corresponding Node
22 // The pointer on the current attribute string to sort on
23 const std::string* attr;
24 // Was the item previously selected ?
25 // Useful for reselecting the item after sort
28 //=====================================================================
30 //=====================================================================
32 //=====================================================================
33 ///Comparing function for ordering algorithm. Takes parameters as strings.
34 int wxCALLBACK CompareFunctionStrings(long item1, long item2, long sortData)
36 creaImageIO::ItemData* data1 = (creaImageIO::ItemData*)item1;
37 creaImageIO::ItemData* data2 = (creaImageIO::ItemData*)item2;
39 const std::string& s1(*(data1->attr));
40 const std::string& s2(*(data2->attr));
62 //=====================================================================
64 //=====================================================================
65 ///Comparing function for ordering algorithm. Takes parameters as ints.
66 int wxCALLBACK CompareFunctionInts(long item1, long item2, long sortData)
68 creaImageIO::ItemData* data1 = (creaImageIO::ItemData*)item1;
69 creaImageIO::ItemData* data2 = (creaImageIO::ItemData*)item2;
71 const std::string& s1(*(data1->attr));
72 const std::string& s2(*(data2->attr));
74 int val1=atoi(s1.c_str());
75 int val2=atoi(s2.c_str());
100 //=====================================================================
103 //=====================================================================
104 namespace creaImageIO
106 //=====================================================================
108 WxTreeView::WxTreeView(TreeHandler* handler,
109 GimmickView* gimmick,
112 : wxPanel(parent,id),
113 TreeView(handler, gimmick)
115 GimmickDebugMessage(1,"WxTreeView::WxTreeView"
119 // Split part below toolbar into notebook for views and panel
120 // for preview, messages...
122 // mSplitter = new wxSplitterWindow( this , -1);
125 wxBoxSizer *sizer = new wxBoxSizer(wxHORIZONTAL);
127 int ctrl_style = wxLC_REPORT | wxLC_VRULES;
128 int col_style = wxLIST_FORMAT_LEFT;
130 // Creating the ListCtrl for the levels > 0 (not for Root level)
132 i < handler->GetTree().GetNumberOfLevels() -1;
136 GimmickDebugMessage(5,"Creating view for level "<<i
139 level.SelectedUpToDate = true;
140 level.SortColumn = 0;
142 // If the first level : parent = this
143 wxWindow* sparent = this;
144 // else parent = last splitter
146 sparent = mLevelList[i-1].wxSplitter;
148 level.wxSplitter = new wxSplitterWindow( sparent , -1);
151 level.wxSplitter->Show(false);
153 // level.wxSplitter->SetMinimumPaneSize(100);
155 wxListCtrl* ctrl = new wxListCtrl(level.wxSplitter,
161 level.wxSplitter->Initialize(ctrl);
163 // Create the columns : one for each attribute of the level
167 tree::LevelDescriptor::AttributeDescriptorListType::const_iterator a;
168 for (a = handler->GetTree().GetAttributeDescriptorList(i+1).begin();
169 a != handler->GetTree().GetAttributeDescriptorList(i+1).end();
174 GimmickDebugMessage(5,"Creating column "<<col<<" : "
178 if(a->GetFlags()!=creaImageIO::tree::AttributeDescriptor::PRIVATE)
181 if(a->GetName()=="UNKNOWN")
184 title += handler->GetTree().GetLevelDescriptor(i+1).GetName();
185 if (title[title.size()-1]!='s')
193 std::string temp = a->GetKey();
194 if (temp.compare("ID") != 0)
197 ctrl->InsertColumn(col,
202 level.key.push_back(a->GetKey());
207 mLevelList.push_back(level);
214 wxMenuItem* m1=menu->Append(wxID_ANY, _T("&Sort ascending"));
215 wxMenuItem* m2=menu->Append(wxID_ANY, _T("&Sort descending"));
216 wxMenuItem* m3=menu->Append(wxID_ANY, _T("&Filter"));
217 mAscendingID=m1->GetId();
218 mDescendingID=m2->GetId();
219 mFilterID=m3->GetId();
220 Connect( mAscendingID, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(WxTreeView::OnPopupSort) );
221 Connect( mDescendingID, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(WxTreeView::OnPopupSort) );
222 Connect( mFilterID, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(WxTreeView::OnPopupFilter) );
227 menuItem =new wxMenu;
228 wxMenuItem* m1Item=menuItem->Append(wxID_ANY, _T("&Anonymize"));
229 wxMenuItem* m2Item=menuItem->Append(wxID_ANY, _T("&Local Copy"));
231 mAnonymizingID=m1Item->GetId();
232 mLocalCopyID=m2Item->GetId();
233 //Connect( mAnonymizingID, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(WxTreeView::OnAnonymize) );
234 Connect( mLocalCopyID, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(WxTreeView::OnLocalCopy) );
237 #endif // wxUSE_MENUS
238 /// Initialize the first level splitter
240 sizer->Add( mLevelList[0].wxSplitter ,1, wxGROW ,0);
241 // mColumnSelected=1;
246 mIgnoreSelectedChanged = false;
248 //CreateColorPalette();
256 //=====================================================================
258 //=====================================================================
260 WxTreeView::~WxTreeView()
262 GimmickDebugMessage(1,"WxTreeView::~WxTreeView"
265 //=====================================================================
269 //=====================================================================
270 const std::vector<tree::Node*>& WxTreeView::GetSelected(int level)
272 // if (GetSelectedUpToDate(level))
275 // the selection of upper level
276 std::vector<tree::Node*>& sel(mLevelList[level-1].Selected);
280 sel.push_back(GetTreeHandler()->GetTree().GetTree());
282 else if (level < mLevelList.size()+2 )
287 item = GetCtrl(l-1)->GetNextItem(item,
289 wxLIST_STATE_SELECTED);
292 long adr = GetCtrl(l-1)->GetItemData(item);
293 tree::Node* n = ((ItemData*)adr)->node;
294 if(mLastSelected==item)
296 std::vector<tree::Node*>::iterator it;
298 it = sel.insert ( it , n );
307 /*int n = GetCtrl(l-1)->GetItemCount();
308 for (int i = 0; i<n; i++)
310 std::cout<<GetCtrl(l-1)->GetItemState(i,wxLIST_STATE_SELECTED)<<std::endl;
311 if ( GetCtrl(l-1)->GetItemState(i,wxLIST_STATE_SELECTED))
313 long adr = GetCtrl(l-1)->GetItemData(i);
314 tree::Node* n = ((ItemData*)adr)->node;
317 std::vector<tree::Node*>::iterator it;
319 it = sel.insert ( it , n );
334 // return mLevelList[level-1].Selected;
338 //=====================================================================
340 //=====================================================================
341 ///Removes selected nodes on last selected level
343 void WxTreeView::RemoveSelected()
345 unsigned int tempLevel = mLastLevel;
347 const std::vector<tree::Node*>& sel=GetSelected(mLastLevel+1);
348 // if no selection, no remove action.
352 std::stringstream out;
353 std::string levelName=GetTreeHandler()->GetTree().GetLevelDescriptor(mLastLevel).GetName();
356 if(sel.size()>1&&levelName.at(levelName.size()-1)!='s')
363 out<<" "<<GetTreeHandler()->GetTree().GetLevelDescriptor(mLastLevel).GetName()<<"?";
365 if (wxMessageBox(crea::std2wx(out.str()),
367 wxYES_NO,this ) == wxYES)
373 GetGimmickView()->modifyValidationSignal(false);
374 bool needRefresh=false;
375 std::vector<tree::Node*>::const_iterator i;
376 for (i=sel.begin(); i!=sel.end(); ++i)
383 if((*i)->GetParent()->GetNumberOfChildren()<2)
387 tree::Node* n= (tree::Node*)(*i);
388 GetTreeHandler()->LoadChildren((*i),4);
389 GetGimmickView()->AddIgnoreFile(n);
390 GetTreeHandler()->Remove(*i);
393 if(needRefresh && mLastLevel>1)
395 UpdateLevel(mLastLevel-2);
397 else if(mLastLevel>1)
399 UpdateLevel(mLastLevel-1);
403 UpdateLevel(mLastLevel);
409 // no need to incremente level
410 mLastLevel = tempLevel;
416 //=====================================================================
417 /// Updates a level of the view (adds or removes children, etc.)
418 void WxTreeView::UpdateLevel( int level )
420 GimmickDebugMessage(1,
421 GetTreeHandler()->GetTree().GetLabel()
422 <<"WxTreeView::UpdateLevel(level "
428 RecursiveUpdateLevel(level);
430 for (i=0; i<level-1; i++)
432 if (!GetSplitter(i)->IsSplit())
433 GetSplitter(i)->SplitVertically( GetCtrl(i), GetSplitter(i+1),
436 if (GetSplitter(i)->IsSplit()) GetSplitter(i)->Unsplit();
439 //=====================================================================
441 //=====================================================================
442 /// Recursive method called upon by UpdateLevel to refresh all windows
443 void WxTreeView::RecursiveUpdateLevel( int level )
445 GimmickDebugMessage(1,
446 GetTreeHandler()->GetTree().GetLabel()
447 <<"WxTreeView::RecursiveUpdateLevel(level "
452 const std::vector<tree::Node*>& sel(GetSelected(level));
456 // to speed up inserting we hide the control temporarily
458 GetCtrl(l)->DeleteAllItems();
460 std::vector<tree::Node*>::const_iterator i;
462 for (i=sel.begin(); i!=sel.end(); ++i)
464 GimmickDebugMessage(1,
465 "adding children of '"
471 //Adds items and sets their attributes
473 GetTreeHandler()->LoadChildren(*i,1);
474 tree::Node::ChildrenListType::reverse_iterator j;
475 for (j = (*i)->GetChildrenList().rbegin();
476 j!= (*i)->GetChildrenList().rend();
479 GimmickDebugMessage(1,
486 item.SetMask(wxLIST_MASK_STATE |
488 // wxLIST_MASK_IMAGE |
490 // wxLIST_MASK_WIDTH |
494 ItemData* data = new ItemData;
502 GetCtrl(l)->InsertItem(item);
505 for (int k=0; k<GetCtrl(l)->GetColumnCount(); ++k)
508 // Temporary correction : it works but no explanation about the problem FCY
512 val = (*j)->GetAttribute("NumberOfChildren");
515 val = (*j)->GetAttribute(mLevelList[l].key[k]);
516 if(((*j)->GetAttributeDescriptor(mLevelList[l].key[k])).isDateEntry()) // Date
518 // std::cout << "["<<val<< "]" << std::endl;
519 std::string valtmp(val);
522 boost::gregorian::date d1(boost::gregorian::from_undelimited_string(val));
523 val = to_iso_extended_string(d1);
529 // std::cout << "["<<val<< "]" << std::endl;
531 else if(((*j)->GetAttributeDescriptor(mLevelList[l].key[k])).isTimeEntry()) // Time
533 if ((val.size()>6) &&
534 (val != "" || val != " "))
535 val = val.substr(0,2) + " : "
536 + val.substr(2,2) + " : "
543 if (val.size()==0) val = "?";
544 item.SetText( crea::std2wx(val));
546 GetCtrl(l)->SetItem(item);
555 //=====================================================================
558 //================================================================
559 void WxTreeView::OnItemDeSelected(wxListEvent& event)
561 GimmickDebugMessage(1,
562 GetTreeHandler()->GetTree().GetLabel()
563 <<" WxTreeView::OnItemDeselected"<<std::endl);
564 // retrieve the level
565 wxObject* obj = event.GetEventObject();
566 unsigned int level = 0;
567 for (level = 0; level<mLevelList.size(); ++level)
569 if ( GetCtrl(level) == obj ) break;
571 SetSelectedUpToDate(level,false);
572 // to allow a first selection in images TreeView
573 if (level==mLevelList.size()-1)
574 OnItemSelected(event);
576 //================================================================
578 //================================================================
579 void WxTreeView::OnItemSelected(wxListEvent& event)
582 GimmickDebugMessage(1,
583 GetTreeHandler()->GetTree().GetLabel()
584 <<" WxTreeView::OnItemSelected"<<std::endl);
586 if (mIgnoreSelectedChanged)
588 GimmickDebugMessage(1,
589 " mIgnoreSelectedChanged true: returning"
597 info.m_itemId = event.m_itemIndex;
598 mLastSelected = event.m_itemIndex;
599 // retrieve the level
600 wxObject* obj = event.GetEventObject();
601 unsigned int level = 0;
602 for (level = 0; level<mLevelList.size(); ++level)
604 if ( GetCtrl(level) == obj ) break;
607 GimmickDebugMessage(1,
611 // Update the children level (if selection not at last level)
612 if (level<mLevelList.size()-1)
615 UpdateLevel( level + 2 );
616 // Reset the viewer setting the default image
617 GetGimmickView()->ClearSelection();
619 // Select all images if the selection is at series level
620 if (level==mLevelList.size()-2) SelectAll(level+1);
621 // Validate selected images if the selection is at image level
622 if (level==(mLevelList.size()-1)) //&&mProcess)
624 if(event.GetEventType()==wxEVT_COMMAND_LIST_ITEM_SELECTED)
626 ValidateSelectedImages (true);
630 ValidateSelectedImages (false);
635 //================================================================
637 //================================================================
638 void WxTreeView::SelectAll(int level)
641 // int level=mLevelList.size()-1;
644 item = GetCtrl(level)->GetNextItem(item,
649 if(item==(GetCtrl(level)->GetItemCount()-1))
651 mIgnoreSelectedChanged = false;//mProcess=true;
655 mIgnoreSelectedChanged = true;// mProcess=false;
657 GetCtrl(level)->SetItemState(item,wxLIST_STATE_SELECTED, wxLIST_MASK_STATE
658 | wxLIST_MASK_TEXT |wxLIST_MASK_IMAGE | wxLIST_MASK_DATA | wxLIST_MASK_WIDTH | wxLIST_MASK_FORMAT);
662 //================================================================
663 //================================================================
665 void WxTreeView::OnColClick(wxListEvent& event)
667 mColumnSelected = event.m_col;
669 clientpt.x = wxGetMousePosition().x - this->GetScreenPosition().x;
670 clientpt.y = wxGetMousePosition().y - this->GetScreenPosition().y;
671 senderCtrl = event.GetEventObject();
672 unsigned int level = 0;
673 for (level = 0; level<mLevelList.size(); ++level)
675 if ( GetCtrl(level) == senderCtrl ) break;
677 PopupMenu(menu, clientpt);
681 void WxTreeView::OnItemMenu(wxListEvent &event)
684 clientpt.x = wxGetMousePosition().x - this->GetScreenPosition().x;
685 clientpt.y = wxGetMousePosition().y - this->GetScreenPosition().y;
686 senderCtrl = event.GetEventObject();
687 unsigned int level = 0;
688 for (level = 0; level<mLevelList.size(); ++level)
690 if ( GetCtrl(level) == senderCtrl ) break;
692 PopupMenu(menuItem, clientpt);
696 //================================================================
697 //================================================================
699 void WxTreeView::OnPopupFilter(wxCommandEvent& event)
702 GimmickDebugMessage(7,
703 "WxTreeView::OnEndLabelEdit"
705 unsigned int level = 0;
706 for (level = 0; level<mLevelList.size(); ++level)
708 if ( GetCtrl(level) == senderCtrl ) break;
710 std::string filter = crea::wx2std(wxGetTextFromUser(_T("Enter the filter to apply"), _T("Filter On Column")));
715 UpdateLevel(level+1);
717 std::vector<long> items;
722 it = GetCtrl(level)->GetNextItem(it,
727 long adr = GetCtrl(level)->GetItemData(it);
728 tree::Node* nod = ((ItemData*)adr)->node;
729 att=(*nod).GetAttribute(mLevelList[level].key[mColumnSelected]);
732 if(att.find(filter)>900)
744 items.push_back(it-del);
748 std::vector<long>::iterator iter;
749 for(iter=items.begin();iter!=items.end();++iter)
751 GetCtrl(level)->DeleteItem(*iter);
753 GetGimmickView()->ClearSelection();
755 //================================================================
757 //================================================================
758 void WxTreeView::OnPopupSort(wxCommandEvent& event)
761 unsigned int level = 0;
762 for (level = 0; level<mLevelList.size(); ++level)
764 if ( GetCtrl(level) == senderCtrl ) break;
766 mLevelList[level].SortColumn = mColumnSelected;
768 if(event.GetId()==mAscendingID)
770 mLevelList[level].SortAscending = true;
772 else if(event.GetId()==mDescendingID)
774 mLevelList[level].SortAscending = false;
779 //================================================================
781 //================================================================
782 void WxTreeView::OnLocalCopy(wxCommandEvent& event)
786 unsigned int tempLevel = mLastLevel;
788 const std::vector<tree::Node*>& sel=GetSelected(mLastLevel+1);
793 std::stringstream out;
794 std::string levelName=GetTreeHandler()->GetTree().GetLevelDescriptor(mLastLevel).GetName();
797 if(sel.size()>1&&levelName.at(levelName.size()-1)!='s')
800 out<<"s to .gimmick?";
804 out<<" "<<GetTreeHandler()->GetTree().GetLevelDescriptor(mLastLevel).GetName()<<" to .gimmick?";
806 if (wxMessageBox(crea::std2wx(out.str()),
808 wxYES_NO,this ) == wxYES)
814 std::vector<std::string> s;
815 GetFilenamesAsString(sel,s);
816 GetGimmickView()->CopyFiles(s);
821 mLastLevel = tempLevel;
826 //================================================================
828 //================================================================
829 void WxTreeView::SortLevel(int level)
831 GimmickDebugMessage(1,
832 "WxTreeView::SortLevel("
835 //Obtain the column name and the level that needs to be organized
837 // int l = level - 1;
838 //Sets the data for the items to be sorted
842 int n = GetCtrl(level)->GetItemCount();
843 for (int i = 0; i < n; i++)
846 //Gets current item data
847 ItemData* data = (ItemData*)GetCtrl(level)->GetItemData(i);
849 //Extracts the node and the type of attribute
850 tree::Node* nod = data->node;
853 (*nod).GetAttributeDescriptor
854 (mLevelList[level].key[mLevelList[level].SortColumn])
857 //Obtains the organizing attribute
858 data->attr = & (*nod).GetAttribute
859 (mLevelList[level].key[mLevelList[level].SortColumn]);
861 data->selected = false;
862 if (GetCtrl(level)->GetItemState(i,wxLIST_STATE_SELECTED)>0)
864 data->selected = true;
869 GimmickDebugMessage(1,
870 "WxTreeView::OnSort : "
871 <<nbselected<<" selected before sorting"
874 mIgnoreSelectedChanged = true;
876 if (mLevelList[level].SortAscending)
881 GetCtrl(level)->SortItems(CompareFunctionInts, 0);
885 GetCtrl(level)->SortItems(CompareFunctionStrings, 0);
893 GetCtrl(level)->SortItems(CompareFunctionInts, 1);
897 GetCtrl(level)->SortItems(CompareFunctionStrings, 1);
902 // Reselects the unselected
903 n = GetCtrl(level)->GetItemCount();
905 for (int i = 0; i < n; i++)
908 //Gets current item data
909 ItemData* data = (ItemData*)GetCtrl(level)->GetItemData(i);
914 // item = GetCtrl(level)->GetNextItem(item,wxLIST_NEXT_ALL);
915 // if ( item == -1 ) break;
916 //Gets current item data
917 // ItemData* data = (ItemData*)GetCtrl(level)->GetItemData(item);
925 // if it is the last one we must process the selection
926 mIgnoreSelectedChanged = false;
928 GetCtrl(level)->SetItemState(i,
929 wxLIST_STATE_SELECTED,
935 | wxLIST_MASK_FORMAT);
937 if (GetCtrl(level)->GetItemState(i,wxLIST_STATE_SELECTED)>0)
944 mIgnoreSelectedChanged = false;
945 GimmickDebugMessage(1,
946 "WxTreeView::SortLevel : "
947 <<after<<" selected after sorting"
951 //================================================================
954 //================================================================
955 void WxTreeView::ValidateSelectedImages(bool isSelection)
957 GimmickDebugMessage(7,
958 "WxTreeView::ValidateSelectedImages"
960 const std::vector<tree::Node*>& sel(GetSelected(mLevelList.size()+1));
961 GetGimmickView()->OnSelectionChange(sel,
962 isSelection,(mLastSelected-1),
963 !mIgnoreSelectedChanged);
966 //================================================================
969 //================================================================
970 void WxTreeView::GetNodes(std::vector<tree::Node*>& nodes, bool direction)
972 long item = mLastSelected;
973 int level=mLevelList.size()-1;
974 //Gets current item data
975 long adr = GetCtrl(level)->GetItemData(item);
977 tree::Node* nod = ((ItemData*)adr)->node;
982 item = GetCtrl(level)->GetNextItem(item,
987 item = GetCtrl(level)->GetNextItem(item,
990 if ( item == -1 || item==0 )
994 if(GetCtrl(level)->GetItemState(item, wxLIST_STATE_SELECTED)==0 )
997 adr = GetCtrl(level)->GetItemData(item);
998 nod = ((ItemData*)adr)->node;
999 nodes.push_back(nod);
1004 //================================================================
1005 //=================================================
1006 void WxTreeView::OnKeyDown(wxListEvent &event)
1008 if(event.GetKeyCode() == WXK_DELETE)
1013 GetGimmickView()->ClearSelection();
1017 //================================================================
1019 //================================================================
1020 // Should be in another place : not specific !
1021 void WxTreeView::GetSelectedAsString(std::vector<std::string>&s)
1023 int level=mLevelList.size();
1024 const std::vector<tree::Node*>& sel=GetSelected(level+1);
1025 std::vector<tree::Node*>::const_iterator i;
1027 for (i=sel.begin(); i!=sel.end(); ++i)
1029 std::string filename=(*i)->GetAttribute("FullFileName");
1030 s.push_back(filename);
1034 //================================================================
1035 void WxTreeView::GetFilenamesAsString(const std::vector<tree::Node*>& nodes, std::vector<std::string>&s)
1037 std::vector<tree::Node*>::const_iterator i;
1039 for (i=nodes.begin(); i!=nodes.end(); ++i)
1041 if((*i)->GetLevel()<mLevelList.size())
1043 GetTreeHandler()->LoadChildren(*i,0);
1044 GetFilenamesAsString((*i)->GetChildrenList(),s);
1048 std::string filename=(*i)->GetAttribute("FullFileName");
1049 s.push_back(filename);
1054 //================================================================
1055 void WxTreeView::SetColor(int l, int item)
1058 GetCtrl(l)->SetItemTextColour(item, wxColourDatabase().Find
1059 (crea::std2wx(mColorPalette[colorId])));
1060 GetCtrl(l)->SetItemState(item,wxLIST_STATE_SELECTED | wxLIST_STATE_FOCUSED, wxLIST_STATE_SELECTED); /*
1062 //Setting the color according to the parent
1065 item.SetBackgroundColour
1066 (wxColourDatabase().Find
1067 (crea::std2wx(mColorPalette[colorId])));
1070 (*j,wxColourDatabase().Find
1071 (crea::std2wx(mColorPalette[colorId]))));
1081 else if(l!=mLevelList.size()-1)
1083 item.SetBackgroundColour(mColorMap[*i]);
1084 mColorMap.insert(NodeColorPair(*j,mColorMap[*i]));
1088 item.SetBackgroundColour(mColorMap[*i]);
1091 //================================================================
1092 void WxTreeView::CreateColorPalette()
1094 GimmickDebugMessage(6,"WxTreeView::CreateColorPalette");
1095 mColorPalette.push_back("WHITE");
1096 mColorPalette.push_back("LIGHT GREY");
1097 mColorPalette.push_back("AQUAMARINE");
1098 mColorPalette.push_back("MEDIUM FOREST GREEN");
1099 mColorPalette.push_back("INDIAN RED");
1100 mColorPalette.push_back("KHAKI");
1101 mColorPalette.push_back("ORANGE");
1102 mColorPalette.push_back("LIGHT BLUE");
1103 mColorPalette.push_back("LIGHT STEEL BLUE");
1104 mColorPalette.push_back("PINK");
1105 mColorPalette.push_back("PLUM");
1106 mColorPalette.push_back("PURPLE");
1107 mColorPalette.push_back("RED");
1108 mColorPalette.push_back("SEA GREEN");
1109 mColorPalette.push_back("SIENNA");
1110 mColorPalette.push_back("SKY BLUE");
1111 mColorPalette.push_back("SLATE BLUE");
1112 mColorPalette.push_back("SPRING GREEN");
1113 mColorPalette.push_back("TAN");
1114 mColorPalette.push_back("THISTLE");
1115 mColorPalette.push_back("TURQUOISE");
1116 mColorPalette.push_back("VIOLET");
1117 mColorPalette.push_back("VIOLET RED");
1118 mColorPalette.push_back("WHEAT");
1119 mColorPalette.push_back("YELLOW");
1120 mColorPalette.push_back("YELLOW GREEN");
1121 mColorPalette.push_back("BLUE");
1122 mColorPalette.push_back("BLUE VIOLET");
1123 mColorPalette.push_back("BROWN");
1124 mColorPalette.push_back("CADET BLUE");
1125 mColorPalette.push_back("CORAL");
1126 mColorPalette.push_back("CORNFLOWER BLUE");
1127 mColorPalette.push_back("CYAN");
1128 mColorPalette.push_back("DARK GREY");
1129 mColorPalette.push_back("DARK GREEN");
1130 mColorPalette.push_back("DARK OLIVE GREEN");
1131 mColorPalette.push_back("DARK ORCHID");
1132 mColorPalette.push_back("DARK SLATE BLUE");
1133 mColorPalette.push_back("DARK SLATE GREY");
1134 mColorPalette.push_back("DARK TURQUOISE");
1135 mColorPalette.push_back("FIREBRICK");
1136 mColorPalette.push_back("FOREST GREEN");
1137 mColorPalette.push_back("GOLD");
1138 mColorPalette.push_back("GOLDENROD");
1139 mColorPalette.push_back("GREY");
1140 mColorPalette.push_back("GREEN");
1141 mColorPalette.push_back("GREEN YELLOW");
1142 mColorPalette.push_back("LIME GREEN");
1143 mColorPalette.push_back("MAGENTA");
1144 mColorPalette.push_back("MAROON");
1145 mColorPalette.push_back("MEDIUM AQUAMARINE");
1146 mColorPalette.push_back("MEDIUM BLUE");
1147 mColorPalette.push_back("MEDIUM GOLDENROD");
1148 mColorPalette.push_back("MEDIUM ORCHID");
1149 mColorPalette.push_back("MEDIUM SEA GREEN");
1150 mColorPalette.push_back("MEDIUM SLATE BLUE");
1151 mColorPalette.push_back("MEDIUM SPRING GREEN");
1152 mColorPalette.push_back("MEDIUM TURQUOISE");
1153 mColorPalette.push_back("MEDIUM VIOLET RED");
1154 mColorPalette.push_back("MIDNIGHT BLUE");
1155 mColorPalette.push_back("NAVY");
1156 mColorPalette.push_back("ORANGE RED");
1157 mColorPalette.push_back("ORCHID, PALE GREEN");
1158 mColorPalette.push_back("STEEL BLUE");
1159 mColorPalette.push_back("BLACK");
1163 //================================================================
1164 BEGIN_EVENT_TABLE(WxTreeView, wxPanel)
1166 EVT_SIZE(MyFrame::OnSize)
1168 EVT_MENU(LIST_QUIT, MyFrame::OnQuit)
1169 EVT_MENU(LIST_ABOUT, MyFrame::OnAbout)
1170 EVT_MENU(LIST_LIST_VIEW, MyFrame::OnListView)
1171 EVT_MENU(LIST_REPORT_VIEW, MyFrame::OnReportView)
1172 EVT_MENU(LIST_ICON_VIEW, MyFrame::OnIconView)
1173 EVT_MENU(LIST_ICON_TEXT_VIEW, MyFrame::OnIconTextView)
1174 EVT_MENU(LIST_SMALL_ICON_VIEW, MyFrame::OnSmallIconView)
1175 EVT_MENU(LIST_SMALL_ICON_TEXT_VIEW, MyFrame::OnSmallIconTextView)
1176 EVT_MENU(LIST_VIRTUAL_VIEW, MyFrame::OnVirtualView)
1177 EVT_MENU(LIST_SMALL_VIRTUAL_VIEW, MyFrame::OnSmallVirtualView)
1179 EVT_MENU(LIST_FOCUS_LAST, MyFrame::OnFocusLast)
1180 EVT_MENU(LIST_TOGGLE_FIRST, MyFrame::OnToggleFirstSel)
1181 EVT_MENU(LIST_DESELECT_ALL, MyFrame::OnDeselectAll)
1182 EVT_MENU(LIST_SELECT_ALL, MyFrame::OnSelectAll)
1183 EVT_MENU(LIST_DELETE, MyFrame::OnDelete)
1184 EVT_MENU(LIST_ADD, MyFrame::OnAdd)
1185 EVT_MENU(LIST_EDIT, MyFrame::OnEdit)
1186 EVT_MENU(LIST_DELETE_ALL, MyFrame::OnDeleteAll)
1187 EVT_MENU(LIST_SORT, MyFrame::OnSort)
1188 EVT_MENU(LIST_SET_FG_COL, MyFrame::OnSetFgColour)
1189 EVT_MENU(LIST_SET_BG_COL, MyFrame::OnSetBgColour)
1190 EVT_MENU(LIST_TOGGLE_MULTI_SEL, MyFrame::OnToggleMultiSel)
1191 EVT_MENU(LIST_SHOW_COL_INFO, MyFrame::OnShowColInfo)
1192 EVT_MENU(LIST_SHOW_SEL_INFO, MyFrame::OnShowSelInfo)
1193 EVT_MENU(LIST_FREEZE, MyFrame::OnFreeze)
1194 EVT_MENU(LIST_THAW, MyFrame::OnThaw)
1195 EVT_MENU(LIST_TOGGLE_LINES, MyFrame::OnToggleLines)
1196 EVT_MENU(LIST_MAC_USE_GENERIC, MyFrame::OnToggleMacUseGeneric)
1198 EVT_UPDATE_UI(LIST_SHOW_COL_INFO, MyFrame::OnUpdateShowColInfo)
1199 EVT_UPDATE_UI(LIST_TOGGLE_MULTI_SEL, MyFrame::OnUpdateToggleMultiSel)
1202 BEGIN_EVENT_TABLE(MyListCtrl, wxListCtrl)
1203 EVT_LIST_BEGIN_DRAG(LIST_CTRL, MyListCtrl::OnBeginDrag)
1204 EVT_LIST_BEGIN_RDRAG(LIST_CTRL, MyListCtrl::OnBeginRDrag)
1206 EVT_LIST_BEGIN_LABEL_EDIT(-1, WxTreeView::OnBeginLabelEdit)
1207 EVT_LIST_END_LABEL_EDIT(-1, WxTreeView::OnEndLabelEdit)
1209 EVT_LIST_DELETE_ITEM(LIST_CTRL, MyListCtrl::OnDeleteItem)
1210 EVT_LIST_DELETE_ALL_ITEMS(LIST_CTRL, MyListCtrl::OnDeleteAllItems)
1211 #if WXWIN_COMPATIBILITY_2_4
1212 EVT_LIST_GET_INFO(LIST_CTRL, MyListCtrl::OnGetInfo)
1213 EVT_LIST_SET_INFO(LIST_CTRL, MyListCtrl::OnSetInfo)
1216 EVT_LIST_KEY_DOWN(-1, WxTreeView::OnKeyDown)
1217 EVT_LIST_ITEM_SELECTED(-1, WxTreeView::OnItemSelected)
1218 EVT_LIST_ITEM_RIGHT_CLICK(-1, WxTreeView::OnItemMenu)
1219 EVT_LIST_ITEM_DESELECTED(-1, WxTreeView::OnItemDeSelected)
1221 EVT_LIST_KEY_DOWN(LIST_CTRL, MyListCtrl::OnListKeyDown)
1222 EVT_LIST_ITEM_ACTIVATED(LIST_CTRL, MyListCtrl::OnActivated)
1223 EVT_LIST_ITEM_FOCUSED(LIST_CTRL, MyListCtrl::OnFocused)
1225 EVT_LIST_COL_RIGHT_CLICK(-1, WxTreeView::OnColClick)
1227 EVT_LIST_COL_CLICK(-1, WxTreeView::OnColClick)
1229 //EVT_LEFT_DOWN(WxTreeView::OnMouseClick)
1231 EVT_LIST_COL_BEGIN_DRAG(LIST_CTRL, MyListCtrl::OnColBeginDrag)
1232 EVT_LIST_COL_DRAGGING(LIST_CTRL, MyListCtrl::OnColDragging)
1233 EVT_LIST_COL_END_DRAG(LIST_CTRL, MyListCtrl::OnColEndDrag)
1235 EVT_LIST_CACHE_HINT(LIST_CTRL, MyListCtrl::OnCacheHint)
1237 #if USE_CONTEXT_MENU
1238 EVT_CONTEXT_MENU(MyListCtrl::OnContextMenu)
1240 EVT_CHAR(MyListCtrl::OnChar)
1242 EVT_RIGHT_DOWN(MyListCtrl::OnRightClick)
1246 } // EO namespace creaImageIO