From: Julian Smart Date: Fri, 1 Apr 2005 15:57:19 +0000 (+0000) Subject: Now calculates clipping region from actual child HWNDs and not X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/54c5498d0f54fdc2005fcddec4cac5e6acdc0036?ds=inline Now calculates clipping region from actual child HWNDs and not wxWidgets windows, which helps with composite controls git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@33241 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/src/msw/statbox.cpp b/src/msw/statbox.cpp index ea27a85d60..77b7a8939c 100644 --- a/src/msw/statbox.cpp +++ b/src/msw/statbox.cpp @@ -229,32 +229,40 @@ WXHRGN wxStaticBox::MSWCalculateClippingRegion() RECT rc; ::GetWindowRect(GetHwnd(), &rc); HRGN hrgn = ::CreateRectRgn(rc.left, rc.top, rc.right + 1, rc.bottom + 1); - - wxWindowList::compatibility_iterator node = GetParent()->GetChildren().GetFirst(); - while ( node ) + + wxList hWnds; + HWND child = ::GetWindow((HWND) GetParent()->GetHWND(), GW_CHILD); + while (child != 0) + { + hWnds.Append((wxObject*) child); + child = ::GetWindow(child, GW_HWNDNEXT); + } + + for (wxNode* node = hWnds.GetFirst(); node; node = node->GetNext()) { - wxWindow *child = node->GetData(); + HWND child = (HWND) node->GetData(); + 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 ( !child->IsKindOf(CLASSINFO(wxStaticBox)) ) + if (!childWindow || !childWindow->IsKindOf(CLASSINFO(wxStaticBox))) { - ::GetWindowRect(GetHwndOf(child), &rc); + ::GetWindowRect(child, &rc); if ( RectInRegion(hrgn, &rc) ) { // need to remove WS_CLIPSIBLINGS from all sibling windows // that are within this staticbox if set - LONG style = ::GetWindowLong(GetHwndOf(child), GWL_STYLE); + LONG style = ::GetWindowLong(child, GWL_STYLE); if ( style & WS_CLIPSIBLINGS ) { style &= ~WS_CLIPSIBLINGS; - ::SetWindowLong(GetHwndOf(child), GWL_STYLE, style); + ::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(GetHwndOf(child), NULL, 0, 0, 0, 0, + ::SetWindowPos(child, NULL, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_FRAMECHANGED); } @@ -264,9 +272,8 @@ WXHRGN wxStaticBox::MSWCalculateClippingRegion() ::DeleteObject(hrgnchild); } } - - node = node->GetNext(); } + ::GetWindowRect(GetHwnd(), &rc); ::OffsetRgn(hrgn, -rc.left, -rc.top);