pub struct ListState { /* private fields */ }Expand description
A cursor over a list of rows, the first row shown, and a selection.
Rows are positions in what is listed (after filtering, say); the selection is kept by index, whatever the caller’s indices are (an item’s index before filtering), so marks survive a change of filter. Movement takes the page, the rows on screen, since that can change with every render.
Implementations§
Source§impl ListState
impl ListState
pub fn new() -> ListState
pub fn is_empty(&self) -> bool
Sourcepub fn set_len(&mut self, len: usize)
pub fn set_len(&mut self, len: usize)
Set the number of rows. The cursor is left where it is: call
reset or set_cursor to put it
on a row that exists.
Sourcepub fn set_cursor(&mut self, row: usize)
pub fn set_cursor(&mut self, row: usize)
Put the cursor on row, without scrolling (see
follow).
pub fn set_offset(&mut self, offset: usize)
Sourcepub fn reset(&mut self, row: usize, page: usize)
pub fn reset(&mut self, row: usize, page: usize)
Put the cursor on row and the first row shown back at the top,
then scroll just enough to show the cursor: after the rows changed.
Sourcepub fn follow(&mut self, page: usize)
pub fn follow(&mut self, page: usize)
Scroll just enough that the cursor’s row is among the page shown.
Sourcepub fn step(&mut self, delta: isize, page: usize)
pub fn step(&mut self, delta: isize, page: usize)
Move the cursor by delta rows (negative: up), stopping at the
ends, and scroll to follow it. Nothing happens with no rows.
Sourcepub fn select_row(&mut self, row: usize, page: usize)
pub fn select_row(&mut self, row: usize, page: usize)
Move to row (clamped to the last) and scroll to show it.
Sourcepub fn clear_selection(&mut self, count: usize)
pub fn clear_selection(&mut self, count: usize)
Make room to select count indices, all unselected.
pub fn is_selected(&self, index: usize) -> bool
Sourcepub fn set_selected(&mut self, index: usize, on: bool)
pub fn set_selected(&mut self, index: usize, on: bool)
Select or unselect index; indices past the room made are grown to.
Sourcepub fn selected_count(&self) -> usize
pub fn selected_count(&self) -> usize
How many indices are selected.
Trait Implementations§
impl Eq for ListState
impl StructuralPartialEq for ListState
Auto Trait Implementations§
impl Freeze for ListState
impl RefUnwindSafe for ListState
impl Send for ListState
impl Sync for ListState
impl Unpin for ListState
impl UnsafeUnpin for ListState
impl UnwindSafe for ListState
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.