Applied patches for #15184 (wxRichTextAction fix for when the command identifier...
[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 licence
7 /////////////////////////////////////////////////////////////////////////////
8
9 /**
10 @class wxWindowUpdateLocker
11
12 This tiny class prevents redrawing of a wxWindow during its lifetime by using
13 wxWindow::Freeze() and wxWindow::Thaw() methods.
14
15 It is typically used for creating automatic objects to temporarily suppress
16 window updates before a batch of 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 wxWindow::Freeze() and
31 wxWindow::Thaw() because you don't risk to forget calling the latter.
32
33 @library{wxbase}
34 @category{misc}
35 */
36 class wxWindowUpdateLocker
37 {
38 public:
39 /**
40 Creates an object preventing the updates of the specified @e win.
41 The parameter must be non-@NULL and the window must exist for longer than
42 wxWindowUpdateLocker object itself.
43 */
44 wxWindowUpdateLocker(wxWindow* win);
45
46 /**
47 Destructor reenables updates for the window this object is associated with.
48 */
49 ~wxWindowUpdateLocker();
50 };
51