}
+void
+Choice::add(wxString const& entry, wxString const& data)
+{
+ if (_needs_clearing) {
+ Clear();
+ _needs_clearing = false;
+ }
+
+ Append(entry, new wxStringClientData(data));
+}
+
+
void
Choice::set(int index)
{
}
+void
+Choice::set_by_data(wxString const& data)
+{
+ for (unsigned int i = 0; i < GetCount(); ++i) {
+ if (auto client_data = dynamic_cast<wxStringClientData*>(GetClientObject(i))) {
+ if (client_data->GetData() == data) {
+ set(i);
+ return;
+ }
+ }
+ }
+}
+
+
optional<int>
Choice::get() const
{
return sel;
}
+
+optional<wxString>
+Choice::get_data() const
+{
+ auto index = get();
+ if (!index) {
+ return {};
+ }
+
+ return dynamic_cast<wxStringClientData*>(GetClientObject(*index))->GetData();
+}
+