Struct zng_app::widget::info::WidgetInfoTree
source · pub struct WidgetInfoTree(/* private fields */);
Expand description
A tree of WidgetInfo
.
The tree is behind an Arc
pointer so cloning and storing this type is very cheap.
Instantiated using WidgetInfoBuilder
.
Implementations§
source§impl WidgetInfoTree
impl WidgetInfoTree
sourcepub fn access_enabled(&self) -> AccessEnabled
pub fn access_enabled(&self) -> AccessEnabled
If this tree contains accessibility information.
If accessibility is enabled for the window and will stay enabled for its lifetime.
sourcepub fn to_access_tree(&self) -> AccessTree
pub fn to_access_tree(&self) -> AccessTree
Build an access tree from the info tree.
If not access_enabled
returns a placeholder tree with only the root node.
sourcepub fn to_access_updates(&self, prev_tree: &Self) -> Option<AccessTreeUpdate>
pub fn to_access_updates(&self, prev_tree: &Self) -> Option<AccessTreeUpdate>
Build partial or full access trees for updated widgets.
Returns None
if not access_enabled
or no access info has changed. The focused
value is always set
to the root ID, it must be changed to the correct focused widget.
This is usually called by window implementers just after the next frame after info rebuild. Note that these
updates will also include to_access_updates_bounds
.
sourcepub fn to_access_updates_bounds(&self) -> Option<AccessTreeUpdate>
pub fn to_access_updates_bounds(&self) -> Option<AccessTreeUpdate>
Build partial access trees for widgets that changed transform, size or visibility.
Returns None
if not access_enabled
or no transform/visibility changed. The focused
value is always set
to the root ID, it must be changed to the correct focused widget.
This is usually called by window implementers after each frame that is not to_access_updates
.
source§impl WidgetInfoTree
impl WidgetInfoTree
sourcepub fn wgt(window_id: WindowId, root_id: WidgetId) -> Self
pub fn wgt(window_id: WindowId, root_id: WidgetId) -> Self
Blank window that contains only the root widget taking no space.
sourcepub fn stats(&self) -> WidgetInfoTreeStats
pub fn stats(&self) -> WidgetInfoTreeStats
Statistics abound the info tree.
sourcepub fn scale_factor(&self) -> Factor
pub fn scale_factor(&self) -> Factor
Scale factor of the last rendered frame.
sourcepub fn view_process_gen(&self) -> ViewProcessGen
pub fn view_process_gen(&self) -> ViewProcessGen
View-process generation.
Is ViewProcessGen::INVALID
before first render and in headless apps.
sourcepub fn build_meta(&self) -> StateMapRef<'_, WidgetInfoMeta>
pub fn build_meta(&self) -> StateMapRef<'_, WidgetInfoMeta>
Custom metadata associated with the tree during info build.
Any widget (that was not reused) can have inserted metadata.
sourcepub fn root(&self) -> WidgetInfo
pub fn root(&self) -> WidgetInfo
Reference to the root widget in the tree.
sourcepub fn all_widgets(&self) -> TreeIter ⓘ
pub fn all_widgets(&self) -> TreeIter ⓘ
All widgets including root
.
sourcepub fn window_id(&self) -> WindowId
pub fn window_id(&self) -> WindowId
Id of the window that owns all widgets represented in the tree.
sourcepub fn get(&self, widget_id: impl Into<WidgetId>) -> Option<WidgetInfo>
pub fn get(&self, widget_id: impl Into<WidgetId>) -> Option<WidgetInfo>
Reference to the widget in the tree, if it is present.
sourcepub fn contains(&self, widget_id: impl Into<WidgetId>) -> bool
pub fn contains(&self, widget_id: impl Into<WidgetId>) -> bool
If the tree contains the widget.
sourcepub fn get_or_parent(&self, path: &WidgetPath) -> Option<WidgetInfo>
pub fn get_or_parent(&self, path: &WidgetPath) -> Option<WidgetInfo>
Reference to the widget or first parent that is present.
sourcepub fn is_rendered(&self) -> bool
pub fn is_rendered(&self) -> bool
If the widgets in this tree have been rendered at least once, after the first render the widget bounds info are always up-to-date and spatial queries can be made on the widgets.
sourcepub fn out_of_bounds(&self) -> impl ExactSizeIterator<Item = WidgetInfo>
pub fn out_of_bounds(&self) -> impl ExactSizeIterator<Item = WidgetInfo>
Iterator over all widgets with inner-bounds not fully contained by their parent inner bounds.
sourcepub fn spatial_bounds(&self) -> PxRect
pub fn spatial_bounds(&self) -> PxRect
Gets the bounds box that envelops all widgets, including the out-of-bounds widgets.
Trait Implementations§
source§impl Clone for WidgetInfoTree
impl Clone for WidgetInfoTree
source§fn clone(&self) -> WidgetInfoTree
fn clone(&self) -> WidgetInfoTree
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for WidgetInfoTree
impl Debug for WidgetInfoTree
source§impl PartialEq for WidgetInfoTree
impl PartialEq for WidgetInfoTree
impl Eq for WidgetInfoTree
Auto Trait Implementations§
impl Freeze for WidgetInfoTree
impl !RefUnwindSafe for WidgetInfoTree
impl Send for WidgetInfoTree
impl Sync for WidgetInfoTree
impl Unpin for WidgetInfoTree
impl !UnwindSafe for WidgetInfoTree
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