pub struct TreeView<'context_menu, NodeIdType> { /* private fields */ }Expand description
A tree view widget.
Implementations§
Sourcepub fn with_settings(self, settings: TreeViewSettings) -> Self
pub fn with_settings(self, settings: TreeViewSettings) -> Self
Set the settings for this tree view with the TreeViewSettings struct.
Sourcepub fn override_indent(self, indent: Option<f32>) -> Self
pub fn override_indent(self, indent: Option<f32>) -> Self
Override the indent value for this tree view.
By default, this value is ‘None’ which means that the indent value from the current ui is used. If this value is set, this value will be used as the indent value without affecting the ui’s indent value.
Sourcepub fn indent_hint_style(self, style: IndentHintStyle) -> Self
pub fn indent_hint_style(self, style: IndentHintStyle) -> Self
Set the style of the indent hint to show the indentation level.
Sourcepub fn row_layout(self, layout: RowLayout) -> Self
pub fn row_layout(self, layout: RowLayout) -> Self
Set the row layout for this tree.
Sourcepub fn fill_space_horizontal(self, fill_space_horizontal: bool) -> Self
pub fn fill_space_horizontal(self, fill_space_horizontal: bool) -> Self
Controls whether the tree should fill all available horizontal space.
If the tree is part of a horizontally justified layout, this property has no effect and the tree will always fill horizontal space.
Default is true.
Sourcepub fn fill_space_vertical(self, fill_space_vertical: bool) -> Self
pub fn fill_space_vertical(self, fill_space_vertical: bool) -> Self
Controls whether the tree should fill all available vertical space.
If the tree is part of a vertically justified layout, this property has no effect and the tree will always fill vertical space.
Default is false.
Sourcepub fn max_width(self, width: f32) -> Self
pub fn max_width(self, width: f32) -> Self
Set the maximum width the tree can have.
If the tree is part of a horizontally justified layout, this property has no effect and the tree will always fill the available horizontal space.
Sourcepub fn max_height(self, height: f32) -> Self
pub fn max_height(self, height: f32) -> Self
Set the maximum height the tree can have.
If the tree is part of a vertical justified layout, this property has no effect and the tree will always fill the available vertical space.
Sourcepub fn min_height(self, height: f32) -> Self
pub fn min_height(self, height: f32) -> Self
Set the minimum height the tree can have.
Sourcepub fn allow_multi_selection(self, allow_multi_select: bool) -> Self
pub fn allow_multi_selection(self, allow_multi_select: bool) -> Self
Set if the tree view is allowed to select multiple nodes at once.
Add a fallback context menu to the tree.
If the node did not configure a context menu directly or if multiple nodes were selected and right-clicked, then this fallback context menu will be opened.
A context menu in egui gets its size the first time it becomes visible. Since all nodes in the tree view share the same context menu you must set the size of the context menu manually for each node if you want to have differently sized context menus.
Sourcepub fn show(
self,
ui: &mut Ui,
build_tree_view: impl FnMut(&mut TreeViewBuilder<'_, NodeIdType>),
) -> (Response, Vec<Action<NodeIdType>>)
pub fn show( self, ui: &mut Ui, build_tree_view: impl FnMut(&mut TreeViewBuilder<'_, NodeIdType>), ) -> (Response, Vec<Action<NodeIdType>>)
Start displaying the tree view.
Construct the tree view using the TreeViewBuilder by adding
directories or leaves to the tree.
Sourcepub fn show_state(
self,
ui: &mut Ui,
state: &mut TreeViewState<NodeIdType>,
build_tree_view: impl FnMut(&mut TreeViewBuilder<'_, NodeIdType>),
) -> (Response, Vec<Action<NodeIdType>>)
pub fn show_state( self, ui: &mut Ui, state: &mut TreeViewState<NodeIdType>, build_tree_view: impl FnMut(&mut TreeViewBuilder<'_, NodeIdType>), ) -> (Response, Vec<Action<NodeIdType>>)
Start displaying the tree view with a TreeViewState.
Construct the tree view using the TreeViewBuilder by adding
directories or leaves to the tree.