From adb8a71bbc0ba11aad0b417db24f7267a250b6c3 Mon Sep 17 00:00:00 2001 From: Stefan Csomor Date: Mon, 24 May 2004 06:29:02 +0000 Subject: [PATCH] overseeing the obvious, there is already a perfect scroll call for HIView... git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@27409 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/mac/carbon/window.cpp | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/src/mac/carbon/window.cpp b/src/mac/carbon/window.cpp index 528f9f4f7c..7669c42d60 100644 --- a/src/mac/carbon/window.cpp +++ b/src/mac/carbon/window.cpp @@ -2274,8 +2274,18 @@ 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 ) ; + if ( rect ) + { + HIRect scrollarea = CGRectMake( rect->x , rect->y , rect->width , rect->height) ; + scrollrect = CGRectIntersection( scrollrect , scrollarea ) ; + } + HIViewScrollRect ( (ControlRef) m_macControl , &scrollrect , dx ,dy ) ; +#else wxPoint pos; pos.x = pos.y = 0; @@ -2283,20 +2293,11 @@ void wxWindowMac::ScrollWindow(int dx, int dy, const wxRect *rect) Rect scrollrect; RgnHandle updateRgn = NewRgn() ; -#if TARGET_API_MAC_OSX - // if there is already a pending redraw event, we first must flush that, as we don't have - // means to retrieve the dirty region of a HIView - if ( HIViewGetNeedsDisplay( (ControlRef) m_macControl ) ) - Update() ; -#endif - { + { wxClientDC dc(this) ; wxMacPortSetter helper(&dc) ; GetControlBounds( (ControlRef) m_macControl, &scrollrect); -#if TARGET_API_MAC_OSX - GetParent()->MacWindowToRootWindow( &scrollrect.left , &scrollrect.top ) ; -#endif scrollrect.top += MacGetTopBorderSize() ; scrollrect.left += MacGetLeftBorderSize() ; scrollrect.bottom = scrollrect.top + height ; @@ -2311,11 +2312,6 @@ void wxWindowMac::ScrollWindow(int dx, int dy, const wxRect *rect) ScrollRect( &scrollrect , dx , dy , updateRgn ) ; } // ScrollWindowRect( (WindowRef) MacGetTopLevelWindowRef() , &scrollrect , dx , dy , kScrollWindowInvalidate, updateRgn ) ; -#if TARGET_API_MAC_OSX - HIViewConvertRegion( updateRgn , (ControlRef) MacGetTopLevelWindow()->GetHandle() , (ControlRef) m_macControl ) ; - HIViewSetNeedsDisplayInRegion( (ControlRef) m_macControl , updateRgn , true ) ; -#else - // TODO TEST #endif } -- 2.45.2