]> Creatis software - creaMaracasVisu.git/blob - lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracasIRMView.h
441f78cbef0bc9a1d2ef44410f96556dcd688323
[creaMaracasVisu.git] / lib / maracasVisuLib / src / interface / wxWindows / widgets / wxMaracasIRMView.h
1 /*=========================================================================
2
3   Program:   wxMaracas
4   Module:    $RCSfile: wxMaracasIRMView.h,v $
5   Language:  C++
6   Date:      $Date: 2009/05/04 07:35:42 $
7   Version:   $Revision: 1.3 $
8
9   Copyright: (c) 2002, 2003
10   License:
11   
12      This software is distributed WITHOUT ANY WARRANTY; without even 
13      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
14      PURPOSE.  See the above copyright notice for more information.
15
16 =========================================================================*/
17
18 #ifndef __wxMaracasIRMViewPanelH__
19 #define __wxMaracasIRMViewPanelH__
20
21 #include <vector>
22 #include <wx/wx.h>
23 #include "wx/aui/aui.h"
24 #include <iostream>
25 #include "marTypes.h"
26 #include "vtkProp3D.h"
27
28 #include "wxMaracasIRMViewManager.h"
29
30 class wxMaracasIRMViewPanel : public wxPanel{
31 public:
32         wxMaracasIRMViewPanel(wxWindow* parent, int propid)
33                 : wxPanel(parent, -1, wxDefaultPosition, wxDefaultSize){
34                         createPanel();
35                         _propid = propid;
36         }       
37         //virtual ~wxMaracasIRMViewPanel();
38         virtual void createPanel(){
39                 show = false;
40         /*wxBoxSizer* sizerButtons = new wxBoxSizer(wxVERTICAL);
41
42                 wxButton* b = new wxButton(this, -1, wxString(_T("-")), wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT, 
43                                                                 wxDefaultValidator, wxString(_T("-"))); 
44                 Connect(b->GetId(), wxEVT_COMMAND_BUTTON_CLICKED, (wxObjectEventFunction)&wxMaracasIRMViewPanel::onActionButtonPressedHide);
45                 wxButton* b1 = new wxButton(this, -1, wxString(_T("-")), wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT, 
46                                                                 wxDefaultValidator, wxString(_T("x"))); 
47                 Connect(b1->GetId(), wxEVT_COMMAND_BUTTON_CLICKED, (wxObjectEventFunction)&wxMaracasIRMViewPanel::onActionButtonPressedEliminate);
48
49                 sizerButtons->Add(b, wxFIXED_MINSIZE);
50                 sizerButtons->Add(b1, wxFIXED_MINSIZE);*/
51
52                 sizercontrols = new wxBoxSizer(wxVERTICAL);
53
54                 wxBoxSizer* sizerpanel = new wxBoxSizer(wxHORIZONTAL);
55
56                 //sizerpanel->Add(sizerButtons,wxGROW);
57                 sizerpanel->Add(sizercontrols,wxGROW);
58         
59                 this->SetSizer(sizerpanel, true);               
60                 this->SetAutoLayout( true );
61         }
62
63         /**
64         **      Adds a new control to the panel (sizer, radiob, etc)
65         **/
66         virtual void addControl(wxWindow* win){
67                 if(sizercontrols!=NULL){
68                         sizercontrols->Add(win, wxGROW);
69                 }
70         }
71         /**
72         **      Adds a new control to the panel (sizer, radiob, etc)
73         **/
74         virtual void addControl(wxSizer* sizer){
75                 if(sizercontrols!=NULL){
76                         sizercontrols->Add(sizer, wxGROW);
77                 }
78         }
79
80         /**
81         **      Hides or show the controls in the panel
82         **/
83         virtual void onActionButtonPressedHide( wxCommandEvent& event ){
84                 wxList list = sizercontrols->GetChildren();             
85                 int i;
86                 for(i=0; i<list.size();i++){
87                         sizercontrols->Show(i,show);
88                 }
89                 show = !show;
90                 sizercontrols->Layout();
91                 this->Layout();
92         }
93
94     /**
95         **      The user must implement this function to remove the panel from the 
96         **/
97         //virtual void onActionButtonPressedEliminate( wxCommandEvent& event )=0;
98
99         /**
100         **      The user must implement this function to add the necessary controls to the panel
101         **/
102         virtual void createControls( )=0;
103         /**
104         ** returns the id of the panel
105         **/
106         int getPropId(){
107                 return _propid;
108         }
109
110 private:
111         wxBoxSizer* sizercontrols;
112         bool show;
113 protected:
114         int _propid;
115
116 };
117
118
119
120
121 class  creaMaracasVisu_EXPORT  wxMaracasIRMView : public wxPanel
122 {       
123
124 public:
125         wxMaracasIRMView( wxWindow* parent, std::string path);
126     ~wxMaracasIRMView( );
127         
128         static wxMaracasIRMView* getInstance(wxWindow* parent,std::string path="");
129
130         static wxMaracasIRMView* getInstance();
131
132         void setRenderer(vtkRenderer*  renderer);
133
134         void changeOpacity(int propid, int value);
135
136         void changeIsoValue(int propid, double value);
137
138     void addRemoveActor(int propid, bool addremove);
139
140         void changeColor(int propid, double red, double green, double blue);
141
142         void addProp3D(vtkProp3D* prop3D, std::string dataname="");
143
144         void addPropMHD(vtkImageData* imgdata, std::string dataname="");
145
146         void loadProp3D(wxString filename, wxString dataname);
147
148         void loadPropMHD(wxString filename, wxString dataname);
149
150         void onLoadImageFile();
151
152         void addIRMViewPanel(wxMaracasIRMViewPanel* irmview, std::string dataname="");
153
154         std::string getPath();
155
156         void deleteActor(int propid);
157 private:
158         static wxMaracasIRMView* instance;
159
160         wxMaracasIRMViewManager* irmmanager;
161
162         wxAuiManager* wxauimanager;
163
164         void createFileChooser();
165
166         std::string _path;
167
168 };
169
170
171
172 class wxMaracasIRMViewProp3D : public wxMaracasIRMViewPanel{
173 public:
174         wxMaracasIRMViewProp3D(wxWindow* parent, int propid);
175         ~wxMaracasIRMViewProp3D();
176         virtual void createControls();  
177         void onOpacityRelease(wxScrollEvent& event );   
178         void onCheckBoxChange(wxCommandEvent& event);
179         void onColorChange(wxCommandEvent& event);
180
181         
182 private:
183         wxCheckBox* checkbox;
184         wxSlider* opacity;      
185         wxBitmapButton* _colorchoose;
186         
187         
188 };
189
190
191
192
193 class wxMaracasIRMViewProp3DMHD : public wxMaracasIRMViewProp3D{
194 public:
195         wxMaracasIRMViewProp3DMHD(wxWindow* parent, int propid);
196         ~wxMaracasIRMViewProp3DMHD();
197         void onIsoValueRelease(wxScrollEvent& event );
198         void createControls(int maxisovalue);   
199
200         
201 private:        
202         wxSlider* isovalue;
203         int _propid;
204         
205 };
206
207
208
209
210 class ToolBar : public wxToolBar{
211
212 public:
213         
214         ToolBar(wxWindow * parent,std::string iconsdir);
215         ~ToolBar(void);
216         
217         
218         void onLoadImageFile(wxCommandEvent& event);
219         
220 private:
221
222         
223
224         
225 DECLARE_EVENT_TABLE()
226 };
227
228 #endif
229