class GUIListBox

List box GUI element which when active opens a drop down selection with provided elements.

Public

Methods

staticGetGuiTypeName

static const String &GetGuiTypeName()

Returns type name of the GUI element used for finding GUI element styles.

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 index)

Makes the element with the specified index selected.

DeselectElement

void DeselectElement(u32 index)

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.

staticCreate

static GUIElementType *Create(const ContentType &contents, const String &styleClass, const TInlineArray<GUIOption, 4> &options)

Creates a new GUI element.

contents
Structure describing the contents of the GUI element to create.
styleClass
Style class that will be used for determining GUI element visuals from the current style sheet. If no class is provided, default style is determined based on GUI element type.
options
Additional options that control GUI element size and position. This will override options set in the style sheet.

Fields

OnSelectionToggled

Event<void (u32, bool)> OnSelectionToggled

Triggered whenever user selects or deselects an element in the list box.

Returned index maps to the element in the elements array that the list box was initialized with.

Internal

Constructors

GUIListBox

GUIListBox(PrivatelyConstruct, const GUIListBoxContent &content, const String &styleName, const GUISizeConstraints &sizeConstraints)

Methods

GetStyleSheetElement

const char *GetStyleSheetElement() const override

Returns the name of the GUI element type to be used for style lookup in the style sheet.

Protected

Methods

~GUIListBox

~GUIListBox() noexcept

Private

Methods

GetContentBounds

GUILogicalArea GetContentBounds() const override

Similar to GetAbsoluteContentBounds(), except the bounds are relative to the parent GUI element rather than the parent widget.

UpdateRenderElements

void UpdateRenderElements() override

Recreates the internal render elements.

Must be called before GetRenderElementVertexAndIndexData/FillBuffer if element is dirty. Marks the element as non dirty.

DoOnMouseEvent

bool DoOnMouseEvent(const GUIMouseEvent &ev) override

Called when a mouse event is received on any GUI element the mouse is interacting with.

Return true if you have processed the event and don't want other elements to process it.

DoOnCommandEvent

bool DoOnCommandEvent(const GUICommandEvent &ev) override

Called when a command event is triggered.

Return true if you have processed the event and don't want other elements to process it.

GetArrowCachedContentBoundsInElementSpace

GUIPhysicalArea GetArrowCachedContentBoundsInElementSpace() const

Returns the area in which the arrow box will be placed, relative to the GUI element.

GetArrowCachedContentSize

GUILogicalSize GetArrowCachedContentSize() const

Returns the width/height of the arrow box.

ElementSelected

void ElementSelected(u32 idx)

Triggered when user clicks on an element.

OpenListBox

void OpenListBox()

Opens the list box drop down menu.

CloseListBox

void CloseListBox()

Closes the list box drop down menu.

OnListBoxClosed

void OnListBoxClosed()

Called when the list box drop down menu is closed by external influence.

UpdateContents

void UpdateContents()

Updates visible contents depending on selected element(s).

Fields

mElements

Vector<HString> mElements

mElementStates

Vector<bool> mElementStates

mDropDownBox

mArrowSprite

ImageSprite * mArrowSprite

mArrowSpriteInformation

ImageSpriteInformation mArrowSpriteInformation

mArrowPathBuilder

const IGUIVectorPathBuilder * mArrowPathBuilder

mArrowPseudoElementIndex

u32 mArrowPseudoElementIndex

mIsMultiselect

bool mIsMultiselect