//===== // Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost) //===== #include "bbwtRadioButton.h" #include "bbwtPackage.h" #include namespace bbwt { class RadioButtonWidget : public Wt::WContainerWidget { public: RadioButtonWidget( RadioButton* box, Wt::WContainerWidget *parent, int In, Wt::WString title, std::vector lstIn ); ~RadioButtonWidget(); int GetValue(); void OnRadioButton(); private: RadioButton *mBox; int MAX_RADIOBUTTON; Wt::WRadioButton *mwtRadioButton[10]; Wt::WButtonGroup *group; }; //------------------------------------------------------------------------- RadioButtonWidget::RadioButtonWidget( RadioButton* box, Wt::WContainerWidget *parent, int In, Wt::WString title, std::vector lstIn ) : Wt::WContainerWidget( parent) , mBox(box) { Wt::WContainerWidget *panel = this; MAX_RADIOBUTTON = lstIn.size(); int i; Wt::WGroupBox *cont = new Wt::WGroupBox(title); group = new Wt::WButtonGroup(panel); for (i=0;iaddButton(mwtRadioButton[i],i); if (In==i) { mwtRadioButton[i]->setChecked(true); } else { mwtRadioButton[i]->setChecked(false); } mwtRadioButton[i]->checked().connect(this,&RadioButtonWidget::OnRadioButton); } else { mwtRadioButton[i]=NULL; } } panel->addWidget(cont); } //------------------------------------------------------------------------- RadioButtonWidget::~RadioButtonWidget() { } //------------------------------------------------------------------------- int RadioButtonWidget::GetValue() { return group->checkedId(); } //-------------------------------------------------------------------------- void RadioButtonWidget::OnRadioButton() { mBox->bbSetOutputOut( GetValue() ); mBox->bbSetInputIn( GetValue() ); mBox->bbSignalOutputModification("Out"); } //-------------------------------------------------------------------------- //------------------------------------------------------------------------- //-------------------------------------------------------------------------- //-------------------------------------------------------------------------- BBTK_ADD_BLACK_BOX_TO_PACKAGE(wt,RadioButton) BBTK_BLACK_BOX_IMPLEMENTATION(RadioButton,bbtk::WtBlackBox); //===== // Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost) //===== void RadioButton::Process() { } //===== // Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost) //===== void RadioButton::CreateWidget(Wt::WContainerWidget* parent) { std::vector lstIn; lstIn.push_back( bbtk::std2wt(bbGetInputIn0()) ); lstIn.push_back( bbtk::std2wt(bbGetInputIn1()) ); lstIn.push_back( bbtk::std2wt(bbGetInputIn2()) ); lstIn.push_back( bbtk::std2wt(bbGetInputIn3()) ); lstIn.push_back( bbtk::std2wt(bbGetInputIn4()) ); lstIn.push_back( bbtk::std2wt(bbGetInputIn5()) ); lstIn.push_back( bbtk::std2wt(bbGetInputIn6()) ); lstIn.push_back( bbtk::std2wt(bbGetInputIn7()) ); lstIn.push_back( bbtk::std2wt(bbGetInputIn8()) ); lstIn.push_back( bbtk::std2wt(bbGetInputIn9()) ); RadioButtonWidget *w = new RadioButtonWidget( this, // bbGetWxParent(), parent, bbGetInputIn() , bbtk::std2wt(bbGetInputTitle()), lstIn ); bbSetOutputOut( bbGetInputIn() ); bbSetOutputWidget( w ); } //===== // Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost) //===== void RadioButton::bbUserSetDefaultValues() { bbSetInputIn(0); bbSetOutputOut( bbGetInputIn() ); bbSetInputIn0(""); bbSetInputIn1(""); bbSetInputIn2(""); bbSetInputIn3(""); bbSetInputIn4(""); bbSetInputIn5(""); bbSetInputIn6(""); bbSetInputIn7(""); bbSetInputIn8(""); bbSetInputIn9(""); } //===== // Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost) //===== void RadioButton::bbUserInitializeProcessing() { } //===== // Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost) //===== void RadioButton::bbUserFinalizeProcessing() { } } // EO namespace bbwt