From: Vadim Zeitlin Date: Tue, 31 May 2005 14:52:23 +0000 (+0000) Subject: keep correct default background but allow overriding it in user code too X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/0cf119954679a06fb9a19ae3445ba4c89c2129a0 keep correct default background but allow overriding it in user code too git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@34453 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/include/wx/msw/scrolbar.h b/include/wx/msw/scrolbar.h index 4f45dc975b..5c269fbcde 100644 --- a/include/wx/msw/scrolbar.h +++ b/include/wx/msw/scrolbar.h @@ -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; diff --git a/src/msw/scrolbar.cpp b/src/msw/scrolbar.cpp index 48e10b9d71..dc5329af33 100644 --- a/src/msw/scrolbar.cpp +++ b/src/msw/scrolbar.cpp @@ -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