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 "bbwtComboBox.h"
5 #include "bbwtPackage.h"
9 class ComboBoxWidget : public Wt::WContainerWidget
12 ComboBoxWidget(ComboBox* box, Wt::WContainerWidget *parent,
18 void AddItems( std::vector<std::string> lstIn );
23 Wt::WComboBox *wtCmbBox;
24 Wt::WSelectionBox *wtSlctBox;
25 Wt::WComboBox *selection;
30 //------------------------------------------------------------------------
31 //------------------------------------------------------------------------
32 //------------------------------------------------------------------------
35 ComboBoxWidget::ComboBoxWidget(ComboBox* box, Wt::WContainerWidget *parent,
40 Wt::WContainerWidget(parent),
45 Wt::WContainerWidget *panel = this;
46 Wt::WBorderLayout *layout = new Wt::WBorderLayout();
50 layout->addWidget(new Wt::WText(title),Wt::WBorderLayout::North);
55 wtCmbBox = new Wt::WComboBox();
58 wtSlctBox = new Wt::WSelectionBox();
59 // wtSlctBox->setSelectionMode(Wt::ExtendedSelection);
60 selection = wtSlctBox;
63 selection->activated().connect(this,&ComboBoxWidget::OnComboBox);
65 layout->addWidget(selection,Wt::WBorderLayout::Center);
66 panel->setLayout(layout);
69 //-------------------------------------------------------------------------
70 ComboBoxWidget::~ComboBoxWidget()
74 //--------------------------------------------------------------------------
75 void ComboBoxWidget::OnComboBox()
77 mBox->bbSetInputSelection( selection->currentIndex() );
78 mBox->bbSetOutputOut( selection->currentIndex() );
79 mBox->bbSetOutputOutString( bbtk::wt2std( selection->valueText() ) );
80 mBox->bbSignalOutputModification("Out");
81 mBox->bbSignalOutputModification("OutString");
84 //--------------------------------------------------------------------------
85 void ComboBoxWidget::AddItems( std::vector<std::string> lstIn )
88 for (i=0;i<lstIn.size(); i++)
90 selection->addItem(bbtk::std2wt(lstIn[i]));
96 BBTK_ADD_BLACK_BOX_TO_PACKAGE(wt,ComboBox)
97 BBTK_BLACK_BOX_IMPLEMENTATION(ComboBox,bbtk::WtBlackBox);
99 // 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)
101 void ComboBox::Process()
104 ComboBoxWidget *widget = (ComboBoxWidget *)bbGetOutputWidget();
105 widget->AddItems( bbGetInputIn() );
109 // 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)
111 void ComboBox::CreateWidget(Wt::WContainerWidget* parent)
114 ComboBoxWidget *w = new ComboBoxWidget(
117 bbGetInputSelection() ,
122 bbSetOutputOut( bbGetInputSelection() );
123 bbSetOutputOutString( bbGetInputIn()[ bbGetInputSelection() ] );
124 bbSetOutputWidget( w );
128 // 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)
130 void ComboBox::bbUserSetDefaultValues()
132 bbSetInputSelection(0);
137 // 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)
139 void ComboBox::bbUserInitializeProcessing()
144 // 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)
146 void ComboBox::bbUserFinalizeProcessing()