pub struct KeyEventArgs {
pub key: Key,
pub key_modifiers: KeyModifiers,
pub physical_key: PhysicalKey,
pub key_symbol: Option<String>,
pub key_device_type: KeyDeviceType,
/* private fields */
}Expand description
Provides information specific to a keyboard event.
Fields§
§key: KeyThe virtual-key for the associated event.
A given physical key can result in different virtual keys depending
on the current keyboard layout. This is the key that is generally
referred to when creating keyboard shortcuts. For example, when
pressing the key located at the Z position on standard US English
QWERTY keyboard, this property returns:
Key::Zfor an English (QWERTY) layoutKey::Wfor a French (AZERTY) layoutKey::Yfor a German (QWERTZ) layoutKey::Zfor a Russian (JCUKEN) layout
key_modifiers: KeyModifiersThe key modifiers for the associated event.
physical_key: PhysicalKeyThe physical key for the associated event.
This value is independent of the current keyboard layout and usually corresponds to the key printed on a standard US English QWERTY keyboard. This is the key to use for position-dependent bindings such as WASD movement in games.
key_symbol: Option<String>The unicode symbol of the key, or None if none is applicable.
For example, when pressing the key located at the Z position on
standard US English QWERTY keyboard, this property returns:
zfor an English (QWERTY) layoutwfor a French (AZERTY) layoutyfor a German (QWERTZ) layoutяfor a Russian (JCUKEN) layout
key_device_type: KeyDeviceTypeThe type of key device that sent this event.
Implementations§
Source§impl KeyEventArgs
impl KeyEventArgs
Methods from Deref<Target = RoutedEventArgs>§
Sourcepub fn handled(&self) -> bool
pub fn handled(&self) -> bool
Whether the routed event has already been handled.
Once handled, the event keeps travelling along its route but is only delivered to handlers registered for handled events too.
Sourcepub fn set_handled(&self, value: bool)
pub fn set_handled(&self, value: bool)
Marks the routed event as handled or unhandled.
Sourcepub fn routed_event(&self) -> Option<RoutedEvent>
pub fn routed_event(&self) -> Option<RoutedEvent>
The routed event associated with these args.
Sourcepub fn set_routed_event<T: ?Sized>(&self, value: Option<&RoutedEvent<T>>)
pub fn set_routed_event<T: ?Sized>(&self, value: Option<&RoutedEvent<T>>)
Sets the routed event associated with these args.
Sourcepub fn route(&self) -> RoutingStrategies
pub fn route(&self) -> RoutingStrategies
The routing strategy currently being applied to the event.
Sourcepub fn set_route(&self, value: RoutingStrategies)
pub fn set_route(&self, value: RoutingStrategies)
Sets the routing strategy currently being applied to the event.
Sourcepub fn source(&self) -> Option<Ref<FerroObject>>
pub fn source(&self) -> Option<Ref<FerroObject>>
The object that raised the event.
Sourcepub fn set_source(&self, value: impl Into<Nullable<FerroObject>>)
pub fn set_source(&self, value: impl Into<Nullable<FerroObject>>)
Sets the object that raised the event.
Sourcepub fn is_source(&self, object: &FerroObject) -> bool
pub fn is_source(&self, object: &FerroObject) -> bool
Whether object is the source of the event (C# e.Source == object).
Trait Implementations§
Source§impl Clone for KeyEventArgs
impl Clone for KeyEventArgs
Source§impl Default for KeyEventArgs
impl Default for KeyEventArgs
Source§impl Deref for KeyEventArgs
impl Deref for KeyEventArgs
Source§type Target = RoutedEventArgs
type Target = RoutedEventArgs
Source§fn deref(&self) -> &RoutedEventArgs
fn deref(&self) -> &RoutedEventArgs
Source§impl IKeyModifiersEventArgs for KeyEventArgs
impl IKeyModifiersEventArgs for KeyEventArgs
Source§fn key_modifiers(&self) -> KeyModifiers
fn key_modifiers(&self) -> KeyModifiers
Source§impl IRoutedEventArgs for KeyEventArgs
impl IRoutedEventArgs for KeyEventArgs
Source§fn as_routed_event_args(&self) -> &RoutedEventArgs
fn as_routed_event_args(&self) -> &RoutedEventArgs
Source§fn query_args(&self, type_id: TypeId) -> Option<&dyn Any>
fn query_args(&self, type_id: TypeId) -> Option<&dyn Any>
type_id, if
the args are of that type or of a type derived from it.Source§fn is_args_type(type_id: TypeId) -> bool
fn is_args_type(type_id: TypeId) -> bool
type_id or is
derived from it.handled, the source, a cancel flag, ..) is shared with them.Source§impl MarkupTyped for KeyEventArgs
impl MarkupTyped for KeyEventArgs
Source§const MARKUP: &'static MarkupType
const MARKUP: &'static MarkupType
Auto Trait Implementations§
impl !RefUnwindSafe for KeyEventArgs
impl !Send for KeyEventArgs
impl !Sync for KeyEventArgs
impl !UnwindSafe for KeyEventArgs
impl Freeze for KeyEventArgs
impl Unpin for KeyEventArgs
impl UnsafeUnpin for KeyEventArgs
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> ClassDefaults for Twhere
T: ?Sized,
impl<T> ClassDefaults for Twhere
T: ?Sized,
Source§fn static_constructor()
fn static_constructor()
affects_render, metadata
overrides). Read more