private PackageExportTreeView.EnabledState GetFolderChildrenEnabledState(PackageExportTreeView.PackageExportTreeViewItem folder)
 {
     if (!folder.isFolder)
     {
         Debug.LogError("Should be a folder item!");
     }
     PackageExportTreeView.EnabledState result;
     if (!folder.hasChildren)
     {
         result = PackageExportTreeView.EnabledState.None;
     }
     else
     {
         PackageExportTreeView.EnabledState enabledState = PackageExportTreeView.EnabledState.NotSet;
         PackageExportTreeView.PackageExportTreeViewItem packageExportTreeViewItem = folder.children[0] as PackageExportTreeView.PackageExportTreeViewItem;
         PackageExportTreeView.EnabledState enabledState2 = packageExportTreeViewItem.enabledState;
         for (int i = 1; i < folder.children.Count; i++)
         {
             PackageExportTreeView.PackageExportTreeViewItem packageExportTreeViewItem2 = folder.children[i] as PackageExportTreeView.PackageExportTreeViewItem;
             if (enabledState2 != packageExportTreeViewItem2.enabledState)
             {
                 enabledState = PackageExportTreeView.EnabledState.Mixed;
                 break;
             }
         }
         if (enabledState == PackageExportTreeView.EnabledState.NotSet)
         {
             enabledState = ((enabledState2 != PackageExportTreeView.EnabledState.All) ? PackageExportTreeView.EnabledState.None : PackageExportTreeView.EnabledState.All);
         }
         result = enabledState;
     }
     return(result);
 }
Exemplo n.º 2
0
 private PackageExportTreeView.EnabledState GetFolderChildrenEnabledState(PackageExportTreeView.PackageExportTreeViewItem folder)
 {
     if (!folder.isFolder)
     {
         Debug.LogError((object)"Should be a folder item!");
     }
     if (!folder.hasChildren)
     {
         return(PackageExportTreeView.EnabledState.None);
     }
     PackageExportTreeView.EnabledState enabledState1 = PackageExportTreeView.EnabledState.NotSet;
     PackageExportTreeView.EnabledState enabledState2 = (folder.children[0] as PackageExportTreeView.PackageExportTreeViewItem).enabledState;
     for (int index = 1; index < folder.children.Count; ++index)
     {
         PackageExportTreeView.PackageExportTreeViewItem child = folder.children[index] as PackageExportTreeView.PackageExportTreeViewItem;
         if (enabledState2 != child.enabledState)
         {
             enabledState1 = PackageExportTreeView.EnabledState.Mixed;
             break;
         }
     }
     if (enabledState1 == PackageExportTreeView.EnabledState.NotSet)
     {
         enabledState1 = enabledState2 != PackageExportTreeView.EnabledState.All ? PackageExportTreeView.EnabledState.None : PackageExportTreeView.EnabledState.All;
     }
     return(enabledState1);
 }
 private void RecursiveComputeEnabledStateForFolders(PackageExportTreeView.PackageExportTreeViewItem pitem, HashSet <PackageExportTreeView.PackageExportTreeViewItem> done)
 {
     if (pitem.isFolder)
     {
         if (pitem.hasChildren)
         {
             foreach (TreeViewItem current in pitem.children)
             {
                 this.RecursiveComputeEnabledStateForFolders(current as PackageExportTreeView.PackageExportTreeViewItem, done);
             }
         }
         if (!done.Contains(pitem))
         {
             PackageExportTreeView.EnabledState folderChildrenEnabledState = this.GetFolderChildrenEnabledState(pitem);
             pitem.enabledState = folderChildrenEnabledState;
             if (folderChildrenEnabledState == PackageExportTreeView.EnabledState.Mixed)
             {
                 done.Add(pitem);
                 for (PackageExportTreeView.PackageExportTreeViewItem packageExportTreeViewItem = pitem.parent as PackageExportTreeView.PackageExportTreeViewItem; packageExportTreeViewItem != null; packageExportTreeViewItem = (packageExportTreeViewItem.parent as PackageExportTreeView.PackageExportTreeViewItem))
                 {
                     if (!done.Contains(packageExportTreeViewItem))
                     {
                         packageExportTreeViewItem.enabledState = PackageExportTreeView.EnabledState.Mixed;
                         done.Add(packageExportTreeViewItem);
                     }
                 }
             }
         }
     }
 }
        private PackageExportTreeView.EnabledState GetFolderChildrenEnabledState(PackageExportTreeView.PackageExportTreeViewItem folder)
        {
            ExportPackageItem item = folder.item;

            if (item != null && !item.isFolder)
            {
                Debug.LogError("Should be a folder item!");
            }
            if (!folder.hasChildren)
            {
                return(PackageExportTreeView.EnabledState.None);
            }
            PackageExportTreeView.EnabledState enabledState = PackageExportTreeView.EnabledState.NotSet;
            PackageExportTreeView.PackageExportTreeViewItem packageExportTreeViewItem = folder.children[0] as PackageExportTreeView.PackageExportTreeViewItem;
            ExportPackageItem item2 = packageExportTreeViewItem.item;
            int num = (item2 != null) ? item2.enabledStatus : 1;

            for (int i = 1; i < folder.children.Count; i++)
            {
                item2 = (folder.children[i] as PackageExportTreeView.PackageExportTreeViewItem).item;
                if (num != item2.enabledStatus)
                {
                    enabledState = PackageExportTreeView.EnabledState.Mixed;
                    break;
                }
            }
            if (enabledState == PackageExportTreeView.EnabledState.NotSet)
            {
                enabledState = ((num != 1) ? PackageExportTreeView.EnabledState.None : PackageExportTreeView.EnabledState.All);
            }
            return(enabledState);
        }
 private void EnableChildrenRecursive(TreeViewItem parentItem, PackageExportTreeView.EnabledState enabled)
 {
     if (parentItem.hasChildren)
     {
         foreach (TreeViewItem current in parentItem.children)
         {
             PackageExportTreeView.PackageExportTreeViewItem packageExportTreeViewItem = current as PackageExportTreeView.PackageExportTreeViewItem;
             packageExportTreeViewItem.enabledState = enabled;
             this.EnableChildrenRecursive(packageExportTreeViewItem, enabled);
         }
     }
 }
        public void OnGUI(Rect rect)
        {
            int controlID = GUIUtility.GetControlID(FocusType.Keyboard);

            this.m_TreeView.OnGUI(rect, controlID);
            if (Event.current.type == EventType.KeyDown && Event.current.keyCode == KeyCode.Space && this.m_Selection != null && this.m_Selection.Count > 0 && GUIUtility.keyboardControl == controlID)
            {
                PackageExportTreeView.EnabledState enabledState = (this.m_Selection[0].enabledState == PackageExportTreeView.EnabledState.All) ? PackageExportTreeView.EnabledState.None : PackageExportTreeView.EnabledState.All;
                this.m_Selection[0].enabledState = enabledState;
                this.ItemWasToggled(this.m_Selection[0]);
                Event.current.Use();
            }
        }
