TreeView<T>class
A virtualized tree over your own objects. You give it roots and a way to get children; it keeps a flat list of the rows that are reachable through open nodes and only ever creates enough row panels to fill the viewport. Give `Sandbox.UI.TreeView.GetChildren` lists or arrays and scrolling allocates nothing.
Constructors1
Showing 1 constructors
public TreeView<T>()
No results match this filter.
Methods26
Showing 26 methods
protected virtual void BindRow(int row, Sandbox.UI.TreeRow panel)
| Parameter | Type | Description |
|---|---|---|
| row | int | — |
| panel | TreeRow | — |
void—protected virtual void BuildRows()
void—protected virtual bool CanRenameRow(int row)
| Parameter | Type | Description |
|---|---|---|
| row | int | — |
bool—protected virtual void CheckForChanges()
void—protected virtual void ClearSelectionInternal()
void—public void Close(T item, bool recursive = False)
| Parameter | Type | Description |
|---|---|---|
| item | T | — |
| recursive = False | bool | — |
void—public bool ExpandPathTo(T item)
| Parameter | Type | Description |
|---|---|---|
| item | T | — |
bool—public int GetItemRow(T item)
| Parameter | Type | Description |
|---|---|---|
| item | T | — |
int—public T GetRowItem(int row)
The item at a visible row.
| Parameter | Type | Description |
|---|---|---|
| row | int | — |
T—public void Highlight(T item)
| Parameter | Type | Description |
|---|---|---|
| item | T | — |
void—public bool IsOpen(T item)
| Parameter | Type | Description |
|---|---|---|
| item | T | — |
bool—protected virtual bool IsRowSelected(int row)
| Parameter | Type | Description |
|---|---|---|
| row | int | — |
bool—public bool IsSelected(T item)
| Parameter | Type | Description |
|---|---|---|
| item | T | — |
bool—protected virtual void OnRowActivated(int row)
| Parameter | Type | Description |
|---|---|---|
| row | int | — |
void—protected virtual void OnRowContextMenu(int row)
| Parameter | Type | Description |
|---|---|---|
| row | int | — |
void—protected virtual void OnRowDropped(int targetRow, int sourceRow)
| Parameter | Type | Description |
|---|---|---|
| targetRow | int | — |
| sourceRow | int | — |
void—protected virtual void OnRowRenamed(int row, string text)
| Parameter | Type | Description |
|---|---|---|
| row | int | — |
| text | string | — |
void—protected virtual void OnSelectionFinished()
void—public void Open(T item, bool recursive = False)
| Parameter | Type | Description |
|---|---|---|
| item | T | — |
| recursive = False | bool | — |
void—public void ScrollTo(T item)
| Parameter | Type | Description |
|---|---|---|
| item | T | — |
void—public void Select(T item, bool add = False)
| Parameter | Type | Description |
|---|---|---|
| item | T | — |
| add = False | bool | — |
void—protected virtual void SetRowOpen(int row, bool open, bool recursive)
| Parameter | Type | Description |
|---|---|---|
| row | int | — |
| open | bool | — |
| recursive | bool | — |
void—protected virtual void SetRowSelected(int row, bool selected)
| Parameter | Type | Description |
|---|---|---|
| row | int | — |
| selected | bool | — |
void—public void Toggle(T item, bool recursive = False)
| Parameter | Type | Description |
|---|---|---|
| item | T | — |
| recursive = False | bool | — |
void—No results match this filter.
Properties20
Showing 20 properties
public System.Func`2<T,bool> Sandbox.UI.TreeView<T>.CanDrag { get; set; }
Can this item be dragged? Setting this makes rows draggable.
Func<T,bool>—public System.Func`2<T,bool> Sandbox.UI.TreeView<T>.CanExpand { get; set; }
Whether an item can be expanded. Optional - without it `Sandbox.UI.TreeView.GetChildren` is asked.
Func<T,bool>—public System.Func`2<T,bool> Sandbox.UI.TreeView<T>.CanRename { get; set; }
Whether F2 can rename an item. Optional - without it any item can when `Sandbox.UI.TreeView.OnRename` is set.
Func<T,bool>—public System.Collections.Generic.IEqualityComparer`1<T> Sandbox.UI.TreeView<T>.Comparer { get; set; }
How items are compared for open and selected state. Set before adding anything.
IEqualityComparer<T>—public T Sandbox.UI.TreeView<T>.CursorItem { get; set; }
The item under the keyboard cursor, or default.
T—public System.Func`2<T,System.Collections.Generic.IEnumerable`1<T>> Sandbox.UI.TreeView<T>.GetChildren { get; set; }
The children of an item. Return a list or array to avoid allocating enumerators.
Func<T,IEnumerable<T>>—public System.Func`2<T,float> Sandbox.UI.TreeView<T>.GetHeight { get; set; }
Height of a specific item's row. Optional - without it every row is `Sandbox.UI.BaseTreeView.RowHeight`.
Func<T,float>—public System.Func`2<T,T> Sandbox.UI.TreeView<T>.GetParent { get; set; }
The parent of an item, or default for a root. Optional, but without it opening the path to an item is a search down from the roots, which walks a lazy tree into existence.
Func<T,T>—public System.Func`2<T,string> Sandbox.UI.TreeView<T>.GetTooltip { get; set; }
Hover text for an item.
Func<T,string>—public System.Action`1<T> Sandbox.UI.TreeView<T>.OnActivate { get; set; }
Double click or enter on an item. A double click opens a closed branch first when `Sandbox.UI.BaseTreeView.ExpandOnDoubleClick` is enabled.
Action<T>—public System.Action`1<T> Sandbox.UI.TreeView<T>.OnContextMenu { get; set; }
Right click on an item. Build and show whatever menu you like.
Action<T>—public System.Action`2<T,T> Sandbox.UI.TreeView<T>.OnItemDropped { get; set; }
A dragged item was dropped on a target item, or on empty space when the target is default.
Action<T,T>—public System.Action`2<T,string> Sandbox.UI.TreeView<T>.OnRename { get; set; }
The user finished renaming an item in place. Apply it to your data.
Action<T,string>—public System.Action`2<Sandbox.UI.TreeRow,T> Sandbox.UI.TreeView<T>.OnRow { get; set; }
Fill a row panel from its item. Called when a row scrolls in or the tree refreshes, never per frame. Rows are reused, so create extra panels once and update them here.
public System.Action`1<T> Sandbox.UI.TreeView<T>.OnSelect { get; set; }
The cursor item after any selection change.
Action<T>—public System.Action Sandbox.UI.TreeView<T>.OnSelectionChanged { get; set; }
Any change to `Sandbox.UI.TreeView.Selection`.
Action—public System.Collections.Generic.IReadOnlyCollection`1<T> Sandbox.UI.TreeView<T>.OpenItems { get; set; }
The items that are open.
IReadOnlyCollection<T>—public System.Collections.Generic.IEnumerable`1<T> Sandbox.UI.TreeView<T>.Roots { get; set; }
The top level items. Pass a list or array and additions and removals are picked up automatically.
IEnumerable<T>—No results match this filter.