Table of Contents

Class TreeList<TContainer, TElement, TValue>

Namespace
RichHudFramework.UI
Assembly
RichHudClient.dll

Generic indented collapsable list of pooled, uniformly-sized entries. Allows use of custom entry element types. Designed to fit in with SE UI elements.

public class TreeList<TContainer, TElement, TValue> : TreeBoxBase<ChainSelectionBox<TContainer, TElement, TValue>, HudChain<TContainer, TElement>, TContainer, TElement>, IReadOnlyHudElement, IReadOnlyHudNode, IReadOnlyHudParent, IMinLabelElement, IEntryBox<TContainer, TElement>, IEnumerable<TContainer>, IEnumerable, IValueControl<TContainer>, IValueControl, IClickableElement, IFocusableElement where TContainer : class, IListBoxEntry<TElement, TValue>, new() where TElement : HudElementBase, IMinLabelElement

Type Parameters

TContainer

Container element type wrapping the UI element

TElement

UI element in the list

TValue

Value paired with the list entry

Inheritance
TreeBoxBase<ChainSelectionBox<TContainer, TElement, TValue>, HudChain<TContainer, TElement>, TContainer, TElement>
TreeList<TContainer, TElement, TValue>
Implements
IEntryBox<TContainer, TElement>
IEnumerable<TContainer>
IValueControl<TContainer>
Derived
Inherited Members

Examples

new TreeList<string>(parent)
{
    Name = "Custom TreeList Label",
    UpdateValueCallback = (obj, args) =>
    {
        var treeList = (TreeList<string>)obj;
        MyAPIGateway.Utilities.ShowMessage(
            $"[{treeList.GetType().Name}]",
            $"Selected: {treeList.Value.AssocMember}");
    },
    ListContainer = 
    {
        { "Label 1", "Key 1" },
        { "Label 2", "Key 2" },
        { "Label 3", "Key 3" },
        { "Label 4", "Key 4" },
        { "Label 5", "Key 5" },
        { "Label 6", "Key 6" }
    }
};

Remarks

There are two aliases for TreeLists used to simplify common usages:

Constructors

TreeList()

public TreeList()

TreeList(HudParentBase)

public TreeList(HudParentBase parent)

Parameters

parent HudParentBase

Properties

LineHeight

Uniform height applied to list entries

public float LineHeight { get; set; }

Property Value

float

ListContainer

Enables collection-initializer syntax (e.g., new TreeList { ListContainer = { entry1, entry2 } })

public TreeList<TContainer, TElement, TValue> ListContainer { get; }

Property Value

TreeList<TContainer, TElement, TValue>

Methods

Add(RichText, TValue, bool)

Adds a new member to the tree box with the given name and associated object.

public TContainer Add(RichText name, TValue assocMember, bool enabled = true)

Parameters

name RichText
assocMember TValue
enabled bool

Returns

TContainer

AddRange(IReadOnlyList<MyTuple<RichText, TValue, bool>>)

Adds the given range of entries to the tree box.

public void AddRange(IReadOnlyList<MyTuple<RichText, TValue, bool>> entries)

Parameters

entries IReadOnlyList<MyTuple<RichText, TValue, bool>>

ClearEntries()

Clears the current selection

public void ClearEntries()

Insert(int, RichText, TValue, bool)

Inserts an entry at the given index.

public void Insert(int index, RichText name, TValue assocMember, bool enabled = true)

Parameters

index int
name RichText
assocMember TValue
enabled bool

RemoveAt(int)

Removes the member at the given index from the tree box.

public void RemoveAt(int index)

Parameters

index int

RemoveRange(int, int)

Removes the specified range of indices from the tree box.

public void RemoveRange(int index, int count)

Parameters

index int
count int

SetSelection(TValue)

Sets the selection to the member associated with the given object.

public void SetSelection(TValue assocMember)

Parameters

assocMember TValue