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$
|
|
|
|
// Licence: wxWindows license
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
/**
|
|
|
|
@class wxWindowUpdateLocker
|
|
|
|
@wxheader{wupdlock.h}
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
This tiny class prevents redrawing of a wxWindow during its
|
2008-03-08 09:43:31 -05:00
|
|
|
lifetime by using wxWindow::Freeze and
|
2008-03-08 08:52:38 -05:00
|
|
|
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
|
|
|
|
|
|
|
Using this class is easier and safer than calling
|
2008-03-08 08:52:38 -05:00
|
|
|
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}
|
|
|
|
@category{FIXME}
|
|
|
|
*/
|
2008-03-08 09:43:31 -05:00
|
|
|
class wxWindowUpdateLocker
|
2008-03-08 08:52:38 -05:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
/**
|
|
|
|
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
|
|
|
|
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
|
|
|
|