Struct cursive::views::LinearLayout [−][src]
pub struct LinearLayout { /* fields omitted */ }
Arranges its children linearly according to its orientation.
Methods
impl LinearLayout
[src]
impl LinearLayout
pub fn new(orientation: Orientation) -> Self
[src]
pub fn new(orientation: Orientation) -> Self
Creates a new layout with the given orientation.
pub fn weight(self, weight: usize) -> Self
[src]
pub fn weight(self, weight: usize) -> Self
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]
pub fn child<V: View + 'static>(self, view: V) -> Self
Adds a child to the layout.
Chainable variant.
pub fn add_child<V: View + 'static>(&mut self, view: V)
[src]
pub fn add_child<V: View + 'static>(&mut self, view: V)
Adds a child to the layout.
pub fn len(&self) -> usize
[src]
pub fn len(&self) -> usize
Returns the number of children.
pub fn is_empty(&self) -> bool
[src]
pub fn is_empty(&self) -> bool
Returns true
if this view has no children.
pub fn get_focus_index(&self) -> usize
[src]
pub fn get_focus_index(&self) -> usize
Returns index of focused inner view
pub fn vertical() -> Self
[src]
pub fn vertical() -> Self
Creates a new vertical layout.
pub fn horizontal() -> Self
[src]
pub fn horizontal() -> Self
Creates a new horizontal layout.
pub fn get_child(&self, i: usize) -> Option<&View>
[src]
pub fn get_child(&self, i: usize) -> Option<&View>
Returns a reference to a child.
pub fn get_child_mut(&mut self, i: usize) -> Option<&mut View>
[src]
pub fn get_child_mut(&mut self, i: usize) -> Option<&mut View>
Returns a mutable reference to a child.
pub fn remove_child(&mut self, i: usize) -> Option<Box<View>>
[src]
pub fn remove_child(&mut self, i: usize) -> Option<Box<View>>
Removes a child.
If i
is within bounds, the removed child will be returned.
Trait Implementations
impl View for LinearLayout
[src]
impl View for LinearLayout
fn draw(&self, printer: &Printer)
[src]
fn draw(&self, printer: &Printer)
Draws the view with the given printer (includes bounds) and focus. Read more
fn needs_relayout(&self) -> bool
[src]
fn needs_relayout(&self) -> bool
Returns true
if the view content changed since last layout phase. Read more
fn layout(&mut self, size: Vec2)
[src]
fn layout(&mut self, size: Vec2)
Called once the size for this view has been decided. Read more
fn required_size(&mut self, req: Vec2) -> Vec2
[src]
fn required_size(&mut self, req: Vec2) -> Vec2
Returns the minimum size the view requires with the given restrictions. Read more
fn take_focus(&mut self, source: Direction) -> bool
[src]
fn take_focus(&mut self, source: Direction) -> bool
This view is offered focus. Will it take it? Read more
fn on_event(&mut self, event: Event) -> EventResult
[src]
fn on_event(&mut self, event: Event) -> EventResult
Called when an event is received (key press, mouse event, ...). Read more
fn call_on_any<'a>(&mut self, selector: &Selector, callback: AnyCb<'a>)
[src]
fn call_on_any<'a>(&mut self, selector: &Selector, callback: AnyCb<'a>)
Runs a closure on the view identified by the given selector. Read more
fn focus_view(&mut self, selector: &Selector) -> Result<(), ()>
[src]
fn focus_view(&mut self, selector: &Selector) -> Result<(), ()>
Moves the focus to the view identified by the given selector. Read more
fn important_area(&self, _: Vec2) -> Rect
[src]
fn important_area(&self, _: Vec2) -> Rect
What part of the view is important and should be visible? Read more
Auto Trait Implementations
impl !Send for LinearLayout
impl !Send for LinearLayout
impl !Sync for LinearLayout
impl !Sync for LinearLayout