Table of Contents

Class ListBox<TContainer, TElement, TValue>

Namespace
RichHudFramework.UI
Assembly
RichHudClient.dll

Generic scrollable list of text elements. Allows use of custom entry element types. Each list entry is associated with a TValue

public class ListBox<TContainer, TElement, TValue> : ScrollSelectionBox<TContainer, TElement, TValue>, IReadOnlyHudElement, IReadOnlyHudNode, IReadOnlyHudParent, 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
SelectionBoxBase<ScrollBox<TContainer, TElement>, TContainer, TElement>
SelectionBox<ScrollBox<TContainer, TElement>, TContainer, TElement, TValue>
ScrollSelectionBox<TContainer, TElement, TValue>
ListBox<TContainer, TElement, TValue>
Implements
IEntryBox<TContainer, TElement>
IEnumerable<TContainer>
IValueControl<TContainer>
Derived
Inherited Members

Examples

new ListBox<Color>(parent)
{
    // Set background color to selection value
    UpdateValueCallback = (obj, args) =>
    {
        var listBox = (ListBox<Color>)obj;
        MyAPIGateway.Utilities.ShowMessage(
            $"[{listBox.GetType().Name}]",
            $"Key: {listBox.Value.Element.Text} - Value: {listBox.Value.AssocMember}");

        listBox.Color = listBox.Value.AssocMember;
    },
    ListContainer =
    {
        { "Color 1", Color.Red },
        { "Color 2", Color.Plum },
        { "Color 3", Color.Green },
        { "Default", TerminalFormatting.DarkSlateGrey }
    }
}

Remarks

ListBox<TValue> is used as an alias to simplify common usages by defaulting TContainer and TElement to ListBoxEntry<TElement, TValue> and Label, respectively.

Constructors

ListBox()

public ListBox()

ListBox(HudParentBase)

public ListBox(HudParentBase parent)

Parameters

parent HudParentBase

Properties

BarColor

Color of the slider bar

public Color BarColor { get; set; }

Property Value

Color

BarHighlight

Bar color when moused over

public Color BarHighlight { get; set; }

Property Value

Color

ListPos

Returns the coordinates of the center of the list area

protected override Vector2 ListPos { get; }

Property Value

Vector2

ListRange

Range of element indices representing the visible area, plus padding to allow for smooth clipping. Used for scissor rect masking.

protected override Vector2I ListRange { get; }

Property Value

Vector2I

ListSize

Returns dimensions of the area occupied by list entries

protected override Vector2 ListSize { get; }

Property Value

Vector2

SliderColor

Color of the slider box when not moused over

public Color SliderColor { get; set; }

Property Value

Color

SliderHighlight

Color of the slider button when moused over

public Color SliderHighlight { get; set; }

Property Value

Color