]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/control.cpp
reset m_selectionOld when the selection is programatically changed
[wxWidgets.git] / src / msw / control.cpp
index 304829225a6104f85e147f603bf260bbe29aaaf5..d32372b29ff15225c84d976a1a189f19458fe9ac 100644 (file)
@@ -335,7 +335,11 @@ WXHBRUSH wxControl::MSWControlColorSolid(WXHDC pDC, wxColour colBg)
 {
     HDC hdc = (HDC)pDC;
     if ( m_hasFgCol )
+    {
         ::SetTextColor(hdc, wxColourToRGB(GetForegroundColour()));
+        if ( !colBg.Ok() )
+            colBg = GetBackgroundColour();
+    }
 
     if ( colBg.Ok() )
     {
@@ -358,44 +362,9 @@ WXHBRUSH wxControl::MSWControlColor(WXHDC pDC)
 
     ::SetBkMode((HDC)pDC, TRANSPARENT);
 
-    // check if we should adapt our background to our parent
-    for ( wxWindow *win = this; win; win = win->GetParent() )
-    {
-        if ( win->IsTopLevel() )
-        {
-            // don't go beyond the first top level parent
-            break;
-        }
-
-        if ( win->GetBackgroundStyle() == wxBG_STYLE_COLOUR )
-        {
-            // parent window has solid colour, so it doesn't look
-            // transparent and hence we shouldn't show notebook background
-            wxBrush *brush = wxTheBrushList->FindOrCreateBrush
-                                             (
-                                                win->GetBackgroundColour(),
-                                                wxSOLID
-                                             );
-
-            return (WXHBRUSH)brush->GetResourceHandle();
-        }
-
-#if wxUSE_UXTHEME && wxUSE_NOTEBOOK
-        // check for the special case of the notebooks which draw themed
-        // background when themes are enabled
-        wxNotebook *nbook = wxDynamicCast(win, wxNotebook);
-        if ( nbook )
-        {
-            // return value may be NULL but it is ok: if the first parent
-            // notebook doesn't use themes, then we don't have to process
-            // this message at all, so let default processing take place
-            return nbook->GetThemeBackgroundBrush(pDC, this);
-        }
-#endif // wxUSE_UXTHEME && wxUSE_NOTEBOOK
-    }
+    hbr = MSWGetBgBrush(pDC);
 
-    // let the control deal with background itself
-    return MSWGetDefaultBgBrush();
+    return hbr ? hbr : MSWGetDefaultBgBrush();
 }
 
 WXHBRUSH wxControl::MSWControlColorDisabled(WXHDC pDC)