Struct cursive::views::ListView[][src]

pub struct ListView { /* fields omitted */ }

Displays a list of elements.

Implementations

impl ListView[src]

pub fn new() -> ListView[src]

Creates a new, empty ListView.

pub fn len(&self) -> usize[src]

Returns the number of children, including delimiters.

pub 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.

pub fn children(&self) -> &[ListChild][src]

Returns a reference to the children

pub fn get_row(&self, id: usize) -> &ListChild[src]

Returns a reference to the child at the given position.

pub fn row_mut(&mut self, id: usize) -> &mut ListChild[src]

Gives mutable access to the child at the given position.

Panics

Panics if id >= self.len().

pub fn add_child<V>(&mut self, label: &str, view: V) where
    V: 'static + IntoBoxedView
[src]

Adds a view to the end of the list.

pub fn clear(&mut self)[src]

Removes all children from this view.

pub fn child<V>(self, label: &str, view: V) -> ListView where
    V: 'static + IntoBoxedView
[src]

Adds a view to the end of the list.

Chainable variant.

pub fn add_delimiter(&mut self)[src]

Adds a delimiter to the end of the list.

pub fn delimiter(self) -> ListView[src]

Adds a delimiter to the end of the list.

Chainable variant.

pub fn remove_child(&mut self, index: usize) -> ListChild[src]

Removes a child from the view.

Panics

If index >= self.len().

pub fn set_on_select<F>(&mut self, cb: F) where
    F: Fn(&mut Cursive, &String) + 'static, 
[src]

Sets a callback to be used when an item is selected.

pub fn on_select<F>(self, cb: F) -> ListView where
    F: Fn(&mut Cursive, &String) + 'static, 
[src]

Sets a callback to be used when an item is selected.

Chainable variant.

pub 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]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> AnyView for T where
    T: View
[src]

pub fn as_any(&self) -> &(dyn Any + 'static)[src]

Downcast self to a Any.

pub fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)[src]

Downcast self to a mutable Any.

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Erased for T

impl<T> Finder for T where
    T: View
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> IntoBoxedView for T where
    T: View
[src]

impl<T> Nameable for T where
    T: View
[src]

impl<T> Resizable for T where
    T: View
[src]

impl<T> Scrollable for T where
    T: View
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> With for T[src]