Module kas::layout [−][src]
Expand description
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 Stretch
are auxilliary data types.
MarginSelector
is a utility type facilitating user-selection of margins.
Layout engines
The RulesSolver
and RulesSetter
traits define interfaces for
layout engines:
SingleSolver
andSingleSetter
are trivial implementations for single-child parentsRowSolver
andRowSetter
set out a row or column of children. These are parametrised overS: RowStorage
allowing both efficient operation on a small fixed number of children withFixedRowStorage
and operation on a over aVec
withDynRowStorage
.GridSolver
andGridSetter
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
Partial alignment information provided by the parent
Information on which axis is being resized
Provides alignment information on both axes along with ideal size
Variable-length grid storage
Variable-length row storage
Fixed-length grid storage
Fixed-length row storage
Frame size rules
Per-child information
A RulesSetter
for grids supporting cell-spans
A RulesSolver
for grids supporting cell-spans
Margin sizes
Allows efficient implementations of draw
/ event handlers based on the
layout representation.
A RulesSetter
for rows (and, without loss of generality, for columns).
A RulesSolver
for rows (and, without loss of generality, for columns).
RulesSetter
implementation for a fixed single-child layout
RulesSolver
implementation for a fixed single-child layout
Widget sizing information
Size solver
Widget component for displaying a sprite
Enums
Alignment of contents
Scaling of image sprite within allocation
Margins (selectable)
Scaling of image according to scale factor
Priority for stretching widgets beyond ideal size
Traits
Requirements of grid solver storage type
Requirements of row solver storage type
Temporary storage type.
Resolves a RulesSolver
solution for each child
A SizeRules
solver for layouts
Master trait over storage types
Functions
Solve size rules for a widget