[][src]Trait kas::event::Handler

pub trait Handler: Core {
    type Response: From<NoResponse>;
    fn handle_action(
        &mut self,
        tk: &dyn TkWidget,
        action: Action,
        number: u32
    ) -> Self::Response; }

Event-handling aspect of a widget.

This is a companion trait to Widget. It can (optionally) be implemented by the derive(Widget) macro, or can be implemented manually.

Associated Types

type Response: From<NoResponse>

Type of message returned by this handler.

This mechanism allows type-safe handling of user-defined responses to handled actions. For example, a user may define a control panel where each button returns a unique code, or a configuration editor may return a full copy of the new configuration on completion.

Loading content...

Required methods

fn handle_action(
    &mut self,
    tk: &dyn TkWidget,
    action: Action,
    number: u32
) -> Self::Response

Handle a high-level event directed at the widget identified by number, and return a user-defined msg.

Loading content...

Implementors

impl Handler for Entry<()>
[src]

type Response = NoResponse

impl Handler for Text
[src]

type Response = NoResponse

impl<R: From<NoResponse>, H: Fn() -> R> Handler for TextButton<H>
[src]

type Response = R

impl<R: From<NoResponse>, H: Fn() -> R> Handler for Entry<H>
[src]

type Response = R

Loading content...