virtual public void SetExpandedWithChildren(TreeViewItem fromItem, bool expand) { if (fromItem == null) { Debug.LogError("item is null"); return; } HashSet <int> parents = new HashSet <int>(); TreeViewUtility.GetParentsBelowItem(fromItem, parents); // Get existing expanded in hashset HashSet <int> oldExpandedSet = new HashSet <int>(expandedIDs); if (expand) { oldExpandedSet.UnionWith(parents); } else { oldExpandedSet.ExceptWith(parents); } // Bulk set expanded ids (is sorted in SetExpandedIDs) SetExpandedIDs(oldExpandedSet.ToArray()); }
// Used to expand children recursively below an item protected virtual IList <int> GetDescendantsThatHaveChildren(int id) { // Default behavior assumes complete tree HashSet <int> parentsBelow = new HashSet <int>(); TreeViewUtility.GetParentsBelowItem(FindItem(id), parentsBelow); return(parentsBelow.ToArray()); }
public virtual void SetExpandedWithChildren(TreeViewItem fromItem, bool expand) { if (fromItem == null) { Debug.LogError("item is null"); } else { HashSet <int> parentsBelowItem = TreeViewUtility.GetParentsBelowItem(fromItem); HashSet <int> hashSet = new HashSet <int>(this.expandedIDs); if (expand) { hashSet.UnionWith(parentsBelowItem); } else { hashSet.ExceptWith(parentsBelowItem); } this.SetExpandedIDs(hashSet.ToArray <int>()); } }
protected virtual IList <int> GetDescendantsThatHaveChildren(int id) { return(TreeViewUtility.GetParentsBelowItem(this.FindItem(id)).ToList <int>()); }
// Used to expand children recursively below an item protected virtual IList <int> GetDescendantsThatHaveChildren(int id) { // Default behavior assumes complete tree return(TreeViewUtility.GetParentsBelowItem(FindItem(id)).ToList()); }