Struct cursive::views::LinearLayout
source · pub struct LinearLayout { /* private fields */ }
Expand description
Arranges its children linearly according to its orientation.
Implementations
sourceimpl LinearLayout
impl LinearLayout
sourcepub fn new(orientation: Orientation) -> Self
pub fn new(orientation: Orientation) -> Self
Creates a new layout with the given orientation.
sourcepub fn weight(self, weight: usize) -> Self
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).
sourcepub fn child<V: View + 'static>(self, view: V) -> Self
pub fn child<V: View + 'static>(self, view: V) -> Self
Adds a child to the layout.
Chainable variant.
sourcepub fn get_focus_index(&self) -> usize
pub fn get_focus_index(&self) -> usize
Returns index of focused inner view
sourcepub fn horizontal() -> Self
pub fn horizontal() -> Self
Creates a new horizontal layout.
sourcepub fn get_child_mut(&mut self, i: usize) -> Option<&mut dyn View>
pub fn get_child_mut(&mut self, i: usize) -> Option<&mut dyn View>
Returns a mutable reference to a child.
Trait Implementations
sourceimpl View for LinearLayout
impl View for LinearLayout
sourcefn draw(&self, printer: &Printer<'_, '_>)
fn draw(&self, printer: &Printer<'_, '_>)
Draws the view with the given printer (includes bounds) and focus. Read more
sourcefn needs_relayout(&self) -> bool
fn needs_relayout(&self) -> bool
Returns
true
if the view content changed since last layout phase. Read moresourcefn layout(&mut self, size: Vec2)
fn layout(&mut self, size: Vec2)
Called once the size for this view has been decided. Read more
sourcefn required_size(&mut self, req: Vec2) -> Vec2
fn required_size(&mut self, req: Vec2) -> Vec2
Returns the minimum size the view requires with the given restrictions. Read more
sourcefn take_focus(&mut self, source: Direction) -> bool
fn take_focus(&mut self, source: Direction) -> bool
This view is offered focus. Will it take it? Read more
sourcefn on_event(&mut self, event: Event) -> EventResult
fn on_event(&mut self, event: Event) -> EventResult
Called when an event is received (key press, mouse event, …). Read more
sourcefn call_on_any<'a>(&mut self, selector: &Selector<'_>, callback: AnyCb<'a>)
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
sourcefn focus_view(&mut self, selector: &Selector<'_>) -> Result<(), ()>
fn focus_view(&mut self, selector: &Selector<'_>) -> Result<(), ()>
Moves the focus to the view identified by the given selector. Read more
sourcefn important_area(&self, _: Vec2) -> Rect
fn important_area(&self, _: Vec2) -> Rect
What part of the view is important and should be visible? Read more
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
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more