1#[allow(missing_docs)]
3#[derive(Clone, Copy, Debug, PartialEq, Eq)]
4pub enum Key {
5 LeftMouseButton,
6 MiddleMouseButton,
7 RightMouseButton,
8
9 Key1,
10 Key2,
11 Key3,
12 Key4,
13 Key5,
14 Key6,
15 Key7,
16 Key8,
17 Key9,
18 Key0,
19
20 F1,
21 F2,
22 F3,
23 F4,
24 F5,
25 F6,
26 F7,
27 F8,
28 F9,
29 F10,
30 F11,
31 F12,
32
33 A,
34 B,
35 C,
36 D,
37 E,
38 F,
39 G,
40 H,
41 I,
42 J,
43 K,
44 L,
45 M,
46 N,
47 O,
48 P,
49 Q,
50 R,
51 S,
52 T,
53 U,
54 V,
55 W,
56 X,
57 Y,
58 Z,
59
60 Tab,
61 Shift,
62 Ctrl,
63 Alt,
64 Space,
65 Enter,
66 Backspace,
67 Escape,
68 Home,
69 End,
70 Minus,
71 Plus,
72 BracketOpen,
73 BracketClose,
74 Comma,
75 Period,
76 Semicolon,
77 Quote,
78 Tilde,
79 Backslash,
80 Slash,
81
82 Left,
83 Right,
84 Up,
85 Down,
86}
87
88#[derive(Clone, Copy, Debug)]
90pub struct Modifiers {
91 pub ctrl: bool,
93 pub alt: bool,
95 pub shift: bool,
97 pub logo: bool,
99 pub command: bool,
102}
103
104#[allow(missing_docs)]
105impl Modifiers {
106 pub fn none() -> Modifiers {
107 Modifiers {
108 ctrl: false,
109 alt: false,
110 shift: false,
111 logo: false,
112 command: false,
113 }
114 }
115
116 pub fn ctrl() -> Modifiers {
117 Modifiers {
118 ctrl: true,
119 alt: false,
120 shift: false,
121 logo: false,
122 #[cfg(target_os = "macos")]
123 command: false,
124 #[cfg(not(target_os = "macos"))]
125 command: true,
126 }
127 }
128
129 pub fn alt() -> Modifiers {
130 Modifiers {
131 ctrl: false,
132 alt: true,
133 shift: false,
134 logo: false,
135 command: false,
136 }
137 }
138
139 pub fn shift() -> Modifiers {
140 Modifiers {
141 ctrl: false,
142 alt: false,
143 shift: true,
144 logo: false,
145 command: false,
146 }
147 }
148
149 pub fn logo() -> Modifiers {
150 Modifiers {
151 ctrl: false,
152 alt: false,
153 shift: false,
154 logo: true,
155 #[cfg(target_os = "macos")]
156 command: true,
157 #[cfg(not(target_os = "macos"))]
158 command: false,
159 }
160 }
161}
162
163#[derive(Clone, Copy, Debug)]
165pub enum Event {
166 Press(Key),
168 Release(Key),
170 Modifiers(Modifiers),
172 Resize(f32, f32),
174 Motion(f32, f32),
176 Cursor(f32, f32),
178 Scroll(f32, f32),
180 Text(char),
182 Focus(bool),
184 Exit,
186}