pub trait TreeOps {
Show 73 methods
// Required methods
fn create_node(
&mut self,
kind: PieceKind,
props: &dyn Any,
layout: Rc<dyn Layout>,
flex: Flex,
native: bool,
is_boundary: bool,
scope: Scope,
) -> RNode;
fn attach(&mut self, parent: RNode, child: RNode);
fn attach_at(&mut self, parent: RNode, child: RNode, index: usize);
fn reorder_children(&mut self, parent: RNode, order: Vec<RNode>);
fn remove_subtree(&mut self, node: RNode);
fn node_exists(&self, node: RNode) -> bool;
fn dark_mode(&mut self) -> bool;
fn set_appearance(&mut self, dark: Option<bool>);
fn on_event(&mut self, node: RNode, h: EventHandler);
fn handlers_for(&self, node: RNode) -> Vec<EventHandler> ⓘ;
fn set_id(&mut self, node: RNode, id: String);
fn set_grid_facts(&mut self, node: RNode, facts: GridFacts);
fn set_a11y(&mut self, node: RNode, a11y: A11yProps);
fn enable_gesture(&mut self, node: RNode, kind: GestureKind);
fn focus_node(&mut self, node: RNode, focused: bool);
fn set_probe_focused(&mut self, node: RNode, focused: bool);
fn set_app_menu(&mut self, items: Vec<MenuItem>);
fn set_context_menu(&mut self, node: RNode, items: Vec<MenuItem>);
fn set_window_toolbar(&mut self, root: RNode, items: Vec<ToolbarItem>);
fn patch_window_toolbar(&mut self, root: RNode, patch: ToolbarPatch);
fn scroll_to_target(
&mut self,
node: RNode,
target: &ScrollTarget,
animated: bool,
) -> bool;
fn scroll_reveal(&mut self, node: RNode, animated: bool) -> bool;
fn patch(&mut self, node: RNode, patch: Box<dyn Any>, affects_size: bool);
fn replay(&mut self, node: RNode, ops: Vec<DrawOp>);
fn set_implicit_anim(&mut self, node: RNode, anim: Option<AnimSpec>);
fn set_node_opacity(&mut self, node: RNode, opacity: f64);
fn set_node_transform(&mut self, node: RNode, t: Transform);
fn set_node_selectable(&mut self, node: RNode, selectable: bool);
fn mark_needs_measure(&mut self, node: RNode);
fn mark_layout_dirty(&mut self);
fn layout_if_needed(&mut self);
fn set_window_size(&mut self, s: Size);
fn set_route(&mut self, route: &str);
fn child_count(&self, node: RNode) -> usize;
fn first_child(&self, node: RNode) -> Option<RNode>;
fn node_kind(&self, node: RNode) -> Option<PieceKind>;
fn node_id(&self, node: RNode) -> Option<String>;
fn node_handle_any(&self, node: RNode) -> Option<Box<dyn Any>>;
fn node_frame(&self, node: RNode) -> Option<Rect>;
fn node_probe(&self, node: RNode) -> Option<NodeProbe>;
fn node_a11y(&self, node: RNode) -> Option<A11yProps>;
fn read_a11y(&self, node: RNode) -> Option<A11ySnapshot>;
fn a11y_nodes(&self) -> Vec<(String, PieceKind, A11yProps, A11ySnapshot)>;
fn find_by_id(&self, id: &str) -> Option<RNode>;
fn snapshot(&mut self) -> Result<Vec<u8>, String>;
fn ui_idle(&mut self) -> bool;
fn root_node(&self) -> RNode;
fn open_window_root(
&mut self,
options: &WindowOptions,
kind: WindowKind,
) -> WindowRootReply;
fn adopt_window_root(
&mut self,
root: RNode,
raw: RawHandle,
size: Size,
) -> bool;
fn remove_window_root(&mut self, root: RNode);
fn set_root_size(&mut self, root: RNode, s: Size);
fn add_extra_layout_root(&mut self, node: RNode, size: Size);
fn drop_extra_layout_root(&mut self, node: RNode);
fn close_native_window(&mut self, root: RNode);
fn focus_native_window(&mut self, root: RNode);
fn set_native_window_title(&mut self, root: RNode, title: &str);
fn snapshot_of(&mut self, root: RNode) -> Result<Vec<u8>, String>;
fn capability(&self, cap: Cap) -> Support;
fn supports_lifecycle(&self, phase: Lifecycle) -> bool;
fn present(&mut self, req: u64, spec: &PresentSpec);
fn dismiss(&mut self, req: u64);
fn open_url(&mut self, url: &str);
fn defer_system_gestures(&mut self, edges: Edges);
fn install_list(&mut self, node: RNode, driver: ListDriver);
fn list_prepare_cell(
&mut self,
node: RNode,
key: usize,
cell: RawHandle,
) -> CellStep;
fn list_store_cell(
&mut self,
node: RNode,
key: usize,
anchor: RNode,
built: BuiltRow,
);
fn list_layout_cell(&mut self, node: RNode, key: usize);
fn list_cell_keys(&self, node: RNode) -> Vec<usize>;
fn list_reload(&mut self, node: RNode);
fn list_scroll_to_end(&mut self, node: RNode);
fn list_scroll_to_row(&mut self, node: RNode, row: usize);
fn list_set_selected(&mut self, node: RNode, rows: Vec<usize>);
fn list_driver(&mut self, node: RNode) -> Option<Rc<ListDriver>>;
}Required Methods§
fn create_node( &mut self, kind: PieceKind, props: &dyn Any, layout: Rc<dyn Layout>, flex: Flex, native: bool, is_boundary: bool, scope: Scope, ) -> RNode
fn attach(&mut self, parent: RNode, child: RNode)
fn attach_at(&mut self, parent: RNode, child: RNode, index: usize)
fn reorder_children(&mut self, parent: RNode, order: Vec<RNode>)
fn remove_subtree(&mut self, node: RNode)
Sourcefn node_exists(&self, node: RNode) -> bool
fn node_exists(&self, node: RNode) -> bool
Whether node still exists (diagnostics: stale-id probes).
Sourcefn dark_mode(&mut self) -> bool
fn dark_mode(&mut self) -> bool
Whether the platform renders in dark appearance (see Toolkit::dark_mode).
Sourcefn set_appearance(&mut self, dark: Option<bool>)
fn set_appearance(&mut self, dark: Option<bool>)
Apply an app-level appearance override (see Toolkit::set_appearance).
fn on_event(&mut self, node: RNode, h: EventHandler)
fn handlers_for(&self, node: RNode) -> Vec<EventHandler> ⓘ
fn set_id(&mut self, node: RNode, id: String)
Sourcefn set_grid_facts(&mut self, node: RNode, facts: GridFacts)
fn set_grid_facts(&mut self, node: RNode, facts: GridFacts)
Merge non-default grid cell facts onto a node’s Flex — the .grid_span/.grid_align
seam (docs/grid.md). Called at build time, before the first layout.
fn set_a11y(&mut self, node: RNode, a11y: A11yProps)
Sourcefn enable_gesture(&mut self, node: RNode, kind: GestureKind)
fn enable_gesture(&mut self, node: RNode, kind: GestureKind)
Attach a native gesture recognizer to node (docs/shapes.md): the backend then emits
Event::Tap/LongPress/Drag for it. The node must have a native handle.
Sourcefn focus_node(&mut self, node: RNode, focused: bool)
fn focus_node(&mut self, node: RNode, focused: bool)
Move native keyboard focus to (or away from) node (docs/focus.md).
Sourcefn set_probe_focused(&mut self, node: RNode, focused: bool)
fn set_probe_focused(&mut self, node: RNode, focused: bool)
Mirror a FocusChanged event into the node’s dayscript probe (pump-only).
Sourcefn set_window_toolbar(&mut self, root: RNode, items: Vec<ToolbarItem>)
fn set_window_toolbar(&mut self, root: RNode, items: Vec<ToolbarItem>)
Install root’s window toolbar (docs/toolbars.md). root is a window root — the primary
root or one returned by open_window_root.
Sourcefn patch_window_toolbar(&mut self, root: RNode, patch: ToolbarPatch)
fn patch_window_toolbar(&mut self, root: RNode, patch: ToolbarPatch)
Apply a targeted change to one item of root’s toolbar.
Sourcefn scroll_to_target(
&mut self,
node: RNode,
target: &ScrollTarget,
animated: bool,
) -> bool
fn scroll_to_target( &mut self, node: RNode, target: &ScrollTarget, animated: bool, ) -> bool
Programmatic scroll (§7.6, docs/scroll.md): resolve target against a SCROLL node’s
content/viewport and drive Toolkit::scroll_to. Returns false when node isn’t a
realized scroll (the caller reports the miss; dayscript retries).
Sourcefn scroll_reveal(&mut self, node: RNode, animated: bool) -> bool
fn scroll_reveal(&mut self, node: RNode, animated: bool) -> bool
Scroll the nearest enclosing SCROLL ancestor so node’s frame is visible (minimal
scroll, scrollRectToVisible semantics). False when no scroll ancestor exists.
fn patch(&mut self, node: RNode, patch: Box<dyn Any>, affects_size: bool)
fn replay(&mut self, node: RNode, ops: Vec<DrawOp>)
Sourcefn set_implicit_anim(&mut self, node: RNode, anim: Option<AnimSpec>)
fn set_implicit_anim(&mut self, node: RNode, anim: Option<AnimSpec>)
Set (or clear) a node’s implicit .animation (§8.4): subsequent property patches and frame
changes on this node (or its descendants) animate with anim even outside a
with_animation.
Sourcefn set_node_opacity(&mut self, node: RNode, opacity: f64)
fn set_node_opacity(&mut self, node: RNode, opacity: f64)
Apply an animatable opacity (0..1) to node’s native handle (§8.4), animating if an
animation is in scope. No-op if the node has no handle.
Sourcefn set_node_transform(&mut self, node: RNode, t: Transform)
fn set_node_transform(&mut self, node: RNode, t: Transform)
Apply an animatable [Transform] to node’s native handle (§8.4) — the cheap movement/
scaling channel that never relayouts. No-op if the node has no handle.
Sourcefn set_node_selectable(&mut self, node: RNode, selectable: bool)
fn set_node_selectable(&mut self, node: RNode, selectable: bool)
Make node’s text user-selectable (the .selectable() modifier). One-shot and unmanaged;
No-op if the node has no handle.
fn mark_needs_measure(&mut self, node: RNode)
fn mark_layout_dirty(&mut self)
fn layout_if_needed(&mut self)
fn set_window_size(&mut self, s: Size)
Sourcefn set_route(&mut self, route: &str)
fn set_route(&mut self, route: &str)
Report the app’s current route to the backend (Toolkit::set_route) — web-dom mirrors
it into the URL hash (docs/navigation.md). Called by the turn-end route sync when the
route actually changed.
fn child_count(&self, node: RNode) -> usize
fn first_child(&self, node: RNode) -> Option<RNode>
fn node_kind(&self, node: RNode) -> Option<PieceKind>
Sourcefn node_id(&self, node: RNode) -> Option<String>
fn node_id(&self, node: RNode) -> Option<String>
The app-authored .id() string on node (find_by_id’s inverse), or None for an id-less
or disposed node. Backs the free id_of — the recorder’s NodeId → id lookup (§14.6).
Sourcefn node_handle_any(&self, node: RNode) -> Option<Box<dyn Any>>
fn node_handle_any(&self, node: RNode) -> Option<Box<dyn Any>>
A CLONE of the node’s native handle boxed as Any (None for layout-only or disposed
nodes). TreeOps is object-safe, so the generic Toolkit::Handle can’t appear here —
toolkit ext modules downcast to their concrete Handle type. This is the tweaks door
(docs/tweaks.md): cloning is cheap on every backend (a retain / gobject ref / GlobalRef
clone / Copy pointer) and the clone never outlives the native widget’s own refcounting.
fn node_frame(&self, node: RNode) -> Option<Rect>
fn node_probe(&self, node: RNode) -> Option<NodeProbe>
Sourcefn node_a11y(&self, node: RNode) -> Option<A11yProps>
fn node_a11y(&self, node: RNode) -> Option<A11yProps>
The node’s accumulated accessibility annotations (§13) — a11y_audit’s expectation.
Sourcefn read_a11y(&self, node: RNode) -> Option<A11ySnapshot>
fn read_a11y(&self, node: RNode) -> Option<A11ySnapshot>
The node’s ACTUAL native a11y properties (a11y_audit diffs this against node_a11y).
Sourcefn a11y_nodes(&self) -> Vec<(String, PieceKind, A11yProps, A11ySnapshot)>
fn a11y_nodes(&self) -> Vec<(String, PieceKind, A11yProps, A11ySnapshot)>
For every node with an .id() and a native handle: (id, kind, expected, actual) — the
raw material for the a11y_audit step (§14.2). Comparison/policy lives in day-script.
fn find_by_id(&self, id: &str) -> Option<RNode>
fn snapshot(&mut self) -> Result<Vec<u8>, String>
fn root_node(&self) -> RNode
Sourcefn open_window_root(
&mut self,
options: &WindowOptions,
kind: WindowKind,
) -> WindowRootReply
fn open_window_root( &mut self, options: &WindowOptions, kind: WindowKind, ) -> WindowRootReply
Open a native window and adopt its content container as an additional boundary
root. Inserts the root record, asks Toolkit::open_window, and answers per the
toolkit’s reply: Open(root) = live now (handle installed, window entry pushed),
Pending(root) = native creation is in flight (the record is parked without a
handle until Self::adopt_window_root), Unsupported = the placeholder was
removed again — present the content as a cover instead.
Sourcefn adopt_window_root(&mut self, root: RNode, raw: RawHandle, size: Size) -> bool
fn adopt_window_root(&mut self, root: RNode, raw: RawHandle, size: Size) -> bool
Complete a Pending open: adopt raw as the window’s content container, install
it on the parked root, and start laying out at size. false = the root is gone
(closed before completion) — the caller should drop the native window again.
Sourcefn remove_window_root(&mut self, root: RNode)
fn remove_window_root(&mut self, root: RNode)
Remove an (already childless) window root: bookkeeping + handle release + window entry removal. Never the primary. Idempotent; also valid for a parked Pending root.
Sourcefn set_root_size(&mut self, root: RNode, s: Size)
fn set_root_size(&mut self, root: RNode, s: Size)
A secondary window’s content size changed (its WindowResized handler).
Sourcefn add_extra_layout_root(&mut self, node: RNode, size: Size)
fn add_extra_layout_root(&mut self, node: RNode, size: Size)
Register an EXTRA layout root: a node that stays attached in the tree (native
re-homing needs the parent link) but lays out independently at its own reported
size — the cover-fallback surface (docs/windows.md). The primary root’s PassThrough
layout only descends into its first child, so a second top-level surface must drive
its own layout entry. set_root_size resizes it; drop it before subtree removal.
Sourcefn drop_extra_layout_root(&mut self, node: RNode)
fn drop_extra_layout_root(&mut self, node: RNode)
Unregister an extra layout root (the entry only — the node itself is removed by the
ordinary remove_subtree).
Sourcefn close_native_window(&mut self, root: RNode)
fn close_native_window(&mut self, root: RNode)
Ask the platform to close the window whose root is root (async — the platform
confirms with Event::WindowClosed).
Sourcefn focus_native_window(&mut self, root: RNode)
fn focus_native_window(&mut self, root: RNode)
Bring the window whose root is root to front and make it key.
Sourcefn set_native_window_title(&mut self, root: RNode, title: &str)
fn set_native_window_title(&mut self, root: RNode, title: &str)
Retitle the window whose root is root.
Sourcefn snapshot_of(&mut self, root: RNode) -> Result<Vec<u8>, String>
fn snapshot_of(&mut self, root: RNode) -> Result<Vec<u8>, String>
Snapshot the window whose root is root (the primary answers snapshot).
Sourcefn capability(&self, cap: Cap) -> Support
fn capability(&self, cap: Cap) -> Support
Toolkit capability probe (pieces pick presentation with it, e.g. Cap::NavSplit).
Sourcefn supports_lifecycle(&self, phase: Lifecycle) -> bool
fn supports_lifecycle(&self, phase: Lifecycle) -> bool
Does the running backend deliver this lifecycle phase (docs/lifecycle.md)?
Sourcefn present(&mut self, req: u64, spec: &PresentSpec)
fn present(&mut self, req: u64, spec: &PresentSpec)
Present a native modal for request req (docs/dialogs.md).
Sourcefn dismiss(&mut self, req: u64)
fn dismiss(&mut self, req: u64)
Dismiss the modal for req (programmatic resolve while it is still up).
Sourcefn open_url(&mut self, url: &str)
fn open_url(&mut self, url: &str)
Open url in the platform’s default handler (the link piece’s seam).
Sourcefn defer_system_gestures(&mut self, edges: Edges)
fn defer_system_gestures(&mut self, edges: Edges)
Re-send the union of every mounted defers_system_gestures request (docs/cover.md).
fn install_list(&mut self, node: RNode, driver: ListDriver)
Sourcefn list_prepare_cell(
&mut self,
node: RNode,
key: usize,
cell: RawHandle,
) -> CellStep
fn list_prepare_cell( &mut self, node: RNode, key: usize, cell: RawHandle, ) -> CellStep
Decide whether row key’s cell must be built (returns a fresh anchor) or rebound.
Sourcefn list_store_cell(
&mut self,
node: RNode,
key: usize,
anchor: RNode,
built: BuiltRow,
)
fn list_store_cell( &mut self, node: RNode, key: usize, anchor: RNode, built: BuiltRow, )
Record a freshly built row for a cell.
Sourcefn list_layout_cell(&mut self, node: RNode, key: usize)
fn list_layout_cell(&mut self, node: RNode, key: usize)
Lay the row out inside its cell bounds (row content width × the RowHeight).
Sourcefn list_cell_keys(&self, node: RNode) -> Vec<usize>
fn list_cell_keys(&self, node: RNode) -> Vec<usize>
The physical-cell keys of every bound cell of the list at node (for a bulk re-layout
after the list’s own width changed).
Sourcefn list_reload(&mut self, node: RNode)
fn list_reload(&mut self, node: RNode)
Apply a data change: the native host re-queries the source.
Sourcefn list_scroll_to_end(&mut self, node: RNode)
fn list_scroll_to_end(&mut self, node: RNode)
Imperatively scroll the native list so its last row is fully visible (no-op if empty).
Sourcefn list_scroll_to_row(&mut self, node: RNode, row: usize)
fn list_scroll_to_row(&mut self, node: RNode, row: usize)
Imperatively scroll the native list so row row is visible (clamped; no-op if empty).
Sourcefn list_set_selected(&mut self, node: RNode, rows: Vec<usize>)
fn list_set_selected(&mut self, node: RNode, rows: Vec<usize>)
Programmatically sync the list’s selected rows (empty = clear). The toolkit applies without re-emitting a selection event.
Sourcefn list_driver(&mut self, node: RNode) -> Option<Rc<ListDriver>>
fn list_driver(&mut self, node: RNode) -> Option<Rc<ListDriver>>
The list’s driver, for the guard → commit path list_try_reorder runs outside the
borrow (None when node hosts no list).