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 "bbwxComboBox.h"
5 #include "bbwxPackage.h"
11 #include <wx/choice.h>
15 //--------------------------------------------------------------------------
16 // The widget created by the box
17 class ComboBoxWidget : public wxPanel
20 ComboBoxWidget( ComboBox* box, wxWindow *parent,
23 std::vector< std::string > lstIn );
27 void OnComboBox(wxEvent& event);
36 //------------------------------------------------------------------------
37 //------------------------------------------------------------------------
38 //------------------------------------------------------------------------
40 //-------------------------------------------------------------------------
41 ComboBoxWidget::ComboBoxWidget( ComboBox* box,
45 std::vector< std::string > lstIn )
47 wxPanel( parent, -1) ,
50 wxPanel *panel = this;
54 //---------------------------------------------------------------------
55 // 1) Creation de wxChoise widget
57 wxchoice = new wxChoice ( panel , -1 );
59 Connect( wxchoice->GetId(), wxEVT_COMMAND_CHOICE_SELECTED, (wxObjectEventFunction) (void (wxPanel::*)(wxEvent&))&ComboBoxWidget::OnComboBox );
62 for (i=0;i<lstIn.size(); i++)
64 wxchoice->Append( bbtk::std2wx( lstIn[i] ) );
66 wxchoice->SetSelection(iSelection);
68 //---------------------------------------------------------------------
69 // 2) Insertion of the components in the window
71 // We use a FlexGridSizer
72 wxFlexGridSizer *sizer = new wxFlexGridSizer(1);
75 sizer->Add( new wxStaticText(panel,-1, bbtk::std2wx(title) ) );
77 sizer->Add( wxchoice,1,wxGROW );
78 sizer->AddGrowableCol(0);
79 panel->SetSizer(sizer);
81 // panel->SetAutoLayout(true);
85 //-------------------------------------------------------------------------
87 ComboBoxWidget::~ComboBoxWidget()
91 //--------------------------------------------------------------------------
92 void ComboBoxWidget::OnComboBox(wxEvent& event)
95 int iSelection = wxchoice->GetSelection();
96 mBox->bbSetInputSelection( iSelection );
98 mBox->bbSetOutputOut( iSelection );
99 mBox->bbSetOutputOutString( bbtk::wx2std( wxchoice->GetString(iSelection) ) );
100 mBox->bbSignalOutputModification("Out");
101 mBox->bbSignalOutputModification("OutString");
105 BBTK_ADD_BLACK_BOX_TO_PACKAGE(wx,ComboBox)
106 BBTK_BLACK_BOX_IMPLEMENTATION(ComboBox,bbtk::WxBlackBox);
108 // 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)
110 void ComboBox::Process()
114 // 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)
116 void ComboBox::CreateWidget(wxWindow* parent)
119 // bbSetOutputWidget( new wxStaticText ( parent , -1 , _T("") ) );
120 // bbSetOutputWidget( new wxComboBox ( parent , -1 , _T("ups") ) );
121 // bbSetOutputWidget( new wxChoice ( parent , -1 ) );
123 ComboBoxWidget *w = new ComboBoxWidget(
126 bbGetInputSelection() ,
130 bbSetOutputOut( bbGetInputSelection() );
131 bbSetOutputOutString( bbGetInputIn()[ bbGetInputSelection() ] );
132 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);
145 // 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)
147 void ComboBox::bbUserInitializeProcessing()
152 // 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)
154 void ComboBox::bbUserFinalizeProcessing()