X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=packages%2Fwx%2Fsrc%2FbbwxCommandButton.cxx;h=5ad78e5b8110918aa62c4093daf11e9b7f730cf2;hb=ed9d32f344e2ffa223081390b63f064cf1e42de0;hp=a89bcc8efc717c1d1ee6e313c7751aac09e2b2f8;hpb=6575a389b71b1b85c79e4444885becb76ecf16e4;p=bbtk.git diff --git a/packages/wx/src/bbwxCommandButton.cxx b/packages/wx/src/bbwxCommandButton.cxx index a89bcc8..5ad78e5 100644 --- a/packages/wx/src/bbwxCommandButton.cxx +++ b/packages/wx/src/bbwxCommandButton.cxx @@ -2,8 +2,8 @@ Program: bbtk Module: $RCSfile: bbwxCommandButton.cxx,v $ Language: C++ - Date: $Date: 2008/10/17 08:18:32 $ - Version: $Revision: 1.11 $ + Date: $Date: 2009/05/15 14:58:03 $ + Version: $Revision: 1.15 $ =========================================================================*/ /* --------------------------------------------------------------------- @@ -46,8 +46,27 @@ namespace bbwx { - BBTK_ADD_BLACK_BOX_TO_PACKAGE(wx,CommandButton); - + + + //-------------------------------------------------------------------------- + class CommandButtonWidget : public wxPanel + { + public: + CommandButtonWidget(CommandButton* box, wxWindow *parent, + wxString title); + ~CommandButtonWidget(); + void OnCommandButton( wxEvent& ); + void SetLabel(wxString title); + void SetColour(wxColour color); + + private: + CommandButton* mBox; + wxButton *mwxCommandButton; + }; + + //-------------------------------------------------------------------------- + //-------------------------------------------------------------------------- + CommandButtonWidget::CommandButtonWidget(CommandButton* box, wxWindow *parent, wxString title ) @@ -166,25 +185,41 @@ namespace bbwx //-------------------------------------------------------------------------- //-------------------------------------------------------------------------- - + BBTK_ADD_BLACK_BOX_TO_PACKAGE(wx,CommandButton); BBTK_BLACK_BOX_IMPLEMENTATION(CommandButton,bbtk::WxBlackBox); - void CommandButton::bbUserConstructor() - { - bbSetInputIn(""); - bbSetInputLabel(""); - std::vector lstColour; - lstColour.push_back(0.75); - lstColour.push_back(0.75); - lstColour.push_back(0.75); - bbSetInputColour(lstColour); - } - +//----------------------------------------------------------------- + void CommandButton::bbUserSetDefaultValues() + { + bbSetInputIn(""); + bbSetInputLabel(""); + std::vector lstColour; + lstColour.push_back(0.75); + lstColour.push_back(0.75); + lstColour.push_back(0.75); + bbSetInputColour(lstColour); + bbSetOutputWidget(0); + } + + //----------------------------------------------------------------- + void CommandButton::bbUserInitializeProcessing() + { + } + + //----------------------------------------------------------------- + void CommandButton::bbUserFinalizeProcessing() + { + } + void CommandButton::Process() { - UpdateColour(); - UpdateLabel(); + CommandButtonWidget* w = (CommandButtonWidget*)bbGetOutputWidget(); + if (w) + { + UpdateColour(); + UpdateLabel(); + } } void CommandButton::UpdateColour() @@ -205,6 +240,7 @@ namespace bbwx } } + void CommandButton::UpdateLabel() { CommandButtonWidget* wxwidget = (CommandButtonWidget*)bbGetOutputWidget(); @@ -216,11 +252,12 @@ namespace bbwx * * */ - void CommandButton::CreateWidget() + void CommandButton::CreateWidget(wxWindow* parent) { bbSetOutputWidget - ( new CommandButtonWidget ( this, bbGetWxParent(), - bbtk::std2wx(bbGetInputLabel()) ) ); + ( new CommandButtonWidget ( this, //bbGetWxParent(), + parent, + bbtk::std2wx(bbGetInputLabel()) ) ); UpdateColour(); }