Don't consider hidden root item to be visible in wxGenericTreeCtrl.

This fixes wrong results returned by GetFirstVisibleItem() in the tree control
with wxTR_HIDE_ROOT style.

Closes #4482.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@76942 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin 2014-07-16 22:55:11 +00:00
parent c3ba472abb
commit c4691daac7

View File

@ -1315,6 +1315,10 @@ bool wxGenericTreeCtrl::IsVisible(const wxTreeItemId& item) const
{
wxCHECK_MSG( item.IsOk(), false, wxT("invalid tree item") );
// Hidden root item is never visible.
if ( item == GetRootItem() && HasFlag(wxTR_HIDE_ROOT) )
return false;
// An item is only visible if it's not a descendant of a collapsed item
wxGenericTreeItem *pItem = (wxGenericTreeItem*) item.m_pItem;
wxGenericTreeItem* parent = pItem->GetParent();