1 #ifndef __creaImageIOWxTreeView_h_INCLUDED__
2 #define __creaImageIOWxTreeView_h_INCLUDED__
6 #include <creaImageIOTreeView.h>
9 #include <wx/listctrl.h>
10 #include <wx/splitter.h>
19 //=====================================================================
21 //=====================================================================
22 /// Abstract class that handles the view of a Tree through its TreeHandler
23 class WxTreeView : public wxPanel, virtual public TreeView
27 WxTreeView(TreeHandler*, GimmickView*,
28 wxWindow* parent, const wxWindowID id);
29 /// Virtual destructor
30 virtual ~WxTreeView();
33 /// Updates the view of a level given the selected items of upper level
34 virtual void UpdateLevel( int );
36 ///Removes selected nodes on given level
37 virtual void RemoveSelected( int );
39 /// Callback for selection change
40 void OnSelectedChanged(wxListEvent& event);
42 /// Callback for column click
43 void OnColClick(wxListEvent& event);
45 /// Callback for first item edition
46 void OnBeginLabelEdit(wxListEvent& event);
48 /// Callback when first item edition ends
49 void OnEndLabelEdit(wxListEvent& event);
51 /// Callback when the user needs the items sorted
52 void OnPopupSort(wxCommandEvent& event);
54 ///Callback when the user need the items filtered
55 void OnPopupFilter(wxCommandEvent& event);
59 /// The struct holding the data for one level
60 /// Holds the wx control and other data
61 /// such as the vector of attribute keys corresponding to the columns
66 wxSplitterWindow* wxSplitter;
67 std::vector<std::string> key;
69 /// The vector of levels : one for each level of the tree
70 std::vector<LevelType> mLevelList;
72 /// return the wxListCtrl of one level
73 wxListCtrl* GetCtrl(int l) { return mLevelList[l].wxCtrl; }
74 /// return the wxSplitter of one level
75 wxSplitterWindow* GetSplitter(int l) { return mLevelList[l].wxSplitter; }
76 //Returns the maximum number of levels
77 int GetNumberOfLevels(){ return mLevelList.size(); }
78 /// Gets the user selected data from the level passed as a parameter
79 std::vector<tree::Node*> GetSelected(int level);
80 ///Validates the selected images
81 void ValidateSelectedImages(bool isSelection);
82 ///Gets selected filenames
83 void GetSelectedAsString(std::vector<std::string>&s);
84 /// Gets the next nodes on the list, be it up(true) or down(false).
85 void GetNodes(std::vector<tree::Node*>& nodes, bool direction);
86 /// Updates the view of a level given the selected items of upper level
88 virtual void RecursiveUpdateLevel( int );
89 ///Sets the color of a selected item
90 void SetColor(int level, int item);
91 ///Creates the color palette for the first level
92 void CreateColorPalette();
93 ///Selects the lowest level (images)
94 void SelectLowerLevel();
96 void OnSort(int level);
100 /// Currently Selected Column
102 ///Boolean that defines the direction of the organization
103 ///True is ascending order and false is descending
105 ///The last selected item on the list
107 ///The last selection of nodes (for every level, except the last)
108 std::vector<tree::Node*> mSelected;
109 ///The last selection of nodes (for the last level)
110 std::vector<tree::Node*> mLastLevelSelected;
112 typedef std::map<tree::Node*,wxColour> ColorMap;
113 typedef std::pair<tree::Node*,wxColour> NodeColorPair;
115 ///Initial color palette
116 std::vector<std::string> mColorPalette;
117 ///Boolean declaring if the last level selection has been made
121 wxObject* senderCtrl;
126 DECLARE_EVENT_TABLE()
128 // EO class WxTreeView
129 //=====================================================================
133 } // EO namespace creaImageIO
136 #endif // USE_WIDGETS