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); } } }
void OnSpreadsheetClick(UI.DatabaseSpreadsheet sheet, Database.LinkRequest link, Database.CellPosition pos) { //add current event in history m_UIState.AddHistoryEvent(GetCurrentHistoryEvent()); var tableLinkRequest = link as Database.LinkRequestTable; if (tableLinkRequest != null) { if (tableLinkRequest.LinkToOpen.TableName == ObjectTable.TableName) { //open object link in the same pane OpenLinkRequest(tableLinkRequest, true); return; } } else Debug.LogWarning("Cannot open unknown link '" + link.ToString() + "'"); //open the link in the spreadsheet pane m_EventListener.OnOpenLink(link, m_ActiveMode); }