istereo2

view libs/goatkit/event.h @ 14:018f997dc646

button done
author John Tsiombikas <nuclear@member.fsf.org>
date Tue, 29 Sep 2015 01:11:54 +0300
parents
children
line source
1 /*
2 GoatKit - a themable/animated widget toolkit for games
3 Copyright (C) 2014 John Tsiombikas <nuclear@member.fsf.org>
5 This program is free software: you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as published by
7 the Free Software Foundation, either version 3 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18 #ifndef EVENT_H_
19 #define EVENT_H_
21 #include "vec.h"
23 namespace goatkit {
25 enum EventType {
26 // primary events
27 EV_MOUSE_BUTTON,
28 EV_MOUSE_MOTION,
29 EV_MOUSE_FOCUS,
30 EV_KEY,
32 // derived events
33 EV_CLICK,
34 EV_DOUBLE_CLICK,
35 EV_CHANGE,
37 NUM_EVENTS
38 };
40 enum SpecialKeys {
41 KEY_ESCAPE = 27,
42 KEY_DELETE = 127,
44 KEY_F1 = 256, KEY_F2, KEY_F3, KEY_F4, KEY_F5, KEY_F6,
45 KEY_F7, KEY_F8, KEY_F9, KEY_F10, KEY_F11, KEY_F12,
46 KEY_LEFT, KEY_RIGHT, KEY_UP, KEY_DOWN,
47 KEY_HOME, KEY_END, KEY_PGUP, KEY_PGDOWN,
48 KEY_INSERT
49 };
51 struct ButtonEvent {
52 Vec2 pos;
53 int button;
54 bool press;
55 };
57 struct MotionEvent {
58 Vec2 pos;
59 };
61 struct FocusEvent {
62 bool enter;
63 };
65 struct KeyEvent {
66 int key;
67 bool press;
68 };
70 struct Event {
71 EventType type;
73 ButtonEvent button;
74 MotionEvent motion;
75 FocusEvent focus;
76 KeyEvent key;
77 };
79 const char *event_type_name(EventType type);
81 } // namespace goatkit
83 #endif // EVENT_H_