No changes, just refactor wxMSW background brush methods.

Factor out MSWGetCustomBgBrush() from MSWGetBgBrushForChild(). This is useful
as in the vast majority of cases the parent window will want to use the same
background brush for all of its children so it doesn't really care about the
concrete child passed to MSWGetBgBrushForChild() and we can adjust the brush
to the child origin in the common code instead of asking each derived class
overriding MSWGetBgBrushForChild() to do this.

This doesn't change anything but will make the upcoming changes to wxPanel
background painting simpler.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@67250 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2011-03-20 00:00:29 +00:00
parent 0be027c45b
commit 0a81f13024
4 changed files with 38 additions and 27 deletions

View File

@@ -4884,9 +4884,30 @@ bool wxWindowMSW::DoEraseBackground(WXHDC hDC)
}
WXHBRUSH
wxWindowMSW::MSWGetBgBrushForChild(WXHDC WXUNUSED(hDC),
wxWindowMSW * WXUNUSED(child))
wxWindowMSW::MSWGetBgBrushForChild(WXHDC hDC, wxWindowMSW *child)
{
// Test for the custom background brush first.
WXHBRUSH hbrush = MSWGetCustomBgBrush();
if ( hbrush )
{
// We assume that this is either a stipple or hatched brush and not a
// solid one as otherwise it would have been enough to set the
// background colour and such brushes need to be positioned correctly
// in order to align when different windows are painted, so do it here.
RECT rc;
::GetWindowRect(GetHwndOf(child), &rc);
::MapWindowPoints(NULL, GetHwnd(), (POINT *)&rc, 1);
if ( !::SetBrushOrgEx((HDC)hDC, -rc.left, -rc.top, NULL) )
{
wxLogLastError(wxT("SetBrushOrgEx(bg brush)"));
}
return hbrush;
}
// Otherwise see if we have a custom background colour.
if ( m_hasBgCol )
{
wxBrush *