deft.layout

Layout engine — box sizers.

A Sizer arranges child widgets (and nested sizers) within a rectangle. HBox lays children out horizontally, VBox vertically. Each child carries a *proportion*: children with proportion 0 keep their preferred size along the main axis, while the leftover space is shared among the proportional children in proportion to their weights. Per-child Padding is reserved around the child's cell.

The layout math is pure integer arithmetic with no dependency on a running message loop, so it is exercised directly by unit tests.

Members

Classes

Grid
class Grid

A table layout: a fixed grid of columns and rows, each independently sized to its content (autoSize), a fixed pixel size (absolute) or a weighted share of the leftover space (percent). Widgets and nested sizers are placed into cells by column/row and may span several columns or rows. Within its cell a child fills the available space by default, or keeps its preferred size and aligns (start/center/end) — see GridItem.

GridItem
class GridItem

A placed grid child, returned by Grid.add/Grid.addSizer for fluent configuration:

HBox
class HBox

Lays children out left to right.

Sizer
class Sizer

Abstract base for box sizers.

SizerItem
class SizerItem

One placed child of a sizer: a widget or a nested sizer, with its proportion, padding and in-cell alignment.

VBox
class VBox

Lays children out top to bottom.

Enums

GridTrackKind
enum GridTrackKind

How a grid track (one column or one row) is sized.

HAlign
enum HAlign

Horizontal placement of a child within the space available to it.

VAlign
enum VAlign

Vertical placement of a child within the space available to it.

Structs

GridTrack
struct GridTrack

The size rule for one column or row of a Grid.

Meta