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
54
55
56
57
58
59
60
61
62
63
64
65
//! Types to help idiomatically represent user input events, such as pointer clicks and moves.
//!
//! ```
//! use euclid::num::Zero;
//! use keyboard_types::Modifiers;
//! use event_types::event_data::PointerDown;
//! use event_types::*;
//!
//! // Your library can construct event data
//! let pointer_data = PointerProperties::builder()
//! .coordinates(Coordinates::zero())
//! .held_buttons(PointerButton::Primary)
//! .id(PointerId(0))
//! .pointer_type(PointerType::Mouse)
//! .is_primary(true)
//! .build();
//! let event_data = PointerDown::new(pointer_data, Modifiers::SHIFT, PointerButton::Primary, 1);
//!
//! // So that your users can get info about input events
//! dbg!(event_data.button_pressed());
//! dbg!(event_data.pointer());
//! dbg!(event_data.modifiers());
//! ```
//!
//! # Overview
//!
//! - The [event_data] module: Collection of types describing some common input events
//! - [KeyProperties]: Describes a key
//! - [PointerProperties]: Describes a pointer
//!
//! The rest are mostly small structs and enums helping describe event data and its units.
//!
//! # Usage
//!
//! This library only provides types to represent data associated with input events. It does not provide an event system itself. Therefore, if you are writing a GUI framework, you will most likely have to bring:
//! - Your own Event wrapper, which will contain:
//! - Event data from structs in [event_data] (possibly in a Vec if you want to batch some events)
//! - Some sort of reference to the target element
//! - Facilities for default event behavior and cancelling it, if desired
//! - Event bubbling and preventing it, if desired
//! - Your own event data for events not in this crate (e.g. clipboard events)
//! - Your own components and ways to attach event listeners to them
/// A re-export of [enumset]
///
/// Used for describing sets of pointer buttons
pub use enumset;
/// A re-export of [euclid]
///
/// Used for geometry primitives, including coordinates and dimensions
pub use euclid;
/// A re-export of [keyboard_types]
///
/// Used for describing keys and active modifiers in pointer events
pub use keyboard_types;
pub use *;
pub use *;
pub use *;