added border clipping

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@16358 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Stefan Csomor
2002-08-04 08:59:49 +00:00
parent ef357cdac2
commit b8f2db1f34
4 changed files with 76 additions and 12 deletions

View File

@@ -695,13 +695,26 @@ void wxControl::MacRedrawControl()
{ {
wxClientDC dc(this) ; wxClientDC dc(this) ;
wxMacPortSetter helper(&dc) ; wxMacPortSetter helper(&dc) ;
/*
Rect r = { 0 , 0 , 32000 , 32000 } ;
ClipRect( &r ) ;
*/
int x = 0 , y = 0; int x = 0 , y = 0;
GetParent()->MacWindowToRootWindow( &x,&y ) ; wxWindow *parent = GetParent() ;
parent->MacWindowToRootWindow( &x,&y ) ;
RgnHandle clrgn = NewRgn() ; RgnHandle clrgn = NewRgn() ;
CopyRgn( (RgnHandle) GetParent()->MacGetVisibleRegion().GetWXHRGN() , clrgn ) ; RgnHandle insidergn = NewRgn() ;
wxSize size = parent->GetSize() ;
SetRectRgn( insidergn , parent->MacGetLeftBorderSize() , parent->MacGetTopBorderSize() ,
size.x - parent->MacGetLeftBorderSize() - parent->MacGetRightBorderSize(),
size.y - parent->MacGetTopBorderSize() - parent->MacGetBottomBorderSize()) ;
CopyRgn( (RgnHandle) parent->MacGetVisibleRegion(false).GetWXHRGN() , clrgn ) ;
SectRgn( clrgn , insidergn , clrgn ) ;
OffsetRgn( clrgn , x , y ) ; OffsetRgn( clrgn , x , y ) ;
SetClip( clrgn ) ; SetClip( clrgn ) ;
DisposeRgn( clrgn ) ;
DisposeRgn( insidergn ) ;
wxDC::MacSetupBackgroundForCurrentPort( MacGetBackgroundBrush() ) ; wxDC::MacSetupBackgroundForCurrentPort( MacGetBackgroundBrush() ) ;
UMADrawControl( (ControlHandle) m_macControl ) ; UMADrawControl( (ControlHandle) m_macControl ) ;
@@ -714,13 +727,27 @@ void wxControl::OnPaint(wxPaintEvent& event)
{ {
wxPaintDC dc(this) ; wxPaintDC dc(this) ;
wxMacPortSetter helper(&dc) ; wxMacPortSetter helper(&dc) ;
/*
Rect r = { 0 , 0 , 32000 , 32000 } ;
ClipRect( &r ) ;
*/
int x = 0 , y = 0; int x = 0 , y = 0;
GetParent()->MacWindowToRootWindow( &x,&y ) ; wxWindow *parent = GetParent() ;
parent->MacWindowToRootWindow( &x,&y ) ;
RgnHandle clrgn = NewRgn() ; RgnHandle clrgn = NewRgn() ;
CopyRgn( (RgnHandle) GetParent()->MacGetVisibleRegion().GetWXHRGN() , clrgn ) ; RgnHandle insidergn = NewRgn() ;
wxSize size = parent->GetSize() ;
SetRectRgn( insidergn , parent->MacGetLeftBorderSize() , parent->MacGetTopBorderSize() ,
size.x - parent->MacGetLeftBorderSize() - parent->MacGetRightBorderSize(),
size.y - parent->MacGetTopBorderSize() - parent->MacGetBottomBorderSize()) ;
CopyRgn( (RgnHandle) parent->MacGetVisibleRegion(false).GetWXHRGN() , clrgn ) ;
SectRgn( clrgn , insidergn , clrgn ) ;
OffsetRgn( clrgn , x , y ) ; OffsetRgn( clrgn , x , y ) ;
SetClip( clrgn ) ; SetClip( clrgn ) ;
DisposeRgn( clrgn ) ;
DisposeRgn( insidergn ) ;
wxDC::MacSetupBackgroundForCurrentPort( MacGetBackgroundBrush() ) ; wxDC::MacSetupBackgroundForCurrentPort( MacGetBackgroundBrush() ) ;
UMADrawControl( (ControlHandle) m_macControl ) ; UMADrawControl( (ControlHandle) m_macControl ) ;

View File

@@ -1569,7 +1569,12 @@ const wxRegion& wxWindowMac::MacGetVisibleRegion( bool respectChildrenAndSibling
x = y = 0 ; x = y = 0 ;
parent->MacWindowToRootWindow( &x, &y ) ; parent->MacWindowToRootWindow( &x, &y ) ;
MacRootWindowToWindow( &x , &y ) ; MacRootWindowToWindow( &x , &y ) ;
SetRectRgn( tempRgn , x , y , x + size.x , y + size.y ) ;
SetRectRgn( tempRgn ,
x + parent->MacGetLeftBorderSize() , y + parent->MacGetTopBorderSize() ,
x + size.x - parent->MacGetLeftBorderSize() - parent->MacGetRightBorderSize(),
y + size.y - parent->MacGetTopBorderSize() - parent->MacGetBottomBorderSize()) ;
SectRgn( visRgn , tempRgn , visRgn ) ; SectRgn( visRgn , tempRgn , visRgn ) ;
if ( parent->IsTopLevel() ) if ( parent->IsTopLevel() )
break ; break ;

View File

@@ -695,13 +695,26 @@ void wxControl::MacRedrawControl()
{ {
wxClientDC dc(this) ; wxClientDC dc(this) ;
wxMacPortSetter helper(&dc) ; wxMacPortSetter helper(&dc) ;
/*
Rect r = { 0 , 0 , 32000 , 32000 } ;
ClipRect( &r ) ;
*/
int x = 0 , y = 0; int x = 0 , y = 0;
GetParent()->MacWindowToRootWindow( &x,&y ) ; wxWindow *parent = GetParent() ;
parent->MacWindowToRootWindow( &x,&y ) ;
RgnHandle clrgn = NewRgn() ; RgnHandle clrgn = NewRgn() ;
CopyRgn( (RgnHandle) GetParent()->MacGetVisibleRegion().GetWXHRGN() , clrgn ) ; RgnHandle insidergn = NewRgn() ;
wxSize size = parent->GetSize() ;
SetRectRgn( insidergn , parent->MacGetLeftBorderSize() , parent->MacGetTopBorderSize() ,
size.x - parent->MacGetLeftBorderSize() - parent->MacGetRightBorderSize(),
size.y - parent->MacGetTopBorderSize() - parent->MacGetBottomBorderSize()) ;
CopyRgn( (RgnHandle) parent->MacGetVisibleRegion(false).GetWXHRGN() , clrgn ) ;
SectRgn( clrgn , insidergn , clrgn ) ;
OffsetRgn( clrgn , x , y ) ; OffsetRgn( clrgn , x , y ) ;
SetClip( clrgn ) ; SetClip( clrgn ) ;
DisposeRgn( clrgn ) ;
DisposeRgn( insidergn ) ;
wxDC::MacSetupBackgroundForCurrentPort( MacGetBackgroundBrush() ) ; wxDC::MacSetupBackgroundForCurrentPort( MacGetBackgroundBrush() ) ;
UMADrawControl( (ControlHandle) m_macControl ) ; UMADrawControl( (ControlHandle) m_macControl ) ;
@@ -714,13 +727,27 @@ void wxControl::OnPaint(wxPaintEvent& event)
{ {
wxPaintDC dc(this) ; wxPaintDC dc(this) ;
wxMacPortSetter helper(&dc) ; wxMacPortSetter helper(&dc) ;
/*
Rect r = { 0 , 0 , 32000 , 32000 } ;
ClipRect( &r ) ;
*/
int x = 0 , y = 0; int x = 0 , y = 0;
GetParent()->MacWindowToRootWindow( &x,&y ) ; wxWindow *parent = GetParent() ;
parent->MacWindowToRootWindow( &x,&y ) ;
RgnHandle clrgn = NewRgn() ; RgnHandle clrgn = NewRgn() ;
CopyRgn( (RgnHandle) GetParent()->MacGetVisibleRegion().GetWXHRGN() , clrgn ) ; RgnHandle insidergn = NewRgn() ;
wxSize size = parent->GetSize() ;
SetRectRgn( insidergn , parent->MacGetLeftBorderSize() , parent->MacGetTopBorderSize() ,
size.x - parent->MacGetLeftBorderSize() - parent->MacGetRightBorderSize(),
size.y - parent->MacGetTopBorderSize() - parent->MacGetBottomBorderSize()) ;
CopyRgn( (RgnHandle) parent->MacGetVisibleRegion(false).GetWXHRGN() , clrgn ) ;
SectRgn( clrgn , insidergn , clrgn ) ;
OffsetRgn( clrgn , x , y ) ; OffsetRgn( clrgn , x , y ) ;
SetClip( clrgn ) ; SetClip( clrgn ) ;
DisposeRgn( clrgn ) ;
DisposeRgn( insidergn ) ;
wxDC::MacSetupBackgroundForCurrentPort( MacGetBackgroundBrush() ) ; wxDC::MacSetupBackgroundForCurrentPort( MacGetBackgroundBrush() ) ;
UMADrawControl( (ControlHandle) m_macControl ) ; UMADrawControl( (ControlHandle) m_macControl ) ;

View File

@@ -1569,7 +1569,12 @@ const wxRegion& wxWindowMac::MacGetVisibleRegion( bool respectChildrenAndSibling
x = y = 0 ; x = y = 0 ;
parent->MacWindowToRootWindow( &x, &y ) ; parent->MacWindowToRootWindow( &x, &y ) ;
MacRootWindowToWindow( &x , &y ) ; MacRootWindowToWindow( &x , &y ) ;
SetRectRgn( tempRgn , x , y , x + size.x , y + size.y ) ;
SetRectRgn( tempRgn ,
x + parent->MacGetLeftBorderSize() , y + parent->MacGetTopBorderSize() ,
x + size.x - parent->MacGetLeftBorderSize() - parent->MacGetRightBorderSize(),
y + size.y - parent->MacGetTopBorderSize() - parent->MacGetBottomBorderSize()) ;
SectRgn( visRgn , tempRgn , visRgn ) ; SectRgn( visRgn , tempRgn , visRgn ) ;
if ( parent->IsTopLevel() ) if ( parent->IsTopLevel() )
break ; break ;