]> git.saurik.com Git - wxWidgets.git/commitdiff
fixed background drawing for opaque controls
authorVadim Zeitlin <vadim@wxwidgets.org>
Wed, 22 Dec 2004 21:07:33 +0000 (21:07 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Wed, 22 Dec 2004 21:07:33 +0000 (21:07 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@31119 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

include/wx/msw/control.h
src/msw/control.cpp

index 74000ed3e2d43f350d5e7703bdf7567e13788354..70ce2da88df26b02546772710ba0e4361b131bb8 100644 (file)
@@ -125,7 +125,15 @@ protected:
 
     // call this from the derived class MSWControlColor() if you want to always
     // paint the background (as all opaque controls do)
-    WXHBRUSH MSWControlColorSolid(WXHDC pDC, wxColour colBg = wxNullColour);
+    WXHBRUSH MSWControlColorSolid(WXHDC pDC)
+    {
+        return DoMSWControlColor(pDC, GetBackgroundColour());
+    }
+
+    // common part of the 3 functions above: pass wxNullColour to use the
+    // appropriate background colour (meaning ours or our parents) or a fixed
+    // one
+    WXHBRUSH DoMSWControlColor(WXHDC pDC, wxColour colBg);
 
     // another WM_CTLCOLOR-related function: override this to return the brush
     // which should be used to paint the control background by default
index 1561c9d470c7085718f58635e4ec6975f2b6cff1..d5775be8b75ace8967a8bd04c8dd7ada73c19c24 100644 (file)
@@ -331,7 +331,7 @@ bool wxControl::MSWOnNotify(int idCtrl,
 }
 #endif // Win95
 
-WXHBRUSH wxControl::MSWControlColorSolid(WXHDC pDC, wxColour colBg)
+WXHBRUSH wxControl::DoMSWControlColor(WXHDC pDC, wxColour colBg)
 {
     HDC hdc = (HDC)pDC;
     if ( m_hasFgCol )
@@ -358,18 +358,18 @@ WXHBRUSH wxControl::MSWControlColorSolid(WXHDC pDC, wxColour colBg)
 
 WXHBRUSH wxControl::MSWControlColor(WXHDC pDC)
 {
+    // by default consider that the controls text shouldn't erase the
+    // background under it (this is true for all static controls, check boxes,
+    // radio buttons, ...
     ::SetBkMode((HDC)pDC, TRANSPARENT);
 
-    return MSWControlColorSolid(pDC);
+    return DoMSWControlColor(pDC, wxNullColour);
 }
 
 WXHBRUSH wxControl::MSWControlColorDisabled(WXHDC pDC)
 {
-    return MSWControlColorSolid
-           (
-                pDC,
-                wxSystemSettings::GetColour(wxSYS_COLOUR_BTNFACE)
-           );
+    return DoMSWControlColor(pDC,
+                             wxSystemSettings::GetColour(wxSYS_COLOUR_BTNFACE));
 }
 
 // ---------------------------------------------------------------------------