class GUIGameObjectField

GUI object that displays a field in which a GameObject can be dragged and dropped.

The field accepts a GameObject of a specific type and displays an optional label.

Public

Methods

staticGetGuiTypeName

static const String &GetGuiTypeName()

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

SetValue

void SetValue(const HGameObject &value)

Represents game object currently referenced by the field, if any.

GetValue

const HGameObject &GetValue() const

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 HGameObject &)> OnValueChanged

Triggered whenever the referenced game object changes.

Internal

Constructors

GUIGameObjectField

GUIGameObjectField(PrivatelyConstruct, const GUIGameObjectFieldContent &content, const String &style, const GUISizeConstraints &sizeConstraints)

Methods

SetTint

void SetTint(const Color &color) override

Sets the tint of the GUI element.

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.

Private

Methods

~GUIGameObjectField

virtual ~GUIGameObjectField() noexcept = default

SetValue

void SetValue(const HGameObject &value, bool triggerEvent)

Sets the game object referenced by the field.

value
Game object to reference.
triggerEvent
Determines should the onValueChanged() event be triggered if the new object is different from the previous one.

DataDropped

void DataDropped(const SPtr<DragAndDropData> &data)

Triggered when a drag and drop operation finishes over this element.

OnDropButtonClicked

void OnDropButtonClicked()

Triggered when the drop button that displays the game object label is clicked.

OnClearButtonClicked

void OnClearButtonClicked()

Triggered when the clear button is clicked.

Fields

mLayout

GUILayout * mLayout

mLabel

GUILabel * mLabel

mDropButton

GUIDropButton * mDropButton

mClearButton

GUIButton * mClearButton

mType

String mType

mNamespace

String mNamespace

mSelectedObject

HGameObject mSelectedObject