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

added wxStaticBox fix for panther


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_4_BRANCH@25711 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Stefan Csomor
2004-02-10 17:31:38 +00:00
parent 91df926e86
commit 314bbbacb3
2 changed files with 174 additions and 154 deletions

View File

@@ -1721,95 +1721,105 @@ 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 ) ;
}
if ( !IsTopLevel() )
{
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 )
//TODO : as soon as the new scheme has proven to work correctly, move this to wxStaticBox
if ( IsKindOf( CLASSINFO( wxStaticBox ) ) )
{
for (wxNode *node = GetChildren().First(); node; node = node->Next())
{
wxWindowMac *child = (wxWindowMac*)node->Data();
int borderTop = 14 ;
int borderOther = 4 ;
if ( UMAGetSystemVersion() >= 0x1030 )
borderTop += 2 ;
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 ;
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 ) ;
}
}
SetRectRgn( tempStaticBoxRgn , borderOther , borderTop , m_width - borderOther , m_height - borderOther ) ;
DiffRgn( visRgn , tempStaticBoxRgn , visRgn ) ;
}
if ( (GetWindowStyle() & wxCLIP_SIBLINGS) && GetParent() )
if ( !IsTopLevel() )
{
bool thisWindowThrough = false ;
for (wxNode *node = GetParent()->GetChildren().First(); node; node = node->Next())
wxWindow* parent = GetParent() ;
while( parent )
{
wxWindowMac *sibling = (wxWindowMac*)node->Data();
if ( sibling == this )
{
thisWindowThrough = true ;
continue ;
}
if( !thisWindowThrough )
{
continue ;
}
wxSize size = parent->GetSize() ;
int x , y ;
x = y = 0 ;
parent->MacWindowToRootWindow( &x, &y ) ;
MacRootWindowToWindow( &x , &y ) ;
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 ;
SetRectRgn( tempRgn ,
x + parent->MacGetLeftBorderSize() , y + parent->MacGetTopBorderSize() ,
x + size.x - parent->MacGetRightBorderSize(),
y + size.y - parent->MacGetBottomBorderSize()) ;
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 ) ;
}
SectRgn( visRgn , tempRgn , visRgn ) ;
if ( parent->IsTopLevel() )
break ;
parent = parent->GetParent() ;
}
}
if ( respectChildrenAndSiblings )
{
if ( GetWindowStyle() & wxCLIP_CHILDREN )
{
for (wxNode *node = GetChildren().First(); node; node = node->Next())
{
wxWindowMac *child = (wxWindowMac*)node->Data();
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 ) ;
}
}
}
if ( (GetWindowStyle() & wxCLIP_SIBLINGS) && GetParent() )
{
bool thisWindowThrough = false ;
for (wxNode *node = GetParent()->GetChildren().First(); node; node = node->Next())
{
wxWindowMac *sibling = (wxWindowMac*)node->Data();
if ( sibling == this )
{
thisWindowThrough = true ;
continue ;
}
if( !thisWindowThrough )
{
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 ) ) )
{
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 ) ;
}
}
}
}
}
m_macVisibleRegion = visRgn ;
DisposeRgn( visRgn ) ;

View File

@@ -1721,95 +1721,105 @@ 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 ) ;
}
if ( !IsTopLevel() )
{
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 )
//TODO : as soon as the new scheme has proven to work correctly, move this to wxStaticBox
if ( IsKindOf( CLASSINFO( wxStaticBox ) ) )
{
for (wxNode *node = GetChildren().First(); node; node = node->Next())
{
wxWindowMac *child = (wxWindowMac*)node->Data();
int borderTop = 14 ;
int borderOther = 4 ;
if ( UMAGetSystemVersion() >= 0x1030 )
borderTop += 2 ;
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 ;
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 ) ;
}
}
SetRectRgn( tempStaticBoxRgn , borderOther , borderTop , m_width - borderOther , m_height - borderOther ) ;
DiffRgn( visRgn , tempStaticBoxRgn , visRgn ) ;
}
if ( (GetWindowStyle() & wxCLIP_SIBLINGS) && GetParent() )
if ( !IsTopLevel() )
{
bool thisWindowThrough = false ;
for (wxNode *node = GetParent()->GetChildren().First(); node; node = node->Next())
wxWindow* parent = GetParent() ;
while( parent )
{
wxWindowMac *sibling = (wxWindowMac*)node->Data();
if ( sibling == this )
{
thisWindowThrough = true ;
continue ;
}
if( !thisWindowThrough )
{
continue ;
}
wxSize size = parent->GetSize() ;
int x , y ;
x = y = 0 ;
parent->MacWindowToRootWindow( &x, &y ) ;
MacRootWindowToWindow( &x , &y ) ;
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 ;
SetRectRgn( tempRgn ,
x + parent->MacGetLeftBorderSize() , y + parent->MacGetTopBorderSize() ,
x + size.x - parent->MacGetRightBorderSize(),
y + size.y - parent->MacGetBottomBorderSize()) ;
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 ) ;
}
SectRgn( visRgn , tempRgn , visRgn ) ;
if ( parent->IsTopLevel() )
break ;
parent = parent->GetParent() ;
}
}
if ( respectChildrenAndSiblings )
{
if ( GetWindowStyle() & wxCLIP_CHILDREN )
{
for (wxNode *node = GetChildren().First(); node; node = node->Next())
{
wxWindowMac *child = (wxWindowMac*)node->Data();
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 ) ;
}
}
}
if ( (GetWindowStyle() & wxCLIP_SIBLINGS) && GetParent() )
{
bool thisWindowThrough = false ;
for (wxNode *node = GetParent()->GetChildren().First(); node; node = node->Next())
{
wxWindowMac *sibling = (wxWindowMac*)node->Data();
if ( sibling == this )
{
thisWindowThrough = true ;
continue ;
}
if( !thisWindowThrough )
{
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 ) ) )
{
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 ) ;
}
}
}
}
}
m_macVisibleRegion = visRgn ;
DisposeRgn( visRgn ) ;