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§
Sourcefn 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 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`.
Sourcefn 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.
Position::Relative
- 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
).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);
Sourcefn 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 parentpadding-left
, seepadding_left
.
§Example
Element::new(cx).left(Units::Pixels(100.0));
Sourcefn 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 parentpadding-left
, seepadding_left
.
§Example
Element::new(cx).right(Units::Pixels(100.0));
Sourcefn 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 parentpadding-left
, seepadding_left
.
§Example
Element::new(cx).top(Units::Pixels(100.0));
Sourcefn 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 parentpadding-left
, seepadding_left
.
§Example
Element::new(cx).bottom(Units::Pixels(100.0));
Sourcefn padding_left<U>(self, value: impl Res<U>) -> Self
fn padding_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
.
Sourcefn padding_right<U>(self, value: impl Res<U>) -> Self
fn padding_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
.
Sourcefn padding_top<U>(self, value: impl Res<U>) -> Self
fn padding_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
.
Sourcefn padding_bottom<U>(self, value: impl Res<U>) -> Self
fn padding_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
.
Sourcefn padding<U>(self, value: impl Res<U>) -> Self
fn padding<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.
Sourcefn vertical_gap<U>(self, value: impl Res<U>) -> Self
fn vertical_gap<U>(self, value: impl Res<U>) -> Self
Sets the space between the views children in the vertical direction.
Sourcefn horizontal_gap<U>(self, value: impl Res<U>) -> Self
fn horizontal_gap<U>(self, value: impl Res<U>) -> Self
Sets the space between the views children in the horizontal direction.
Sourcefn gap<U>(self, value: impl Res<U>) -> Self
fn gap<U>(self, value: impl Res<U>) -> Self
Sets the space between the views children in both the horizontal and vertical directions.
Sourcefn vertical_scroll<U>(self, value: impl Res<U>) -> Self
fn vertical_scroll<U>(self, value: impl Res<U>) -> Self
Set the vertical scroll position of the view.
Sourcefn horizontal_scroll<U>(self, value: impl Res<U>) -> Self
fn horizontal_scroll<U>(self, value: impl Res<U>) -> Self
Set the horizontal scroll position of the view.
Sourcefn 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.
Sourcefn 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.
Sourcefn 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.
Sourcefn 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.
Sourcefn min_horizontal_gap<U>(self, value: impl Res<U>) -> Self
fn min_horizontal_gap<U>(self, value: impl Res<U>) -> Self
Sets the minimum horizontal space between the children of the view.
Sourcefn min_vertical_gap<U>(self, value: impl Res<U>) -> Self
fn min_vertical_gap<U>(self, value: impl Res<U>) -> Self
Sets the minimum vertical space between the children of the view.
Sourcefn min_gap<U>(self, value: impl Res<U>) -> Self
fn min_gap<U>(self, value: impl Res<U>) -> Self
Sets the minimum horizontal and minimum vertical space between the children of the view.
Sourcefn max_horizontal_gap<U>(self, value: impl Res<U>) -> Self
fn max_horizontal_gap<U>(self, value: impl Res<U>) -> Self
Sets the maximum horizontal space between the children of the view.
Sourcefn max_vertical_gap<U>(self, value: impl Res<U>) -> Self
fn max_vertical_gap<U>(self, value: impl Res<U>) -> Self
Sets the maximum vertical space between the children of the view.
Sourcefn max_gap<U>(self, value: impl Res<U>) -> Self
fn max_gap<U>(self, value: impl Res<U>) -> Self
Sets the maximum horizontal and maximum vertical space between the children of the view.
Sourcefn grid_columns<U>(self, value: impl Res<U>) -> Self
fn grid_columns<U>(self, value: impl Res<U>) -> Self
Sets the grid columns for a grid layout.
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
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.