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
This commit is contained in:
Vadim Zeitlin
2005-05-31 14:52:23 +00:00
parent 123865f20a
commit 0cf1199546
2 changed files with 10 additions and 12 deletions

View File

@@ -57,10 +57,11 @@ public:
virtual bool MSWOnScroll(int orientation, WXWORD wParam, virtual bool MSWOnScroll(int orientation, WXWORD wParam,
WXWORD pos, WXHWND control); 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); protected:
wxSize DoGetBestSize() const; virtual wxSize DoGetBestSize() const;
virtual WXDWORD MSWGetStyle(long style, WXDWORD *exstyle) const; virtual WXDWORD MSWGetStyle(long style, WXDWORD *exstyle) const;
int m_pageSize; int m_pageSize;

View File

@@ -344,16 +344,13 @@ WXDWORD wxScrollBar::MSWGetStyle(long style, WXDWORD *exstyle) const
return msStyle; return msStyle;
} }
WXHBRUSH wxScrollBar::DoMSWControlColor(WXHDC pDC, wxColour colBg, WXHWND hWnd) WXHBRUSH wxScrollBar::MSWControlColor(WXHDC pDC, WXHWND hWnd)
{ {
HDC hdc = (HDC)pDC; // unless we have an explicitly set bg colour, use default (gradient under
if ( m_hasFgCol ) // XP) brush instead of GetBackgroundColour() one as the base class would
{ //
::SetTextColor(hdc, wxColourToRGB(GetForegroundColour())); // note that fg colour isn't used for a scrollbar
} return UseBgCol() ? wxControl::MSWControlColor(pDC, hWnd) : NULL;
WXHBRUSH hbr = 0;
return hbr;
} }
#endif // wxUSE_SCROLLBAR #endif // wxUSE_SCROLLBAR