WidgetInfo

Struct WidgetInfo 

Source
pub struct WidgetInfo { /* private fields */ }
Expand description

Reference to a widget info in a WidgetInfoTree.

Implementations§

Source§

impl WidgetInfo

Source

pub fn access(&self) -> Option<WidgetAccessInfo>

Accessibility info, if the widget is accessible.

The widget is accessible only if access_enabled and some accessibility metadata was set on the widget.

Source

pub fn access_children(&self) -> impl Iterator<Item = WidgetAccessInfo>

Descendant branches that have accessibility info.

The iterator enters descendants only until it finds a node that has access info, these nodes are yielded.

Source

pub fn access_parent(&self) -> Option<WidgetAccessInfo>

First ancestor that is accessible.

Source§

impl WidgetInfo

Source

pub fn id(&self) -> WidgetId

Widget id.

Source

pub fn path(&self) -> WidgetPath

Full path to this widget.

Source

pub fn trace_path(&self) -> Txt

Path details to help finding the widget during debug.

If the inspector metadata is present the widget type is included.

Source

pub fn trace_id(&self) -> Txt

Detailed id text.

If the inspector metadata is present the widget type is included.

Source

pub fn interaction_path(&self) -> InteractionPath

Full path to this widget with interactivity values.

Source

pub fn new_path(&self, old_path: &WidgetPath) -> Option<WidgetPath>

Gets the path if it is different from old_path.

Only allocates a new path if needed.

§Panics

If old_path does not point to the same widget id as self.

Source

pub fn new_interaction_path( &self, old_path: &InteractionPath, ) -> Option<InteractionPath>

Gets the interaction_path if it is different from old_path.

Only allocates a new path if needed.

§Panics

If old_path does not point to the same widget id as self.

Source

pub fn z_index(&self) -> Option<(ZIndex, ZIndex)>

Get the z-index of the widget in the latest frame if it was rendered.

Note that widgets can render in the back and front of each descendant, these indexes are the back-most index, the moment the widget starts rendering and the front-most index at the moment the widget and all contents finishes rendering.

This value is updated every render without causing a tree rebuild.

Source

pub fn visibility(&self) -> Visibility

Gets the visibility of the widget or the widget’s descendants in the last rendered frame.

A widget is Visible if it rendered at least one display item, Hidden if it rendered only space and hit-test items, Collapsed if it did not render. All widgets are Visible if no frame was ever rendered.

Source

pub fn interactivity(&self) -> Interactivity

Get or compute the interactivity of the widget.

The interactivity of a widget is the combined result of all interactivity filters applied to it and its ancestors. If a parent is blocked this is blocked, same for disabled.

Source

pub fn bounds_info(&self) -> WidgetBoundsInfo

All the transforms introduced by this widget, starting from the outer info.

This information is up-to-date, it is updated every layout and render without causing a tree rebuild.

Source

pub fn border_info(&self) -> WidgetBorderInfo

Clone a reference to the widget border and corner radius information.

This information is up-to-date, it is updated every layout without causing a tree rebuild.

Source

pub fn perspective(&self) -> Option<(f32, PxPoint)>

Gets the 3D perspective for this widget.

The f32 is a distance from the Z-plane to the viewer, the point is the vanishing center in the parent widget inner bounds.

Source

pub fn transform_style(&self) -> TransformStyle

Gets the transform style for this widget.

Is Flat unless it or the parent widget sets Preserve3D.

Source

pub fn outer_size(&self) -> PxSize

Size of the widget outer area, not transformed.

Returns an up-to-date size, the size is updated every layout without causing a tree rebuild.

Source

pub fn inner_size(&self) -> PxSize

Size of the widget inner area, not transformed.

Returns an up-to-date size, the size is updated every layout without causing a tree rebuild.

Source

pub fn inner_border_size(&self) -> PxSize

Size of the widget child area, not transformed.

Returns an up-to-date size, the size is updated every layout without causing a tree rebuild.

Source

