[−][src]Trait kas::event::Handler
Event handling for a Widget
This trait is part of the Widget
family and is derived by
derive(Widget)
unless #[handler(handle = noauto)]
or #[handler(noauto)]
is used.
Interactive widgets should implement their event-handling logic here
(although it is also possible to implement this in SendEvent::send
,
which might be preferable when dealing with child widgets).
The default implementation does nothing, and is derived by derive(Widget)
when a #[handler]
attribute is present (except with parameter
handler=noauto
).
Associated Types
type Msg
[src]
Type of message returned by this widget
This mechanism allows type-safe handling of user-defined responses to handled actions, for example an enum encoding button presses or a floating-point value from a slider.
The VoidMsg
type may be used where messages are never generated.
This is distinct from ()
, which might be applicable when a widget only
needs to "wake up" a parent.
Provided methods
pub fn activation_via_press(&self) -> bool
[src]
Generic handler: translate presses to activations
This is configuration for Manager::handle_generic
, and can be used
to translate press (click/touch) events into Event::Activate
.
pub fn handle(
&mut self,
_: &mut Manager<'_>,
event: Event
) -> Response<Self::Msg>
[src]
&mut self,
_: &mut Manager<'_>,
event: Event
) -> Response<Self::Msg>
Handle an event and return a user-defined message
Widgets should handle any events applicable to themselves here, and
return all other events via Response::Unhandled
.
Implementations on Foreign Types
impl<M: 'static> Handler for Box<dyn Widget<Msg = M>>
[src]
type Msg = M
pub fn activation_via_press(&self) -> bool
[src]
pub fn handle(
&mut self,
mgr: &mut Manager<'_>,
event: Event
) -> Response<Self::Msg>
[src]
&mut self,
mgr: &mut Manager<'_>,
event: Event
) -> Response<Self::Msg>
impl<M: 'static> Handler for Box<dyn Menu<Msg = M>>
[src]
type Msg = M
pub fn activation_via_press(&self) -> bool
[src]
pub fn handle(
&mut self,
mgr: &mut Manager<'_>,
event: Event
) -> Response<Self::Msg>
[src]
&mut self,
mgr: &mut Manager<'_>,
event: Event
) -> Response<Self::Msg>
Implementors
impl Handler for DragHandle
[src]
type Msg = Coord
pub fn handle(
&mut self,
mgr: &mut Manager<'_>,
event: Event
) -> Response<Self::Msg>
[src]
&mut self,
mgr: &mut Manager<'_>,
event: Event
) -> Response<Self::Msg>
impl Handler for Filler
[src]
impl<D: Directional> Handler for ScrollBar<D>
[src]
impl<D: Directional, M, W: Menu<Msg = M>> Handler for SubMenu<D, W>
[src]
impl<D: Directional, W: Widget> Handler for List<D, W>
[src]
impl<D: Directional, W: Widget> Handler for Splitter<D, W>
[src]
impl<D: Directional, W: Menu<Msg = M>, M> Handler for MenuBar<D, W>
[src]
type Msg = M
pub fn handle(
&mut self,
mgr: &mut Manager<'_>,
event: Event
) -> Response<Self::Msg>
[src]
&mut self,
mgr: &mut Manager<'_>,
event: Event
) -> Response<Self::Msg>
impl<G: EditGuard + 'static> Handler for EditBox<G>
[src]
type Msg = G::Msg
pub fn handle(
&mut self,
mgr: &mut Manager<'_>,
event: Event
) -> Response<Self::Msg>
[src]
&mut self,
mgr: &mut Manager<'_>,
event: Event
) -> Response<Self::Msg>
impl<M: 'static> Handler for CheckBox<M> where
M: From<VoidMsg>,
[src]
M: From<VoidMsg>,
type Msg = M
impl<M: 'static> Handler for CheckBoxBare<M>
[src]
type Msg = M
pub fn activation_via_press(&self) -> bool
[src]
pub fn handle(&mut self, mgr: &mut Manager<'_>, event: Event) -> Response<M>
[src]
impl<M: 'static> Handler for MenuToggle<M> where
M: From<VoidMsg>,
[src]
M: From<VoidMsg>,
type Msg = M
impl<M: 'static> Handler for RadioBox<M> where
M: From<VoidMsg>,
[src]
M: From<VoidMsg>,
type Msg = M
impl<M: 'static> Handler for RadioBoxBare<M>
[src]
type Msg = M
pub fn activation_via_press(&self) -> bool
[src]
pub fn handle(&mut self, mgr: &mut Manager<'_>, event: Event) -> Response<M>
[src]
impl<M: Clone + Debug + 'static> Handler for ComboBox<M>
[src]
impl<M: Clone + Debug + 'static> Handler for MenuEntry<M>
[src]
impl<M: Clone + Debug + 'static> Handler for TextButton<M>
[src]
type Msg = M
pub fn activation_via_press(&self) -> bool
[src]
pub fn handle(&mut self, _: &mut Manager<'_>, event: Event) -> Response<M>
[src]
impl<M: Debug + 'static> Handler for Separator<M>
[src]
type Msg = M
impl<T: FormattableText + 'static> Handler for Label<T>
[src]
impl<T: FormattableText + 'static> Handler for MessageBox<T>
[src]
impl<T: SliderType, D: Directional> Handler for Slider<T, D>
[src]
type Msg = T
impl<W: Widget + 'static> Handler for Window<W> where
W: Widget<Msg = VoidMsg>,
[src]
W: Widget<Msg = VoidMsg>,