Module kas::layout

source ·
Expand description

Layout utilities

For documentation of layout resolution, see the Layout trait.

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 Stretch are auxilliary data types.

Solvers

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

Enums

  • Alignment of contents
  • Priority for stretching widgets beyond ideal size

Traits

Functions