pub struct KeyMods {
pub shift: bool,
pub ctrl: bool,
pub alt: bool,
pub super_key: bool,
}Expand description
Physical modifier state. Unlike Mods — which abstracts platform
conventions for the input widget (word, doc) — nothing here is
normalized: an app binding Ctrl-w needs to know it was Control and not
Command.
Fields§
§shift: bool§ctrl: bool§alt: bool§super_key: boolWindows key / Command / Super.
Implementations§
Source§impl KeyMods
impl KeyMods
Sourcepub const SHIFT: u32
pub const SHIFT: u32
Bit 0 Shift, 1 Ctrl, 2 Alt, 3 Super — the order the fields are
declared in, and the C header’s KUI_KMOD_* (pinned there). What
a wire that carries the state as one integer spells it as: the
conformance corpus’s modifiers step, the C input door.
pub const CTRL: u32
pub const ALT: u32
pub const SUPER: u32
Sourcepub const NONE: KeyMods
pub const NONE: KeyMods
No modifier held: what the with_* steps start from —
KeyMods::NONE.with_shift().with_ctrl().
pub const fn with_shift(self) -> KeyMods
pub const fn with_ctrl(self) -> KeyMods
pub const fn with_alt(self) -> KeyMods
pub const fn with_super(self) -> KeyMods
Sourcepub const fn with_primary(self) -> KeyMods
pub const fn with_primary(self) -> KeyMods
The platform primary shortcut modifier held: Command on macOS,
Control elsewhere — the one Self::primary reads.
pub fn from_bits(bits: u32) -> KeyMods
pub fn bits(self) -> u32
pub fn any(self) -> bool
Sourcepub fn parse(names: &str) -> KeyMods
pub fn parse(names: &str) -> KeyMods
From the schema’s spelling (the scrollMods row): names separated
by spaces or commas — "ctrl", "ctrl super", "shift, alt". A
word that is none of the four is skipped, so a string of none of
them names nothing.
Sourcepub fn to_fields(self) -> Value
pub fn to_fields(self) -> Value
{shift=, ctrl=, alt=, super=}: the state as an event carries it
under a field of its own (a scroll event’s mods).
Trait Implementations§
impl Copy for KeyMods
impl Eq for KeyMods
impl StructuralPartialEq for KeyMods
Auto Trait Implementations§
impl Freeze for KeyMods
impl RefUnwindSafe for KeyMods
impl Send for KeyMods
impl Sync for KeyMods
impl Unpin for KeyMods
impl UnsafeUnpin for KeyMods
impl UnwindSafe for KeyMods
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
impl<S, T> Duplex<S> for Twhere
T: FromSample<S> + ToSample<S>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.