pub struct TreeViewBuilder<'ui, NodeIdType>where
NodeIdType: NodeId,{ /* private fields */ }Expand description
The builder used to construct the tree.
Use this to add directories or leaves to the tree.
Implementations§
Source§impl<'ui, NodeIdType> TreeViewBuilder<'ui, NodeIdType>where
NodeIdType: NodeId,
impl<'ui, NodeIdType> TreeViewBuilder<'ui, NodeIdType>where
NodeIdType: NodeId,
Sourcepub fn parent_id(&self) -> Option<&NodeIdType>
pub fn parent_id(&self) -> Option<&NodeIdType>
Get the current parent id if any.
Sourcepub fn leaf(&mut self, id: NodeIdType, label: impl Into<WidgetText>)
pub fn leaf(&mut self, id: NodeIdType, label: impl Into<WidgetText>)
Add a leaf directly to the tree with an id and the label text.
To customize the node that is added to the tree consider using TreeViewBuilder::node
Sourcepub fn dir(&mut self, id: NodeIdType, label: impl Into<WidgetText>) -> bool
pub fn dir(&mut self, id: NodeIdType, label: impl Into<WidgetText>) -> bool
Add a directory to the tree.
Returns true if the directory is open and its child are visible.
Returns false if the directory is closed.
Must call TreeViewBuilder::close_dir to close the directory.
To customize the node that is added to the tree consider using TreeViewBuilder::node
Sourcepub fn close_dir_in(&mut self, child_count: usize)
pub fn close_dir_in(&mut self, child_count: usize)
Automatically close the current dir after child_count many nodes
have been added to the tree.
If this method is called with 0 the current directory will close immediately.
Child nodes that were added before this method was called are not counted.
Sourcepub fn node(&mut self, config: impl NodeConfig<NodeIdType>) -> bool
pub fn node(&mut self, config: impl NodeConfig<NodeIdType>) -> bool
Add a node to the tree.
If the node is a directory this method returns the openness state of the ndode.
Returns true if the directory is open and its child are visible.
Returns false if the directory is closed.
If the node is a directory, you must call TreeViewBuilder::close_dir to close the directory.