+++ /dev/null
-//=====
-// 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 "bbwtComboBox.h"
-#include "bbwtPackage.h"
-namespace bbwt
-{
-
- class ComboBoxWidget : public Wt::WContainerWidget
- {
- public:
- ComboBoxWidget(ComboBox* box, Wt::WContainerWidget *parent,
- int iSelection,
- Wt::WString title,
- int typeForm);
- ~ComboBoxWidget();
- void OnComboBox();
- void AddItems( std::vector<std::string> lstIn );
-
- private:
- int mTypeForm;
- ComboBox *mBox;
- Wt::WComboBox *wtCmbBox;
- Wt::WSelectionBox *wtSlctBox;
- Wt::WComboBox *selection;
- //TODO choice
-
- };
-
- //------------------------------------------------------------------------
- //------------------------------------------------------------------------
- //------------------------------------------------------------------------
-
-
- ComboBoxWidget::ComboBoxWidget(ComboBox* box, Wt::WContainerWidget *parent,
- int iSelection,
- Wt::WString title,
- int typeForm)
- :
- Wt::WContainerWidget(parent),
- mBox(box),
- mTypeForm(typeForm)
- {
-
- Wt::WContainerWidget *panel = this;
- Wt::WBorderLayout *layout = new Wt::WBorderLayout();
- int i;
- if(title!="")
- {
- layout->addWidget(new Wt::WText(title),Wt::WBorderLayout::North);
- }
-
- if(mTypeForm == 0)
- {
- wtCmbBox = new Wt::WComboBox();
- selection = wtCmbBox;
- } else {
- wtSlctBox = new Wt::WSelectionBox();
- // wtSlctBox->setSelectionMode(Wt::ExtendedSelection);
- selection = wtSlctBox;
- }
-
- selection->activated().connect(this,&ComboBoxWidget::OnComboBox);
-
- layout->addWidget(selection,Wt::WBorderLayout::Center);
- panel->setLayout(layout);
- }
-
-//-------------------------------------------------------------------------
- ComboBoxWidget::~ComboBoxWidget()
- {
- }
-
-//--------------------------------------------------------------------------
- void ComboBoxWidget::OnComboBox()
- {
- mBox->bbSetInputSelection( selection->currentIndex() );
- mBox->bbSetOutputOut( selection->currentIndex() );
- mBox->bbSetOutputOutString( bbtk::wt2std( selection->valueText() ) );
- mBox->bbSignalOutputModification("Out");
- mBox->bbSignalOutputModification("OutString");
- }
-
-//--------------------------------------------------------------------------
- void ComboBoxWidget::AddItems( std::vector<std::string> lstIn )
- {
- int i;
- for (i=0;i<lstIn.size(); i++)
- {
- selection->addItem(bbtk::std2wt(lstIn[i]));
- } // for i
- }
-
-
-
-BBTK_ADD_BLACK_BOX_TO_PACKAGE(wt,ComboBox)
-BBTK_BLACK_BOX_IMPLEMENTATION(ComboBox,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 ComboBox::Process()
-{
-
- ComboBoxWidget *widget = (ComboBoxWidget *)bbGetOutputWidget();
- widget->AddItems( 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 ComboBox::CreateWidget(Wt::WContainerWidget* parent)
-{
-
- ComboBoxWidget *w = new ComboBoxWidget(
- this,
- parent,
- bbGetInputSelection() ,
- bbGetInputTitle(),
-// bbGetInputIn(),
- bbGetInputForm() );
-
- bbSetOutputOut( bbGetInputSelection() );
- bbSetOutputOutString( bbGetInputIn()[ bbGetInputSelection() ] );
- 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 ComboBox::bbUserSetDefaultValues()
-{
- bbSetInputSelection(0);
- bbSetInputTitle("");
- bbSetInputForm(0);
-}
-//=====
-// 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 ComboBox::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 ComboBox::bbUserFinalizeProcessing()
-{
-
-}
-}
-// EO namespace bbwt
-
-