1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
/// Actions that a user or application can initiate on the tree view.
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum TreeAction<Custom = ()> {
/// Move the selected node up within its siblings.
ReorderUp,
/// Move the selected node down within its siblings.
ReorderDown,
/// Move selection to the previous visible row.
SelectPrev,
/// Move selection to the next visible row.
SelectNext,
/// Move selection to the parent node.
SelectParent,
/// Expand the selection; if possible, move to an expandable descendant.
SelectChild,
/// Toggle expansion recursively for the selected subtree.
ToggleRecursive,
/// Toggle expansion for the selected node only.
ToggleNode,
/// Expand all nodes in the tree.
ExpandAll,
/// Collapse all nodes in the tree.
CollapseAll,
/// Request adding a child under the selected node.
AddChild,
/// Request editing the selected node.
EditNode,
/// Detach the node from its parent without deleting it.
DetachNode,
/// Delete the node from the tree entirely.
DeleteNode,
/// Store the selected node id in the clipboard.
YankNode,
/// Paste the clipboard node as a child of the selected node.
PasteNode,
/// Toggle drawing of guide lines.
ToggleGuides,
/// Toggle the mark state for the selected node.
ToggleMark,
/// Select the first visible row.
SelectFirst,
/// Select the last visible row.
SelectLast,
/// Custom action forwarded to the caller without internal handling.
Custom(Custom),
}
/// Result of handling an action or key event.
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum TreeEvent<Custom = ()> {
/// The action was handled internally and state was updated.
Handled,
/// The action was ignored (e.g., nothing selected / nothing to do).
Unhandled,
/// The action is forwarded to the caller for handling.
Action(TreeAction<Custom>),
}