Struct cursive::views::ListView [−][src]
pub struct ListView { /* fields omitted */ }
Displays a list of elements.
Methods
impl ListView
[src]
impl ListView
pub fn new() -> Self
[src]
pub fn new() -> Self
Creates a new, empty ListView
.
pub fn len(&self) -> usize
[src]
pub fn len(&self) -> usize
Returns the number of children, including delimiters.
pub fn is_empty(&self) -> bool
[src]
pub fn is_empty(&self) -> bool
Returns true
if this view contains no children.
Returns false
if at least a delimiter or a view is present.
pub fn children(&self) -> &[ListChild]
[src]
pub fn children(&self) -> &[ListChild]
Returns a reference to the children
pub fn get_row(&self, id: usize) -> &ListChild
[src]
pub fn get_row(&self, id: usize) -> &ListChild
Returns a reference to the child at the given position.
pub fn row_mut(&mut self, id: usize) -> &mut ListChild
[src]
pub fn row_mut(&mut self, id: usize) -> &mut ListChild
pub fn add_child<V: View + 'static>(&mut self, label: &str, view: V)
[src]
pub fn add_child<V: View + 'static>(&mut self, label: &str, view: V)
Adds a view to the end of the list.
pub fn clear(&mut self)
[src]
pub fn clear(&mut self)
Removes all children from this view.
pub fn child<V: View + 'static>(self, label: &str, view: V) -> Self
[src]
pub fn child<V: View + 'static>(self, label: &str, view: V) -> Self
Adds a view to the end of the list.
Chainable variant.
pub fn add_delimiter(&mut self)
[src]
pub fn add_delimiter(&mut self)
Adds a delimiter to the end of the list.
pub fn delimiter(self) -> Self
[src]
pub fn delimiter(self) -> Self
Adds a delimiter to the end of the list.
Chainable variant.
pub fn set_on_select<F>(&mut self, cb: F) where
F: Fn(&mut Cursive, &String) + 'static,
[src]
pub 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.
pub fn on_select<F>(self, cb: F) -> Self where
F: Fn(&mut Cursive, &String) + 'static,
[src]
pub 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.
pub fn focus(&self) -> usize
[src]
pub 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 Default for ListView
impl View for ListView
[src]
impl View for ListView
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 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 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 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 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 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, size: Vec2) -> Rect
[src]
fn important_area(&self, size: Vec2) -> Rect
What part of the view is important and should be visible? 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