[−][src]Struct cursive::views::ListView
Displays a list of elements.
Methods
impl ListView
[src]
pub fn new() -> Self
[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]
pub fn add_child<V: View + 'static>(&mut self, label: &str, view: V)
[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: View + 'static>(self, label: &str, view: V) -> Self
[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) -> Self
[src]
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]
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]
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]
Returns the index of the currently focused item.
Panics if the list is empty.
Trait Implementations
impl View for ListView
[src]
fn draw(&self, printer: &Printer)
[src]
fn required_size(&mut self, req: Vec2) -> Vec2
[src]
fn layout(&mut self, size: Vec2)
[src]
fn on_event(&mut self, event: Event) -> EventResult
[src]
fn take_focus(&mut self, source: Direction) -> bool
[src]
fn call_on_any<'a>(&mut self, selector: &Selector, callback: AnyCb<'a>)
[src]
fn focus_view(&mut self, selector: &Selector) -> Result<(), ()>
[src]
fn important_area(&self, size: Vec2) -> Rect
[src]
fn needs_relayout(&self) -> bool
[src]
Should return true
if the view content changed since the last call to layout()
. Read more
impl Default for ListView
[src]
Auto Trait Implementations
Blanket Implementations
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From for T
[src]
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,