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 SetItems( 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::SetItems( std::vector<std::string> lstIn )
91 for (i=0;i<lstIn.size(); i++)
93 selection->addItem(bbtk::std2wt(lstIn[i]));
99 BBTK_ADD_BLACK_BOX_TO_PACKAGE(wt,ComboBox)
100 BBTK_BLACK_BOX_IMPLEMENTATION(ComboBox,bbtk::WtBlackBox);
102 // 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)
104 void ComboBox::Process()
107 ComboBoxWidget *widget = (ComboBoxWidget *)bbGetOutputWidget();
108 widget->SetItems( bbGetInputIn() );
110 if (bbGetInputIn().size()>0)
112 bbSetOutputOutString( bbGetInputIn()[0] );
114 bbSetOutputOutString( "" );
118 // 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)
120 void ComboBox::CreateWidget(Wt::WContainerWidget* parent)
123 ComboBoxWidget *w = new ComboBoxWidget(
126 bbGetInputSelection() ,
131 bbSetOutputOut( bbGetInputSelection() );
132 bbSetOutputOutString( bbGetInputIn()[ bbGetInputSelection() ] );
133 bbSetOutputWidget( w );
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::bbUserSetDefaultValues()
141 bbSetInputSelection(0);
146 // 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)
148 void ComboBox::bbUserInitializeProcessing()
153 // 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)
155 void ComboBox::bbUserFinalizeProcessing()