1 #if !defined(_BTK_EVENT_HPP_) 2 #define _BTK_EVENT_HPP_ 9 struct SDL_MouseButtonEvent;
49 UserMax = UINT32_MAX - 1,
57 static Type Register();
58 Type type()
const noexcept{
78 void accept() noexcept{
81 void reject() noexcept{
116 bool is_pressed()
const noexcept{
117 return state == Pressed;
119 bool is_released()
const noexcept{
120 return state == Released;
122 bool is_up()
const noexcept{
123 return state == Pressed;
125 bool is_down()
const noexcept{
126 return state == Released;
128 Vec2 position()
const noexcept{
145 bool is_right()
const noexcept{
146 return value == SDL_BUTTON_RIGHT;
148 bool is_left()
const noexcept{
149 return value == SDL_BUTTON_LEFT;
151 bool is_middle()
const noexcept{
152 return value == SDL_BUTTON_MIDDLE;
191 bool has_kmod(Keymode mode)
const noexcept{
192 return static_cast<bool>(keymode & mode);
201 Event(Type::SetRect),
206 Vec2 position()
const noexcept{
207 return {rect.x,rect.y};
217 MotionEvent(Event::Type type = Event::Type::Motion):
219 MotionEvent(
const MotionEvent &) =
default;
229 Vec2 position()
const noexcept{
239 std::string_view text;
245 size_t length()
const noexcept;
261 DragEvent(Event::Type type,
int x,
int y,
int xrel,
int yrel):
293 WheelEvent(
const WheelEvent &) =
default;
326 #endif // _BTK_EVENT_HPP_ bool is_accepted() const noexcept
is accepted
Definition: event.hpp:75
KeyEvent()
Construct a new Key Event object.
Definition: event.hpp:178
Uint8 clicks
Clicks count.
Definition: event.hpp:159
void PushEvent(Event *event, Window &receiver)
Push event to queue.
Definition: event.cpp:63
a SDL_Rect with methods
Definition: rect.hpp:10
MouseEvent()
Construct a new Mouse Event object.
Definition: event.hpp:112
This header include many useful containers.
Definition: async.hpp:7
A Basic Window.
Definition: window.hpp:20
A Event of text input.
Definition: event.hpp:237
A event about mouse click.
Definition: event.hpp:106
void set_type(Type t) noexcept
Chaneg the event type.
Definition: event.hpp:90
A event about keyboard.
Definition: event.hpp:171
A event about mouse drag.
Definition: event.hpp:251
bool SendEvent(Event &event, Window &receiver)
Dispatched event right now.
Definition: event.cpp:74
A event about set Widget rect.
Definition: event.hpp:199
void DispatchEvent(const SDL_Event &ev, void *)
This function was called by System to dispatch our event.
Definition: event.cpp:81
DragEvent(Event::Type type, const MotionEvent &motion)
Construct a new Drag Event object from MotionEvent.
Definition: event.hpp:273
A event about mouse motion.
Definition: event.hpp:216
A base event of all events.
Definition: event.hpp:17
Definition: event.hpp:287
int x
Mouse position.
Definition: event.hpp:164
DragEvent(Event::Type type, int x, int y, int xrel, int yrel)
Construct a new Drag Event object.
Definition: event.hpp:261