pub fn baseline(&self) -> Px

Gets the baseline offset up from the inner bounds bottom line.

Source

pub fn outer_transform(&self) -> PxTransform

Widget outer transform in window space.

Returns an up-to-date transform, the transform is updated every render or render update without causing a tree rebuild.

Source

pub fn inner_transform(&self) -> PxTransform

Widget inner transform in the window space.

Returns an up-to-date transform, the transform is updated every render or render update without causing a tree rebuild.

Source

pub fn outer_bounds(&self) -> PxRect

Widget outer rectangle in the window space.

Returns an up-to-date rect, the bounds are updated every render or render update without causing a tree rebuild.

Source

pub fn inner_bounds(&self) -> PxRect

Widget inner rectangle in the window space.

Returns an up-to-date rect, the bounds are updated every render or render update without causing a tree rebuild.

Source

pub fn spatial_bounds(&self) -> PxBox

Compute the bounding box that envelops self and descendants inner bounds.

Source

pub fn center(&self) -> PxPoint

Widget inner bounds center in the window space.

Source

pub fn meta(&self) -> StateMapRef<'_, WidgetInfoMeta>

Custom metadata associated with the widget during info build.

Source

pub fn tree(&self) -> &WidgetInfoTree

Reference the WidgetInfoTree that owns self.

Source

pub fn is_reused(&self) -> bool

If the widget info and all descendants did not change in the last rebuild.

Source

pub fn root(&self) -> Self

Reference to the root widget.

Source

pub fn parent(&self) -> Option<Self>

Reference to the widget that contains this widget.

Is None only for root.

Source

pub fn prev_sibling(&self) -> Option<Self>

Reference to the previous widget within the same parent.

Source

pub fn next_sibling(&self) -> Option<Self>

Reference to the next widget within the same parent.

Source

pub fn first_child(&self) -> Option<Self>

Reference to the first widget within this widget.

Source

pub fn last_child(&self) -> Option<Self>

Reference to the last widget within this widget.

Source

pub fn has_siblings(&self) -> bool

If the parent widget has multiple children.

Source

pub fn has_children(&self) -> bool

If the widget has at least one child.

Source

pub fn siblings(&self) -> impl Iterator<Item = WidgetInfo> + 'static + use<>

All parent children except this widget.

Source

pub fn children(&self) -> Children

Iterator over the direct descendants of the widget.

Source

pub fn children_count(&self) -> usize

Count of children.

Source

pub fn self_and_children(&self) -> Children

Iterator over the widget and the direct descendants of the widget.

Source

pub fn descendants(&self) -> TreeIter

Iterator over all widgets contained by this widget.

Source

pub fn descendants_len(&self) -> usize

Total number of descendants.

Source

pub fn self_and_descendants(&self) -> TreeIter

Iterator over the widget and all widgets contained by it.

Source

pub fn ancestors(&self) -> Ancestors

Iterator over parent -> grandparent -> .. -> root.

Source

pub fn descendants_range(&self) -> WidgetDescendantsRange

Gets a value that can check if widgets are descendant of self in O(1) time.

Source

pub fn cmp_sibling_in( &self, sibling: &WidgetInfo, ancestor: &WidgetInfo, ) -> Option<Ordering>

Compare the position of self and sibling in the ancestor descendants.

Source

pub fn is_ancestor(&self, maybe_descendant: &WidgetInfo) -> bool

If self is an ancestor of maybe_descendant.

Source

pub fn is_descendant(&self, maybe_ancestor: &WidgetInfo) -> bool

If self is inside maybe_ancestor.

Source

pub fn self_and_ancestors(&self) -> Ancestors

Iterator over self -> parent -> grandparent -> .. -> root.

Source

pub fn prev_siblings(&self) -> PrevSiblings

Iterator over all previous widgets within the same parent.

Source

pub fn self_and_prev_siblings(&self) -> PrevSiblings

Iterator over self and all previous widgets within the same parent.

Source

