class GUIResourceField

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

The field accepts a Resource 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 HResource &value)

Resource referenced by the field, if any.

GetValue

HResource GetValue() const

SetValueReference

void SetValueReference(const HResource &value)

Equivalent to , but accessed through a resource reference.

GetValueReference

HResource GetValueReference() const

GetUuid

UUID GetUuid() const

Returns the UUID of the resource referenced by the field.

Returns empty UUID if no resource is referenced.

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

Triggered whenever the referenced resource changes.

Internal

Constructors

GUIResourceField

GUIResourceField(PrivatelyConstruct, const GUIResourceFieldContent &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

~GUIResourceField

virtual ~GUIResourceField() noexcept = default

SetUuid

void SetUuid(const UUID &uuid, bool triggerEvent = true)

Sets the resource referenced by the field by finding the resource with the provided UUID.

uuid
Unique resource identifier of the resource to show, or empty string if no resource.
triggerEvent
Determines should the onValueChanged() event be triggered if the new UUID 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

mNamespace

String mNamespace

mType

String mType

mUUID

UUID mUUID