pub struct VirtualGrid { /* private fields */ }Expand description
Virtualized grid state
Implementations§
Source§impl VirtualGrid
impl VirtualGrid
pub fn new(config: VirtualGridConfig) -> Self
Sourcepub fn set_item_count(&mut self, count: usize)
pub fn set_item_count(&mut self, count: usize)
Set total item count
Sourcepub fn item_count(&self) -> usize
pub fn item_count(&self) -> usize
Get total item count
Sourcepub fn set_viewport_height(&mut self, height: f32)
pub fn set_viewport_height(&mut self, height: f32)
Set viewport height
Sourcepub fn viewport_height(&self) -> f32
pub fn viewport_height(&self) -> f32
Get viewport height
Sourcepub fn set_scroll_position(&mut self, position: f32)
pub fn set_scroll_position(&mut self, position: f32)
Set scroll position
Sourcepub fn scroll_position(&self) -> f32
pub fn scroll_position(&self) -> f32
Get current scroll position
Sourcepub fn max_scroll(&self) -> f32
pub fn max_scroll(&self) -> f32
Get maximum scroll position
Sourcepub fn scroll_to_item(&mut self, index: usize, align: ScrollAlign)
pub fn scroll_to_item(&mut self, index: usize, align: ScrollAlign)
Scroll to specific item
Sourcepub fn row_height(&self) -> f32
pub fn row_height(&self) -> f32
Get row height (cell height + gap)
Sourcepub fn row_position(&self, row: usize) -> f32
pub fn row_position(&self, row: usize) -> f32
Get row position
Sourcepub fn content_height(&self) -> f32
pub fn content_height(&self) -> f32
Get content height
Sourcepub fn get_cell_layout(&self, index: usize) -> CellLayout
pub fn get_cell_layout(&self, index: usize) -> CellLayout
Get cell layout by index
Sourcepub fn get_cell_layout_by_position(&self, row: usize, col: usize) -> CellLayout
pub fn get_cell_layout_by_position(&self, row: usize, col: usize) -> CellLayout
Get cell layout by row/column
Sourcepub fn cell_to_index(&self, cell: &GridCell) -> usize
pub fn cell_to_index(&self, cell: &GridCell) -> usize
Convert grid cell to item index
Sourcepub fn index_to_cell(&self, index: usize) -> GridCell
pub fn index_to_cell(&self, index: usize) -> GridCell
Convert item index to grid cell
Sourcepub fn visible_range(&self) -> Option<&VisibleGridRange>
pub fn visible_range(&self) -> Option<&VisibleGridRange>
Get visible range