pub struct Announcer { /* private fields */ }Expand description
Where an application says what changed. A handle: clones say it in the same place.
use ravenrs_app_a11y::{Announcer, Urgency};
use ravenrs_core::Role;
use ravenrs_widgets::Ui;
let announcer = Announcer::new();
let mut ui = Ui::new(announcer.region(), ravenrs_style::Theme::raven_dark());
announcer.polite("Salvo: Conta corrente");
ui.update();
assert!(ui.access_tree().find(Role::Status, "Salvo: Conta corrente").is_some());
announcer.assertive("Não foi salvo");
ui.update();
assert!(ui.access_tree().find(Role::Alert, "Não foi salvo").is_some());
assert_eq!(announcer.latest().map(|a| a.urgency), Some(Urgency::Assertive));Implementations§
Source§impl Announcer
impl Announcer
Sourcepub fn say(&self, text: String, urgency: Urgency)
pub fn say(&self, text: String, urgency: Urgency)
Says text this soon. Empty words say nothing.
Sourcepub fn set_quiet(&self, quiet: bool)
pub fn set_quiet(&self, quiet: bool)
Stops saying anything, or starts again, for an application that announces in its own way.
Sourcepub fn latest(&self) -> Option<Announcement>
pub fn latest(&self) -> Option<Announcement>
The latest thing said.
Sourcepub fn recent(&self) -> Vec<Announcement>
pub fn recent(&self) -> Vec<Announcement>
The last few things said, newest last.
Sourcepub fn region(&self) -> LiveRegion
pub fn region(&self) -> LiveRegion
Where screen readers hear it. It takes no room.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Announcer
impl !Send for Announcer
impl !Sync for Announcer
impl !UnwindSafe for Announcer
impl Freeze for Announcer
impl Unpin for Announcer
impl UnsafeUnpin for Announcer
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
Mutably borrows from an owned value. Read more