Table of Contents

Class ListInputElement<TElementContainer, TElement>

Namespace
RichHudFramework.UI
Assembly
RichHudClient.dll

Specialized MouseInputElement that manages selection, mouse highlighting, and keyboard navigation for scrollable lists (vertical or horizontal). Supports both mouse and keyboard-driven selection.

public class ListInputElement<TElementContainer, TElement> : MouseInputElement, IReadOnlyHudElement, IReadOnlyHudNode, IReadOnlyHudParent, IMouseInput, IFocusableElement where TElementContainer : class, IScrollBoxEntry<TElement>, new() where TElement : HudElementBase, IMinLabelElement

Type Parameters

TElementContainer

Container type that holds each list entry (must implement IScrollBoxEntry<TElement>)

TElement

The actual UI element type displayed in each entry (must be a labeled element)

Inheritance
ListInputElement<TElementContainer, TElement>
Implements
Inherited Members

Constructors

ListInputElement(HudChain<TElementContainer, TElement>)

public ListInputElement(HudChain<TElementContainer, TElement> parent)

Parameters

parent HudChain<TElementContainer, TElement>

ListInputElement(HudElementBase, IReadOnlyHudCollection<TElementContainer, TElement>)

public ListInputElement(HudElementBase parent, IReadOnlyHudCollection<TElementContainer, TElement> entries)

Parameters

parent HudElementBase
entries IReadOnlyHudCollection<TElementContainer, TElement>

Properties

Entries

Read-only view of all entries managed by this input element.

public IReadOnlyHudCollection<TElementContainer, TElement> Entries { get; }

Property Value

IReadOnlyHudCollection<TElementContainer, TElement>

FocusIndex

Index of the entry that currently has keyboard focus for navigation.

public int FocusIndex { get; }

Property Value

int

HighlightIndex

Index of the entry currently highlighted by the mouse cursor (or keyboard navigation when active). Always valid (clamped) even if the list is empty.

public int HighlightIndex { get; }

Property Value

int

KeyboardScroll

Indicates whether keyboard arrow keys are currently being used to navigate the list. When true, mouse movement will temporarily disable keyboard scrolling until a new key is pressed.

public bool KeyboardScroll { get; protected set; }

Property Value

bool

ListPos

Local position of the top-left corner of the visible list area relative to this element.

public Vector2 ListPos { get; set; }

Property Value

Vector2

ListRange

Range of entry indices currently visible within the scrollable viewport (inclusive). X = first visible index, Y = last visible index.

public Vector2I ListRange { get; set; }

Property Value

Vector2I

ListSize

Total size of the visible portion of the list (width × height).

public Vector2 ListSize { get; set; }

Property Value

Vector2

Selection

Currently selected entry. Returns null/default if no selection or list is empty.

public TElementContainer Selection { get; }

Property Value

TElementContainer

SelectionIndex

Index of the currently selected entry. Returns -1 if nothing is selected.

public int SelectionIndex { get; }

Property Value

int

Methods

ClearSelection()

Removes the current selection and resets highlight/focus to the first entry.

public void ClearSelection()

OffsetSelectionIndex(int, bool)

Moves the current selection up/down by the given offset. Skips disabled entries. If wrap is true, selection wraps around the list edges.

public void OffsetSelectionIndex(int offset, bool wrap = false)

Parameters

offset int
wrap bool

SetSelection(TElementContainer)

Sets the selection to the specified entry.

public void SetSelection(TElementContainer member)

Parameters

member TElementContainer

SetSelectionAt(int)

Selects the entry at the specified index (clamped to valid range). Disabled entries are skipped automatically. Triggers SelectionChanged if the selection actually changes.

public void SetSelectionAt(int index)

Parameters

index int

Events

SelectionChanged

Invoked whenever the selected entry changes (including clearing selection).

public event EventHandler SelectionChanged

Event Type

EventHandler