LayoutHelper
struct · ferroui-base · v0.5.0
struct LayoutHelper
Provides helper methods needed for layout.
Members
LAYOUT_EPSILONapply_layout_constraintsmeasure_hold_with_bordermeasure_child_with_bordermeasure_childarrange_child_with_borderarrange_childinvalidate_self_and_children_measureget_layout_scaleround_layout_size_upround_layout_thicknessround_layout_pointround_layout_valueround_layout_value_upvalidate_scaling
LAYOUT_EPSILON
const LAYOUT_EPSILON: f64
Epsilon value used for certain layout calculations. Based on the value in WPF LayoutDoubleUtil.
apply_layout_constraints
fn apply_layout_constraints(control: &Layoutable, constraints: Size) -> Size
Calculates a control's size based on its width, height, min-width, min-height, max-width and max-height.
measure_hold_with_border
fn measure_hold_with_border(control: Option<&Layoutable>, padding: Thickness, border_thickness: Thickness) -> Option<crate::layout::MeasureHold>
Measures a child with padding and a border, returning the desired
size including them.
The measure hold of an element that measures control as Self::measure_child_with_border
does: the child's hold moved by the padding and the border (desktop-performance.md section
9.15); without a child, every size.
measure_child_with_border
fn measure_child_with_border(control: Option<&Layoutable>, available_size: Size, padding: Thickness, border_thickness: Thickness) -> Size
measure_child
fn measure_child(control: Option<&Layoutable>, available_size: Size, padding: Thickness) -> Size
Measures a child with padding, returning the desired size including the padding.
arrange_child_with_border
fn arrange_child_with_border(child: Option<&Layoutable>, available_size: Size, padding: Thickness, border_thickness: Thickness) -> Size
Arranges a child inside padding and a border.
arrange_child
fn arrange_child(child: Option<&Layoutable>, available_size: Size, padding: Thickness) -> Size
Arranges a child inside padding.
invalidate_self_and_children_measure
fn invalidate_self_and_children_measure(control: &Layoutable)
Invalidates measure for the control and all of its visual descendants.
get_layout_scale
fn get_layout_scale(control: &Layoutable) -> f64
Obtains the layout scale of the given control, based on its layout root.
round_layout_size_up
fn round_layout_size_up(size: Size, dpi_scale: f64) -> Size
Rounds a size to an integer number of device pixels, rounding up.
round_layout_thickness
fn round_layout_thickness(thickness: Thickness, dpi_scale: f64) -> Thickness
Rounds a thickness to integer numbers of device pixels.
round_layout_point
fn round_layout_point(point: Point, dpi_scale: f64) -> Point
Rounds a point to integer device pixels.
round_layout_value
fn round_layout_value(value: f64, dpi_scale: f64) -> f64
Calculates the value to be used for layout rounding at high DPI by rounding the value up or down to the nearest pixel.
round_layout_value_up
fn round_layout_value_up(value: f64, dpi_scale: f64) -> f64
Calculates the value to be used for layout rounding at high DPI by rounding the value up to the nearest pixel.
validate_scaling
fn validate_scaling(scaling: f64) -> f64
Validates a render/layout scaling value, normalizing values close to one to exactly one. Panics on invalid values.
Trait implementations
SendSyncFreezeUnsafeUnpinUnpinUnwindSafeRefUnwindSafeClassDefaultsBorrow<T>BorrowMut<T>Into<U>From<T>TryInto<U>TryFrom<U>AnyErasedDestructorIntoEither
Availability
Extracted for aarch64-apple-darwin. Cargo features are listed in the crate index.