Trait rat_widget::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§
sourcefn handle(&mut self, event: &Event, qualifier: Qualifier) -> R
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.
Implementors§
impl HandleEvent<Event, ConvenientKeys, TextOutcome> for DateInputState
impl HandleEvent<Event, Dialog, Outcome> for MsgDialogState
impl HandleEvent<Event, FocusKeys, ButtonOutcome> for ButtonState
impl HandleEvent<Event, FocusKeys, MenuOutcome> for MenuBarState
impl HandleEvent<Event, FocusKeys, MenuOutcome> for MenuLineState
impl HandleEvent<Event, FocusKeys, Outcome> for RListState<NoSelection>
impl HandleEvent<Event, FocusKeys, Outcome> for RListState<RowSelection>
impl HandleEvent<Event, FocusKeys, Outcome> for RListState<RowSetSelection>
impl HandleEvent<Event, FocusKeys, Outcome> for FTableState<CellSelection>
impl HandleEvent<Event, FocusKeys, Outcome> for FTableState<NoSelection>
impl HandleEvent<Event, FocusKeys, Outcome> for FTableState<RowSelection>
impl HandleEvent<Event, FocusKeys, Outcome> for FTableState<RowSetSelection>
impl HandleEvent<Event, FocusKeys, TextOutcome> for DateInputState
impl HandleEvent<Event, FocusKeys, TextOutcome> for TextInputState
impl HandleEvent<Event, FocusKeys, TextOutcome> for MaskedInputState
impl HandleEvent<Event, FocusKeys, TextOutcome> for NumberInputState
impl HandleEvent<Event, FocusKeys, TextOutcome> for TextAreaState
impl HandleEvent<Event, MouseOnly, ButtonOutcome> for ButtonState
impl HandleEvent<Event, MouseOnly, MenuOutcome> for MenuBarState
impl HandleEvent<Event, MouseOnly, MenuOutcome> for MenuLineState
impl HandleEvent<Event, MouseOnly, MenuOutcome> for PopupMenuState
impl HandleEvent<Event, MouseOnly, Outcome> for RListState<NoSelection>
impl HandleEvent<Event, MouseOnly, Outcome> for RListState<RowSelection>
impl HandleEvent<Event, MouseOnly, Outcome> for RListState<RowSetSelection>
impl HandleEvent<Event, MouseOnly, Outcome> for ViewState
impl HandleEvent<Event, MouseOnly, Outcome> for FTableState<CellSelection>
impl HandleEvent<Event, MouseOnly, Outcome> for FTableState<NoSelection>
impl HandleEvent<Event, MouseOnly, Outcome> for FTableState<RowSelection>
impl HandleEvent<Event, MouseOnly, Outcome> for FTableState<RowSetSelection>
impl HandleEvent<Event, MouseOnly, ScrollOutcome> for ScrollState
impl HandleEvent<Event, MouseOnly, TextOutcome> for DateInputState
impl HandleEvent<Event, MouseOnly, TextOutcome> for TextInputState
impl HandleEvent<Event, MouseOnly, TextOutcome> for MaskedInputState
impl HandleEvent<Event, MouseOnly, TextOutcome> for NumberInputState
impl HandleEvent<Event, MouseOnly, TextOutcome> for TextAreaState
impl HandleEvent<Event, Popup, MenuOutcome> for MenuBarState
impl HandleEvent<Event, Popup, MenuOutcome> for PopupMenuState
impl HandleEvent<Event, ReadOnly, TextOutcome> for DateInputState
impl HandleEvent<Event, ReadOnly, TextOutcome> for TextInputState
impl HandleEvent<Event, ReadOnly, TextOutcome> for MaskedInputState
impl HandleEvent<Event, ReadOnly, TextOutcome> for NumberInputState
impl HandleEvent<Event, ReadOnly, TextOutcome> for TextAreaState
impl<'a> HandleEvent<Event, FocusKeys, Outcome> for Focus<'a>
impl<'a> HandleEvent<Event, MouseOnly, Outcome> for Focus<'a>
impl<'a> HandleEvent<Event, MouseOnly, ScrollOutcome> for ScrollArea<'a>
Handle scrolling for the whole area spanned by the two scroll-states.