From 21f9e9538015470a16807b8307d135ecb064c196 Mon Sep 17 00:00:00 2001 From: Stefan Csomor Date: Tue, 10 Feb 2004 17:29:48 +0000 Subject: [PATCH] because some sash code draws whether the window is visible or not, the easiest thing is to make the MacGetVisibleRegion return an empty region for this case, so the wxDC is always entirely clipped git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@25710 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/mac/carbon/window.cpp | 145 ++++++++++++++++++++------------------ src/mac/window.cpp | 145 ++++++++++++++++++++------------------ 2 files changed, 154 insertions(+), 136 deletions(-) diff --git a/src/mac/carbon/window.cpp b/src/mac/carbon/window.cpp index 8fad9699bc..a5c56e4202 100644 --- a/src/mac/carbon/window.cpp +++ b/src/mac/carbon/window.cpp @@ -1638,92 +1638,101 @@ const wxRegion& wxWindowMac::MacGetVisibleRegion( bool respectChildrenAndSibling RgnHandle tempRgn = NewRgn() ; RgnHandle tempStaticBoxRgn = NewRgn() ; - SetRectRgn( visRgn , 0 , 0 , m_width , m_height ) ; - - //TODO : as soon as the new scheme has proven to work correctly, move this to wxStaticBox - if ( IsKindOf( CLASSINFO( wxStaticBox ) ) ) + if ( MacIsReallyShown() ) { - int borderTop = 14 ; - int borderOther = 4 ; + SetRectRgn( visRgn , 0 , 0 , m_width , m_height ) ; - SetRectRgn( tempStaticBoxRgn , borderOther , borderTop , m_width - borderOther , m_height - borderOther ) ; - DiffRgn( visRgn , tempStaticBoxRgn , visRgn ) ; - } + //TODO : as soon as the new scheme has proven to work correctly, move this to wxStaticBox + if ( IsKindOf( CLASSINFO( wxStaticBox ) ) ) + { + int borderTop = 14 ; + int borderOther = 4 ; + if ( UMAGetSystemVersion() >= 0x1030 ) + borderTop += 2 ; - if ( !IsTopLevel() ) - { - wxWindow* parent = GetParent() ; - while( parent ) + SetRectRgn( tempStaticBoxRgn , borderOther , borderTop , m_width - borderOther , m_height - borderOther ) ; + DiffRgn( visRgn , tempStaticBoxRgn , visRgn ) ; + } + + if ( !IsTopLevel() ) { - wxSize size = parent->GetSize() ; - int x , y ; - x = y = 0 ; - parent->MacWindowToRootWindow( &x, &y ) ; - MacRootWindowToWindow( &x , &y ) ; - - SetRectRgn( tempRgn , - x + parent->MacGetLeftBorderSize() , y + parent->MacGetTopBorderSize() , - x + size.x - parent->MacGetRightBorderSize(), - y + size.y - parent->MacGetBottomBorderSize()) ; - - SectRgn( visRgn , tempRgn , visRgn ) ; - if ( parent->IsTopLevel() ) - break ; - parent = parent->GetParent() ; + wxWindow* parent = GetParent() ; + while( parent ) + { + wxSize size = parent->GetSize() ; + int x , y ; + x = y = 0 ; + parent->MacWindowToRootWindow( &x, &y ) ; + MacRootWindowToWindow( &x , &y ) ; + + SetRectRgn( tempRgn , + x + parent->MacGetLeftBorderSize() , y + parent->MacGetTopBorderSize() , + x + size.x - parent->MacGetRightBorderSize(), + y + size.y - parent->MacGetBottomBorderSize()) ; + + SectRgn( visRgn , tempRgn , visRgn ) ; + if ( parent->IsTopLevel() ) + break ; + parent = parent->GetParent() ; + } } - } - if ( respectChildrenAndSiblings ) - { - if ( GetWindowStyle() & wxCLIP_CHILDREN ) + if ( respectChildrenAndSiblings ) { - for (wxWindowListNode *node = GetChildren().GetFirst(); node; node = node->GetNext()) + if ( GetWindowStyle() & wxCLIP_CHILDREN ) { - wxWindowMac *child = node->GetData(); - - if ( !child->IsTopLevel() && child->IsShown() ) + for (wxWindowListNode *node = GetChildren().GetFirst(); node; node = node->GetNext()) { - SetRectRgn( tempRgn , child->m_x , child->m_y , child->m_x + child->m_width , child->m_y + child->m_height ) ; - if ( child->IsKindOf( CLASSINFO( wxStaticBox ) ) ) - { - int borderTop = 14 ; - int borderOther = 4 ; + wxWindowMac *child = node->GetData(); - SetRectRgn( tempStaticBoxRgn , child->m_x + borderOther , child->m_y + borderTop , child->m_x + child->m_width - borderOther , child->m_y + child->m_height - borderOther ) ; - DiffRgn( tempRgn , tempStaticBoxRgn , tempRgn ) ; + if ( !child->IsTopLevel() && child->IsShown() ) + { + SetRectRgn( tempRgn , child->m_x , child->m_y , child->m_x + child->m_width , child->m_y + child->m_height ) ; + if ( child->IsKindOf( CLASSINFO( wxStaticBox ) ) ) + { + int borderTop = 14 ; + int borderOther = 4 ; + if ( UMAGetSystemVersion() >= 0x1030 ) + borderTop += 2 ; + + SetRectRgn( tempStaticBoxRgn , child->m_x + borderOther , child->m_y + borderTop , child->m_x + child->m_width - borderOther , child->m_y + child->m_height - borderOther ) ; + DiffRgn( tempRgn , tempStaticBoxRgn , tempRgn ) ; + } + DiffRgn( visRgn , tempRgn , visRgn ) ; } - DiffRgn( visRgn , tempRgn , visRgn ) ; } } - } - if ( (GetWindowStyle() & wxCLIP_SIBLINGS) && GetParent() ) - { - bool thisWindowThrough = false ; - for (wxWindowListNode *node = GetParent()->GetChildren().GetFirst(); node; node = node->GetNext()) + if ( (GetWindowStyle() & wxCLIP_SIBLINGS) && GetParent() ) { - wxWindowMac *sibling = node->GetData(); - if ( sibling == this ) - { - thisWindowThrough = true ; - continue ; - } - if( !thisWindowThrough ) + bool thisWindowThrough = false ; + for (wxWindowListNode *node = GetParent()->GetChildren().GetFirst(); node; node = node->GetNext()) { - continue ; - } - - if ( !sibling->IsTopLevel() && sibling->IsShown() ) - { - SetRectRgn( tempRgn , sibling->m_x - m_x , sibling->m_y - m_y , sibling->m_x + sibling->m_width - m_x , sibling->m_y + sibling->m_height - m_y ) ; - if ( sibling->IsKindOf( CLASSINFO( wxStaticBox ) ) ) + wxWindowMac *sibling = node->GetData(); + if ( sibling == this ) { - int borderTop = 14 ; - int borderOther = 4 ; + thisWindowThrough = true ; + continue ; + } + if( !thisWindowThrough ) + { + continue ; + } - SetRectRgn( tempStaticBoxRgn , sibling->m_x - m_x + borderOther , sibling->m_y - m_y + borderTop , sibling->m_x + sibling->m_width - m_x - borderOther , sibling->m_y + sibling->m_height - m_y - borderOther ) ; - DiffRgn( tempRgn , tempStaticBoxRgn , tempRgn ) ; + if ( !sibling->IsTopLevel() && sibling->IsShown() ) + { + SetRectRgn( tempRgn , sibling->m_x - m_x , sibling->m_y - m_y , sibling->m_x + sibling->m_width - m_x , sibling->m_y + sibling->m_height - m_y ) ; + if ( sibling->IsKindOf( CLASSINFO( wxStaticBox ) ) ) + { + int borderTop = 14 ; + int borderOther = 4 ; + if ( UMAGetSystemVersion() >= 0x1030 ) + borderTop += 2 ; + + SetRectRgn( tempStaticBoxRgn , sibling->m_x - m_x + borderOther , sibling->m_y - m_y + borderTop , sibling->m_x + sibling->m_width - m_x - borderOther , sibling->m_y + sibling->m_height - m_y - borderOther ) ; + DiffRgn( tempRgn , tempStaticBoxRgn , tempRgn ) ; + } + DiffRgn( visRgn , tempRgn , visRgn ) ; } - DiffRgn( visRgn , tempRgn , visRgn ) ; } } } diff --git a/src/mac/window.cpp b/src/mac/window.cpp index 8fad9699bc..a5c56e4202 100644 --- a/src/mac/window.cpp +++ b/src/mac/window.cpp @@ -1638,92 +1638,101 @@ const wxRegion& wxWindowMac::MacGetVisibleRegion( bool respectChildrenAndSibling RgnHandle tempRgn = NewRgn() ; RgnHandle tempStaticBoxRgn = NewRgn() ; - SetRectRgn( visRgn , 0 , 0 , m_width , m_height ) ; - - //TODO : as soon as the new scheme has proven to work correctly, move this to wxStaticBox - if ( IsKindOf( CLASSINFO( wxStaticBox ) ) ) + if ( MacIsReallyShown() ) { - int borderTop = 14 ; - int borderOther = 4 ; + SetRectRgn( visRgn , 0 , 0 , m_width , m_height ) ; - SetRectRgn( tempStaticBoxRgn , borderOther , borderTop , m_width - borderOther , m_height - borderOther ) ; - DiffRgn( visRgn , tempStaticBoxRgn , visRgn ) ; - } + //TODO : as soon as the new scheme has proven to work correctly, move this to wxStaticBox + if ( IsKindOf( CLASSINFO( wxStaticBox ) ) ) + { + int borderTop = 14 ; + int borderOther = 4 ; + if ( UMAGetSystemVersion() >= 0x1030 ) + borderTop += 2 ; - if ( !IsTopLevel() ) - { - wxWindow* parent = GetParent() ; - while( parent ) + SetRectRgn( tempStaticBoxRgn , borderOther , borderTop , m_width - borderOther , m_height - borderOther ) ; + DiffRgn( visRgn , tempStaticBoxRgn , visRgn ) ; + } + + if ( !IsTopLevel() ) { - wxSize size = parent->GetSize() ; - int x , y ; - x = y = 0 ; - parent->MacWindowToRootWindow( &x, &y ) ; - MacRootWindowToWindow( &x , &y ) ; - - SetRectRgn( tempRgn , - x + parent->MacGetLeftBorderSize() , y + parent->MacGetTopBorderSize() , - x + size.x - parent->MacGetRightBorderSize(), - y + size.y - parent->MacGetBottomBorderSize()) ; - - SectRgn( visRgn , tempRgn , visRgn ) ; - if ( parent->IsTopLevel() ) - break ; - parent = parent->GetParent() ; + wxWindow* parent = GetParent() ; + while( parent ) + { + wxSize size = parent->GetSize() ; + int x , y ; + x = y = 0 ; + parent->MacWindowToRootWindow( &x, &y ) ; + MacRootWindowToWindow( &x , &y ) ; + + SetRectRgn( tempRgn , + x + parent->MacGetLeftBorderSize() , y + parent->MacGetTopBorderSize() , + x + size.x - parent->MacGetRightBorderSize(), + y + size.y - parent->MacGetBottomBorderSize()) ; + + SectRgn( visRgn , tempRgn , visRgn ) ; + if ( parent->IsTopLevel() ) + break ; + parent = parent->GetParent() ; + } } - } - if ( respectChildrenAndSiblings ) - { - if ( GetWindowStyle() & wxCLIP_CHILDREN ) + if ( respectChildrenAndSiblings ) { - for (wxWindowListNode *node = GetChildren().GetFirst(); node; node = node->GetNext()) + if ( GetWindowStyle() & wxCLIP_CHILDREN ) { - wxWindowMac *child = node->GetData(); - - if ( !child->IsTopLevel() && child->IsShown() ) + for (wxWindowListNode *node = GetChildren().GetFirst(); node; node = node->GetNext()) { - SetRectRgn( tempRgn , child->m_x , child->m_y , child->m_x + child->m_width , child->m_y + child->m_height ) ; - if ( child->IsKindOf( CLASSINFO( wxStaticBox ) ) ) - { - int borderTop = 14 ; - int borderOther = 4 ; + wxWindowMac *child = node->GetData(); - SetRectRgn( tempStaticBoxRgn , child->m_x + borderOther , child->m_y + borderTop , child->m_x + child->m_width - borderOther , child->m_y + child->m_height - borderOther ) ; - DiffRgn( tempRgn , tempStaticBoxRgn , tempRgn ) ; + if ( !child->IsTopLevel() && child->IsShown() ) + { + SetRectRgn( tempRgn , child->m_x , child->m_y , child->m_x + child->m_width , child->m_y + child->m_height ) ; + if ( child->IsKindOf( CLASSINFO( wxStaticBox ) ) ) + { + int borderTop = 14 ; + int borderOther = 4 ; + if ( UMAGetSystemVersion() >= 0x1030 ) + borderTop += 2 ; + + SetRectRgn( tempStaticBoxRgn , child->m_x + borderOther , child->m_y + borderTop , child->m_x + child->m_width - borderOther , child->m_y + child->m_height - borderOther ) ; + DiffRgn( tempRgn , tempStaticBoxRgn , tempRgn ) ; + } + DiffRgn( visRgn , tempRgn , visRgn ) ; } - DiffRgn( visRgn , tempRgn , visRgn ) ; } } - } - if ( (GetWindowStyle() & wxCLIP_SIBLINGS) && GetParent() ) - { - bool thisWindowThrough = false ; - for (wxWindowListNode *node = GetParent()->GetChildren().GetFirst(); node; node = node->GetNext()) + if ( (GetWindowStyle() & wxCLIP_SIBLINGS) && GetParent() ) { - wxWindowMac *sibling = node->GetData(); - if ( sibling == this ) - { - thisWindowThrough = true ; - continue ; - } - if( !thisWindowThrough ) + bool thisWindowThrough = false ; + for (wxWindowListNode *node = GetParent()->GetChildren().GetFirst(); node; node = node->GetNext()) { - continue ; - } - - if ( !sibling->IsTopLevel() && sibling->IsShown() ) - { - SetRectRgn( tempRgn , sibling->m_x - m_x , sibling->m_y - m_y , sibling->m_x + sibling->m_width - m_x , sibling->m_y + sibling->m_height - m_y ) ; - if ( sibling->IsKindOf( CLASSINFO( wxStaticBox ) ) ) + wxWindowMac *sibling = node->GetData(); + if ( sibling == this ) { - int borderTop = 14 ; - int borderOther = 4 ; + thisWindowThrough = true ; + continue ; + } + if( !thisWindowThrough ) + { + continue ; + } - SetRectRgn( tempStaticBoxRgn , sibling->m_x - m_x + borderOther , sibling->m_y - m_y + borderTop , sibling->m_x + sibling->m_width - m_x - borderOther , sibling->m_y + sibling->m_height - m_y - borderOther ) ; - DiffRgn( tempRgn , tempStaticBoxRgn , tempRgn ) ; + if ( !sibling->IsTopLevel() && sibling->IsShown() ) + { + SetRectRgn( tempRgn , sibling->m_x - m_x , sibling->m_y - m_y , sibling->m_x + sibling->m_width - m_x , sibling->m_y + sibling->m_height - m_y ) ; + if ( sibling->IsKindOf( CLASSINFO( wxStaticBox ) ) ) + { + int borderTop = 14 ; + int borderOther = 4 ; + if ( UMAGetSystemVersion() >= 0x1030 ) + borderTop += 2 ; + + SetRectRgn( tempStaticBoxRgn , sibling->m_x - m_x + borderOther , sibling->m_y - m_y + borderTop , sibling->m_x + sibling->m_width - m_x - borderOther , sibling->m_y + sibling->m_height - m_y - borderOther ) ; + DiffRgn( tempRgn , tempStaticBoxRgn , tempRgn ) ; + } + DiffRgn( visRgn , tempRgn , visRgn ) ; } - DiffRgn( visRgn , tempRgn , visRgn ) ; } } } -- 2.45.2