From: Vadim Zeitlin Date: Thu, 26 Jul 2001 08:33:53 +0000 (+0000) Subject: added wxWindow::Freeze/Thaw(), implemented them for wxGTK::wxTextCtrl X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/0cc7251efec4fb9f7e9e3f403fe9f3e6585e9497 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 --- diff --git a/docs/latex/wx/window.tex b/docs/latex/wx/window.tex index 8d2e39bcb6..46a993bf8f 100644 --- a/docs/latex/wx/window.tex +++ b/docs/latex/wx/window.tex @@ -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} diff --git a/include/wx/gtk/textctrl.h b/include/wx/gtk/textctrl.h index 10b4dcce0e..bc5d527d11 100644 --- a/include/wx/gtk/textctrl.h +++ b/include/wx/gtk/textctrl.h @@ -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 diff --git a/include/wx/gtk1/textctrl.h b/include/wx/gtk1/textctrl.h index 10b4dcce0e..bc5d527d11 100644 --- a/include/wx/gtk1/textctrl.h +++ b/include/wx/gtk1/textctrl.h @@ -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 diff --git a/include/wx/window.h b/include/wx/window.h index f425041036..549e6a61c5 100644 --- a/include/wx/window.h +++ b/include/wx/window.h @@ -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) ) { } diff --git a/src/gtk/textctrl.cpp b/src/gtk/textctrl.cpp index 65f7951813..7f5f223d94 100644 --- a/src/gtk/textctrl.cpp +++ b/src/gtk/textctrl.cpp @@ -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)); + } +} diff --git a/src/gtk1/textctrl.cpp b/src/gtk1/textctrl.cpp index 65f7951813..7f5f223d94 100644 --- a/src/gtk1/textctrl.cpp +++ b/src/gtk1/textctrl.cpp @@ -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)); + } +}