コード例 #1
0
 private void DrawColumnSeperators()
 {
     if (Event.current.type == EventType.Repaint)
     {
         var bcol = SirenixGUIStyles.BorderColor;
         bcol.a *= 0.4f;
         var r = this.table.OuterRect;
         GUITableUtilities.DrawColumnHeaderSeperators(r, this.columns, bcol);
     }
 }
コード例 #2
0
        public void DrawOverview()
        {
            if (Event.current.type == EventType.Layout && this.nextDisplay != null)
            {
                this.Display     = this.nextDisplay.Value;
                this.nextDisplay = null;
                this.Update();
            }

            if (Event.current.type == EventType.Layout && this.shouldSort)
            {
                this.shouldSort = false;
                this.Sort();
            }

            EnumBtnStyle = EnumBtnStyle ?? new GUIStyle(EditorStyles.toolbarDropDown);
            EnumBtnStyle.stretchHeight = true;
            EnumBtnStyle.fixedHeight   = this.Tree.Config.SearchToolbarHeight;

            GUILayout.BeginHorizontal(GUILayoutOptions.ExpandHeight());
            {
                var rect       = GUIHelper.GetCurrentLayoutRect();
                var columnRect = rect.AddYMin(this.Tree.Config.SearchToolbarHeight);

                GUILayout.BeginVertical(GUILayoutOptions.Width(rect.width).ExpandHeight());
                {
                    EditorGUI.DrawRect(columnRect.AddYMin(this.Tree.Config.DefaultMenuStyle.Height), SirenixGUIStyles.EditorWindowBackgroundColor);

                    GUILayout.BeginHorizontal();
                    this.Tree.DrawSearchToolbar();
                    var displayRect = GUILayoutUtility.GetRect(95, this.Tree.Config.SearchToolbarHeight, GUILayoutOptions.Width(95));
                    displayRect.height = this.Tree.Config.SearchToolbarHeight;
                    displayRect.width -= 1;

                    var newDisplay = EnumSelector <DisplayOptions> .DrawEnumField(displayRect, null, GUIHelper.TempContent("Data Columns"), this.Display, EnumBtnStyle);

                    if (newDisplay != this.Display)
                    {
                        this.nextDisplay = newDisplay;
                    }

                    GUILayout.EndHorizontal();

                    GUITableUtilities.ResizeColumns(columnRect, this.columns);
                    this.DrawColumnHeaders();
                    this.Tree.DrawMenuTree();
                }

                GUILayout.EndVertical();
                GUITableUtilities.DrawColumnHeaderSeperators(columnRect, this.columns, SirenixGUIStyles.BorderColor);

                GUILayout.Space(-5);
            }
            GUILayout.EndHorizontal();
        }
コード例 #3
0
        private void DrawColumnHeaders()
        {
            if (this.Property.Children.Count == 0)
            {
                return;
            }

            this.columnHeaderRect = GUILayoutUtility.GetRect(0, 21);

            this.columnHeaderRect.height += 1;
            this.columnHeaderRect.y      -= 1;

            if (Event.current.type == EventType.Repaint)
            {
                SirenixEditorGUI.DrawBorders(this.columnHeaderRect, 1);
                EditorGUI.DrawRect(this.columnHeaderRect, SirenixGUIStyles.ColumnTitleBg);
            }

            var offset = this.columnHeaderRect.width - this.table.ContentRect.width;

            this.columnHeaderRect.width -= offset;
            GUITableUtilities.ResizeColumns(this.columnHeaderRect, this.columns);

            if (Event.current.type == EventType.Repaint)
            {
                GUITableUtilities.DrawColumnHeaderSeperators(this.columnHeaderRect, this.columns, SirenixGUIStyles.BorderColor);

                var rect = this.columnHeaderRect;
                for (int i = 0; i < this.columns.Count; i++)
                {
                    var col = this.columns[i];
                    if (rect.x > this.columnHeaderRect.xMax)
                    {
                        break;
                    }

                    rect.width = col.ColWidth;
                    rect.xMax  = Mathf.Min(this.columnHeaderRect.xMax, rect.xMax);

                    if (col.NiceName != null)
                    {
                        var lblRect = rect;
                        GUI.Label(lblRect, col.NiceName, SirenixGUIStyles.LabelCentered);
                    }

                    rect.x += col.ColWidth;
                }
            }
        }
