// call this from the derived class MSWControlColor() if you want to always
// paint the background (as all opaque controls do)
- WXHBRUSH MSWControlColorSolid(WXHDC pDC, wxColour colBg = wxNullColour);
+ WXHBRUSH MSWControlColorSolid(WXHDC pDC)
+ {
+ return DoMSWControlColor(pDC, GetBackgroundColour());
+ }
+
+ // common part of the 3 functions above: pass wxNullColour to use the
+ // appropriate background colour (meaning ours or our parents) or a fixed
+ // one
+ WXHBRUSH DoMSWControlColor(WXHDC pDC, wxColour colBg);
// another WM_CTLCOLOR-related function: override this to return the brush
// which should be used to paint the control background by default
}
#endif // Win95
-WXHBRUSH wxControl::MSWControlColorSolid(WXHDC pDC, wxColour colBg)
+WXHBRUSH wxControl::DoMSWControlColor(WXHDC pDC, wxColour colBg)
{
HDC hdc = (HDC)pDC;
if ( m_hasFgCol )
WXHBRUSH wxControl::MSWControlColor(WXHDC pDC)
{
+ // by default consider that the controls text shouldn't erase the
+ // background under it (this is true for all static controls, check boxes,
+ // radio buttons, ...
::SetBkMode((HDC)pDC, TRANSPARENT);
- return MSWControlColorSolid(pDC);
+ return DoMSWControlColor(pDC, wxNullColour);
}
WXHBRUSH wxControl::MSWControlColorDisabled(WXHDC pDC)
{
- return MSWControlColorSolid
- (
- pDC,
- wxSystemSettings::GetColour(wxSYS_COLOUR_BTNFACE)
- );
+ return DoMSWControlColor(pDC,
+ wxSystemSettings::GetColour(wxSYS_COLOUR_BTNFACE));
}
// ---------------------------------------------------------------------------