]> git.saurik.com Git - wxWidgets.git/commitdiff
added wxWindow::Freeze/Thaw(), implemented them for wxGTK::wxTextCtrl
authorVadim Zeitlin <vadim@wxwidgets.org>
Thu, 26 Jul 2001 08:33:53 +0000 (08:33 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Thu, 26 Jul 2001 08:33:53 +0000 (08:33 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11176 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

docs/latex/wx/window.tex
include/wx/gtk/textctrl.h
include/wx/gtk1/textctrl.h
include/wx/window.h
src/gtk/textctrl.cpp
src/gtk1/textctrl.cpp

index 8d2e39bcb6c1d46480020ece42bd73fe0d7d966b..46a993bf8f22ad1db81323039da2d89bed7b1beb 100644 (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}
index 10b4dcce0e90a89fbcfbb6b0c4e2628644579340..bc5d527d11abefeefef5b95a87941bbe15a78e9b 100644 (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
index 10b4dcce0e90a89fbcfbb6b0c4e2628644579340..bc5d527d11abefeefef5b95a87941bbe15a78e9b 100644 (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
index f425041036a237e2feaf5e210b42d3774bc62195..549e6a61c5fc9bf2c61a0ff86a32fcf858a84ab4 100644 (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) ) { }
 
index 65f795181320acfd6733c45b150126fe96a46394..7f5f223d94f89f66e7ec284cea24e3e57bb2df50 100644 (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));
+    }
+}
index 65f795181320acfd6733c45b150126fe96a46394..7f5f223d94f89f66e7ec284cea24e3e57bb2df50 100644 (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));
+    }
+}