]> git.saurik.com Git - wxWidgets.git/blob - interface/wx/wupdlock.h
generate a size event from ShowWithEffect() for consistency with Show()
[wxWidgets.git] / interface / wx / wupdlock.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wupdlock.h
3 // Purpose: interface of wxWindowUpdateLocker
4 // Author: wxWidgets team
5 // RCS-ID: $Id$
6 // Licence: wxWindows license
7 /////////////////////////////////////////////////////////////////////////////
8
9 /**
10 @class wxWindowUpdateLocker
11
12 This tiny class prevents redrawing of a wxWindow during its
13 lifetime by using wxWindow::Freeze and
14 wxWindow::Thaw methods. It is typically used for creating
15 automatic objects to temporarily suppress window updates before a batch of
16 operations is performed:
17
18 @code
19 void MyFrame::Foo()
20 {
21 m_text = new wxTextCtrl(this, ...);
22
23 wxWindowUpdateLocker noUpdates(m_text);
24 m_text-AppendText();
25 ... many other operations with m_text...
26 m_text-WriteText();
27 }
28 @endcode
29
30 Using this class is easier and safer than calling
31 wxWindow::Freeze and wxWindow::Thaw because you
32 don't risk to forget calling the latter.
33
34 @library{wxbase}
35 @category{FIXME}
36 */
37 class wxWindowUpdateLocker
38 {
39 public:
40 /**
41 Creates an object preventing the updates of the specified @e win. The
42 parameter must be non-@NULL and the window must exist for longer than
43 wxWindowUpdateLocker object itself.
44 */
45 wxWindowUpdateLocker(wxWindow* win);
46
47 /**
48 Destructor reenables updates for the window this object is associated with.
49 */
50 ~wxWindowUpdateLocker();
51 };
52