pub struct AppHandler<A: Application> { /* private fields */ }Expand description
Default implementation for winit::application::ApplicationHandler.
The new winit requires an implementation of that trait to be able to use
an EventLoop, and everything, including the main window, will be done from
that.
This type implements this trait and does some basic tasks:
- Creates the
MainWindowWithRendererobject. - Forwards the events to your application object.
For that it requires that your application object implements UiBuilder and
Application.
If you have special needs you can skip this and write your own implementation
of winit::application::ApplicationHandler.
Implementations§
Source§impl<A: Application> AppHandler<A>
impl<A: Application> AppHandler<A>
Sourcepub fn new(event_loop: &EventLoop<AppEvent<A>>, app_data: A::Data) -> Self
pub fn new(event_loop: &EventLoop<AppEvent<A>>, app_data: A::Data) -> Self
Creates a new AppHandler.
It creates an empty handler. It automatically creates an EventLoopProxy.
Sourcepub fn imgui_builder(&mut self) -> &mut ContextBuilder
pub fn imgui_builder(&mut self) -> &mut ContextBuilder
Returns the ContextBuilder of this application.
With this you can change the ImGui options before the context is created.
Sourcepub fn set_attributes(&mut self, wattrs: WindowAttributes)
pub fn set_attributes(&mut self, wattrs: WindowAttributes)
Sets the window attributes that will be used to create the main window.
Sourcepub fn attributes(&mut self) -> &mut WindowAttributes
pub fn attributes(&mut self) -> &mut WindowAttributes
Gets the current window attributes.
It returns a mutable reference, so you can modify it in-place, which is sometimes more convenient.
Sourcepub fn into_inner(self) -> (Option<A>, A::Data)
pub fn into_inner(self) -> (Option<A>, A::Data)
Extracts the inner values.
You may need this after the main loop has finished to get the result of your program execution.
Sourcepub fn event_proxy(&self) -> &EventLoopProxy<AppEvent<A>>
pub fn event_proxy(&self) -> &EventLoopProxy<AppEvent<A>>
Gets the inner EventLoopProxy.
Trait Implementations§
Source§impl<A> ApplicationHandler<AppEvent<A>> for AppHandler<A>where
A: Application,
impl<A> ApplicationHandler<AppEvent<A>> for AppHandler<A>where
A: Application,
Source§fn suspended(&mut self, event_loop: &ActiveEventLoop)
fn suspended(&mut self, event_loop: &ActiveEventLoop)
Source§fn resumed(&mut self, event_loop: &ActiveEventLoop)
fn resumed(&mut self, event_loop: &ActiveEventLoop)
Source§fn window_event(
&mut self,
event_loop: &ActiveEventLoop,
window_id: WindowId,
event: WindowEvent,
)
fn window_event( &mut self, event_loop: &ActiveEventLoop, window_id: WindowId, event: WindowEvent, )
Source§fn device_event(
&mut self,
event_loop: &ActiveEventLoop,
device_id: DeviceId,
event: DeviceEvent,
)
fn device_event( &mut self, event_loop: &ActiveEventLoop, device_id: DeviceId, event: DeviceEvent, )
Source§fn user_event(&mut self, event_loop: &ActiveEventLoop, event: AppEvent<A>)
fn user_event(&mut self, event_loop: &ActiveEventLoop, event: AppEvent<A>)
EventLoopProxy::send_event.Source§fn new_events(&mut self, _event_loop: &ActiveEventLoop, _cause: StartCause)
fn new_events(&mut self, _event_loop: &ActiveEventLoop, _cause: StartCause)
Source§fn about_to_wait(&mut self, _event_loop: &ActiveEventLoop)
fn about_to_wait(&mut self, _event_loop: &ActiveEventLoop)
Source§fn exiting(&mut self, event_loop: &ActiveEventLoop)
fn exiting(&mut self, event_loop: &ActiveEventLoop)
Source§fn memory_warning(&mut self, event_loop: &ActiveEventLoop)
fn memory_warning(&mut self, event_loop: &ActiveEventLoop)
Auto Trait Implementations§
impl<A> Freeze for AppHandler<A>
impl<A> !RefUnwindSafe for AppHandler<A>
impl<A> !Send for AppHandler<A>
impl<A> !Sync for AppHandler<A>
impl<A> Unpin for AppHandler<A>
impl<A> !UnwindSafe for AppHandler<A>
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.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more