zng_app::widget::info

Struct WidgetBoundsInfo

source
pub struct WidgetBoundsInfo(/* private fields */);
Expand description

Shared reference to layout size, offsets, rendered transforms and bounds of a widget.

Can be retrieved in the WIDGET and WidgetInfo.

Implementations§

source§

impl WidgetBoundsInfo

source

pub fn new() -> Self

New default.

source

pub fn new_size(outer: PxSize, inner: PxSize) -> Self

New info with bound sizes known.

source

pub fn measure_outer_size(&self) -> PxSize

Gets the widget’s last measured outer bounds size.

This size is expected to be the same if the widget is layout using the same exact parameters it was measured.

source

pub fn outer_size(&self) -> PxSize

Gets the widget’s last layout outer bounds size.

source

pub fn inner_offset(&self) -> PxVector

Gets the widget’s inner bounds offset inside the outer bounds.

If inner_offset_baseline is true the baseline is added from this value.

source

pub fn inner_offset_baseline(&self) -> bool

If the baseline is added from the inner_offset.

source

pub fn child_offset(&self) -> PxVector

Gets the widget’s child offset inside the inner bounds.

If the widget’s child is another widget this is zero and the offset is set on that child’s parent_child_offset instead.

source

pub fn inner_size(&self) -> PxSize

Gets the widget’s inner bounds size.

source

pub fn baseline(&self) -> Px

The baseline offset up from the inner bounds bottom line.

Note that if inner_offset_baseline is true the inner_offset is already added by the baseline. Parent panel widgets implementing baseline offset must use the final_baseline value to avoid offsetting more then once.

source

pub fn final_baseline(&self) -> Px

Gets the baseline of the widget after inner_offset is applied.

Returns Px(0) if inner_offset_baseline, otherwise returns baseline.

source

pub fn outer_transform(&self) -> PxTransform

Gets the global transform of the widget’s outer bounds during the last render or render update.

source

pub fn parent_child_offset(&self) -> PxVector

Offset rendered in the widget inner set by the parent widget.

Note that this offset is applied to the outer_transform already.

source

pub fn inner_transform(&self) -> PxTransform

Gets the global transform of the widget’s inner bounds during the last render or render update.

source

pub fn measure_inline(&self) -> Option<WidgetInlineMeasure>

Gets the latest inline measure info.

Note that this info may not be the same that was used to update the inline layout info. This value is only useful for panels implementing inline, just after the widget was measured.

Returns None if the latest widget measure was not in an inlining context.

source

pub fn inline(&self) -> Option<MappedMutexGuard<'_, WidgetInlineInfo>>

Exclusive read the latest inline layout info.

Returns None if the latest widget layout was not in an inlining context.

source

pub fn rendered(&self) -> Option<bool>

Gets the widget’s latest render info, if it was rendered visible or hidden. Returns None if the widget was collapsed.

source

pub fn is_in_bounds(&self) -> bool

Gets if the inner_bounds are fully inside the parent inner bounds.

source

pub fn can_auto_hide(&self) -> bool

Gets if the widget only renders if outer_bounds intersects with the FrameBuilder::auto_hide_rect.

This is true by default and can be disabled using allow_auto_hide. If set to false the widget is always rendered, but descendant widgets can still auto-hide.

source

pub fn outer_bounds(&self) -> PxRect

Outer bounding box, updated after every render.

source

pub fn inner_bounds(&self) -> PxRect

Calculate the bounding box that envelops the actual size and position of the inner bounds last rendered.

source

pub fn is_collapsed(&self) -> bool

If the widget and descendants was collapsed during layout.

source

pub fn transform_style(&self) -> TransformStyle

Gets if the widget preserves 3D perspective.

source

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

Gets the widget perspective and perspective origin (in the inner bounds).

source

pub fn metrics(&self) -> Option<LayoutMetricsSnapshot>

Snapshot of the LayoutMetrics on the last layout.

The metrics_used value indicates what fields where actually used in the last layout.

Is None if the widget is collapsed.

source

pub fn metrics_used(&self) -> LayoutMask

All metrics fields used by the widget or descendants on the last layout.

source

pub fn hit_test_z(&self, window_point: PxPoint) -> RelativeHitZ

Gets the relative hit-test Z for window_point against the hit-test shapes rendered for the widget.

source

pub fn hit_test_clip_child( &self, child: &WidgetInfo, window_point: PxPoint, ) -> bool

Returns true if a hit-test clip that affects the child removes the window_point hit on the child.

Trait Implementations§

source§

impl Clone for WidgetBoundsInfo

source§

fn clone(&self) -> WidgetBoundsInfo

Returns a copy 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 WidgetBoundsInfo

source§

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

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

impl Default for WidgetBoundsInfo

source§

fn default() -> WidgetBoundsInfo

Returns the “default value” for a type. Read more
source§

impl PartialEq for WidgetBoundsInfo

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 Eq for WidgetBoundsInfo

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: VarValue,

source§

fn as_any(&self) -> &(dyn Any + 'static)

Access to dyn Any methods.
source§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Access to mut dyn Any methods.
source§

fn clone_boxed(&self) -> Box<dyn AnyVarValue>

Clone the value.
source§

fn clone_boxed_var(&self) -> Box<dyn AnyVar>

Clone the value into a new boxed LocalVar<Self>.
source§

fn into_any(self: Box<T>) -> Box<dyn Any>

Access to Box<dyn Any> methods.
source§

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

Gets if self equals other.
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, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. 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§

type Var = LocalVar<T>

Variable type that will wrap the T value. Read more
source§

fn into_var(self) -> <T as IntoVar<T>>::Var

Converts the source value into a var.
source§

fn into_boxed_var(self) -> Box<dyn VarBoxed<T>>
where Self: Sized,

Converts into BoxedVar<T>. Read more
§

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