pub struct ChildPod { /* private fields */ }Expand description
A container’s owned child: a boxed widget plus the geometry and
capture/focus/hover bookkeeping the container keeps for it. Children are
pods, not arena nodes; origin/size are in the container’s space.
Implementations§
Source§impl ChildPod
impl ChildPod
Sourcepub const INSPECT_ID_BASE: u64
pub const INSPECT_ID_BASE: u64
Where ChildPod::inspect_id’s allocator starts: 2^48, far from arena
WidgetIds.
Sourcepub fn new(widget: Box<dyn Widget>) -> ChildPod
pub fn new(widget: Box<dyn Widget>) -> ChildPod
Wrap a freshly built child widget at the origin with zero size.
Sourcepub fn type_name(&self) -> &'static str
pub fn type_name(&self) -> &'static str
The wrapped widget’s concrete type name, asked of the live widget
(Widget::type_name). Diagnostic only; never parse it.
Sourcepub fn debug_label(&self) -> Option<&str>
pub fn debug_label(&self) -> Option<&str>
The human name attached for tooling, if any. None by default.
Sourcepub fn set_debug_label(&mut self, label: impl Into<Cow<'static, str>>)
pub fn set_debug_label(&mut self, label: impl Into<Cow<'static, str>>)
Attach a human name for tooling; nothing in the passes reads it.
Sourcepub fn clear_debug_label(&mut self)
pub fn clear_debug_label(&mut self)
Drop any attached debug label.
Sourcepub fn inspect_id(&self) -> WidgetId
pub fn inspect_id(&self) -> WidgetId
This pod’s tooling id, assigned on first call and stable thereafter.
Sourcepub fn widget_mut(&mut self) -> &mut (dyn Widget + 'static)
pub fn widget_mut(&mut self) -> &mut (dyn Widget + 'static)
Mutable access to the boxed widget; marks the pod layout-dirty.
Sourcepub fn widget_mut_for_rebuild(&mut self) -> &mut (dyn Widget + 'static)
pub fn widget_mut_for_rebuild(&mut self) -> &mut (dyn Widget + 'static)
Mutable access without marking the pod dirty; the caller marks it.
Sourcepub fn set_widget(&mut self, widget: Box<dyn Widget>)
pub fn set_widget(&mut self, widget: Box<dyn Widget>)
Replace the boxed child widget; marks the pod layout-dirty.
Sourcepub fn is_layout_dirty(&self) -> bool
pub fn is_layout_dirty(&self) -> bool
Whether the next layout must run (tooling and tests).
Sourcepub fn mark_layout_dirty(&mut self)
pub fn mark_layout_dirty(&mut self)
Mark this pod (only) layout-dirty; a caller outside a rebuild must also
dirty its path with request_layout.
Sourcepub fn is_paint_dirty(&self) -> bool
pub fn is_paint_dirty(&self) -> bool
Whether the subtree must be painted afresh (tooling and tests).
Sourcepub fn mark_paint_dirty(&mut self)
pub fn mark_paint_dirty(&mut self)
Mark this pod (only) paint-dirty.
Sourcepub fn size(&self) -> Size
pub fn size(&self) -> Size
The child’s resolved size (valid after ChildPod::layout_child).
Sourcepub fn set_origin(&mut self, origin: Point)
pub fn set_origin(&mut self, origin: Point)
Place the child at origin within the container’s coordinate space.
Sourcepub fn transform(&self) -> Option<Affine>
pub fn transform(&self) -> Option<Affine>
The child’s transform, if any (see ChildPod::set_transform).
Sourcepub fn set_transform(&mut self, transform: Option<Affine>)
pub fn set_transform(&mut self, transform: Option<Affine>)
Place the child under transform (local space, before origin: p
lands at origin + transform * p), or clear it with None. Paint, hit
tests and events map through it; semantics reports its bounding box. A
non-invertible transform draws and hits nothing. Window-space rects
reported from paint are not mapped.
Sourcepub fn is_active(&self) -> bool
pub fn is_active(&self) -> bool
Whether this child currently holds the recorded active (captured) path.
Sourcepub fn set_active(&mut self, active: bool)
pub fn set_active(&mut self, active: bool)
Set (or clear) the recorded active path. A clear is refused during a non-claimant contact’s walk, so it cannot strand the claimant.
Sourcepub fn is_focused(&self) -> bool
pub fn is_focused(&self) -> bool
Whether this child has a recorded focus path at all; routing needs
ChildPod::holds_live_focus.
Sourcepub fn set_focused(&mut self, focused: bool)
pub fn set_focused(&mut self, focused: bool)
Record (or drop) this child’s focus path, stamping the live session.
Sourcepub fn focus_epoch(&self) -> u64
pub fn focus_epoch(&self) -> u64
The focus epoch stamp (diagnostic; non-zero does not mean focused).
Sourcepub fn holds_live_focus(&self) -> bool
pub fn holds_live_focus(&self) -> bool
Whether this child holds a focus link on the root’s live session (flag
set and stamp matching). Without a root both read (0, 0).
Sourcepub fn retire_stale_focus_link(&mut self) -> bool
pub fn retire_stale_focus_link(&mut self) -> bool
Drop a focus link the live session already stranded, reporting whether one was dropped; a live link is never retired.
Sourcepub fn hover_epoch(&self) -> u64
pub fn hover_epoch(&self) -> u64
The hover epoch stamp (0: never claimed). Diagnostic only — read
PaintCtx::is_hovered instead.
Sourcepub fn layout_child(
&mut self,
ctx: &mut LayoutCtx<'_>,
bc: &BoxConstraints,
) -> Size
pub fn layout_child( &mut self, ctx: &mut LayoutCtx<'_>, bc: &BoxConstraints, ) -> Size
Lay the child out under bc and return its size, or return the recorded
size without calling Widget::layout when the pass is not forced, the
pod is clean, and bc, the epoch and the insets match last time’s.
Dirty sources: a LAYOUT rebuild or swap, a frame or layout request
below (plus the landing paint), a handled or redraw event,
ChildPod::widget_mut, a fresh build.
Sourcepub fn layout_sliver_child(
&mut self,
ctx: &mut LayoutCtx<'_>,
sc: &SliverConstraints,
) -> Option<SliverGeometry>
pub fn layout_sliver_child( &mut self, ctx: &mut LayoutCtx<'_>, sc: &SliverConstraints, ) -> Option<SliverGeometry>
Lay the child out as a sliver under sc, or return None for a
non-sliver child. Skips like ChildPod::layout_child; a geometry with
a scroll-offset correction leaves the pod dirty so it is never replayed.
Sourcepub fn sliver_geometry(&self) -> Option<SliverGeometry>
pub fn sliver_geometry(&self) -> Option<SliverGeometry>
The geometry of the last sliver layout, if it was one.
Sourcepub fn is_sliver(&mut self) -> bool
pub fn is_sliver(&mut self) -> bool
Whether the child speaks the sliver protocol (does not dirty the pod).
Sourcepub fn paint_child(
&mut self,
ctx: &mut PaintCtx<'_>,
scene: &mut dyn PaintScene,
)
pub fn paint_child( &mut self, ctx: &mut PaintCtx<'_>, scene: &mut dyn PaintScene, )
Paint the child at its absolute position, bubbling its requests and
publications into ctx; a non-invertible transform skips it.
Sourcepub fn semantics_child(&self, ctx: &mut SemanticsCtx)
pub fn semantics_child(&self, ctx: &mut SemanticsCtx)
Collect the child’s semantics at its absolute origin (a transformed pod reports its bounding box).
Sourcepub fn event_child(
&mut self,
ctx: &mut EventCtx<'_>,
event: &InputEvent,
) -> EventResult
pub fn event_child( &mut self, ctx: &mut EventCtx<'_>, event: &InputEvent, ) -> EventResult
Route an event into the child in its local space, folding its flags into
ctx and recording a capture as the active path. Containers use
frust-widgets’ route_event helpers, not an ad-hoc contains() gate.
A non-claimant contact walks forward-only: pods above the captor hand their child an inert carrier, so no container re-arms its gesture from the wrong finger; the captor receives the real event.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for ChildPod
impl !RefUnwindSafe for ChildPod
impl !Send for ChildPod
impl !Sync for ChildPod
impl !UnwindSafe for ChildPod
impl Unpin for ChildPod
impl UnsafeUnpin for ChildPod
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.