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§
Structs§
- Click
Args CLICK_EVENTarguments.- GESTURES
- Gesture events config service.
- KeyChord
- A sequence of two keyboard combinations.
- KeyGesture
- A keyboard combination.
- Shortcut
Actions - Represents the resolved targets for a shortcut at a time.
- Shortcut
Args SHORTCUT_EVENTarguments.- Shortcut
Filter - Conditions that must be met for the shortcut to apply.
- Shortcuts
- Multiple shortcuts.
- Shortcuts
Handle - Represents shortcuts claim in
click_shortcutorfocus_shortcut. - Weak
Shortcuts Handle - Weak
ShortcutsHandle.
Enums§
- Click
Args Source - Specific information from the source of a
ClickArgs. - Gesture
Key - A keyboard key used in a gesture.
- Modifier
Gesture - A modifier key press and release without any other key press in between.
- Shortcut
- Keyboard gesture or chord associated with a command.
- Shortcut
Click - What kind of click a shortcut represents in a
ClickArgsSource::Shortcut.
Statics§
- CLICK_
EVENT - Aggregate click event.
- SHORTCUT_
EVENT - Shortcut input event.
Traits§
- Command
Shortcut Ext - Adds the
shortcutmetadata. - Command
Shortcut Matches Ext - Adds the
shortcut_matchesmethod to commands. - Headless
AppGesture Ext - Extension trait that adds gesture simulation methods to
HeadlessApp.
Functions§
- click_
shortcut PKeyboard shortcuts that focus and clicks this widget.- context_
click_ shortcut PKeyboard shortcuts that focus and context clicks this widget.- is_
cap_ hovered PIf the mouse pointer is over the widget, or a descendant, or is captured by the it.- is_
cap_ pointer_ pressed PIfis_cap_mouse_pressedoris_cap_touched_from_start.- is_
cap_ pressed PIfis_cap_mouse_pressed,is_cap_touched_from_startoris_shortcut_pressed.- is_
hovered PIf the mouse pointer is over the widget or a descendant and the widget is enabled.- is_
hovered_ disabled PIf the mouse pointer is over the widget or a descendant and the widget is disabled.- is_
pointer_ active PIfis_mouse_activeoris_touch_active.- is_
pressed PIfis_mouse_pressed,is_touched_from_startoris_shortcut_pressed.- on_
any_ click POn widget click from any source and of any click count and the widget is enabled.- on_
any_ double_ click POn widget double click from any source and the widget is enabled.- on_
any_ single_ click POn widget click from any source but excluding double/triple clicks and the widget is enabled.- on_
any_ triple_ click POn widget triple click from any source and the widget is enabled.- on_
click POn widget click with the primary button and any click count and the widget is enabled.- on_
context_ click POn widget click with the secondary/context button and the widget is enabled.- on_
disabled_ click POn widget click from any source and of any click count and the widget is disabled.- on_
double_ click POn widget double click with the primary button and the widget is enabled.- on_
pre_ any_ click PPreviewon_any_clickevent.- on_
pre_ any_ double_ click PPreviewon_any_double_clickevent.- on_
pre_ any_ single_ click PPreviewon_any_single_clickevent.- on_
pre_ any_ triple_ click PPreviewon_any_triple_clickevent.- on_
pre_ click PPreviewon_clickevent.- on_
pre_ context_ click PPreviewon_context_clickevent.- on_
pre_ disabled_ click PPreviewon_disabled_clickevent.- on_
pre_ double_ click PPreviewon_double_clickevent.- on_
pre_ single_ click PPreviewon_single_clickevent.- on_
pre_ triple_ click PPreviewon_triple_clickevent.- on_
single_ click POn widget click with the primary button, excluding double/triple clicks and the widget is enabled.- on_
triple_ click POn widget triple click with the primary button and the widget is enabled.