]>
Commit | Line | Data |
---|---|---|
23324ae1 FM |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: wupdlock.h | |
e54c96f1 | 3 | // Purpose: interface of wxWindowUpdateLocker |
23324ae1 FM |
4 | // Author: wxWidgets team |
5 | // RCS-ID: $Id$ | |
526954c5 | 6 | // Licence: wxWindows licence |
23324ae1 FM |
7 | ///////////////////////////////////////////////////////////////////////////// |
8 | ||
9 | /** | |
10 | @class wxWindowUpdateLocker | |
7c913512 | 11 | |
f41d6c8c FM |
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: | |
7c913512 | 17 | |
23324ae1 FM |
18 | @code |
19 | void MyFrame::Foo() | |
20 | { | |
21 | m_text = new wxTextCtrl(this, ...); | |
7c913512 | 22 | |
23324ae1 FM |
23 | wxWindowUpdateLocker noUpdates(m_text); |
24 | m_text-AppendText(); | |
25 | ... many other operations with m_text... | |
26 | m_text-WriteText(); | |
27 | } | |
28 | @endcode | |
7c913512 | 29 | |
f41d6c8c FM |
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. | |
7c913512 | 32 | |
23324ae1 | 33 | @library{wxbase} |
f41d6c8c | 34 | @category{misc} |
23324ae1 | 35 | */ |
7c913512 | 36 | class wxWindowUpdateLocker |
23324ae1 FM |
37 | { |
38 | public: | |
39 | /** | |
f41d6c8c FM |
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 | |
23324ae1 FM |
42 | wxWindowUpdateLocker object itself. |
43 | */ | |
4cc4bfaf | 44 | wxWindowUpdateLocker(wxWindow* win); |
23324ae1 FM |
45 | |
46 | /** | |
47 | Destructor reenables updates for the window this object is associated with. | |
48 | */ | |
49 | ~wxWindowUpdateLocker(); | |
50 | }; | |
e54c96f1 | 51 |