]> git.saurik.com Git - wxWidgets.git/blob - include/wx/wupdlock.h
compilation
[wxWidgets.git] / include / wx / wupdlock.h
1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: wx/wupdlock.h
3 // Purpose: wxWindowUpdateLocker prevents window redrawing
4 // Author: Vadim Zeitlin
5 // Created: 2006-03-06
6 // RCS-ID: $Id$
7 // Copyright: (c) 2006 Vadim Zeitlin <vadim@wxwindows.org>
8 // Licence: wxWindows licence
9 ///////////////////////////////////////////////////////////////////////////////
10
11 #ifndef _WX_WUPDLOCK_H_
12 #define _WX_WUPDLOCK_H_
13
14 #include "wx/window.h"
15
16 // ----------------------------------------------------------------------------
17 // wxWindowUpdateLocker prevents updates to the window during its lifetime
18 // ----------------------------------------------------------------------------
19
20 class wxWindowUpdateLocker
21 {
22 public:
23 // create an object preventing updates of the given window (which must have
24 // a lifetime at least as great as ours)
25 wxWindowUpdateLocker(wxWindow *win) : m_win(win) { win->Freeze(); }
26
27 // dtor thaws the window to permit updates again
28 ~wxWindowUpdateLocker() { m_win->Thaw(); }
29
30 private:
31 wxWindow *m_win;
32
33 DECLARE_NO_COPY_CLASS(wxWindowUpdateLocker)
34 };
35
36 #endif // _WX_WUPDLOCK_H_
37