fltk.tree
FLTK Tree Widget
This module provides tree view widgets for hierarchical data:
- Tree: Container widget displaying hierarchical items
- TreeItem: Individual item in a tree
License
BSD-3-ClauseCopyright
Copyright © 2025 DDN (D Developer Network) Members
Types 6
Sort order options for items added to the tree.
Defines the style of connection lines between items.
Tree selection style.
Individual item in a tree widget.
TreeItem represents a single node in the tree hierarchy. Items can have children, forming a hierarchical structure. Items are managed by the Tree widget and should not be created directly.
TreeItemPtr _itemHandlevoid label(string text)Sets the item's label text.this(TreeItemPtr handle)Creates a wrapper around an existing tree item handle.Tree widget for displaying hierarchical data.
Tree displays items in a hierarchical structure with expand/collapse functionality. Items are added using path notation (e.g., "Parent/Child").
Example:
auto tree = new Tree(10, 10, 200, 300, "Files:");
tree.add("Documents/Report.txt");
tree.add("Documents/Notes.txt");
tree.add("Images/Photo.jpg");
tree.add("Images/Logo.png");TreePtr _treeHandlevoid clear()Clears all items from the tree.void clearChildren()Clears all children but keeps the root.TreeItem firstSelectedItem()Gets the first selected item.TreeItem nextSelectedItem(TreeItem item)Gets the next selected item.int deselectAll()Deselects all items.int connectorWidth() const @trustedGets the connector width (space to the right of open/close icon).this(int x, int y, int width, int height, string label = null)Creates a new tree widget.Manages a dynamic array of TreeItem pointers.
This class provides a container for managing collections of tree items, supporting operations like add, insert, remove, swap, and move. It is useful for bulk operations on tree items or maintaining separate collections of items.
Example:
auto arr = new TreeItemArray();
// Add items to the array
// arr.add(someItem);
assert(arr.total() == 0); // Initially emptyTreeItemArrayPtr _handleTreeItemArrayPtr handle() @safe nothrow @nogcReturns the underlying handle for low-level operations.this(int chunksize = 10)Creates a new tree item array.