class GUITextureField

GUI object that displays a field in which a Texture or a SpriteTexture can be dragged and dropped.

It also displays an optional label field. When a texture is referenced its image is displayed in the field.

Public

Methods

staticGetGuiTypeName

static const String &GetGuiTypeName()

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

SetTexture

void SetTexture(const HTexture &value)

Represents the texture currently referenced by the field, if any.

Will return null if a non-texture type is currently assigned to the field.

GetTexture

HTexture GetTexture() const

SetTextureReference

void SetTextureReference(const HTexture &value)

Equivalent to , but accessed through a resource reference.

GetTextureReference

HTexture GetTextureReference() const

SetSpriteImage

void SetSpriteImage(const HSpriteImage &value)

Represents the sprite image referenced by the field, if any.

Will return null if a non-sprite image type is currently assigned to the field

GetSpriteImage

HSpriteImage GetSpriteImage() const

SetSpriteImageReference

void SetSpriteImageReference(const HSpriteImage &value)

Equivalent to , but accessed through a resource reference.

GetSpriteImageReference

HSpriteImage GetSpriteImageReference() const

SetValue

void SetValue(const HResource &value)

Represents the resource referenced by the field.

Use this if you don't know if the field holds a Texture or SpriteImage

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.

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

Triggered whenever the referenced texture changes.

Internal

Constructors

GUITextureField

GUITextureField(PrivatelyConstruct, const GUITextureFieldContent &content, const String &style, const GUISizeConstraints &sizeConstraints)

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.

Private

Methods

~GUITextureField

virtual ~GUITextureField() noexcept = default

SetUuid

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

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

uuid
Unique resource identifier of the texture to show, or empty string if no texture.
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

mUUID

UUID mUUID