diff options
| -rw-r--r-- | src/wx/dcpomatic_choice.cc | 12 | ||||
| -rw-r--r-- | src/wx/dcpomatic_choice.h | 1 |
2 files changed, 13 insertions, 0 deletions
diff --git a/src/wx/dcpomatic_choice.cc b/src/wx/dcpomatic_choice.cc index 168d76430..cf43b13ed 100644 --- a/src/wx/dcpomatic_choice.cc +++ b/src/wx/dcpomatic_choice.cc @@ -88,3 +88,15 @@ Choice::get() const return sel; } + +optional<wxString> +Choice::get_data() const +{ + auto index = get(); + if (!index) { + return {}; + } + + return dynamic_cast<wxStringClientData*>(GetClientObject(*index))->GetData(); +} + diff --git a/src/wx/dcpomatic_choice.h b/src/wx/dcpomatic_choice.h index 7c9042de9..7c1fadcc0 100644 --- a/src/wx/dcpomatic_choice.h +++ b/src/wx/dcpomatic_choice.h @@ -37,6 +37,7 @@ public: void add(std::string const& entry); void set(int index); boost::optional<int> get() const; + boost::optional<wxString> get_data() const; template <typename... Args> void bind(Args... args) { |
