pub struct WidgetPod { /* private fields */ }Expand description
Standard retained-widget adapter used by the SUI runtime.
WidgetPod gives a Widget stable identity, cached layout state, event
routing participation, and scene/semantics cooperation. It is the default
local retained model, but a widget’s own internals may still use custom
state, virtualization, worker threads, or remote systems before rejoining
SUI through widget contexts and scene output.
Implementations§
Source§impl WidgetPod
impl WidgetPod
pub fn new<W>(widget: W) -> Selfwhere
W: Widget + 'static,
Sourcepub fn new_boxed(widget: Box<dyn Widget>) -> Self
pub fn new_boxed(widget: Box<dyn Widget>) -> Self
Retain a type-erased widget without inserting an additional adapter into the logical widget tree.
Dynamic widget registries use this when the concrete widget type is selected from application data at runtime.
pub const fn id(&self) -> WidgetId
Sourcepub const fn is_inert(&self) -> bool
pub const fn is_inert(&self) -> bool
Whether this subtree is inert: still painted, but out of hit testing, focus, and semantics. Containers make content inert while it animates out, so it looks gone to everything but the eye.
Sourcepub fn set_inert(&mut self, inert: bool)
pub fn set_inert(&mut self, inert: bool)
Make this subtree inert or live again (see WidgetPod::is_inert).
Focus and pointer capture inside an inert subtree are released when
the runtime next refreshes its widget graph, after the current layout
pass.
pub fn debug_name(&self) -> &'static str
pub fn diagnostics_snapshot(&self) -> WidgetDiagnosticsSnapshot
pub fn collect_diagnostics(&self, output: &mut Vec<WidgetDiagnosticsSnapshot>)
pub const fn bounds(&self) -> Rect
pub const fn measured_size(&self) -> Size
pub const fn presentation_transform(&self) -> Transform
pub fn set_bounds(&mut self, bounds: Rect)
Sourcepub fn probe_measure(
&mut self,
parent_ctx: &mut MeasureCtx,
constraints: Constraints,
) -> Size
pub fn probe_measure( &mut self, parent_ctx: &mut MeasureCtx, constraints: Constraints, ) -> Size
Query a size without requiring the widget’s retained layout to match it.
Keep four recent results locally, backed by the window’s bounded query
cache. Widget revisions and layout contexts invalidate both tiers.
Call measure with the final constraints before arrangement: a probe hit
does not restore child layouts, text handles, or other committed state.
Final measure calls in dirty/forced subtrees still always execute.
Sourcepub fn probe_measure_axis(
&mut self,
parent_ctx: &mut MeasureCtx,
constraints: Constraints,
axis: Axis,
) -> f32
pub fn probe_measure_axis( &mut self, parent_ctx: &mut MeasureCtx, constraints: Constraints, axis: Axis, ) -> f32
Size-only query for one axis; shares the exact-key, invalidation and
bounded eviction rules of probe_measure, with a distinct query kind.
pub fn measure( &mut self, parent_ctx: &mut MeasureCtx, constraints: Constraints, ) -> Size
pub fn intrinsic_size( &mut self, parent_ctx: &mut MeasureCtx, axis: Axis, available_cross: f32, ) -> IntrinsicSize
pub fn arrange(&mut self, parent_ctx: &mut ArrangeCtx, bounds: Rect)
Sourcepub fn arrange_transformed(
&mut self,
parent_ctx: &mut ArrangeCtx,
bounds: Rect,
transform: Transform,
)
pub fn arrange_transformed( &mut self, parent_ctx: &mut ArrangeCtx, bounds: Rect, transform: Transform, )
Arrange this widget in parent coordinates and apply an affine transform to its complete retained subtree for paint, input, and semantics.
pub fn paint(&self, parent_ctx: &mut PaintCtx)
pub fn semantics(&self, parent_ctx: &mut SemanticsCtx)
Sourcepub fn accepts_focus(&self) -> bool
pub fn accepts_focus(&self) -> bool
Return whether this retained widget is a focus target.
Adaptive containers use this while selecting a restoration fallback for a subtree that has just become visible again.
Sourcepub fn visit_children(&self, visitor: &mut dyn WidgetPodVisitor)
pub fn visit_children(&self, visitor: &mut dyn WidgetPodVisitor)
Visit this pod’s direct children. Public so container widgets can walk their own subtree (e.g. to derive a focus-within visual by comparing descendant ids against the focused widget id — sui has no focus-within event, and any focus change repaints every window, so polling at paint time stays correct).