pub struct LayoutHelper;Expand description
Provides helper methods needed for layout.
Implementations§
Source§impl LayoutHelper
impl LayoutHelper
Sourcepub const LAYOUT_EPSILON: f64 = 0.00000153
pub const LAYOUT_EPSILON: f64 = 0.00000153
Epsilon value used for certain layout calculations. Based on the value in WPF LayoutDoubleUtil.
Sourcepub fn apply_layout_constraints(control: &Layoutable, constraints: Size) -> Size
pub 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.
Sourcepub fn measure_child_with_border(
control: Option<&Layoutable>,
available_size: Size,
padding: Thickness,
border_thickness: Thickness,
) -> Size
pub fn measure_child_with_border( control: Option<&Layoutable>, available_size: Size, padding: Thickness, border_thickness: Thickness, ) -> Size
Measures a child with padding and a border, returning the desired size including them.
Sourcepub fn measure_child(
control: Option<&Layoutable>,
available_size: Size,
padding: Thickness,
) -> Size
pub fn measure_child( control: Option<&Layoutable>, available_size: Size, padding: Thickness, ) -> Size
Measures a child with padding, returning the desired size including the padding.
Sourcepub fn arrange_child_with_border(
child: Option<&Layoutable>,
available_size: Size,
padding: Thickness,
border_thickness: Thickness,
) -> Size
pub 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.
Sourcepub fn arrange_child(
child: Option<&Layoutable>,
available_size: Size,
padding: Thickness,
) -> Size
pub fn arrange_child( child: Option<&Layoutable>, available_size: Size, padding: Thickness, ) -> Size
Arranges a child inside padding.
Sourcepub fn invalidate_self_and_children_measure(control: &Layoutable)
pub fn invalidate_self_and_children_measure(control: &Layoutable)
Invalidates measure for the control and all of its visual descendants.
Sourcepub fn get_layout_scale(control: &Layoutable) -> f64
pub fn get_layout_scale(control: &Layoutable) -> f64
Obtains the layout scale of the given control, based on its layout root.
Sourcepub fn round_layout_size_up(size: Size, dpi_scale: f64) -> Size
pub fn round_layout_size_up(size: Size, dpi_scale: f64) -> Size
Rounds a size to an integer number of device pixels, rounding up.
Sourcepub fn round_layout_thickness(thickness: Thickness, dpi_scale: f64) -> Thickness
pub fn round_layout_thickness(thickness: Thickness, dpi_scale: f64) -> Thickness
Rounds a thickness to integer numbers of device pixels.
Sourcepub fn round_layout_point(point: Point, dpi_scale: f64) -> Point
pub fn round_layout_point(point: Point, dpi_scale: f64) -> Point
Rounds a point to integer device pixels.
Sourcepub fn round_layout_value(value: f64, dpi_scale: f64) -> f64
pub 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.
Sourcepub fn round_layout_value_up(value: f64, dpi_scale: f64) -> f64
pub 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.
Sourcepub fn validate_scaling(scaling: f64) -> f64
pub fn validate_scaling(scaling: f64) -> f64
Validates a render/layout scaling value, normalizing values close to one to exactly one. Panics on invalid values.
Auto Trait Implementations§
impl Freeze for LayoutHelper
impl RefUnwindSafe for LayoutHelper
impl Send for LayoutHelper
impl Sync for LayoutHelper
impl Unpin for LayoutHelper
impl UnsafeUnpin for LayoutHelper
impl UnwindSafe for LayoutHelper
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> ClassDefaults for Twhere
T: ?Sized,
impl<T> ClassDefaults for Twhere
T: ?Sized,
Source§fn static_constructor()
fn static_constructor()
affects_render, metadata
overrides). Read more