9#ifndef ASW_MODULES_UI_LAYOUT_H
10#define ASW_MODULES_UI_LAYOUT_H
Shared state for the UI system.
Places children in a grid, filling each row left to right, e.g. a level select or a 2 by 2 menu.
float gap
Space between cells, both ways.
std::vector< float > _natural_h
float row_height
Height of every row, 0 for the tallest child in the row.
std::vector< Widget * > _shown
float padding
Space inside the grid on every side.
void layout(Context &ctx) override
Place the children.
detail::ForcedSizes _heights
std::size_t columns
Number of columns.
Places children one after another, top to bottom or left to right.
Align align
Where children sit across the stack.
float padding
Space inside the stack on every side.
detail::ForcedSizes _across
Direction direction
Direction children are placed in.
float gap
Space between children.
void layout(Context &ctx) override
Place the children.
A vertical stack with padding, for a column of rows.
VBox()
Default constructor.
Sizes a layout forced on its children, so a child gets its own size back when the layout stops forcin...
std::vector< Entry > _last
void keep(const Widget &w)
Keep last layout's record for a child skipped this layout, e.g. a hidden one.
void finish()
End the layout. Records not made or kept this layout are dropped.
const Entry * find(WidgetId id) const
float natural(const Widget &w, float current) const
The child's own size: its current size, unless that is still the size this layout forced on it last t...
void record(const Widget &w, float natural, float forced)
Record the size forced on a child this layout.
std::vector< Entry > _next
UI context and focus management for the ASW UI module.
bool in_row_with_focusables(const Widget &w)
Whether a widget sits in a row with other widgets that can take focus: its parent is a horizontal Sta...
uint32_t WidgetId
Unique identifier type for widgets.
Align
Where children sit across the stack: left to right for a vertical stack, top to bottom for a horizont...
@ Stretch
Children fill the stack across.
Direction
Stack direction.