Skip to main content

ChildPod

Struct ChildPod 

Source
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

Source

pub const INSPECT_ID_BASE: u64

Where ChildPod::inspect_id’s allocator starts: 2^48, far from arena WidgetIds.

Source

pub fn new(widget: Box<dyn Widget>) -> Self

Wrap a freshly built child widget at the origin with zero size.

Source

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.

Source

pub fn debug_label(&self) -> Option<&str>

The human name attached for tooling, if any. None by default.

Source

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.

Source

pub fn clear_debug_label(&mut self)

Drop any attached debug label.

Source

pub fn inspect_id(&self) -> WidgetId

This pod’s tooling id, assigned on first call and stable thereafter.

Source

pub fn widget(&self) -> &dyn Widget

Shared access to the boxed child widget.

Source

pub fn widget_mut(&mut self) -> &mut dyn Widget

Mutable access to the boxed widget; marks the pod layout-dirty.

Source

pub fn widget_mut_for_rebuild(&mut self) -> &mut dyn Widget

Mutable access without marking the pod dirty; the caller marks it.

Source

pub fn set_widget(&mut self, widget: Box<dyn Widget>)

Replace the boxed child widget; marks the pod layout-dirty.

Source

pub fn is_layout_dirty(&self) -> bool

Whether the next layout must run (tooling and tests).

Source

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.

Source

pub fn is_paint_dirty(&self) -> bool

Whether the subtree must be painted afresh (tooling and tests).

Source

pub fn mark_paint_dirty(&mut self)

Mark this pod (only) paint-dirty.

Source

pub fn origin(&self) -> Point

The child’s origin in the container’s coordinate space.

Source

pub fn size(&self) -> Size

The child’s resolved size (valid after ChildPod::layout_child).

Source

pub fn set_origin(&mut self, origin: Point)

Place the child at origin within the container’s coordinate space.

Source

pub fn transform(&self) -> Option<Affine>

The child’s transform, if any (see ChildPod::set_transform).

Source

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.

Source

pub fn is_active(&self) -> bool

Whether this child currently holds the recorded active (captured) path.

Source

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.

Source

pub fn is_focused(&self) -> bool

Whether this child has a recorded focus path at all; routing needs ChildPod::holds_live_focus.

Source

pub fn set_focused(&mut self, focused: bool)

Record (or drop) this child’s focus path, stamping the live session.

Source

pub fn focus_epoch(&self) -> u64

The focus epoch stamp (diagnostic; non-zero does not mean focused).

Source

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).

Drop a focus link the live session already stranded, reporting whether one was dropped; a live link is never retired.

Source

pub fn hover_epoch(&self) -> u64

The hover epoch stamp (0: never claimed). Diagnostic only — read PaintCtx::is_hovered instead.

Source

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.

Source

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.

Source

pub fn sliver_geometry(&self) -> Option<SliverGeometry>

The geometry of the last sliver layout, if it was one.

Source

pub fn is_sliver(&mut self) -> bool

Whether the child speaks the sliver protocol (does not dirty the pod).

Source

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.

Source

pub fn semantics_child(&self, ctx: &mut SemanticsCtx)

Collect the child’s semantics at its absolute origin (a transformed pod reports its bounding box).

Source

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.

Source

pub fn contains(&self, point: Point) -> bool

Whether point (container space) lies in this child’s bounds, half-open (origin <= p < origin + size). The initial hit test only.

Trait Implementations§

Source§

impl Drop for ChildPod

Source§

fn drop(&mut self)

Report a live hover link severed by this pod’s removal, so RenderRoot::rebuild ends the hover.

Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> StorageAccess<T> for T

Source§

fn as_borrowed(&self) -> &T

Borrows the value.
Source§

fn into_taken(self) -> T

Takes the value.
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.