]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/control.cpp
added test for Unicode/ANSI
[wxWidgets.git] / src / msw / control.cpp
index d32372b29ff15225c84d976a1a189f19458fe9ac..1561c9d470c7085718f58635e4ec6975f2b6cff1 100644 (file)
@@ -337,34 +337,30 @@ WXHBRUSH wxControl::MSWControlColorSolid(WXHDC pDC, wxColour colBg)
     if ( m_hasFgCol )
     {
         ::SetTextColor(hdc, wxColourToRGB(GetForegroundColour()));
-        if ( !colBg.Ok() )
-            colBg = GetBackgroundColour();
     }
 
+    // use the background colour override if a valid colour is given
+    WXHBRUSH hbr;
     if ( colBg.Ok() )
     {
-        ::SetBkColor(hdc, wxColourToRGB(colBg));
-
+        // draw children with the same colour as the parent
         wxBrush *brush = wxTheBrushList->FindOrCreateBrush(colBg, wxSOLID);
 
-        return (WXHBRUSH)brush->GetResourceHandle();
+        hbr = (WXHBRUSH)brush->GetResourceHandle();
+    }
+    else // use our own background colour and recurse upwards if necessary
+    {
+        hbr = MSWGetBgBrush(pDC);
     }
 
-    return 0;
+    return hbr;
 }
 
 WXHBRUSH wxControl::MSWControlColor(WXHDC pDC)
 {
-    WXHBRUSH hbr = MSWControlColorSolid(pDC, m_hasBgCol ? m_backgroundColour
-                                                        : wxNullColour);
-    if ( hbr )
-        return hbr;
-
     ::SetBkMode((HDC)pDC, TRANSPARENT);
 
-    hbr = MSWGetBgBrush(pDC);
-
-    return hbr ? hbr : MSWGetDefaultBgBrush();
+    return MSWControlColorSolid(pDC);
 }
 
 WXHBRUSH wxControl::MSWControlColorDisabled(WXHDC pDC)