class GUIIntField

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 integer input field.

Public

Constructors

GUIIntField

GUIIntField(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(i32 value)

Current value in the input field.

Value will be clamped according to range and step.

GetValue

i32 GetValue() const

SetRange

void SetRange(i32 min, i32 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(i32 step)

Determines the minimum change allowed for the input field.

GetStep

i32 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 (i32)> OnValueChanged

Triggers when the internal 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(i32 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

~GUIIntField

virtual ~GUIIntField() 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(i32 value)

Updates the underlying input box with the text representing the provided integer value.

ApplyRangeAndStep

i32 ApplyRangeAndStep(i32 value) const

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

staticIntFilter

static bool IntFilter(const String &str)

Callback that checks can the provided string be converted to an integer value.

Fields

mInputBox

GUIInputBox * mInputBox

mValue

i32 mValue

mLastDragPos

GUIPhysicalUnit mLastDragPos

mMinValue

i32 mMinValue

mMaxValue

i32 mMaxValue

mStep

i32 mStep

mIsDragging

bool mIsDragging

mIsDragCursorSet

bool mIsDragCursorSet

mHasInputFocus

bool mHasInputFocus