API ReferenceSandbox.UI

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.

object→Panel→BaseTreeView
Namespace
Sandbox.UI
Assembly
Sandbox.Engine
Declaration
public abstract class Sandbox.UI.BaseTreeView : Sandbox.UI.Panel

Constructors1

Showing 1 constructors

Methods35

Showing 35 methods

protected void AddRow(float height, int depth, bool hasChildren, bool isOpen)PROTECTED

Append a row during `Sandbox.UI.BaseTreeView.BuildRows`.

ParameterTypeDescription
heightfloat—
depthint—
hasChildrenbool—
isOpenbool—
Returns:void—

public void BeginRename(int row)PUBLIC

Start renaming a row's label in place, scrolling it into view first if needed.

ParameterTypeDescription
rowint—
Returns:void—

protected virtual void BindRow(int row, Sandbox.UI.TreeRow panel)PROTECTEDVIRTUAL

Fill a pooled row panel with the item at this row.

ParameterTypeDescription
rowint—
panelTreeRow—
Returns:void—

protected virtual void BuildRows()PROTECTEDVIRTUAL

Walk the data and call `Sandbox.UI.BaseTreeView.AddRow(System.Single,System.Int32,System.Boolean,System.Boolean)` for every reachable row, in order.

Returns:void—

protected virtual bool CanRenameRow(int row)PROTECTEDVIRTUAL

ParameterTypeDescription
rowint—
Returns:bool—

protected virtual void CheckForChanges()PROTECTEDVIRTUAL

Cheap per-tick check for data that changed underneath us. Set `Sandbox.UI.BaseTreeView.NeedsRebuild` if so.

Returns:void—

public void ClearSelection()PUBLIC

Drop the selection, keeping the cursor.

Returns:void—

protected virtual void ClearSelectionInternal()PROTECTEDVIRTUAL

Returns:void—

protected virtual void FinalLayoutChildren(Vector2 offset)PROTECTEDVIRTUAL

ParameterTypeDescription
offsetVector2—
Returns:void—

public int GetParentRow(int row)PUBLIC

The nearest row above with one less depth, or -1 for a root.

ParameterTypeDescription
rowint—
Returns:int—

protected Sandbox.UI.BaseTreeView.RowLayout GetRow(int row)PROTECTED

Layout of a row.

ParameterTypeDescription
rowint—
Returns:RowLayout—

public int GetRowDepth(int row)PUBLIC

Depth of a row, roots being zero.

ParameterTypeDescription
rowint—
Returns:int—

public Sandbox.UI.TreeRow GetRowPanel(int row)PUBLIC

The bound panel for a row, or null if it isn't in the viewport.

ParameterTypeDescription
rowint—
Returns:TreeRow—

public int GetSubtreeEnd(int row)PUBLIC

One past the last row inside this row's subtree.

ParameterTypeDescription
rowint—
Returns:int—

public void HighlightRow(int row)PUBLIC

Flash a row so the eye finds it: the `highlight` class for `Sandbox.UI.BaseTreeView.HighlightTime`, then `highlight-fade` for `Sandbox.UI.BaseTreeView.HighlightFadeTime`.

ParameterTypeDescription
rowint—
Returns:void—

protected virtual bool IsRowSelected(int row)PROTECTEDVIRTUAL

ParameterTypeDescription
rowint—
Returns:bool—

public void MoveCursor(int delta, bool range = False)PUBLIC

Move the cursor by some rows, selecting (or range-selecting with shift) where it lands.

ParameterTypeDescription
deltaint—
range = Falsebool—
Returns:void—

public virtual void OnButtonEvent(Sandbox.UI.ButtonEvent e)PUBLICVIRTUAL

ParameterTypeDescription
eButtonEvent—
Returns:void—

protected virtual void OnDrop(Sandbox.UI.PanelEvent e)PROTECTEDVIRTUAL

ParameterTypeDescription
ePanelEvent—
Returns:void—

public virtual void OnHotloaded()PUBLICVIRTUAL

Returns:void—

protected virtual void OnRowActivated(int row)PROTECTEDVIRTUAL

ParameterTypeDescription
rowint—
Returns:void—

protected virtual void OnRowContextMenu(int row)PROTECTEDVIRTUAL

ParameterTypeDescription
rowint—
Returns:void—

