]> Creatis software - creaImageIO.git/blob - src2/creaImageIOWxTreeView.h
Implemented calls from/to the interface to several methods.
[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           /// Callback for selection change
41       void OnColClick(wxListEvent& event);
42
43
44     private:
45       /// The struct holding the data for one level
46       /// Holds the wx control and other data
47       /// such as the vector of attribute keys corresponding to the columns
48       struct LevelType
49       {
50         // The List Control
51         wxListCtrl* wxCtrl;
52         wxSplitterWindow* wxSplitter;
53         std::vector<std::string> key;
54       };
55       /// The vector of levels : one for each level of the tree      
56       std::vector<LevelType> mLevelList;
57       
58       /// return the wxListCtrl of one level
59       wxListCtrl* GetCtrl(int l) { return mLevelList[l].wxCtrl; }
60       /// return the wxSplitter of one level
61       wxSplitterWindow* GetSplitter(int l) { return mLevelList[l].wxSplitter; }
62           /// Gets the user selected data from the level passed as a parameter
63       std::vector<tree::Node*> GetSelected(int level);
64           ///Validates the selected images
65       void ValidateSelectedImages();
66           ///Returns the selected data as vtkImageData
67           vtkImageData* GetSelectedImage(int dim);  
68           ///Returns the selected data as vtkImageData
69           void GetSelectedImages(std::vector<vtkImageData*>& s, int dim);  
70        
71       // Updates the view of a level given the selected items of upper level
72       // Recursive method
73       virtual void RecursiveUpdateLevel( int );
74
75
76       DECLARE_EVENT_TABLE()
77     };
78     // EO class WxTreeView
79     //=====================================================================
80   
81 } // EO namespace creaImageIO
82 /*
83 class MyEvent: public wxCommandEvent
84 {
85 public:
86         MyEvent( wxEventType commandType = MyCommandEvent, int id = 0 )
87         :  wxCommandEvent(commandType, id) { }
88  
89         // You *must* copy here the data to be transported
90         MyEvent( const MyEvent &event )
91         :  wxCommandEvent(event) { this->SetText( event.GetText() ); }
92  
93         // Required for sending with wxPostEvent()
94         wxEvent* Clone() const { return new MyEvent(*this); }
95  
96         wxString GetText() const { return m_Text; }
97         void SetText( const wxString& text ) { m_Text = text; }
98  
99 private:
100         wxString m_Text;
101 };
102 */
103 #endif // USE_WIDGETS
104 // EOF
105 #endif