pub trait ModifiersExt {
// Required methods
fn primary(&self) -> bool;
fn only_primary(&self) -> bool;
fn only_shift(&self) -> bool;
fn only_control(&self) -> bool;
fn only_alt(&self) -> bool;
fn only_super(&self) -> bool;
fn word_select(&self) -> bool;
fn possible_shortcut(&self) -> bool;
}
Expand description
Helper functions for [Modifiers
] and [ModifiersState
].
Required Methods§
sourcefn primary(&self) -> bool
fn primary(&self) -> bool
Returns true if the current state includes the platform’s primary shortcut key.
For Apple based platforms, this returns true if a “super” modifier is pressed. This corresponds to the Apple/Command key.
For all other platforms, this returns true if a control key is pressed.
sourcefn only_primary(&self) -> bool
fn only_primary(&self) -> bool
Returns true if only the primary modifier key is pressed.
sourcefn only_shift(&self) -> bool
fn only_shift(&self) -> bool
Returns true if only a shift modifier key is pressed.
sourcefn only_control(&self) -> bool
fn only_control(&self) -> bool
Returns true if only a control modifier key is pressed.
sourcefn only_super(&self) -> bool
fn only_super(&self) -> bool
Returns true if only a super modifier key is pressed.
sourcefn word_select(&self) -> bool
fn word_select(&self) -> bool
Returns true if the platform-specific modifier for word-selection is pressed.
For Apple-based platforms, this returns true if an “alt” key is pressed. This corresponds to the Option key.
For all other platforms, this returns true if a control key is pressed.
sourcefn possible_shortcut(&self) -> bool
fn possible_shortcut(&self) -> bool
Returns true if the current modifier state might be a shortcut key.
This returns true if either the control key, alt key, or super key are pressed.