2008-03-08 13:52:38 +00:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: wupdlock.h
|
2008-03-10 15:24:38 +00:00
|
|
|
// Purpose: interface of wxWindowUpdateLocker
|
2008-03-08 13:52:38 +00:00
|
|
|
// Author: wxWidgets team
|
|
|
|
// RCS-ID: $Id$
|
|
|
|
// Licence: wxWindows license
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
/**
|
|
|
|
@class wxWindowUpdateLocker
|
2008-03-08 14:43:31 +00:00
|
|
|
|
2008-09-27 10:27:44 +00:00
|
|
|
This tiny class prevents redrawing of a wxWindow during its lifetime by using
|
|
|
|
wxWindow::Freeze() and wxWindow::Thaw() methods.
|
|
|
|
|
|
|
|
It is typically used for creating automatic objects to temporarily suppress
|
|
|
|
window updates before a batch of operations is performed:
|
2008-03-08 14:43:31 +00:00
|
|
|
|
2008-03-08 13:52:38 +00:00
|
|
|
@code
|
|
|
|
void MyFrame::Foo()
|
|
|
|
{
|
|
|
|
m_text = new wxTextCtrl(this, ...);
|
2008-03-08 14:43:31 +00:00
|
|
|
|
2008-03-08 13:52:38 +00:00
|
|
|
wxWindowUpdateLocker noUpdates(m_text);
|
|
|
|
m_text-AppendText();
|
|
|
|
... many other operations with m_text...
|
|
|
|
m_text-WriteText();
|
|
|
|
}
|
|
|
|
@endcode
|
2008-03-08 14:43:31 +00:00
|
|
|
|
2008-09-27 10:27:44 +00:00
|
|
|
Using this class is easier and safer than calling wxWindow::Freeze() and
|
|
|
|
wxWindow::Thaw() because you don't risk to forget calling the latter.
|
2008-03-08 14:43:31 +00:00
|
|
|
|
2008-03-08 13:52:38 +00:00
|
|
|
@library{wxbase}
|
2008-09-27 10:27:44 +00:00
|
|
|
@category{misc}
|
2008-03-08 13:52:38 +00:00
|
|
|
*/
|
2008-03-08 14:43:31 +00:00
|
|
|
class wxWindowUpdateLocker
|
2008-03-08 13:52:38 +00:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
/**
|
2008-09-27 10:27:44 +00:00
|
|
|
Creates an object preventing the updates of the specified @e win.
|
|
|
|
The parameter must be non-@NULL and the window must exist for longer than
|
2008-03-08 13:52:38 +00:00
|
|
|
wxWindowUpdateLocker object itself.
|
|
|
|
*/
|
2008-03-09 12:33:59 +00:00
|
|
|
wxWindowUpdateLocker(wxWindow* win);
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Destructor reenables updates for the window this object is associated with.
|
|
|
|
*/
|
|
|
|
~wxWindowUpdateLocker();
|
|
|
|
};
|
2008-03-10 15:24:38 +00:00
|
|
|
|