Trait LayoutModifiers

Source
pub trait LayoutModifiers: Modifiable {
Show 39 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 padding_left<U>(self, value: impl Res<U>) -> Self where U: Into<Units> { ... } fn padding_right<U>(self, value: impl Res<U>) -> Self where U: Into<Units> { ... } fn padding_top<U>(self, value: impl Res<U>) -> Self where U: Into<Units> { ... } fn padding_bottom<U>(self, value: impl Res<U>) -> Self where U: Into<Units> { ... } fn alignment<U>(self, value: impl Res<U>) -> Self where U: Into<Alignment> { ... } fn padding<U>(self, value: impl Res<U>) -> Self where U: Into<Units> { ... } fn vertical_gap<U>(self, value: impl Res<U>) -> Self where U: Into<Units> { ... } fn horizontal_gap<U>(self, value: impl Res<U>) -> Self where U: Into<Units> { ... } fn gap<U>(self, value: impl Res<U>) -> Self where U: Into<Units> { ... } fn vertical_scroll<U>(self, value: impl Res<U>) -> Self where U: Into<f32> { ... } fn horizontal_scroll<U>(self, value: impl Res<U>) -> Self where U: Into<f32> { ... } 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_horizontal_gap<U>(self, value: impl Res<U>) -> Self where U: Into<Units> { ... } fn min_vertical_gap<U>(self, value: impl Res<U>) -> Self where U: Into<Units> { ... } fn min_gap<U>(self, value: impl Res<U>) -> Self where U: Into<Units> { ... } fn max_horizontal_gap<U>(self, value: impl Res<U>) -> Self where U: Into<Units> { ... } fn max_vertical_gap<U>(self, value: impl Res<U>) -> Self where U: Into<Units> { ... } fn max_gap<U>(self, value: impl Res<U>) -> Self where U: Into<Units> { ... } fn grid_columns<U>(self, value: impl Res<U>) -> Self where U: Into<Vec<Units>> { ... } fn grid_rows<U>(self, value: impl Res<U>) -> Self where U: Into<Vec<Units>> { ... } fn column_start(self, value: impl Res<usize>) -> Self { ... } fn column_span(self, value: impl Res<usize>) -> Self { ... } fn row_start(self, value: impl Res<usize>) -> Self { ... } fn row_span(self, value: impl Res<usize>) -> Self { ... }
}
Expand description

Modifiers for changing the layout properties of a view.

Provided Methods§

Source

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 Position::Relative. 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>(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.

  • Position::Relative - 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).
  • Position::Absolute - 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::Absolute);
Source

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 padding-left, see padding_left.
§Example
Element::new(cx).left(Units::Pixels(100.0));
Source

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 padding-left, see padding_left.
§Example
Element::new(cx).right(Units::Pixels(100.0));
Source

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 padding-left, see padding_left.
§Example
Element::new(cx).top(Units::Pixels(100.0));
Source

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 padding-left, see padding_left.
§Example
Element::new(cx).bottom(Units::Pixels(100.0));
Source

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

Sets the space for all sides of the view.

Source

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

Sets the width of the view.

Source

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

Sets the height of the view.

Source

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

Sets the width and height of the view.

Source

fn padding_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.

Source

fn padding_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.

Source

fn padding_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.

Source

fn padding_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.

Source

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

Set the alignment of the view.

Source

fn padding<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.

Source

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

Sets the space between the views children in the vertical direction.

Source

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

Sets the space between the views children in the horizontal direction.

Source

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

Sets the space between the views children in both the horizontal and vertical directions.

Source

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

Set the vertical scroll position of the view.

Source

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

Set the horizontal scroll position of the view.

Source

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

Sets the minimum width of the view.

Source

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

Sets the minimum height of the view.

Source

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

Sets the minimum width and minimum height of the view.

Source

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

Sets the maximum width of the view.

Source

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

Sets the maximum height of the view.

Source

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

Sets the maximum width and maximum height of the view.

Source

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

Sets the minimum horizontal space between the children of the view.

Source

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

Sets the minimum vertical space between the children of the view.

Source

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

Sets the minimum horizontal and minimum vertical space between the children of the view.

Source

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

Sets the maximum horizontal space between the children of the view.

Source

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

Sets the maximum vertical space between the children of the view.

Source

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

Sets the maximum horizontal and maximum vertical space between the children of the view.

Source

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

Sets the grid columns for a grid layout.

Source

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

Sets the grid rows for a grid layout.

Source

fn column_start(self, value: impl Res<usize>) -> Self

Source

fn column_span(self, value: impl Res<usize>) -> Self

Source

fn row_start(self, value: impl Res<usize>) -> Self

Source

fn row_span(self, value: impl Res<usize>) -> Self

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

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