void InitIfNeeded() { if (!m_Initialized && SelectedDenericTableData != null) { // Check if it already exists (deserialized from window layout file or scriptable object) if (m_TreeViewState == null) { m_TreeViewState = new TreeViewState(); } SelectedDenericTableData.Cache(); bool firstInit = m_MultiColumnHeaderState == null; var headerState = SelectedDenericTableData.CreateDefaultMultiColumnHeaderState(); if (MultiColumnHeaderState.CanOverwriteSerializedFields(m_MultiColumnHeaderState, headerState)) { MultiColumnHeaderState.OverwriteSerializedFields(m_MultiColumnHeaderState, headerState); } m_MultiColumnHeaderState = headerState; var multiColumnHeader = new MultiColumnHeader(headerState); if (firstInit) { multiColumnHeader.ResizeToFit(); } var treeModel = new ListModel(SelectedDenericTableData.GenerateTree()); m_TreeView = new MultiColumnListView(m_TreeViewState, multiColumnHeader, treeModel, SelectedDenericTableData); m_SearchField = new SearchField(); m_SearchField.downOrUpArrowKeyPressed += m_TreeView.SetFocusAndEnsureSelectedItem; m_Initialized = true; } }
public MultiColumnListView(TreeViewState state, MultiColumnHeader multicolumnHeader, ListModel model, SerializedObjectEntry genericSerializedData) : base(state, multicolumnHeader, model) { this.genericSerializedData = genericSerializedData; // Custom setup rowHeight = kRowHeights; columnIndexForTreeFoldouts = 0; showAlternatingRowBackgrounds = true; showBorder = true; customFoldoutYOffset = (kRowHeights - EditorGUIUtility.singleLineHeight) * 0.5f; // center foldout in the row since we also center content. See RowGUI extraSpaceBeforeIconAndLabel = kToggleWidth; multicolumnHeader.sortingChanged += OnSortingChanged; Reload(); }
public TreeViewWithListModel(TreeViewState state, MultiColumnHeader multiColumnHeader, ListModel model) : base(state, multiColumnHeader) { Init(model); }
void Init(ListModel model) { m_TreeModel = model; }
public TreeViewWithListModel(TreeViewState state, ListModel model) : base(state) { Init(model); }