added wxWindow::Freeze/Thaw(), implemented them for wxGTK::wxTextCtrl

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11176 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2001-07-26 08:33:53 +00:00
parent d6ddcd574b
commit 0cc7251efe
6 changed files with 69 additions and 0 deletions

View File

@@ -466,6 +466,20 @@ implements the following methods:\par
Sizes the window so that it fits around its subwindows. This function won't do
anything if there are no subwindows.
\membersection{wxWindow::Freeze}\label{wxwindowfreeze}
\func{virtual void}{Freeze}{\void}
Freezes the window or, in other words, prevents any updates from taking place
on screen, the window is not redrawn at all. \helpref{Thaw}{wxwindowthaw} must
be called to reenable window redrawing.
This method is useful for visual appearance optimization (for example, it
is a good idea to use it before inserting large amount of text into a
wxTextCtrl under wxGTK) but is not implemented on all platforms nor for all
controls so it is mostly just a hint to wxWindows and not a mandatory
directive.
\membersection{wxWindow::GetBackgroundColour}\label{wxwindowgetbackgroundcolour}
\constfunc{virtual wxColour}{GetBackgroundColour}{\void}
@@ -2441,6 +2455,13 @@ needed if Show() is called immediately after the frame creation.
\helpref{wxWindow::IsShown}{wxwindowisshown}
\membersection{wxWindow::Thaw}\label{wxwindowthaw}
\func{virtual void}{Thaw}{\void}
Reenables window updating after a previous call to
\helpref{Freeze}{wxwindowfreeze}.
\membersection{wxWindow::TransferDataFromWindow}\label{wxwindowtransferdatafromwindow}
\func{virtual bool}{TransferDataFromWindow}{\void}

View File

@@ -143,6 +143,11 @@ public:
void SetModified() { m_modified = TRUE; }
// GTK+ textctrl is so dumb that you need to freeze/thaw it manually to
// avoid horrible flicker/scrolling back and forth
virtual void Freeze();
virtual void Thaw();
// wxGTK-specific: called recursively by Enable,
// to give widgets an oppprtunity to correct their colours after they
// have been changed by Enable

View File

@@ -143,6 +143,11 @@ public:
void SetModified() { m_modified = TRUE; }
// GTK+ textctrl is so dumb that you need to freeze/thaw it manually to
// avoid horrible flicker/scrolling back and forth
virtual void Freeze();
virtual void Thaw();
// wxGTK-specific: called recursively by Enable,
// to give widgets an oppprtunity to correct their colours after they
// have been changed by Enable

View File

@@ -519,6 +519,12 @@ public:
// clear the window entirely
virtual void Clear() = 0;
// freeze the window: don't redraw it until it is thawed
virtual void Freeze() { }
// thaw the window: redraw it after it had been frozen
virtual void Thaw() { }
// adjust DC for drawing on this window
virtual void PrepareDC( wxDC & WXUNUSED(dc) ) { }

View File

@@ -1290,3 +1290,19 @@ wxSize wxTextCtrl::DoGetBestSize() const
wxSize ret( wxControl::DoGetBestSize() );
return wxSize(80, ret.y);
}
void wxTextCtrl::Freeze()
{
if ( HasFlag(wxTE_MULTILINE) )
{
gtk_text_freeze(GTK_TEXT(m_text));
}
}
void wxTextCtrl::Thaw()
{
if ( HasFlag(wxTE_MULTILINE) )
{
gtk_text_thaw(GTK_TEXT(m_text));
}
}

View File

@@ -1290,3 +1290,19 @@ wxSize wxTextCtrl::DoGetBestSize() const
wxSize ret( wxControl::DoGetBestSize() );
return wxSize(80, ret.y);
}
void wxTextCtrl::Freeze()
{
if ( HasFlag(wxTE_MULTILINE) )
{
gtk_text_freeze(GTK_TEXT(m_text));
}
}
void wxTextCtrl::Thaw()
{
if ( HasFlag(wxTE_MULTILINE) )
{
gtk_text_thaw(GTK_TEXT(m_text));
}
}