pub enum Command {
Create {
id: NodeId,
kind: WidgetKind,
props: Vec<Prop>,
},
SetProp {
id: NodeId,
prop: Prop,
},
Insert {
parent: NodeId,
child: NodeId,
index: usize,
},
Remove {
parent: NodeId,
child: NodeId,
},
Destroy {
id: NodeId,
},
SetFrame {
id: NodeId,
frame: Rect,
},
SetA11y {
id: NodeId,
a11y: A11yProps,
},
SetWindowSize {
id: NodeId,
size: Size,
},
SetFocusOrder {
window: NodeId,
order: Vec<NodeId>,
},
ScrollTo {
id: NodeId,
offset: Point,
},
Focus {
id: NodeId,
},
}Expand description
A change the backend must apply to the native widget tree.
Commands arrive in batches. Within a batch, order matters: a node is always created before it is inserted, and a subtree root is removed before it is destroyed.
Variants§
Create
Native views start with a zero frame; the core only sends frames that differ from the last one it sent.
SetProp
Insert
Remove
Destroy
Frees a node. Sent for every native node of a destroyed subtree, children first. The subtree’s root has already been removed from its parent; nodes inside it may still be attached to each other.
SetFrame
Parent-relative, logical units. Never sent for windows.
SetA11y
SetWindowSize
Window content size requested by the app. The platform may refuse it.
SetFocusOrder
The keyboard (Tab) order of a window’s focusable controls. Sent when it changes. Backends chain focus in this order; which controls can actually take focus stays a platform decision (e.g. macOS keyboard navigation settings).
ScrollTo
Scrolls a ScrollView so offset (content coordinates) is at its
top-left. Already clamped by the core. Like user scrolling, it makes
the backend report Scrolled.