Add Choice::get_data().
authorCarl Hetherington <cth@carlh.net>
Wed, 1 Mar 2023 00:23:44 +0000 (01:23 +0100)
committerCarl Hetherington <cth@carlh.net>
Fri, 3 Mar 2023 00:27:53 +0000 (01:27 +0100)
src/wx/dcpomatic_choice.cc
src/wx/dcpomatic_choice.h

index 168d76430bfc3822fce2a2685c6980fbf74d6142..cf43b13edc2a8ba1e6b0954db64816b80f3a424c 100644 (file)
@@ -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();
+}
+
index 7c9042de98e9066a43e3e4fdedeff0242712bfd3..7c1fadcc0eb04a3f3fe293d5dd194b3fd8e00774 100644 (file)
@@ -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) {