gtk4::prelude

Trait ShortcutTriggerExt

Source
pub trait ShortcutTriggerExt: IsA<ShortcutTrigger> + 'static {
    // Provided methods
    fn to_label(&self, display: &impl IsA<Display>) -> GString { ... }
    fn to_str(&self) -> GString { ... }
    fn trigger(
        &self,
        event: impl AsRef<Event>,
        enable_mnemonics: bool,
    ) -> KeyMatch { ... }
}
Expand description

Provided Methods§

Source

fn to_label(&self, display: &impl IsA<Display>) -> GString

Gets textual representation for the given trigger.

This function is returning a translated string for presentation to end users for example in menu items or in help texts.

The @display in use may influence the resulting string in various forms, such as resolving hardware keycodes or by causing display-specific modifier names.

The form of the representation may change at any time and is not guaranteed to stay identical.

§display

gdk::Display to print for

§Returns

a new string

Source

fn to_str(&self) -> GString

Prints the given trigger into a human-readable string.

This is a small wrapper around Gtk::ShortcutTrigger::print() to help when debugging.

§Returns

a new string

Source

fn trigger(&self, event: impl AsRef<Event>, enable_mnemonics: bool) -> KeyMatch

Checks if the given @event triggers @self.

§event

the event to check

§enable_mnemonics

true if mnemonics should trigger. Usually the value of this property is determined by checking that the passed in @event is a Key event and has the right modifiers set.

§Returns

Whether the event triggered the shortcut

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§