]> git.saurik.com Git - wxWidgets.git/commitdiff
keep correct default background but allow overriding it in user code too
authorVadim Zeitlin <vadim@wxwidgets.org>
Tue, 31 May 2005 14:52:23 +0000 (14:52 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Tue, 31 May 2005 14:52:23 +0000 (14:52 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@34453 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

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

index 4f45dc975bceb1ac0d9bc9aca6e84ed3482d01a6..5c269fbcde333c51f66ece81c31a08a00713f3c9 100644 (file)
@@ -57,10 +57,11 @@ public:
     virtual bool MSWOnScroll(int orientation, WXWORD wParam,
                              WXWORD pos, WXHWND control);
 
-protected:
+    // override wxControl version to not use solid background here
+    virtual WXHBRUSH MSWControlColor(WXHDC pDC, WXHWND hWnd);
 
-    virtual WXHBRUSH DoMSWControlColor(WXHDC pDC, wxColour colBg, WXHWND hWnd);
-    wxSize DoGetBestSize() const;
+protected:
+    virtual wxSize DoGetBestSize() const;
     virtual WXDWORD MSWGetStyle(long style, WXDWORD *exstyle) const;
 
     int m_pageSize;
index 48e10b9d713337fa493f96172411cb6f054ce820..dc5329af33ec73818d5deb9a579c0631ebe4c793 100644 (file)
@@ -344,16 +344,13 @@ WXDWORD wxScrollBar::MSWGetStyle(long style, WXDWORD *exstyle) const
     return msStyle;
 }
 
-WXHBRUSH wxScrollBar::DoMSWControlColor(WXHDC pDC, wxColour colBg, WXHWND hWnd)
+WXHBRUSH wxScrollBar::MSWControlColor(WXHDC pDC, WXHWND hWnd)
 {
-    HDC hdc = (HDC)pDC;
-    if ( m_hasFgCol )
-    {
-        ::SetTextColor(hdc, wxColourToRGB(GetForegroundColour()));
-    }
-
-    WXHBRUSH hbr = 0;
-    return hbr;
+    // unless we have an explicitly set bg colour, use default (gradient under
+    // XP) brush instead of GetBackgroundColour() one as the base class would
+    //
+    // note that fg colour isn't used for a scrollbar
+    return UseBgCol() ? wxControl::MSWControlColor(pDC, hWnd) : NULL;
 }
 
 #endif // wxUSE_SCROLLBAR