Trait vizia_core::modifiers::LayoutModifiers

source ·
pub trait LayoutModifiers: Modifiable {
Show 33 methods // Provided methods fn layout_type<U: Into<LayoutType>>(self, value: impl Res<U>) -> Self { ... } fn position_type<U: Into<PositionType>>(self, value: impl Res<U>) -> Self { ... } fn left<U: Into<Units>>(self, value: impl Res<U>) -> Self { ... } fn right<U: Into<Units>>(self, value: impl Res<U>) -> Self { ... } fn top<U: Into<Units>>(self, value: impl Res<U>) -> Self { ... } fn bottom<U: Into<Units>>(self, value: impl Res<U>) -> Self { ... } fn space<U: Into<Units>>(self, value: impl Res<U>) -> Self { ... } fn width<U: Into<Units>>(self, value: impl Res<U>) -> Self { ... } fn height<U: Into<Units>>(self, value: impl Res<U>) -> Self { ... } fn size<U: Into<Units>>(self, value: impl Res<U>) -> Self { ... } fn child_left<U: Into<Units>>(self, value: impl Res<U>) -> Self { ... } fn child_right<U: Into<Units>>(self, value: impl Res<U>) -> Self { ... } fn child_top<U: Into<Units>>(self, value: impl Res<U>) -> Self { ... } fn child_bottom<U: Into<Units>>(self, value: impl Res<U>) -> Self { ... } fn child_space<U: Into<Units>>(self, value: impl Res<U>) -> Self { ... } fn row_between<U: Into<Units>>(self, value: impl Res<U>) -> Self { ... } fn col_between<U: Into<Units>>(self, value: impl Res<U>) -> Self { ... } fn min_width<U: Into<Units>>(self, value: impl Res<U>) -> Self { ... } fn min_height<U: Into<Units>>(self, value: impl Res<U>) -> Self { ... } fn min_size<U: Into<Units>>(self, value: impl Res<U>) -> Self { ... } fn max_width<U: Into<Units>>(self, value: impl Res<U>) -> Self { ... } fn max_height<U: Into<Units>>(self, value: impl Res<U>) -> Self { ... } fn max_size<U: Into<Units>>(self, value: impl Res<U>) -> Self { ... } fn min_left<U: Into<Units>>(self, value: impl Res<U>) -> Self { ... } fn min_right<U: Into<Units>>(self, value: impl Res<U>) -> Self { ... } fn min_top<U: Into<Units>>(self, value: impl Res<U>) -> Self { ... } fn min_bottom<U: Into<Units>>(self, value: impl Res<U>) -> Self { ... } fn min_space<U: Into<Units>>(self, value: impl Res<U>) -> Self { ... } fn max_left<U: Into<Units>>(self, value: impl Res<U>) -> Self { ... } fn max_right<U: Into<Units>>(self, value: impl Res<U>) -> Self { ... } fn max_top<U: Into<Units>>(self, value: impl Res<U>) -> Self { ... } fn max_bottom<U: Into<Units>>(self, value: impl Res<U>) -> Self { ... } fn max_space<U: Into<Units>>(self, value: impl Res<U>) -> Self { ... }
}
Expand description

Modifiers for changing the layout properties of a view.

Provided Methods§

source

fn layout_type<U: Into<LayoutType>>(self, value: impl Res<U>) -> Self

Sets the layout type of the view.

The layout type controls how a parent will position any children which have PositionType::ParentDirected. Accepts any value, or lens to a target, with a type which can be converted into LayoutType.

There are three variants:

  • LayoutType::Row - Parent will stack its children horizontally.
  • LayoutType::Column - (default) Parent will stack its children vertically.
  • LayoutType::Grid - The position of children is determine by the grid properties.
§Example
#[derive(Lens, Model, Setter)]
pub struct AppData {
    layout_type: LayoutType,
}


Element::new(cx).layout_type(LayoutType::Row);  // Value of type `LayoutType`.
Element::new(cx).layout_type(AppData::layout_type); // Lens to target of type `LayoutType`.
source

fn position_type<U: Into<PositionType>>(self, value: impl Res<U>) -> Self

Sets the position type of the view.

The position type determines how a child will be positioned within a parent.

  • PositionType::ParentDirected - The child will be positioned relative to its siblings in a stack (if parent layout type is Row or Column), or relative to its grid position (if parent layout type is Grid).
  • PositionType::SelfDirected - The child will be positioned relative to the top-left corner of its parents bounding box and will ignore its siblings or grid position. This is approximately equivalent to absolute positioning.
§Example
Element::new(cx).position_type(PositionType::SelfDirected);
source

fn left<U: Into<Units>>(self, value: impl Res<U>) -> Self

Sets the space on the left side of the view.

The left space, along with the right space, determines the horizontal position of a view.

  • Units::Pixels(...) - The left space will be a fixed number of points. This will scale with the DPI of the target display.
  • Units::Percentage(...) - The left space will be a proportion of the parent width.
  • Units::Stretch(...) - The left space will be a ratio of the remaining free space, see Units.
  • Units::Auto - The left space will be determined by the parent child-left, see child_left.
§Example
Element::new(cx).left(Units::Pixels(100.0));
source

fn right<U: Into<Units>>(self, value: impl Res<U>) -> Self

Sets the space on the right side of the view.

