//===== // 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 "bbwtCheckBox.h" #include "bbwtPackage.h" namespace bbwt { class CheckBoxWidget : public Wt::WContainerWidget { public: /// Ctor with the two first params the parent window and the creator box /// which must be passed to the WxBlackBoxWidget constructor. /// The other params initialize the widget CheckBoxWidget(CheckBox* box, Wt::WContainerWidget *parent, Wt::WString title, bool value, int reactiveOnKeyStroke ); ~CheckBoxWidget(); bool GetValue(){return mwtCheckBox->isChecked();} void SetValue(bool val); void OnCheckBoxClick(); private: CheckBox* mBox; Wt::WCheckBox *mwtCheckBox; int _reactiveOnKeyStroke; bool val; }; //------------------------------------------------------------------------ //------------------------------------------------------------------------ //------------------------------------------------------------------------ CheckBoxWidget::CheckBoxWidget(CheckBox* box, Wt::WContainerWidget *parent, Wt::WString title, bool value, int reactiveOnKeyStroke ) : Wt::WContainerWidget(parent), mBox(box), _reactiveOnKeyStroke(reactiveOnKeyStroke), val(value) { Wt::WContainerWidget * panel = this; panel->setPadding(2); panel->setContentAlignment(Wt::AlignCenter|Wt::AlignMiddle); //The definition of wt checkbox determines that there is a possible tristate, mwtCheckBox = new Wt::WCheckBox(title,panel); mwtCheckBox->clicked().connect(this,&CheckBoxWidget::OnCheckBoxClick); } //------------------------------------------------------------------------- //------------------------------------------------------------------------- void CheckBoxWidget::OnCheckBoxClick() { // When user clicks the box // we update the output of the box mBox->bbSetOutputOut( mwtCheckBox->isChecked() ); mBox->bbSetInputIn( mwtCheckBox->isChecked() ); // and signal that the output has changed //if(_reactiveOnKeyStroke==1){ mBox->bbSignalOutputModification(std::string("Out")); //} } //------------------------------------------------------------------------- //------------------------------------------------------------------------- CheckBoxWidget::~CheckBoxWidget() { } //------------------------------------------------------------------------- //------------------------------------------------------------------------- void CheckBoxWidget::SetValue(bool value) { this->val=value; mwtCheckBox->setChecked(value); } BBTK_ADD_BLACK_BOX_TO_PACKAGE(wt,CheckBox) BBTK_BLACK_BOX_IMPLEMENTATION(CheckBox,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 CheckBox::Process() { bbSetOutputOut( bbGetInputIn() ); } //===== // 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 CheckBox::CreateWidget(Wt::WContainerWidget* parent) { CheckBoxWidget *w = new CheckBoxWidget(this, parent, bbtk::std2wt( bbGetInputTitle() ), bbGetInputIn(), bbGetInputReactiveOnKeystroke() ); 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 CheckBox::bbUserSetDefaultValues() { bbSetInputIn(false); bbSetInputReactiveOnKeystroke(1); bbSetOutputOut(false); } //===== // 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 CheckBox::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 CheckBox::bbUserFinalizeProcessing() { } } // EO namespace bbwt