From bd9594a3b9958076734c3c6b3e4105d142cde6f4 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Wed, 3 Apr 2024 23:25:19 +0200 Subject: Add Choice::set_entries(). --- src/wx/dcpomatic_choice.cc | 12 ++++++++++++ src/wx/dcpomatic_choice.h | 2 ++ 2 files changed, 14 insertions(+) diff --git a/src/wx/dcpomatic_choice.cc b/src/wx/dcpomatic_choice.cc index 5e5a1e257..f2e215439 100644 --- a/src/wx/dcpomatic_choice.cc +++ b/src/wx/dcpomatic_choice.cc @@ -82,6 +82,18 @@ Choice::add_entry(wxString const& entry, wxString const& data) } +void +Choice::set_entries(wxArrayString const& entries) +{ + if (GetStrings() == entries) { + return; + } + + Clear(); + Set(entries); +} + + void Choice::set(int index) { diff --git a/src/wx/dcpomatic_choice.h b/src/wx/dcpomatic_choice.h index ed59f6a17..cc8115d20 100644 --- a/src/wx/dcpomatic_choice.h +++ b/src/wx/dcpomatic_choice.h @@ -36,6 +36,8 @@ public: void add_entry(wxString const& entry, wxClientData* data); void add_entry(wxString const& entry, wxString const& data); void add_entry(std::string const& entry); + void set_entries(wxArrayString const& entries); + void set(int index); void set_by_data(wxString const& data); boost::optional get() const; -- cgit v1.2.3