pub trait TreeSource<K: Key> {
// Required method
fn load(&self, parent: Option<&K>, sink: Sink<K>);
// Provided methods
fn can_drop(
&self,
keys: &[K],
target: &K,
position: Position,
) -> Result<(), String> { ... }
fn match_text(&self, node: &Node<K>) -> String { ... }
fn item(&self, key: &K) -> SelectionItem { ... }
}Expand description
What the application implements: a branch’s children, on demand.
Required Methods§
Provided Methods§
Sourcefn can_drop(
&self,
keys: &[K],
target: &K,
position: Position,
) -> Result<(), String>
fn can_drop( &self, keys: &[K], target: &K, position: Position, ) -> Result<(), String>
Whether keys may be dropped position of target: Err with
the reason refuses it. Asked while dragging (a refused target is
marked so) and by tree.drop’s default, after the step’s hooks;
the view’s own veto (TreeView::can_drop) is asked too. By
default every drop is allowed.
Sourcefn match_text(&self, node: &Node<K>) -> String
fn match_text(&self, node: &Node<K>) -> String
What the filter searches for a node (TreeState::set_filter):
by default its plain name (Node::name). Add words the label
does not show (a description, tags, a path) after the name; the
row highlights what matches in its label only.
Sourcefn item(&self, key: &K) -> SelectionItem
fn item(&self, key: &K) -> SelectionItem
A node’s item in the application-wide selection
(TreeView::shared): by default its key’s
(SelectionItem::from_key). Give the id other widgets showing
the same thing use.