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