コード例 #1
0
        protected override HashSet <int> GetParentsAbove(int id)
        {
            HashSet <int> hashSet = new HashSet <int>();

            for (BackendData.Foo foo = BackendData.FindItemRecursive(this.m_Backend.root, id); foo != null; foo = foo.parent)
            {
                if (foo.parent != null)
                {
                    hashSet.Add(foo.parent.id);
                }
            }
            return(hashSet);
        }
コード例 #2
0
        protected override void GetParentsAbove(int id, HashSet <int> parentsAbove)
        {
            BackendData.Foo target = BackendData.FindItemRecursive(m_Backend.root, id);

            while (target != null)
            {
                if (target.parent != null)
                {
                    parentsAbove.Add(target.parent.id);
                }
                target = target.parent;
            }
        }
コード例 #3
0
        public TreeViewTestWithCustomHeight(EditorWindow editorWindow, BackendData backendData, Rect rect)
        {
            this.m_BackendData = backendData;
            TreeViewState treeViewState = new TreeViewState();

            this.m_TreeView = new TreeViewController(editorWindow, treeViewState);
            TestGUICustomItemHeights gui      = new TestGUICustomItemHeights(this.m_TreeView);
            TestDragging             dragging = new TestDragging(this.m_TreeView, this.m_BackendData);
            TestDataSource           data     = new TestDataSource(this.m_TreeView, this.m_BackendData);

            data.onVisibleRowsChanged = (System.Action)Delegate.Combine(data.onVisibleRowsChanged, new System.Action(gui.CalculateRowRects));
            this.m_TreeView.Init(rect, data, gui, dragging);
            data.SetExpanded(data.root, true);
        }
コード例 #4
0
        void TestTreeWithCustomItemHeights()
        {
            Rect rect = new Rect(0, 0, position.width, position.height);

            if (m_TreeViewWithCustomHeight == null)
            {
                m_BackendData2 = new BackendData();
                m_BackendData2.GenerateData(300);

                m_TreeViewWithCustomHeight = new TreeViewTestWithCustomHeight(this, m_BackendData2, rect);
            }

            m_TreeViewWithCustomHeight.OnGUI(rect);
        }
コード例 #5
0
        public TreeViewTestWithCustomHeight(EditorWindow editorWindow, BackendData backendData, Rect rect)
        {
            this.m_BackendData = backendData;
            TreeViewState treeViewState = new TreeViewState();

            this.m_TreeView = new TreeViewController(editorWindow, treeViewState);
            TestGUICustomItemHeights testGUICustomItemHeights = new TestGUICustomItemHeights(this.m_TreeView);
            TestDragging             dragging       = new TestDragging(this.m_TreeView, this.m_BackendData);
            TestDataSource           testDataSource = new TestDataSource(this.m_TreeView, this.m_BackendData);
            TestDataSource           expr_52        = testDataSource;

            expr_52.onVisibleRowsChanged = (Action)Delegate.Combine(expr_52.onVisibleRowsChanged, new Action(testGUICustomItemHeights.CalculateRowRects));
            this.m_TreeView.Init(rect, testDataSource, testGUICustomItemHeights, dragging);
            testDataSource.SetExpanded(testDataSource.root, true);
        }
コード例 #6
0
        public TreeViewTestWithCustomHeight(EditorWindow editorWindow, BackendData backendData, Rect rect)
        {
            m_BackendData = backendData;

            var state = new TreeViewState();

            m_TreeView = new TreeViewController(editorWindow, state);
            var gui        = new TestGUICustomItemHeights(m_TreeView);
            var dragging   = new TestDragging(m_TreeView, m_BackendData);
            var dataSource = new TestDataSource(m_TreeView, m_BackendData);

            dataSource.onVisibleRowsChanged += gui.CalculateRowRects;
            m_TreeView.Init(rect, dataSource, gui, dragging);
            dataSource.SetExpanded(dataSource.root, true);
        }
コード例 #7
0
        protected override HashSet <int> GetParentsAbove(int id)
        {
            HashSet <int> parentsAbove = new HashSet <int>();

            BackendData.Foo target = BackendData.FindItemRecursive(m_Backend.root, id);

            while (target != null)
            {
                if (target.parent != null)
                {
                    parentsAbove.Add(target.parent.id);
                }
                target = target.parent;
            }
            return(parentsAbove);
        }
コード例 #8
0
        private void TestLargeTreesWithFixedItemHeightAndPingingAndFraming()
        {
            Rect rect  = new Rect(0f, 0f, base.position.width / 2f, base.position.height);
            Rect rect4 = new Rect(base.position.width / 2f, 0f, base.position.width / 2f, base.position.height);

            if (this.m_TreeViewTest == null)
            {
                this.m_BackendData = new BackendData();
                this.m_BackendData.GenerateData(0xf4240);
                bool lazy = false;
                this.m_TreeViewTest = new TreeViewTest(this, lazy);
                this.m_TreeViewTest.Init(rect, this.m_BackendData);
                lazy = true;
                this.m_TreeViewTest2 = new TreeViewTest(this, lazy);
                this.m_TreeViewTest2.Init(rect4, this.m_BackendData);
            }
            this.m_TreeViewTest.OnGUI(rect);
            this.m_TreeViewTest2.OnGUI(rect4);
            EditorGUI.DrawRect(new Rect(rect.xMax - 1f, 0f, 2f, base.position.height), new Color(0.4f, 0.4f, 0.4f, 0.8f));
        }
コード例 #9
0
        public HashSet <int> GetParentsBelow(int id)
        {
            BackendData.Foo foo = BackendData.FindItemRecursive(this.root, id);
            HashSet <int>   result;

            if (foo != null)
            {
                if (this.m_RecursiveFindParentsBelow)
                {
                    result = this.GetParentsBelowRecursive(foo);
                }
                else
                {
                    result = this.GetParentsBelowStackBased(foo);
                }
            }
            else
            {
                result = new HashSet <int>();
            }
            return(result);
        }
コード例 #10
0
        void TestLargeTreesWithFixedItemHeightAndPingingAndFraming()
        {
            Rect leftRect  = new Rect(0, 0, position.width / 2, position.height);
            Rect rightRect = new Rect(position.width / 2, 0, position.width / 2, position.height);

            if (m_TreeViewTest == null)
            {
                m_BackendData = new BackendData();
                m_BackendData.GenerateData(1000000);

                bool lazy = false;
                m_TreeViewTest = new TreeViewTest(this, lazy);
                m_TreeViewTest.Init(leftRect, m_BackendData);

                lazy            = true;
                m_TreeViewTest2 = new TreeViewTest(this, lazy);
                m_TreeViewTest2.Init(rightRect, m_BackendData);
            }

            m_TreeViewTest.OnGUI(leftRect);
            m_TreeViewTest2.OnGUI(rightRect);
            EditorGUI.DrawRect(new Rect(leftRect.xMax - 1, 0, 2, position.height), new Color(0.4f, 0.4f, 0.4f, 0.8f));
        }
コード例 #11
0
 public LazyTestDataSource(TreeViewController treeView, BackendData data)
     : base(treeView)
 {
     m_Backend = data;
     FetchData();
 }
コード例 #12
0
 public TestDragging(TreeViewController treeView, BackendData data) : base(treeView)
 {
     this.m_BackendData = data;
 }
コード例 #13
0
 public TestDataSource(TreeViewController treeView, BackendData data) : base(treeView)
 {
     this.m_Backend = data;
     this.FetchData();
 }