#include "wxMaracasSurfaceRenderingProp3D.h" #include #include "wxMaracasSurfaceRendering.h" #include #include "Color.xpm" /** ** Implementation of SurfaceRenderingProp3D **/ wxMaracasSurfaceRenderingProp3D::wxMaracasSurfaceRenderingProp3D(wxWindow* parent,int propid) :wxMaracasSurfaceRenderingPanel(parent, propid){ createControls(); } wxMaracasSurfaceRenderingProp3D::~wxMaracasSurfaceRenderingProp3D(){ //wxMaracasSurfaceRendering::getInstance()->addRemoveActor(_propid, false); wxMaracasSurfaceRendering::getInstance()->deleteActor(_propid); } void wxMaracasSurfaceRenderingProp3D::createControls(){ wxFlexGridSizer* sizersurrendprop = new wxFlexGridSizer(1,1,1); wxString choices[2]; choices[0] = wxString(_T("On")); choices[1] = wxString(_T("Off")); checkbox = new wxCheckBox(this,-1,wxString(_T("Show Actor"))); Connect(checkbox->GetId(), wxEVT_COMMAND_CHECKBOX_CLICKED, (wxObjectEventFunction)&wxMaracasSurfaceRenderingProp3D::onCheckBoxChange); checkbox->SetValue(true); sizersurrendprop->Add(checkbox,wxFIXED_MINSIZE); //this->addControl(checkbox); wxBitmap bitmap(Color_xpm); _colorchoose = new wxBitmapButton(this, -1, bitmap,wxDefaultPosition,wxSize(30,30)); Connect(_colorchoose->GetId(), wxEVT_COMMAND_BUTTON_CLICKED, (wxObjectEventFunction)&wxMaracasSurfaceRenderingProp3D::onColorChange); sizersurrendprop->Add(_colorchoose,wxFIXED_MINSIZE); //sizercolor->Add(checkbox,wxFIXED_MINSIZE); //sizercolor->Add(_colorchoose,wxFIXED_MINSIZE); //this->addControl(sizercolor); wxStaticText* label = new wxStaticText(this, -1, wxString(_T("Opacity"))); opacity = new wxSlider(this, -1,100,0,100,wxDefaultPosition,wxDefaultSize,wxSL_HORIZONTAL|wxSL_LABELS); Connect(opacity->GetId(), wxEVT_SCROLL_CHANGED, (wxObjectEventFunction)&wxMaracasSurfaceRenderingProp3D::onOpacityRelease); wxFlexGridSizer* sizeropacity = new wxFlexGridSizer(1,1,1); sizeropacity->Add(label,wxFIXED_MINSIZE); sizeropacity->Add(opacity,wxFIXED_MINSIZE); sizersurrendprop->Add(sizeropacity,wxFIXED_MINSIZE); /**wxBitmap bitmap1(OpenImage_xpm); _viewimage = new wxBitmapButton(this, -1, bitmap1, wxDefaultPosition, wxSize(30,30)); Connect(_viewimage->GetId(), wxEVT_COMMAND_BUTTON_CLICKED, (wxObjectEventFunction)&wxMaracasSurfaceRenderingProp3D::onViewImage); sizersurrendprop->Add(_viewimage,wxFIXED_MINSIZE); */ //this->addControl(sizeropacity); this->addControl(sizersurrendprop); } void wxMaracasSurfaceRenderingProp3D::onCheckBoxChange(wxCommandEvent& event){ wxMaracasSurfaceRendering::getInstance()->addRemoveActor(this->getPropId(), checkbox->GetValue()); } void wxMaracasSurfaceRenderingProp3D::onColorChange(wxCommandEvent& event){ wxColourDialog* colourdiag = new wxColourDialog(this); if(colourdiag->ShowModal()==wxID_OK){ wxColour colour = colourdiag->GetColourData().GetColour(); _colorchoose->SetBackgroundColour(colour); double r = (double)(colour.Red())/255.0; double g = (double)(colour.Green())/255.0; double b = (double)(colour.Blue())/255.0; wxMaracasSurfaceRendering::getInstance()->changeColor(this->getPropId(),r,g,b); } delete colourdiag; } /*void wxMaracasSurfaceRenderingProp3D::onActionButtonPressedEliminate( wxCommandEvent& event ){ }*/ void wxMaracasSurfaceRenderingProp3D::onOpacityRelease(wxScrollEvent& event ){ wxMaracasSurfaceRendering::getInstance()->changeOpacity(this->getPropId(),opacity->GetValue()); } void wxMaracasSurfaceRenderingProp3D::onViewImage(wxCommandEvent& event){ //if(mwxwidget->ShowModal()==wxID_OK){ // mwxwidget->Show(false); //} }