Ejemplo n.º 1
0
        public override void OnGUI(Rect rect)
        {
            base.OnGUI(rect);
            if (!m_Init)
            {
                m_Init = true;
                m_TreeView.Init(rect, m_DataSource, m_TreeViewGUI, m_TreeViewDragging);
                m_TreeView.ReloadData();
            }

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

            m_TreeView.OnEvent();
            var controllId = GUIUtility.GetControlID(FocusType.Keyboard);

            m_TreeView.OnGUI(rect, controllId);

            if (GUIUtility.keyboardControl == controllId)
            {
                HandleCommandEventsForTreeView();
            }
        }
        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);
            }
        }
Ejemplo n.º 3
0
 public override void OnLostFocus()
 {
     base.OnLostFocus();
     if (m_TreeView != null)
     {
         if (m_TreeView.gui != null)
         {
             m_TreeView.EndPing();
         }
         m_TreeView.EndNameEditing(true);
     }
 }
Ejemplo n.º 4
0
        public override void OnGUI(Rect rect)
        {
            base.OnGUI(rect);
            if (!m_Init)
            {
                m_Init = true;
                m_TreeView.Init(rect, dataSource, m_TreeViewGUI, m_TreeViewDragging);
                m_TreeView.ReloadData();
                if (OnGUIInitAction != null)
                {
                    OnGUIInitAction();
                }
            }

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

            m_TreeView.OnEvent();
            m_TreeView.OnGUI(rect, GUIUtility.GetControlID(FocusType.Keyboard));
            HandleCommandEventsForTreeView();
        }