2008-03-08 08:52:38 -05:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: wupdlock.h
|
2008-03-10 11:24:38 -04:00
|
|
|
// Purpose: interface of wxWindowUpdateLocker
|
2008-03-08 08:52:38 -05:00
|
|
|
// Author: wxWidgets team
|
|
|
|
// RCS-ID: $Id$
|
2010-07-13 09:29:13 -04:00
|
|
|
// Licence: wxWindows licence
|
2008-03-08 08:52:38 -05:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
/**
|
|
|
|
@class wxWindowUpdateLocker
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-09-27 06:27:44 -04: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 09:43:31 -05:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
@code
|
|
|
|
void MyFrame::Foo()
|
|
|
|
{
|
|
|
|
m_text = new wxTextCtrl(this, ...);
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
wxWindowUpdateLocker noUpdates(m_text);
|
|
|
|
m_text-AppendText();
|
|
|
|
... many other operations with m_text...
|
|
|
|
m_text-WriteText();
|
|
|
|
}
|
|
|
|
@endcode
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-09-27 06:27:44 -04: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 09:43:31 -05:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
@library{wxbase}
|
2008-09-27 06:27:44 -04:00
|
|
|
@category{misc}
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-03-08 09:43:31 -05:00
|
|
|
class wxWindowUpdateLocker
|
2008-03-08 08:52:38 -05:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
/**
|
2008-09-27 06:27:44 -04: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 08:52:38 -05:00
|
|
|
wxWindowUpdateLocker object itself.
|
|
|
|
*/
|
2008-03-09 08:33:59 -04:00
|
|
|
wxWindowUpdateLocker(wxWindow* win);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Destructor reenables updates for the window this object is associated with.
|
|
|
|
*/
|
|
|
|
~wxWindowUpdateLocker();
|
|
|
|
};
|
2008-03-10 11:24:38 -04:00
|
|
|
|