[−][src]Struct cursive::views::LinearLayout
Arranges its children linearly according to its orientation.
Examples
use cursive::views::{Button, LinearLayout, TextView, TextArea}; use cursive::traits::Boxable; let linear_layout = LinearLayout::horizontal() .child(TextView::new("Top of the page")) .child(TextArea::new().fixed_size((20, 5))) .child(Button::new("Ok", |s| s.quit()));
Implementations
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]
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: IntoBoxedView + 'static>(self, view: V) -> Self[src]
Adds a child to the layout.
Chainable variant.
pub fn add_child<V: IntoBoxedView + 'static>(&mut self, view: V)[src]
Adds a child to the layout.
pub fn insert_child<V: IntoBoxedView + 'static>(&mut self, i: usize, view: V)[src]
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 set_focus_index(&mut self, index: usize) -> Result<(), ()>[src]
Attemps to set the focus on the given child.
Returns Err(()) if index >= self.len(), or if the view at the
given index does not accept focus.
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]
fn draw(&self, printer: &Printer)[src]
fn needs_relayout(&self) -> bool[src]
fn layout(&mut self, size: Vec2)[src]
fn required_size(&mut self, req: Vec2) -> Vec2[src]
fn take_focus(&mut self, source: Direction) -> bool[src]
fn on_event(&mut self, event: Event) -> EventResult[src]
fn call_on_any<'a>(&mut self, selector: &Selector, callback: AnyCb<'a>)[src]
fn focus_view(&mut self, selector: &Selector) -> Result<(), ()>[src]
fn important_area(&self, _: Vec2) -> Rect[src]
Auto Trait Implementations
impl !RefUnwindSafe for LinearLayout
impl !Send for LinearLayout
impl !Sync for LinearLayout
impl Unpin for LinearLayout
impl !UnwindSafe for LinearLayout
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized, [src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized, [src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T[src]
impl<T> Erased for T[src]
impl<T> From<T> for T[src]
impl<T, U> Into<U> for T where
U: From<T>, [src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>, [src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>, [src]
U: TryFrom<T>,