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