Don't always override the default background colours.

The wxColour argument taken by wxControl::DoMSWControlColor() allows to
override the default colour, it shouldn't be used in MSWControlColor() as this
resulted in always using custom colours for the controls, even when the user
hadn't changed them. Fix this by not passing any valid colour to it in this
case and allowing it to deduce the correct colour to use on its own.

See #1691.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@61859 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2009-09-08 12:23:17 +00:00
parent ddc4214a4f
commit 52c5093f76

View File

@@ -398,8 +398,7 @@ WXHBRUSH wxControl::DoMSWControlColor(WXHDC pDC, wxColour colBg, WXHWND hWnd)
::SetBkColor(hdc, wxColourToRGB(colBg));
// draw children with the same colour as the parent
wxBrush *brush = wxTheBrushList->FindOrCreateBrush(colBg,
wxBRUSHSTYLE_SOLID);
wxBrush *brush = wxTheBrushList->FindOrCreateBrush(colBg);
hbr = (WXHBRUSH)brush->GetResourceHandle();
}
@@ -415,14 +414,13 @@ WXHBRUSH wxControl::DoMSWControlColor(WXHDC pDC, wxColour colBg, WXHWND hWnd)
WXHBRUSH wxControl::MSWControlColor(WXHDC pDC, WXHWND hWnd)
{
wxColour colBg;
if ( HasTransparentBackground() )
::SetBkMode((HDC)pDC, TRANSPARENT);
else // if the control is opaque it shouldn't use the parents background
colBg = GetBackgroundColour();
return DoMSWControlColor(pDC, colBg, hWnd);
// don't pass any background colour to DoMSWControlColor(), our own
// background colour will be used by it only if it is set, otherwise the
// defaults will be used
return DoMSWControlColor(pDC, wxColour(), hWnd);
}
WXHBRUSH wxControl::MSWControlColorDisabled(WXHDC pDC)