accesskit_macos

Struct SubclassingAdapter

source
pub struct SubclassingAdapter { /* private fields */ }
Expand description

Uses dynamic Objective-C subclassing to implement the NSView accessibility methods when normal subclassing isn’t an option.

Implementations§

source§

impl SubclassingAdapter

source

pub unsafe fn new( view: *mut c_void, activation_handler: impl 'static + ActivationHandler, action_handler: impl 'static + ActionHandler, ) -> Self

Create an adapter that dynamically subclasses the specified view. This must be done before the view is shown or focused for the first time.

The action handler will always be called on the main thread.

§Safety

view must be a valid, unreleased pointer to an NSView.

source

pub unsafe fn for_window( window: *mut c_void, activation_handler: impl 'static + ActivationHandler, action_handler: impl 'static + ActionHandler, ) -> Self

Create an adapter that dynamically subclasses the content view of the specified window.

The action handler will always be called on the main thread.

§Safety

window must be a valid, unreleased pointer to an NSWindow.

§Panics

This function panics if the specified window doesn’t currently have a content view.

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.

source

pub fn update_view_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.

Trait Implementations§

source§

impl Drop for SubclassingAdapter

source§

fn drop(&mut self)

Executes the destructor for this type. 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.
source§

impl<T> AutoreleaseSafe for T
where T: ?Sized,