vizia::modifiers

Trait LayoutModifiers

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

Modifiers for changing the layout properties of a view.

Provided Methods§

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

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`.

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

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);

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

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));

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

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));

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

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));

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

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));

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

Sets the space for all sides of the view.

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

Sets the width of the view.

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

Sets the height of the view.

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

Sets the width and height of the view.

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

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.

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

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.

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

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.

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

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.

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

Sets the space between the vew and its children.

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

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

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

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

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

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

Sets the minimum width of the view.

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

Sets the minimum height of the view.

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

Sets the minimum width and minimum height of the view.

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

Sets the maximum width of the view.

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

Sets the maximum height of the view.

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

Sets the maximum width and maximum height of the view.

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

Sets the minimum left space of the view.

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

Sets the minimum right space of the view.

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

Sets the minimum top space of the view.

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

Sets the minimum bottom space of the view.

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

Sets the minimum space for all sides of the view.

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

Sets the maximum left space of the view.

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

Sets the maximum right space of the view.

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

Sets the maximum top space of the view.

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

Sets the maximum bottom space of the view.

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

Sets the maximum space for all sides of the view.

Object Safety§

This trait is not object safe.

Implementors§

§

impl<V> LayoutModifiers for Handle<'_, V>
where V: View,