optimizing scrolling
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_8_BRANCH@50130 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -2269,9 +2269,18 @@ void wxMacDataItemBrowserControl::MacScrollTo( unsigned int n )
|
|||||||
GetScrollPosition( &top , &left ) ;
|
GetScrollPosition( &top , &left ) ;
|
||||||
wxMacDataItem * item = (wxMacDataItem*) GetItemFromLine( n );
|
wxMacDataItem * item = (wxMacDataItem*) GetItemFromLine( n );
|
||||||
|
|
||||||
|
// there is a bug in RevealItem that leads to situations
|
||||||
|
// in large lists, where the item does not get scrolled
|
||||||
|
// into sight, so we do a pre-scroll if necessary
|
||||||
UInt16 height ;
|
UInt16 height ;
|
||||||
GetRowHeight( (DataBrowserItemID) item , &height ) ;
|
GetRowHeight( (DataBrowserItemID) item , &height ) ;
|
||||||
SetScrollPosition( n * ((UInt32)height) , left ) ;
|
UInt32 linetop = n * ((UInt32) height );
|
||||||
|
UInt32 linebottom = linetop + height;
|
||||||
|
Rect rect ;
|
||||||
|
GetRect( &rect );
|
||||||
|
|
||||||
|
if ( linetop < top || linebottom > (top + rect.bottom - rect.top ) )
|
||||||
|
SetScrollPosition( wxMax( n-2, 0 ) * ((UInt32)height) , left ) ;
|
||||||
|
|
||||||
RevealItem( item , kDataBrowserRevealWithoutSelecting );
|
RevealItem( item , kDataBrowserRevealWithoutSelecting );
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user