Module 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§

AlignHints
Partial alignment information provided by the parent
AlignPair
Provides alignment information on both axes along with ideal size
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
FrameRules
Frame size rules
FrameStorage
Layout storage for frame
GridCellInfo
Per-child information
GridDimensions
Grid dimensions
GridSetter
A RulesSetter for grids supporting cell-spans
GridSolver
A RulesSolver for grids supporting cell-spans
LogicalSize
Logical (pre-scaling) pixel size
Margins
Margin sizes
PackStorage
Layout storage for pack
PixmapScaling
Control over scaling
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
Visitor
A layout visitor

Enums§

Align
Alignment of contents
Stretch
Priority for stretching widgets beyond ideal size

Traits§

DefaultWithLen
Bound on GridSolver type parameters
GridStorage
Requirements of grid solver storage type
LayoutVisitor
Macro-generated implementation of layout over a Visitor
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
Visitable
A sub-set of Layout used by Visitor.
VisitableList
A list of Visitable

Functions§

solve_size_rules
Solve size rules for a widget