Struct accesskit_winit::Adapter
source · pub struct Adapter { /* private fields */ }
Implementations§
source§impl Adapter
impl Adapter
sourcepub fn new<T: From<ActionRequestEvent> + Send + 'static>(
window: &Window,
source: impl 'static + FnOnce() -> TreeUpdate + Send,
event_loop_proxy: EventLoopProxy<T>
) -> Self
pub fn new<T: From<ActionRequestEvent> + Send + 'static>( window: &Window, source: impl 'static + FnOnce() -> TreeUpdate + Send, event_loop_proxy: EventLoopProxy<T> ) -> Self
Creates a new AccessKit adapter for a winit window. This must be done
before the window is shown for the first time. This means that you must
use winit::window::WindowBuilder::with_visible
to make the window
initially invisible, then create the adapter, then show the window.
sourcepub fn with_action_handler(
window: &Window,
source: impl 'static + FnOnce() -> TreeUpdate + Send,
action_handler: Box<dyn ActionHandler>
) -> Self
pub fn with_action_handler( window: &Window, source: impl 'static + FnOnce() -> TreeUpdate + Send, action_handler: Box<dyn ActionHandler> ) -> Self
Creates a new AccessKit adapter for a winit window. This must be done
before the window is shown for the first time. This means that you must
use winit::window::WindowBuilder::with_visible
to make the window
initially invisible, then create the adapter, then show the window.
Use this if you need to provide your own AccessKit action handler rather than dispatching action requests through the winit event loop. Remember that an AccessKit action handler can be called on any thread, depending on the underlying AccessKit platform adapter.
sourcepub fn process_event(&self, window: &Window, event: &WindowEvent)
pub fn process_event(&self, window: &Window, event: &WindowEvent)
Allows reacting to window events.
This must be called whenever a new window event is received and before it is handled by the application.
pub fn update(&self, update: TreeUpdate)
pub fn update_if_active(&self, updater: impl FnOnce() -> TreeUpdate)
Auto Trait Implementations§
impl RefUnwindSafe for Adapter
impl Send for Adapter
impl Sync for Adapter
impl Unpin for Adapter
impl UnwindSafe for Adapter
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
source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.