]> git.saurik.com Git - wxWidgets.git/commitdiff
added MSWPrintChild() for drawing child background (replaces patch 1108389)
authorVadim Zeitlin <vadim@wxwidgets.org>
Sat, 19 Feb 2005 20:49:50 +0000 (20:49 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Sat, 19 Feb 2005 20:49:50 +0000 (20:49 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@32208 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

include/wx/msw/notebook.h
include/wx/msw/window.h
src/msw/notebook.cpp
src/msw/window.cpp

index 6bed22bbfe54121bbab9416520e78622e5fd346c..7261a747a553224ff308c01ecc18f0029da6430d 100644 (file)
@@ -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)
index fe646444e44c6a9c53462dc162bdd7176013279c..ef21be2ecf777b70d39c18b9c8f1b77f1c62936a 100644 (file)
@@ -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);
 
index db34763fd59b50369e785a359faf17b0de83b61a..e73853067695a35904562411e68d26c33f9ae508 100644 (file)
@@ -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
index 105459f34c5790feb3734f3ff0e021c108c926ff..d86c3599f1a0ed5d90391247984a784bb1e55dfa 100644 (file)
@@ -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
 // ---------------------------------------------------------------------------