]> git.saurik.com Git - wxWidgets.git/commitdiff
use ShouldInheritColours()
authorVadim Zeitlin <vadim@wxwidgets.org>
Thu, 16 Oct 2003 09:38:04 +0000 (09:38 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Thu, 16 Oct 2003 09:38:04 +0000 (09:38 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@24192 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/common/ctrlcmn.cpp
src/univ/themes/gtk.cpp
src/univ/themes/win32.cpp

index 468a4ac93b81ad81ff902a61fbb2277d15a18315..ec97111188ae4c169cf3eaea1a9bdae455c3ad49 100644 (file)
@@ -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__
     //
index e7ca25dfba1b09326de662b263b8aebab76e73f1..2471eca2f95de02ed5a5aaae9427236ef4679ce3 100644 (file)
@@ -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() )
index 6edcca086271cf5188ed96c7e98472cfec37db16..8629507e498732ceab7fe9545194772a080e7633 100644 (file)
@@ -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 )