]> Creatis software - creaImageIO.git/blob - src2/creaImageIOWxTreeView.h
Adaptive panel splitting
[creaImageIO.git] / src2 / creaImageIOWxTreeView.h
1 #ifndef __creaImageIOWxTreeView_h_INCLUDED__
2 #define __creaImageIOWxTreeView_h_INCLUDED__
3
4 #ifdef USE_WXWIDGETS
5
6 #include <creaImageIOTreeView.h>
7 #include <creaWx.h>
8
9 #include <wx/listctrl.h>
10 #include <wx/splitter.h>
11 //#include <vector>
12
13 namespace creaImageIO
14 {
15   /**
16    * \ingroup View
17    */
18   //=====================================================================
19   
20   //=====================================================================
21   /// Abstract class that handles the view of a Tree through its TreeHandler
22   class WxTreeView : public wxPanel, virtual public TreeView
23     {
24     public:
25       /// Ctor
26       WxTreeView(TreeHandler*, wxWindow* parent, const wxWindowID id);
27       /// Virtual destructor
28       virtual ~WxTreeView();
29
30       
31       /// Updates the view of a level given the selected items of upper level
32       virtual void UpdateLevel( int );
33
34           ///Removes selected nodes on given level
35           virtual void RemoveSelected( int );
36
37       /// Callback for selection change
38       void OnSelected(wxListEvent& event);
39
40
41     private:
42       /// The struct holding the data for one level
43       /// Holds the wx control and other data
44       /// such as the vector of attribute keys corresponding to the columns
45       struct LevelType
46       {
47         // The
48         wxListCtrl* wxCtrl;
49         wxSplitterWindow* wxSplitter;
50         std::vector<std::string> key;
51       };
52       /// The vector of levels : one for each level of the tree      
53       std::vector<LevelType> mLevelList;
54       
55       /// return the wxListCtrl of one level
56       wxListCtrl* GetCtrl(int l) { return mLevelList[l].wxCtrl; }
57       /// return the wxSplitter of one level
58       wxSplitterWindow* GetSplitter(int l) { return mLevelList[l].wxSplitter; }
59
60       std::vector<tree::Node*> GetSelected(int level);
61   
62   
63        
64       // Updates the view of a level given the selected items of upper level
65       // Recursive method
66       virtual void RecursiveUpdateLevel( int );
67
68
69       DECLARE_EVENT_TABLE()
70     };
71     // EO class WxTreeView
72     //=====================================================================
73   
74 } // EO namespace creaImageIO
75
76
77 #endif // USE_WIDGETS
78 // EOF
79 #endif