]> Creatis software - creaMaracasVisu.git/blob - lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracaSurfaceRenderingProp3D.cxx
*** empty log message ***
[creaMaracasVisu.git] / lib / maracasVisuLib / src / interface / wxWindows / widgets / wxMaracaSurfaceRenderingProp3D.cxx
1 #include "wxMaracasSurfaceRenderingProp3D.h"
2
3 #include <wx/colordlg.h>
4 #include "wxMaracasSurfaceRendering.h"
5 #include <OpenImage.xpm>
6 #include "Color.xpm"
7 /**
8 **      Implementation of SurfaceRenderingProp3D
9 **/
10
11 wxMaracasSurfaceRenderingProp3D::wxMaracasSurfaceRenderingProp3D(wxWindow* parent,int propid)
12 :wxMaracasSurfaceRenderingPanel(parent, propid){
13         createControls();       
14 }
15
16 wxMaracasSurfaceRenderingProp3D::~wxMaracasSurfaceRenderingProp3D(){    
17         //wxMaracasSurfaceRendering::getInstance()->addRemoveActor(_propid, false);
18         wxMaracasSurfaceRendering::getInstance()->deleteActor(_propid);
19 }
20
21 void wxMaracasSurfaceRenderingProp3D::createControls(){
22
23         wxFlexGridSizer* sizersurrendprop = new wxFlexGridSizer(1,1,1);
24         
25         wxString choices[2];
26         choices[0] = wxString(_T("On"));
27         choices[1] = wxString(_T("Off"));
28         checkbox = new  wxCheckBox(this,-1,wxString(_T("Show Actor")));
29         Connect(checkbox->GetId(), wxEVT_COMMAND_CHECKBOX_CLICKED, (wxObjectEventFunction)&wxMaracasSurfaceRenderingProp3D::onCheckBoxChange);  
30         checkbox->SetValue(true);       
31
32         sizersurrendprop->Add(checkbox,wxFIXED_MINSIZE);
33
34         //this->addControl(checkbox);   
35         
36         wxBitmap bitmap(Color_xpm);
37         _colorchoose = new wxBitmapButton(this, -1, bitmap,wxDefaultPosition,wxSize(30,30));    
38         Connect(_colorchoose->GetId(), wxEVT_COMMAND_BUTTON_CLICKED, (wxObjectEventFunction)&wxMaracasSurfaceRenderingProp3D::onColorChange);                   
39         sizersurrendprop->Add(_colorchoose,wxFIXED_MINSIZE);    
40
41         //sizercolor->Add(checkbox,wxFIXED_MINSIZE);
42         //sizercolor->Add(_colorchoose,wxFIXED_MINSIZE);
43         //this->addControl(sizercolor);
44         
45         
46         wxStaticText* label = new wxStaticText(this, -1, wxString(_T("Opacity")));              
47         opacity = new wxSlider(this, -1,100,0,100,wxDefaultPosition,wxDefaultSize,wxSL_HORIZONTAL|wxSL_LABELS); 
48         Connect(opacity->GetId(), wxEVT_SCROLL_CHANGED, (wxObjectEventFunction)&wxMaracasSurfaceRenderingProp3D::onOpacityRelease);     
49         wxFlexGridSizer* sizeropacity = new wxFlexGridSizer(1,1,1);     
50         sizeropacity->Add(label,wxFIXED_MINSIZE);
51         sizeropacity->Add(opacity,wxFIXED_MINSIZE);
52
53         sizersurrendprop->Add(sizeropacity,wxFIXED_MINSIZE);
54
55         /**wxBitmap bitmap1(OpenImage_xpm);
56         _viewimage = new wxBitmapButton(this, -1, bitmap1, wxDefaultPosition, wxSize(30,30));   
57         Connect(_viewimage->GetId(), wxEVT_COMMAND_BUTTON_CLICKED, (wxObjectEventFunction)&wxMaracasSurfaceRenderingProp3D::onViewImage);                       
58         sizersurrendprop->Add(_viewimage,wxFIXED_MINSIZE);      */
59         
60         //this->addControl(sizeropacity);
61         this->addControl(sizersurrendprop);
62         
63 }
64 void wxMaracasSurfaceRenderingProp3D::onCheckBoxChange(wxCommandEvent& event){  
65         wxMaracasSurfaceRendering::getInstance()->addRemoveActor(this->getPropId(), checkbox->GetValue());
66 }
67 void wxMaracasSurfaceRenderingProp3D::onColorChange(wxCommandEvent& event){
68         wxColourDialog* colourdiag = new wxColourDialog(this);
69         if(colourdiag->ShowModal()==wxID_OK){
70                 wxColour colour = colourdiag->GetColourData().GetColour();
71                 _colorchoose->SetBackgroundColour(colour);
72
73                 double r = (double)(colour.Red())/255.0;
74                 double g = (double)(colour.Green())/255.0;
75                 double b = (double)(colour.Blue())/255.0;
76                 
77                 wxMaracasSurfaceRendering::getInstance()->changeColor(this->getPropId(),r,g,b);
78         }
79         delete colourdiag;
80 }
81 /*void wxMaracasSurfaceRenderingProp3D::onActionButtonPressedEliminate( wxCommandEvent& event ){        
82
83 }*/
84
85 void wxMaracasSurfaceRenderingProp3D::onOpacityRelease(wxScrollEvent& event ){
86
87         wxMaracasSurfaceRendering::getInstance()->changeOpacity(this->getPropId(),opacity->GetValue());
88
89 }
90
91 void wxMaracasSurfaceRenderingProp3D::onViewImage(wxCommandEvent& event){       
92
93         //if(mwxwidget->ShowModal()==wxID_OK){
94     
95         //      mwxwidget->Show(false);
96         //}     
97 }
98