Ejemplo n.º 1
0
        protected override void DrawCell(long row, long col, Rect r, long index, bool selected, ref GUIPipelineState pipe)
        {
            var s = m_TableDisplay.GetCellExpandState(row, (int)col);

            if (s.isColumnExpandable)
            {
                int indent = s.expandDepth * 16;
                r.x     += indent;
                r.width -= indent;
                if (s.isExpandable)
                {
                    Rect rToggle     = new Rect(r.x, r.y, 16, r.height);
                    bool newExpanded = GUI.Toggle(rToggle, s.isExpanded, GUIContent.none, Styles.styles.foldout);
                    if (newExpanded != s.isExpanded)
                    {
                        pipe.processMouseClick = false;
                        SetCellExpandedState(row, col, newExpanded);
                    }
                }
                r.x     += 16;
                r.width -= 16;
            }

            Database.LinkRequest link = null;
            if (onClickLink != null)
            {
                link = m_TableDisplay.GetCellLink(new Database.CellPosition(row, (int)col));
            }
            if (Event.current.type == EventType.Repaint)
            {
                var column = m_TableDisplay.GetColumnByIndex((int)col);
                if (column != null)
                {
#if MEMPROFILER_DEBUG_INFO
                    string str;
                    if (m_DataRenderer.showDebugValue)
                    {
                        //str = "\"" + column.GetRowValueString(row) + "\" " + column.GetDebugString(row);
                        str = column.GetDebugString(row);
                    }
                    else
                    {
                        str = column.GetRowValueString(row);
                    }
#else
                    var str = column.GetRowValueString(row);
#endif
                    DrawTextEllipsis(str, r,
                                     link == null ? Styles.styles.numberLabel : Styles.styles.clickableLabel
                                     , EllipsisStyleMetricData, selected);
                }
            }
            if (link != null)
            {
                if (Event.current.type == EventType.Repaint)
                {
                    EditorGUIUtility.AddCursorRect(r, MouseCursor.Link);
                }
            }
        }
        protected override void DrawCell(long row, long col, Rect r, long index, bool selected, ref GUIPipelineState pipe)
        {
            var s = m_TableDisplay.GetCellExpandState(row, (int)col);

            if (s.isColumnExpandable)
            {
                int indent = s.expandDepth * 16;
                r.x     += indent;
                r.width -= indent;
                if (s.isExpandable)
                {
                    Rect rToggle     = new Rect(r.x, r.y, Styles.FoldoutWidth, r.height);
                    bool newExpanded = GUI.Toggle(rToggle, s.isExpanded, GUIContent.none, Styles.Foldout);
                    if (newExpanded != s.isExpanded)
                    {
                        pipe.processMouseClick = false;
                        SetCellExpandedState(row, col, newExpanded);
                    }
                }
                r.x     += 16;
                r.width -= 16;
            }

            Database.LinkRequest link = null;
            if (onClickLink != null)
            {
                link = m_TableDisplay.GetCellLink(new Database.CellPosition(row, (int)col));
            }
            if (Event.current.type == EventType.Repaint)
            {
                var column     = m_TableDisplay.GetColumnByIndex((int)col);
                var metaColumn = m_TableDisplay.GetMetaData().GetColumnByIndex((int)col);
                if (column != null)
                {
                    var str = column.GetRowValueString(row, m_FormattingOptions.GetFormatter(metaColumn.FormatName));
                    DrawTextEllipsis(str, r,
                                     link == null ? Styles.NumberLabel : Styles.ClickableLabel
                                     , EllipsisStyleMetricData, selected);
                }
            }
            if (link != null)
            {
                if (Event.current.type == EventType.Repaint)
                {
                    EditorGUIUtility.AddCursorRect(r, MouseCursor.Link);
                }
            }
        }