X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/a88acabdd2be91a59ce96017fdcd5a661fcb3c3e..7679ac6334c85e41b90084ec5fb336945e352b81:/src/gtk1/textctrl.cpp diff --git a/src/gtk1/textctrl.cpp b/src/gtk1/textctrl.cpp index 5572e67ad3..2ed849a995 100644 --- a/src/gtk1/textctrl.cpp +++ b/src/gtk1/textctrl.cpp @@ -756,6 +756,7 @@ bool wxTextCtrl::Enable( bool enable ) if (m_windowStyle & wxTE_MULTILINE) { gtk_text_set_editable( GTK_TEXT(m_text), enable ); + OnParentEnable(enable); } else { @@ -765,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;