]> git.saurik.com Git - wxWidgets.git/commitdiff
scrolling code committed
authorStefan Csomor <csomor@advancedconcepts.ch>
Thu, 27 May 2004 15:09:04 +0000 (15:09 +0000)
committerStefan Csomor <csomor@advancedconcepts.ch>
Thu, 27 May 2004 15:09:04 +0000 (15:09 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@27465 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/mac/carbon/window.cpp

index 7669c42d6023e052b75651afd0703fc0df654f61..62847f962c3177db3c4127f9a8abc830205965c7 100644 (file)
@@ -1856,6 +1856,13 @@ bool wxWindowMac::MacIsReallyHilited()
     return IsControlActive( (ControlRef) m_macControl ) ;
 }
 
+void wxWindowMac::MacFlashInvalidAreas() 
+{
+#if TARGET_API_MAC_OSX
+    HIViewFlashDirtyArea( (WindowRef) MacGetTopLevelWindowRef() ) ;
+#endif
+}
+
 //
 //
 //
@@ -2278,12 +2285,30 @@ void wxWindowMac::ScrollWindow(int dx, int dy, const wxRect *rect)
         int width , height ;
         GetClientSize( &width , &height ) ;
 #if TARGET_API_MAC_OSX
-        HIRect scrollrect = CGRectMake( MacGetLeftBorderSize() , MacGetTopBorderSize() , width , height ) ;
+        // note there currently is a bug in OSX which makes inefficient refreshes in case an entire control
+        // area is scrolled, this does not occur if width and height are 2 pixels less, 
+        // TODO write optimal workaround
+        HIRect scrollrect = CGRectMake( MacGetLeftBorderSize() , MacGetTopBorderSize() , width , height ) ;       
         if ( rect ) 
         {
             HIRect scrollarea = CGRectMake( rect->x , rect->y , rect->width , rect->height) ;
             scrollrect = CGRectIntersection( scrollrect , scrollarea ) ;
         }
+        if ( HIViewGetNeedsDisplay( (ControlRef) m_macControl ) )
+        {
+            // becuase HIViewScrollRect does not scroll the already invalidated area we have two options
+            // either immediate redraw or full invalidate
+#if 1
+            // is the better overall solution, as it does not slow down scrolling
+            HIViewSetNeedsDisplay( (ControlRef) m_macControl , true ) ;
+#else
+            // this would be the preferred version for fast drawing controls       
+            if( UMAGetSystemVersion() < 0x1030 )
+                Update() ;
+            else
+                HIViewRender((ControlRef) m_macControl) ;
+#endif
+        }
         HIViewScrollRect ( (ControlRef) m_macControl , &scrollrect , dx ,dy ) ;
 #else
 
@@ -2337,9 +2362,6 @@ void wxWindowMac::ScrollWindow(int dx, int dy, const wxRect *rect)
             child->SetSize( x+dx, y+dy, w, h );                
         }        
     }
-    
-// TODO remove, was moved higher up    Update() ;
-
 }
 
 void wxWindowMac::MacOnScroll(wxScrollEvent &event )