]>
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$ | |
6 | // Licence: wxWindows license | |
7 | ///////////////////////////////////////////////////////////////////////////// | |
8 | ||
9 | /** | |
10 | @class wxWindowUpdateLocker | |
11 | @wxheader{wupdlock.h} | |
7c913512 | 12 | |
23324ae1 | 13 | This tiny class prevents redrawing of a wxWindow during its |
7c913512 | 14 | lifetime by using wxWindow::Freeze and |
23324ae1 FM |
15 | wxWindow::Thaw methods. It is typically used for creating |
16 | automatic objects to temporarily suppress window updates before a batch of | |
17 | operations is performed: | |
7c913512 | 18 | |
23324ae1 FM |
19 | @code |
20 | void MyFrame::Foo() | |
21 | { | |
22 | m_text = new wxTextCtrl(this, ...); | |
7c913512 | 23 | |
23324ae1 FM |
24 | wxWindowUpdateLocker noUpdates(m_text); |
25 | m_text-AppendText(); | |
26 | ... many other operations with m_text... | |
27 | m_text-WriteText(); | |
28 | } | |
29 | @endcode | |
7c913512 FM |
30 | |
31 | Using this class is easier and safer than calling | |
23324ae1 FM |
32 | wxWindow::Freeze and wxWindow::Thaw because you |
33 | don't risk to forget calling the latter. | |
7c913512 | 34 | |
23324ae1 FM |
35 | @library{wxbase} |
36 | @category{FIXME} | |
37 | */ | |
7c913512 | 38 | class wxWindowUpdateLocker |
23324ae1 FM |
39 | { |
40 | public: | |
41 | /** | |
42 | Creates an object preventing the updates of the specified @e win. The | |
43 | parameter must be non-@NULL and the window must exist for longer than | |
44 | wxWindowUpdateLocker object itself. | |
45 | */ | |
4cc4bfaf | 46 | wxWindowUpdateLocker(wxWindow* win); |
23324ae1 FM |
47 | |
48 | /** | |
49 | Destructor reenables updates for the window this object is associated with. | |
50 | */ | |
51 | ~wxWindowUpdateLocker(); | |
52 | }; | |
e54c96f1 | 53 |