Implemented OnParentEnable to allow widgets to reset their colours

after a wxWindow::Enable call


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@10193 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Julian Smart
2001-05-17 10:58:05 +00:00
parent 36bd690299
commit fdca68a670
8 changed files with 96 additions and 44 deletions

View File

@@ -757,19 +757,6 @@ bool wxTextCtrl::Enable( bool enable )
{
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
{
@@ -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;