pub struct WidgetNode {Show 13 fields
pub widget: Box<dyn Widget>,
pub parent: Option<WidgetId>,
pub children: Vec<WidgetId>,
pub activation: ActivationState,
pub dirty: DirtyFlags,
pub bounds: Rect,
pub clips_children: bool,
pub ime: Option<ImeContext>,
pub event_pass_through: bool,
pub gesture_dead_zone: bool,
pub keyboard_capture: bool,
pub hit_transparent: bool,
pub last_painted_epoch: u64,
/* private fields */
}Expand description
A node in the widget arena storing a widget and its metadata.
Fields§
§widget: Box<dyn Widget>§parent: Option<WidgetId>§children: Vec<WidgetId>§activation: ActivationState§dirty: DirtyFlags§bounds: Rect§clips_children: boolWhen true, the paint pass clips child rendering to this widget’s bounds. Set by scroll areas and overflow-hidden containers.
ime: Option<ImeContext>Optional OS input-method (IME) descriptor. Some(..) declares this
node a text-input surface — the platform enables the OS IME (with the
descriptor’s purpose) while the node is focused. None (the default)
means no OS IME: enabling IME changes how text arrives, so the safe
common-case default is off. The platform reads the focused node’s
descriptor at focus-change time. See crate::ime.
event_pass_through: boolWhen true, hit-testing skips this node — pointer events fall
through to whatever sits behind it. Descendants are still
hit-tested normally (the recursion walks into children before
the pass-through check), so an interactive subtree under a
pass-through wrapper stays usable. Used by the debug inspector’s
HighlightLayer and HoverProbe to paint over the user’s
content without absorbing clicks. Default false.
gesture_dead_zone: boolWhen true, a pointer press anywhere in this widget’s subtree must
NOT arm a drag/swipe recognizer on any ancestor above this node —
the subtree is a gesture dead zone for ancestor gestures. Used so
interactive controls (buttons, a ⋮ menu) placed inside a draggable /
swipeable container (a dock-panel header, a card, a list row) can be
clicked without a few px of pointer jitter starting the ancestor’s drag.
The boundary is honored by arm_drag_observers. Mirrors Electron’s
-webkit-app-region: no-drag. Default false. See the DeadZone
wrapper widget.
keyboard_capture: boolWhen true and this widget holds keyboard focus, a KeyDown is
delivered straight to it without first running shortcut →
intent → action resolution. The node is a keyboard capture
surface: it wants every keystroke (including chords the host app
binds as Shortcuts — Ctrl+C, Ctrl+W, Alt+<letter>, …).
Used by a terminal emulator (which must forward Ctrl+C to the
child process, not trigger the app’s copy shortcut), a game
viewport, or a vim-mode editor. Honored by dispatch_event_impl,
which skips the shortcut block for a focused capture node.
Ctrl+Tab / Ctrl+Shift+Tab are reserved: dispatch_event_impl
cycles focus on that chord before dispatching to a focused capture
node, so no capture surface can trap the keyboard (WCAG 2.1.2).
Escape is not reserved — overlay back-navigation runs ahead of the
check only while an overlay is open, so a capture surface below no
overlay does see Escape. Default false.
hit_transparent: boolWhen true, this widget AND its entire subtree are invisible to
hit-testing: the recursion returns immediately without descending
into children, so the point falls through to whatever sits
behind. Unlike event_pass_through
(which is per-node — descendants stay hittable), this excludes
the whole subtree. Use for purely decorative overlays whose
children are themselves widgets — a count badge over a button, a
watermark, a status dot — so they never steal clicks meant for
the control underneath. Default false.
last_painted_epoch: u64The WidgetTree::paint_epoch at which this widget’s bounds were
last observed inside the window viewport by the paint pass.
The animation scheduler uses this to pause looping animations
for offscreen widgets: an animation whose
last_painted_epoch + 1 < tree.paint_epoch is considered
off-screen and skipped. 0 means “not yet painted” — treated
as “always visible” to keep headless tests (no render() call)
from regressing.