summaryrefslogtreecommitdiff
path: root/src/wx/wx_util.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2015-04-29 22:10:50 +0100
committerCarl Hetherington <cth@carlh.net>2015-04-29 22:10:50 +0100
commitb4e9d90b9d83c952563ccabc435a5d4310ee4853 (patch)
tree2eddd6bab831528fce9c93a57f09ae61a44fe69a /src/wx/wx_util.cc
parentd43aadb0bbb5cbdebbc5c95cb3065ed0aa49296a (diff)
Hand-apply b737b25e10a4bcfb8cb645e95a089192347b4805 from master; more deflickering.
Diffstat (limited to 'src/wx/wx_util.cc')
-rw-r--r--src/wx/wx_util.cc31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/wx/wx_util.cc b/src/wx/wx_util.cc
index cd3d39c67..a46ba98e2 100644
--- a/src/wx/wx_util.cc
+++ b/src/wx/wx_util.cc
@@ -180,6 +180,29 @@ checked_set (wxChoice* widget, string value)
}
void
+checked_set (wxChoice* widget, vector<pair<string, string> > items)
+{
+ vector<pair<string, string> > current;
+ for (unsigned int i = 0; i < widget->GetCount(); ++i) {
+ current.push_back (
+ make_pair (
+ wx_to_std (widget->GetString (i)),
+ string_client_data (widget->GetClientObject (i))
+ )
+ );
+ }
+
+ if (current == items) {
+ return;
+ }
+
+ widget->Clear ();
+ for (vector<pair<string, string> >::const_iterator i = items.begin(); i != items.end(); ++i) {
+ widget->Append (std_to_wx (i->first), new wxStringClientData (std_to_wx (i->second)));
+ }
+}
+
+void
checked_set (wxTextCtrl* widget, string value)
{
if (widget->GetValue() != std_to_wx (value)) {
@@ -188,6 +211,14 @@ checked_set (wxTextCtrl* widget, string value)
}
void
+checked_set (wxTextCtrl* widget, wxString value)
+{
+ if (widget->GetValue() != value) {
+ widget->ChangeValue (value);
+ }
+}
+
+void
checked_set (wxStaticText* widget, string value)
{
if (widget->GetLabel() != std_to_wx (value)) {