1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
//! 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`](crate::touch).
//!
//! ```
//! use zng::prelude::*;
//!
//! # let _scope = APP.defaults();
//! # let _ =
//! Window! {
//! gesture::on_click = hn!(|args: &gesture::ClickArgs| {
//! 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.
//!
//! [`zng_app::shortcut`]: mod@zng_app::shortcut
pub use zng_ext_input::gesture::{
ClickArgs, ClickArgsSource, CommandShortcutMatchesExt, HeadlessAppGestureExt, ShortcutActions, ShortcutArgs, ShortcutClick,
ShortcutsHandle, WeakShortcutsHandle, CLICK_EVENT, GESTURES, SHORTCUT_EVENT,
};
pub use zng_app::shortcut::{
shortcut, CommandShortcutExt, GestureKey, KeyChord, KeyGesture, ModifierGesture, Shortcut, ShortcutFilter, Shortcuts,
};
pub use zng_wgt_input::gesture::{
click_shortcut, context_click_shortcut, on_any_click, on_any_double_click, on_any_single_click, on_any_triple_click, on_click,
on_context_click, on_disabled_click, on_double_click, on_pre_any_click, on_pre_any_double_click, on_pre_any_single_click,
on_pre_any_triple_click, on_pre_click, on_pre_context_click, on_pre_disabled_click, on_pre_double_click, on_pre_single_click,
on_pre_triple_click, on_single_click, on_triple_click,
};
pub use zng_wgt_input::{is_cap_hovered, is_cap_pointer_pressed, is_cap_pressed, is_hovered, is_hovered_disabled, is_pressed};