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 offset 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 inner_rects(&self) -> Vec<PxRect> ⓘ
pub fn inner_rects(&self) -> Vec<PxRect> ⓘ
Gets the inline rows for inline widgets or inner bounds for block widgets.
The rectangles are in the root space.
Sourcepub fn visit_inner_rects<B>(
&self,
visitor: impl FnMut(PxRect, usize, usize) -> ControlFlow<B>,
) -> Option<B>
pub fn visit_inner_rects<B>( &self, visitor: impl FnMut(PxRect, usize, usize) -> ControlFlow<B>, ) -> Option<B>
Call visitor for each inner_rects without allocating or locking.
is not inline both index and len are zero.
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 T
impl<T> AnyVarValue for T
Source§fn clone_boxed(&self) -> BoxAnyVarValue
fn clone_boxed(&self) -> BoxAnyVarValue
Source§fn eq_any(&self, other: &(dyn AnyVarValue + 'static)) -> bool
fn eq_any(&self, other: &(dyn AnyVarValue + 'static)) -> bool
self and other are equal.Source§fn try_swap(&mut self, other: &mut (dyn AnyVarValue + 'static)) -> bool
fn try_swap(&mut self, other: &mut (dyn AnyVarValue + 'static)) -> bool
other if both are of the same type.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,
§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
§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