class GUIClickable

Inherits: GUIInteractable

Base class for a clickable GUI button element.

Public

Methods

SetContent

void SetContent(const GUIContent &content)

Change content displayed by the button.

Fields

OnClick

Event<void ()> OnClick

Triggered when button is clicked.

OnHover

Event<void ()> OnHover

Triggered when pointer hovers over the button.

OnOut

Event<void ()> OnOut

Triggered when pointer that was previously hovering leaves the button.

OnDoubleClick

Event<void ()> OnDoubleClick

Triggered when button is clicked twice in rapid succession.

Internal

Methods

SetOnInternal

void SetOnInternal(bool on)

Change the button "on" state.

This state determines whether the button uses normal or "on" fields specified in the GUI style.

IsOnInternal

bool IsOnInternal() const

Retrieves the button "on" state.

This state determines whether the button uses normal or "on" fields specified in the GUI style.

SetStateInternal

void SetStateInternal(GUIElementState state)

Change the internal button state, changing the button look depending on set style.

CalculateUnconstrainedOptimalSize

GUILogicalSize CalculateUnconstrainedOptimalSize() const override

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

GetRenderElementDepthRange

u32 GetRenderElementDepthRange() const override

Returns the range of depths that the child elements can be rendered it.

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

Constructors

GUIClickable

GUIClickable(const String &styleName, const GUIContent &content, const GUISizeConstraints &sizeConstraints, GUIElementOptions options = GUIElementOption::AcceptsKeyFocus)

Methods

~GUIClickable

~GUIClickable() noexcept override = default

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.

GetTooltip

String GetTooltip() const override

Returns text to display when hovering over the element.

Returns empty string if no tooltip.

NotifyStyleChanged

void NotifyStyleChanged() override

Method that gets triggered whenever element style changes.

GetState

GUIElementState GetState() const

Retrieves internal button state.

Fields

mBackgroundSprite

GUIBackgroundSprite mBackgroundSprite

mContentSprites

GUIContentSprites mContentSprites

mActiveState

GUIElementState mActiveState

mContent

GUIContent mContent

mHasFocus

bool mHasFocus