diff options
author | Daniel Wilhelm <daniel@wili.li> | 2014-04-18 17:15:39 +0200 |
---|---|---|
committer | Daniel Wilhelm <daniel@wili.li> | 2014-04-18 17:15:39 +0200 |
commit | d2854834e18443876c8f75e0a7f3b88d1d549fc4 (patch) | |
tree | e967b628081e50abc7c34cd264e6586271c7e728 /wx+/no_flicker.h | |
parent | 4.1 (diff) | |
download | FreeFileSync-d2854834e18443876c8f75e0a7f3b88d1d549fc4.tar.gz FreeFileSync-d2854834e18443876c8f75e0a7f3b88d1d549fc4.tar.bz2 FreeFileSync-d2854834e18443876c8f75e0a7f3b88d1d549fc4.zip |
4.2
Diffstat (limited to 'wx+/no_flicker.h')
-rw-r--r-- | wx+/no_flicker.h | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/wx+/no_flicker.h b/wx+/no_flicker.h new file mode 100644 index 00000000..0dceba97 --- /dev/null +++ b/wx+/no_flicker.h @@ -0,0 +1,35 @@ +// ************************************************************************** +// * This file is part of the FreeFileSync project. It is distributed under * +// * GNU General Public License: http://www.gnu.org/licenses/gpl.html * +// * Copyright (C) 2008-2011 ZenJu (zhnmju123 AT gmx.de) * +// ************************************************************************** + +#ifndef NO_FLICKER_HEADER_893421590321532 +#define NO_FLICKER_HEADER_893421590321532 + +#include <wx/window.h> + +namespace zen +{ +inline +void setText(wxTextCtrl& control, const wxString& newText, bool* additionalLayoutChange = NULL) +{ + if (additionalLayoutChange && !*additionalLayoutChange) //never revert from true to false! + *additionalLayoutChange = control.GetValue().length() != newText.length(); //avoid screen flicker: update layout only when necessary + + if (control.GetValue() != newText) + control.ChangeValue(newText); +} + +inline +void setText(wxStaticText& control, const wxString& newText, bool* additionalLayoutChange = NULL) +{ + if (additionalLayoutChange && !*additionalLayoutChange) + *additionalLayoutChange = control.GetLabel().length() != newText.length(); //avoid screen flicker: update layout only when necessary + + if (control.GetLabel() != newText) + control.SetLabel(newText); +} +} + +#endif //NO_FLICKER_HEADER_893421590321532 |