class GUITextField

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

Public

Methods

staticGetGuiTypeName

static const String &GetGuiTypeName()

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

SetValue

void SetValue(const String &value)

Value in the text field.

GetValue

String GetValue() const

HasInputFocus

bool HasInputFocus() const

Checks whether the element currently has keyboard focus.

SetTint

void SetTint(const Color &color) override

Sets the tint of the GUI element.

staticCreate

static GUIElementType *Create(const ContentType &contents, const String &styleClass, const TInlineArray<GUIOption, 4> &options)

Creates a new GUI element.

contents
Structure describing the contents of the GUI element to create.
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.
options
Additional options that control GUI element size and position. This will override options set in the style sheet.

Fields

OnValueChanged

Event<void (const String &)> OnValueChanged

OnConfirm

Event<void ()> OnConfirm

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

Internal

Constructors

GUITextField

GUITextField(PrivatelyConstruct, const GUITextFieldContent &content, const String &style, const GUISizeConstraints &sizeConstraints)

Methods

SetValueInternal

void SetValueInternal(const String &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

UpdateLayoutForChildren

void UpdateLayoutForChildren() override

Calculates sizes and relative positions for all child elements.

Should be preceded with a call to UpdateOptimalLayoutSizes().

CalculateUnconstrainedOptimalSize

GUILogicalSize CalculateUnconstrainedOptimalSize() const override

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

ValueChanged

void ValueChanged(const String &newValue)

Triggered when the value in the internal input box changes.

DoOnInputBoxFocusGained

void DoOnInputBoxFocusGained()

Triggers when the input box receives keyboard focus.

DoOnInputBoxFocusLost

void DoOnInputBoxFocusLost()

Triggers when the input box loses keyboard focus.

InputConfirmed

void InputConfirmed()

Triggered when the users confirms input in the input box.

Fields

mInputBox

GUIInputBox * mInputBox

mLayout

GUILayout * mLayout

mLabel

GUILabel * mLabel

mHasInputFocus

bool mHasInputFocus

mValue

String mValue