UUxtToggleGroupComponent
Component which controls the state of a collection of UUxtToggleStateComponent to behave like a radio group. The component ensures that only one toggle state can be toggled on at a time. Optionally, all states can be toggled off if the SelectedIndex is set to INDEX_NONE.
class UUxtToggleGroupComponent;
Header
#include <Controls/UxtToggleGroupComponent.h>
Inheritance
Inherits from UActorComponent
Protected Types
Name | |
---|---|
typedef TWeakObjectPtr< UUxtToggleStateComponent > | ToggleStateWeak |
Public Functions
Name | |
---|---|
void | SetSelectedIndex(int32 Index) |
int32 | GetSelectedIndex() const |
bool | AddToggleState(UUxtToggleStateComponent * ToggleState) |
bool | InsertToggleState(UUxtToggleStateComponent * ToggleState, int32 Index) |
bool | RemoveToggleState(UUxtToggleStateComponent * ToggleState) |
void | EmptyGroup() |
int32 | GetGroupCount() const |
int32 | GetToggleStateIndex(const UUxtToggleStateComponent * ToggleState) const |
Protected Functions
Name | |
---|---|
virtual void | BeginPlay() override |
virtual void | OnToggled(UUxtToggleStateComponent * ToggleState) |
Public Attributes
Name | |
---|---|
FUxtToggleGroupSelectionChangedDelegate | OnGroupSelectionChanged |
Protected Attributes
Name | |
---|---|
TArray< ToggleStateWeak > | ToggleStates |
Protected Types Documentation
typedef ToggleStateWeak
typedef TWeakObjectPtr<UUxtToggleStateComponent> UUxtToggleGroupComponent::ToggleStateWeak;
Public Functions Documentation
function SetSelectedIndex
void SetSelectedIndex(
int32 Index
)
Mutates the selected index, broadcasts events, and performs bounds checking.
function GetSelectedIndex
inline int32 GetSelectedIndex() const
Accessor to the selected index.
function AddToggleState
bool AddToggleState(
UUxtToggleStateComponent * ToggleState
)
Adds a toggle state to the end of the ToggleStates list. Returns true if the insertion was successful.
function InsertToggleState
bool InsertToggleState(
UUxtToggleStateComponent * ToggleState,
int32 Index
)
Adds a toggle state to a specific index within the ToggleStates list. Increments the selection index if the toggle state is added before the current selection index. Returns true if the insertion was successful.
function RemoveToggleState
bool RemoveToggleState(
UUxtToggleStateComponent * ToggleState
)
Removes a toggle state from the ToggleStates list. Returns true if the removal was successful.
function EmptyGroup
void EmptyGroup()
Removes all toggle states from the ToggleStates list and invalidates the selected index.
function GetGroupCount
inline int32 GetGroupCount() const
Returns how many toggle states are within the group.
function GetToggleStateIndex
int32 GetToggleStateIndex(
const UUxtToggleStateComponent * ToggleState
) const
Returns the index of the ToggleState in the ToggleStates list, if the ToggleState does not exist returns INDEX_NONE (-1).
Protected Functions Documentation
function BeginPlay
virtual void BeginPlay() override
Extracts references from the ToggleReferences and sets the initial selection.
function OnToggled
virtual void OnToggled(
UUxtToggleStateComponent * ToggleState
)
Delegate for when any toggle state within ToggleStates is toggled.
Public Attributes Documentation
variable OnGroupSelectionChanged
FUxtToggleGroupSelectionChangedDelegate OnGroupSelectionChanged;
Event which broadcasts when the toggle group selection changes.
Protected Attributes Documentation
variable ToggleStates
TArray< ToggleStateWeak > ToggleStates;
A collection of toggle states that act as one toggle group, only one state can be toggle on at a time.
Updated on 2 November 2021 at 11:40:26 Coordinated Universal Time