pub struct TreeSource {Show 13 fields
pub children_len: Rc<dyn Fn(Option<u64>) -> usize>,
pub child_token: Rc<dyn Fn(Option<u64>, usize) -> u64>,
pub expandable: Rc<dyn Fn(u64) -> bool>,
pub section_header: Rc<dyn Fn(u64) -> bool>,
pub expanded: Rc<dyn Fn(u64) -> bool>,
pub bind_row: Rc<dyn Fn(u64, RawHandle)>,
pub recycle: Rc<dyn Fn(RawHandle)>,
pub layout_cell: Rc<dyn Fn(RawHandle, f64)>,
pub layout_cell_size: Rc<dyn Fn(RawHandle, Size)>,
pub cell_height: Rc<dyn Fn(RawHandle) -> f64>,
pub type_select_text: Rc<dyn Fn(u64) -> String>,
pub row_menu: Option<Rc<dyn Fn(u64) -> Vec<MenuItem>>>,
pub moves: Option<TreeMoves>,
}Expand description
The synchronous row-pull closures for hierarchical trees (docs/tree.md): ListSource’s
shape, addressed by token instead of row index, because expanding a row renumbers every
index below it while tokens hold still. day-core injects one per TREE host via
Toolkit::attach_tree; the backend answers its native data-source from it. The same
synchronous discipline as ListSource: UI thread, outside any day-core borrow;
bind_row flushes and lays the row out before returning.
Fields§
§children_len: Rc<dyn Fn(Option<u64>) -> usize>How many children parent has (None = the root level).
child_token: Rc<dyn Fn(Option<u64>, usize) -> u64>The i-th child of parent: the stable token every backend keys its rows by.
expandable: Rc<dyn Fn(u64) -> bool>Whether this token can hold children at all: what draws (or omits) the disclosure.
section_header: Rc<dyn Fn(u64) -> bool>Non-selectable section heading, separate from a navigation destination.
expanded: Rc<dyn Fn(u64) -> bool>Current desired expansion, including restoration before the first native reload.
bind_row: Rc<dyn Fn(u64, RawHandle)>Build (first use of this cell) or rebind (recycled cell) the row for token into the
native cell.
recycle: Rc<dyn Fn(RawHandle)>The native cell left the viewport; Day may drop per-cell bookkeeping (optional).
layout_cell: Rc<dyn Fn(RawHandle, f64)>Re-lay the row bound to this cell at width, called from the cell’s own native
layout pass. Trees need this where lists don’t: indentation makes every cell’s
content width per-row, so the host-width layout bind_row did is only a first
approximation. Skips quietly when called inside a day-core borrow (a snapshot pass).
layout_cell_size: Rc<dyn Fn(RawHandle, Size)>Native bounds for controls whose group headers have a different height from leaves. Overrides the initial row-height estimate and preserves the native height on rebind.
cell_height: Rc<dyn Fn(RawHandle) -> f64>The height day-core last laid this cell’s row at (see ListSource::cell_height).
type_select_text: Rc<dyn Fn(u64) -> String>The row’s type-ahead string (docs/tree.md): what native type-select matches against.
The row’s context menu, built when the menu is summoned (docs/menus.md “Dynamic context
menus”), called on the UI thread from the platform’s own menu callback, outside any
day-core borrow, like every closure here. None = rows carry no menu; an empty
result suppresses the menu for that row.
moves: Option<TreeMoves>Drag-to-move closures, present when TreeProps::movable (docs/tree.md). None on
immovable trees; backends must not enable their drag machinery without it.
Trait Implementations§
Source§impl Clone for TreeSource
impl Clone for TreeSource
Source§fn clone(&self) -> TreeSource
fn clone(&self) -> TreeSource
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more