pub fn next_siblings(&self) -> NextSiblings

Iterator over all next widgets within the same parent.

Source

pub fn self_and_next_siblings(&self) -> NextSiblings

Iterator over self and all next widgets within the same parent.

Source

pub fn prev_siblings_in(&self, ancestor: &WidgetInfo) -> RevTreeIter

Iterator over all previous widgets within the same ancestor, including descendants of siblings.

If ancestor is not actually an ancestor iterates to the root.

Source

pub fn self_and_prev_siblings_in(&self, ancestor: &WidgetInfo) -> RevTreeIter

Iterator over self, descendants and all previous widgets within the same ancestor.

If ancestor is not actually an ancestor iterates to the root.

Source

pub fn next_siblings_in(&self, ancestor: &WidgetInfo) -> TreeIter

Iterator over all next widgets within the same ancestor, including descendants of siblings.

If ancestor is not actually an ancestor iterates to the root.

Source

pub fn self_and_next_siblings_in(&self, ancestor: &WidgetInfo) -> TreeIter

Iterator over self, descendants and all next widgets within the same ancestor.

If ancestor is not actually an ancestor iterates to the root.

Source

pub fn orientation_from(&self, origin: PxPoint) -> Option<Orientation2D>

The center orientation in relation to an origin.

Returns None if the origin is the center.

Source

pub fn distance_key(&self, origin: PxPoint) -> DistanceKey

Value that indicates the distance between this widget center and origin.

Source

pub fn rect_distance_key(&self, origin: PxPoint) -> DistanceKey

Value that indicates the distance between the nearest point inside this widgets rectangles and origin.

The widgets rectangles is the inner bounds for block widgets or the row rectangles for inline widgets.

Source

pub fn rect_distance_key_filtered( &self, origin: PxPoint, filter: impl FnMut(PxRect, usize, usize) -> bool, ) -> DistanceKey

Like rect_distance_key, but only consider rectangles approved by filter.

The filter parameters are the rectangle, the inline row index and the total inline rows length. If the widget is not inlined both the index and len are zero.

Source

pub fn depth(&self) -> usize

Count of ancestors.

Source

pub fn shared_ancestor(&self, other: &Self) -> Option<WidgetInfo>

First ancestor of self and other.

Returns None if other is not from the same tree.

Source

pub fn is_in_bounds(&self) -> bool

Returns true if this widget’s inner bounds are fully contained by the parent inner bounds.

Source

pub fn out_of_bounds( &self, ) -> impl Iterator<Item = WidgetInfo> + 'static + use<>

Iterator over all descendants with inner bounds not fully contained by their parent inner bounds.

Source

pub fn spatial_iter<F>( &self, filter: F, ) -> impl Iterator<Item = WidgetInfo> + use<F>
where F: Fn(&WidgetInfo) -> bool + Clone,

Iterator over self and descendants, first self, then all in-bounds descendants, then all out-of-bounds descendants.

If the filter returns false the widget and all it’s in-bounds descendants are skipped, otherwise they are yielded. After all in-bounds descendants reachable from self and filtered the iterator changes to each out-of-bounds descendants and their in-bounds descendants that are also filtered.

Source

pub fn inner_contains( &self, point: PxPoint, ) -> impl Iterator<Item = WidgetInfo> + 'static + use<>

Iterator over self and all descendants with inner bounds that contain the point.

Source

pub fn inner_intersects( &self, rect: PxRect, ) -> impl Iterator<Item = WidgetInfo> + 'static + use<>

Spatial iterator over self and descendants with inner bounds that intersects the rect.

Source

pub fn inner_contains_rect( &self, rect: PxRect, ) -> impl Iterator<Item = WidgetInfo> + 'static + use<>

Spatial iterator over self and descendants with inner bounds that fully envelops the rect.

Source

pub fn inner_contained( &self, rect: PxRect, ) -> impl Iterator<Item = WidgetInfo> + 'static + use<>

Spatial iterator over self and descendants with inner bounds that are fully inside the rect.

