pub struct TreeView { /* private fields */ }Expand description
A hierarchical list. Create with cx.new(|cx| TreeView::new(cx).nodes(...)).
Implementations§
Source§impl TreeView
impl TreeView
pub fn new(cx: &mut Context<'_, Self>) -> Self
Sourcepub fn bind_nodes(
self,
signal: &Signal<Vec<TreeNode>>,
cx: &mut Context<'_, Self>,
) -> Self
pub fn bind_nodes( self, signal: &Signal<Vec<TreeNode>>, cx: &mut Context<'_, Self>, ) -> Self
Drive the tree data from a Signal<Vec<TreeNode>>: the view adopts the
signal’s nodes now and re-reads them on every signal change. Expansion
and selection survive data updates (they are keyed by node id).
Sourcepub fn expand(self, id: impl Into<SharedString>) -> Self
pub fn expand(self, id: impl Into<SharedString>) -> Self
Expand the branch with this id (construction-time; users toggle live).
Sourcepub fn collapse(self, id: impl Into<SharedString>) -> Self
pub fn collapse(self, id: impl Into<SharedString>) -> Self
Collapse the branch with this id.
Sourcepub fn default_expanded(self, expanded: bool) -> Self
pub fn default_expanded(self, expanded: bool) -> Self
Start with every branch expanded. Applies to the current nodes and to
nodes assigned later via nodes / bind_nodes.
Sourcepub fn expanded_ids(&self) -> Vec<SharedString>
pub fn expanded_ids(&self) -> Vec<SharedString>
The ids of every expanded branch, sorted for determinism.
Sourcepub fn selected_id(&self) -> Option<SharedString>
pub fn selected_id(&self) -> Option<SharedString>
The id of the selected node, if any.
Trait Implementations§
impl EventEmitter<TreeViewEvent> for TreeView
Auto Trait Implementations§
impl !RefUnwindSafe for TreeView
impl !UnwindSafe for TreeView
impl Freeze for TreeView
impl Send for TreeView
impl Sync for TreeView
impl Unpin for TreeView
impl UnsafeUnpin for TreeView
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> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for 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>
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