[][src]Struct cursive::views::LinearLayout

pub struct LinearLayout { /* fields omitted */ }

Arranges its children linearly according to its orientation.

Methods

impl LinearLayout[src]

pub fn new(orientation: Orientation) -> Self[src]

Creates a new layout with the given orientation.

pub fn set_weight(&mut self, i: usize, weight: usize)[src]

Sets the weight of the given child.

Panics

Panics if i >= self.len().

pub fn weight(self, weight: usize) -> Self[src]

Modifies the weight of the last child added.

It is an error to call this before adding a child (and it will panic).

pub fn child<V: View + 'static>(self, view: V) -> Self[src]

Adds a child to the layout.

Chainable variant.

pub fn add_child<V: View + 'static>(&mut self, view: V)[src]

Adds a child to the layout.

pub fn insert_child<V: View + 'static>(&mut self, i: usize, view: V)[src]

Inserts a child at the given position.

Panics

Panics if i > self.len().

pub fn swap_children(&mut self, i: usize, j: usize)[src]

Swaps two children.

pub fn len(&self) -> usize[src]

Returns the number of children.

pub fn is_empty(&self) -> bool[src]

Returns true if this view has no children.

pub fn get_focus_index(&self) -> usize[src]

Returns index of focused inner view

pub fn vertical() -> Self[src]

Creates a new vertical layout.

pub fn horizontal() -> Self[src]

Creates a new horizontal layout.

pub fn get_child(&self, i: usize) -> Option<&dyn View>[src]

Returns a reference to a child.

pub fn get_child_mut(&mut self, i: usize) -> Option<&mut dyn View>[src]

Returns a mutable reference to a child.

pub fn remove_child(&mut self, i: usize) -> Option<Box<dyn View>>[src]

Removes a child.

If i is within bounds, the removed child will be returned.

Trait Implementations

impl View for LinearLayout[src]

Auto Trait Implementations

impl !Send for LinearLayout

impl !Sync for LinearLayout

Blanket Implementations

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T> From for T[src]

impl<T, U> TryFrom for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Erased for T[src]