1 #include "wxMaracasSurfaceRenderingProp3D.h"
3 #include <wx/colordlg.h>
4 #include "wxMaracasSurfaceRendering.h"
5 #include <OpenImage.xpm>
8 ** Implementation of SurfaceRenderingProp3D
11 wxMaracasSurfaceRenderingProp3D::wxMaracasSurfaceRenderingProp3D(wxWindow* parent,int propid)
12 :wxMaracasSurfaceRenderingPanel(parent, propid){
16 wxMaracasSurfaceRenderingProp3D::~wxMaracasSurfaceRenderingProp3D(){
17 //wxMaracasSurfaceRendering::getInstance()->addRemoveActor(_propid, false);
18 wxMaracasSurfaceRendering::getInstance()->deleteActor(_propid);
21 void wxMaracasSurfaceRenderingProp3D::createControls(){
23 wxFlexGridSizer* sizersurrendprop = new wxFlexGridSizer(1,1,1);
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);
32 sizersurrendprop->Add(checkbox,wxFIXED_MINSIZE);
34 //this->addControl(checkbox);
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);
41 //sizercolor->Add(checkbox,wxFIXED_MINSIZE);
42 //sizercolor->Add(_colorchoose,wxFIXED_MINSIZE);
43 //this->addControl(sizercolor);
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);
53 sizersurrendprop->Add(sizeropacity,wxFIXED_MINSIZE);
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); */
60 //this->addControl(sizeropacity);
61 this->addControl(sizersurrendprop);
64 void wxMaracasSurfaceRenderingProp3D::onCheckBoxChange(wxCommandEvent& event){
65 wxMaracasSurfaceRendering::getInstance()->addRemoveActor(this->getPropId(), checkbox->GetValue());
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);
73 double r = (double)(colour.Red())/255.0;
74 double g = (double)(colour.Green())/255.0;
75 double b = (double)(colour.Blue())/255.0;
77 wxMaracasSurfaceRendering::getInstance()->changeColor(this->getPropId(),r,g,b);
81 /*void wxMaracasSurfaceRenderingProp3D::onActionButtonPressedEliminate( wxCommandEvent& event ){
85 void wxMaracasSurfaceRenderingProp3D::onOpacityRelease(wxScrollEvent& event ){
87 wxMaracasSurfaceRendering::getInstance()->changeOpacity(this->getPropId(),opacity->GetValue());
91 void wxMaracasSurfaceRenderingProp3D::onViewImage(wxCommandEvent& event){
93 //if(mwxwidget->ShowModal()==wxID_OK){
95 // mwxwidget->Show(false);