pub struct KeyGesture { /* private fields */ }Expand description
Defines a keyboard input combination.
Implementations§
Source§impl KeyGesture
impl KeyGesture
Sourcepub const fn new(key: Key, modifiers: KeyModifiers) -> Self
pub const fn new(key: Key, modifiers: KeyModifiers) -> Self
Creates a gesture for a key with modifiers.
Sourcepub const fn key_modifiers(&self) -> KeyModifiers
pub const fn key_modifiers(&self) -> KeyModifiers
The modifier keys of the gesture.
Sourcepub fn parse(gesture: &str) -> Result<KeyGesture, ParseKeyModifiersError>
pub fn parse(gesture: &str) -> Result<KeyGesture, ParseKeyModifiersError>
Parses a gesture such as Ctrl+Shift+A.
Parts are separated by +. The last part that names a key decides
the key (+, -, . and , name the corresponding OEM keys);
every other part must be a modifier: Ctrl/Control, Shift,
Alt, Meta/Cmd/Win/⌘.
Sourcepub fn matches(&self, key_event: Option<&KeyEventArgs>) -> bool
pub fn matches(&self, key_event: Option<&KeyEventArgs>) -> bool
Whether a key event matches the gesture: same modifiers and the same key, where the numpad operation keys match their regular counterparts.
Source§impl KeyGesture
impl KeyGesture
Sourcepub fn to_platform_string(
&self,
format_provider: Option<Rc<KeyGestureFormatInfo>>,
) -> String
pub fn to_platform_string( &self, format_provider: Option<Rc<KeyGestureFormatInfo>>, ) -> String
Formats the gesture with the platform’s names for keys and
modifiers (the p format): the given format info, or the one
registered with the locator, or the invariant one.
Sourcepub fn to_string_format(
&self,
format: Option<&str>,
format_provider: Option<Rc<KeyGestureFormatInfo>>,
) -> Result<String, FormatError>
pub fn to_string_format( &self, format: Option<&str>, format_provider: Option<Rc<KeyGestureFormatInfo>>, ) -> Result<String, FormatError>
Returns the gesture as a string formatted according to the format string and the format provider.
The format is None, an empty string or "g" for the invariant format, or "p"
for the platform specific format: the given format info, or the one registered with
the locator, or the invariant one.
Fails with a FormatError if the format string is anything else.
Sourcepub fn format_with(&self, format_info: &KeyGestureFormatInfo) -> String
pub fn format_with(&self, format_info: &KeyGestureFormatInfo) -> String
Formats the gesture with the given format info.
Trait Implementations§
Source§impl Clone for KeyGesture
impl Clone for KeyGesture
impl Copy for KeyGesture
Source§impl Debug for KeyGesture
impl Debug for KeyGesture
Source§impl Display for KeyGesture
Formats the gesture in the invariant format, e.g. Ctrl+Shift+A.
impl Display for KeyGesture
Formats the gesture in the invariant format, e.g. Ctrl+Shift+A.
impl Eq for KeyGesture
Source§impl FromStr for KeyGesture
impl FromStr for KeyGesture
Source§impl Hash for KeyGesture
impl Hash for KeyGesture
Source§impl MarkupTyped for KeyGesture
impl MarkupTyped for KeyGesture
Source§const MARKUP: &'static MarkupType
const MARKUP: &'static MarkupType
Source§impl PartialEq for KeyGesture
impl PartialEq for KeyGesture
impl StructuralPartialEq for KeyGesture
Auto Trait Implementations§
impl Freeze for KeyGesture
impl RefUnwindSafe for KeyGesture
impl Send for KeyGesture
impl Sync for KeyGesture
impl Unpin for KeyGesture
impl UnsafeUnpin for KeyGesture
impl UnwindSafe for KeyGesture
Blanket Implementations§
Source§impl<T> AnyValue for Twhere
T: PartialEq + 'static,
impl<T> AnyValue for Twhere
T: PartialEq + 'static,
fn any_value_as_any(&self) -> &(dyn Any + 'static)
fn any_value_eq(&self, other: &(dyn AnyValue + 'static)) -> bool
fn any_value_type_name(&self) -> &'static str
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