Struct cursive::views::ListView
[−]
[src]
pub struct ListView { /* fields omitted */ }
Displays a scrollable list of elements.
Methods
impl ListView
[src]
fn new() -> Self
Creates a new, empty ListView
.
fn add_child<V: View + 'static>(&mut self, label: &str, view: V)
Adds a view to the end of the list.
fn clear(&mut self)
Removes all children from this view.
fn child<V: View + 'static>(self, label: &str, view: V) -> Self
Adds a view to the end of the list.
Chainable variant.
fn add_delimiter(&mut self)
Adds a delimiter to the end of the list.
fn delimiter(self) -> Self
Adds a delimiter to the end of the list.
Chainable variant.
fn set_on_select<F>(&mut self, cb: F) where F: Fn(&mut Cursive, &String) + 'static
Sets a callback to be used when an item is selected.
fn on_select<F>(self, cb: F) -> Self where F: Fn(&mut Cursive, &String) + 'static
Sets a callback to be used when an item is selected.
Chainable variant.
fn focus(&self) -> usize
Returns the index of the currently focused item.
Panics if the list is empty.
Trait Implementations
impl Default for ListView
[src]
impl View for ListView
[src]
fn draw(&self, printer: &Printer)
Draws the view with the given printer (includes bounds) and focus.
fn required_size(&mut self, req: Vec2) -> Vec2
Returns the minimum size the view requires with the given restrictions. Read more
fn layout(&mut self, size: Vec2)
Called once the size for this view has been decided, Read more
fn on_event(&mut self, event: Event) -> EventResult
Called when a key was pressed. Read more
fn take_focus(&mut self, source: Direction) -> bool
This view is offered focus. Will it take it? Read more
fn find_any(&mut self, selector: &Selector) -> Option<&mut Any>
Finds the view pointed to by the given path. Read more
fn needs_relayout(&self) -> bool
Returns true
if the view content changed since last layout phase. Read more