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