[][src]Trait druid::AppDelegate

pub trait AppDelegate<T: Data> {
    pub fn event(
        &mut self,
        ctx: &mut DelegateCtx<'_>,
        window_id: WindowId,
        event: Event,
        data: &mut T,
        env: &Env
    ) -> Option<Event> { ... }
pub fn command(
        &mut self,
        ctx: &mut DelegateCtx<'_>,
        target: Target,
        cmd: &Command,
        data: &mut T,
        env: &Env
    ) -> Handled { ... }
pub fn window_added(
        &mut self,
        id: WindowId,
        data: &mut T,
        env: &Env,
        ctx: &mut DelegateCtx<'_>
    ) { ... }
pub fn window_removed(
        &mut self,
        id: WindowId,
        data: &mut T,
        env: &Env,
        ctx: &mut DelegateCtx<'_>
    ) { ... } }

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

pub fn event(
    &mut self,
    ctx: &mut DelegateCtx<'_>,
    window_id: WindowId,
    event: Event,
    data: &mut T,
    env: &Env
) -> Option<Event>
[src]

The AppDelegate's event handler. This function receives all non-command events, before they are passed down the tree.

The return value of this function will be passed down the tree. This can be the event that was passed in, a different event, or no event. In all cases, the update() method will be called as usual.

pub fn command(
    &mut self,
    ctx: &mut DelegateCtx<'_>,
    target: Target,
    cmd: &Command,
    data: &mut T,
    env: &Env
) -> Handled
[src]

The AppDelegates Command handler.

This function is called with each (Target, Command) pair before they are sent down the tree.

If your implementation returns Handled::No, the command will be sent down the widget tree. Otherwise it will not.

To do anything fancier than this, you can submit arbitary commands via DelegateCtx::submit_command.

pub fn window_added(
    &mut self,
    id: WindowId,
    data: &mut T,
    env: &Env,
    ctx: &mut DelegateCtx<'_>
)
[src]

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.

pub fn window_removed(
    &mut self,
    id: WindowId,
    data: &mut T,
    env: &Env,
    ctx: &mut DelegateCtx<'_>
)
[src]

The handler for window deletion events. This function is called after a window has been removed.

Loading content...

Implementors

Loading content...