Trait rat_ftable::event::HandleEvent

source ·
pub trait HandleEvent<Event, Qualifier, R>
where R: ConsumedEvent,
{ // Required method fn handle(&mut self, event: &Event, qualifier: Qualifier) -> R; }
Expand description

A very broad trait for an event handler for widgets.

As widget types are only short-lived, this trait should be implemented for the state type. Thereby it can modify any state, and it can return an arbitrary result, that fits the widget.

Required Methods§

source

fn handle(&mut self, event: &Event, qualifier: Qualifier) -> R

Handle an event.

  • self - Should be the widget state.

  • event - Event

  • qualifier - Allows specifying/restricting the behaviour of the event-handler.

    This library defines two possible types:

    • FocusKeys - The event-handler does all the interactions for a focused widget. This calls the event-handler for MouseOnly too.
    • MouseOnly - Interactions for a non-focused widget. Mostly only reacting to mouse-events. But might check for hotkeys or the like.

Further ideas:

  • ReadOnly
  • Additional special behaviour like DoubleClick, HotKeyAlt, HotKeyCtrl.
  • Opt-in behaviour like different key-bindings.
  • Configurable key-map.
  • Other context or configuration parameters.

Implementations on Foreign Types§

source§

impl HandleEvent<Event, MouseOnly, Outcome> for ViewState

source§

fn handle(&mut self, event: &Event, _qualifier: MouseOnly) -> Outcome

source§

impl HandleEvent<Event, MouseOnly, ScrollOutcome> for ScrollState

source§

fn handle(&mut self, event: &Event, _qualifier: MouseOnly) -> ScrollOutcome

source§

impl<'a> HandleEvent<Event, FocusKeys, Outcome> for Focus<'a>

source§

fn handle(&mut self, event: &Event, _keymap: FocusKeys) -> Outcome

source§

impl<'a> HandleEvent<Event, MouseOnly, Outcome> for Focus<'a>

source§

fn handle(&mut self, event: &Event, _keymap: MouseOnly) -> Outcome

source§

impl<'a> HandleEvent<Event, MouseOnly, ScrollOutcome> for ScrollArea<'a>

Handle scrolling for the whole area spanned by the two scroll-states.

source§

fn handle(&mut self, event: &Event, _qualifier: MouseOnly) -> ScrollOutcome

source§

impl<R, Q, S> HandleEvent<Event, Q, R> for ViewportState<S>
where S: HandleEvent<Event, Q, R>, R: From<Outcome> + ConsumedEvent + Debug,

source§

fn handle(&mut self, event: &Event, qualifier: Q) -> R

Implementors§