]> Creatis software - creaMaracasVisu.git/blob - lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracasIRMView.h
*** empty log message ***
[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/04/09 13:58:38 $
7   Version:   $Revision: 1.2 $
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, int 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 private:
157         static wxMaracasIRMView* instance;
158
159         wxMaracasIRMViewManager* irmmanager;
160
161         wxAuiManager* wxauimanager;
162
163         void createFileChooser();
164
165         std::string _path;
166 };
167
168
169
170 class wxMaracasIRMViewProp3D : public wxMaracasIRMViewPanel{
171 public:
172         wxMaracasIRMViewProp3D(wxWindow* parent, int propid);
173         ~wxMaracasIRMViewProp3D();
174         virtual void createControls();  
175         void onOpacityRelease(wxScrollEvent& event );   
176         void onCheckBoxChange(wxCommandEvent& event);
177         void onColorChange(wxCommandEvent& event);
178
179         
180 private:
181         wxCheckBox* checkbox;
182         wxSlider* opacity;      
183         wxBitmapButton* _colorchoose;
184         
185         
186 };
187
188
189
190
191 class wxMaracasIRMViewProp3DMHD : public wxMaracasIRMViewProp3D{
192 public:
193         wxMaracasIRMViewProp3DMHD(wxWindow* parent, int propid);
194         ~wxMaracasIRMViewProp3DMHD();
195         void onIsoValueRelease(wxScrollEvent& event );
196         void createControls(int maxisovalue);   
197
198         
199 private:        
200         wxSlider* isovalue;
201         int _propid;
202         
203 };
204
205
206
207
208 class ToolBar : public wxToolBar{
209
210 public:
211         
212         ToolBar(wxWindow * parent,std::string iconsdir);
213         ~ToolBar(void);
214         
215         
216         void onLoadImageFile(wxCommandEvent& event);
217         
218 private:
219
220         
221
222         
223 DECLARE_EVENT_TABLE()
224 };
225
226 #endif
227