public override void OnGUI(Rect rect)
        {
            base.OnGUI(rect);

            var bottomHeight     = GetBottomBarHeight();
            var listHeaderHeight = 18;

            var position      = Owner.WindowOwner.position;
            var leftRect      = new Rect(0, EditorStyles.toolbar.fixedHeight, m_HorizontalSplitLine.PositionX, position.height - EditorStyles.toolbar.fixedHeight);
            var searchBarRect = new Rect(0f, 0f, position.width, EditorStyles.toolbar.fixedHeight);
            var gridViewRect  = new Rect(m_HorizontalSplitLine.PositionX, EditorStyles.toolbar.fixedHeight + listHeaderHeight, position.width - m_HorizontalSplitLine.PositionX, position.height - EditorStyles.toolbar.fixedHeight - bottomHeight - listHeaderHeight);

            m_BottomBarRectWidth = position.width - m_HorizontalSplitLine.PositionX;
            var bottomBarRect  = new Rect(m_HorizontalSplitLine.PositionX, position.height - bottomHeight, position.width - m_HorizontalSplitLine.PositionX, bottomHeight);
            var listHeaderRect = new Rect(gridViewRect.x, EditorStyles.toolbar.fixedHeight, gridViewRect.width, listHeaderHeight);

            if (Event.current.type == EventType.MouseDown && rect.Contains(Event.current.mousePosition))
            {
                m_GridView.EndPing();
                m_GridView.EndRename(true);
                m_TreeView.EndPing();
                m_TreeView.EndNameEditing(true);
            }

            m_HorizontalSplitLine.ResizeHandling(0, position.width, position.height, 0, 2);

            m_FolderTreeViewGroup.OnGUI(leftRect);
            m_SearchBar.OnGUI(searchBarRect);
            m_GridView.OnGUI(gridViewRect);
            m_BottomBar.OnGUI(bottomBarRect);

            m_HorizontalSplitLine.OnGUI(0, EditorStyles.toolbar.fixedHeight, position.height);

            HandleCommandEvents();

            if (!m_Init)
            {
                m_Init = true;
                var state = m_FolderTreeViewGroup.GeTreeViewState();
                if (state.selectedIDs.Count == 0)
                {
                    state.selectedIDs.Add(GetDataContainer().RootItem.id);
                }

                UpdateGridViewContent();
                RefreshBottomBarSelectedItem(m_GridView.ViewConfig.SelectedItemIdList.ToArray());
                UpdateBreadcrumbBarContents();
            }

            m_BreadcrumbBar.KeyboardControlID = m_GridView.KeyboardControlID;
            m_BreadcrumbBar.OnGUI(listHeaderRect);

            if (!m_TreeView.isSearching && m_GridViewDataSource.Count == 0)
            {
                Vector2 vector2   = EditorStyles.label.CalcSize(m_EmptyFolderText);
                Rect    position2 = new Rect(gridViewRect.x + 2f + Mathf.Max(0.0f, (gridViewRect.width - vector2.x) * 0.5f), gridViewRect.y + 10f, vector2.x, 20f);
                using (new EditorGUI.DisabledScope(true))
                    GUI.Label(position2, m_EmptyFolderText, EditorStyles.label);
            }
        }
Exemplo n.º 2
0
        public override void OnGUI(Rect rect)
        {
            base.OnGUI(rect);
            var position      = Owner.WindowOwner.position;
            var toolBarRect   = new Rect(0f, 0f, position.width, EditorStyles.toolbar.fixedHeight);
            var graphViewRect = new Rect(0, EditorStyles.toolbar.fixedHeight, position.width,
                                         position.height - EditorStyles.toolbar.fixedHeight);
            var treeViewRect = new Rect();

            if (showMainButton && isMainButtonOn)
            {
                graphViewRect = new Rect(m_HorizontalSplitLine.PositionX, EditorStyles.toolbar.fixedHeight,
                                         position.width - m_HorizontalSplitLine.PositionX,
                                         position.height - EditorStyles.toolbar.fixedHeight);
                treeViewRect = new Rect(0, EditorStyles.toolbar.fixedHeight, m_HorizontalSplitLine.PositionX,
                                        position.height - EditorStyles.toolbar.fixedHeight);
            }

            if (Event.current.type == EventType.MouseDown && rect.Contains(Event.current.mousePosition))
            {
                if (m_TreeView != null)
                {
                    if (m_TreeView.gui != null)
                    {
                        m_TreeView.EndPing();
                    }
                    m_TreeView.EndNameEditing(true);
                }
            }

            if (showMainButton && isMainButtonOn)
            {
                m_HorizontalSplitLine.ResizeHandling(0, position.width, position.height, 0, 2);
                m_ObjectTreeViewGroup.OnGUI(treeViewRect);
                m_HorizontalSplitLine.OnGUI(0, EditorStyles.toolbar.fixedHeight, position.height);
            }

            if (ShowSearchBar)
            {
                m_SearchBar.OnGUI(toolBarRect);
            }
            else
            {
                graphViewRect = rect;
            }

            m_GraphView.OnGUI(graphViewRect);
        }
Exemplo n.º 3
0
        public override void OnGUI(Rect rect)
        {
            base.OnGUI(rect);
            var position      = Owner.WindowOwner.position;
            var searchBarRect = new Rect(0f, 0f, position.width, EditorStyles.toolbar.fixedHeight);
            var gridViewRect  = new Rect(0, EditorStyles.toolbar.fixedHeight, position.width, position.height - EditorStyles.toolbar.fixedHeight - 17f);
            var bottomBarRect = new Rect(0, position.height - EditorStyles.toolbar.fixedHeight, position.width, 17f);

            if (Event.current.type == EventType.MouseDown && rect.Contains(Event.current.mousePosition))
            {
                m_GridView.EndPing();
            }

            m_SearchBar.OnGUI(searchBarRect);
            m_GridView.OnGUI(gridViewRect);
            m_BottomBar.OnGUI(bottomBarRect);

            HandleCommandEvents();
        }