X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/513903c4f9f62b78206df9db6905278915ee6e47..c48269b9f7afca9c8e7076e0ceb06b933b2e88b8:/src/gtk/textctrl.cpp diff --git a/src/gtk/textctrl.cpp b/src/gtk/textctrl.cpp index 91caedb0d7..2ed849a995 100644 --- a/src/gtk/textctrl.cpp +++ b/src/gtk/textctrl.cpp @@ -756,20 +756,7 @@ 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); - } + OnParentEnable(enable); } else { @@ -779,6 +766,26 @@ bool wxTextCtrl::Enable( bool enable ) return TRUE; } +// wxGTK-specific: called recursively by Enable, +// to give widgets an oppprtunity to correct their colours after they +// have been changed by Enable +void wxTextCtrl::OnParentEnable( bool 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); + } +} + void wxTextCtrl::DiscardEdits() { m_modified = FALSE;