From 230205aec528c1224b7f95981b61defbab9a92e2 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Thu, 16 Oct 2003 09:38:04 +0000 Subject: [PATCH] use ShouldInheritColours() git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@24192 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/common/ctrlcmn.cpp | 16 +++++++++------- src/univ/themes/gtk.cpp | 2 +- src/univ/themes/win32.cpp | 2 +- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/src/common/ctrlcmn.cpp b/src/common/ctrlcmn.cpp index 468a4ac93b..ec97111188 100644 --- a/src/common/ctrlcmn.cpp +++ b/src/common/ctrlcmn.cpp @@ -92,13 +92,15 @@ bool wxControlBase::CreateControl(wxWindowBase *parent, // inherit colour and font settings from the parent window void wxControlBase::InheritAttributes() { - // it definitely doesn't make sense to inherit the background colour as the - // controls typically have their own standard one and probably not the - // foreground neither? -#if 0 - SetBackgroundColour(GetParent()->GetBackgroundColour()); - SetForegroundColour(GetParent()->GetForegroundColour()); -#endif // 0 + if ( ShouldInheritColours() ) + { + wxWindow *parent = GetParent(); + + wxCHECK_RET( parent, _T("a control without parent?") ); + + SetBackgroundColour(parent->GetBackgroundColour()); + SetForegroundColour(parent->GetForegroundColour()); + } #ifdef __WXPM__ // diff --git a/src/univ/themes/gtk.cpp b/src/univ/themes/gtk.cpp index e7ca25dfba..2471eca2f9 100644 --- a/src/univ/themes/gtk.cpp +++ b/src/univ/themes/gtk.cpp @@ -775,7 +775,7 @@ wxColour wxGTKColourScheme::GetBackground(wxWindow *win) const col = win->GetBackgroundColour(); } - if ( win->IsContainerWindow() ) + if ( !win->ShouldInheritColours() ) { // doesn't depend on the state if ( !col.Ok() ) diff --git a/src/univ/themes/win32.cpp b/src/univ/themes/win32.cpp index 6edcca0862..8629507e49 100644 --- a/src/univ/themes/win32.cpp +++ b/src/univ/themes/win32.cpp @@ -1330,7 +1330,7 @@ wxColour wxWin32ColourScheme::GetBackground(wxWindow *win) const col = win->GetBackgroundColour(); } - if ( win->IsContainerWindow() ) + if ( !win->ShouldInheritColours() ) { wxTextCtrl *text = wxDynamicCast(win, wxTextCtrl); if ( text ) -- 2.50.0