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