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