1 #include "labelcombobox.hpp"
4 labeledcombobox::labeledcombobox(wxSizer
* sizer
, wxWindow
* parent
, const std::string
& label
, wxString
* choices
,
5 size_t choice_count
, size_t defaultidx
, bool start_enabled
, wxEvtHandler
* dispatch_to
,
6 wxObjectEventFunction on_fn_change
)
8 sizer
->Add(new wxStaticText(parent
, wxID_ANY
, towxstring(label
)), 0, wxGROW
);
9 sizer
->Add(combo
= new wxComboBox(parent
, wxID_ANY
, choices
[defaultidx
], wxDefaultPosition
, wxDefaultSize
,
10 choice_count
, choices
, wxCB_READONLY
), 0, wxGROW
);
12 combo
->Connect(wxEVT_COMMAND_COMBOBOX_SELECTED
, on_fn_change
, NULL
, dispatch_to
);
13 combo
->Enable(start_enabled
);
14 enabled
= start_enabled
;
18 std::string
labeledcombobox::get_choice()
20 return tostdstring(combo
->GetValue());
23 void labeledcombobox::enable()
25 if(forced
&& !enabled
)
26 combo
->SetValue(remembered
);
31 void labeledcombobox::disable(const wxString
& choice
)
35 remembered
= combo
->GetValue();
36 combo
->SetValue(choice
);
41 void labeledcombobox::disable()
45 remembered
= combo
->GetValue();