21 enum struct GEventType : uint32_t {
49 inline GEventType operator|(GEventType a, GEventType b) {
50 return GEventType(uint32_t(a) | uint32_t(b));
52 inline GEventType operator&(GEventType a, GEventType b) {
53 return GEventType(uint32_t(a) & uint32_t(b));
55 inline bool operator==(GEventType a,
int b) {
return uint32_t(a) == uint32_t(b);}
56 inline bool operator!=(GEventType a,
int b) {
return uint32_t(a) != uint32_t(b);}
64 enum struct GEventState : uint32_t {
79 inline GEventState operator|(GEventState a, GEventState b) {
80 return GEventState(uint32_t(a) | uint32_t(b));
82 inline GEventState operator&(GEventState a, GEventState b) {
83 return GEventState(uint32_t(a) & uint32_t(b));
85 inline bool operator==(GEventState a,
int b) {
return uint32_t(a) == uint32_t(b);}
86 inline bool operator!=(GEventState a,
int b) {
return uint32_t(a) != uint32_t(b);}
99 EscapeKey, TabKey, BackspaceKey, SpaceKey, ReturnKey, EnterKey, DeleteKey,
100 LeftKey, RightKey, UpKey, DownKey, HomeKey, EndKey,
101 CtrlKey, ShiftKey, AltKey, AltGrKey, MetaKey, CapsKey, NumKey;
120 virtual GKeyEvent* toKeyEvent() {
return nullptr;}
121 virtual GTouchEvent* toTouchEvent() {
return nullptr;}
122 virtual GGestureEvent* toGestureEvent() {
return nullptr;}
136 Gadget&
from()
const;
137 GBox& fromBox()
const;
138 GProp& fromProp()
const;
167 GTime
time()
const {
return time_;}
189 static void setMouseMotionHandler(
int channel, std::function<
bool(
class GMouseEvent&)>);
190 static void setWheelHandler(
int channel, std::function<
bool(
class GMouseEvent&)>);
191 static void setKeyHandler(
int channel, std::function<
bool(
class GKeyEvent&)>);
197 static GKeyCode nameToKey(GString
const& key_name);
217 bool hasGuard()
const {
return hasguard_;}
218 bool guardDone()
const {
return guarddone_;}
220 GTrigger
const* trigger_{};
221 bool hasguard_{}, guarddone_{}, reshapeinter_{};
225 GObject *aux_{}, *tag_{};
227 std::function<void(GEvent&)> postfire_{};
245 float x()
const {
return pos().x;}
246 float y()
const {
return pos().y;}
252 float wx()
const {
return wpos_.x;}
253 float wy()
const {
return wpos_.y;}
258 float dx()
const {
return dx_;}
259 float dy()
const {
return dy_;}
276 GEventState
state()
const {
return state_;}
281 bool ctrlPressed()
const {
return (state_ & GEventState::Ctrl) != 0;}
282 bool metaPressed()
const {
return (state_ & GEventState::Meta) != 0;}
294 int button_{}, clickcount_{};
295 GEventState state_{};
308 GKeyEvent& asKeyEvent()
override {
return *
this;}
309 GKeyEvent* toKeyEvent()
override {
return this;}
311 bool shiftMod()
const {
return (state_ & GEventState::Shift) != 0;}
312 bool ctrlMod()
const {
return (state_ & GEventState::Ctrl) != 0;}
313 bool metaMod()
const {
return (state_ & GEventState::Meta) != 0;}
316 GEventState
state()
const {
return state_;}
320 GKeyCode
key()
const {
return key_;}
325 GString
const&
text()
const {
return text_;}
329 GEventState state_{};
341 enum Type {Down, Up, Motion};
345 GTouchEvent& asTouchEvent()
override {
return *
this;}
346 GTouchEvent* toTouchEvent()
override {
return this;}
349 int64_t touchID_{}, fingerID_{};
369 float dist_{}, theta_{};