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
impl WidgetBoundsInfo
sourcepub fn measure_outer_size(&self) -> PxSize
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.
sourcepub fn outer_size(&self) -> PxSize
pub fn outer_size(&self) -> PxSize
Gets the widget’s last layout outer bounds size.
sourcepub fn inner_offset(&self) -> PxVector
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.
sourcepub fn inner_offset_baseline(&self) -> bool
pub fn inner_offset_baseline(&self) -> bool
If the baseline
is added from the inner_offset
.
sourcepub fn child_offset(&self) -> PxVector
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.
sourcepub fn inner_size(&self) -> PxSize
pub fn inner_size(&self) -> PxSize
Gets the widget’s inner bounds size.
sourcepub fn baseline(&self) -> Px
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.
sourcepub fn final_baseline(&self) -> Px
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
.
sourcepub fn outer_transform(&self) -> PxTransform
pub fn outer_transform(&self) -> PxTransform
Gets the global transform of the widget’s outer bounds during the last render or render update.
sourcepub fn parent_child_offset(&self) -> PxVector
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.
sourcepub fn inner_transform(&self) -> PxTransform
pub fn inner_transform(&self) -> PxTransform
Gets the global transform of the widget’s inner bounds during the last render or render update.
sourcepub fn measure_inline(&self) -> Option<WidgetInlineMeasure>
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.
sourcepub fn inline(&self) -> Option<MappedMutexGuard<'_, WidgetInlineInfo>>
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.
sourcepub fn rendered(&self) -> Option<bool>
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.
sourcepub fn is_in_bounds(&self) -> bool
pub fn is_in_bounds(&self) -> bool
Gets if the inner_bounds
are fully inside the parent inner bounds.
sourcepub fn can_auto_hide(&self) -> bool
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.
sourcepub fn outer_bounds(&self) -> PxRect
pub fn outer_bounds(&self) -> PxRect
Outer bounding box, updated after every render.
sourcepub fn inner_bounds(&self) -> PxRect
pub fn inner_bounds(&self) -> PxRect
Calculate the bounding box that envelops the actual size and position of the inner bounds last rendered.
sourcepub fn is_collapsed(&self) -> bool
pub fn is_collapsed(&self) -> bool
If the widget and descendants was collapsed during layout.
sourcepub fn transform_style(&self) -> TransformStyle
pub fn transform_style(&self) -> TransformStyle
Gets if the widget preserves 3D perspective.
sourcepub fn perspective(&self) -> Option<(f32, PxPoint)>
pub fn perspective(&self) -> Option<(f32, PxPoint)>
Gets the widget perspective and perspective origin (in the inner bounds).
sourcepub fn metrics(&self) -> Option<LayoutMetricsSnapshot>
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.
sourcepub fn metrics_used(&self) -> LayoutMask
pub fn metrics_used(&self) -> LayoutMask
All metrics
fields used by the widget or descendants on the last layout.
sourcepub fn hit_test_z(&self, window_point: PxPoint) -> RelativeHitZ
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.
sourcepub fn hit_test_clip_child(
&self,
child: &WidgetInfo,
window_point: PxPoint,
) -> bool
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
impl Clone for WidgetBoundsInfo
source§fn clone(&self) -> WidgetBoundsInfo
fn clone(&self) -> WidgetBoundsInfo
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for WidgetBoundsInfo
impl Debug for WidgetBoundsInfo
source§impl Default for WidgetBoundsInfo
impl Default for WidgetBoundsInfo
source§fn default() -> WidgetBoundsInfo
fn default() -> WidgetBoundsInfo
source§impl PartialEq for WidgetBoundsInfo
impl PartialEq for WidgetBoundsInfo
impl Eq for WidgetBoundsInfo
Auto Trait Implementations§
impl Freeze for WidgetBoundsInfo
impl !RefUnwindSafe for WidgetBoundsInfo
impl Send for WidgetBoundsInfo
impl Sync for WidgetBoundsInfo
impl Unpin for WidgetBoundsInfo
impl !UnwindSafe for WidgetBoundsInfo
Blanket Implementations§
source§impl<T> AnyVarValue for Twhere
T: VarValue,
impl<T> AnyVarValue for Twhere
T: VarValue,
source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
dyn Any
methods.source§fn clone_boxed(&self) -> Box<dyn AnyVarValue>
fn clone_boxed(&self) -> Box<dyn AnyVarValue>
source§fn clone_boxed_var(&self) -> Box<dyn AnyVar>
fn clone_boxed_var(&self) -> Box<dyn AnyVar>
LocalVar<Self>
.source§fn eq_any(&self, other: &(dyn AnyVarValue + 'static)) -> bool
fn eq_any(&self, other: &(dyn AnyVarValue + 'static)) -> bool
self
equals other
.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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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