pub trait NodeConfig<NodeIdType> {
Show 14 methods
// Required methods
fn id(&self) -> &NodeIdType;
fn is_dir(&self) -> bool;
fn label(&mut self, ui: &mut Ui);
// Provided methods
fn flatten(&self) -> bool { ... }
fn default_open(&self) -> bool { ... }
fn drop_allowed(&self) -> bool { ... }
fn activatable(&self) -> bool { ... }
fn node_height(&self) -> Option<f32> { ... }
fn has_custom_icon(&self) -> bool { ... }
fn icon(&mut self, ui: &mut Ui) { ... }
fn has_custom_closer(&self) -> bool { ... }
fn closer(&mut self, ui: &mut Ui, closer_state: CloserState) { ... }
fn has_context_menu(&self) -> bool { ... }
fn context_menu(&mut self, ui: &mut Ui) { ... }
}Expand description
Provides the configuration of a node in the tree.
Used to configure the appearance and behavior of a node in the tree.
Implementing this trait is not necessary most of the time. The NodeBuilder
implements this trait and can be used for most purposes.
Required Methods§
Sourcefn id(&self) -> &NodeIdType
fn id(&self) -> &NodeIdType
Returns the id of this node
Provided Methods§
Sourcefn flatten(&self) -> bool
fn flatten(&self) -> bool
Whether or not the directory should be flattened into the parent directiron.
A directory that is flattened is not visible in the tree and cannot be navigated to. Its children appear like the children of the grand parent directory.
For example, this file structure:
Foo
├─ Alice
├─ Bar
│ ├─ Bob
│ └─ Clair
└─ Denislooks like this when the Bar directory is flattened:
Foo
├─ Alice
├─ Bob
├─ Clair
└─ DenisThis node (Bar in the example) will still appear in Action::SetSelected if it is part of a relevant
multi selection process.
This node will still be the target of any drag and drop action as if it was visible.
Default value is false. Override to customize.
Sourcefn default_open(&self) -> bool
fn default_open(&self) -> bool
Whether or not a directory should be open by default or closed.
Default is true. Override to customize.
Sourcefn drop_allowed(&self) -> bool
fn drop_allowed(&self) -> bool
Whether or not dropping onto this node is allowed.
Default is true for directories and false otherwise. Override to customize.
Sourcefn activatable(&self) -> bool
fn activatable(&self) -> bool
Whether or not this node can be activated.
If a directory is activatable the double-click to expand/collapse for that node is disabled. Directories can still be expanded/collapsed by clicking on the closer or using the keyboard.
Default is false for directories and true otherwise. Override to customize.
Sourcefn node_height(&self) -> Option<f32>
fn node_height(&self) -> Option<f32>
The height of this node. If None the default height of the
TreeViewSettings is used.
Default is None. Override to customize.
Sourcefn has_custom_icon(&self) -> bool
fn has_custom_icon(&self) -> bool
Whether or not this node has a custom icon.
Default is false. Override to customize.
Sourcefn icon(&mut self, ui: &mut Ui)
fn icon(&mut self, ui: &mut Ui)
If has_custom_icon returns true, this method is used to render the custom icon.
Default does nothing. Override to customize.
Sourcefn has_custom_closer(&self) -> bool
fn has_custom_closer(&self) -> bool
Whether or not this node has a custom closer.
Default is false. Override to customize.
Sourcefn closer(&mut self, ui: &mut Ui, closer_state: CloserState)
fn closer(&mut self, ui: &mut Ui, closer_state: CloserState)
If has_custom_closer returns true, this method is used to render the custom closer.
Default does nothing. Override to customize.
Whether or not this node has a context menu.
If a node was right-clicked but did not configure a context menu then the
TreeView::fallback_context_menu will be used.
Default is false. Override to customize.
If has_context_menu returns true, this method is used to render the context menu.
Default does nothing. Override to customize.