[][src]Module kas::layout

Layout solver

Size units are physical (real) pixels. This applies to most of KAS.

Data types

SizeRules is the "heart" of widget layout, used to specify a widget's size requirements. It provides various methods to compute derived rules and SizeRules::solve_seq, the "muscle" of the layout engine.

AxisInfo, Margins and StretchPolicy are auxilliary data types.

Layout engines

The RulesSolver and RulesSetter traits define interfaces for layout engines:

  • SingleSolver and SingleSetter are trivial implementations for single-child parents
  • RowSolver and RowSetter set out a row or column of children. These are parametrised over S: RowStorage allowing both efficient operation on a small fixed number of children with FixedRowStorage and operation on a over a Vec with DynRowStorage.
  • GridSolver and GridSetter set out children assigned to grid cells with optional cell-spans. This is the most powerful and flexible layout engine.

RowPositionSolver may be used with widgets set out by RowSetter to quickly locate children from a coord or rect.

Structs

AxisInfo

Information on which axis is being resized

DynGridStorage

Variable-length grid storage

DynRowStorage

Variable-length row storage

FixedGridStorage

Fixed-length grid storage

FixedRowStorage

Fixed-length row storage

GridChildInfo

Per-child information

GridSetter

A RulesSetter for grids supporting cell-spans

GridSolver

A RulesSolver for grids supporting cell-spans

Margins

Margin sizes

RowPositionSolver

Allows efficient implementations of draw / event handlers based on the layout representation.

RowSetter

A RulesSetter for rows (and, without loss of generality, for columns).

RowSolver

A RulesSolver for rows (and, without loss of generality, for columns).

SingleSetter

RulesSetter implementation for a fixed single-child layout

SingleSolver

RulesSolver implementation for a fixed single-child layout

SizeRules

Widget sizing information

SolveCache

Size solver

Enums

StretchPolicy

Policy for stretching widgets beyond ideal size

Traits

GridStorage

Requirements of grid solver storage type

RowStorage

Requirements of row solver storage type

RowTemp

Temporary storage type.

RulesSetter

Resolves a RulesSolver solution for each child

RulesSolver

A SizeRules solver for layouts

Storage

Master trait over storage types