Fix missing scrollbar in the audio tab on macOS/Windows (#2480).
[dcpomatic.git] / src / wx / dcpomatic_choice.cc
index 168d76430bfc3822fce2a2685c6980fbf74d6142..b639dd0f912540c5e8e060784970dac16599764a 100644 (file)
@@ -70,6 +70,18 @@ Choice::add(wxString const& entry, wxClientData* data)
 }
 
 
+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)
 {
@@ -88,3 +100,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();
+}
+