VirtualGrid

Struct VirtualGrid 

Source
pub struct VirtualGrid { /* private fields */ }
Expand description

Virtualized grid state

Implementations§

Source§

impl VirtualGrid

Source

pub fn new(config: VirtualGridConfig) -> Self

Source

pub fn set_item_count(&mut self, count: usize)

Set total item count

Source

pub fn item_count(&self) -> usize

Get total item count

Source

pub fn row_count(&self) -> usize

Get row count

Source

pub fn set_viewport_height(&mut self, height: f32)

Set viewport height

Source

pub fn viewport_height(&self) -> f32

Get viewport height

Source

pub fn set_scroll_position(&mut self, position: f32)

Set scroll position

Source

pub fn scroll_position(&self) -> f32

Get current scroll position

Source

pub fn max_scroll(&self) -> f32

Get maximum scroll position

Source

pub fn scroll_by(&mut self, delta: f32)

Scroll by delta

Source

pub fn scroll_to_item(&mut self, index: usize, align: ScrollAlign)

Scroll to specific item

Source

pub fn row_height(&self) -> f32

Get row height (cell height + gap)

Source

pub fn row_position(&self, row: usize) -> f32

Get row position

Source

pub fn content_height(&self) -> f32

Get content height

Source

pub fn get_cell_layout(&self, index: usize) -> CellLayout

Get cell layout by index

Source

pub fn get_cell_layout_by_position(&self, row: usize, col: usize) -> CellLayout

Get cell layout by row/column

Source

pub fn cell_to_index(&self, cell: &GridCell) -> usize

Convert grid cell to item index

Source

pub fn index_to_cell(&self, index: usize) -> GridCell

Convert item index to grid cell

Source

pub fn visible_range(&self) -> Option<&VisibleGridRange>

Get visible range

Source

pub fn reset(&mut self)

Reset scroll position

Trait Implementations§

Source§

impl Default for VirtualGrid

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.