class GUIFloatField

A composite GUI object representing an editor field.

Editor fields are a combination of a label and an input field. Label is optional. This specific implementation displays a floating point input field.

Public

Constructors

GUIFloatField

GUIFloatField(const PrivatelyConstruct &dummy, const GUIContent &labelContent, u32 labelWidth, const String &style, const GUISizeConstraints &dimensions, bool withLabel)

Methods

staticGetGuiTypeName

static const String &GetGuiTypeName()

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

SetValue

void SetValue(float value)

Current value in the input field.

Value will be clamped according to range and step.

GetValue

float GetValue() const

SetRange

void SetRange(float min, float max)

Sets a minimum and maximum allowed values in the input field.

Set to large negative/positive values if you don't require clamping.

SetStep

void SetStep(float step)

Determines the minimum change allowed for the input field.

GetStep

float GetStep() const

HasInputFocus

bool HasInputFocus() const

Checks is the input field currently active.

SetTint

void SetTint(const Color &color) override

Sets the tint of the GUI element.

staticCreate

static T *Create(const GUIContent &labelContent, u32 labelWidth, const String &styleClass = StringUtility::kBlank)

Creates a new GUI editor field with a label.

labelContent
Content to display in the editor field label.
labelWidth
Width of the label in pixels.
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.

Fields

OnValueChanged

Event<void (float)> OnValueChanged

Triggers when the field value changes.

OnConfirm

Event<void ()> OnConfirm

Triggered when the user hits the Enter key with the input box in focus.

Internal

Methods

SetValueInternal

void SetValueInternal(float value, bool triggerEvent)

Sets a new value in the input field, and also allows you to choose should the field trigger an onValueChanged event.

Protected

Methods

~GUIFloatField

virtual ~GUIFloatField() noexcept = default

HasCustomCursor

bool HasCustomCursor(const GUIPhysicalPoint &position, CursorType &type) const override

Checks if the GUI element has a custom cursor and outputs the cursor type if it does.

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.

ValueChanged

void ValueChanged(const String &newValue)

Triggered when the input box value changes.

DoOnFocusGained

void DoOnFocusGained()

Triggers when the input box receives keyboard focus.

DoOnFocusLost

void DoOnFocusLost()

Triggers when the input box loses keyboard focus.

InputConfirmed

void InputConfirmed()

Triggered when the users confirms input in the input box.

SetText

void SetText(float value)

Updates the underlying input box with the text representing the provided floating point value.

ApplyRangeAndStep

float ApplyRangeAndStep(float value) const

Clamps the provided value to current valid range, and step interval.

staticFloatFilter

static bool FloatFilter(const String &str)

Callback that checks can the provided string be converted to a floating point value.

Fields

mInputBox

GUIInputBox * mInputBox

mValue

float mValue

mLastDragPos

GUIPhysicalUnit mLastDragPos

mMinValue

float mMinValue

mMaxValue

float mMaxValue

mStep

float mStep

mIsDragging

bool mIsDragging

mHasInputFocus

bool mHasInputFocus