Skip to main content

LayoutHelper

Struct LayoutHelper 

Source
pub struct LayoutHelper;
Expand description

Provides helper methods needed for layout.

Implementations§

Source§

impl LayoutHelper

Source

pub const LAYOUT_EPSILON: f64 = 0.00000153

Epsilon value used for certain layout calculations. Based on the value in WPF LayoutDoubleUtil.

Source

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.

Source

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.

Source

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.

Source

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.

Source

pub fn arrange_child( child: Option<&Layoutable>, available_size: Size, padding: Thickness, ) -> Size

Arranges a child inside padding.

Source

pub fn invalidate_self_and_children_measure(control: &Layoutable)

Invalidates measure for the control and all of its visual descendants.

Source

pub fn get_layout_scale(control: &Layoutable) -> f64

Obtains the layout scale of the given control, based on its layout root.

Source

pub fn round_layout_size_up(size: Size, dpi_scale: f64) -> Size

Rounds a size to an integer number of device pixels, rounding up.

Source

pub fn round_layout_thickness(thickness: Thickness, dpi_scale: f64) -> Thickness

Rounds a thickness to integer numbers of device pixels.

Source

pub fn round_layout_point(point: Point, dpi_scale: f64) -> Point

Rounds a point to integer device pixels.

Source

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.

Source

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.

Source

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§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> ClassDefaults for T
where T: ?Sized,

Source§

fn static_constructor()

The static constructor of a type: work done once per thread, after the properties of the type are registered and before its first instance exists (class handlers, affects_render, metadata overrides). Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.