[−][src]Enum kas::event::Event
Events addressed to a widget
Variants (Non-exhaustive)
No event
Widget activation, for example clicking a button or toggling a check-box
Navigation key input
This is received when the widget has key-navigation focus. Note that
the Enter/Return/Space keys are not a NavKey
but instead trigger
Event::Activate
(depending on context).
Widget lost keyboard input focus
ReceivedCharacter(char)
Widget receives a character of text input
Scroll(ScrollDelta)
A mouse or touchpad scroll event
A mouse or touch-screen move/zoom/rotate event
Mouse-grabs generate translation (delta
component) only. Touch grabs
optionally also generate rotation and scaling components, depending on
the GrabMode
.
In general, a point p
on the screen should be transformed as follows:
// Works for Coord type; for DVec2 type-conversions are unnecessary: p = (alpha.complex_mul(p.into()) + delta).into();
When it is known that there is no rotational component, one can use a
simpler transformation: alpha.0 * p + delta
. When there is also no
scaling component, we just have a translation: p + delta
.
Note however that if events are generated with rotation and/or scaling
components, these simplifications are invalid.
Two such transforms may be combined as follows:
let alpha = alpha2.complex_mul(alpha1); let delta = alpha2.complex_mul(delta1) + delta2;
If instead one uses a transform to map screen-space to world-space, this transform should be adjusted as follows:
world_alpha = world_alpha.complex_div(alpha.into()); world_delta = world_delta - world_alpha.complex_mul(delta.into());
Those familiar with complex numbers may recognise that
alpha = a * e^{i*t}
where a
is the scale component and t
is the
angle of rotation. Calculate these components as follows:
let a = (alpha.0 * alpha.0 + alpha.1 * alpha.1).sqrt(); let t = (alpha.1).atan2(alpha.0);
A mouse button was pressed or touch event started
Fields of PressStart
Movement of mouse or a touch press
Received only given a press grab.
Fields of PressMove
End of a click/touch press
Received only given a press grab.
When end_id == None
, this is a "cancelled press": the end of the press
is outside the application window.
Fields of PressEnd
Update from a timer
This event is received after requesting timed wake-up(s)
(see Manager::update_on_timer
).
Update triggerred via an UpdateHandle
This event may be received after registering an UpdateHandle
via
Manager::update_on_handle
.
A user-defined payload is passed. Interpretation of this payload is user-defined and unfortunately not type safe.
Fields of HandleUpdate
handle: UpdateHandle
payload: u64
NewPopup(WidgetId)
Notification that a new popup has been created
This is sent to the parent of each open popup when a new popup is
created. This enables parents to close their popups when the new popup
is not a descendant of itself. The WidgetId
is that of the popup.
PopupRemoved(WindowId)
Notification that a popup has been destroyed
This is sent to the popup's parent after a popup has been removed. Since popups may be removed directly by the Manager, the parent should clean up any associated state here.
Sent when a widget receives keyboard navigation focus
The widget should reply with Response::Focus
.
Trait Implementations
impl Clone for Event
[src]
impl Debug for Event
[src]
impl PartialEq<Event> for Event
[src]
impl StructuralPartialEq for Event
[src]
Auto Trait Implementations
impl RefUnwindSafe for Event
impl Send for Event
impl Sync for Event
impl Unpin for Event
impl UnwindSafe for Event
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<Src, Scheme> ApproxFrom<Src, Scheme> for Src where
Scheme: ApproxScheme,
[src]
Scheme: ApproxScheme,
type Err = NoError
The error type produced by a failed conversion.
fn approx_from(src: Src) -> Result<Src, <Src as ApproxFrom<Src, Scheme>>::Err>
[src]
impl<Dst, Src, Scheme> ApproxInto<Dst, Scheme> for Src where
Dst: ApproxFrom<Src, Scheme>,
Scheme: ApproxScheme,
[src]
Dst: ApproxFrom<Src, Scheme>,
Scheme: ApproxScheme,
type Err = <Dst as ApproxFrom<Src, Scheme>>::Err
The error type produced by a failed conversion.
fn approx_into(self) -> Result<Dst, <Src as ApproxInto<Dst, Scheme>>::Err>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, Dst> ConvAsUtil<Dst> for T
[src]
fn approx(self) -> Result<Dst, Self::Err> where
Self: ApproxInto<Dst, DefaultApprox>,
[src]
Self: ApproxInto<Dst, DefaultApprox>,
fn approx_by<Scheme>(self) -> Result<Dst, Self::Err> where
Scheme: ApproxScheme,
Self: ApproxInto<Dst, Scheme>,
[src]
Scheme: ApproxScheme,
Self: ApproxInto<Dst, Scheme>,
impl<T> ConvUtil for T
[src]
fn approx_as<Dst>(self) -> Result<Dst, Self::Err> where
Self: ApproxInto<Dst, DefaultApprox>,
[src]
Self: ApproxInto<Dst, DefaultApprox>,
fn approx_as_by<Dst, Scheme>(self) -> Result<Dst, Self::Err> where
Scheme: ApproxScheme,
Self: ApproxInto<Dst, Scheme>,
[src]
Scheme: ApproxScheme,
Self: ApproxInto<Dst, Scheme>,
fn into_as<Dst>(self) -> Dst where
Self: Into<Dst>,
[src]
Self: Into<Dst>,
fn try_as<Dst>(self) -> Result<Dst, Self::Err> where
Self: TryInto<Dst>,
[src]
Self: TryInto<Dst>,
fn value_as<Dst>(self) -> Result<Dst, Self::Err> where
Self: ValueInto<Dst>,
[src]
Self: ValueInto<Dst>,
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<Src> TryFrom<Src> for Src
[src]
type Err = NoError
The error type produced by a failed conversion.
fn try_from(src: Src) -> Result<Src, <Src as TryFrom<Src>>::Err>
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<Src, Dst> TryInto<Dst> for Src where
Dst: TryFrom<Src>,
[src]
Dst: TryFrom<Src>,
type Err = <Dst as TryFrom<Src>>::Err
The error type produced by a failed conversion.
fn try_into(self) -> Result<Dst, <Src as TryInto<Dst>>::Err>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<Src> ValueFrom<Src> for Src
[src]
type Err = NoError
The error type produced by a failed conversion.
fn value_from(src: Src) -> Result<Src, <Src as ValueFrom<Src>>::Err>
[src]
impl<Src, Dst> ValueInto<Dst> for Src where
Dst: ValueFrom<Src>,
[src]
Dst: ValueFrom<Src>,