Exemplo n.º 7
0
 private void EnableChildrenRecursive(TreeViewItem parentItem, PackageExportTreeView.EnabledState enabled)
 {
     if (!parentItem.hasChildren)
     {
         return;
     }
     using (List <TreeViewItem> .Enumerator enumerator = parentItem.children.GetEnumerator())
     {
         while (enumerator.MoveNext())
         {
             PackageExportTreeView.PackageExportTreeViewItem current = enumerator.Current as PackageExportTreeView.PackageExportTreeViewItem;
             current.enabledState = enabled;
             this.EnableChildrenRecursive((TreeViewItem)current, enabled);
         }
     }
 }
Exemplo n.º 8
0
 private void RecursiveComputeEnabledStateForFolders(PackageExportTreeView.PackageExportTreeViewItem pitem, HashSet <PackageExportTreeView.PackageExportTreeViewItem> done)
 {
     if (!pitem.isFolder)
     {
         return;
     }
     if (pitem.hasChildren)
     {
         using (List <TreeViewItem> .Enumerator enumerator = pitem.children.GetEnumerator())
         {
             while (enumerator.MoveNext())
             {
                 this.RecursiveComputeEnabledStateForFolders(enumerator.Current as PackageExportTreeView.PackageExportTreeViewItem, done);
             }
         }
     }
     if (done.Contains(pitem))
     {
         return;
     }
     PackageExportTreeView.EnabledState childrenEnabledState = this.GetFolderChildrenEnabledState(pitem);
     pitem.enabledState = childrenEnabledState;
     if (childrenEnabledState != PackageExportTreeView.EnabledState.Mixed)
     {
         return;
     }
     done.Add(pitem);
     for (PackageExportTreeView.PackageExportTreeViewItem parent = pitem.parent as PackageExportTreeView.PackageExportTreeViewItem; parent != null; parent = parent.parent as PackageExportTreeView.PackageExportTreeViewItem)
     {
         if (!done.Contains(parent))
         {
             parent.enabledState = PackageExportTreeView.EnabledState.Mixed;
             done.Add(parent);
         }
     }
 }
Exemplo n.º 9
0
 public void SetAllEnabled(PackageExportTreeView.EnabledState enabled)
 {
     this.EnableChildrenRecursive(this.m_TreeView.data.root, enabled);
     this.ComputeEnabledStateForFolders();
 }
 public PackageExportTreeViewItem(ExportPackageItem itemIn, int id, int depth, TreeViewItem parent, string displayName) : base(id, depth, parent, displayName)
 {
     this.m_EnabledState = PackageExportTreeView.EnabledState.NotSet;
     this.item           = itemIn;
 }
 public PackageExportTreeViewItem(ExportPackageItem itemIn, int id, int depth, TreeViewItem parent, string displayName) : base(id, depth, parent, displayName)
 {
     this.m_EnabledState = PackageExportTreeView.EnabledState.NotSet;
     this.item = itemIn;
 }