Source

pub fn center_contained( &self, area: PxRect, ) -> impl Iterator<Item = WidgetInfo> + 'static + use<>

Spatial iterator over self and descendants with center point inside the area.

Source

pub fn center_in_distance( &self, origin: PxPoint, max_radius: Px, ) -> impl Iterator<Item = WidgetInfo> + 'static + use<>

Spatial iterator over self and descendants with center point within the max_radius of the origin.

Source

pub fn hit_test(&self, point: PxPoint) -> HitTestInfo

Gets all widgets of self and descendants hit by a point, sorted by z-index of the hit, front to back.

Source

pub fn nearest(&self, origin: PxPoint, max_radius: Px) -> Option<WidgetInfo>

Find the descendant with center point nearest of origin within the max_radius.

This method is faster than sorting the result of center_in_distance, but is slower if any point in distance is acceptable.

Source

pub fn nearest_filtered( &self, origin: PxPoint, max_radius: Px, filter: impl FnMut(&WidgetInfo) -> bool, ) -> Option<WidgetInfo>

Find the widget, self or descendant, with center point nearest of origin within the max_radius and approved by the filter closure.

Source

pub fn nearest_bounded_filtered( &self, origin: PxPoint, max_radius: Px, bounds: PxRect, filter: impl FnMut(&WidgetInfo) -> bool, ) -> Option<WidgetInfo>

Find the widget, self or descendant, with center point nearest of origin within the max_radius and inside bounds; and approved by the filter closure.

Source

pub fn nearest_rect( &self, origin: PxPoint, max_radius: Px, ) -> Option<WidgetInfo>

Find the descendant that has inner bounds or inline rows nearest to origin and are within max_radius.

The distance is from any given point inside the bounds or inline rows rectangle to the origin. If origin is inside the rectangle the distance is zero. If multiple widgets have the same distance the nearest center point widget is used.

Source

pub fn nearest_rect_filtered( &self, origin: PxPoint, max_radius: Px, filter: impl FnMut(&WidgetInfo, PxRect, usize, usize) -> bool, ) -> Option<WidgetInfo>

Find the descendant that has inner bounds or inline rows nearest to origin and are within max_radius and are approved by the filter closure.

The filter parameters are the widget, the rect, the rect row index and the widget inline rows length. If the widget is not inlined both index and len are zero.

Source

pub fn nearest_rect_bounded_filtered( &self, origin: PxPoint, max_radius: Px, bounds: PxRect, filter: impl FnMut(&WidgetInfo, PxRect, usize, usize) -> bool, ) -> Option<WidgetInfo>

Find the widget, self or descendant, with inner bounds or inline rows nearest of origin within the max_radius and inside bounds; and approved by the filter closure.

The filter parameters are the widget, the rect, the rect row index and the widget inline rows length. If the widget is not inlined both index and len are zero.

Source

pub fn oriented( &self, origin: PxPoint, max_distance: Px, orientation: Orientation2D, ) -> impl Iterator<Item = WidgetInfo> + 'static + use<>

Spatial iterator over all widgets, self and descendants, with center in the direction defined by orientation and within max_distance of the origin, widgets are only visited once and the distance is clipped by the spatial_bounds.

Use Px::MAX on the distance to visit all widgets in the direction.

The direction is defined by a 45º frustum cast from the origin, see Orientation2D::point_is for more details.

Source

pub fn oriented_box( &self, origin: PxBox, max_distance: Px, orientation: Orientation2D, ) -> impl Iterator<Item = WidgetInfo> + 'static + use<>

Spatial iterator over all widgets, self and descendants, with inner_bounds in the direction defined by orientation in relation to origin and with center within max_distance of the origin center. Widgets are only visited once and the distance is clipped by the spatial_bounds.

Use Px::MAX on the distance to visit all widgets in the direction.

The direction is a collision check between inner-bounds and origin, see Orientation2D::box_is for more details.

Source

