From 1a784dfc808db85f5e2616c014ea2ecd23c6a3c1 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Mon, 11 Apr 2005 14:41:36 +0000 Subject: [PATCH] after latest changes background of radio buttons _not_ inside the notebook wasn't redrawn at all, fixed this git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@33509 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/msw/radiobox.h | 3 +++ include/wx/msw/window.h | 3 ++- src/msw/radiobox.cpp | 24 +++++++++++++++++ src/msw/window.cpp | 54 ++++++++++++++++++++------------------- 4 files changed, 57 insertions(+), 27 deletions(-) diff --git a/include/wx/msw/radiobox.h b/include/wx/msw/radiobox.h index ae7041a3c0..79b607ebbb 100644 --- a/include/wx/msw/radiobox.h +++ b/include/wx/msw/radiobox.h @@ -146,6 +146,9 @@ protected: #ifndef __WXWINCE__ virtual WXHRGN MSWGetRegionWithoutChildren(); + virtual WXLRESULT MSWWindowProc(WXUINT nMsg, + WXWPARAM wParam, + WXLPARAM lParam); #endif // __WXWINCE__ diff --git a/include/wx/msw/window.h b/include/wx/msw/window.h index 688cf27772..627f4378f7 100644 --- a/include/wx/msw/window.h +++ b/include/wx/msw/window.h @@ -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(); diff --git a/src/msw/radiobox.cpp b/src/msw/radiobox.cpp index cb435180b1..ac037051d8 100644 --- a/src/msw/radiobox.cpp +++ b/src/msw/radiobox.cpp @@ -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__ // --------------------------------------------------------------------------- diff --git a/src/msw/window.cpp b/src/msw/window.cpp index 8681939a01..58d2235f7b 100644 --- a/src/msw/window.cpp +++ b/src/msw/window.cpp @@ -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 // --------------------------------------------------------------------------- -- 2.45.2