protected virtual void OnRowDropped(int targetRow, int sourceRow)PROTECTEDVIRTUAL

ParameterTypeDescription
targetRowint—
sourceRowint—
Returns:void—

protected virtual void OnRowRenamed(int row, string text)PROTECTEDVIRTUAL

ParameterTypeDescription
rowint—
textstring—
Returns:void—

protected virtual void OnSelectionFinished()PROTECTEDVIRTUAL

Returns:void—

public void RebindRows()PUBLIC

Re-run `Sandbox.UI.BaseTreeView.BindRow(System.Int32,Sandbox.UI.TreeRow)` on every bound row without rebuilding the row list.

Returns:void—

public void Rebuild()PUBLIC

Rebuild everything now instead of waiting for the next tick.

Returns:void—

protected void RefreshRowStates()PROTECTED

Push selection and open state into every bound row.

Returns:void—

public void ScrollToRow(int row)PUBLIC

Scroll the least amount that brings this row fully into view.

ParameterTypeDescription
rowint—
Returns:void—

public void SelectRow(int row, bool toggle = False, bool range = False)PUBLIC

Select a row the way a click would: plain replaces, ctrl toggles, shift ranges from the anchor.

ParameterTypeDescription
rowint—
toggle = Falsebool—
range = Falsebool—
Returns:void—

protected virtual void SetRowOpen(int row, bool open, bool recursive)PROTECTEDVIRTUAL

ParameterTypeDescription
rowint—
openbool—
recursivebool—
Returns:void—

protected virtual void SetRowSelected(int row, bool selected)PROTECTEDVIRTUAL

ParameterTypeDescription
rowint—
selectedbool—
Returns:void—

public virtual void Tick()PUBLICVIRTUAL

Returns:void—

public void ToggleRow(int row, bool recursive = False)PUBLIC

Open or close a row. Shift-click on the expander does it recursively.

ParameterTypeDescription
rowint—
recursive = Falsebool—
Returns:void—

Properties15

Showing 15 properties

public int Sandbox.UI.BaseTreeView.ActiveRowCount { get; set; }PUBLICGETSET

Number of row panels currently bound to a row.

Returns:int—

public int Sandbox.UI.BaseTreeView.AnchorRow { get; set; }PUBLICGETSET

Where a shift-selection ranges from, or -1.

Returns:int—

public int Sandbox.UI.BaseTreeView.BindCount { get; set; }PUBLICGETSETPER-FRAME

How many times a row panel has been bound. Goes up on scroll and rebuild, never per frame.

Returns:int—

public int Sandbox.UI.BaseTreeView.CursorRow { get; set; }PUBLICGETSET

The row keyboard navigation moves from, or -1.

Returns:int—

public bool Sandbox.UI.BaseTreeView.ExpandOnClick { get; set; }PUBLICGETSET

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.

Returns:bool—

public bool Sandbox.UI.BaseTreeView.ExpandOnDoubleClick { get; set; }PUBLICGETSET

Double-clicking a closed branch opens it before activation. Open branches stay open. Disable this when the activation handler manages expansion itself.

Returns:bool—

public float Sandbox.UI.BaseTreeView.HighlightFadeTime { get; set; }PUBLICGETSET

How long the highlight takes to fade out, in seconds. Styled by the `highlight-fade` class.

Returns:float—

public float Sandbox.UI.BaseTreeView.HighlightTime { get; set; }PUBLICGETSET

How long `Sandbox.UI.BaseTreeView.HighlightRow(System.Int32)` holds before it fades, in seconds.

Returns:float—

public float Sandbox.UI.BaseTreeView.IndentWidth { get; set; }PUBLICGETSET

Extra left padding per level of depth.

Returns:float—

public bool Sandbox.UI.BaseTreeView.IsDragging { get; set; }PUBLICGETSET

True while one of our rows is being dragged. The tree carries the `dragging` class.

Returns:bool—

public bool Sandbox.UI.BaseTreeView.NeedsRebuild { get; set; }PUBLICGETSET

Rebuild the flat row list on the next tick.

Returns:bool—

public int Sandbox.UI.BaseTreeView.OverscanRows { get; set; }PUBLICGETSET

Rows above and below the viewport that stay bound, so fast scrolls don't flash empty.

