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