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
impl SubclassingAdapter
sourcepub unsafe fn new(
view: *mut c_void,
activation_handler: impl 'static + ActivationHandler,
action_handler: impl 'static + ActionHandler,
) -> Self
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
.
sourcepub unsafe fn for_window(
window: *mut c_void,
activation_handler: impl 'static + ActivationHandler,
action_handler: impl 'static + ActionHandler,
) -> Self
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.
sourcepub fn update_if_active(
&mut self,
update_factory: impl FnOnce() -> TreeUpdate,
) -> Option<QueuedEvents>
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.
sourcepub fn update_view_focus_state(
&mut self,
is_focused: bool,
) -> Option<QueuedEvents>
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.