7
7
8
8
namespace lxgui ::input {
9
9
10
+ // / Data for on_mouse_moved signal
11
+ struct mouse_moved_data {
12
+ gui::vector2f motion; // / Mouse motion that generated this event, in points
13
+ gui::vector2f position; // / Mouse position, in points
14
+ };
15
+
16
+ // / Data for on_mouse_wheel signal
17
+ struct mouse_wheel_data {
18
+ float motion; // / Mouse wheel motion that generated this event
19
+ gui::vector2f position; // / Mouse position, in points
20
+ };
21
+
22
+ // / Data for on_mouse_pressed signal
23
+ struct mouse_pressed_data {
24
+ input::mouse_button button; // / Mouse button that generated this event
25
+ gui::vector2f position; // / Mouse position, in points
26
+ };
27
+
28
+ // / Data for on_mouse_released signal
29
+ struct mouse_released_data {
30
+ input::mouse_button button; // / Mouse button that generated this event
31
+ gui::vector2f position; // / Mouse position, in points
32
+ bool was_dragged; // / Was mouse dragged before release?
33
+ };
34
+
35
+ // / Data for on_mouse_double_clicked signal
36
+ struct mouse_double_clicked_data {
37
+ input::mouse_button button; // / Mouse button that generated this event
38
+ gui::vector2f position; // / Mouse position, in points
39
+ };
40
+
41
+ // / Data for on_mouse_drag_start signal
42
+ struct mouse_drag_start_data {
43
+ input::mouse_button button; // / Mouse button that generated this event (if more than one, only
44
+ // / the first pressed)
45
+ gui::vector2f position; // / Mouse position, in points
46
+ };
47
+
48
+ // / Data for on_mouse_drag_stop signal
49
+ struct mouse_drag_stop_data {
50
+ input::mouse_button button; // / Mouse button that generated this event (if more than one, only
51
+ // / the first pressed)
52
+ gui::vector2f position; // / Mouse position, in points
53
+ };
54
+
55
+ // / Data for on_key_pressed signal
56
+ struct key_pressed_data {
57
+ input::key key; // / Keyboard key that generated this event
58
+ };
59
+
60
+ // / Data for on_key_pressed_repeat signal
61
+ struct key_pressed_repeat_data {
62
+ input::key key; // / Keyboard key that generated this event
63
+ };
64
+
65
+ // / Data for on_key_released signal
66
+ struct key_released_data {
67
+ input::key key; // / Keyboard key that generated this event
68
+ };
69
+
70
+ // / Data for on_text_entered signal
71
+ struct text_entered_data {
72
+ std::uint32_t character; // / Unicode UTF-32 code point of the typed character
73
+ };
74
+
10
75
// / Stores signals for input events.
11
76
class signals {
12
77
public:
@@ -21,88 +86,59 @@ class signals {
21
86
22
87
/* *
23
88
* \brief Signal triggered when the mouse moves
24
- * \details Arguments:
25
- * - mouse motion that generated this event, in points
26
- * - mouse position, in points
27
89
*/
28
- utils::signal<void (const gui::vector2f&, const gui::vector2f &)> on_mouse_moved;
90
+ utils::signal<void (const mouse_moved_data &)> on_mouse_moved;
29
91
30
92
/* *
31
93
* \brief Signal triggered when the mouse wheel is moved
32
- * \details Arguments:
33
- * - mouse wheel motion that generated this event
34
- * - mouse position, in points
35
94
*/
36
- utils::signal<void (float , const gui::vector2f &)> on_mouse_wheel;
95
+ utils::signal<void (const mouse_wheel_data &)> on_mouse_wheel;
37
96
38
97
/* *
39
98
* \brief Signal triggered when a mouse button is pressed
40
- * \details Arguments:
41
- * - mouse button that generated this event
42
- * - mouse position, in points
43
99
*/
44
- utils::signal<void (input::mouse_button, const gui::vector2f &)> on_mouse_pressed;
100
+ utils::signal<void (const mouse_pressed_data &)> on_mouse_pressed;
45
101
46
102
/* *
47
103
* \brief Signal triggered when a mouse button is released
48
- * \details Arguments:
49
- * - mouse button that generated this event
50
- * - mouse position, in points
51
104
*/
52
- utils::signal<void (input::mouse_button, const gui::vector2f &)> on_mouse_released;
105
+ utils::signal<void (const mouse_released_data &)> on_mouse_released;
53
106
54
107
/* *
55
108
* \brief Signal triggered when a mouse button is double clicked
56
- * \details Arguments:
57
- * - mouse button that generated this event
58
- * - mouse position, in points
59
109
*/
60
- utils::signal<void (input::mouse_button, const gui::vector2f &)> on_mouse_double_clicked;
110
+ utils::signal<void (const mouse_double_clicked_data &)> on_mouse_double_clicked;
61
111
62
112
/* *
63
113
* \brief Signal triggered when the mouse starts a drag operation
64
- * \details Arguments:
65
- * - mouse button that is pressed (if more than one, only the first pressed)
66
- * - mouse position, in points
67
114
*/
68
- utils::signal<void (input::mouse_button, const gui::vector2f &)> on_mouse_drag_start;
115
+ utils::signal<void (const mouse_drag_start_data &)> on_mouse_drag_start;
69
116
70
117
/* *
71
118
* \brief Signal triggered when the mouse ends a drag operation
72
- * \details Arguments:
73
- * - mouse button that was pressed (if more than one, only the first pressed)
74
- * - mouse position, in points
75
119
*/
76
- utils::signal<void (input::mouse_button, const gui::vector2f &)> on_mouse_drag_stop;
120
+ utils::signal<void (const mouse_drag_stop_data &)> on_mouse_drag_stop;
77
121
78
122
/* *
79
123
* \brief Signal triggered when a keyboard key is pressed
80
- * \details Arguments:
81
- * - keyboard key that generated this event
82
124
*/
83
- utils::signal<void (input::key )> on_key_pressed;
125
+ utils::signal<void (const key_pressed_data& )> on_key_pressed;
84
126
85
127
/* *
86
128
* \brief Signal triggered when a keyboard key is long-pressed and repeats
87
- * \details Arguments:
88
- * - keyboard key that generated this event
89
129
*/
90
- utils::signal<void (input::key )> on_key_pressed_repeat;
130
+ utils::signal<void (const key_pressed_repeat_data& )> on_key_pressed_repeat;
91
131
92
132
/* *
93
133
* \brief Signal triggered when a keyboard key is released
94
- * \details Arguments:
95
- * - keyboard key that generated this event
96
134
*/
97
- utils::signal<void (input::key )> on_key_released;
135
+ utils::signal<void (const key_released_data& )> on_key_released;
98
136
99
137
/* *
100
138
* \brief Signal triggered when text is entered
101
- * \details Arguments:
102
- * - Unicode UTF-32 code point of the typed character
103
139
* \note The event will trigger repeatedly if more than one character is generated.
104
140
*/
105
- utils::signal<void (std:: uint32_t )> on_text_entered;
141
+ utils::signal<void (const text_entered_data& )> on_text_entered;
106
142
};
107
143
108
144
} // namespace lxgui::input
0 commit comments