public void Init(Rect rect, BackendData backendData) { if (this.m_TreeView == null) { ITreeViewDataSource source; this.m_BackendData = backendData; TreeViewState treeViewState = new TreeViewState { columnWidths = new float[] { 250f, 90f, 93f, 98f, 74f, 78f } }; this.m_TreeView = new TreeView(this.m_EditorWindow, treeViewState); ITreeViewGUI gui = new TestGUI(this.m_TreeView); ITreeViewDragging dragging = new TestDragging(this.m_TreeView, this.m_BackendData); if (this.m_Lazy) { source = new LazyTestDataSource(this.m_TreeView, this.m_BackendData); } else { source = new TestDataSource(this.m_TreeView, this.m_BackendData); } this.m_TreeView.Init(rect, source, gui, dragging); this.m_ColumnHeader = new TreeViewColumnHeader(); this.m_ColumnHeader.columnWidths = treeViewState.columnWidths; this.m_ColumnHeader.minColumnWidth = 30f; this.m_ColumnHeader.columnRenderer = (Action <int, Rect>)Delegate.Combine(this.m_ColumnHeader.columnRenderer, new Action <int, Rect>(this.OnColumnRenderer)); } }
public void Init(Rect rect, BackendData backendData) { if (this.m_TreeView == null) { ITreeViewDataSource source; this.m_BackendData = backendData; TreeViewState treeViewState = new TreeViewState { columnWidths = new float[] { 250f, 90f, 93f, 98f, 74f, 78f } }; this.m_TreeView = new TreeView(this.m_EditorWindow, treeViewState); ITreeViewGUI gui = new TestGUI(this.m_TreeView); ITreeViewDragging dragging = new TestDragging(this.m_TreeView, this.m_BackendData); if (this.m_Lazy) { source = new LazyTestDataSource(this.m_TreeView, this.m_BackendData); } else { source = new TestDataSource(this.m_TreeView, this.m_BackendData); } this.m_TreeView.Init(rect, source, gui, dragging); this.m_ColumnHeader = new TreeViewColumnHeader(); this.m_ColumnHeader.columnWidths = treeViewState.columnWidths; this.m_ColumnHeader.minColumnWidth = 30f; this.m_ColumnHeader.columnRenderer = (Action<int, Rect>) Delegate.Combine(this.m_ColumnHeader.columnRenderer, new Action<int, Rect>(this.OnColumnRenderer)); } }
public int GetNumItemsInTree() { LazyTestDataSource data = this.m_TreeView.data as LazyTestDataSource; if (data != null) { return(data.itemCounter); } TestDataSource source2 = this.m_TreeView.data as TestDataSource; if (source2 != null) { return(source2.itemCounter); } return(-1); }