pub trait TreeOps {
Show 158 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 reparent(&mut self, child: RNode, parent: RNode) -> bool;
fn native_window_tabs(&self) -> bool;
fn native_document_tabs(&self) -> bool;
fn group_windows(&mut self, roots: &[RNode]);
fn window_tab_order(&self, root: RNode) -> Vec<NodeId>;
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 reduce_motion(&mut self) -> bool;
fn set_appearance(&mut self, dark: Option<bool>);
fn set_app_badge(&mut self, badge: &AppBadge);
fn on_event(&mut self, node: RNode, h: EventHandler);
fn handlers_for(&self, node: RNode) -> Vec<EventHandler> ⓘ;
fn native_view_of(&self, node: RNode) -> Option<RNode>;
fn wrappers_above(&self, node: RNode) -> Vec<RNode>;
fn gesture_target(&self, node: RNode, kind: GestureKind) -> Option<RNode>;
fn set_element_outer(&mut self, inner: RNode, outer: RNode);
fn set_id(&mut self, node: RNode, id: String);
fn mounted_id_families(&self) -> Vec<String>;
fn set_grid_facts(&mut self, node: RNode, facts: GridFacts);
fn forward_whole_row(&mut self, wrapper: RNode, inner: RNode);
fn set_a11y(&mut self, node: RNode, a11y: A11yProps);
fn announce(&mut self, text: &str, urgent: bool);
fn enable_gesture(&mut self, node: RNode, kind: GestureKind);
fn focus_node(&mut self, node: RNode, focused: bool);
fn set_focusable(&mut self, node: RNode, focusable: bool);
fn set_probe_focused(&mut self, node: RNode, focused: bool);
fn set_probe_selected(&mut self, node: RNode, selected: Option<usize>);
fn set_probe_value(&mut self, node: RNode, value: f64, text: String);
fn set_app_menu(&mut self, items: Vec<MenuItem>);
fn set_context_menu(&mut self, node: RNode, items: Vec<MenuItem>);
fn edit_window_toolbar(&mut self, root: RNode, ops: Vec<ToolbarOp>) -> bool;
fn patch_window_toolbar(&mut self, root: RNode, patch: ToolbarPatch) -> bool;
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 request_frame(&mut self, root: RNode, cb: FrameCallback) -> CancelFrame;
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 set_node_input_traits(&mut self, node: RNode, traits: &InputTraits);
fn set_node_cursor(&mut self, node: RNode, cursor: Cursor);
fn set_node_drag_region(&mut self, node: RNode, drag: bool);
fn mark_needs_measure(&mut self, node: RNode);
fn mark_layout_dirty(&mut self);
fn invalidate_all_measurements(&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 parent_of(&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_native(&self, node: RNode) -> Option<NativeSnapshot>;
fn a11y_nodes(&self) -> Vec<(String, PieceKind, A11yProps, NativeSnapshot)>;
fn find_by_id(&self, id: &str) -> Option<RNode>;
fn prepare_snapshot(
&mut self,
root: Option<RNode>,
revision: u32,
) -> Result<Readiness, String>;
fn snapshot(&mut self) -> Result<Vec<u8>, String>;
fn snapshot_origin(&mut self) -> Option<Point>;
fn snapshot_chrome(&mut self) -> Result<Vec<u8>, String>;
fn decode_image(&mut self, req: u64, id: BitmapId, bytes: &[u8]);
fn image_info(&mut self, id: BitmapId) -> Option<BitmapInfo>;
fn image_properties(&mut self, id: BitmapId) -> Option<ImageProperties>;
fn encode_image(&mut self, req: u64, id: BitmapId, spec: &EncodeSpec);
fn image_encode_formats(&mut self) -> Vec<ImageFormat>;
fn release_image(&mut self, id: BitmapId);
fn render_bitmap(
&mut self,
req: u64,
id: BitmapId,
ops: &[DrawOp],
size: Size,
scale: f64,
);
fn render_pdf(&mut self, req: u64, pages: &[PdfPage], info: &PdfInfo);
fn window_image_support(&mut self) -> Support;
fn font_families(&mut self) -> Vec<FontFamilyInfo>;
fn measure_text(
&mut self,
text: &str,
size: f64,
font: &CanvasFont,
) -> Option<TextMetrics>;
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 fit_window(&mut self, root: RNode, size: 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 quit_app(&mut self);
fn focus_native_window(&mut self, root: RNode);
fn set_native_window_title(&mut self, root: RNode, title: &str);
fn apply_window(&mut self, root: RNode, change: &WindowChange);
fn set_dock_menu(&mut self, items: &[MenuItem]);
fn set_status_items(&mut self, items: &[StatusItemSpec]);
fn set_app_progress(&mut self, progress: AppProgress);
fn set_dock_visible(&mut self, visible: bool);
fn set_keep_running(&mut self, keep: bool);
fn native_window_frame(&self, root: RNode) -> Option<Rect>;
fn monitors(&self) -> Vec<Monitor>;
fn set_launcher_shortcuts(&mut self, shortcuts: &[LauncherShortcut]);
fn snapshot_of(&mut self, root: RNode) -> Result<Vec<u8>, String>;
fn capability(&self, cap: Cap) -> Support;
fn attach_refresh(&mut self, node: RNode, host: NodeId);
fn set_presented(&mut self, node: RNode, visible: bool);
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 share_support(&self) -> Support;
fn share_url(&mut self, url: &str, title: &str) -> bool;
fn application_handlers(
&mut self,
query: &HandlerQuery,
) -> Result<ApplicationHandlers, ApplicationError>;
fn open_url_with_application(
&mut self,
url: &str,
application: &str,
completion: OpenApplicationCompletion,
);
fn defer_system_gestures(&mut self, edges: Edges);
fn set_status_bar_hidden(&mut self, hidden: bool);
fn install_list(&mut self, node: RNode, driver: ListDriver);
fn list_prepare_cell(
&mut self,
node: RNode,
key: usize,
cell: RawHandle,
header: bool,
) -> CellStep;
fn list_store_cell(
&mut self,
node: RNode,
key: usize,
anchor: RNode,
built: BuiltRow,
header: bool,
);
fn list_layout_cell(&mut self, node: RNode, key: usize);
fn list_layout_cell_width(&mut self, node: RNode, key: usize, width: f64);
fn list_cell_height(&self, node: RNode, key: usize) -> f64;
fn list_cell_keys(&self, node: RNode) -> Vec<usize>;
fn list_recycle_cell(&mut self, node: RNode, key: usize);
fn list_release_cell(&mut self, node: RNode, key: usize);
fn list_pin_cell(&mut self, node: RNode, key: usize);
fn list_reload(&mut self, node: RNode);
fn list_splice(&mut self, node: RNode, deltas: Vec<RowDelta>);
fn set_undo_state(&mut self, state: &UndoState);
fn set_edit_state(&mut self, state: &EditState);
fn modifiers(&mut self) -> Modifiers;
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_set_editing(&mut self, node: RNode, on: bool);
fn list_driver(&mut self, node: RNode) -> Option<Rc<ListDriver>>;
fn install_tree(&mut self, node: RNode, driver: TreeDriver);
fn tree_prepare_cell(
&mut self,
node: RNode,
key: usize,
cell: RawHandle,
) -> TreeCellStep;
fn tree_store_cell(
&mut self,
node: RNode,
key: usize,
anchor: RNode,
built: TreeBuiltRow,
);
fn tree_layout_cell(&mut self, node: RNode, key: usize);
fn tree_layout_cell_width(&mut self, node: RNode, key: usize, width: f64);
fn tree_layout_cell_size(&mut self, node: RNode, key: usize, size: Size);
fn tree_cell_height(&self, node: RNode, key: usize) -> f64;
fn tree_recycle_cell(&mut self, node: RNode, key: usize);
fn tree_reload(&mut self, node: RNode);
fn tree_set_expanded(&mut self, node: RNode, token: u64, expanded: bool);
fn tree_set_selected(&mut self, node: RNode, tokens: Vec<u64>);
fn tree_reveal(&mut self, node: RNode, token: u64);
fn tree_driver(&mut self, node: RNode) -> Option<Rc<TreeDriver>>;
fn set_drag_source(&mut self, node: RNode, source: Source);
fn set_drop_target(&mut self, node: RNode, target: Target);
fn set_context_menu_fn(&mut self, node: RNode, f: ContextMenuFn);
fn context_menu_of(&mut self, node: RNode) -> Option<ContextMenuFn>;
// Provided methods
fn note_node_tweaked(&mut self, node: RNode) { ... }
fn toggle_sidebar(&mut self, _host: RNode) -> bool { ... }
fn native_back(&mut self) -> bool { ... }
}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)
Sourcefn reparent(&mut self, child: RNode, parent: RNode) -> bool
fn reparent(&mut self, child: RNode, parent: RNode) -> bool
Move an existing subtree without disposing its scope or native handles.
fn native_window_tabs(&self) -> bool
fn native_document_tabs(&self) -> bool
fn group_windows(&mut self, roots: &[RNode])
fn window_tab_order(&self, root: RNode) -> Vec<NodeId>
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 reduce_motion(&mut self) -> bool
fn reduce_motion(&mut self) -> bool
Whether the user asked for less motion (see Toolkit::reduce_motion).
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).
Sourcefn set_app_badge(&mut self, badge: &AppBadge)
fn set_app_badge(&mut self, badge: &AppBadge)
Put a badge on the app icon (see Toolkit::set_app_badge, docs/badge.md).
fn on_event(&mut self, node: RNode, h: EventHandler)
fn handlers_for(&self, node: RNode) -> Vec<EventHandler> ⓘ
Sourcefn native_view_of(&self, node: RNode) -> Option<RNode>
fn native_view_of(&self, node: RNode) -> Option<RNode>
The node itself if it has a native view, else the one a chain of single-child
layout-only wrappers leads down to: the descent enable_gesture and set_focusable
make, for a modifier that has to reach the view (Decorate::on_key’s key mark).
Sourcefn wrappers_above(&self, node: RNode) -> Vec<RNode>
fn wrappers_above(&self, node: RNode) -> Vec<RNode>
The layout-only wrappers directly above node (single child, no native view), nearest
first: the same element as node, where an id or a modifier often sits.
Sourcefn gesture_target(&self, node: RNode, kind: GestureKind) -> Option<RNode>
fn gesture_target(&self, node: RNode, kind: GestureKind) -> Option<RNode>
The node a kind gesture addressed to node is delivered to: node itself when it
enabled that gesture, else the nearest node above it, within the same element, that did
(where a .padding(..).on_tap(..) registered its handler), else None. The element’s
nodes are those its modifiers wrapped it in (set_element_outer), native containers
such as .background(..) included, plus any layout-only wrappers directly above. What
makes a dayscript step by id reach the handler the way a native gesture on the inner
view reaches the recognizer on its superview.
Sourcefn set_element_outer(&mut self, inner: RNode, outer: RNode)
fn set_element_outer(&mut self, inner: RNode, outer: RNode)
Record that a decorated piece’s own node inner sits inside wrappers up to outer: the
span one element’s modifiers built, which gesture_target climbs. A no-op when the two
are the same node.
fn set_id(&mut self, node: RNode, id: String)
Sourcefn mounted_id_families(&self) -> Vec<String>
fn mounted_id_families(&self) -> Vec<String>
Families attached at least once, including subsequently disposed/recycled nodes.
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: what the .grid_span/
.grid_align modifiers call (docs/grid.md). Called at build time, before the first layout.
Sourcefn forward_whole_row(&mut self, wrapper: RNode, inner: RNode)
fn forward_whole_row(&mut self, wrapper: RNode, inner: RNode)
Give a wrapper that takes its size from inner (an overlay host) the inner node’s
Flex::whole_row, so a decorated platform row still reads as one to its list cell.
fn set_a11y(&mut self, node: RNode, a11y: A11yProps)
Sourcefn announce(&mut self, text: &str, urgent: bool)
fn announce(&mut self, text: &str, urgent: bool)
Speak text through the screen reader (Toolkit::announce, docs/accessibility.md).
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_focusable(&mut self, node: RNode, focusable: bool)
fn set_focusable(&mut self, node: RNode, focusable: bool)
Opt a container into the platform’s focus system (docs/focus.md); what
Decorate::focusable calls. The node must have a native view somewhere under it.
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_probe_selected(&mut self, node: RNode, selected: Option<usize>)
fn set_probe_selected(&mut self, node: RNode, selected: Option<usize>)
Record which row of a nav host is current, on the kinds::NAV host that .id() tags
(docs/navigation.md). The host’s NavPatch::Select carries a resident-page index
(visit order, which only coincides with row order when every page is built up front), so
the nav host reports the row index here instead. None = nothing selected (-1).
Sourcefn set_probe_value(&mut self, node: RNode, value: f64, text: String)
fn set_probe_value(&mut self, node: RNode, value: f64, text: String)
Record an external piece’s current value in the node’s dayscript probe, both the
numeric form (assert_value) and its display text (assert_text). The core patch
inspection only knows the builtin patch types, so a satellite piece (a stepper, a
rating) reports its own state through this instead (docs/extending.md).
Sourcefn edit_window_toolbar(&mut self, root: RNode, ops: Vec<ToolbarOp>) -> bool
fn edit_window_toolbar(&mut self, root: RNode, ops: Vec<ToolbarOp>) -> bool
Edit root’s window toolbar (docs/toolbars.md). root is a window root: the primary
root or one returned by open_window_root.
false when the toolkit did not apply it (the root has no native handle yet, or the
toolkit has no bar for it).
Sourcefn patch_window_toolbar(&mut self, root: RNode, patch: ToolbarPatch) -> bool
fn patch_window_toolbar(&mut self, root: RNode, patch: ToolbarPatch) -> bool
Apply a targeted change to one item of root’s toolbar; false as above.
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, or a supported native navigation menu with a top/bottom target
(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>)
fn request_frame(&mut self, root: RNode, cb: FrameCallback) -> CancelFrame
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.
Sourcefn set_node_input_traits(&mut self, node: RNode, traits: &InputTraits)
fn set_node_input_traits(&mut self, node: RNode, traits: &InputTraits)
Apply a text field’s InputTraits (docs/textfield.md).
Idempotent; called again with the whole set when a reactive member changes. No-op if
the node has no handle.
Sourcefn set_node_cursor(&mut self, node: RNode, cursor: Cursor)
fn set_node_cursor(&mut self, node: RNode, cursor: Cursor)
Shape the pointer over node (the .cursor() modifier, docs/cursor.md). Idempotent;
called again when a reactive cursor changes. No-op if the node has no handle.
Sourcefn set_node_drag_region(&mut self, node: RNode, drag: bool)
fn set_node_drag_region(&mut self, node: RNode, drag: bool)
Make node move its window when dragged, like a title bar (.window_drag_region(),
docs/window-chrome.md).
fn mark_needs_measure(&mut self, node: RNode)
fn mark_layout_dirty(&mut self)
Sourcefn invalidate_all_measurements(&mut self)
fn invalidate_all_measurements(&mut self)
Forget every measurement Day holds and re-lay every bound list and tree row: the system
text size changed (crate::note_text_size_changed), so every text measurement is
stale, and a cached one would keep each label at its old size.
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>
Sourcefn parent_of(&self, node: RNode) -> Option<RNode>
fn parent_of(&self, node: RNode) -> Option<RNode>
node’s parent, None at a root: the window root, or a list cell’s anchor, whose
parent is the native cell rather than a Day node.
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_native(&self, node: RNode) -> Option<NativeSnapshot>
fn read_native(&self, node: RNode) -> Option<NativeSnapshot>
The node’s actual native state (a11y_audit diffs it against node_a11y, and
assert_native against the probe).
Sourcefn a11y_nodes(&self) -> Vec<(String, PieceKind, A11yProps, NativeSnapshot)>
fn a11y_nodes(&self) -> Vec<(String, PieceKind, A11yProps, NativeSnapshot)>
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 prepare_snapshot( &mut self, root: Option<RNode>, revision: u32, ) -> Result<Readiness, String>
fn snapshot(&mut self) -> Result<Vec<u8>, String>
Sourcefn snapshot_origin(&mut self) -> Option<Point>
fn snapshot_origin(&mut self) -> Option<Point>
Where the primary window’s root sits in Self::snapshot’s image, in points (see
Toolkit::snapshot_origin); None when the toolkit does not say.
Sourcefn snapshot_chrome(&mut self) -> Result<Vec<u8>, String>
fn snapshot_chrome(&mut self) -> Result<Vec<u8>, String>
The same capture with the window’s own chrome (see Toolkit::snapshot_window_chrome).
Sourcefn decode_image(&mut self, req: u64, id: BitmapId, bytes: &[u8])
fn decode_image(&mut self, req: u64, id: BitmapId, bytes: &[u8])
Decode encoded bytes into a native image under id (see Toolkit::decode_image).
Sourcefn image_info(&mut self, id: BitmapId) -> Option<BitmapInfo>
fn image_info(&mut self, id: BitmapId) -> Option<BitmapInfo>
What a decoded image is (see Toolkit::image_info).
Sourcefn image_properties(&mut self, id: BitmapId) -> Option<ImageProperties>
fn image_properties(&mut self, id: BitmapId) -> Option<ImageProperties>
An image’s metadata beyond its pixels (see Toolkit::image_properties).
Sourcefn encode_image(&mut self, req: u64, id: BitmapId, spec: &EncodeSpec)
fn encode_image(&mut self, req: u64, id: BitmapId, spec: &EncodeSpec)
Encode a decoded image back to bytes (see Toolkit::encode_image).
Sourcefn image_encode_formats(&mut self) -> Vec<ImageFormat>
fn image_encode_formats(&mut self) -> Vec<ImageFormat>
Which formats this toolkit encodes (see Toolkit::encode_formats).
Sourcefn release_image(&mut self, id: BitmapId)
fn release_image(&mut self, id: BitmapId)
Release a decoded image (see Toolkit::release_image).
Sourcefn render_bitmap(
&mut self,
req: u64,
id: BitmapId,
ops: &[DrawOp],
size: Size,
scale: f64,
)
fn render_bitmap( &mut self, req: u64, id: BitmapId, ops: &[DrawOp], size: Size, scale: f64, )
Render a canvas drawing into a bitmap under id (see Toolkit::render_bitmap); the
answer arrives as Event::BitmapRendered.
Sourcefn render_pdf(&mut self, req: u64, pages: &[PdfPage], info: &PdfInfo)
fn render_pdf(&mut self, req: u64, pages: &[PdfPage], info: &PdfInfo)
Render canvas drawings into a PDF (see Toolkit::render_pdf); the answer arrives as
Event::PdfRendered.
Sourcefn window_image_support(&mut self) -> Support
fn window_image_support(&mut self) -> Support
Whether the toolkit can rasterize its own window at all (Cap::Snapshot).
Sourcefn font_families(&mut self) -> Vec<FontFamilyInfo>
fn font_families(&mut self) -> Vec<FontFamilyInfo>
The platform’s font families (see Toolkit::font_families); cached by day-core.
Sourcefn measure_text(
&mut self,
text: &str,
size: f64,
font: &CanvasFont,
) -> Option<TextMetrics>
fn measure_text( &mut self, text: &str, size: f64, font: &CanvasFont, ) -> Option<TextMetrics>
Measure one line of canvas text (see Toolkit::measure_text).
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 fit_window(&mut self, root: RNode, size: Size)
fn fit_window(&mut self, root: RNode, size: Size)
Ask the toolkit to size the window whose content root is root to size
(WindowOptions::size_to_fit). Also updates Day’s own layout size for that root, so the
content is re-laid at the size the window actually became.
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 quit_app(&mut self)
fn quit_app(&mut self)
End the app: the last primary window has closed (docs/windows.md close policy).
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 apply_window(&mut self, root: RNode, change: &WindowChange)
fn apply_window(&mut self, root: RNode, change: &WindowChange)
Apply a property change to the window whose root is root (docs/windows.md “Window
properties”). Ignored for a root with no native handle yet.
Install the app’s Dock menu (docs/menus.md).
Sourcefn set_status_items(&mut self, items: &[StatusItemSpec])
fn set_status_items(&mut self, items: &[StatusItemSpec])
Show the app’s status items (docs/status-item.md).
Sourcefn set_app_progress(&mut self, progress: AppProgress)
fn set_app_progress(&mut self, progress: AppProgress)
Show progress on the app’s Dock or taskbar icon.
Sourcefn set_dock_visible(&mut self, visible: bool)
fn set_dock_visible(&mut self, visible: bool)
Show or hide the macOS Dock icon.
Sourcefn set_keep_running(&mut self, keep: bool)
fn set_keep_running(&mut self, keep: bool)
Keep the process running when its last window closes (day-core decides when to quit).
Sourcefn native_window_frame(&self, root: RNode) -> Option<Rect>
fn native_window_frame(&self, root: RNode) -> Option<Rect>
The outer frame of the window whose root is root (docs/windows.md).
Sourcefn set_launcher_shortcuts(&mut self, shortcuts: &[LauncherShortcut])
fn set_launcher_shortcuts(&mut self, shortcuts: &[LauncherShortcut])
Replace the app’s run-time launcher shortcuts.
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 attach_refresh(&mut self, node: RNode, host: NodeId)
fn attach_refresh(&mut self, node: RNode, host: NodeId)
Attach pull recognition to a mounted scroll view.
fn set_presented(&mut self, node: RNode, visible: bool)
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 (what the link piece calls).
fn application_handlers( &mut self, query: &HandlerQuery, ) -> Result<ApplicationHandlers, ApplicationError>
fn open_url_with_application( &mut self, url: &str, application: &str, completion: OpenApplicationCompletion, )
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).
Re-send whether any mounted status_bar_hidden request asks to hide the status bar
(docs/cover.md).
fn install_list(&mut self, node: RNode, driver: ListDriver)
Sourcefn list_prepare_cell(
&mut self,
node: RNode,
key: usize,
cell: RawHandle,
header: bool,
) -> CellStep
fn list_prepare_cell( &mut self, node: RNode, key: usize, cell: RawHandle, header: bool, ) -> CellStep
Decide whether row key’s cell must be built (returns a fresh anchor) or rebound.
header: the row about to bind is a section header (docs/list.md “Sections”); a cell
that held the other kind is rebuilt.
Sourcefn list_store_cell(
&mut self,
node: RNode,
key: usize,
anchor: RNode,
built: BuiltRow,
header: bool,
)
fn list_store_cell( &mut self, node: RNode, key: usize, anchor: RNode, built: BuiltRow, header: bool, )
Record a freshly built row (or section header) 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_layout_cell_width(&mut self, node: RNode, key: usize, width: f64)
fn list_layout_cell_width(&mut self, node: RNode, key: usize, width: f64)
Re-lay the row at the cell’s actual width (the list’s width is only the first
approximation: a native row’s chrome, GtkListView’s themed row node, makes the cell
narrower, and a row laid at the list’s width holds the whole list wider than its frame).
Sourcefn list_cell_height(&self, node: RNode, key: usize) -> f64
fn list_cell_height(&self, node: RNode, key: usize) -> f64
The height the cell’s row was last laid at (ListSource::cell_height); 0 before its
first layout.
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).
Active cells eligible for width-change layout; excludes cells parked by recycle.
Sourcefn list_recycle_cell(&mut self, node: RNode, key: usize)
fn list_recycle_cell(&mut self, node: RNode, key: usize)
A pooled cell left the visible row set (an emulated backend hides rows past a shrunk source instead of destroying them): clear the cell subtree’s element ids so stale rows stop answering dayscript lookups. The cell itself stays pooled; the next bind re-ids it.
Sourcefn list_release_cell(&mut self, node: RNode, key: usize)
fn list_release_cell(&mut self, node: RNode, key: usize)
The host discarded cell key of list node for good: dispose the row built in it.
Sourcefn list_pin_cell(&mut self, node: RNode, key: usize)
fn list_pin_cell(&mut self, node: RNode, key: usize)
Cell key is the host’s pinned header copy (ListSource::bind_pinned): park its ids, now
and on every rebind, so lookups find the header row in the list.
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.
fn list_splice(&mut self, node: RNode, deltas: Vec<RowDelta>)
fn set_undo_state(&mut self, state: &UndoState)
fn set_edit_state(&mut self, state: &EditState)
fn modifiers(&mut self) -> Modifiers
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_set_editing(&mut self, node: RNode, on: bool)
fn list_set_editing(&mut self, node: RNode, on: bool)
Enter or leave the list’s native editing mode (ListPatch::Editing); a toolkit
without one ignores it.
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).
fn install_tree(&mut self, node: RNode, driver: TreeDriver)
Sourcefn tree_prepare_cell(
&mut self,
node: RNode,
key: usize,
cell: RawHandle,
) -> TreeCellStep
fn tree_prepare_cell( &mut self, node: RNode, key: usize, cell: RawHandle, ) -> TreeCellStep
Decide whether the cell for key must be built (fresh anchor) or rebound.
Sourcefn tree_store_cell(
&mut self,
node: RNode,
key: usize,
anchor: RNode,
built: TreeBuiltRow,
)
fn tree_store_cell( &mut self, node: RNode, key: usize, anchor: RNode, built: TreeBuiltRow, )
Record a freshly built row for a cell.
Sourcefn tree_layout_cell(&mut self, node: RNode, key: usize)
fn tree_layout_cell(&mut self, node: RNode, key: usize)
Lay the row out inside its cell bounds (row content width × the RowHeight).
Sourcefn tree_layout_cell_width(&mut self, node: RNode, key: usize, width: f64)
fn tree_layout_cell_width(&mut self, node: RNode, key: usize, width: f64)
Re-lay the row at the cell’s actual width (indentation makes tree cells per-row wide).
fn tree_layout_cell_size(&mut self, node: RNode, key: usize, size: Size)
Sourcefn tree_cell_height(&self, node: RNode, key: usize) -> f64
fn tree_cell_height(&self, node: RNode, key: usize) -> f64
The height the cell’s row was last laid at (TreeSource::cell_height); 0 before its
first layout.
Sourcefn tree_recycle_cell(&mut self, node: RNode, key: usize)
fn tree_recycle_cell(&mut self, node: RNode, key: usize)
The cell went back to the host’s reuse pool: clear the row subtree’s element ids, so
a collapsed-away row stops answering find_by_id (dayscript assert_missing) and a
stale id can never hijack a lookup. The next bind re-sets the live row’s id.
Sourcefn tree_reload(&mut self, node: RNode)
fn tree_reload(&mut self, node: RNode)
Apply a data change: the native host re-queries the source (expansion and selection survive by token).
Sourcefn tree_set_expanded(&mut self, node: RNode, token: u64, expanded: bool)
fn tree_set_expanded(&mut self, node: RNode, token: u64, expanded: bool)
Programmatically disclose/collapse one row (no TreeExpanded echo).
Sourcefn tree_set_selected(&mut self, node: RNode, tokens: Vec<u64>)
fn tree_set_selected(&mut self, node: RNode, tokens: Vec<u64>)
Programmatically sync the tree’s selected rows (no selection-event echo).
Sourcefn tree_reveal(&mut self, node: RNode, token: u64)
fn tree_reveal(&mut self, node: RNode, token: u64)
Scroll this row into view, realizing it if needed (ancestors already expanded).
Sourcefn tree_driver(&mut self, node: RNode) -> Option<Rc<TreeDriver>>
fn tree_driver(&mut self, node: RNode) -> Option<Rc<TreeDriver>>
The tree’s driver, for the guard → commit path tree_try_move runs outside the
borrow (None when node hosts no tree).
Sourcefn set_drag_source(&mut self, node: RNode, source: Source)
fn set_drag_source(&mut self, node: RNode, source: Source)
Install native transfer behavior on a realized host.
fn set_drop_target(&mut self, node: RNode, target: Target)
Install a summon-time context-menu provider on node (docs/menus.md).
The context menu the app gave node (or its nearest ancestor that has one), as a
provider; what the dayscript context_menu step chooses from. Returned rather than
called, because a provider is app code: it may select what it summons over and flush,
which re-enters the tree, so the caller asks it once the tree borrow has ended.
Provided Methods§
Sourcefn note_node_tweaked(&mut self, node: RNode)
fn note_node_tweaked(&mut self, node: RNode)
Record that a .tweak closure ran against node’s current handle (docs/tweaks.md), so
a later backing swap (set_node_selectable on a toolkit that rebuilds the widget) can
warn about the discarded work instead of losing it silently.
Show/hide the sidebar pane of the navigation host host: what the sidebar affordance
a nav(Sidebar) contributes for itself drives. false when the toolkit has no
pane to toggle there (or no sidebar concept at all). Per host, so a second window’s
button collapses its own sidebar (docs/toolbars.md, docs/navigation.md).
Sourcefn native_back(&mut self) -> bool
fn native_back(&mut self) -> bool
Press the platform’s back affordance (Toolkit::native_back): the native path a
real tap takes, which nav_back() (Day’s rail) never runs. false when nothing is
popped by it.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".