pub struct ListCursor { /* private fields */ }Expand description
A focus over len rows and the window of rows shown around it.
The window’s place lives in the cursor, so it doesn’t jump from frame
to frame: ask for it with window (rows of one height)
or window_by_heights each time the list is
shown.
Implementations§
Source§impl ListCursor
impl ListCursor
Sourcepub fn scrolling(self, scroll: Scroll) -> Self
pub fn scrolling(self, scroll: Scroll) -> Self
The same cursor, its window following the focus by scroll.
Sourcepub fn at(self, index: usize) -> Self
pub fn at(self, index: usize) -> Self
The same cursor on row index (the last row, if there is no such
row).
Sourcepub fn first_shown(&self) -> usize
pub fn first_shown(&self) -> usize
The first row of the window, as the last window
or window_by_heights left it.
Sourcepub fn step(
&mut self,
forward: bool,
wrap: bool,
enabled: impl Fn(usize) -> bool,
) -> bool
pub fn step( &mut self, forward: bool, wrap: bool, enabled: impl Fn(usize) -> bool, ) -> bool
Moves the focus to the next (forward) or previous row that
enabled accepts, going round the ends if wrap, else stopping at
them. Returns whether the focus moved, so the caller knows to play
its move sound. With no such row it stays put.
Sourcepub fn settle(&mut self, enabled: impl Fn(usize) -> bool) -> bool
pub fn settle(&mut self, enabled: impl Fn(usize) -> bool) -> bool
Moves the focus off a row enabled rejects: to the next row it
accepts, else the nearest one before. Returns whether it moved. For
after the rows changed (a row was used up, or removed).
Sourcepub fn set_len(&mut self, len: usize)
pub fn set_len(&mut self, len: usize)
Sets the number of rows, after some were added or removed. A focus past the new end moves to the last row; the window is clamped the next time it is asked for.
Sourcepub fn window(&mut self, rows_shown: usize) -> Range<usize> ⓘ
pub fn window(&mut self, rows_shown: usize) -> Range<usize> ⓘ
The rows a box of rows_shown rows shows: always the focus, placed
by the cursor’s Scroll rule, and never past the end of the list
while there are rows before it to show instead. A box of no rows
still shows the focused one. With no rows it is empty.
Trait Implementations§
Source§impl Clone for ListCursor
impl Clone for ListCursor
Source§fn clone(&self) -> ListCursor
fn clone(&self) -> ListCursor
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more