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