pub struct TreeState { /* private fields */ }Expand description
State for managing tree items.
Implementations§
Source§impl TreeState
impl TreeState
Sourcepub fn set_items(
&mut self,
items: impl Into<Vec<TreeItem>>,
cx: &mut Context<'_, Self>,
)
pub fn set_items( &mut self, items: impl Into<Vec<TreeItem>>, cx: &mut Context<'_, Self>, )
Set the tree items.
Sourcepub fn selected_index(&self) -> Option<usize>
pub fn selected_index(&self) -> Option<usize>
Get the currently selected index, if any.
Sourcepub fn set_selected_index(
&mut self,
ix: Option<usize>,
cx: &mut Context<'_, Self>,
)
pub fn set_selected_index( &mut self, ix: Option<usize>, cx: &mut Context<'_, Self>, )
Set the selected index, or None to clear selection.
Sourcepub fn set_selected_item(
&mut self,
item: Option<&TreeItem>,
cx: &mut Context<'_, Self>,
)
pub fn set_selected_item( &mut self, item: Option<&TreeItem>, cx: &mut Context<'_, Self>, )
Set the selected index by tree item, or None to clear selection.
Sourcepub fn selected_item(&self) -> Option<&TreeItem>
pub fn selected_item(&self) -> Option<&TreeItem>
Get the currently selected tree item, if any.
pub fn scroll_to_item(&mut self, ix: usize, strategy: ScrollStrategy)
Sourcepub fn selected_entry(&self) -> Option<&TreeEntry>
pub fn selected_entry(&self) -> Option<&TreeEntry>
Get the currently selected entry, if any.
pub fn focus(&mut self, window: &mut Window, cx: &mut App)
Trait Implementations§
impl EventEmitter<TreeEvent> for TreeState
Auto Trait Implementations§
impl !RefUnwindSafe for TreeState
impl !Send for TreeState
impl !Sync for TreeState
impl !UnwindSafe for TreeState
impl Freeze for TreeState
impl Unpin for TreeState
impl UnsafeUnpin for TreeState
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
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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>
Converts
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>
Converts
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