diff --git a/src/gtk/textctrl.cpp b/src/gtk/textctrl.cpp index 5572e67ad3..91caedb0d7 100644 --- a/src/gtk/textctrl.cpp +++ b/src/gtk/textctrl.cpp @@ -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 { diff --git a/src/gtk/window.cpp b/src/gtk/window.cpp index 797888dd42..8adc34fead 100644 --- a/src/gtk/window.cpp +++ b/src/gtk/window.cpp @@ -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; } diff --git a/src/gtk1/textctrl.cpp b/src/gtk1/textctrl.cpp index 5572e67ad3..91caedb0d7 100644 --- a/src/gtk1/textctrl.cpp +++ b/src/gtk1/textctrl.cpp @@ -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 { diff --git a/src/gtk1/window.cpp b/src/gtk1/window.cpp index 797888dd42..8adc34fead 100644 --- a/src/gtk1/window.cpp +++ b/src/gtk1/window.cpp @@ -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; }