pub enum Command {
Show 14 variants
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,
},
Present {
window: NodeId,
},
SelectText {
id: NodeId,
range: Range<usize>,
},
ScrollToRow {
id: NodeId,
row: RowKey,
},
}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
(a window in full screen keeps the screen’s), or give it no smaller
than the window’s MinSize; it reports the size it gives as
WindowResized.
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 or List so offset (content coordinates) is at its
top-left. Already clamped by the core. Like user scrolling, it makes
the backend report Scrolled.
Focus
Present
Brings a window forward as the platform’s apps do when asked to
show one that’s open already: the app activated, the window
restored if minimized, raised and made the one taking keys. Before
any Focus in the batch. A window not shown yet (created in this
batch) comes forward when it is.
SelectText
Selects these characters of a text field’s or text area’s text,
counted in Unicode scalar values, within it and on grapheme
boundaries (the app counts graphemes). A Focus for the
field comes first in the batch: a selection is the focused field’s.
ScrollToRow
Scrolls a List or Table just enough to show a row, as the platform’s own
“scroll to row” does. The platform then reports Scrolled, and the
rows it shows.