TGUI  1.2.0
Loading...
Searching...
No Matches
Event.hpp
1
2//
3// TGUI - Texus' Graphical User Interface
4// Copyright (C) 2012-2024 Bruno Van de Velde (vdv_b@tgui.eu)
5//
6// This software is provided 'as-is', without any express or implied warranty.
7// In no event will the authors be held liable for any damages arising from the use of this software.
8//
9// Permission is granted to anyone to use this software for any purpose,
10// including commercial applications, and to alter it and redistribute it freely,
11// subject to the following restrictions:
12//
13// 1. The origin of this software must not be misrepresented;
14// you must not claim that you wrote the original software.
15// If you use this software in a product, an acknowledgment
16// in the product documentation would be appreciated but is not required.
17//
18// 2. Altered source versions must be plainly marked as such,
19// and must not be misrepresented as being the original software.
20//
21// 3. This notice may not be removed or altered from any source distribution.
22//
24
25
26#ifndef TGUI_EVENT_HPP
27#define TGUI_EVENT_HPP
28
29#include <TGUI/Config.hpp>
30
32
33TGUI_MODULE_EXPORT namespace tgui
34{
36
37 // Based on sf::Event from SFML
38 struct Event
39 {
40 // Based on sf::KeyBoard::Key from SFML
42 enum class KeyboardKey
43 {
44 Unknown = -1,
45 A = 0,
46 B,
47 C,
48 D,
49 E,
50 F,
51 G,
52 H,
53 I,
54 J,
55 K,
56 L,
57 M,
58 N,
59 O,
60 P,
61 Q,
62 R,
63 S,
64 T,
65 U,
66 V,
67 W,
68 X,
69 Y,
70 Z,
71 Num0,
72 Num1,
73 Num2,
74 Num3,
75 Num4,
76 Num5,
77 Num6,
78 Num7,
79 Num8,
80 Num9,
81 Escape,
82 LControl,
83 LShift,
84 LAlt,
85 LSystem,
86 RControl,
87 RShift,
88 RAlt,
89 RSystem,
90 Menu,
91 LBracket,
92 RBracket,
93 Semicolon,
94 Comma,
95 Period,
96 Quote,
97 Slash,
98 Backslash,
99 Tilde,
100 Equal,
101 Minus,
102 Space,
103 Enter,
104 Backspace,
105 Tab,
106 PageUp,
107 PageDown,
108 End,
109 Home,
110 Insert,
111 Delete,
112 Add,
113 Subtract,
114 Multiply,
115 Divide,
116 Left,
117 Right,
118 Up,
119 Down,
120 Numpad0,
121 Numpad1,
122 Numpad2,
123 Numpad3,
124 Numpad4,
125 Numpad5,
126 Numpad6,
127 Numpad7,
128 Numpad8,
129 Numpad9,
130 F1,
131 F2,
132 F3,
133 F4,
134 F5,
135 F6,
136 F7,
137 F8,
138 F9,
139 F10,
140 F11,
141 F12,
142 F13,
143 F14,
144 F15,
145 Pause
146 };
147
149 enum class MouseButton
150 {
151 Left,
152 Right,
153 Middle
154 };
155
157 enum class KeyModifier
158 {
159 System,
160 Control,
161 Shift,
162 Alt
163 };
164
168 struct KeyEvent
169 {
171 bool alt;
172 bool control;
173 bool shift;
174 bool system;
175 };
176
181 {
182 char32_t unicode;
183 };
184
189 {
190 int x;
191 int y;
192 };
193
198 {
200 int x;
201 int y;
202 };
203
208 {
209 float delta;
210 int x;
211 int y;
212 };
213
218 {
219 unsigned int width;
220 unsigned int height;
221 };
222
241
243
245
246 union
247 {
254 };
255 };
256
258}
259
261
262#endif // TGUI_EVENT_HPP
Namespace that contains all TGUI functions and classes.
Definition AbsoluteOrRelativeValue.hpp:39
KeyPressed event parameters.
Definition Event.hpp:169
KeyboardKey code
Code of the key that has been pressed.
Definition Event.hpp:170
bool system
Is the System key pressed?
Definition Event.hpp:174
bool control
Is the Control key pressed?
Definition Event.hpp:172
bool alt
Is the Alt key pressed?
Definition Event.hpp:171
bool shift
Is the Shift key pressed?
Definition Event.hpp:173
MouseButtonPressed/MouseButtonReleased events parameters.
Definition Event.hpp:198
MouseButton button
Code of the button that has been pressed.
Definition Event.hpp:199
int x
X position of the mouse pointer, relative to the left of the owner window.
Definition Event.hpp:200
int y
Y position of the mouse pointer, relative to the top of the owner window.
Definition Event.hpp:201
MouseMoved event parameters.
Definition Event.hpp:189
int y
Y position of the mouse pointer, relative to the top of the owner window.
Definition Event.hpp:191
int x
X position of the mouse pointer, relative to the left of the owner window.
Definition Event.hpp:190
MouseWheelScrolled events parameters.
Definition Event.hpp:208
int x
X position of the mouse pointer, relative to the left of the owner window.
Definition Event.hpp:210
int y
Y position of the mouse pointer, relative to the top of the owner window.
Definition Event.hpp:211
float delta
Wheel offset (positive is up, negative is down). High-precision mice may use non-integral offsets.
Definition Event.hpp:209
Resized events parameters.
Definition Event.hpp:218
unsigned int width
New width, in pixels.
Definition Event.hpp:219
unsigned int height
New height, in pixels.
Definition Event.hpp:220
TextEntered event parameters.
Definition Event.hpp:181
char32_t unicode
UTF-32 Unicode value of the character.
Definition Event.hpp:182
Definition Event.hpp:39
Type type
Type of the event.
Definition Event.hpp:244
MouseButton
Mouse buttons.
Definition Event.hpp:150
@ Middle
The middle (wheel) mouse button.
KeyModifier
Modifiers keys.
Definition Event.hpp:158
MouseWheelEvent mouseWheel
Mouse wheel event parameters (Event::MouseWheelScrolled)
Definition Event.hpp:252
KeyboardKey
Keyboard key codes.
Definition Event.hpp:43
@ Escape
The Escape key.
@ RAlt
The right Alt key.
@ Pause
The Pause key.
@ Numpad9
The numpad 9 key.
@ Numpad0
The numpad 0 key.
@ Subtract
The - key (minus from numpad)
@ RSystem
The right OS specific key (windows key / super key / command key)
@ Numpad7
The numpad 7 key.
@ Minus
The - key (hyphen)
@ Numpad6
The numpad 6 key.
@ Numpad4
The numpad 4 key.
@ Tab
The Tabulation key.
@ Numpad3
The numpad 3 key.
@ Numpad5
The numpad 5 key.
@ LShift
The left Shift key.
@ Unknown
Unhandled key.
@ Numpad8
The numpad 8 key.
@ RShift
The right Shift key.
@ PageUp
The Page up key.
@ LControl
The left Control key.
@ Insert
The Insert key.
@ LAlt
The left Alt key.
@ RControl
The right Control key.
@ Numpad1
The numpad 1 key.
@ Backspace
The Backspace key.
@ Space
The Space key.
@ PageDown
The Page down key.
@ Enter
The Enter/Return keys.
@ Delete
The Delete key.
@ Numpad2
The numpad 2 key.
@ LSystem
The left OS specific key (windows key / super key / command key)
MouseMoveEvent mouseMove
Mouse move event parameters (Event::MouseMoved)
Definition Event.hpp:250
MouseButtonEvent mouseButton
Mouse button event parameters (Event::MouseButtonPressed, Event::MouseButtonReleased)
Definition Event.hpp:251
TextEvent text
Text event parameters (Event::TextEntered)
Definition Event.hpp:249
Type
Enumeration of the different types of events.
Definition Event.hpp:227
@ Closed
The window was closed (no data)
@ MouseEntered
The mouse cursor entered the content area of the window (no data)
@ Resized
The window was resized (data in event.size)
@ GainedFocus
The window gained the focus (no data)
@ MouseButtonPressed
A mouse button was pressed (data in event.mouseButton)
@ MouseButtonReleased
A mouse button was released (data in event.mouseButton)
@ LostFocus
The window lost the focus (no data)
@ TextEntered
A character was entered (data in event.text)
@ MouseWheelScrolled
The mouse wheel was scrolled (data in event.mouseWheel)
@ MouseLeft
The mouse cursor left the content area of the window (no data)
@ KeyPressed
A key was pressed (data in event.key)
@ MouseMoved
The mouse cursor moved (data in event.mouseMove)
KeyEvent key
Key event parameters (Event::KeyPressed)
Definition Event.hpp:248
SizeEvent size
Size event parameters (Event::Resized)
Definition Event.hpp:253