class GUIToggleable

Inherits: GUIClickable

GUI element representing a toggleable button.

Public

Methods

SetIsToggled

void SetIsToggled(bool isToggled)

Checks or unchecks the toggle.

IsToggled

bool IsToggled() const

Checks is the toggle currently on.

Fields

OnToggled

Event<void (bool)> OnToggled

Triggered whenever the button is toggled on or off.

Internal

Methods

SetToggleGroupInternal

void SetToggleGroupInternal(SPtr<GUIToggleGroup> toggleGroup)

Sets a toggle group of the toggle button.

Toggling one button in a group will automatically untoggle others.

SetCheckmarkPathBuilder

void SetCheckmarkPathBuilder(const IGUIVectorPathBuilder *pathBuilder)

Sets an interface that constructs the vector path used for drawing the GUI element checkmark.

SetIsToggled

virtual void SetIsToggled(bool isToggled, bool triggerEvent)

Checks or unchecks the toggle, and optionally triggers the OnToggled event.

CalculateUnconstrainedOptimalSize

GUILogicalSize CalculateUnconstrainedOptimalSize() const override

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

Protected

Constructors

GUIToggleable

GUIToggleable(const GUIToggleContent &contents, const String &styleName, const GUISizeConstraints &dimensions)

Methods

~GUIToggleable

virtual ~GUIToggleable() noexcept

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 &event) 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 &event) 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.

NotifyStyleChanged

void NotifyStyleChanged() override

Method that gets triggered whenever element style changes.

CalculateCheckmarkContentAreaSize

GUILogicalSize CalculateCheckmarkContentAreaSize(const GUILogicalSize &elementOptimalSize) const

Calculates the bounds of the content are in which the checkmark will be placed.

elementOptimalSize
Unconstrained optimal size for the GUI element. Will be used to derive checkmark area size if explicit size is not provided in the style sheet.

Fields

mCheckmarkSprite

ImageSprite * mCheckmarkSprite

mCheckmarkSpriteInformation

ImageSpriteInformation mCheckmarkSpriteInformation

mCheckmarkPathBuilder

const IGUIVectorPathBuilder * mCheckmarkPathBuilder

mCheckmarkPseudoElementIndex

u32 mCheckmarkPseudoElementIndex

mToggleGroup

SPtr<GUIToggleGroup> mToggleGroup

mIsToggled

bool mIsToggled

mCheckmarkSizeConstraints

GUISizeConstraints mCheckmarkSizeConstraints