BaseTreeViewclass
A virtualized tree. Holds the flat list of visible rows, a pool of `Sandbox.UI.TreeRow` panels that are rebound as it scrolls, and all the index-based input handling. Knows nothing about the items themselves - `Sandbox.UI.TreeView` supplies those.
Constructors1
Showing 1 constructors
protected BaseTreeView()
No results match this filter.
Methods35
Showing 35 methods
protected void AddRow(float height, int depth, bool hasChildren, bool isOpen)
Append a row during `Sandbox.UI.BaseTreeView.BuildRows`.
| Parameter | Type | Description |
|---|---|---|
| height | float | — |
| depth | int | — |
| hasChildren | bool | — |
| isOpen | bool | — |
void—public void BeginRename(int row)
Start renaming a row's label in place, scrolling it into view first if needed.
| Parameter | Type | Description |
|---|---|---|
| row | int | — |
void—protected virtual void BindRow(int row, Sandbox.UI.TreeRow panel)
Fill a pooled row panel with the item at this row.
| Parameter | Type | Description |
|---|---|---|
| row | int | — |
| panel | TreeRow | — |
void—protected virtual void BuildRows()
Walk the data and call `Sandbox.UI.BaseTreeView.AddRow(System.Single,System.Int32,System.Boolean,System.Boolean)` for every reachable row, in order.
void—protected virtual bool CanRenameRow(int row)
| Parameter | Type | Description |
|---|---|---|
| row | int | — |
bool—protected virtual void CheckForChanges()
Cheap per-tick check for data that changed underneath us. Set `Sandbox.UI.BaseTreeView.NeedsRebuild` if so.
void—public void ClearSelection()
Drop the selection, keeping the cursor.
void—protected virtual void ClearSelectionInternal()
void—protected virtual void FinalLayoutChildren(Vector2 offset)
| Parameter | Type | Description |
|---|---|---|
| offset | Vector2 | — |
void—public int GetParentRow(int row)
The nearest row above with one less depth, or -1 for a root.
| Parameter | Type | Description |
|---|---|---|
| row | int | — |
int—protected Sandbox.UI.BaseTreeView.RowLayout GetRow(int row)
Layout of a row.
| Parameter | Type | Description |
|---|---|---|
| row | int | — |
RowLayout—public int GetRowDepth(int row)
Depth of a row, roots being zero.
| Parameter | Type | Description |
|---|---|---|
| row | int | — |
int—public Sandbox.UI.TreeRow GetRowPanel(int row)
The bound panel for a row, or null if it isn't in the viewport.
| Parameter | Type | Description |
|---|---|---|
| row | int | — |
public int GetSubtreeEnd(int row)
One past the last row inside this row's subtree.
| Parameter | Type | Description |
|---|---|---|
| row | int | — |
int—public void HighlightRow(int row)
Flash a row so the eye finds it: the `highlight` class for `Sandbox.UI.BaseTreeView.HighlightTime`, then `highlight-fade` for `Sandbox.UI.BaseTreeView.HighlightFadeTime`.
| Parameter | Type | Description |
|---|---|---|
| row | int | — |
void—protected virtual bool IsRowSelected(int row)
| Parameter | Type | Description |
|---|---|---|
| row | int | — |
bool—public void MoveCursor(int delta, bool range = False)
Move the cursor by some rows, selecting (or range-selecting with shift) where it lands.
| Parameter | Type | Description |
|---|---|---|
| delta | int | — |
| range = False | bool | — |
void—public virtual void OnButtonEvent(Sandbox.UI.ButtonEvent e)
| Parameter | Type | Description |
|---|---|---|
| e | ButtonEvent | — |
void—protected virtual void OnClick(Sandbox.UI.MousePanelEvent e)
| Parameter | Type | Description |
|---|---|---|
| e | MousePanelEvent | — |
void—protected virtual void OnDrop(Sandbox.UI.PanelEvent e)
| Parameter | Type | Description |
|---|---|---|
| e | PanelEvent | — |
void—public virtual void OnHotloaded()
void—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 RebindRows()
Re-run `Sandbox.UI.BaseTreeView.BindRow(System.Int32,Sandbox.UI.TreeRow)` on every bound row without rebuilding the row list.
void—public void Rebuild()
Rebuild everything now instead of waiting for the next tick.
void—protected void RefreshRowStates()
Push selection and open state into every bound row.
void—public void ScrollToRow(int row)
Scroll the least amount that brings this row fully into view.
| Parameter | Type | Description |
|---|---|---|
| row | int | — |
void—public void SelectRow(int row, bool toggle = False, bool range = False)
Select a row the way a click would: plain replaces, ctrl toggles, shift ranges from the anchor.
| Parameter | Type | Description |
|---|---|---|
| row | int | — |
| toggle = False | bool | — |
| range = 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 virtual void Tick()
void—public void ToggleRow(int row, bool recursive = False)
Open or close a row. Shift-click on the expander does it recursively.
| Parameter | Type | Description |
|---|---|---|
| row | int | — |
| recursive = False | bool | — |
void—No results match this filter.
Properties15
Showing 15 properties
public int Sandbox.UI.BaseTreeView.ActiveRowCount { get; set; }
Number of row panels currently bound to a row.
int—public int Sandbox.UI.BaseTreeView.AnchorRow { get; set; }
Where a shift-selection ranges from, or -1.
int—public int Sandbox.UI.BaseTreeView.BindCount { get; set; }
How many times a row panel has been bound. Goes up on scroll and rebuild, never per frame.
int—public int Sandbox.UI.BaseTreeView.CursorRow { get; set; }
The row keyboard navigation moves from, or -1.
int—public bool Sandbox.UI.BaseTreeView.ExpandOnClick { get; set; }
A plain click opens a closed branch before selecting it. Open branches stay open. Ctrl/shift selection and clicks on embedded controls retain their usual behavior.
bool—public bool Sandbox.UI.BaseTreeView.ExpandOnDoubleClick { get; set; }
Double-clicking a closed branch opens it before activation. Open branches stay open. Disable this when the activation handler manages expansion itself.
bool—public float Sandbox.UI.BaseTreeView.HighlightFadeTime { get; set; }
How long the highlight takes to fade out, in seconds. Styled by the `highlight-fade` class.
float—public float Sandbox.UI.BaseTreeView.HighlightTime { get; set; }
How long `Sandbox.UI.BaseTreeView.HighlightRow(System.Int32)` holds before it fades, in seconds.
float—public float Sandbox.UI.BaseTreeView.IndentWidth { get; set; }
Extra left padding per level of depth.
float—public bool Sandbox.UI.BaseTreeView.IsDragging { get; set; }
True while one of our rows is being dragged. The tree carries the `dragging` class.
bool—public bool Sandbox.UI.BaseTreeView.NeedsRebuild { get; set; }
Rebuild the flat row list on the next tick.
bool—public int Sandbox.UI.BaseTreeView.OverscanRows { get; set; }
Rows above and below the viewport that stay bound, so fast scrolls don't flash empty.
int—public int Sandbox.UI.BaseTreeView.PooledRowCount { get; set; }
Number of row panels alive, bound or pooled.
int—public int Sandbox.UI.BaseTreeView.RowCount { get; set; }
Number of rows currently reachable through open parents.
int—public float Sandbox.UI.BaseTreeView.RowHeight { get; set; }
Height of a row when the tree has no per-item height.
float—No results match this filter.