From: Vadim Zeitlin Date: Sat, 19 Feb 2005 20:49:50 +0000 (+0000) Subject: added MSWPrintChild() for drawing child background (replaces patch 1108389) X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/07c19327922deabc5f140ea3659e65e1c37a5d65 added MSWPrintChild() for drawing child background (replaces patch 1108389) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@32208 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/include/wx/msw/notebook.h b/include/wx/msw/notebook.h index 6bed22bbfe..7261a747a5 100644 --- a/include/wx/msw/notebook.h +++ b/include/wx/msw/notebook.h @@ -212,6 +212,9 @@ protected: // creates the brush to be used for drawing the tab control background void UpdateBgBrush(); + + // paint themed children background here + virtual bool MSWPrintChild(wxWindow *win, WXWPARAM wParam, WXLPARAM lParam); #endif // wxUSE_UXTHEME // the current selection (-1 if none) diff --git a/include/wx/msw/window.h b/include/wx/msw/window.h index fe646444e4..ef21be2ecf 100644 --- a/include/wx/msw/window.h +++ b/include/wx/msw/window.h @@ -398,6 +398,16 @@ public: // windows via their MSWGetBgBrushForChild() recursively WXHBRUSH MSWGetBgBrush(WXHDC hDC); + // overriding this method gives the parent window the opportunity to + // process WM_PRINTCLIENT for its children: this is currently used by + // wxNotebook to draw themed background for them + // + // return true if the message was processed or false to use default logic + // for it (currently this means handling it just as WM_PAINT i.e. render + // the control into the provided DC) + virtual bool MSWPrintChild(wxWindow *win, WXWPARAM wParam, WXLPARAM lParam); + + // Responds to colour changes: passes event on to children. void OnSysColourChanged(wxSysColourChangedEvent& event); diff --git a/src/msw/notebook.cpp b/src/msw/notebook.cpp index db34763fd5..e738530676 100644 --- a/src/msw/notebook.cpp +++ b/src/msw/notebook.cpp @@ -1002,6 +1002,33 @@ wxColour wxNotebook::MSWGetBgColourForChild(wxWindow *win) return c == CLR_INVALID ? wxNullColour : wxRGBToColour(c); } +bool +wxNotebook::MSWPrintChild(wxWindow *win, + WXWPARAM wParam, + WXLPARAM WXUNUSED(lParam)) +{ + RECT rc; + ::GetClientRect(GetHwnd(), &rc); + TabCtrl_AdjustRect(GetHwnd(), true, &rc); + ::MapWindowPoints(GetHwnd(), GetHwndOf(win), (POINT *)&rc, 2); + + wxUxThemeHandle theme(win, L"TAB"); + if ( theme ) + { + wxUxThemeEngine::Get()->DrawThemeBackground + ( + theme, + (WXHDC)wParam, + 9 /* TABP_PANE */, + 0, + &rc, + NULL + ); + } + + return true; +} + #endif // wxUSE_UXTHEME // Windows only: attempts to get colour for UX theme page background diff --git a/src/msw/window.cpp b/src/msw/window.cpp index 105459f34c..d86c3599f1 100644 --- a/src/msw/window.cpp +++ b/src/msw/window.cpp @@ -2312,12 +2312,21 @@ WXLRESULT wxWindowMSW::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM l } #ifdef WM_PRINT + case WM_PRINTCLIENT: + if ( GetParent() && + GetParent()->MSWPrintChild(this, wParam, lParam) ) + { + processed = true; + } + break; + case WM_PRINT: { if ( lParam & PRF_ERASEBKGND ) HandleEraseBkgnd((WXHDC)(HDC)wParam); wxPaintDCEx dc((wxWindow *)this, (WXHDC)wParam); + processed = HandlePaint(); } break; @@ -4035,6 +4044,14 @@ WXHBRUSH wxWindowMSW::MSWGetBgBrush(WXHDC hDC) return 0; } +bool +wxWindowMSW::MSWPrintChild(wxWindow * WXUNUSED(win), + WXWPARAM WXUNUSED(wParam), + WXLPARAM WXUNUSED(lParam)) +{ + return false; +} + // --------------------------------------------------------------------------- // moving and resizing // ---------------------------------------------------------------------------