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