pub fn nearest_oriented( &self, origin: PxPoint, max_distance: Px, orientation: Orientation2D, ) -> Option<WidgetInfo>

Find the widget with center point nearest of origin within the max_distance and with orientation to origin.

This method is faster than searching the result of oriented.

Source

pub fn nearest_oriented_filtered( &self, origin: PxPoint, max_distance: Px, orientation: Orientation2D, filter: impl FnMut(&WidgetInfo) -> bool, ) -> Option<WidgetInfo>

Find the widget with center point nearest of origin within the max_distance and with orientation to origin, and approved by the filter closure.

This method is faster than searching the result of oriented.

Source

pub fn nearest_box_oriented( &self, origin: PxBox, max_distance: Px, orientation: Orientation2D, ) -> Option<WidgetInfo>

Find the widget with center point nearest to origin center within the max_distance and with box orientation to origin.

This method is faster than searching the result of oriented_box.

Source

pub fn nearest_box_oriented_filtered( &self, origin: PxBox, max_distance: Px, orientation: Orientation2D, filter: impl FnMut(&WidgetInfo) -> bool, ) -> Option<WidgetInfo>

Find the widget with center point nearest to origin center within the max_distance and with box orientation to origin, and approved by the filter closure.

This method is faster than searching the result of oriented_box.

Trait Implementations§

Source§

impl Clone for WidgetInfo

Source§

fn clone(&self) -> WidgetInfo

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for WidgetInfo

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Hash for WidgetInfo

Source§

fn hash<H: Hasher>(&self, state: &mut H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for WidgetInfo

Source§

fn eq(&self, other: &Self) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl WidgetInfoInspectorExt for WidgetInfo

Source§

fn inspector_info(&self) -> Option<Arc<InspectorInfo>>

Reference the builder that was used to generate the widget, the builder generated items and the widget info context. Read more
Source§

fn can_inspect(&self) -> bool

If a inspector_info is defined for the widget.
Source§

fn inspect_child<P: InspectWidgetPattern>( &self, pattern: P, ) -> Option<WidgetInfo>

Returns the first child that matches.
Source§

fn inspect_descendant<P: InspectWidgetPattern>( &self, pattern: P, ) -> Option<WidgetInfo>

Returns the first descendant that matches. Read more
Source§

fn inspect_ancestor<P: InspectWidgetPattern>( &self, pattern: P, ) -> Option<WidgetInfo>

Returns the first ancestor that matches.
Source§

fn inspect_property<P: InspectPropertyPattern>( &self, pattern: P, ) -> Option<&dyn PropertyArgs>

Search for a property set on the widget. Read more
Source§

fn parent_property(&self) -> Option<(PropertyId, usize)>

Gets the parent property that has this widget as an input. Read more
Source§

impl WidgetPathProvider for WidgetInfo

Source§

type WidgetIter<'s> = Map<Ancestors, fn(WidgetInfo) -> WidgetId>

Output of widget_and_ancestors.
Source§

fn window_id(&self) -> WindowId

The window parent.
Source§

fn widget_and_ancestors(&self) -> Self::WidgetIter<'_>

Iterate over the widget, parent, grandparent, .., root.
Source§

impl Eq for WidgetInfo

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> AnyVarValue for T
where T: Debug + PartialEq + Clone + Any + Send + Sync,

Source§

fn clone_boxed(&self) -> BoxAnyVarValue

Clone the value.
Source§

fn eq_any(&self, other: &(dyn AnyVarValue + 'static)) -> bool

Gets if self and other are equal.
Source§

fn try_swap(&mut self, other: &mut (dyn AnyVarValue + 'static)) -> bool

Swap value with other if both are of the same type.
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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> IntoVar<T> for T
where T: VarValue,

Source§

fn into_var(self) -> Var<T>

§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
Source§

impl<T> IntoValue<T> for T
where T: VarValue,

Source§

impl<T> StateValue for T
where T: Any + Send + Sync,

Source§

impl<T> VarValue for T