]> git.saurik.com Git - wxWidgets.git/commitdiff
Made wxWindow::Enable recursive in order to solve colouring problems; forced the...
authorJulian Smart <julian@anthemion.co.uk>
Wed, 16 May 2001 15:53:11 +0000 (15:53 +0000)
committerJulian Smart <julian@anthemion.co.uk>
Wed, 16 May 2001 15:53:11 +0000 (15:53 +0000)
of a wxTextCtrl back to the custom colour in wxTextCtrl::Enable. This appears
to fix inconsistent colour problems.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@10179 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/gtk/textctrl.cpp
src/gtk/window.cpp
src/gtk1/textctrl.cpp
src/gtk1/window.cpp

index 5572e67ad39d203d55f8b0e89e46c2b8f02780b3..91caedb0d746200af33333d924fbc6c650f8108f 100644 (file)
@@ -756,6 +756,20 @@ bool wxTextCtrl::Enable( bool enable )
     if (m_windowStyle & wxTE_MULTILINE)
     {
         gtk_text_set_editable( GTK_TEXT(m_text), enable );
+
+       // If we have a custom background colour, we use this colour in both
+       // disabled and enabled mode, or we end up with a different colour under the
+       // text.
+        wxColour oldColour = GetBackgroundColour();
+        if (oldColour.Ok())
+        {
+            // Need to set twice or it'll optimize the useful stuff out
+            if (oldColour == * wxWHITE)
+                SetBackgroundColour(*wxBLACK);
+            else
+                SetBackgroundColour(*wxWHITE);
+            SetBackgroundColour(oldColour);
+        }
     }
     else
     {
index 797888dd428ccf5786c911af3052a5940feca93a..8adc34fead87a4ac07986a73d7f3e9498786f92f 100644 (file)
@@ -2948,6 +2948,16 @@ bool wxWindow::Enable( bool enable )
     if ( m_wxwindow )
         gtk_widget_set_sensitive( m_wxwindow, enable );
 
+    // Recurse, so that children have the opportunity to Do The Right Thing.
+    for ( wxWindowList::Node *node = GetChildren().GetFirst();
+          node;
+          node = node->GetNext() )
+    {
+        wxWindow *child = node->GetData();
+       if (!child->IsKindOf(CLASSINFO(wxDialog)) && !child->IsKindOf(CLASSINFO(wxFrame)))
+            child->Enable(enable);
+    }
+
     return TRUE;
 }
 
index 5572e67ad39d203d55f8b0e89e46c2b8f02780b3..91caedb0d746200af33333d924fbc6c650f8108f 100644 (file)
@@ -756,6 +756,20 @@ bool wxTextCtrl::Enable( bool enable )
     if (m_windowStyle & wxTE_MULTILINE)
     {
         gtk_text_set_editable( GTK_TEXT(m_text), enable );
+
+       // If we have a custom background colour, we use this colour in both
+       // disabled and enabled mode, or we end up with a different colour under the
+       // text.
+        wxColour oldColour = GetBackgroundColour();
+        if (oldColour.Ok())
+        {
+            // Need to set twice or it'll optimize the useful stuff out
+            if (oldColour == * wxWHITE)
+                SetBackgroundColour(*wxBLACK);
+            else
+                SetBackgroundColour(*wxWHITE);
+            SetBackgroundColour(oldColour);
+        }
     }
     else
     {
index 797888dd428ccf5786c911af3052a5940feca93a..8adc34fead87a4ac07986a73d7f3e9498786f92f 100644 (file)
@@ -2948,6 +2948,16 @@ bool wxWindow::Enable( bool enable )
     if ( m_wxwindow )
         gtk_widget_set_sensitive( m_wxwindow, enable );
 
+    // Recurse, so that children have the opportunity to Do The Right Thing.
+    for ( wxWindowList::Node *node = GetChildren().GetFirst();
+          node;
+          node = node->GetNext() )
+    {
+        wxWindow *child = node->GetData();
+       if (!child->IsKindOf(CLASSINFO(wxDialog)) && !child->IsKindOf(CLASSINFO(wxFrame)))
+            child->Enable(enable);
+    }
+
     return TRUE;
 }