TGUI 1.x-dev
Loading...
Searching...
No Matches
Event.hpp
1
2//
3// TGUI - Texus' Graphical User Interface
4// Copyright (C) 2012-2026 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#ifndef TGUI_EVENT_HPP
26#define TGUI_EVENT_HPP
27
28#include <TGUI/Config.hpp>
29
31
32namespace tgui
33{
34 // Based on sf::Event from SFML
35 struct Event
36 {
37 // Based on sf::KeyBoard::Key from SFML
39 enum class KeyboardKey
40 {
41 Unknown = -1,
42 A = 0,
43 B,
44 C,
45 D,
46 E,
47 F,
48 G,
49 H,
50 I,
51 J,
52 K,
53 L,
54 M,
55 N,
56 O,
57 P,
58 Q,
59 R,
60 S,
61 T,
62 U,
63 V,
64 W,
65 X,
66 Y,
67 Z,
68 Num0,
69 Num1,
70 Num2,
71 Num3,
72 Num4,
73 Num5,
74 Num6,
75 Num7,
76 Num8,
77 Num9,
78 Escape,
79 LControl,
80 LShift,
81 LAlt,
82 LSystem,
83 RControl,
84 RShift,
85 RAlt,
86 RSystem,
87 Menu,
88 LBracket,
89 RBracket,
90 Semicolon,
91 Comma,
92 Period,
93 Quote,
94 Slash,
95 Backslash,
96 Tilde,
97 Equal,
98 Minus,
99 Space,
100 Enter,
101 Backspace,
102 Tab,
103 PageUp,
104 PageDown,
105 End,
106 Home,
107 Insert,
108 Delete,
109 Add,
110 Subtract,
111 Multiply,
112 Divide,
113 Left,
114 Right,
115 Up,
116 Down,
117 Numpad0,
118 Numpad1,
119 Numpad2,
120 Numpad3,
121 Numpad4,
122 Numpad5,
123 Numpad6,
124 Numpad7,
125 Numpad8,
126 Numpad9,
127 F1,
128 F2,
129 F3,
130 F4,
131 F5,
132 F6,
133 F7,
134 F8,
135 F9,
136 F10,
137 F11,
138 F12,
139 F13,
140 F14,
141 F15,
142 Pause
143 };
144
146 enum class MouseButton
147 {
148 Left,
149 Right,
150 Middle
151 };
152
154 enum class KeyModifier
155 {
156 System,
157 Control,
158 Shift,
159 Alt
160 };
161
165 struct KeyEvent
166 {
168 bool alt;
169 bool control;
170 bool shift;
171 bool system;
172 };
173
178 {
179 char32_t unicode;
180 };
181
186 {
187 int x;
188 int y;
189 };
190
195 {
197 int x;
198 int y;
199 };
200
205 {
206 float delta;
207 int x;
208 int y;
209 };
210
215 {
216 std::uintptr_t fingerId;
217 int x;
218 int y;
219 };
220
225 {
226 unsigned int width;
227 unsigned int height;
228 };
229
233 enum class Type
234 {
235 LostFocus,
236 GainedFocus,
237 TextEntered,
238 KeyPressed,
239 MouseWheelScrolled,
240 MouseButtonPressed,
241 MouseButtonReleased,
242 MouseMoved,
243 MouseEntered,
244 MouseLeft,
245 FingerDown,
246 FingerMoved,
247 FingerUp,
248 Resized,
249 Closed
250 };
251
253
255
266 };
267} // namespace tgui
268
269#endif // TGUI_EVENT_HPP
Namespace that contains all TGUI functions and classes.
Definition AbsoluteOrRelativeValue.hpp:37
FingerDown/FingerMoved/FingerUp events parameters.
Definition Event.hpp:215
int y
Y position of the mouse pointer, relative to the top of the owner window.
Definition Event.hpp:218
std::uintptr_t fingerId
Unique id of the finger (must not be 0).
Definition Event.hpp:216
int x
X position of the mouse pointer, relative to the left of the owner window.
Definition Event.hpp:217
KeyPressed event parameters.
Definition Event.hpp:166
KeyboardKey code
Code of the key that has been pressed.
Definition Event.hpp:167
bool system
Is the System key pressed?
Definition Event.hpp:171
bool control
Is the Control key pressed?
Definition Event.hpp:169
bool alt
Is the Alt key pressed?
Definition Event.hpp:168
bool shift
Is the Shift key pressed?
Definition Event.hpp:170
MouseButtonPressed/MouseButtonReleased events parameters.
Definition Event.hpp:195
MouseButton button
Code of the button that has been pressed.
Definition Event.hpp:196
int x
X position of the mouse pointer, relative to the left of the owner window.
Definition Event.hpp:197
int y
Y position of the mouse pointer, relative to the top of the owner window.
Definition Event.hpp:198
MouseMoved event parameters.
Definition Event.hpp:186
int y
Y position of the mouse pointer, relative to the top of the owner window.
Definition Event.hpp:188
int x
X position of the mouse pointer, relative to the left of the owner window.
Definition Event.hpp:187
MouseWheelScrolled events parameters.
Definition Event.hpp:205
int x
X position of the mouse pointer, relative to the left of the owner window.
Definition Event.hpp:207
int y
Y position of the mouse pointer, relative to the top of the owner window.
Definition Event.hpp:208
float delta
Wheel offset (positive is up, negative is down). High-precision mice may use non-integral offsets.
Definition Event.hpp:206
Resized events parameters.
Definition Event.hpp:225
unsigned int width
New width, in pixels.
Definition Event.hpp:226
unsigned int height
New height, in pixels.
Definition Event.hpp:227
TextEntered event parameters.
Definition Event.hpp:178
char32_t unicode
UTF-32 Unicode value of the character.
Definition Event.hpp:179
Definition Event.hpp:36
Type type
Type of the event.
Definition Event.hpp:254
MouseButton
Mouse buttons.
Definition Event.hpp:147
KeyModifier
Modifiers keys.
Definition Event.hpp:155
KeyboardKey
Keyboard key codes.
Definition Event.hpp:40
Type
Enumeration of the different types of events.
Definition Event.hpp:234
MouseButtonEvent mouseButton
Mouse button event parameters (Event::MouseButtonPressed, Event::MouseButtonReleased).
MouseMoveEvent mouseMove
Mouse move event parameters (Event::MouseMoved).
MouseWheelEvent mouseWheel
Mouse wheel event parameters (Event::MouseWheelScrolled).
FingerEvent touch
Touch event parameters (Event::FingerDown, Event::FingerMoved, Event::FingerUp).
SizeEvent size
Size event parameters (Event::Resized).
KeyEvent key
Key event parameters (Event::KeyPressed).
TextEvent text
Text event parameters (Event::TextEntered).