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>) -> Selfwhere
U: Into<LayoutType>,
fn layout_type<U>(self, value: impl Res<U>) -> Selfwhere
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>) -> Selfwhere
U: Into<PositionType>,
fn position_type<U>(self, value: impl Res<U>) -> Selfwhere
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 isRow
orColumn
), or relative to its grid position (if parent layout type isGrid
).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
fn left<U>(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, seeUnits
.Units::Auto
- The left space will be determined by the parentchild-left
, seechild_left
.
§Example
Element::new(cx).left(Units::Pixels(100.0));
fn right<U>(self, value: impl Res<U>) -> Self
fn right<U>(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, seeUnits
.Units::Auto
- The right space will be determined by the parentchild-left
, seechild_left
.
§Example
Element::new(cx).right(Units::Pixels(100.0));
fn top<U>(self, value: impl Res<U>) -> Self
fn top<U>(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, seeUnits
.Units::Auto
- The top space will be determined by the parentchild-left
, seechild_left
.
§Example
Element::new(cx).top(Units::Pixels(100.0));
fn bottom<U>(self, value: impl Res<U>) -> Self
fn bottom<U>(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, seeUnits
.Units::Auto
- The bottom space will be determined by the parentchild-left
, seechild_left
.
§Example
Element::new(cx).bottom(Units::Pixels(100.0));
fn child_left<U>(self, value: impl Res<U>) -> Self
fn child_left<U>(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
.
fn child_right<U>(self, value: impl Res<U>) -> Self
fn child_right<U>(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
.
fn child_top<U>(self, value: impl Res<U>) -> Self
fn child_top<U>(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
.
fn child_bottom<U>(self, value: impl Res<U>) -> Self
fn child_bottom<U>(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
.
fn child_space<U>(self, value: impl Res<U>) -> Self
fn child_space<U>(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.
fn row_between<U>(self, value: impl Res<U>) -> Self
fn row_between<U>(self, value: impl Res<U>) -> Self
Sets the space between the views children in a vertical stack.
fn col_between<U>(self, value: impl Res<U>) -> Self
fn col_between<U>(self, value: impl Res<U>) -> Self
Sets the space between the views children in a horizontal stack.
fn min_height<U>(self, value: impl Res<U>) -> Self
fn min_height<U>(self, value: impl Res<U>) -> Self
Sets the minimum height of the view.
fn min_size<U>(self, value: impl Res<U>) -> Self
fn min_size<U>(self, value: impl Res<U>) -> Self
Sets the minimum width and minimum height of the view.
fn max_height<U>(self, value: impl Res<U>) -> Self
fn max_height<U>(self, value: impl Res<U>) -> Self
Sets the maximum height of the view.
fn max_size<U>(self, value: impl Res<U>) -> Self
fn max_size<U>(self, value: impl Res<U>) -> Self
Sets the maximum width and maximum height of the view.
fn min_bottom<U>(self, value: impl Res<U>) -> Self
fn min_bottom<U>(self, value: impl Res<U>) -> Self
Sets the minimum bottom space of the view.
fn max_bottom<U>(self, value: impl Res<U>) -> Self
fn max_bottom<U>(self, value: impl Res<U>) -> Self
Sets the maximum bottom space of the view.