From b8f2db1f34fcf92ad8a5cdf5334f2000c9f292f4 Mon Sep 17 00:00:00 2001 From: Stefan Csomor Date: Sun, 4 Aug 2002 08:59:49 +0000 Subject: [PATCH] added border clipping git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@16358 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/mac/carbon/control.cpp | 37 ++++++++++++++++++++++++++++++++----- src/mac/carbon/window.cpp | 7 ++++++- src/mac/control.cpp | 37 ++++++++++++++++++++++++++++++++----- src/mac/window.cpp | 7 ++++++- 4 files changed, 76 insertions(+), 12 deletions(-) diff --git a/src/mac/carbon/control.cpp b/src/mac/carbon/control.cpp index b3049043ee..fc90b8ea04 100644 --- a/src/mac/carbon/control.cpp +++ b/src/mac/carbon/control.cpp @@ -695,13 +695,26 @@ void wxControl::MacRedrawControl() { wxClientDC dc(this) ; wxMacPortSetter helper(&dc) ; - +/* + Rect r = { 0 , 0 , 32000 , 32000 } ; + ClipRect( &r ) ; +*/ int x = 0 , y = 0; - GetParent()->MacWindowToRootWindow( &x,&y ) ; + wxWindow *parent = GetParent() ; + parent->MacWindowToRootWindow( &x,&y ) ; 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 ) ; SetClip( clrgn ) ; + DisposeRgn( clrgn ) ; + DisposeRgn( insidergn ) ; wxDC::MacSetupBackgroundForCurrentPort( MacGetBackgroundBrush() ) ; UMADrawControl( (ControlHandle) m_macControl ) ; @@ -714,13 +727,27 @@ void wxControl::OnPaint(wxPaintEvent& event) { wxPaintDC dc(this) ; wxMacPortSetter helper(&dc) ; +/* + Rect r = { 0 , 0 , 32000 , 32000 } ; + ClipRect( &r ) ; +*/ int x = 0 , y = 0; - GetParent()->MacWindowToRootWindow( &x,&y ) ; + wxWindow *parent = GetParent() ; + parent->MacWindowToRootWindow( &x,&y ) ; 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 ) ; SetClip( clrgn ) ; + DisposeRgn( clrgn ) ; + DisposeRgn( insidergn ) ; wxDC::MacSetupBackgroundForCurrentPort( MacGetBackgroundBrush() ) ; UMADrawControl( (ControlHandle) m_macControl ) ; diff --git a/src/mac/carbon/window.cpp b/src/mac/carbon/window.cpp index 44cd7f0919..471c87c462 100644 --- a/src/mac/carbon/window.cpp +++ b/src/mac/carbon/window.cpp @@ -1569,7 +1569,12 @@ const wxRegion& wxWindowMac::MacGetVisibleRegion( bool respectChildrenAndSibling x = y = 0 ; parent->MacWindowToRootWindow( &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 ) ; if ( parent->IsTopLevel() ) break ; diff --git a/src/mac/control.cpp b/src/mac/control.cpp index b3049043ee..fc90b8ea04 100644 --- a/src/mac/control.cpp +++ b/src/mac/control.cpp @@ -695,13 +695,26 @@ void wxControl::MacRedrawControl() { wxClientDC dc(this) ; wxMacPortSetter helper(&dc) ; - +/* + Rect r = { 0 , 0 , 32000 , 32000 } ; + ClipRect( &r ) ; +*/ int x = 0 , y = 0; - GetParent()->MacWindowToRootWindow( &x,&y ) ; + wxWindow *parent = GetParent() ; + parent->MacWindowToRootWindow( &x,&y ) ; 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 ) ; SetClip( clrgn ) ; + DisposeRgn( clrgn ) ; + DisposeRgn( insidergn ) ; wxDC::MacSetupBackgroundForCurrentPort( MacGetBackgroundBrush() ) ; UMADrawControl( (ControlHandle) m_macControl ) ; @@ -714,13 +727,27 @@ void wxControl::OnPaint(wxPaintEvent& event) { wxPaintDC dc(this) ; wxMacPortSetter helper(&dc) ; +/* + Rect r = { 0 , 0 , 32000 , 32000 } ; + ClipRect( &r ) ; +*/ int x = 0 , y = 0; - GetParent()->MacWindowToRootWindow( &x,&y ) ; + wxWindow *parent = GetParent() ; + parent->MacWindowToRootWindow( &x,&y ) ; 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 ) ; SetClip( clrgn ) ; + DisposeRgn( clrgn ) ; + DisposeRgn( insidergn ) ; wxDC::MacSetupBackgroundForCurrentPort( MacGetBackgroundBrush() ) ; UMADrawControl( (ControlHandle) m_macControl ) ; diff --git a/src/mac/window.cpp b/src/mac/window.cpp index 44cd7f0919..471c87c462 100644 --- a/src/mac/window.cpp +++ b/src/mac/window.cpp @@ -1569,7 +1569,12 @@ const wxRegion& wxWindowMac::MacGetVisibleRegion( bool respectChildrenAndSibling x = y = 0 ; parent->MacWindowToRootWindow( &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 ) ; if ( parent->IsTopLevel() ) break ; -- 2.47.2