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
This commit is contained in:
@@ -229,32 +229,40 @@ WXHRGN wxStaticBox::MSWCalculateClippingRegion()
|
|||||||
RECT rc;
|
RECT rc;
|
||||||
::GetWindowRect(GetHwnd(), &rc);
|
::GetWindowRect(GetHwnd(), &rc);
|
||||||
HRGN hrgn = ::CreateRectRgn(rc.left, rc.top, rc.right + 1, rc.bottom + 1);
|
HRGN hrgn = ::CreateRectRgn(rc.left, rc.top, rc.right + 1, rc.bottom + 1);
|
||||||
|
|
||||||
wxWindowList::compatibility_iterator node = GetParent()->GetChildren().GetFirst();
|
wxList hWnds;
|
||||||
while ( node )
|
HWND child = ::GetWindow((HWND) GetParent()->GetHWND(), GW_CHILD);
|
||||||
|
while (child != 0)
|
||||||
{
|
{
|
||||||
wxWindow *child = node->GetData();
|
hWnds.Append((wxObject*) child);
|
||||||
|
child = ::GetWindow(child, GW_HWNDNEXT);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (wxNode* node = hWnds.GetFirst(); node; node = node->GetNext())
|
||||||
|
{
|
||||||
|
HWND child = (HWND) node->GetData();
|
||||||
|
wxWindow* childWindow = wxGetWindowFromHWND((WXHWND) child);
|
||||||
|
|
||||||
// can't just test for (this != child) here since if a wxStaticBox
|
// can't just test for (this != child) here since if a wxStaticBox
|
||||||
// overlaps another wxStaticBox then neither are drawn. The overlapping
|
// overlaps another wxStaticBox then neither are drawn. The overlapping
|
||||||
// region will flicker but we shouldn't have overlapping windows anyway.
|
// 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) )
|
if ( RectInRegion(hrgn, &rc) )
|
||||||
{
|
{
|
||||||
// need to remove WS_CLIPSIBLINGS from all sibling windows
|
// need to remove WS_CLIPSIBLINGS from all sibling windows
|
||||||
// that are within this staticbox if set
|
// that are within this staticbox if set
|
||||||
LONG style = ::GetWindowLong(GetHwndOf(child), GWL_STYLE);
|
LONG style = ::GetWindowLong(child, GWL_STYLE);
|
||||||
if ( style & WS_CLIPSIBLINGS )
|
if ( style & WS_CLIPSIBLINGS )
|
||||||
{
|
{
|
||||||
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
|
// MSDN: "If you have changed certain window data using
|
||||||
// SetWindowLong, you must call SetWindowPos to have the
|
// SetWindowLong, you must call SetWindowPos to have the
|
||||||
// changes take effect."
|
// 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_NOMOVE | SWP_NOSIZE | SWP_NOZORDER |
|
||||||
SWP_FRAMECHANGED);
|
SWP_FRAMECHANGED);
|
||||||
}
|
}
|
||||||
@@ -264,9 +272,8 @@ WXHRGN wxStaticBox::MSWCalculateClippingRegion()
|
|||||||
::DeleteObject(hrgnchild);
|
::DeleteObject(hrgnchild);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
node = node->GetNext();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
::GetWindowRect(GetHwnd(), &rc);
|
::GetWindowRect(GetHwnd(), &rc);
|
||||||
::OffsetRgn(hrgn, -rc.left, -rc.top);
|
::OffsetRgn(hrgn, -rc.left, -rc.top);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user