class GUIListBoxFieldBase

Public

Methods

IsMultiselect

bool IsMultiselect() const

Checks whether the listbox supports multiple selected elements at once.

SetElements

void SetElements(const Vector<HString> &elements)

Changes the list box elements.

SelectElement

void SelectElement(u32 elementIndex)

Selects an element with the specified index.

DeselectElement

void DeselectElement(u32 elementIndex)

Deselect element the element with the specified index.

Only relevant for multi-select list boxes.

GetSelectedElementIndex

u32 GetSelectedElementIndex() const

Returns the index of the currently selected element.

If the list box allows multi-select, returns the index of the first selected element, or ~0u if none is selected.

GetElementStates

const Vector<bool> &GetElementStates() const

Returns states of all element in the list box (enabled or disabled).

SetElementStates

void SetElementStates(const Vector<bool> &states)

Sets states for all list box elements.

Only valid for multi-select list boxes. Number of states must match number of list box elements.

SetTint

void SetTint(const Color &color) override

Sets the tint of the GUI element.

Fields

OnSelectionChanged

Event<void (u32, bool)> OnSelectionChanged

Triggers when a new element is selected.

Provides index to the element.

Protected

Constructors

GUIListBoxFieldBase

GUIListBoxFieldBase(const GUIListBoxFieldContent &content, const String &style, const GUISizeConstraints &sizeConstraints)

Methods

~GUIListBoxFieldBase

virtual ~GUIListBoxFieldBase() noexcept = default

UpdateLayoutForChildren

void UpdateLayoutForChildren() override

Calculates sizes and relative positions for all child elements.

Should be preceded with a call to UpdateOptimalLayoutSizes().

CalculateUnconstrainedOptimalSize

GUILogicalSize CalculateUnconstrainedOptimalSize() const override

Calculates the optimal size for the GUI element, ignoring size constraints.

DoOnSelectionChanged

virtual void DoOnSelectionChanged(u32 newIndex, bool enabled)

Triggered when the selected list box element changes.

Fields

mListBox

GUIListBox * mListBox

mLayout

GUILayout * mLayout

mLabel

GUILabel * mLabel