Skip to main content

TreeOps

Trait TreeOps 

Source
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§

Source

fn create_node( &mut self, kind: PieceKind, props: &dyn Any, layout: Rc<dyn Layout>, flex: Flex, native: bool, is_boundary: bool, scope: Scope, ) -> RNode

Source

fn attach(&mut self, parent: RNode, child: RNode)

Source

fn attach_at(&mut self, parent: RNode, child: RNode, index: usize)

Source

fn reorder_children(&mut self, parent: RNode, order: Vec<RNode>)

Source

fn remove_subtree(&mut self, node: RNode)

Source

fn node_exists(&self, node: RNode) -> bool

Whether node still exists (diagnostics: stale-id probes).

Source

fn dark_mode(&mut self) -> bool

Whether the platform renders in dark appearance (see Toolkit::dark_mode).

Source

fn set_appearance(&mut self, dark: Option<bool>)

Apply an app-level appearance override (see Toolkit::set_appearance).

Source

fn on_event(&mut self, node: RNode, h: EventHandler)

Source

fn handlers_for(&self, node: RNode) -> Vec<EventHandler>

Source

fn set_id(&mut self, node: RNode, id: String)

Source

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.

Source

fn set_a11y(&mut self, node: RNode, a11y: A11yProps)

Source

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.

Source

fn focus_node(&mut self, node: RNode, focused: bool)

Move native keyboard focus to (or away from) node (docs/focus.md).

Source

fn set_probe_focused(&mut self, node: RNode, focused: bool)

Mirror a FocusChanged event into the node’s dayscript probe (pump-only).

Source

fn set_app_menu(&mut self, items: Vec<MenuItem>)

Source

fn set_context_menu(&mut self, node: RNode, items: Vec<MenuItem>)

Source

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.

Source

fn patch_window_toolbar(&mut self, root: RNode, patch: ToolbarPatch)

Apply a targeted change to one item of root’s toolbar.

Source

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).

Source

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.

Source

fn patch(&mut self, node: RNode, patch: Box<dyn Any>, affects_size: bool)

Source

fn replay(&mut self, node: RNode, ops: Vec<DrawOp>)

Source

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.

Source

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.

Source

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.

Source

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.

Source

fn mark_needs_measure(&mut self, node: RNode)

Source

fn mark_layout_dirty(&mut self)

Source

fn layout_if_needed(&mut self)

Source

fn set_window_size(&mut self, s: Size)

Source

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.

Source

fn child_count(&self, node: RNode) -> usize

Source

fn first_child(&self, node: RNode) -> Option<RNode>

Source

fn node_kind(&self, node: RNode) -> Option<PieceKind>

Source

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).

Source

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.

Source

fn node_frame(&self, node: RNode) -> Option<Rect>

Source

fn node_probe(&self, node: RNode) -> Option<NodeProbe>

Source

fn node_a11y(&self, node: RNode) -> Option<A11yProps>

The node’s accumulated accessibility annotations (§13) — a11y_audit’s expectation.

Source

fn read_a11y(&self, node: RNode) -> Option<A11ySnapshot>

The node’s ACTUAL native a11y properties (a11y_audit diffs this against node_a11y).

Source

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.

Source

fn find_by_id(&self, id: &str) -> Option<RNode>

Source

fn snapshot(&mut self) -> Result<Vec<u8>, String>

Source

fn ui_idle(&mut self) -> bool

Whether native transitions have settled (see Toolkit::ui_idle).

Source

fn root_node(&self) -> RNode

Source

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.

Source

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.

Source

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.

Source

fn set_root_size(&mut self, root: RNode, s: Size)

A secondary window’s content size changed (its WindowResized handler).

Source

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.

Source

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).

Source

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).

Source

fn focus_native_window(&mut self, root: RNode)

Bring the window whose root is root to front and make it key.

Source

fn set_native_window_title(&mut self, root: RNode, title: &str)

Retitle the window whose root is root.

Source

fn snapshot_of(&mut self, root: RNode) -> Result<Vec<u8>, String>

Snapshot the window whose root is root (the primary answers snapshot).

Source

fn capability(&self, cap: Cap) -> Support

Toolkit capability probe (pieces pick presentation with it, e.g. Cap::NavSplit).

Source

fn supports_lifecycle(&self, phase: Lifecycle) -> bool

Does the running backend deliver this lifecycle phase (docs/lifecycle.md)?

Source

fn present(&mut self, req: u64, spec: &PresentSpec)

Present a native modal for request req (docs/dialogs.md).

Source

fn dismiss(&mut self, req: u64)

Dismiss the modal for req (programmatic resolve while it is still up).

Source

fn open_url(&mut self, url: &str)

Open url in the platform’s default handler (the link piece’s seam).

Source

fn defer_system_gestures(&mut self, edges: Edges)

Re-send the union of every mounted defers_system_gestures request (docs/cover.md).

Source

fn install_list(&mut self, node: RNode, driver: ListDriver)

Source

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.

Source

fn list_store_cell( &mut self, node: RNode, key: usize, anchor: RNode, built: BuiltRow, )

Record a freshly built row for a cell.

Source

fn list_layout_cell(&mut self, node: RNode, key: usize)

Lay the row out inside its cell bounds (row content width × the RowHeight).

Source

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).

Source

fn list_reload(&mut self, node: RNode)

Apply a data change: the native host re-queries the source.

Source

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).

Source

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).

Source

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.

Source

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).

Implementors§

Source§

impl<B: Toolkit> TreeOps for Tree<B>

Day API ↩ Guides· daybrite.dev