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-03-08 13:52:38 +00:00
|
|
|
This tiny class prevents redrawing of a wxWindow during its
|
2008-03-08 14:43:31 +00:00
|
|
|
lifetime by using wxWindow::Freeze and
|
2008-03-08 13:52:38 +00: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 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
|
|
|
|
|
|
|
Using this class is easier and safer than calling
|
2008-03-08 13:52:38 +00:00
|
|
|
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}
|
|
|
|
@category{FIXME}
|
|
|
|
*/
|
2008-03-08 14:43:31 +00:00
|
|
|
class wxWindowUpdateLocker
|
2008-03-08 13:52:38 +00: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 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
|
|
|
|