From 4249e3340757896a928ed3353cd146568c84e4b0 Mon Sep 17 00:00:00 2001 From: Robin Dunn Date: Fri, 15 Apr 2005 03:00:15 +0000 Subject: [PATCH] Don't clip hidden windows from the staticbox's refresh. Also handle non wxWindows better. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@33617 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/msw/statbox.cpp | 61 ++++++++++++++++++++++++++------------------- 1 file changed, 35 insertions(+), 26 deletions(-) diff --git a/src/msw/statbox.cpp b/src/msw/statbox.cpp index 1aa091a7b1..a73cb5bf68 100644 --- a/src/msw/statbox.cpp +++ b/src/msw/statbox.cpp @@ -258,35 +258,44 @@ WXHRGN wxStaticBox::MSWGetRegionWithoutChildren() child; child = ::GetWindow(child, GW_HWNDNEXT) ) { - wxWindow *childWindow = wxGetWindowFromHWND((WXHWND) child); - - // can't just test for (this != child) here since if a wxStaticBox - // overlaps another wxStaticBox then neither are drawn. The overlapping - // region will flicker but we shouldn't have overlapping windows anyway. - if ( !childWindow || !wxDynamicCast(childWindow, wxStaticBox) ) + if ( ! ::IsWindowVisible(child) ) + { + // if the window isn't visible then it doesn't need clipped + continue; + } + + LONG style = ::GetWindowLong(child, GWL_STYLE); + wxString str(wxGetWindowClass(child)); + str.UpperCase(); + if ( str == wxT("BUTTON") && (style & BS_GROUPBOX) != 0 ) { - ::GetWindowRect(child, &rc); - if ( ::RectInRegion(hrgn, &rc) ) + // Don't clip any static boxes, not just this one. This will + // result in flicker in overlapping static boxes, but at least + // they will all be drawn correctly and we shouldn't have + // overlapping windows anyway. + continue; + } + + ::GetWindowRect(child, &rc); + if ( ::RectInRegion(hrgn, &rc) ) + { + // need to remove WS_CLIPSIBLINGS from all sibling windows + // that are within this staticbox if set + if ( style & WS_CLIPSIBLINGS ) { - // need to remove WS_CLIPSIBLINGS from all sibling windows - // that are within this staticbox if set - LONG style = ::GetWindowLong(child, GWL_STYLE); - if ( style & WS_CLIPSIBLINGS ) - { - style &= ~WS_CLIPSIBLINGS; - ::SetWindowLong(child, GWL_STYLE, style); - - // MSDN: "If you have changed certain window data using - // SetWindowLong, you must call SetWindowPos to have the - // changes take effect." - ::SetWindowPos(child, NULL, 0, 0, 0, 0, - SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | - SWP_FRAMECHANGED); - } - - AutoHRGN hrgnChild(::CreateRectRgnIndirect(&rc)); - ::CombineRgn(hrgn, hrgn, hrgnChild, RGN_DIFF); + style &= ~WS_CLIPSIBLINGS; + ::SetWindowLong(child, GWL_STYLE, style); + + // MSDN: "If you have changed certain window data using + // SetWindowLong, you must call SetWindowPos to have the + // changes take effect." + ::SetWindowPos(child, NULL, 0, 0, 0, 0, + SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | + SWP_FRAMECHANGED); } + + AutoHRGN hrgnChild(::CreateRectRgnIndirect(&rc)); + ::CombineRgn(hrgn, hrgn, hrgnChild, RGN_DIFF); } } -- 2.45.2