pub struct TreeView { /* private fields */ }Expand description
A tree of expandable rows. See the module docs.
Implementations§
Source§impl TreeView
impl TreeView
Sourcepub fn new(id: impl Into<ElementId>, items: Vec<TreeItem>) -> Self
pub fn new(id: impl Into<ElementId>, items: Vec<TreeItem>) -> Self
A tree over items. id keys its cursor, expansion and selection;
give every instance its own.
Sourcepub fn max_h(self, height: impl Into<Pixels>) -> Self
pub fn max_h(self, height: impl Into<Pixels>) -> Self
Caps the tree’s height. Taller content scrolls inside it, and only the rows in view are built. Without a cap the tree is as tall as its open rows unless its parent bounds it.
Sourcepub fn selection_mode(self, mode: SelectionMode) -> Self
pub fn selection_mode(self, mode: SelectionMode) -> Self
None (the default), Single or Multiple.
Sourcepub fn selected_keys(self, keys: impl IntoIterator<Item = SharedString>) -> Self
pub fn selected_keys(self, keys: impl IntoIterator<Item = SharedString>) -> Self
The controlled selection.
Sourcepub fn default_selected_keys(
self,
keys: impl IntoIterator<Item = SharedString>,
) -> Self
pub fn default_selected_keys( self, keys: impl IntoIterator<Item = SharedString>, ) -> Self
The initial selection of an uncontrolled tree.
Sourcepub fn disallow_empty_selection(self, v: bool) -> Self
pub fn disallow_empty_selection(self, v: bool) -> Self
Keeps the last selected row from being deselected.
Sourcepub fn expanded_keys(self, keys: impl IntoIterator<Item = SharedString>) -> Self
pub fn expanded_keys(self, keys: impl IntoIterator<Item = SharedString>) -> Self
The controlled set of expanded parents.
Sourcepub fn default_expanded_keys(
self,
keys: impl IntoIterator<Item = SharedString>,
) -> Self
pub fn default_expanded_keys( self, keys: impl IntoIterator<Item = SharedString>, ) -> Self
The parents expanded at first in an uncontrolled tree.
Sourcepub fn disabled_keys(self, keys: impl IntoIterator<Item = SharedString>) -> Self
pub fn disabled_keys(self, keys: impl IntoIterator<Item = SharedString>) -> Self
Rows that behave as TreeItem::is_disabled.
Sourcepub fn is_disabled(self, disabled: bool) -> Self
pub fn is_disabled(self, disabled: bool) -> Self
A disabled tree renders dimmed, leaves the tab order and ignores input.
Sourcepub fn on_selection_change(
self,
f: impl Fn(&HashSet<SharedString>, &mut Window, &mut App) + 'static,
) -> Self
pub fn on_selection_change( self, f: impl Fn(&HashSet<SharedString>, &mut Window, &mut App) + 'static, ) -> Self
Reports the selection after a press, Enter, Space or Escape changed it.
Sourcepub fn on_expanded_change(
self,
f: impl Fn(&HashSet<SharedString>, &mut Window, &mut App) + 'static,
) -> Self
pub fn on_expanded_change( self, f: impl Fn(&HashSet<SharedString>, &mut Window, &mut App) + 'static, ) -> Self
Reports the expanded set after a chevron, a key or a press changed it.
Trait Implementations§
Source§impl Disableable for TreeView
impl Disableable for TreeView
Source§fn is_disabled(self, disabled: bool) -> Self
fn is_disabled(self, disabled: bool) -> Self
isDisabled — whether the component is disabled.Source§impl IntoElement for TreeView
impl IntoElement for TreeView
Source§type Element = ViewElement<TreeView>
type Element = ViewElement<TreeView>
Source§fn into_element(self) -> Self::Element
fn into_element(self) -> Self::Element
Element.Source§fn into_any_element(self) -> AnyElement
fn into_any_element(self) -> AnyElement
AnyElement.Source§impl RenderOnce for TreeView
impl RenderOnce for TreeView
Source§fn render(self, window: &mut Window, cx: &mut App) -> impl IntoElement
fn render(self, window: &mut Window, cx: &mut App) -> impl IntoElement
Render::render() method
which takes a mutable reference.Auto Trait Implementations§
impl !RefUnwindSafe for TreeView
impl !Send for TreeView
impl !Sync for TreeView
impl !UnwindSafe for TreeView
impl Freeze for TreeView
impl Unpin for TreeView
impl UnsafeUnpin for TreeView
Blanket Implementations§
Source§impl<E> AnimationExt for Ewhere
E: IntoElement + 'static,
impl<E> AnimationExt for Ewhere
E: IntoElement + 'static,
Source§fn with_animation(
self,
id: impl Into<ElementId>,
animation: Animation,
animator: impl Fn(Self, f32) -> Self + 'static,
) -> AnimationElement<Self>where
Self: Sized,
fn with_animation(
self,
id: impl Into<ElementId>,
animation: Animation,
animator: impl Fn(Self, f32) -> Self + 'static,
) -> AnimationElement<Self>where
Self: Sized,
Source§fn with_animations(
self,
id: impl Into<ElementId>,
animations: Vec<Animation>,
animator: impl Fn(Self, usize, f32) -> Self + 'static,
) -> AnimationElement<Self>where
Self: Sized,
fn with_animations(
self,
id: impl Into<ElementId>,
animations: Vec<Animation>,
animator: impl Fn(Self, usize, f32) -> Self + 'static,
) -> AnimationElement<Self>where
Self: Sized,
Source§fn with_spring<T>(
self,
id: impl Into<ElementId>,
animation: SpringAnimation<T>,
animator: impl FnOnce(Self, <T as SpringTarget>::Output) -> Self + 'static,
) -> SpringAnimationElement<Self>
fn with_spring<T>( self, id: impl Into<ElementId>, animation: SpringAnimation<T>, animator: impl FnOnce(Self, <T as SpringTarget>::Output) -> Self + 'static, ) -> SpringAnimationElement<Self>
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> FluentBuilder for Twhere
T: IntoElement,
impl<T> FluentBuilder for Twhere
T: IntoElement,
Source§fn map<U>(self, f: impl FnOnce(Self) -> U) -> Uwhere
Self: Sized,
fn map<U>(self, f: impl FnOnce(Self) -> U) -> Uwhere
Self: Sized,
Source§fn when(self, condition: bool, then: impl FnOnce(Self) -> Self) -> Selfwhere
Self: Sized,
fn when(self, condition: bool, then: impl FnOnce(Self) -> Self) -> Selfwhere
Self: Sized,
Source§fn when_else(
self,
condition: bool,
then: impl FnOnce(Self) -> Self,
else_fn: impl FnOnce(Self) -> Self,
) -> Selfwhere
Self: Sized,
fn when_else(
self,
condition: bool,
then: impl FnOnce(Self) -> Self,
else_fn: impl FnOnce(Self) -> Self,
) -> Selfwhere
Self: Sized,
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