CYD-UI
A C++ library for building native graphic user interfaces
Loading...
Searching...
No Matches
cydui_events.cppm
Go to the documentation of this file.
1
// Copyright (c) 2024, Víctor Castillo Agüero.
2
// SPDX-License-Identifier: GPL-3.0-or-later
3
4
module
;
5
#include <cyd_fabric_modules/headers/macros/async_events.h>
6
#include <SDL3/SDL_events.h>
7
8
export
module
cydui.events
;
9
10
export
import
std;
11
export
import
fabric.async;
12
export
import
cydui.dimensions
;
13
14
using
cydui::dimensions::screen_measure
;
15
16
export
{
17
EVENT
(RedrawEvent) {
18
unsigned
long
win = 0;
19
int
x = 0;
20
int
y = 0;
21
void
* component =
nullptr
;
22
};
23
24
EVENT
(ButtonEvent) {
25
const
unsigned
long
win = 0;
26
const
unsigned
int
button = 0;
27
const
screen_measure
x = 0;
28
const
screen_measure
y = 0;
29
const
bool
pressed =
false
;
30
const
bool
released =
false
;
31
const
bool
holding =
false
;
32
};
33
34
EVENT
(ScrollEvent) {
35
unsigned
long
win = 0;
36
const
screen_measure
dy = 0;
37
const
screen_measure
dx = 0;
38
const
screen_measure
x = 0;
39
const
screen_measure
y = 0;
40
};
41
42
EVENT
(MotionEvent) {
43
unsigned
long
win = 0;
44
const
screen_measure
x = 0;
45
const
screen_measure
y = 0;
46
bool
enter =
false
;
47
bool
exit =
false
;
48
49
bool
dragging =
false
;
50
};
51
52
EVENT
(ResizeEvent) {
53
unsigned
long
win = 0;
54
const
screen_measure
w = 0;
55
const
screen_measure
h = 0;
56
};
57
58
namespace
cydui
{
59
enum class
Button
{
60
PRIMARY
= 1,
61
SECONDARY
= 3,
62
WHEEL
= 2,
63
BUTTON1
=
PRIMARY
,
64
BUTTON2
=
WHEEL
,
65
BUTTON3
=
SECONDARY
,
66
};
67
}
68
69
using
Scancode
= SDL_Scancode;
70
using
Keycode
= SDL_Keycode;
71
using
Keymod
= Uint16;
72
73
struct
Keysym
{
74
Scancode
scancode
;
75
SDL_Keycode
code
;
76
Keymod
mod
;
77
};
78
79
EVENT
(KeyEvent) {
80
const
Keysym
keysym;
81
const
bool
pressed =
false
;
82
const
bool
released =
false
;
83
const
bool
holding =
false
;
84
};
85
86
EVENT
(TextInputEvent) {
87
std::string text =
""
;
88
bool
compositing_event =
false
;
89
struct
{
90
int
cursor{0};
91
int
selection{0};
92
} compositing_state { };
93
};
94
95
EVENT
(WindowClosed) {};
96
}
Keycode
SDL_Keycode Keycode
Definition
cydui_events.cppm:70
EVENT
EVENT(RedrawEvent)
Definition
cydui_events.cppm:17
Scancode
SDL_Scancode Scancode
Definition
cydui_events.cppm:69
Keymod
Uint16 Keymod
Definition
cydui_events.cppm:71
cydui.dimensions
cydui.events
cydui::dimensions::screen_measure
quantify::quantity_t< screen::pixel, double > screen_measure
Definition
_types.cppm:21
cydui
Definition
animations.cppm:32
cydui::Button
Button
Definition
cydui_events.cppm:59
cydui::Button::WHEEL
@ WHEEL
Definition
cydui_events.cppm:62
cydui::Button::SECONDARY
@ SECONDARY
Definition
cydui_events.cppm:61
cydui::Button::BUTTON1
@ BUTTON1
Definition
cydui_events.cppm:63
cydui::Button::PRIMARY
@ PRIMARY
Definition
cydui_events.cppm:60
cydui::Button::BUTTON2
@ BUTTON2
Definition
cydui_events.cppm:64
cydui::Button::BUTTON3
@ BUTTON3
Definition
cydui_events.cppm:65
Keysym
Definition
cydui_events.cppm:73
Keysym::scancode
Scancode scancode
Definition
cydui_events.cppm:74
Keysym::code
SDL_Keycode code
Definition
cydui_events.cppm:75
Keysym::mod
Keymod mod
Definition
cydui_events.cppm:76
include
cyd_ui
cydui_events.cppm
Generated by
1.13.2