added wxTreeCtrl::CollapseAll[Children]() and IsEmpty() methods; documented wxTreeItemId (patch 1622125)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@44116 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2007-01-07 15:02:57 +00:00
parent 633f0196de
commit 9248adc8da
4 changed files with 126 additions and 2 deletions

View File

@@ -183,6 +183,9 @@ wxSize wxTreeCtrlBase::DoGetBestSize() const
void wxTreeCtrlBase::ExpandAll()
{
if ( IsEmpty() )
return;
ExpandAllChildren(GetRootItem());
}
@@ -202,5 +205,33 @@ void wxTreeCtrlBase::ExpandAllChildren(const wxTreeItemId& item)
}
}
void wxTreeCtrlBase::CollapseAll()
{
if ( IsEmpty() )
return;
CollapseAllChildren(GetRootItem());
}
void wxTreeCtrlBase::CollapseAllChildren(const wxTreeItemId& item)
{
// first (recursively) collapse all the children
wxTreeItemIdValue cookie;
for ( wxTreeItemId idCurr = GetFirstChild(item, cookie);
idCurr.IsOk();
idCurr = GetNextChild(item, cookie) )
{
CollapseAllChildren(idCurr);
}
// then collapse this element too
Collapse(item);
}
bool wxTreeCtrlBase::IsEmpty() const
{
return !GetRootItem().IsOk();
}
#endif // wxUSE_TREECTRL