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