1 #include "core/command.hpp"
3 #include "plat-wxwidgets/labelcombobox.hpp"
5 labeledcombobox::labeledcombobox(wxSizer
* sizer
, wxWindow
* parent
, const std::string
& label
, wxString
* choices
,
6 size_t choice_count
, size_t defaultidx
, bool start_enabled
, wxEvtHandler
* dispatch_to
,
7 wxObjectEventFunction on_fn_change
)
9 sizer
->Add(new wxStaticText(parent
, wxID_ANY
, towxstring(label
)), 0, wxGROW
);
10 sizer
->Add(combo
= new wxComboBox(parent
, wxID_ANY
, choices
[defaultidx
], wxDefaultPosition
, wxDefaultSize
,
11 choice_count
, choices
, wxCB_READONLY
), 0, wxGROW
);
13 combo
->Connect(wxEVT_COMMAND_COMBOBOX_SELECTED
, on_fn_change
, NULL
, dispatch_to
);
14 combo
->Enable(start_enabled
);
15 enabled
= start_enabled
;
19 std::string
labeledcombobox::get_choice()
21 return tostdstring(combo
->GetValue());
24 void labeledcombobox::enable()
26 if(forced
&& !enabled
)
27 combo
->SetValue(remembered
);
32 void labeledcombobox::disable(const wxString
& choice
)
36 remembered
= combo
->GetValue();
37 combo
->SetValue(choice
);
42 void labeledcombobox::disable()
46 remembered
= combo
->GetValue();