pub struct WidgetTree { /* private fields */ }Expand description
The widget tree: a thin, typed wrapper over tree_arena::TreeArena.
Implementations§
Source§impl WidgetTree
impl WidgetTree
Sourcepub fn insert_root(&mut self, pod: WidgetPod) -> WidgetId
pub fn insert_root(&mut self, pod: WidgetPod) -> WidgetId
Insert pod as a root of the tree, returning its id.
Sourcepub fn insert_child(
&mut self,
parent: WidgetId,
pod: WidgetPod,
) -> Option<WidgetId>
pub fn insert_child( &mut self, parent: WidgetId, pod: WidgetPod, ) -> Option<WidgetId>
Insert pod as a child of parent; None if parent is not in the tree.
Sourcepub fn pod(&self, id: WidgetId) -> Option<&WidgetPod>
pub fn pod(&self, id: WidgetId) -> Option<&WidgetPod>
Shared access to the pod with the given id, anywhere in the tree.
Sourcepub fn pod_mut(&mut self, id: WidgetId) -> Option<&mut WidgetPod>
pub fn pod_mut(&mut self, id: WidgetId) -> Option<&mut WidgetPod>
Mutable access to the pod with the given id, anywhere in the tree.
Sourcepub fn children(&self, id: WidgetId) -> Vec<WidgetId>
pub fn children(&self, id: WidgetId) -> Vec<WidgetId>
The children of id in insertion order; empty if id is absent or childless.
Sourcepub fn inspect(&self) -> Vec<InspectNode>
pub fn inspect(&self) -> Vec<InspectNode>
A read-only pre-order snapshot of the whole retained tree (siblings in declaration order).
Covers both child mechanisms: arena children, then the ChildPods a widget
publishes through Widget::visit_children (a container that does not
override it reads as a leaf). Bounds come from the last layout pass, so call
it after one or the rects are zero-sized.
Sourcepub fn inspect_layout_dirty(&self) -> Vec<(WidgetId, bool)>
pub fn inspect_layout_dirty(&self) -> Vec<(WidgetId, bool)>
Per-node layout-dirty state for tooling and tests: one (id, layout_dirty)
pair per node WidgetTree::inspect reports, in its order, so the two zip.
A ChildPod reports ChildPod::is_layout_dirty; an arena WidgetPod
always reports false (the root lays it out unconditionally). Kept beside
inspect so the plain InspectNode shape does not change.
Sourcepub fn inspect_paint_dirty(&self) -> Vec<(WidgetId, bool)>
pub fn inspect_paint_dirty(&self) -> Vec<(WidgetId, bool)>
Per-node paint-dirty state: the twin of WidgetTree::inspect_layout_dirty
reporting ChildPod::is_paint_dirty; an arena WidgetPod reports false.