Molybden API
Loading...
Searching...
No Matches
input_events.hpp
1// Copyright (c) 2000-2023 TeamDev Ltd. All rights reserved.
2// TeamDev PROPRIETARY and CONFIDENTIAL.
3// Use is subject to license terms.
4
5#ifndef MOLYBDEN_INPUT_EVENTS_HPP
6#define MOLYBDEN_INPUT_EVENTS_HPP
7
8#include "molybden/ui/geometry.hpp"
9
10namespace molybden {
11
15enum class KeyCode {
16 kUnspecified,
17 kKeyCodeLbutton,
18 kKeyCodeRbutton,
19 kKeyCodeCancel,
20 kKeyCodeMbutton,
21 kKeyCodeXbutton1,
22 kKeyCodeXbutton2,
23 kKeyCodeBack,
24 kKeyCodeTab,
25 kKeyCodeClear,
26 kKeyCodeReturn,
27 kKeyCodeShift,
28 kKeyCodeControl,
29 kKeyCodeMenu,
30 kKeyCodePause,
31 kKeyCodeCapital,
32 kKeyCodeKana,
33 kKeyCodeHanguel,
34 kKeyCodeHangul,
35 kKeyCodeJunja,
36 kKeyCodeFinal,
37 kKeyCodeHanja,
38 kKeyCodeKanji,
39 kKeyCodeEscape,
40 kKeyCodeConvert,
41 kKeyCodeNonconvert,
42 kKeyCodeAccept,
43 kKeyCodeModechange,
44 kKeyCodeSpace,
45 kKeyCodePrior,
46 kKeyCodeNext,
47 kKeyCodeEnd,
48 kKeyCodeHome,
49 kKeyCodeLeft,
50 kKeyCodeUp,
51 kKeyCodeRight,
52 kKeyCodeDown,
53 kKeyCodeSelect,
54 kKeyCodePrint,
55 kKeyCodeExecute,
56 kKeyCodeSnapshot,
57 kKeyCodeInsert,
58 kKeyCodeDelete,
59 kKeyCodeHelp,
60 kKeyCode0,
61 kKeyCode1,
62 kKeyCode2,
63 kKeyCode3,
64 kKeyCode4,
65 kKeyCode5,
66 kKeyCode6,
67 kKeyCode7,
68 kKeyCode8,
69 kKeyCode9,
70 kKeyCodeA,
71 kKeyCodeB,
72 kKeyCodeC,
73 kKeyCodeD,
74 kKeyCodeE,
75 kKeyCodeF,
76 kKeyCodeG,
77 kKeyCodeH,
78 kKeyCodeI,
79 kKeyCodeJ,
80 kKeyCodeK,
81 kKeyCodeL,
82 kKeyCodeM,
83 kKeyCodeN,
84 kKeyCodeO,
85 kKeyCodeP,
86 kKeyCodeQ,
87 kKeyCodeR,
88 kKeyCodeS,
89 kKeyCodeT,
90 kKeyCodeU,
91 kKeyCodeV,
92 kKeyCodeW,
93 kKeyCodeX,
94 kKeyCodeY,
95 kKeyCodeZ,
96 kKeyCodeLwin,
97 kKeyCodeRwin,
98 kKeyCodeLcmd,
99 kKeyCodeRcmd,
100 kKeyCodeApps,
101 kKeyCodeSleep,
102 kKeyCodeNumpad0,
103 kKeyCodeNumpad1,
104 kKeyCodeNumpad2,
105 kKeyCodeNumpad3,
106 kKeyCodeNumpad4,
107 kKeyCodeNumpad5,
108 kKeyCodeNumpad6,
109 kKeyCodeNumpad7,
110 kKeyCodeNumpad8,
111 kKeyCodeNumpad9,
112 kKeyCodeMultiply,
113 kKeyCodeAdd,
114 kKeyCodeSeparator,
115 kKeyCodeSubtract,
116 kKeyCodeDecimal,
117 kKeyCodeDivide,
118 kKeyCodeF1,
119 kKeyCodeF2,
120 kKeyCodeF3,
121 kKeyCodeF4,
122 kKeyCodeF5,
123 kKeyCodeF6,
124 kKeyCodeF7,
125 kKeyCodeF8,
126 kKeyCodeF9,
127 kKeyCodeF10,
128 kKeyCodeF11,
129 kKeyCodeF12,
130 kKeyCodeF13,
131 kKeyCodeF14,
132 kKeyCodeF15,
133 kKeyCodeF16,
134 kKeyCodeF17,
135 kKeyCodeF18,
136 kKeyCodeF19,
137 kKeyCodeF20,
138 kKeyCodeF21,
139 kKeyCodeF22,
140 kKeyCodeF23,
141 kKeyCodeF24,
142 kKeyCodeNumlock,
143 kKeyCodeScroll,
144 kKeyCodeLshift,
145 kKeyCodeRshift,
146 kKeyCodeLcontrol,
147 kKeyCodeRcontrol,
148 kKeyCodeLmenu,
149 kKeyCodeRmenu,
150 kKeyCodeCommand,
151 kKeyCodeBrowserBack,
152 kKeyCodeBrowserForward,
153 kKeyCodeBrowserRefresh,
154 kKeyCodeBrowserStop,
155 kKeyCodeBrowserSearch,
156 kKeyCodeBrowserFavorites,
157 kKeyCodeBrowserHome,
158 kKeyCodeVolumeMute,
159 kKeyCodeVolumeDown,
160 kKeyCodeVolumeUp,
161 kKeyCodeMediaNextTrack,
162 kKeyCodeMediaPrevTrack,
163 kKeyCodeMediaStop,
164 kKeyCodeMediaPlayPause,
165 kKeyCodeLaunchMail,
166 kKeyCodeLaunchMediaSelect,
167 kKeyCodeLaunchApp1,
168 kKeyCodeLaunchApp2,
169 kKeyCodeOemPlus,
170 kKeyCodeOemComma,
171 kKeyCodeOemMinus,
172 kKeyCodeOemPeriod,
173 kKeyCodeOem1,
174 kKeyCodeOem2,
175 kKeyCodeOem3,
176 kKeyCodeOem4,
177 kKeyCodeOem5,
178 kKeyCodeOem6,
179 kKeyCodeOem7,
180 kKeyCodeOem8,
181 kKeyCodeOem102,
182 kKeyCodeProcesskey,
183 kKeyCodePacket,
184 kKeyCodeAttn,
185 kKeyCodeCrsel,
186 kKeyCodeExsel,
187 kKeyCodeEreof,
188 kKeyCodePlay,
189 kKeyCodeZoom,
190 kKeyCodeNoname,
191 kKeyCodePa1,
192 kKeyCodeOemClear,
193 kKeyCodeDbeAlphanumeric,
194};
195
199enum class KeyLocation {
200 kUnspecified,
201
207 kStandard,
208
213 kNumericKeypad,
214
218 kLeft,
219
223 kRight
224};
225
233 bool alt_down = false;
234
238 bool alt_graph_down = false;
239
243 bool shift_down = false;
244
248 bool control_down = false;
249
253 bool meta_down = false;
254};
255
259enum class MouseButton {
260 kUnspecified,
261 kNoButton,
262 kPrimary,
263 kMiddle,
264 kSecondary,
265 kBack,
266 kForward
267};
268
272enum class ScrollType {
273 kUnspecified,
274
278 kUnitScroll,
279
283 kBlockScroll
284};
285
294
298 bool middle_button_down = false;
299
304
308 bool back_button_down = false;
309
314};
315
319struct KeyEvent {
320 protected:
321 KeyEvent(KeyCode code, KeyModifiers modifiers, KeyLocation location);
322
323 public:
327 KeyCode code;
328
333
337 KeyLocation location;
338};
339
343struct KeyPressed : public KeyEvent {
344 KeyPressed(KeyCode code,
346 KeyLocation location,
347 char key_char);
348
355};
356
360struct KeyTyped : public KeyEvent {
361 KeyTyped(KeyCode code,
363 KeyLocation location,
364 char key_char);
365
372};
373
377struct KeyReleased : public KeyEvent {
378 KeyReleased(KeyCode code, KeyModifiers modifiers, KeyLocation location);
379};
380
399
425
445
449struct MouseWheel : public MouseEvent {
453 ScrollType scroll_type,
454 float delta_x,
455 float delta_y);
456
460 ScrollType scroll_type;
461
466
470 float delta_x;
471
475 float delta_y;
476};
477
508
539
561
583
584} // namespace molybden
585
586#endif // MOLYBDEN_INPUT_EVENTS_HPP
A common interface that all keyboard events must extend.
Definition input_events.hpp:319
KeyCode code
The code of the key.
Definition input_events.hpp:327
KeyLocation location
The location of the key on the keyboard.
Definition input_events.hpp:337
KeyModifiers modifiers
The keyboard modifiers applied.
Definition input_events.hpp:332
The modifiers for the keyboard and mouse events.
Definition input_events.hpp:229
bool alt_graph_down
Indicates whether the Alt Graph/Right key is pressed.
Definition input_events.hpp:238
bool shift_down
Indicates whether the Shift key is pressed.
Definition input_events.hpp:243
bool control_down
Indicates whether the Ctrl key is pressed.
Definition input_events.hpp:248
bool alt_down
Indicates whether the Alt key is pressed.
Definition input_events.hpp:233
bool meta_down
Indicates whether the Meta key is pressed.
Definition input_events.hpp:253
An event indicating that a keyboard key has been pressed.
Definition input_events.hpp:343
char key_char
The character corresponding to the pressed key or 0 when a keyboard modifier such as Shift,...
Definition input_events.hpp:354
An event indicating that a keyboard key has been released.
Definition input_events.hpp:377
An event indicating that a keyboard character key has been typed.
Definition input_events.hpp:360
char key_char
The character corresponding to the pressed key or 0 when a keyboard modifier such as Shift,...
Definition input_events.hpp:371
An event indicating that the mouse has been dragged.
Definition input_events.hpp:403
KeyModifiers key_modifiers
The keyboard modifiers applied.
Definition input_events.hpp:418
MouseButton mouse_button
The button that is pressed during the drag.
Definition input_events.hpp:413
MouseModifiers mouse_modifiers
The mouse modifiers applied.
Definition input_events.hpp:423
An event indicating that the mouse has been moved over the web page.
Definition input_events.hpp:543
MouseModifiers mouse_modifiers
The mouse modifiers applied.
Definition input_events.hpp:559
MouseButton mouse_button
The pressed mouse button.
Definition input_events.hpp:549
KeyModifiers key_modifiers
The keyboard modifiers applied.
Definition input_events.hpp:554
A common interface that all mouse events must extend.
Definition input_events.hpp:384
Point location_on_screen
The mouse position on the screen where the browser view is located.
Definition input_events.hpp:397
Point location
The mouse position inside the browser view.
Definition input_events.hpp:392
An event indicating that the mouse has been moved out of the web page.
Definition input_events.hpp:565
MouseButton mouse_button
The pressed mouse button.
Definition input_events.hpp:571
MouseModifiers mouse_modifiers
The mouse modifiers applied.
Definition input_events.hpp:581
KeyModifiers key_modifiers
The keyboard modifiers applied.
Definition input_events.hpp:576
The modifiers for the mouse events.
Definition input_events.hpp:289
bool secondary_button_down
Indicates whether the secondary mouse button is pressed.
Definition input_events.hpp:303
bool forward_button_down
Indicates whether the forward button is pressed.
Definition input_events.hpp:313
bool back_button_down
Indicates whether the back button is pressed.
Definition input_events.hpp:308
bool primary_button_down
Indicates whether the primary mouse button is pressed.
Definition input_events.hpp:293
bool middle_button_down
Indicates whether the middle mouse button is pressed.
Definition input_events.hpp:298
An event indicating that the mouse has been moved.
Definition input_events.hpp:429
KeyModifiers key_modifiers
The keyboard modifiers applied.
Definition input_events.hpp:438
MouseModifiers mouse_modifiers
The mouse modifiers applied.
Definition input_events.hpp:443
An event indicating that the mouse button has been pressed.
Definition input_events.hpp:481
MouseModifiers mouse_modifiers
The mouse modifiers applied.
Definition input_events.hpp:501
KeyModifiers key_modifiers
The keyboard modifiers applied.
Definition input_events.hpp:496
MouseButton mouse_button
The pressed mouse button.
Definition input_events.hpp:491
uint32_t click_count
The count of consecutive clicks that happened in a short amount of time.
Definition input_events.hpp:506
An event indicating that the mouse button has been released.
Definition input_events.hpp:512
KeyModifiers key_modifiers
The keyboard modifiers applied.
Definition input_events.hpp:527
MouseModifiers mouse_modifiers
The mouse modifiers applied.
Definition input_events.hpp:532
MouseButton mouse_button
The released mouse button.
Definition input_events.hpp:522
uint32_t click_count
The count of consecutive clicks that happened in a short amount of time.
Definition input_events.hpp:537
An event indicating that the mouse wheel button has been rotated.
Definition input_events.hpp:449
float delta_x
The amount of units to scroll horizontally.
Definition input_events.hpp:470
ScrollType scroll_type
The scroll type of the event.
Definition input_events.hpp:460
float delta_y
The amount of units to scroll horizontally.
Definition input_events.hpp:475
KeyModifiers key_modifiers
The keyboard modifiers applied.
Definition input_events.hpp:465
A pair of numbers that in general are used to define coordinates in the two-dimensional space.
Definition geometry.hpp:16