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.
Implementations on Foreign Types§
source§impl HandleEvent<Event, HotKeyAlt, MenuOutcome> for MenuLineState
impl HandleEvent<Event, HotKeyAlt, MenuOutcome> for MenuLineState
source§impl HandleEvent<Event, HotKeyCtrl, MenuOutcome> for MenuLineState
impl HandleEvent<Event, HotKeyCtrl, MenuOutcome> for MenuLineState
fn handle(&mut self, event: &Event, _: HotKeyCtrl) -> MenuOutcome
source§impl HandleEvent<Event, ConvenientKeys, TextOutcome> for DateInputState
impl HandleEvent<Event, ConvenientKeys, TextOutcome> for DateInputState
fn handle(&mut self, event: &Event, _keymap: ConvenientKeys) -> TextOutcome
source§impl HandleEvent<Event, FocusKeys, ButtonOutcome> for ButtonState
impl HandleEvent<Event, FocusKeys, ButtonOutcome> for ButtonState
source§impl HandleEvent<Event, FocusKeys, MenuOutcome> for MenuLineState
impl HandleEvent<Event, FocusKeys, MenuOutcome> for MenuLineState
source§impl HandleEvent<Event, FocusKeys, TextOutcome> for DateInputState
impl HandleEvent<Event, FocusKeys, TextOutcome> for DateInputState
source§impl HandleEvent<Event, FocusKeys, TextOutcome> for TextInputState
impl HandleEvent<Event, FocusKeys, TextOutcome> for TextInputState
source§impl HandleEvent<Event, FocusKeys, TextOutcome> for MaskedInputState
impl HandleEvent<Event, FocusKeys, TextOutcome> for MaskedInputState
source§impl HandleEvent<Event, FocusKeys, TextOutcome> for NumberInputState
impl HandleEvent<Event, FocusKeys, TextOutcome> for NumberInputState
source§impl HandleEvent<Event, FocusKeys, TextOutcome> for TextAreaState
impl HandleEvent<Event, FocusKeys, TextOutcome> for TextAreaState
source§impl HandleEvent<Event, MouseOnly, ButtonOutcome> for ButtonState
impl HandleEvent<Event, MouseOnly, ButtonOutcome> for ButtonState
source§impl HandleEvent<Event, MouseOnly, MenuOutcome> for MenuLineState
impl HandleEvent<Event, MouseOnly, MenuOutcome> for MenuLineState
source§impl HandleEvent<Event, MouseOnly, TextOutcome> for DateInputState
impl HandleEvent<Event, MouseOnly, TextOutcome> for DateInputState
source§impl HandleEvent<Event, MouseOnly, TextOutcome> for TextInputState
impl HandleEvent<Event, MouseOnly, TextOutcome> for TextInputState
source§impl HandleEvent<Event, MouseOnly, TextOutcome> for MaskedInputState
impl HandleEvent<Event, MouseOnly, TextOutcome> for MaskedInputState
source§impl HandleEvent<Event, MouseOnly, TextOutcome> for NumberInputState
impl HandleEvent<Event, MouseOnly, TextOutcome> for NumberInputState
source§impl HandleEvent<Event, MouseOnly, TextOutcome> for TextAreaState
impl HandleEvent<Event, MouseOnly, TextOutcome> for TextAreaState
source§impl HandleEvent<Event, ReadOnly, TextOutcome> for DateInputState
impl HandleEvent<Event, ReadOnly, TextOutcome> for DateInputState
source§impl HandleEvent<Event, ReadOnly, TextOutcome> for TextInputState
impl HandleEvent<Event, ReadOnly, TextOutcome> for TextInputState
source§impl HandleEvent<Event, ReadOnly, TextOutcome> for MaskedInputState
impl HandleEvent<Event, ReadOnly, TextOutcome> for MaskedInputState
source§impl HandleEvent<Event, ReadOnly, TextOutcome> for NumberInputState
impl HandleEvent<Event, ReadOnly, TextOutcome> for NumberInputState
source§impl HandleEvent<Event, ReadOnly, TextOutcome> for TextAreaState
impl HandleEvent<Event, ReadOnly, TextOutcome> for TextAreaState
source§impl<EState, EQualifier> HandleEvent<Event, EQualifier, EditOutcome> for FEditTableState<EState>
impl<EState, EQualifier> HandleEvent<Event, EQualifier, EditOutcome> for FEditTableState<EState>
fn handle(&mut self, event: &Event, qualifier: EQualifier) -> EditOutcome
Implementors§
impl HandleEvent<Event, HotKeyAlt, MenuOutcome> for RMenuLineState
impl HandleEvent<Event, HotKeyCtrl, MenuOutcome> for RMenuLineState
impl HandleEvent<Event, ConvenientKeys, TextOutcome> for RDateInputState
impl HandleEvent<Event, FocusKeys, ButtonOutcome> for RButtonState
impl HandleEvent<Event, FocusKeys, MenuOutcome> for RMenuLineState
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, 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 MsgDialogState
impl HandleEvent<Event, FocusKeys, Outcome> for RTableState<CellSelection>
impl HandleEvent<Event, FocusKeys, Outcome> for RTableState<NoSelection>
impl HandleEvent<Event, FocusKeys, Outcome> for RTableState<RowSelection>
impl HandleEvent<Event, FocusKeys, Outcome> for RTableState<RowSetSelection>
impl HandleEvent<Event, FocusKeys, TextOutcome> for RDateInputState
impl HandleEvent<Event, FocusKeys, TextOutcome> for RTextInputState
impl HandleEvent<Event, FocusKeys, TextOutcome> for RMaskedInputState
impl HandleEvent<Event, FocusKeys, TextOutcome> for RNumberInputState
impl HandleEvent<Event, FocusKeys, TextOutcome> for RTextAreaState
impl HandleEvent<Event, MouseOnly, ButtonOutcome> for RButtonState
impl HandleEvent<Event, MouseOnly, MenuOutcome> for RMenuLineState
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, 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 RTableState<CellSelection>
impl HandleEvent<Event, MouseOnly, Outcome> for RTableState<NoSelection>
impl HandleEvent<Event, MouseOnly, Outcome> for RTableState<RowSelection>
impl HandleEvent<Event, MouseOnly, Outcome> for RTableState<RowSetSelection>
impl HandleEvent<Event, MouseOnly, TextOutcome> for RDateInputState
impl HandleEvent<Event, MouseOnly, TextOutcome> for RTextInputState
impl HandleEvent<Event, MouseOnly, TextOutcome> for RMaskedInputState
impl HandleEvent<Event, MouseOnly, TextOutcome> for RNumberInputState
impl HandleEvent<Event, MouseOnly, TextOutcome> for RTextAreaState
impl HandleEvent<Event, ReadOnly, TextOutcome> for RDateInputState
impl HandleEvent<Event, ReadOnly, TextOutcome> for RTextInputState
impl HandleEvent<Event, ReadOnly, TextOutcome> for RMaskedInputState
impl HandleEvent<Event, ReadOnly, TextOutcome> for RNumberInputState
impl HandleEvent<Event, ReadOnly, TextOutcome> for RTextAreaState
impl<'a> HandleEvent<Event, FocusKeys, Outcome> for Focus<'a>
impl<'a> HandleEvent<Event, MouseOnly, Outcome> for Focus<'a>
impl<EState, EQualifier> HandleEvent<Event, EQualifier, EditOutcome> for REditTableState<EState>
impl<R> HandleEvent<Event, FocusKeys, ScrollOutcome<R>> for ViewStatewhere
R: ConsumedEvent,
Handle all events. Text events are only processed if focus is true. Mouse events are processed if they are in range.
impl<R> HandleEvent<Event, MouseOnly, ScrollOutcome<R>> for ViewStatewhere
R: ConsumedEvent,
Handle only mouse-events.
impl<R, S> HandleEvent<Event, FocusKeys, ScrollOutcome<R>> for ViewportState<S>
Handle events if the widget has the focus.
impl<R, S> HandleEvent<Event, MouseOnly, ScrollOutcome<R>> for ViewportState<S>
Handle only mouse-events.
impl<R, WState> HandleEvent<Event, FocusKeys, ScrollOutcome<R>> for ScrolledState<WState>where
WState: ScrollingState + HandleEvent<Event, FocusKeys, R> + HandleEvent<Event, MouseOnly, R>,
R: ConsumedEvent,
Handle events or the scrolled widget and forward to the inner widget.
impl<R, WState> HandleEvent<Event, MouseOnly, ScrollOutcome<R>> for ScrolledState<WState>
Handle events for the Scrolled widget and the scrollbars.
impl<Selection> HandleEvent<Event, DoubleClick, DoubleClickOutcome> for FTableState<Selection>
impl<Selection> HandleEvent<Event, DoubleClick, DoubleClickOutcome> for RTableState<Selection>
impl<Selection> HandleEvent<Event, EditKeys, EditOutcome> for FTableState<Selection>
impl<Selection> HandleEvent<Event, EditKeys, EditOutcome> for RTableState<Selection>where
FTableState<Selection>: HandleEvent<Event, MouseOnly, Outcome> + HandleEvent<Event, FocusKeys, Outcome> + HandleEvent<Event, EditKeys, EditOutcome>,
impl<WState, Q, R> HandleEvent<Event, Inner<Q>, ScrollOutcome<R>> for ScrolledState<WState>
Forward event-handling to the inner widget.