]> Creatis software - creaImageIO.git/blob - src2/creaImageIOWxGimmickView.h
1da272979ddbaa4a793ddddc2245a3a6789ede38
[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 min_dim = GIMMICK_2D_IMAGE_SELECTION,
34                         int max_dim = GIMMICK_3D_IMAGE_SELECTION,
35                     int number_of_threads = 0);
36       /// Virtual destructor
37       virtual ~WxGimmickView();
38
39           /// Returns the selected Images so that they comply with the given parameter(<4D)
40           ///(overloaded from GimmickView)
41           vtkImageData* GetSelectedImage(int dim);
42       /// Returns the selected Images so that they comply with the given parameter(4D)
43       //(overloaded from GimmickView)
44           void GetSelectedImages(std::vector<vtkImageData*>& s, int dim);
45
46     protected:
47       /// Creates the tool bar
48       void CreateToolBar(); 
49
50       /// Create the tree view for TreeHandler provided 
51       /// (overloaded from GimmickView)
52       void CreateTreeView( TreeHandler* );
53
54
55     private:
56       /// The ToolBar and the tools
57       wxToolBar*         mToolBar;
58       wxToolBarToolBase* mToolAddFile;
59       wxToolBarToolBase* mToolAddDir;
60       wxToolBarToolBase* mToolRemove;
61       wxToolBarToolBase* mToolAddDatabase;
62       wxToolBarToolBase* mToolHelp;
63
64       wxSplitterWindow* mSplitter;
65       wxPanel*          mBottomPanel;
66       wxNotebook*       mNotebook;
67
68       /// The list of icons 
69       wxImageList *    mIcon;
70       void CreateIconList();
71
72       Gimmick * mGimmick;
73       /// Callback for adding files
74       void OnAddFiles(wxCommandEvent& event);
75       /// Callback for adding dir
76       void OnAddDir(wxCommandEvent& event);
77           /// Callback for removing files
78       void OnRemove(wxCommandEvent& event);
79       /// Display a message box with the last addition statistics
80       void DisplayAddSummary();
81
82
83       /// AddProgress Gimmick callback
84       void OnAddProgress( Gimmick::AddProgress& );
85       /// Progress dialog
86       wxProgressDialog* mProgressDialog;
87
88
89       wxString mCurrentDirectory;
90
91       DECLARE_EVENT_TABLE()
92    };
93     // EO class WxGimmickView
94     //=====================================================================
95   
96
97   /*
98
99
100
101
102
103
104
105
106         //====================================================================
107         // General
108         //====================================================================
109
110     /// Returns the size of the current selection
111     virtual int GetSelectionSize() { return 0; } 
112     /// Returns true if there is a valid selection
113     virtual bool IsSelectionValid(){ return false; }
114     /// Returns the vector of full filenames of selected images
115     virtual void GetSelectedFiles(std::vector<std::string>&){ return; }
116     /// Returns the vector of images corresponding to selection
117     virtual void GetSelectedImages(std::vector<vtkImageData*>&){ return; }
118     /// Returns the vector of DicomNode corresponding to selection
119     virtual void GetSelectedDicomNodes(std::vector<DicomNode*>&){ return; }
120    /// Returns the DicomNode corresponding to the tree item
121     virtual DicomNode* GetDicomNodeOfItem(const TreeItemId& i);
122
123         
124         /// Type of list of DicomDatabase
125     typedef std::vector<DicomDatabase*> DicomDatabaseListType;
126     /// Returns the list of DicomDatabase open
127     virtual DicomDatabaseListType& GetDicomDatabaseList() 
128     { return null; }
129     /// Returns the list of DicomDatabase open (const)
130     virtual const DicomDatabaseListType& GetDicomDatabaseList() const 
131     { return null; }
132
133         protected:
134         ///Opens an existing database, or else, creates a local database.
135     virtual void OpenOrNewDatabase(bool open){ return; }
136         ///Shows the help
137         virtual void ShowHelp();
138
139         private:
140         ///Gets the extension of the database
141         const std::string& GetDatabaseExtension() { return null; }
142         ///Sets the extension of the database
143     virtual void SetDatabaseExtension(const std::string& ext){ return; }
144
145
146         //====================================================================
147     // Preview Display Related
148         //====================================================================
149
150
151     ///Shows the image sent as a parameter
152         private:
153          virtual void ShowImage(vtkImageData* image){ return; }
154
155         //====================================================================
156     // Favorites Related
157         //====================================================================
158
159
160         public:
161         ///Loads or creates a favorites database
162     virtual void LoadOrCreateFavoritesDatabase(){ return; }
163         private:
164         ///Creates the user settings directory
165     void CreateUserSettingsDirectory(){ return; }
166         ///Obtains the user settings directory
167         const std::string& GetUserSettingsDirectory(){ return null; }
168
169         //====================================================================  
170         // Attribute Display Related
171         //====================================================================
172
173
174         ///Shows the Information regarding the node sent as a parameter
175         private:
176      virtual void ShowInformation(DicomNode*){ return; }
177    
178         //====================================================================
179     // Tree Display Related
180     //====================================================================
181
182         protected:
183     /// Completely rebuilds the view with 
184     /// current DicomDatabaseList
185     virtual void RebuildView(){ return; }
186         /// Recursively updates the part of the view corresponding 
187     /// to the DicomDatabase passed
188     /// i.e. creates items for the DicomNode which do not have
189     ///      deletes obsolete items (whose DicomNode has been deleted)
190     virtual void UpdateDicomDatabaseView(DicomDatabase*){ return; }
191     /// Recursively updates the part of the view corresponding 
192     /// to the DicomNode provided.
193     /// parent is its parent in the tree (where to insert / remove it)
194         virtual void UpdateDicomNodeView(DicomNode* n, const TreeItemId& parent){ return; }
195     
196         private:
197         ///Type definition of the data regarding the tree
198     typedef WxGimmickTreeItemData TreeItemData;
199         ///Gets the item data of the tree item passed as a parameter
200     TreeItemData* GetItemData(const TreeItemId& id){ return null; }
201     ///Type definition of the data insid a node of the tree
202     typedef WxGimmickDicomNodeData NodeData;
203
204
205         //====================================================================
206     // Class Attributes
207     //====================================================================
208
209         
210         int mSelectionType;
211     int mSelectionMaxImageDimension;
212     int mCurrentSelectionImageSize[4];
213
214         ///Existent Database List
215     DicomDatabaseListType mDicomDatabaseList;
216         ///Favorites database
217     DicomDatabase* mFavoriteDatabase;
218
219         ///Path to the database list file
220     std::string mDatabaseListFile;
221         ///Extension of the database
222     std::string mDatabaseExtension;
223
224     bool mJustStarted;
225
226     int  mFirstDicomDatabaseIconIndex;
227
228    // Previewer
229     vtkImageViewer2* mViewer;
230     
231     int mx1,mx2,my1,my2,mz1,mz2;
232     double mspx,mspy,mspz;
233   
234     // Image preview :
235     // Multi-thread image reader
236     MultiThreadImageReader mReader;
237     // map of images name to node
238     std::map<std::string,DicomNode*> mImageFileNameToNode;
239   */
240  
241 } // EO namespace creaImageIO
242
243 #endif // USE_WIDGETS
244 // EOF
245 #endif