Struct cursive::views::ListView
[−]
[src]
pub struct ListView { /* fields omitted */ }
Displays a scrollable list of elements.
Methods
impl ListView
[src]
fn new() -> Self
[src]
Creates a new, empty ListView
.
fn len(&self) -> usize
[src]
Returns the number of children, including delimiters.
fn is_empty(&self) -> bool
[src]
Returns true
if this view contains no children.
Returns false
if at least a delimiter or a view is present.
fn children(&self) -> &[ListChild]
[src]
Returns a reference to the children
fn get_row(&self, id: usize) -> &ListChild
[src]
Returns a reference to the child at the given position.
fn row_mut(&mut self, id: usize) -> &mut ListChild
[src]
fn add_child<V: View + 'static>(&mut self, label: &str, view: V)
[src]
Adds a view to the end of the list.
fn clear(&mut self)
[src]
Removes all children from this view.
fn child<V: View + 'static>(self, label: &str, view: V) -> Self
[src]
Adds a view to the end of the list.
Chainable variant.
fn add_delimiter(&mut self)
[src]
Adds a delimiter to the end of the list.
fn delimiter(self) -> Self
[src]
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,
[src]
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,
[src]
F: Fn(&mut Cursive, &String) + 'static,
Sets a callback to be used when an item is selected.
Chainable variant.
fn focus(&self) -> usize
[src]
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)
[src]
Draws the view with the given printer (includes bounds) and focus.
fn required_size(&mut self, req: Vec2) -> Vec2
[src]
Returns the minimum size the view requires with the given restrictions. Read more
fn layout(&mut self, size: Vec2)
[src]
Called once the size for this view has been decided, Read more
fn on_event(&mut self, event: Event) -> EventResult
[src]
Called when a key was pressed. Read more
fn take_focus(&mut self, source: Direction) -> bool
[src]
This view is offered focus. Will it take it? 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
fn needs_relayout(&self) -> bool
[src]
Returns true
if the view content changed since last layout phase. Read more