The right space, along with the left space, determines the horizontal position of a view.

  • Units::Pixels(...) - The right space will be a fixed number of points. This will scale with the DPI of the target display.
  • Units::Percentage(...) - The right space will be a proportion of the parent width.
  • Units::Stretch(...) - The right space will be a ratio of the remaining free space, see Units.
  • Units::Auto - The right space will be determined by the parent child-left, see child_left.
§Example
Element::new(cx).right(Units::Pixels(100.0));
source

fn top<U: Into<Units>>(self, value: impl Res<U>) -> Self

Sets the space on the top side of the view.

The top space, along with the bottom space, determines the vertical position of a view.

  • Units::Pixels(...) - The top space will be a fixed number of points. This will scale with the DPI of the target display.
  • Units::Percentage(...) - The top space will be a proportion of the parent width.
  • Units::Stretch(...) - The top space will be a ratio of the remaining free space, see Units.
  • Units::Auto - The top space will be determined by the parent child-left, see child_left.
§Example
Element::new(cx).top(Units::Pixels(100.0));
source

fn bottom<U: Into<Units>>(self, value: impl Res<U>) -> Self

Sets the space on the bottom side of the view.

The bottom space, along with the top space, determines the vertical position of a view.

  • Units::Pixels(...) - The bottom space will be a fixed number of points. This will scale with the DPI of the target display.
  • Units::Percentage(...) - The bottom space will be a proportion of the parent width.
  • Units::Stretch(...) - The bottom space will be a ratio of the remaining free space, see Units.
  • Units::Auto - The bottom space will be determined by the parent child-left, see child_left.
§Example
Element::new(cx).bottom(Units::Pixels(100.0));
source

fn space<U: Into<Units>>(self, value: impl Res<U>) -> Self

Sets the space for all sides of the view.

source

fn width<U: Into<Units>>(self, value: impl Res<U>) -> Self

Sets the width of the view.

source

fn height<U: Into<Units>>(self, value: impl Res<U>) -> Self

Sets the height of the view.

source

fn size<U: Into<Units>>(self, value: impl Res<U>) -> Self

Sets the width and height of the view.

source

fn child_left<U: Into<Units>>(self, value: impl Res<U>) -> Self

Sets the space between the left side of the view and the left side of its children.

Applies only to child views which have a left property set to Auto.

source

fn child_right<U: Into<Units>>(self, value: impl Res<U>) -> Self

Sets the space between the right side of the view and the right side of its children.

Applies only to child views which have a right property set to Auto.

source

fn child_top<U: Into<Units>>(self, value: impl Res<U>) -> Self

Sets the space between the top side of the view and the top side of its children.

Applies only to child views which have a top property set to Auto.

source

fn child_bottom<U: Into<Units>>(self, value: impl Res<U>) -> Self

Sets the space between the bottom side of the view and the bottom side of its children.

Applies only to child views which have a bottom property set to Auto.

source

fn child_space<U: Into<Units>>(self, value: impl Res<U>) -> Self

Sets the space between the vew and its children.

The child_space works by overriding the Auto space properties of its children.

source

fn row_between<U: Into<Units>>(self, value: impl Res<U>) -> Self

Sets the space between the views children in a vertical stack.

source

fn col_between<U: Into<Units>>(self, value: impl Res<U>) -> Self

Sets the space between the views children in a horizontal stack.

source

fn min_width<U: Into<Units>>(self, value: impl Res<U>) -> Self

Sets the minimum width of the view.

source

fn min_height<U: Into<Units>>(self, value: impl Res<U>) -> Self

Sets the minimum height of the view.

source

fn min_size<U: Into<Units>>(self, value: impl Res<U>) -> Self

Sets the minimum width and minimum height of the view.

source

fn max_width<U: Into<Units>>(self, value: impl Res<U>) -> Self

Sets the maximum width of the view.

source

fn max_height<U: Into<Units>>(self, value: impl Res<U>) -> Self

Sets the maximum height of the view.

source

fn max_size<U: Into<Units>>(self, value: impl Res<U>) -> Self

Sets the maximum width and maximum height of the view.

source

fn min_left<U: Into<Units>>(self, value: impl Res<U>) -> Self

Sets the minimum left space of the view.

source

fn min_right<U: Into<Units>>(self, value: impl Res<U>) -> Self

Sets the minimum right space of the view.

source

fn min_top<U: Into<Units>>(self, value: impl Res<U>) -> Self

Sets the minimum top space of the view.

source

fn min_bottom<U: Into<Units>>(self, value: impl Res<U>) -> Self

Sets the minimum bottom space of the view.

source

fn min_space<U: Into<Units>>(self, value: impl Res<U>) -> Self

Sets the minimum space for all sides of the view.

source

fn max_left<U: Into<Units>>(self, value: impl Res<U>) -> Self

Sets the maximum left space of the view.

source

fn max_right<U: Into<Units>>(self, value: impl Res<U>) -> Self

Sets the maximum right space of the view.

source

fn max_top<U: Into<Units>>(self, value: impl Res<U>) -> Self

Sets the maximum top space of the view.

source

fn max_bottom<U: Into<Units>>(self, value: impl Res<U>) -> Self

Sets the maximum bottom space of the view.

source

fn max_space<U: Into<Units>>(self, value: impl Res<U>) -> Self

Sets the maximum space for all sides of the view.

Object Safety§

This trait is not object safe.

Implementors§

source§

impl<'a, V: View> LayoutModifiers for Handle<'a, V>