From c581abbcad367c168233d89de1af89c3cd1f2830 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Fri, 7 Jan 2005 14:38:07 +0000 Subject: [PATCH] extracted background painting in a separate function so that it could be called from derived classes git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@31270 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/msw/window.cpp | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/src/msw/window.cpp b/src/msw/window.cpp index cf15c6ae66..a3a82351a4 100644 --- a/src/msw/window.cpp +++ b/src/msw/window.cpp @@ -4102,21 +4102,26 @@ void wxWindowMSW::OnEraseBackground(wxEraseEvent& event) // do default background painting - wxDC& dc = *event.GetDC(); - HBRUSH hBrush = (HBRUSH)MSWGetBgBrush(dc.GetHDC()); - if ( hBrush ) - { - RECT rc; - ::GetClientRect(GetHwnd(), &rc); - ::FillRect(GetHdcOf(dc), &rc, hBrush); - } - else + if ( !DoEraseBackground(*event.GetDC()) ) { // let the system paint the background event.Skip(); } } +bool wxWindowMSW::DoEraseBackground(wxDC& dc) +{ + HBRUSH hBrush = (HBRUSH)MSWGetBgBrush(dc.GetHDC()); + if ( !hBrush ) + return false; + + RECT rc; + ::GetClientRect(GetHwnd(), &rc); + ::FillRect(GetHdcOf(dc), &rc, hBrush); + + return true; +} + WXHBRUSH wxWindowMSW::MSWGetSolidBgBrushForChild(wxWindow *child) { wxColour col = MSWGetBgColourForChild(child); -- 2.45.2