Skip to main content

AccessNode

Struct AccessNode 

Source
pub struct AccessNode { /* private fields */ }
Expand description

A node of the accessibility tree: a widget, or a part of one (such as a dock’s tab).

Bits a node does not support are not asked of it: AccessNode::add_action says which requests it handles.

Implementations§

Source§

impl AccessNode

Source

pub fn new(role: Role) -> Self

A node with role.

Source

pub fn set_role(&mut self, role: Role)

Sets what the node is.

Source

pub fn set_label(&mut self, label: impl Into<String>)

Sets its name, such as a button’s text. Static text goes in set_value.

Source

pub fn set_value(&mut self, value: impl Into<String>)

Sets its text content: a label’s text, a text input’s text.

Source

pub fn set_bounds(&mut self, bounds: Rect)

Sets where it is, in physical pixels from the window’s top-left corner (a widget’s node starts with the widget’s rectangle).

Source

pub fn add_action(&mut self, action: AccessAction)

Says it handles action.

Source

pub fn set_selected(&mut self, selected: bool)

Sets whether it is the chosen one of its kind, such as the shown tab.

Source

pub fn set_checked(&mut self, checked: bool)

Sets whether it is on, for something that is on or off (a check menu item).

Source

pub fn set_expanded(&mut self, expanded: bool)

Sets whether what it opens is open, for something that opens more (a menu title, an item with a submenu).

Source

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

Whether it is on, if it is something that is on or off.

Source

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

Whether what it opens is open, if it opens something.

Source

pub fn set_disabled(&mut self, disabled: bool)

Sets whether it is unavailable.

Source

pub fn set_focused_part(&mut self, part: u32)

Says which of its parts has keyboard focus while the widget does (such as a dock’s chosen tab), so assistive technology reads that part rather than the whole widget.

Source

pub fn focused_part(&self) -> Option<u32>

The part with keyboard focus while the widget has it.

Source

pub fn push_part(&mut self, part: u32, node: AccessNode)

Adds node as a part of this one, numbered part: a piece that is not a widget of its own, such as a tab of a dock. Requests for it come to the widget with that number. Parts come before the widget’s children. Numbers must be unique within the widget, at any depth, and at most MAX_PART; a part breaking either rule is left out. Keep a part’s number while it lasts (number by identity, not by position), or a screen reader tracking it follows another one.

Source

pub fn role(&self) -> Role

What the node is.

Source

pub fn label(&self) -> Option<&str>

Its name.

Source

pub fn value(&self) -> Option<&str>

Its text content.

Source

pub fn bounds(&self) -> Rect

Where it is, in physical pixels.

Source

pub fn has_action(&self, action: AccessAction) -> bool

Whether it handles action.

Source

pub fn actions(&self) -> impl Iterator<Item = AccessAction> + '_

The actions it handles.

Source

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

Whether it is the chosen one of its kind, if that applies.

Source

pub fn is_disabled(&self) -> bool

Whether it is unavailable.

Source

pub fn clips_children(&self) -> bool

Whether it cuts off its children where they leave its bounds (it scrolls or clips), so children outside it are off screen.

Source

pub fn set_clips_children(&mut self, clips: bool)

Sets whether it cuts off its children where they leave its bounds (a widget’s node starts with this set when its style clips or scrolls).

Source

pub fn set_placeholder(&mut self, placeholder: impl Into<String>)

Sets the hint shown while it is empty, such as a text input’s placeholder.

Source

pub fn placeholder(&self) -> Option<&str>

The hint shown while it is empty.

Source

pub fn children(&self) -> &[AccessId]

Its children in the tree, in order (filled in by the Ui).

Trait Implementations§

Source§

impl Clone for AccessNode

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for AccessNode

Source§

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

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

impl Default for AccessNode

Source§

fn default() -> Self

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

impl PartialEq for AccessNode

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for AccessNode

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> 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> Brush for T
where T: Clone + PartialEq + Default + Debug,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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> 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 = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

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.