Jazz2::UI::Windows::Label class

Text.

Base classes

class Element
Element of the interface.

Derived classes

class WrappedLabel
Text on as many lines as it needs in the width it gets.

Constructors, destructors, conversion operators

Label(StringView text = {}, const Colorf& color = Theme::Text, Alignment align = Alignment::Left) explicit
Creates a new instance.

Public functions

auto GetText() -> StringView
Returns the text shown, TextFunc is called at most once a frame of layout.
auto Measure(const Context& context, Vector2f available) -> Vector2f override
Returns the size the element wants, in pixels.
auto MeasureDependsOnAvailable() const -> bool override
Returns false if what Measure() returns doesn't depend on the available size, it's measured once a frame then.
void Draw(Painter& painter) override
Draws the element and its children.

Public variables

String Text
Text.
Function<String()> TextFunc
Returns the text, replaces Text when set.
Colorf Color
Color.
Alignment Align
Horizontal alignment.

Function documentation

Vector2f Jazz2::UI::Windows::Label::Measure(const Context& context, Vector2f available) override

Returns the size the element wants, in pixels.

The available size is what the parent can give, a size without limit is a very large number.