class TGUIColorGradient

template<class T, class SELF>
Inherits: GUIInteractable

Templated class used for representing both normal and HDR variations of the color gradient GUI element.

Public

Methods

staticGetGuiTypeName

static const String &GetGuiTypeName()

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

SetGradient

void SetGradient(const T &colorGradient)

Color gradient to display.

GetGradient

T GetGradient() const

Fields

OnClicked

Event<void ()> OnClicked

Triggered when the user clicks on the GUI element.

Internal

Constructors

TGUIColorGradient<T, SELF>

TGUIColorGradient<T, SELF>(PrivatelyConstruct, const String &styleName, const GUISizeConstraints &sizeConstraints)

Methods

CalculateUnconstrainedOptimalSize

GUILogicalSize CalculateUnconstrainedOptimalSize() const override

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

Protected

Methods

~TGUIColorGradient<T, SELF>

virtual ~TGUIColorGradient<T, SELF>()

GetStyleSheetElement

const char *GetStyleSheetElement() const override

Returns the name of the GUI element type to be used for style lookup in the style sheet.

UpdateRenderElements

void UpdateRenderElements() override

Recreates the internal render elements.

Must be called before GetRenderElementVertexAndIndexData/FillBuffer if element is dirty. Marks the element as non dirty.

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.

staticGenerateGradientTexture

static HTexture GenerateGradientTexture(const T &gradient, u32 width, bool alpha = false)

Generates a texture from the provided color gradient value.

gradient
Gradient to generate the texture from.
width
Width of the texture in pixels. Height is always 1.
alpha
If true generate a texture representing the alpha values of the gradient (grayscale), otherwise generate a color texture.

Returns: Generated texture.

Private

Fields

mColorSprite

ImageSprite * mColorSprite

mAlphaSprite

ImageSprite * mAlphaSprite

mColorImageSpriteInformation

ImageSpriteInformation mColorImageSpriteInformation

mAlphaImageSpriteInformation

ImageSpriteInformation mAlphaImageSpriteInformation

mValue

T mValue