Crate egui_ltreeview

Crate egui_ltreeview 

Source
Expand description

§egui_ltreeview is a tree view widget for egui

This tree view widget implements all the common features of a tree view to get you up and running as fast as possible.

§Features:

  • Directory and leaf nodes
  • Node selection
  • Select multiple nodes
  • Keyboard navigation using arrow keys
  • Frontend for Drag and Drop support
  • Agnostic to the implementation of your data.
  • Performant (100k nodes in ~3 ms)

§Crate feature flags

  • persistence Adds serde to NodeId and enabled the persistence feature of egui.
  • doc Adds additional documentation.

§Quick start

TreeView::new(Id::new("tree view")).show(ui, |builder| {
    builder.dir(0, "Root");
    builder.leaf(1, "Ava");
    builder.leaf(2, "Benjamin");
    builder.leaf(3, "Charlotte");
    builder.close_dir();
});

Create a new TreeView with its unique id and show it for the current ui. Use the builder in the callback to add directories and leaves to the tree. The nodes of the tree must have a unique id which implements the NodeId trait.

§Further information

Visit the doc module documentation for further information about these topics:

1․ Interaction
      1․1․ Keyboard navigation
      1․2․ Selecting nodes and multi selection
      1․3․ Activating nodes
      1․4․ Opening closing directory nodes
      1․5․ Drag and drop
      1․6․ Context menus on nodes
2․ Interacting with the tree view through code
      2․1․ Changing selection
      2․2․ Changing open state of directory
            2․2․1․ Implementing a “collapse all” or “expand all” feature
3․ Customization
      3․1․ Controlling the size of the tree view
      3․2․ Customizing the tree view itself
      3․3․ Customizing nodes
4․ Performance
      4․1․ Culling hidden nodes
      4․2․ Implementing NodeConfig for better performance

Modules§

doc
Table of contents

Structs§

Activate
Information about the Activate action in the tree.
CloserState
State of the closer when it is drawn.
DragAndDrop
Information about drag and drop action that is currently happening on the tree.
DragAndDropExternal
Represents a drag-and-drop interaction where nodes are dragged outside the TreeView. Used to handle external drops (e.g., onto another UI component or the workspace).
NodeBuilder
A builder to build a node.
TreeView
A tree view widget.
TreeViewBuilder
The builder used to construct the tree.
TreeViewSettings
The global settings the tree view will use.
TreeViewState
Represents the state of the tree view.

Enums§

Action
An action the tree view would like to take as a result of some user input like drag and drop.
DirPosition
A position inside a directory node.
IndentHintStyle
Style of the vertical line to show the indentation level.
RowLayout
How rows in the tree are laid out.

Traits§

NodeConfig
Provides the configuration of a node in the tree.
NodeId
Identifies a node in the tree.