pub struct ListState<D: ListDelegate> { /* private fields */ }Expand description
The state for List.
List required all items has the same height.
Implementations§
Source§impl<D> ListState<D>where
D: ListDelegate,
impl<D> ListState<D>where
D: ListDelegate,
pub fn new(delegate: D, window: &mut Window, cx: &mut Context<'_, Self>) -> Self
Sourcepub fn searchable(self, searchable: bool) -> Self
pub fn searchable(self, searchable: bool) -> Self
Sets whether the list is searchable, default is false.
When true, there will be a search input at the top of the list.
pub fn set_searchable(&mut self, searchable: bool, cx: &mut Context<'_, Self>)
Sourcepub fn selectable(self, selectable: bool) -> Self
pub fn selectable(self, selectable: bool) -> Self
Sets whether the list is selectable, default is true.
Sourcepub fn set_selectable(&mut self, selectable: bool, cx: &mut Context<'_, Self>)
pub fn set_selectable(&mut self, selectable: bool, cx: &mut Context<'_, Self>)
Sets whether the list is selectable, default is true.
pub fn delegate(&self) -> &D
pub fn delegate_mut(&mut self) -> &mut D
Sourcepub fn focus(&mut self, window: &mut Window, cx: &mut App)
pub fn focus(&mut self, window: &mut Window, cx: &mut App)
Focus the list, if the list is searchable, focus the search input.
Sourcepub fn set_selected_index(
&mut self,
ix: Option<IndexPath>,
window: &mut Window,
cx: &mut Context<'_, Self>,
)
pub fn set_selected_index( &mut self, ix: Option<IndexPath>, window: &mut Window, cx: &mut Context<'_, Self>, )
Set the selected index of the list, this method will not scroll to the selected item.
pub fn selected_index(&self) -> Option<IndexPath>
Sourcepub fn set_right_clicked_index(
&mut self,
ix: Option<IndexPath>,
window: &mut Window,
cx: &mut Context<'_, Self>,
)
pub fn set_right_clicked_index( &mut self, ix: Option<IndexPath>, window: &mut Window, cx: &mut Context<'_, Self>, )
Set the index of the item that has been right clicked.
Sourcepub fn right_clicked_index(&self) -> Option<IndexPath>
pub fn right_clicked_index(&self) -> Option<IndexPath>
Returns the index of the item that has been right clicked.
Sourcepub fn set_query(
&mut self,
query: &str,
window: &mut Window,
cx: &mut Context<'_, Self>,
)
pub fn set_query( &mut self, query: &str, window: &mut Window, cx: &mut Context<'_, Self>, )
Set the query text of the search input, this will trigger a search.
Sourcepub fn set_item_to_measure_index(
&mut self,
ix: IndexPath,
_: &mut Window,
cx: &mut Context<'_, Self>,
)
pub fn set_item_to_measure_index( &mut self, ix: IndexPath, _: &mut Window, cx: &mut Context<'_, Self>, )
Set a specific list item for measurement.
If the item is absent, measure the first item in the first non-empty section.
Sourcepub fn scroll_to_item(
&mut self,
ix: IndexPath,
strategy: ScrollStrategy,
_: &mut Window,
cx: &mut Context<'_, Self>,
)
pub fn scroll_to_item( &mut self, ix: IndexPath, strategy: ScrollStrategy, _: &mut Window, cx: &mut Context<'_, Self>, )
Scroll to the item at the given index.
Sourcepub fn scroll_handle(&self) -> &VirtualListScrollHandle
pub fn scroll_handle(&self) -> &VirtualListScrollHandle
Get scroll handle
pub fn scroll_to_selected_item( &mut self, _: &mut Window, cx: &mut Context<'_, Self>, )
Trait Implementations§
impl<D> EventEmitter<ListEvent> for ListState<D>where
D: ListDelegate,
Source§impl<D> Focusable for ListState<D>where
D: ListDelegate,
impl<D> Focusable for ListState<D>where
D: ListDelegate,
Source§fn focus_handle(&self, cx: &App) -> FocusHandle
fn focus_handle(&self, cx: &App) -> FocusHandle
Auto Trait Implementations§
impl<D> !RefUnwindSafe for ListState<D>
impl<D> !Send for ListState<D>
impl<D> !Sync for ListState<D>
impl<D> !UnwindSafe for ListState<D>
impl<D> Forget for ListState<D>
impl<D> Freeze for ListState<D>where
NonZero<u32>: Freeze,
*const ArcInner<RwLock<RawRwLock, FocusMap>> is !null: Freeze,
PhantomData<ArcInner<RwLock<RawRwLock, FocusMap>>>: Freeze,
*const (): Freeze,
*const ArcInner<RwLock<RawRwLock, EntityRefCounts>> is !null: Freeze,
PhantomData<fn(InputBaseState<InputMode>) -> InputBaseState<InputMode>>: Freeze,
&'static str: Freeze,
*const ArcInner<str> is !null: Freeze,
PhantomData<ArcInner<str>>: Freeze,
D: Freeze,
*const u8 is !null: Freeze,
PhantomData<u8>: Freeze,
*const RcInner<RefCell<VirtualListScrollHandleState>> is !null: Freeze,
PhantomData<RcInner<RefCell<VirtualListScrollHandleState>>>: Freeze,
*const RcInner<RefCell<ScrollHandleState>> is !null: Freeze,
PhantomData<RcInner<RefCell<ScrollHandleState>>>: Freeze,
*const RcInner<Vec<RowEntry>> is !null: Freeze,
PhantomData<RcInner<Vec<RowEntry>>>: Freeze,
*const RcInner<Vec<usize>> is !null: Freeze,
PhantomData<RcInner<Vec<usize>>>: Freeze,
*const RcInner<Vec<Size<Pixels>>> is !null: Freeze,
PhantomData<RcInner<Vec<Size<Pixels>>>>: Freeze,
*const RcInner<Cell<Option<Pixels>>> is !null: Freeze,
PhantomData<RcInner<Cell<Option<Pixels>>>>: Freeze,
*const () is !null: Freeze,
PhantomData<((), RunnableMeta)>: Freeze,
*const Task<Box<dyn Any + Send + Sync>> is !null: Freeze,
PhantomData<Task<Box<dyn Any + Send + Sync>>>: Freeze,
PhantomData<fn()>: Freeze,
*const ArcInner<Mutex<RawMutex, RendezvousState<()>>> is !null: Freeze,
PhantomData<ArcInner<Mutex<RawMutex, RendezvousState<()>>>>: Freeze,
*const dyn FnOnce() is !null: Freeze,
PhantomData<dyn FnOnce()>: Freeze,
impl<D> Move for ListState<D>
impl<D> Unpin for ListState<D>where
D: Unpin,
NonZero<u32>: Unpin,
Arc<RwLock<RawRwLock, FocusMap>>: Unpin,
*const (): Unpin,
*const ArcInner<RwLock<RawRwLock, EntityRefCounts>> is !null: Unpin,
&'static str: Unpin,
Arc<str>: Unpin,
*const u8 is !null: Unpin,
Rc<RefCell<VirtualListScrollHandleState>>: Unpin,
Rc<RefCell<ScrollHandleState>>: Unpin,
Rc<Vec<RowEntry>>: Unpin,
Rc<Vec<usize>>: Unpin,
Rc<Vec<Size<Pixels>>>: Unpin,
Rc<Cell<Option<Pixels>>>: Unpin,
Task<(), RunnableMeta>: Unpin,
Box<Task<Box<dyn Any + Send + Sync>>>: Unpin,
Arc<Mutex<RawMutex, RendezvousState<()>>>: Unpin,
Box<dyn FnOnce()>: Unpin,
impl<D> UnsafeUnpin for ListState<D>where
NonZeroU32Inner: UnsafeUnpin,
*const ArcInner<RwLock<RawRwLock, FocusMap>> is !null: UnsafeUnpin,
PhantomData<ArcInner<RwLock<RawRwLock, FocusMap>>>: UnsafeUnpin,
*const (): UnsafeUnpin,
*const ArcInner<RwLock<RawRwLock, EntityRefCounts>> is !null: UnsafeUnpin,
PhantomData<fn(InputBaseState<InputMode>) -> InputBaseState<InputMode>>: UnsafeUnpin,
&'static str: UnsafeUnpin,
*const ArcInner<str> is !null: UnsafeUnpin,
PhantomData<ArcInner<str>>: UnsafeUnpin,
D: UnsafeUnpin,
*const u8 is !null: UnsafeUnpin,
PhantomData<u8>: UnsafeUnpin,
*const RcInner<RefCell<VirtualListScrollHandleState>> is !null: UnsafeUnpin,
PhantomData<RcInner<RefCell<VirtualListScrollHandleState>>>: UnsafeUnpin,
*const RcInner<RefCell<ScrollHandleState>> is !null: UnsafeUnpin,
PhantomData<RcInner<RefCell<ScrollHandleState>>>: UnsafeUnpin,
*const RcInner<Vec<RowEntry>> is !null: UnsafeUnpin,
PhantomData<RcInner<Vec<RowEntry>>>: UnsafeUnpin,
*const RcInner<Vec<usize>> is !null: UnsafeUnpin,
PhantomData<RcInner<Vec<usize>>>: UnsafeUnpin,
*const RcInner<Vec<Size<Pixels>>> is !null: UnsafeUnpin,
PhantomData<RcInner<Vec<Size<Pixels>>>>: UnsafeUnpin,
*const RcInner<Cell<Option<Pixels>>> is !null: UnsafeUnpin,
PhantomData<RcInner<Cell<Option<Pixels>>>>: UnsafeUnpin,
*const () is !null: UnsafeUnpin,
PhantomData<((), RunnableMeta)>: UnsafeUnpin,
*const Task<Box<dyn Any + Send + Sync>> is !null: UnsafeUnpin,
PhantomData<Task<Box<dyn Any + Send + Sync>>>: UnsafeUnpin,
PhantomData<fn()>: UnsafeUnpin,
*const ArcInner<Mutex<RawMutex, RendezvousState<()>>> is !null: UnsafeUnpin,
PhantomData<ArcInner<Mutex<RawMutex, RendezvousState<()>>>>: UnsafeUnpin,
*const dyn FnOnce() is !null: UnsafeUnpin,
PhantomData<dyn FnOnce()>: UnsafeUnpin,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
impl<T> ErasedDestructor for Twhere
T: 'static,
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