From 002c9672c742d419de842c63f0ff20201b375027 Mon Sep 17 00:00:00 2001 From: Stefan Csomor Date: Thu, 27 May 2004 15:09:04 +0000 Subject: [PATCH] scrolling code committed git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@27465 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/mac/carbon/window.cpp | 30 ++++++++++++++++++++++++++---- 1 file changed, 26 insertions(+), 4 deletions(-) diff --git a/src/mac/carbon/window.cpp b/src/mac/carbon/window.cpp index 7669c42d60..62847f962c 100644 --- a/src/mac/carbon/window.cpp +++ b/src/mac/carbon/window.cpp @@ -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 ) -- 2.45.2