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
//! Events produced by state-machine inspectors (keyboard, future drag)
//! and consumed by both the core test suite and the view component.
//!
//! Placing `DirectoryTreeEvent` in the core crate lets [`crate::keyboard::handle_key`]
//! return it without a circular dependency, and lets application code
//! depend only on `dioxus-swdir-tree-core` when integrating the widget
//! without a Dioxus renderer.
use PathBuf;
use crateSelectionMode;
/// An event emitted by the tree's keyboard handler or the view component.
///
/// The host handles each variant by calling the corresponding method on
/// `DirectoryTree`:
///
/// ```no_run
/// # use dioxus_swdir_tree_core::{DirectoryTreeEvent, DirectoryTree};
/// # use std::path::Path;
/// fn handle(tree: &mut DirectoryTree, ev: DirectoryTreeEvent) {
/// match ev {
/// DirectoryTreeEvent::Toggled(path) => {
/// // Forward any ScanRequest to the scan driver.
/// let _req = tree.on_toggled(&path);
/// }
/// DirectoryTreeEvent::Selected { path, is_dir, mode } => {
/// tree.on_selected(&path, is_dir, mode);
/// }
/// }
/// }
/// ```