#include <string>
#include <wx/choice.h>
+#include <wx/control.h>
+#include <wx/listbox.h>
namespace bbwx
{
ComboBoxWidget( ComboBox* box, wxWindow *parent,
int iSelection,
std::string title,
- std::vector< std::string > lstIn );
+ std::vector< std::string > lstIn,
+ int typeForm );
~ComboBoxWidget();
void OnComboBox(wxEvent& event);
private:
- ComboBox *mBox;
+ int mTypeForm;
+ ComboBox *mBox;
+ wxListBox *wxlistbox;
wxChoice *wxchoice;
};
wxWindow *parent,
int iSelection,
std::string title,
- std::vector< std::string > lstIn )
+ std::vector< std::string > lstIn,
+ int typeForm)
:
wxPanel( parent, -1) ,
- mBox(box)
+ mBox(box),
+ mTypeForm(typeForm)
{
- wxPanel *panel = this;
+ wxPanel *panel = this;
+ wxlistbox = NULL;
+ wxchoice = NULL;
+ int i;
-
- //---------------------------------------------------------------------
- // 1) Creation de wxChoise widget
-
- wxchoice = new wxChoice ( panel , -1 );
-
- Connect( wxchoice->GetId(), wxEVT_COMMAND_CHOICE_SELECTED, (wxObjectEventFunction) (void (wxPanel::*)(wxEvent&))&ComboBoxWidget::OnComboBox );
-
- int i;
- for (i=0;i<lstIn.size(); i++)
- {
- wxchoice->Append( bbtk::std2wx( lstIn[i] ) );
- } // for i
- wxchoice->SetSelection(iSelection);
//---------------------------------------------------------------------
// 2) Insertion of the components in the window
{
sizer->Add( new wxStaticText(panel,-1, bbtk::std2wx(title) ) );
}
- sizer->Add( wxchoice,1,wxGROW );
sizer->AddGrowableCol(0);
panel->SetSizer(sizer);
+
+ //---------------------------------------------------------------------
+ // 1) Creation de wxChoise widget
+
+ if (mTypeForm==1)
+ {
+
+ wxlistbox = new wxListBox ( panel , -1 );
+ Connect( wxlistbox->GetId(), wxEVT_COMMAND_CHOICE_SELECTED, (wxObjectEventFunction) (void (wxPanel::*)(wxEvent&))&ComboBoxWidget::OnComboBox );
+ for (i=0;i<lstIn.size(); i++)
+ {
+ wxlistbox->Append( bbtk::std2wx( lstIn[i] ) );
+ } // for i
+ wxlistbox->SetSelection(iSelection);
+ sizer->Add( wxlistbox,1,wxGROW );
+
+ } else {
+
+ wxchoice = new wxChoice ( panel , -1 );
+ Connect( wxchoice->GetId(), wxEVT_COMMAND_CHOICE_SELECTED, (wxObjectEventFunction) (void (wxPanel::*)(wxEvent&))&ComboBoxWidget::OnComboBox );
+ for (i=0;i<lstIn.size(); i++)
+ {
+ wxchoice->Append( bbtk::std2wx( lstIn[i] ) );
+ } // for i
+ wxchoice->SetSelection(iSelection);
+ sizer->Add( wxchoice,1,wxGROW );
+ }
+
+
// panel->SetAutoLayout(true);
// panel->Layout();
//--------------------------------------------------------------------------
void ComboBoxWidget::OnComboBox(wxEvent& event)
{
+ int iSelection;
+ if (mTypeForm==1)
+ {
+ iSelection = wxlistbox->GetSelection();
+ } else {
+ iSelection = wxchoice->GetSelection();
+ }
- int iSelection = wxchoice->GetSelection();
mBox->bbSetInputSelection( iSelection );
-
mBox->bbSetOutputOut( iSelection );
mBox->bbSetOutputOutString( bbtk::wx2std( wxchoice->GetString(iSelection) ) );
mBox->bbSignalOutputModification("Out");
parent,
bbGetInputSelection() ,
bbGetInputTitle(),
- bbGetInputIn() );
+ bbGetInputIn(),
+ bbGetInputForm() );
bbSetOutputOut( bbGetInputSelection() );
bbSetOutputOutString( bbGetInputIn()[ bbGetInputSelection() ] );
{
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)