Struct embedded_layout::layout::linear::LinearLayout [−][src]
pub struct LinearLayout<LD, VG> { /* fields omitted */ }Expand description
LinearLayout
LinearLayout is used to arrange views along the horizontal or vertical axis.
For more information and examples see the module level documentation.
Implementations
Create a new LinearLayout that places views left to right
Create a new LinearLayout that places views top to bottom
impl<S, ELS, VG> LinearLayout<Horizontal<S, ELS>, VG> where
S: SecondaryAlignment + VerticalAlignment,
ELS: ElementSpacing,
VG: ViewGroup,
impl<S, ELS, VG> LinearLayout<Horizontal<S, ELS>, VG> where
S: SecondaryAlignment + VerticalAlignment,
ELS: ElementSpacing,
VG: ViewGroup, pub fn with_alignment<Sec>(
self,
alignment: Sec
) -> LinearLayout<Horizontal<Sec, ELS>, VG> where
Sec: SecondaryAlignment + VerticalAlignment,
pub fn with_alignment<Sec>(
self,
alignment: Sec
) -> LinearLayout<Horizontal<Sec, ELS>, VG> where
Sec: SecondaryAlignment + VerticalAlignment, Change the secondary alignment for this LinearLayout object.
For layouts created using LinearLayout::horizontal the secondary alignment is vertical.
pub fn with_spacing<ES>(
self,
spacing: ES
) -> LinearLayout<Horizontal<S, ES>, VG> where
ES: ElementSpacing,
pub fn with_spacing<ES>(
self,
spacing: ES
) -> LinearLayout<Horizontal<S, ES>, VG> where
ES: ElementSpacing, Change the element spacing
For available values and their properties, see spacing
impl<S, ELS, VG> LinearLayout<Vertical<S, ELS>, VG> where
S: SecondaryAlignment + HorizontalAlignment,
ELS: ElementSpacing,
VG: ViewGroup,
impl<S, ELS, VG> LinearLayout<Vertical<S, ELS>, VG> where
S: SecondaryAlignment + HorizontalAlignment,
ELS: ElementSpacing,
VG: ViewGroup, pub fn with_alignment<Sec>(
self,
alignment: Sec
) -> LinearLayout<Vertical<Sec, ELS>, VG> where
Sec: SecondaryAlignment + HorizontalAlignment,
pub fn with_alignment<Sec>(
self,
alignment: Sec
) -> LinearLayout<Vertical<Sec, ELS>, VG> where
Sec: SecondaryAlignment + HorizontalAlignment, Change the secondary alignment for this LinearLayout object.
For layouts created using LinearLayout::vertical the secondary alignment is horizontal.
pub fn with_spacing<ES>(self, spacing: ES) -> LinearLayout<Vertical<S, ES>, VG> where
ES: ElementSpacing,
pub fn with_spacing<ES>(self, spacing: ES) -> LinearLayout<Vertical<S, ES>, VG> where
ES: ElementSpacing, Change the element spacing
For available values and their properties, see spacing
Consume the layout object and return the wrapped ViewGroup.
After calling arrange() it is no longer necessary to hold the views in a LinearLayout.
Use this method to extract the original view group object if you need to work with the
arranged views.
Example
Arrange an array of StyledText objects, then check the second object’s position.
let text_style = MonoTextStyle::new(&FONT_6X9, BinaryColor::On); // First, wrap out views in a `ViewGroup`. let mut texts = [ Text::new("Hello,", Point::zero(), text_style), Text::new("World!", Point::zero(), text_style) ]; let mut views = Views::new(&mut texts); // Arrange our views and extract our original view group. let views = LinearLayout::vertical(views).arrange().into_inner(); // We can access our `StyledText` objects now. Note that `Views` works like a slice! assert_eq!(Point::new(0, 9), views[1].bounds().top_left); // `Views` is also a drawable `ViewGroup`, so let's display our arranged text! views.draw(&mut display).unwrap();
Trait Implementations
impl<'a, C, LD, VG> Drawable for LinearLayout<LD, VG> where
C: PixelColor,
LD: Orientation,
VG: ViewGroup + Drawable<Color = C>,
impl<'a, C, LD, VG> Drawable for LinearLayout<LD, VG> where
C: PixelColor,
LD: Orientation,
VG: ViewGroup + Drawable<Color = C>, Auto Trait Implementations
impl<LD, VG> RefUnwindSafe for LinearLayout<LD, VG> where
LD: RefUnwindSafe,
VG: RefUnwindSafe, impl<LD, VG> Send for LinearLayout<LD, VG> where
LD: Send,
VG: Send, impl<LD, VG> Sync for LinearLayout<LD, VG> where
LD: Sync,
VG: Sync, impl<LD, VG> Unpin for LinearLayout<LD, VG> where
LD: Unpin,
VG: Unpin, impl<LD, VG> UnwindSafe for LinearLayout<LD, VG> where
LD: UnwindSafe,
VG: UnwindSafe, Blanket Implementations
pub fn align_to<H, V>(Self, &impl View, H, V) -> T where
H: HorizontalAlignment,
V: VerticalAlignment,
pub fn align_to<H, V>(Self, &impl View, H, V) -> T where
H: HorizontalAlignment,
V: VerticalAlignment, Return the object aligned to an other one using the alignment parameters as rules
pub fn align_to_mut<H, V>(&mut Self, &impl View, H, V) -> &mut T where
H: HorizontalAlignment,
V: VerticalAlignment,
pub fn align_to_mut<H, V>(&mut Self, &impl View, H, V) -> &mut T where
H: HorizontalAlignment,
V: VerticalAlignment, Align the object to an other one using the alignment parameters as rules
Mutably borrows from an owned value. Read more
Casts the value.
Casts the value.
Casts the value.
Casts the value.
Casts the value.