fixing incorrect scrolling - which happened at least under OSX ...

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@72509 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Stefan Csomor 2012-09-19 08:18:15 +00:00
parent 4d1c7a9160
commit 60cccf23da

View File

@ -2267,11 +2267,16 @@ void wxGenericTreeCtrl::ScrollTo(const wxTreeItemId &item)
// update the control before scrolling it // update the control before scrolling it
if (m_dirty) if (m_dirty)
#if defined( __WXMSW__ ) || defined(__WXMAC__) {
#if defined( __WXMSW__ )
Update(); Update();
#elif defined(__WXMAC__)
Update();
DoDirtyProcessing();
#else #else
DoDirtyProcessing(); DoDirtyProcessing();
#endif #endif
}
wxGenericTreeItem *gitem = (wxGenericTreeItem*) item.m_pItem; wxGenericTreeItem *gitem = (wxGenericTreeItem*) item.m_pItem;
@ -2289,6 +2294,12 @@ void wxGenericTreeCtrl::ScrollTo(const wxTreeItemId &item)
{ {
// need to scroll up by enough to show this item fully // need to scroll up by enough to show this item fully
itemY += itemHeight - clientHeight; itemY += itemHeight - clientHeight;
#ifdef __WXOSX__
// because itemY below will be divided by PIXELS_PER_UNIT it may
// be rounded down, with the result of the item still only being
// partially visible, so make sure we are rounding up
itemY += PIXELS_PER_UNIT-1;
#endif
} }
else if ( itemY > start_y*PIXELS_PER_UNIT ) else if ( itemY > start_y*PIXELS_PER_UNIT )
{ {