]> git.saurik.com Git - wxWidgets.git/commitdiff
clipping before redraw in the setbackground callback
authorStefan Csomor <csomor@advancedconcepts.ch>
Tue, 28 Jan 2003 08:25:53 +0000 (08:25 +0000)
committerStefan Csomor <csomor@advancedconcepts.ch>
Tue, 28 Jan 2003 08:25:53 +0000 (08:25 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@18978 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

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

index 05db0f21668571bd0cdf69829e785553e69f8a6d..9b86af18d14043aee4f4c95a31563230f71ded70 100644 (file)
@@ -115,7 +115,17 @@ pascal OSStatus wxMacSetupControlBackground( ControlRef iControl , SInt16 iMessa
                        if ( wx != NULL && wx->IsKindOf( CLASSINFO( wxControl ) ) )
                        {
                                wxDC::MacSetupBackgroundForCurrentPort( wx->MacGetBackgroundBrush() ) ;
-       //                              SetThemeBackground( iDepth , iIsColor ) ;
+#if TARGET_CARBON
+                                       // under classic this would lead to partial redraws
+                                       RgnHandle clip = NewRgn() ;
+                               int x = 0 , y = 0;
+
+                               wx->MacWindowToRootWindow( &x,&y ) ;
+                               CopyRgn( (RgnHandle) wx->MacGetVisibleRegion(false).GetWXHRGN() , clip ) ;
+                               OffsetRgn( clip , x , y ) ;
+                               SetClip( clip ) ;
+                               DisposeRgn( clip ) ;
+#endif
                                }
                                else
                                {
@@ -594,6 +604,23 @@ void  wxControl::DoSetSize(int x, int y,
             int sizeFlags )
 {
     wxWindow::DoSetSize( x , y ,width , height ,sizeFlags ) ;
+#if 0
+    {
+       Rect meta , control ;
+       GetControlBounds( (ControlHandle) m_macControl , &control ) ;
+       RgnHandle rgn = NewRgn() ;
+       GetControlRegion( (ControlHandle) m_macControl , kControlStructureMetaPart , rgn ) ;
+       GetRegionBounds( rgn , &meta ) ;
+       if ( !EmptyRect( &meta ) )
+       {
+                       wxASSERT( meta.left >= control.left - m_macHorizontalBorder ) ;
+                       wxASSERT( meta.right <= control.right + m_macHorizontalBorder ) ;
+                       wxASSERT( meta.top >= control.top - m_macVerticalBorder ) ;
+                       wxASSERT( meta.bottom <= control.bottom + m_macVerticalBorder ) ;
+               }
+       DisposeRgn( rgn ) ;
+    }
+#endif
     return ;
 /*
 
index 05db0f21668571bd0cdf69829e785553e69f8a6d..9b86af18d14043aee4f4c95a31563230f71ded70 100644 (file)
@@ -115,7 +115,17 @@ pascal OSStatus wxMacSetupControlBackground( ControlRef iControl , SInt16 iMessa
                        if ( wx != NULL && wx->IsKindOf( CLASSINFO( wxControl ) ) )
                        {
                                wxDC::MacSetupBackgroundForCurrentPort( wx->MacGetBackgroundBrush() ) ;
-       //                              SetThemeBackground( iDepth , iIsColor ) ;
+#if TARGET_CARBON
+                                       // under classic this would lead to partial redraws
+                                       RgnHandle clip = NewRgn() ;
+                               int x = 0 , y = 0;
+
+                               wx->MacWindowToRootWindow( &x,&y ) ;
+                               CopyRgn( (RgnHandle) wx->MacGetVisibleRegion(false).GetWXHRGN() , clip ) ;
+                               OffsetRgn( clip , x , y ) ;
+                               SetClip( clip ) ;
+                               DisposeRgn( clip ) ;
+#endif
                                }
                                else
                                {
@@ -594,6 +604,23 @@ void  wxControl::DoSetSize(int x, int y,
             int sizeFlags )
 {
     wxWindow::DoSetSize( x , y ,width , height ,sizeFlags ) ;
+#if 0
+    {
+       Rect meta , control ;
+       GetControlBounds( (ControlHandle) m_macControl , &control ) ;
+       RgnHandle rgn = NewRgn() ;
+       GetControlRegion( (ControlHandle) m_macControl , kControlStructureMetaPart , rgn ) ;
+       GetRegionBounds( rgn , &meta ) ;
+       if ( !EmptyRect( &meta ) )
+       {
+                       wxASSERT( meta.left >= control.left - m_macHorizontalBorder ) ;
+                       wxASSERT( meta.right <= control.right + m_macHorizontalBorder ) ;
+                       wxASSERT( meta.top >= control.top - m_macVerticalBorder ) ;
+                       wxASSERT( meta.bottom <= control.bottom + m_macVerticalBorder ) ;
+               }
+       DisposeRgn( rgn ) ;
+    }
+#endif
     return ;
 /*