]> Creatis software - creaImageIO.git/blob - src2/creaImageIOWxGimmickView.h
*** empty log message ***
[creaImageIO.git] / src2 / creaImageIOWxGimmickView.h
1 #ifndef __creaImageIOWxGimmickView_h_INCLUDED__
2 #define __creaImageIOWxGimmickView_h_INCLUDED__
3
4 #ifdef USE_WXWIDGETS
5
6 #include <creaImageIOGimmickView.h>
7 #include <creaWx.h>
8
9 #include <wx/splitter.h>
10 #include <wx/toolbar.h> 
11 #include <wx/tbarbase.h> 
12 #include <wx/notebook.h>
13
14 namespace creaImageIO
15 {
16   /**
17    * \ingroup View
18    */
19   //=====================================================================
20   
21   //=====================================================================
22   /// Concrete derivative of GimmickView which implements a wxWidgets-based view
23   class WxGimmickView : public wxPanel, virtual public GimmickView
24     {
25     public:
26       typedef int EventType;
27
28       /// Ctor
29       WxGimmickView(Gimmick*, 
30                     wxWindow *parent, 
31                     const wxWindowID id,
32                     const wxPoint& pos, const wxSize& size,
33                     int image_type = GIMMICK_3D_IMAGE_SELECTION,
34                     int number_of_threads = 0);
35       /// Virtual destructor
36       virtual ~WxGimmickView();
37
38     protected:
39       /// Creates the tool bar
40       void CreateToolBar(); 
41
42       /// Create the tree view for TreeHandler provided 
43       /// (overloaded from GimmickView)
44       void CreateTreeView( TreeHandler* );
45
46     private:
47       /// The ToolBar and the tools
48       wxToolBar*         mToolBar;
49       wxToolBarToolBase* mToolAddFile;
50
51       wxSplitterWindow* mSplitter;
52       wxPanel*          mBottomPanel;
53       wxNotebook*       mNotebook;
54
55       /// The list of icons 
56       wxImageList *    mIcon;
57       void CreateIconList();
58
59    };
60     // EO class WxGimmickView
61     //=====================================================================
62   
63
64   /*
65
66
67
68
69
70
71
72
73         //====================================================================
74         // General
75         //====================================================================
76
77     /// Returns the size of the current selection
78     virtual int GetSelectionSize() { return 0; } 
79     /// Returns true if there is a valid selection
80     virtual bool IsSelectionValid(){ return false; }
81     /// Returns the vector of full filenames of selected images
82     virtual void GetSelectedFiles(std::vector<std::string>&){ return; }
83     /// Returns the vector of images corresponding to selection
84     virtual void GetSelectedImages(std::vector<vtkImageData*>&){ return; }
85     /// Returns the vector of DicomNode corresponding to selection
86     virtual void GetSelectedDicomNodes(std::vector<DicomNode*>&){ return; }
87    /// Returns the DicomNode corresponding to the tree item
88     virtual DicomNode* GetDicomNodeOfItem(const TreeItemId& i);
89
90         
91         /// Type of list of DicomDatabase
92     typedef std::vector<DicomDatabase*> DicomDatabaseListType;
93     /// Returns the list of DicomDatabase open
94     virtual DicomDatabaseListType& GetDicomDatabaseList() 
95     { return null; }
96     /// Returns the list of DicomDatabase open (const)
97     virtual const DicomDatabaseListType& GetDicomDatabaseList() const 
98     { return null; }
99
100         protected:
101         ///Opens an existing database, or else, creates a local database.
102     virtual void OpenOrNewDatabase(bool open){ return; }
103         ///Shows the help
104         virtual void ShowHelp();
105
106         private:
107         ///Gets the extension of the database
108         const std::string& GetDatabaseExtension() { return null; }
109         ///Sets the extension of the database
110     virtual void SetDatabaseExtension(const std::string& ext){ return; }
111
112
113         //====================================================================
114     // Preview Display Related
115         //====================================================================
116
117
118     ///Shows the image sent as a parameter
119         private:
120          virtual void ShowImage(vtkImageData* image){ return; }
121
122         //====================================================================
123     // Favorites Related
124         //====================================================================
125
126
127         public:
128         ///Loads or creates a favorites database
129     virtual void LoadOrCreateFavoritesDatabase(){ return; }
130         private:
131         ///Creates the user settings directory
132     void CreateUserSettingsDirectory(){ return; }
133         ///Obtains the user settings directory
134         const std::string& GetUserSettingsDirectory(){ return null; }
135
136         //====================================================================  
137         // Attribute Display Related
138         //====================================================================
139
140
141         ///Shows the Information regarding the node sent as a parameter
142         private:
143      virtual void ShowInformation(DicomNode*){ return; }
144    
145         //====================================================================
146     // Tree Display Related
147     //====================================================================
148
149         protected:
150     /// Completely rebuilds the view with 
151     /// current DicomDatabaseList
152     virtual void RebuildView(){ return; }
153         /// Recursively updates the part of the view corresponding 
154     /// to the DicomDatabase passed
155     /// i.e. creates items for the DicomNode which do not have
156     ///      deletes obsolete items (whose DicomNode has been deleted)
157     virtual void UpdateDicomDatabaseView(DicomDatabase*){ return; }
158     /// Recursively updates the part of the view corresponding 
159     /// to the DicomNode provided.
160     /// parent is its parent in the tree (where to insert / remove it)
161         virtual void UpdateDicomNodeView(DicomNode* n, const TreeItemId& parent){ return; }
162     
163         private:
164         ///Type definition of the data regarding the tree
165     typedef WxGimmickTreeItemData TreeItemData;
166         ///Gets the item data of the tree item passed as a parameter
167     TreeItemData* GetItemData(const TreeItemId& id){ return null; }
168     ///Type definition of the data insid a node of the tree
169     typedef WxGimmickDicomNodeData NodeData;
170
171
172         //====================================================================
173     // Class Attributes
174     //====================================================================
175
176         
177         int mSelectionType;
178     int mSelectionMaxImageDimension;
179     int mCurrentSelectionImageSize[4];
180
181         ///Existent Database List
182     DicomDatabaseListType mDicomDatabaseList;
183         ///Favorites database
184     DicomDatabase* mFavoriteDatabase;
185
186         ///Path to the database list file
187     std::string mDatabaseListFile;
188         ///Extension of the database
189     std::string mDatabaseExtension;
190
191     bool mJustStarted;
192
193     int  mFirstDicomDatabaseIconIndex;
194
195    // Previewer
196     vtkImageViewer2* mViewer;
197     
198     int mx1,mx2,my1,my2,mz1,mz2;
199     double mspx,mspy,mspz;
200   
201     // Image preview :
202     // Multi-thread image reader
203     MultiThreadImageReader mReader;
204     // map of images name to node
205     std::map<std::string,DicomNode*> mImageFileNameToNode;
206   */
207  
208 } // EO namespace creaImageIO
209
210 #endif // USE_WIDGETS
211 // EOF
212 #endif