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