Struct cursive::views::LinearLayout
[−]
[src]
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 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 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<&AnyView>
[src]
Returns a reference to a child.
pub fn get_child_mut(&mut self, i: usize) -> Option<&mut AnyView>
[src]
Returns a mutable reference to a child.
Trait Implementations
impl View for LinearLayout
[src]
fn draw(&self, printer: &Printer)
[src]
Draws the view with the given printer (includes bounds) and focus.
fn needs_relayout(&self) -> bool
[src]
Returns true
if the view content changed since last layout phase. Read more
fn layout(&mut self, size: Vec2)
[src]
Called once the size for this view has been decided, Read more
fn required_size(&mut self, req: Vec2) -> Vec2
[src]
Returns the minimum size the view requires with the given restrictions. Read more
fn take_focus(&mut self, source: Direction) -> bool
[src]
This view is offered focus. Will it take it? Read more
fn on_event(&mut self, event: Event) -> EventResult
[src]
Called when a key was pressed. Read more
fn call_on_any<'a>(
&mut self,
selector: &Selector,
callback: Box<FnMut(&mut Any) + 'a>
)
[src]
&mut self,
selector: &Selector,
callback: Box<FnMut(&mut Any) + 'a>
)
Runs a closure on the view identified by the given selector. Read more
fn focus_view(&mut self, selector: &Selector) -> Result<(), ()>
[src]
Moves the focus to the view identified by the given selector. Read more