2 // 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)
4 #include "bbwtCheckBox.h"
5 #include "bbwtPackage.h"
9 class CheckBoxWidget : public Wt::WContainerWidget
12 /// Ctor with the two first params the parent window and the creator box
13 /// which must be passed to the WxBlackBoxWidget constructor.
14 /// The other params initialize the widget
15 CheckBoxWidget(CheckBox* box, Wt::WContainerWidget *parent,
17 bool value, int reactiveOnKeyStroke
21 bool GetValue(){return mwtCheckBox->isChecked();}
22 void SetValue(bool val);
23 void OnCheckBoxClick();
27 Wt::WCheckBox *mwtCheckBox;
28 int _reactiveOnKeyStroke;
33 //------------------------------------------------------------------------
34 //------------------------------------------------------------------------
35 //------------------------------------------------------------------------
37 CheckBoxWidget::CheckBoxWidget(CheckBox* box, Wt::WContainerWidget *parent,
39 bool value, int reactiveOnKeyStroke
42 Wt::WContainerWidget(parent),
44 _reactiveOnKeyStroke(reactiveOnKeyStroke),
49 Wt::WContainerWidget * panel = this;
51 panel->setContentAlignment(Wt::AlignCenter|Wt::AlignMiddle);
52 //The definition of wt checkbox determines that there is a possible tristate,
53 mwtCheckBox = new Wt::WCheckBox(title,panel);
54 mwtCheckBox->clicked().connect(this,&CheckBoxWidget::OnCheckBoxClick);
58 //-------------------------------------------------------------------------
61 //-------------------------------------------------------------------------
62 void CheckBoxWidget::OnCheckBoxClick()
64 // When user clicks the box
65 // we update the output of the box
66 mBox->bbSetOutputOut( mwtCheckBox->isChecked() );
67 mBox->bbSetInputIn( mwtCheckBox->isChecked() );
68 // and signal that the output has changed
69 //if(_reactiveOnKeyStroke==1){
70 mBox->bbSignalOutputModification(std::string("Out"));
74 //-------------------------------------------------------------------------
77 //-------------------------------------------------------------------------
78 CheckBoxWidget::~CheckBoxWidget()
81 //-------------------------------------------------------------------------
84 //-------------------------------------------------------------------------
85 void CheckBoxWidget::SetValue(bool value)
88 mwtCheckBox->setChecked(value);
91 BBTK_ADD_BLACK_BOX_TO_PACKAGE(wt,CheckBox)
92 BBTK_BLACK_BOX_IMPLEMENTATION(CheckBox,bbtk::WtBlackBox);
94 // 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)
96 void CheckBox::Process()
99 bbSetOutputOut( bbGetInputIn() );
103 // 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)
105 void CheckBox::CreateWidget(Wt::WContainerWidget* parent)
108 CheckBoxWidget *w = new CheckBoxWidget(this,
110 bbtk::std2wt( bbGetInputTitle() ),
112 bbGetInputReactiveOnKeystroke()
114 bbSetOutputWidget( w );
117 // 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)
119 void CheckBox::bbUserSetDefaultValues()
123 bbSetInputReactiveOnKeystroke(1);
124 bbSetOutputOut(false);
127 // 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)
129 void CheckBox::bbUserInitializeProcessing()
134 // 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)
136 void CheckBox::bbUserFinalizeProcessing()