IsVisible() shouldn't return true if item is out of screen (bug 640607)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@23780 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -1336,8 +1336,18 @@ bool wxTreeCtrl::IsVisible(const wxTreeItemId& item) const
|
|||||||
// the HTREEITEM with TVM_GETITEMRECT
|
// the HTREEITEM with TVM_GETITEMRECT
|
||||||
*(HTREEITEM *)&rect = HITEM(item);
|
*(HTREEITEM *)&rect = HITEM(item);
|
||||||
|
|
||||||
// false means get item rect for the whole item, not only text
|
// true means to get rect for just the text, not the whole line
|
||||||
return SendMessage(GetHwnd(), TVM_GETITEMRECT, false, (LPARAM)&rect) != 0;
|
if ( !::SendMessage(GetHwnd(), TVM_GETITEMRECT, true, (LPARAM)&rect) )
|
||||||
|
{
|
||||||
|
// if TVM_GETITEMRECT returned false, then the item is definitely not
|
||||||
|
// visible (because its parent is not expanded)
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// however if it returned true, the item might still be outside the
|
||||||
|
// currently visible part of the tree, test for it (notice that partly
|
||||||
|
// visible means visible here)
|
||||||
|
return rect.bottom > 0 && rect.top < GetClientSize().y;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxTreeCtrl::ItemHasChildren(const wxTreeItemId& item) const
|
bool wxTreeCtrl::ItemHasChildren(const wxTreeItemId& item) const
|
||||||
|
Reference in New Issue
Block a user