summaryrefslogtreecommitdiff
path: root/wx+/no_flicker.h
diff options
context:
space:
mode:
authorDaniel Wilhelm <daniel@wili.li>2014-04-18 17:26:50 +0200
committerDaniel Wilhelm <daniel@wili.li>2014-04-18 17:26:50 +0200
commit669df123648aaa6aeccc70206b5417bc48b4e9ae (patch)
tree463c107a8d6405020bb304f7a7253e6b64afeee0 /wx+/no_flicker.h
parent5.18 (diff)
downloadFreeFileSync-669df123648aaa6aeccc70206b5417bc48b4e9ae.tar.gz
FreeFileSync-669df123648aaa6aeccc70206b5417bc48b4e9ae.tar.bz2
FreeFileSync-669df123648aaa6aeccc70206b5417bc48b4e9ae.zip
5.19
Diffstat (limited to 'wx+/no_flicker.h')
-rw-r--r--wx+/no_flicker.h17
1 files changed, 12 insertions, 5 deletions
diff --git a/wx+/no_flicker.h b/wx+/no_flicker.h
index ea9efb4d..fd64628f 100644
--- a/wx+/no_flicker.h
+++ b/wx+/no_flicker.h
@@ -15,20 +15,27 @@ namespace zen
inline
void setText(wxTextCtrl& control, const wxString& newText, bool* additionalLayoutChange = nullptr)
{
+ const wxString& label = control.GetValue(); //perf: don't call twice!
if (additionalLayoutChange && !*additionalLayoutChange) //never revert from true to false!
- *additionalLayoutChange = control.GetValue().length() != newText.length(); //avoid screen flicker: update layout only when necessary
+ *additionalLayoutChange = label.length() != newText.length(); //avoid screen flicker: update layout only when necessary
- if (control.GetValue() != newText)
+ if (label != newText)
control.ChangeValue(newText);
}
inline
-void setText(wxStaticText& control, const wxString& newText, bool* additionalLayoutChange = nullptr)
+void setText(wxStaticText& control, wxString newText, bool* additionalLayoutChange = nullptr)
{
+#ifdef ZEN_WIN
+ //wxStaticText handles ampersands incorrectly: https://sourceforge.net/p/freefilesync/bugs/279/
+ replace(newText, L'&', L"&&");
+#endif
+
+ const wxString& label = control.GetLabel(); //perf: don't call twice!
if (additionalLayoutChange && !*additionalLayoutChange)
- *additionalLayoutChange = control.GetLabel().length() != newText.length(); //avoid screen flicker: update layout only when necessary
+ *additionalLayoutChange = label.length() != newText.length(); //avoid screen flicker: update layout only when necessary
- if (control.GetLabel() != newText)
+ if (label != newText)
control.SetLabel(newText);
}
}
bgstack15