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:
SingleSolverandSingleSetterare trivial implementations for single-child parentsRowSolverandRowSetterset out a row or column of children. These are parametrised overS: RowStorageallowing both efficient operation on a small fixed number of children withFixedRowStorageand operation on a over aVecwithDynRowStorage.GridSolverandGridSetterset 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.
Re-exports
pub use visitor::Visitor;internal_doc
Structs
- Partial alignment information provided by the parent
- Provides alignment information on both axes along with ideal size
- Information on which axis is being resized
- Variable-length grid storage
- Variable-length row storage
- Fixed-length grid storage
- Fixed-length row storage
- Frame size rules
- Layout storage for frame layout
- Per-child information
- Grid dimensions
- A
RulesSetterfor grids supporting cell-spans - A
RulesSolverfor grids supporting cell-spans - Logical (pre-scaling) pixel size
- Margin sizes
- Layout storage for alignment
- Control over scaling
- Allows efficient implementations of
draw/ event handlers based on the layout representation. - A
RulesSetterfor rows (and, without loss of generality, for columns). - A
RulesSolverfor rows (and, without loss of generality, for columns). RulesSetterimplementation for a fixed single-child layoutRulesSolverimplementation for a fixed single-child layout- Widget sizing information
- Size solver
Enums
- Alignment of contents
- Priority for stretching widgets beyond ideal size
Traits
- Implementation generated by use of
layout = ..property of#[widget] - Bound on
GridSolvertype parameters - Requirements of grid solver storage type
- Requirements of row solver storage type
- Temporary storage type.
- Resolves a
RulesSolversolution for each child - A
SizeRulessolver for layouts
Functions
- Solve size rules for a widget