Returns:int—

public int Sandbox.UI.BaseTreeView.PooledRowCount { get; set; }PUBLICGETSET

Number of row panels alive, bound or pooled.

Returns:int—

public int Sandbox.UI.BaseTreeView.RowCount { get; set; }PUBLICGETSET

Number of rows currently reachable through open parents.

Returns:int—

public float Sandbox.UI.BaseTreeView.RowHeight { get; set; }PUBLICGETSET

Height of a row when the tree has no per-item height.

Returns:float—

On this page

Constructorsprotected BaseTreeView()Methodsprotected System.Void AddRow(System.Single height, System.Int32 depth, System.Boolean hasChildren, System.Boolean isOpen)public System.Void BeginRename(System.Int32 row)protected virtual System.Void BindRow(System.Int32 row, Sandbox.UI.TreeRow panel)protected virtual System.Void BuildRows()protected virtual System.Boolean CanRenameRow(System.Int32 row)protected virtual System.Void CheckForChanges()public System.Void ClearSelection()protected virtual System.Void ClearSelectionInternal()protected virtual System.Void FinalLayoutChildren(Vector2 offset)public System.Int32 GetParentRow(System.Int32 row)protected Sandbox.UI.BaseTreeView.RowLayout GetRow(System.Int32 row)public System.Int32 GetRowDepth(System.Int32 row)public Sandbox.UI.TreeRow GetRowPanel(System.Int32 row)public System.Int32 GetSubtreeEnd(System.Int32 row)public System.Void HighlightRow(System.Int32 row)protected virtual System.Boolean IsRowSelected(System.Int32 row)public System.Void MoveCursor(System.Int32 delta, System.Boolean range = False)public virtual System.Void OnButtonEvent(Sandbox.UI.ButtonEvent e)protected virtual System.Void OnClick(Sandbox.UI.MousePanelEvent e)protected virtual System.Void OnDrop(Sandbox.UI.PanelEvent e)public virtual System.Void OnHotloaded()protected virtual System.Void OnRowActivated(System.Int32 row)protected virtual System.Void OnRowContextMenu(System.Int32 row)protected virtual System.Void OnRowDropped(System.Int32 targetRow, System.Int32 sourceRow)protected virtual System.Void OnRowRenamed(System.Int32 row, System.String text)protected virtual System.Void OnSelectionFinished()public System.Void RebindRows()public System.Void Rebuild()protected System.Void RefreshRowStates()public System.Void ScrollToRow(System.Int32 row)public System.Void SelectRow(System.Int32 row, System.Boolean toggle = False, System.Boolean range = False)protected virtual System.Void SetRowOpen(System.Int32 row, System.Boolean open, System.Boolean recursive)protected virtual System.Void SetRowSelected(System.Int32 row, System.Boolean selected)public virtual System.Void Tick()public System.Void ToggleRow(System.Int32 row, System.Boolean recursive = False)Propertiespublic System.Int32 Sandbox.UI.BaseTreeView.ActiveRowCount { get; set; }public System.Int32 Sandbox.UI.BaseTreeView.AnchorRow { get; set; }public System.Int32 Sandbox.UI.BaseTreeView.BindCount { get; set; }public System.Int32 Sandbox.UI.BaseTreeView.CursorRow { get; set; }public System.Boolean Sandbox.UI.BaseTreeView.ExpandOnClick { get; set; }public System.Boolean Sandbox.UI.BaseTreeView.ExpandOnDoubleClick { get; set; }public System.Single Sandbox.UI.BaseTreeView.HighlightFadeTime { get; set; }public System.Single Sandbox.UI.BaseTreeView.HighlightTime { get; set; }public System.Single Sandbox.UI.BaseTreeView.IndentWidth { get; set; }public System.Boolean Sandbox.UI.BaseTreeView.IsDragging { get; set; }public System.Boolean Sandbox.UI.BaseTreeView.NeedsRebuild { get; set; }public System.Int32 Sandbox.UI.BaseTreeView.OverscanRows { get; set; }public System.Int32 Sandbox.UI.BaseTreeView.PooledRowCount { get; set; }public System.Int32 Sandbox.UI.BaseTreeView.RowCount { get; set; }public System.Single Sandbox.UI.BaseTreeView.RowHeight { get; set; }Metadata