pub struct VirtualizedList { /* private fields */ }Expand description
A native virtualized vertical list for large or expensive item trees.
The component owns GPUI’s ListState and renders only the visible item
range plus a configurable overdraw area. Pair it with crate::VirtualScrollbar
when a custom Liora scrollbar is needed.
Implementations§
Source§impl VirtualizedList
impl VirtualizedList
pub fn new( item_count: usize, _cx: &mut Context<'_, Self>, render_item: impl Fn(usize, &mut Window, &mut App) -> AnyElement + 'static, ) -> Self
pub fn entity( item_count: usize, cx: &mut App, render_item: impl Fn(usize, &mut Window, &mut App) -> AnyElement + 'static, ) -> Entity<Self>
pub fn list_state(&self) -> ListState
pub fn set_item_count(&mut self, item_count: usize)
pub fn set_render_item( &mut self, render_item: impl Fn(usize, &mut Window, &mut App) -> AnyElement + 'static, )
pub fn set_item_spacing(&mut self, spacing: impl Into<Pixels>)
pub fn set_overdraw(&mut self, overdraw: impl Into<Pixels>)
pub fn set_height(&mut self, height: Option<Pixels>)
pub fn set_draggable(&mut self, draggable: bool)
pub fn set_on_reorder( &mut self, callback: impl Fn(usize, usize, &mut Window, &mut App) + 'static, )
pub fn order(&self) -> &[usize]
Sourcepub fn measure_all_items_for_scrollbar(&mut self)
pub fn measure_all_items_for_scrollbar(&mut self)
Measure every item once so GPUI’s scrollbar math has a stable total height.
GPUI’s virtual list reports scrollbar extents from measured rows only; for long variable-height documents this can otherwise make the thumb jump or reach the ends before the content does. Use this when scrollbar accuracy is more important than the first-frame cost of measuring every row.
Sourcepub fn remeasure(&self)
pub fn remeasure(&self)
Mark every item for remeasurement while preserving proportional scroll.
Updating the render closure alone does not remeasure automatically, so callers that know item heights changed can opt into the heavier work.
Sourcepub fn remeasure_items(&self, range: Range<usize>)
pub fn remeasure_items(&self, range: Range<usize>)
Mark one item range for remeasurement while preserving proportional scroll.
Trait Implementations§
Source§impl Render for VirtualizedList
impl Render for VirtualizedList
Auto Trait Implementations§
impl !RefUnwindSafe for VirtualizedList
impl !Send for VirtualizedList
impl !Sync for VirtualizedList
impl !UnwindSafe for VirtualizedList
impl Freeze for VirtualizedList
impl Unpin for VirtualizedList
impl UnsafeUnpin for VirtualizedList
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more