From 2f518094d7db4e8586eba9c741289735794c572c Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Wed, 1 Mar 2023 01:23:44 +0100 Subject: Add Choice::get_data(). --- src/wx/dcpomatic_choice.cc | 12 ++++++++++++ src/wx/dcpomatic_choice.h | 1 + 2 files changed, 13 insertions(+) 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 +Choice::get_data() const +{ + auto index = get(); + if (!index) { + return {}; + } + + return dynamic_cast(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 get() const; + boost::optional get_data() const; template void bind(Args... args) { -- cgit v1.2.3