summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2024-08-09 02:20:36 +0200
committerCarl Hetherington <cth@carlh.net>2024-09-03 17:02:24 +0200
commit6c5cd3e54f7a63ca89a824944b3c87236815764b (patch)
treee75327860d23ecfdcd2eda47da332ef4e43b285d /src
parentcc090db73c3ababa4b208711c1a2098f393e8dcd (diff)
Add some convenience methods to the Choice class.
Diffstat (limited to 'src')
-rw-r--r--src/wx/dcpomatic_choice.cc21
-rw-r--r--src/wx/dcpomatic_choice.h4
2 files changed, 25 insertions, 0 deletions
diff --git a/src/wx/dcpomatic_choice.cc b/src/wx/dcpomatic_choice.cc
index ab7823901..52aaa4fc4 100644
--- a/src/wx/dcpomatic_choice.cc
+++ b/src/wx/dcpomatic_choice.cc
@@ -83,6 +83,13 @@ Choice::add_entry(wxString const& entry, wxString const& data)
void
+Choice::add_entry(wxString const& entry, string const& data)
+{
+ add_entry(entry, std_to_wx(data));
+}
+
+
+void
Choice::set_entries(wxArrayString const& entries)
{
if (GetStrings() == entries) {
@@ -115,6 +122,13 @@ Choice::set_by_data(wxString const& data)
}
+void
+Choice::set_by_data(string const& data)
+{
+ set_by_data(std_to_wx(data));
+}
+
+
optional<int>
Choice::get() const
{
@@ -138,3 +152,10 @@ Choice::get_data() const
return dynamic_cast<wxStringClientData*>(GetClientObject(*index))->GetData();
}
+
+void
+Choice::clear()
+{
+ Clear();
+}
+
diff --git a/src/wx/dcpomatic_choice.h b/src/wx/dcpomatic_choice.h
index cc8115d20..5417c1aa2 100644
--- a/src/wx/dcpomatic_choice.h
+++ b/src/wx/dcpomatic_choice.h
@@ -35,11 +35,15 @@ public:
void add_entry(wxString const& entry);
void add_entry(wxString const& entry, wxClientData* data);
void add_entry(wxString const& entry, wxString const& data);
+ void add_entry(wxString const& entry, std::string const& data);
void add_entry(std::string const& entry);
void set_entries(wxArrayString const& entries);
+ void clear();
+
void set(int index);
void set_by_data(wxString const& data);
+ void set_by_data(std::string const& data);
boost::optional<int> get() const;
boost::optional<wxString> get_data() const;