class GUINavGroup

Contains a set of elements that can be navigated between using keyboard or gamepad buttons (i.e. the 'Tab' button)

Public

Methods

staticCreate

static SPtr<GUINavGroup> Create()

Creates a new navigation group.

FocusFirst

void FocusFirst()

Sets the focus to the first element in the group.

FocusNext

void FocusNext(GUIInteractable *anchor)

Sets the focus to the next element in the navigation order.

anchor
Element relative to which to determine the navigation. This is usually the currently focused element.

Private

Methods

RegisterElement

void RegisterElement(GUIInteractable *element, i32 tabIndex = 0)

Registers a new element with the tab group.

Caller must ensure the element has been removed from the previous tab group, if any.

element
Element to register.
tabIndex
Index of the element in the tab group. Set setIndex() for more information on how is the index interpreted.

SetIndex

void SetIndex(GUIInteractable *element, i32 tabIndex)

Sets the index of a previously registered element in the tab group.

The index determines in what order will the element be visited compared to other elements.

Index 0 is reserved and means that tab index will be calculated automatically based on element position. The rest of indices are visited in order from lowest to highest. Negative indices are visited before auto-positioned 0-index element, and positive indices are visited after.

UnregisterElement

void UnregisterElement(GUIInteractable *element)

Unregisters an element from the tab group.

FocusTopLeft

void FocusTopLeft()

Sets the focus to the top-left element.

Only iterates over elements with no explicit tab index.

Fields

mElements

UnorderedMap<GUIInteractable *, i32> mElements

mOrderedElements

MultiMap<i32, GUIInteractable *> mOrderedElements