// Ping Item // ------------- virtual public void BeginPingItem(TreeViewItem item, float topPixelOfRow, float availableWidth) { if (item == null) { return; } // Setup ping if (topPixelOfRow >= 0f) { m_Ping.m_TimeStart = Time.realtimeSinceStartup; m_Ping.m_PingStyle = pingStyle; GUIContent cont = GUIContent.Temp(item.displayName); Vector2 contentSize = m_Ping.m_PingStyle.CalcSize(cont); m_Ping.m_ContentRect = new Rect(GetContentIndent(item) + extraSpaceBeforeIconAndLabel, topPixelOfRow, k_IconWidth + k_SpaceBetweenIconAndText + contentSize.x + iconTotalPadding, contentSize.y); m_Ping.m_AvailableWidth = availableWidth; int row = m_TreeView.data.GetRow(item.id); bool useBoldFont = item.displayName.Equals("Assets"); m_Ping.m_ContentDraw = (Rect r) => { // get Item parameters from closure OnContentGUI(r, row, item, item.displayName, false, false, useBoldFont, true); }; m_TreeView.Repaint(); } }
virtual public void InitIfNeeded() { // Cached for large trees... if (m_Rows == null || m_NeedRefreshRows) { if (m_RootItem != null) { if (m_TreeView.isSearching) { m_Rows = Search(m_RootItem, m_TreeView.searchString.ToLower()); } else { m_Rows = ExpandedRows(m_RootItem); } } else { Debug.LogError("TreeView root item is null. Ensure that your TreeViewDataSource sets up at least a root item."); m_Rows = new List <TreeViewItem>(); } m_NeedRefreshRows = false; // TODO: This should be named something like: 'onVisibleRowsReloaded' if (onVisibleRowsChanged != null) { onVisibleRowsChanged(); } // Expanded state has changed ensure that we repaint m_TreeView.Repaint(); } }
public void Repaint() { m_TreeView.Repaint(); }