expand all / collapse all - fix #448

This commit is contained in:
Vadim Lopatin 2017-09-19 14:20:48 +03:00
parent 047b412e3c
commit f55d72c5a5
1 changed files with 18 additions and 0 deletions

View File

@ -185,6 +185,24 @@ class TreeItem {
void collapse() {
_expanded = false;
}
/// expand this node and all children
void expandAll() {
foreach(c; _children) {
if (!c._expanded && c.canCollapse) //?
c.expandAll();
}
if (!expanded)
toggleExpand(this);
}
/// expand this node and all children
void collapseAll() {
foreach(c; _children) {
if (c._expanded && c.canCollapse)
c.collapseAll();
}
if (expanded)
toggleExpand(this);
}
@property TreeItem selectedItem() {
return root.selectedItem();