]> git.saurik.com Git - wxWidgets.git/commitdiff
after latest changes background of radio buttons _not_ inside the notebook wasn't...
authorVadim Zeitlin <vadim@wxwidgets.org>
Mon, 11 Apr 2005 14:41:36 +0000 (14:41 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Mon, 11 Apr 2005 14:41:36 +0000 (14:41 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@33509 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

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

index ae7041a3c09e031925f005f94fa99f6b3dc62e67..79b607ebbbd1578960498f7fcce0b178bcfb5d8b 100644 (file)
@@ -146,6 +146,9 @@ protected:
 
 #ifndef __WXWINCE__
     virtual WXHRGN MSWGetRegionWithoutChildren();
+    virtual WXLRESULT MSWWindowProc(WXUINT nMsg,
+                                    WXWPARAM wParam,
+                                    WXLPARAM lParam);
 #endif // __WXWINCE__
 
 
index 688cf27772ad805c909e1120effa27f9e03b61ab..627f4378f79d123fa4e1adef24798634ff68d2df 100644 (file)
@@ -290,7 +290,8 @@ public:
     bool HandleDestroy();
 
     bool HandlePaint();
-    bool HandleEraseBkgnd(WXHDC pDC);
+    bool HandlePrintClient(WXHDC hDC);
+    bool HandleEraseBkgnd(WXHDC hDC);
 
     bool HandleMinimize();
     bool HandleMaximize();
index cb435180b18692e4fd5172284778699fe8206b63..ac037051d8886a3b518767dc06957e889de79c34 100644 (file)
@@ -667,6 +667,30 @@ WXHRGN wxRadioBox::MSWGetRegionWithoutChildren()
     return (WXHRGN)hrgn;
 }
 
+WXLRESULT
+wxRadioBox::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam)
+{
+    if ( nMsg == WM_PRINTCLIENT )
+    {
+        // we have to process WM_PRINTCLIENT ourselves as otherwise the radio
+        // buttons background would never be drawn unless we have a parent with
+        // non default background
+
+        // so check first if we have one
+        if ( !HandlePrintClient((WXHDC)wParam) )
+        {
+            // no, we don't, erase the background ourselves (don't use our own
+            // colour as with static box, see comments there)
+            wxFillRect(GetHwnd(), (HDC)wParam,
+                        GetHbrushOf(wxBrush(GetParent()->GetBackgroundColour())));
+        }
+
+        return 0;
+    }
+
+    return wxStaticBox::MSWWindowProc(nMsg, wParam, lParam);
+}
+
 #endif // __WXWINCE__
 
 // ---------------------------------------------------------------------------
index 8681939a0186960884eb4238ce5ae027b5cb43c1..58d2235f7b1d15de6e686b04524dc74958230f36 100644 (file)
@@ -2319,30 +2319,7 @@ WXLRESULT wxWindowMSW::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM l
             break;
 
         case WM_PRINTCLIENT:
-            // we receive this message when DrawThemeParentBackground() is
-            // called from def window proc of several controls under XP and we
-            // must draw properly themed background here
-            //
-            // note that naively I'd expect filling the client rect with the
-            // brush returned by MSWGetBgBrush() work -- but for some reason it
-            // doesn't and we have to call parents MSWPrintChild() which is
-            // supposed to call DrawThemeBackground() with appropriate params
-            //
-            // also note that in this case lParam == PRF_CLIENT but we're
-            // clearly expected to paint the background and nothing else!
-            {
-                for ( wxWindow *win = GetParent(); win; win = win->GetParent() )
-                {
-                    if ( win->MSWPrintChild((WXHDC)wParam, (wxWindow *)this) )
-                    {
-                        processed = true;
-                        break;
-                    }
-
-                    if ( win->IsTopLevel() || win->InheritsBackgroundColour() )
-                        break;
-                }
-            }
+            processed = HandlePrintClient((WXHDC)wParam);
             break;
 
         case WM_PAINT:
@@ -3715,7 +3692,7 @@ bool wxWindowMSW::HandleDisplayChange()
 
 #ifndef __WXMICROWIN__
 
-bool wxWindowMSW::HandleCtlColor(WXHBRUSH *brush, WXHDC pDC, WXHWND hWnd)
+bool wxWindowMSW::HandleCtlColor(WXHBRUSH *brush, WXHDC hDC, WXHWND hWnd)
 {
 #if !wxUSE_CONTROLS || defined(__WXUNIVERSAL__)
     wxUnusedVar(pDC);
@@ -3724,7 +3701,7 @@ bool wxWindowMSW::HandleCtlColor(WXHBRUSH *brush, WXHDC pDC, WXHWND hWnd)
     wxControl *item = wxDynamicCast(FindItemByHWND(hWnd, true), wxControl);
 
     if ( item )
-        *brush = item->MSWControlColor(pDC, hWnd);
+        *brush = item->MSWControlColor(hDC, hWnd);
     else
 #endif // wxUSE_CONTROLS
         *brush = NULL;
@@ -4062,6 +4039,31 @@ WXHBRUSH wxWindowMSW::MSWGetBgBrush(WXHDC hDC, WXHWND hWndToPaint)
     return 0;
 }
 
+bool wxWindowMSW::HandlePrintClient(WXHDC hDC)
+{
+    // we receive this message when DrawThemeParentBackground() is
+    // called from def window proc of several controls under XP and we
+    // must draw properly themed background here
+    //
+    // note that naively I'd expect filling the client rect with the
+    // brush returned by MSWGetBgBrush() work -- but for some reason it
+    // doesn't and we have to call parents MSWPrintChild() which is
+    // supposed to call DrawThemeBackground() with appropriate params
+    //
+    // also note that in this case lParam == PRF_CLIENT but we're
+    // clearly expected to paint the background and nothing else!
+    for ( wxWindow *win = GetParent(); win; win = win->GetParent() )
+    {
+        if ( win->MSWPrintChild(hDC, (wxWindow *)this) )
+            return true;
+
+        if ( win->IsTopLevel() || win->InheritsBackgroundColour() )
+            break;
+    }
+
+    return false;
+}
+
 // ---------------------------------------------------------------------------
 // moving and resizing
 // ---------------------------------------------------------------------------