コード例 #4
0
        protected override void DrawPropertyLayout(GUIContent label)
        {
            // Save menuTreeWidth.
            this.menuTreeWidth.Value = this.columns[0].ColWidth;

            // Bottom Slide Toggle Bits:
            var overviewSlideRect     = new Rect();
            var toggleOverviewBtnRect = new Rect();

            Rect topRect;

            GUILayout.BeginHorizontal(GUILayoutOptions.ExpandHeight());
            {
                topRect = GUIHelper.GetCurrentLayoutRect();
                GUITableUtilities.ResizeColumns(topRect, this.columns);

                // Bottom Slide Toggle Bits:
                // The bottom slide-rect toggle needs to be drawn above, but is placed below.
                overviewSlideRect        = topRect.AlignBottom(4).AddY(4);
                overviewSlideRect.width += 4;
                toggleOverviewBtnRect    = overviewSlideRect.AlignCenter(100).AlignBottom(14);
                EditorGUIUtility.AddCursorRect(toggleOverviewBtnRect, MouseCursor.Arrow);
                if (SirenixEditorGUI.IconButton(toggleOverviewBtnRect.AddY(-2), this.overviewToggle.Value ? EditorIcons.TriangleDown : EditorIcons.TriangleUp))
                {
                    this.overviewToggle.Value = !this.overviewToggle.Value;
                }

                if (this.overviewToggle.Value)
                {
                    this.overviewHeight -= SirenixEditorGUI.SlideRect(overviewSlideRect.SetXMax(toggleOverviewBtnRect.xMin), MouseCursor.SplitResizeUpDown).y;
                    this.overviewHeight -= SirenixEditorGUI.SlideRect(overviewSlideRect.SetXMin(toggleOverviewBtnRect.xMax), MouseCursor.SplitResizeUpDown).y;
                }

                // Left menu tree
                GUILayout.BeginVertical(GUILayoutOptions.Width(this.columns[0].ColWidth).ExpandHeight());
                {
                    EditorGUI.DrawRect(GUIHelper.GetCurrentLayoutRect(), SirenixGUIStyles.EditorWindowBackgroundColor);
                    this.validationProfileTree.Draw();
                }
                GUILayout.EndVertical();

                // Draw selected
                GUILayout.BeginVertical();
                {
                    this.DrawTopBarButtons();
                    this.DrawSelectedTests();
                }
                GUILayout.EndVertical();
                GUITableUtilities.DrawColumnHeaderSeperators(topRect, this.columns, SirenixGUIStyles.BorderColor);
            }
            GUILayout.EndHorizontal();

            // Bottom Slide Toggle Bits:
            if (this.overviewToggle.Value)
            {
                GUILayoutUtility.GetRect(0, 4); // Slide Area.
            }

            EditorGUI.DrawRect(overviewSlideRect, SirenixGUIStyles.BorderColor);
            EditorGUI.DrawRect(toggleOverviewBtnRect.AddY(-overviewSlideRect.height), SirenixGUIStyles.BorderColor);
            SirenixEditorGUI.IconButton(toggleOverviewBtnRect.AddY(-2), this.overviewToggle.Value ? EditorIcons.TriangleDown : EditorIcons.TriangleUp);

            // Overview
            if (this.overviewToggle.Value)
            {
                GUILayout.BeginVertical(GUILayout.Height(this.overviewHeight));
                {
                    this.overview.DrawOverview();
                }
                GUILayout.EndVertical();

                if (Event.current.type == EventType.Repaint)
                {
                    this.overviewHeight = Mathf.Max(50, this.overviewHeight);
                    var height = GUIHelper.CurrentWindow.position.height - overviewSlideRect.yMax;
                    this.overviewHeight = Mathf.Min(this.overviewHeight, height);
                }
            }
        }