Module gesture

Module gesture 

Source
Expand description

Gesture service, properties, events, shortcuts and other types.

A gesture is an event that is generated from multiple lower-level events. A shortcut is a gesture generated from one or more keyboard inputs, a click is also a gesture generated from mouse clicks, accessibility clicks, touch taps and some shortcuts. In essence, events, types and states that aggregate multiple difference sources are found here, gestures generated from a single event source are defined in other modules, for example touch gestures are defined in touch.

use zng::prelude::*;

Window! {
    gesture::on_click = hn!(|args| {
        use gesture::ClickArgsSource::*;
        match args.source {
            Mouse { .. } => println!("mouse click"),
            Touch { .. } => println!("touch tap"),
            Shortcut { .. } => println!("shortcut press"),
            Access { .. } => println!("access click"),
        }
    });
}

The example above handles the click gesture on a window and prints what underlying event was interpreted as a click.

§Full API

See zng_ext_input::gesture and zng_wgt_input::gesture for the full gesture API and zng_app::shortcut for the shortcut API.

Macros§

shortcut
Creates a Shortcut.

Structs§

ClickArgs
CLICK_EVENT arguments.
GESTURES
Gesture events config service.
KeyChord
A sequence of two keyboard combinations.
KeyGesture
A keyboard combination.
ShortcutActions
Represents the resolved targets for a shortcut at a time.
ShortcutArgs
SHORTCUT_EVENT arguments.
ShortcutFilter
Conditions that must be met for the shortcut to apply.
Shortcuts
Multiple shortcuts.
ShortcutsHandle
Represents shortcuts claim in click_shortcut or focus_shortcut.
WeakShortcutsHandle
Weak ShortcutsHandle.

Enums§

ClickArgsSource
Specific information from the source of a ClickArgs.
GestureKey
A keyboard key used in a gesture.
ModifierGesture
A modifier key press and release without any other key press in between.
Shortcut
Keyboard gesture or chord associated with a command.
ShortcutClick
What kind of click a shortcut represents in a ClickArgsSource::Shortcut.

Statics§

CLICK_EVENT
Aggregate click event.
SHORTCUT_EVENT
Shortcut input event.

Traits§

CommandShortcutExt
Adds the shortcut metadata.
CommandShortcutMatchesExt
Adds the shortcut_matches method to commands.
HeadlessAppGestureExt
Extension trait that adds gesture simulation methods to HeadlessApp.

Functions§

click_shortcut
P Keyboard shortcuts that focus and clicks this widget.
context_click_shortcut
P Keyboard shortcuts that focus and context clicks this widget.
is_cap_hovered
P If the mouse pointer is over the widget, or a descendant, or is captured by the it.
is_cap_pointer_pressed
P If is_cap_mouse_pressed or is_cap_touched_from_start.
is_cap_pressed
P If is_cap_mouse_pressed, is_cap_touched_from_start or is_shortcut_pressed.
is_hovered
P If the mouse pointer is over the widget or a descendant and the widget is enabled.
is_hovered_disabled
P If the mouse pointer is over the widget or a descendant and the widget is disabled.
is_pointer_active
P If is_mouse_active or is_touch_active.
is_pressed
P If is_mouse_pressed, is_touched_from_start or is_shortcut_pressed.
on_any_click
P On widget click from any source and of any click count and the widget is enabled.
on_any_double_click
P On widget double click from any source and the widget is enabled.
on_any_single_click
P On widget click from any source but excluding double/triple clicks and the widget is enabled.
on_any_triple_click
P On widget triple click from any source and the widget is enabled.
on_click
P On widget click with the primary button and any click count and the widget is enabled.
on_context_click
P On widget click with the secondary/context button and the widget is enabled.
on_disabled_click
P On widget click from any source and of any click count and the widget is disabled.
on_double_click
P On widget double click with the primary button and the widget is enabled.
on_pre_any_click
P Preview on_any_click event.
on_pre_any_double_click
P Preview on_any_double_click event.
on_pre_any_single_click
P Preview on_any_single_click event.
on_pre_any_triple_click
P Preview on_any_triple_click event.
on_pre_click
P Preview on_click event.
on_pre_context_click
P Preview on_context_click event.
on_pre_disabled_click
P Preview on_disabled_click event.
on_pre_double_click
P Preview on_double_click event.
on_pre_single_click
P Preview on_single_click event.
on_pre_triple_click
P Preview on_triple_click event.
on_single_click
P On widget click with the primary button, excluding double/triple clicks and the widget is enabled.
on_triple_click
P On widget triple click with the primary button and the widget is enabled.