Struct TreeView

Source
pub struct TreeView<'context_menu, NodeIdType> { /* private fields */ }
Expand description

A tree view widget.

Implementations§

Source§

impl<'context_menu, NodeIdType: NodeId> TreeView<'context_menu, NodeIdType>

Source

pub fn new(id: Id) -> Self

Create a tree view from an unique id.

Source

pub fn with_settings(self, settings: TreeViewSettings) -> Self

Set the settings for this tree view with the TreeViewSettings struct.

Source

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.

Source

pub fn indent_hint_style(self, style: IndentHintStyle) -> Self

Set the style of the indent hint to show the indentation level.

Source

pub fn row_layout(self, layout: RowLayout) -> Self

Set the row layout for this tree.

Source

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.

Source

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.

Source

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.

Source

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.

Source

pub fn min_width(self, width: f32) -> Self

Set the minimum width the tree can have.

Source

pub fn min_height(self, height: f32) -> Self

Set the minimum height the tree can have.

Source

pub fn allow_multi_selection(self, allow_multi_select: bool) -> Self

Set if the tree view is allowed to select multiple nodes at once.

Source

pub fn fallback_context_menu( self, context_menu: impl FnMut(&mut Ui, &Vec<NodeIdType>) + 'context_menu, ) -> Self

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.

Source

pub fn show( self, ui: &mut Ui, build_tree_view: impl FnMut(&mut TreeViewBuilder<'_, NodeIdType>), ) -> (Response, Vec<Action<NodeIdType>>)
where NodeIdType: NodeId + Send + Sync + 'static,

Start displaying the tree view.

Construct the tree view using the TreeViewBuilder by adding directories or leaves to the tree.

Source

pub fn show_state( self, ui: &mut Ui, state: &mut TreeViewState<NodeIdType>, build_tree_view: impl FnMut(&mut TreeViewBuilder<'_, NodeIdType>), ) -> (Response, Vec<Action<NodeIdType>>)
where NodeIdType: NodeId + Send + Sync + 'static,

Start displaying the tree view with a TreeViewState.

Construct the tree view using the TreeViewBuilder by adding directories or leaves to the tree.

Auto Trait Implementations§

§

impl<'context_menu, NodeIdType> Freeze for TreeView<'context_menu, NodeIdType>

§

impl<'context_menu, NodeIdType> !RefUnwindSafe for TreeView<'context_menu, NodeIdType>

§

impl<'context_menu, NodeIdType> !Send for TreeView<'context_menu, NodeIdType>

§

impl<'context_menu, NodeIdType> !Sync for TreeView<'context_menu, NodeIdType>

§

impl<'context_menu, NodeIdType> Unpin for TreeView<'context_menu, NodeIdType>

§

impl<'context_menu, NodeIdType> !UnwindSafe for TreeView<'context_menu, NodeIdType>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.