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:
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user