diff options
| author | Carl Hetherington <cth@carlh.net> | 2023-03-01 01:23:54 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2023-03-03 01:27:53 +0100 |
| commit | 95af8dff734d6931c93d2bb79c73c330eb4aa83a (patch) | |
| tree | 6c0b77fe0f4318e90d06b2a4b917d1da0fe905ae | |
| parent | 2f518094d7db4e8586eba9c741289735794c572c (diff) | |
Add Choice::add() with a client string.
| -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 cf43b13ed..b639dd0f9 100644 --- a/src/wx/dcpomatic_choice.cc +++ b/src/wx/dcpomatic_choice.cc @@ -71,6 +71,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) { SetSelection(index); diff --git a/src/wx/dcpomatic_choice.h b/src/wx/dcpomatic_choice.h index 7c1fadcc0..33d655ad5 100644 --- a/src/wx/dcpomatic_choice.h +++ b/src/wx/dcpomatic_choice.h @@ -34,6 +34,7 @@ public: void add(wxString const& entry); void add(wxString const& entry, wxClientData* data); + void add(wxString const& entry, wxString const& data); void add(std::string const& entry); void set(int index); boost::optional<int> get() const; |
