コード例 #1
0
        public void OnGUI()
        {
            Profiler.BeginSample("SerializedPropertyTable.OnGUI");
            InitIfNeeded();

            Rect r = GUILayoutUtility.GetRect(0, float.MaxValue, 0, float.MaxValue);

            if (Event.current.type == EventType.Layout)
            {
                Profiler.EndSample();
                return;
            }

            float tableHeight = r.height - m_FilterHeight;

            // filter rect
            r.height = m_FilterHeight;
            Rect filterRect = r;

            // table rect
            r.height = tableHeight;
            r.y     += m_FilterHeight;
            Rect tableRect = r;

            // table
            Profiler.BeginSample("TreeView.OnGUI");
            m_TreeView.OnGUI(tableRect);
            Profiler.EndSample();

            m_TreeView.OnFilterGUI(filterRect);

            if (m_TreeView.IsFilteredDirty())
            {
                m_TreeView.Reload();
            }

            Profiler.EndSample();
        }
コード例 #2
0
        public void OnGUI()
        {
            Profiler.BeginSample("SerializedPropertyTable.OnGUI");
            InitIfNeeded();

            Rect r;

            if (dragHandleEnabled)
            {
                r = GUILayoutUtility.GetRect(0, 10000, m_TableHeight, m_TableHeight);
            }
            else
            {
                r = GUILayoutUtility.GetRect(0, float.MaxValue, 0, float.MaxValue);
            }

            if (Event.current.type == EventType.Layout)
            {
                return;
            }

            float windowWidth = r.width;
            float tableHeight = r.height - m_FilterHeight - (dragHandleEnabled ? m_DragHeight : 0);
            // filter rect
            float h = r.height;

            r.height = m_FilterHeight;
            Rect filterRect = r;

            // table rect
            r.height = tableHeight;
            r.y     += m_FilterHeight;
            Rect tableRect = r;

            // table
            Profiler.BeginSample("TreeView.OnGUI");
            m_TreeView.OnGUI(tableRect);
            Profiler.EndSample();

            if (dragHandleEnabled)
            {
                // separator rect
                r.y     += tableHeight + 1;
                r.height = 1;
                Rect sepRect = r;
                // drag rect
                r.height = 10;
                r.y     += 10;
                r.x     += (r.width - m_DragWidth) * 0.5f;
                r.width  = m_DragWidth;

                m_TableHeight = EditorGUI.HeightResizer(r, m_TableHeight, GetMinHeight(), float.MaxValue);

                // separator (TODO: this doesn't quite work in the case where the vertical bar is visible and the last column overlaps it)
                // once trunk is merged again the treeview will provide a routine to draw the separator for us
                if (m_MultiColumnHeaderState.widthOfAllVisibleColumns <= windowWidth)
                {
                    Rect uv = new Rect(0, 1f, 1, 1f - 1f / EditorStyles.inspectorTitlebar.normal.background.height);
                    GUI.DrawTextureWithTexCoords(sepRect, EditorStyles.inspectorTitlebar.normal.background, uv);
                }

                if (Event.current.type == EventType.Repaint)
                {
                    Styles.DragHandle.Draw(r, false, false, false, false);
                }
            }

            m_TreeView.OnFilterGUI(filterRect);

            if (m_TreeView.IsFilteredDirty())
            {
                m_TreeView.Reload();
            }

            Profiler.EndSample();
        }