]> git.saurik.com Git - wxWidgets.git/commitdiff
added border clipping
authorStefan Csomor <csomor@advancedconcepts.ch>
Sun, 4 Aug 2002 08:59:49 +0000 (08:59 +0000)
committerStefan Csomor <csomor@advancedconcepts.ch>
Sun, 4 Aug 2002 08:59:49 +0000 (08:59 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@16358 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/mac/carbon/control.cpp
src/mac/carbon/window.cpp
src/mac/control.cpp
src/mac/window.cpp

index b3049043ee08532ae33f9ad624f08438b8aef587..fc90b8ea04ce697de35e424fc7a1f16ecafd05ec 100644 (file)
@@ -695,13 +695,26 @@ void wxControl::MacRedrawControl()
     {
         wxClientDC dc(this) ;
         wxMacPortSetter helper(&dc) ;
     {
         wxClientDC dc(this) ;
         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 ) ;
         SetClip( clrgn ) ;
         OffsetRgn( clrgn , x , y ) ;
         SetClip( clrgn ) ;
+               DisposeRgn( clrgn ) ;
+               DisposeRgn( insidergn ) ;
 
         wxDC::MacSetupBackgroundForCurrentPort( MacGetBackgroundBrush() ) ;
         UMADrawControl( (ControlHandle) m_macControl ) ;
 
         wxDC::MacSetupBackgroundForCurrentPort( MacGetBackgroundBrush() ) ;
         UMADrawControl( (ControlHandle) m_macControl ) ;
@@ -714,13 +727,27 @@ void wxControl::OnPaint(wxPaintEvent& event)
     {
         wxPaintDC dc(this) ;
         wxMacPortSetter helper(&dc) ;
     {
         wxPaintDC dc(this) ;
         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 ) ;
         SetClip( clrgn ) ;
         OffsetRgn( clrgn , x , y ) ;
         SetClip( clrgn ) ;
+               DisposeRgn( clrgn ) ;
+               DisposeRgn( insidergn ) ;
 
         wxDC::MacSetupBackgroundForCurrentPort( MacGetBackgroundBrush() ) ;
         UMADrawControl( (ControlHandle) m_macControl ) ;
 
         wxDC::MacSetupBackgroundForCurrentPort( MacGetBackgroundBrush() ) ;
         UMADrawControl( (ControlHandle) m_macControl ) ;
index 44cd7f0919b501beadcb4f6c26e0f1be64ad6e99..471c87c4623b2e74904083fb5b80de21464e094f 100644 (file)
@@ -1569,7 +1569,12 @@ const wxRegion& wxWindowMac::MacGetVisibleRegion( bool respectChildrenAndSibling
       x = y = 0 ;
       parent->MacWindowToRootWindow( &x, &y ) ;
       MacRootWindowToWindow( &x , &y ) ;
       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 ;
       SectRgn( visRgn , tempRgn , visRgn ) ;
       if ( parent->IsTopLevel() )
         break ;
index b3049043ee08532ae33f9ad624f08438b8aef587..fc90b8ea04ce697de35e424fc7a1f16ecafd05ec 100644 (file)
@@ -695,13 +695,26 @@ void wxControl::MacRedrawControl()
     {
         wxClientDC dc(this) ;
         wxMacPortSetter helper(&dc) ;
     {
         wxClientDC dc(this) ;
         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 ) ;
         SetClip( clrgn ) ;
         OffsetRgn( clrgn , x , y ) ;
         SetClip( clrgn ) ;
+               DisposeRgn( clrgn ) ;
+               DisposeRgn( insidergn ) ;
 
         wxDC::MacSetupBackgroundForCurrentPort( MacGetBackgroundBrush() ) ;
         UMADrawControl( (ControlHandle) m_macControl ) ;
 
         wxDC::MacSetupBackgroundForCurrentPort( MacGetBackgroundBrush() ) ;
         UMADrawControl( (ControlHandle) m_macControl ) ;
@@ -714,13 +727,27 @@ void wxControl::OnPaint(wxPaintEvent& event)
     {
         wxPaintDC dc(this) ;
         wxMacPortSetter helper(&dc) ;
     {
         wxPaintDC dc(this) ;
         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 ) ;
         SetClip( clrgn ) ;
         OffsetRgn( clrgn , x , y ) ;
         SetClip( clrgn ) ;
+               DisposeRgn( clrgn ) ;
+               DisposeRgn( insidergn ) ;
 
         wxDC::MacSetupBackgroundForCurrentPort( MacGetBackgroundBrush() ) ;
         UMADrawControl( (ControlHandle) m_macControl ) ;
 
         wxDC::MacSetupBackgroundForCurrentPort( MacGetBackgroundBrush() ) ;
         UMADrawControl( (ControlHandle) m_macControl ) ;
index 44cd7f0919b501beadcb4f6c26e0f1be64ad6e99..471c87c4623b2e74904083fb5b80de21464e094f 100644 (file)
@@ -1569,7 +1569,12 @@ const wxRegion& wxWindowMac::MacGetVisibleRegion( bool respectChildrenAndSibling
       x = y = 0 ;
       parent->MacWindowToRootWindow( &x, &y ) ;
       MacRootWindowToWindow( &x , &y ) ;
       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 ;
       SectRgn( visRgn , tempRgn , visRgn ) ;
       if ( parent->IsTopLevel() )
         break ;