Jazz2::UI::Windows::Form class

Rows of a label and what it's about, with the labels in a column as wide as the longest of them.

A label that would make the column too wide is put above what it's about instead, so a long label doesn't take space from all the rows and isn't cut off either. Other elements, such as check boxes, can be added between the rows, they take the whole width.

Base classes

class Stack
Places its children in a row or a column.

Constructors, destructors, conversion operators

Form(float spacing = Theme::Spacing, Thickness padding = {}) explicit
Creates a new instance.

Public functions

auto AddRow(StringView label, StringView tooltip = {}) -> Stack*
Adds a row with a label, what it's about is added to the returned stack.
auto GetLabelColumn() const -> float
Returns the width of the column of labels in pixels.
auto GetMaxLabelColumn() const -> float
Returns the widest a label can be in pixels before it's put above what it's about.
auto Measure(const Context& context, Vector2f available) -> Vector2f override
Returns the size the element wants, in pixels.
void Arrange(const Context& context, const Rectf& bounds) override
Places the element and its children.

Public variables

float MaxLabelWidth
Widest the column of labels gets in units.
float MaxLabelFraction
Widest the column of labels gets as a part of the width of the form.
float MinLabelWidth
Narrowest the column of labels is in units, so it doesn't change as rows are shown and hidden, or between forms.

Function documentation

Vector2f Jazz2::UI::Windows::Form::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.