Struct Adapter

Source
pub struct Adapter { /* private fields */ }

Implementations§

Source§

impl Adapter

Source

pub fn new( hwnd: HWND, is_window_focused: bool, action_handler: impl 'static + ActionHandler + Send, ) -> Self

Creates a new Windows platform adapter.

The action handler may or may not be called on the thread that owns the window.

This must not be called while handling the WM_GETOBJECT message, because this function must initialize UI Automation before that message is handled. This is necessary to prevent a race condition that leads to nested WM_GETOBJECT messages and, in some cases, assistive technologies not realizing that the window natively implements. UIA. See AccessKit issue #37 for more details.

Source

pub fn update_if_active( &mut self, update_factory: impl FnOnce() -> TreeUpdate, ) -> Option<QueuedEvents>

If and only if the tree has been initialized, call the provided function and apply the resulting update. Note: If the caller’s implementation of ActivationHandler::request_initial_tree initially returned None, the TreeUpdate returned by the provided function must contain a full tree.

If a QueuedEvents instance is returned, the caller must call QueuedEvents::raise on it.

This method may be safely called on any thread, but refer to QueuedEvents::raise for restrictions on the context in which it should be called.

Source

pub fn update_window_focus_state( &mut self, is_focused: bool, ) -> Option<QueuedEvents>

Update the tree state based on whether the window is focused.

If a QueuedEvents instance is returned, the caller must call QueuedEvents::raise on it.

This method may be safely called on any thread, but refer to QueuedEvents::raise for restrictions on the context in which it should be called.

Source

pub fn handle_wm_getobject<H: ActivationHandler + ?Sized>( &mut self, wparam: WPARAM, lparam: LPARAM, activation_handler: &mut H, ) -> Option<impl Into<LRESULT>>

Handle the WM_GETOBJECT window message. The accessibility tree is lazily initialized if necessary using the provided ActivationHandler implementation.

This returns an Option so the caller can pass the message to DefWindowProc if AccessKit decides not to handle it. The optional value is an Into<LRESULT> rather than simply an LRESULT so the necessary call to UIA, which may lead to a nested WM_GETOBJECT message, can be done outside of any lock that the caller might hold on the Adapter or window state, while still abstracting away the details of that call to UIA.

Trait Implementations§

Source§

impl Debug for Adapter

Source§

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

Formats the value using the given formatter. Read more

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> 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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.