pub struct AnnotationRegistry { /* private fields */ }Expand description
Registry that collects widget annotations during rendering.
The registry maintains a tree structure of annotated regions, enabling queries like “what widget is at position X,Y” or “find all buttons”.
Implementations§
Source§impl AnnotationRegistry
impl AnnotationRegistry
Sourcepub fn register(&mut self, area: Rect, annotation: Annotation) -> usize
pub fn register(&mut self, area: Rect, annotation: Annotation) -> usize
Registers a new annotated region.
Returns the index of the registered region.
Sourcepub fn open(&mut self, area: Rect, annotation: Annotation) -> usize
pub fn open(&mut self, area: Rect, annotation: Annotation) -> usize
Opens a region (for nested widgets).
Subsequent registrations will be children of this region.
Sourcepub fn regions(&self) -> &[RegionInfo]
pub fn regions(&self) -> &[RegionInfo]
Returns all registered regions.
Sourcepub fn get(&self, index: usize) -> Option<&RegionInfo>
pub fn get(&self, index: usize) -> Option<&RegionInfo>
Returns a region by index.
Sourcepub fn region_at(&self, x: u16, y: u16) -> Option<&RegionInfo>
pub fn region_at(&self, x: u16, y: u16) -> Option<&RegionInfo>
Returns the region at the given position.
If multiple regions overlap, returns the deepest one (most specific).
Sourcepub fn regions_at(&self, x: u16, y: u16) -> Vec<&RegionInfo>
pub fn regions_at(&self, x: u16, y: u16) -> Vec<&RegionInfo>
Returns all regions at the given position.
Sourcepub fn find_by_id(&self, id: &str) -> Vec<&RegionInfo>
pub fn find_by_id(&self, id: &str) -> Vec<&RegionInfo>
Finds regions by annotation id.
Sourcepub fn get_by_id(&self, id: &str) -> Option<&RegionInfo>
pub fn get_by_id(&self, id: &str) -> Option<&RegionInfo>
Finds the first region with the given id.
Sourcepub fn find_by_type(&self, widget_type: &WidgetType) -> Vec<&RegionInfo>
pub fn find_by_type(&self, widget_type: &WidgetType) -> Vec<&RegionInfo>
Finds regions by widget type.
Sourcepub fn interactive_regions(&self) -> Vec<&RegionInfo>
pub fn interactive_regions(&self) -> Vec<&RegionInfo>
Returns all interactive regions.
Sourcepub fn focused_region(&self) -> Option<&RegionInfo>
pub fn focused_region(&self) -> Option<&RegionInfo>
Returns the currently focused region, if any.
Sourcepub fn root_regions(&self) -> Vec<&RegionInfo>
pub fn root_regions(&self) -> Vec<&RegionInfo>
Returns root regions (depth 0).
Sourcepub fn children_of(&self, index: usize) -> Vec<&RegionInfo>
pub fn children_of(&self, index: usize) -> Vec<&RegionInfo>
Returns children of a region.
Sourcepub fn format_tree(&self) -> String
pub fn format_tree(&self) -> String
Formats the registry as a tree for debugging.
Trait Implementations§
Source§impl Clone for AnnotationRegistry
impl Clone for AnnotationRegistry
Source§fn clone(&self) -> AnnotationRegistry
fn clone(&self) -> AnnotationRegistry
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for AnnotationRegistry
impl Debug for AnnotationRegistry
Source§impl Default for AnnotationRegistry
impl Default for AnnotationRegistry
Source§fn default() -> AnnotationRegistry
fn default() -> AnnotationRegistry
Source§impl<'de> Deserialize<'de> for AnnotationRegistry
impl<'de> Deserialize<'de> for AnnotationRegistry
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for AnnotationRegistry
impl RefUnwindSafe for AnnotationRegistry
impl Send for AnnotationRegistry
impl Sync for AnnotationRegistry
impl Unpin for AnnotationRegistry
impl UnsafeUnpin for AnnotationRegistry
impl UnwindSafe for AnnotationRegistry
Blanket Implementations§
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§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