[−][src]Trait druid::AppDelegate
A type that provides hooks for handling and modifying top-level events.
The AppDelegate
is a trait that is allowed to handle and modify
events before they are passed down the widget tree.
It is a natural place for things like window and menu management.
You customize the AppDelegate
by implementing its methods on your own type.
Provided methods
fn event(
&mut self,
event: Event,
data: &mut T,
env: &Env,
ctx: &mut DelegateCtx,
win_ctx: &mut dyn WinCtx
) -> Option<Event>
&mut self,
event: Event,
data: &mut T,
env: &Env,
ctx: &mut DelegateCtx,
win_ctx: &mut dyn WinCtx
) -> Option<Event>
The AppDelegate
's event handler. This function receives all events,
before they are passed down the tree.
The return value of this function will be passed down the tree. This can
be the even that was passed in, a different event, or no event. In all cases,
the update
method will be called as usual.
fn window_added(
&mut self,
id: WindowId,
data: &mut T,
env: &Env,
ctx: &mut DelegateCtx
)
&mut self,
id: WindowId,
data: &mut T,
env: &Env,
ctx: &mut DelegateCtx
)
The handler for window creation events. This function is called after a window has been added, allowing you to customize the window creation behavior of your app.
fn window_removed(
&mut self,
id: WindowId,
data: &mut T,
env: &Env,
ctx: &mut DelegateCtx
)
&mut self,
id: WindowId,
data: &mut T,
env: &Env,
ctx: &mut DelegateCtx
)
The handler for window deletion events. This function is called after a window has been removed.