pub struct VListState {
pub sel: i32,
pub estimate: i32,
/* private fields */
}Expand description
the state of a list with rows of different heights (see the module header)
Fields§
§sel: i32the selected row, -1 none
estimate: i32the height of a row that was not measured yet (DIP; 0: 40 at first, then the mean of the measured rows)
Implementations§
Source§impl VListState
impl VListState
Sourcepub fn new() -> VListState
pub fn new() -> VListState
no rows yet, nothing selected
Sourcepub fn set_height(&mut self, i: usize, dip: i32)
pub fn set_height(&mut self, i: usize, dip: i32)
row i is dip high (the app knows it: its box is not measured); 0 measures it again
Sourcepub fn invalidate(&mut self, i: usize)
pub fn invalidate(&mut self, i: usize)
row i is measured again the next time it is built
Sourcepub fn invalidate_all(&mut self)
pub fn invalidate_all(&mut self)
every row is measured again
Sourcepub fn insert(&mut self, at: usize, n: usize)
pub fn insert(&mut self, at: usize, n: usize)
n rows were inserted before row at: the view keeps showing the rows it showed (also
the selection stays on its row)
Sourcepub fn remove(&mut self, at: usize, n: usize)
pub fn remove(&mut self, at: usize, n: usize)
rows at .. at + n were removed (the selection on one of them: none)
Sourcepub fn first_visible(&self) -> (usize, i32)
pub fn first_visible(&self) -> (usize, i32)
the first visible row and how many px of it are scrolled out above the view
Sourcepub fn row_height(&self, i: usize) -> i32
pub fn row_height(&self, i: usize) -> i32
row i’s height in px (measured or given; else the estimate)
Sourcepub fn set_count(&mut self, n: usize)
pub fn set_count(&mut self, n: usize)
the number of rows (vlist_begin sets it from its count; rows come and go at the end)
Sourcepub fn scroll_pos(&self) -> i64
pub fn scroll_pos(&self) -> i64
the scroll position: px from the first row’s top to the view’s top (rows not measured count with the estimate)
Sourcepub fn set_scroll_pos(&mut self, px: i64)
pub fn set_scroll_pos(&mut self, px: i64)
scroll to a position (px; the next pass keeps the view inside the rows)
Sourcepub fn total_height(&self) -> i64
pub fn total_height(&self) -> i64
the height of all rows (px; rows not measured count with the estimate)