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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
//! Selection-mode type for click and keyboard interactions.
//!
//! [`SelectionMode`] controls how a new selection event composes
//! with the existing [`DirectoryTree`](crate::DirectoryTree)
//! selection state:
//!
//! | Mode | Effect on the selected set |
//! |-------------------------|----------------------------|
//! | [`SelectionMode::Replace`] | Clear everything; the path becomes the single selection. |
//! | [`SelectionMode::Toggle`] | Add the path if absent; remove it if present. |
//! | [`SelectionMode::ExtendRange`] | Select every visible row between the anchor and the target, inclusive. The anchor is unchanged. |
//!
//! The built-in view emits clicks as [`SelectionMode::Replace`]
//! because iced 0.14's `button::on_press` callback cannot observe
//! modifier keys at press time. Applications that want multi-select
//! track modifier state themselves (see `examples/multi_select.rs`)
//! and rewrite the mode before forwarding the event to
//! [`DirectoryTree::update`](crate::DirectoryTree::update).
//!
//! [`from_modifiers`](SelectionMode::from_modifiers) exists to make
//! that rewrite trivial.
use Modifiers;
/// How an incoming selection event composes with the existing set.
///
/// The three modes cover the three standard click idioms:
///
/// | Mode | Effect on the selected set |
/// |-------------------------|----------------------------|
/// | [`SelectionMode::Replace`] | Clear everything; the path becomes the single selection. |
/// | [`SelectionMode::Toggle`] | Add the path if absent; remove it if present. |
/// | [`SelectionMode::ExtendRange`] | Select every visible row between the anchor and the target, inclusive. The anchor is unchanged. |