Skip to main content

VListState

Struct VListState 

Source
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: i32

the selected row, -1 none

§estimate: i32

the 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

Source

pub fn new() -> VListState

no rows yet, nothing selected

Source

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

Source

pub fn invalidate(&mut self, i: usize)

row i is measured again the next time it is built

Source

pub fn invalidate_all(&mut self)

every row is measured again

Source

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)

Source

pub fn remove(&mut self, at: usize, n: usize)

rows at .. at + n were removed (the selection on one of them: none)

Source

pub fn reveal(&mut self, i: usize)

scroll row i fully into view (the next pass)

Source

pub fn scroll_to(&mut self, i: usize)

show row i at the top of the view

Source

pub fn first_visible(&self) -> (usize, i32)

the first visible row and how many px of it are scrolled out above the view

Source

pub fn row_height(&self, i: usize) -> i32

row i’s height in px (measured or given; else the estimate)

Source

pub fn row_known(&self, i: usize) -> bool

row i’s height is measured or given

Source

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)

Source

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)

Source

pub fn set_scroll_pos(&mut self, px: i64)

scroll to a position (px; the next pass keeps the view inside the rows)

Source

pub fn total_height(&self) -> i64

the height of all rows (px; rows not measured count with the estimate)

Trait Implementations§

Source§

impl Clone for VListState

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Default for VListState

Source§

fn default() -> VListState

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,

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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.