1 |
dpavlin |
1 |
/* |
2 |
|
|
* HT Editor |
3 |
|
|
* event.h |
4 |
|
|
* |
5 |
|
|
* Copyright (C) 2004 Stefan Weyergraf |
6 |
|
|
* |
7 |
|
|
* This program is free software; you can redistribute it and/or modify |
8 |
|
|
* it under the terms of the GNU General Public License version 2 as |
9 |
|
|
* published by the Free Software Foundation. |
10 |
|
|
* |
11 |
|
|
* This program is distributed in the hope that it will be useful, |
12 |
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 |
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14 |
|
|
* GNU General Public License for more details. |
15 |
|
|
* |
16 |
|
|
* You should have received a copy of the GNU General Public License |
17 |
|
|
* along with this program; if not, write to the Free Software |
18 |
|
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
19 |
|
|
*/ |
20 |
|
|
|
21 |
|
|
#ifndef __SYSTEM_EVENT_H__ |
22 |
|
|
#define __SYSTEM_EVENT_H__ |
23 |
|
|
|
24 |
|
|
#include "system/types.h" |
25 |
|
|
#include "tools/data.h" |
26 |
|
|
|
27 |
|
|
enum SystemEventType { |
28 |
|
|
sysevNone = 0, |
29 |
|
|
sysevKey, |
30 |
|
|
sysevMouse |
31 |
|
|
}; |
32 |
|
|
|
33 |
|
|
enum SystemMouseEventType { |
34 |
|
|
sme_buttonPressed, |
35 |
|
|
sme_buttonReleased, |
36 |
|
|
sme_motionNotify |
37 |
|
|
}; |
38 |
|
|
|
39 |
|
|
struct SystemEvent { |
40 |
|
|
SystemEventType type; |
41 |
|
|
union { |
42 |
|
|
struct { |
43 |
|
|
SystemMouseEventType type; |
44 |
|
|
int x; |
45 |
|
|
int y; |
46 |
|
|
int relx; |
47 |
|
|
int rely; |
48 |
|
|
bool button1; // left mouse button |
49 |
|
|
bool button2; // right mouse button |
50 |
|
|
bool button3; // middle mouse button |
51 |
|
|
int dbutton; // mouse button that changed since last sysevMouse (0 if none) |
52 |
|
|
} mouse; |
53 |
|
|
struct { |
54 |
|
|
uint keycode; |
55 |
|
|
bool pressed; |
56 |
|
|
char chr; |
57 |
|
|
} key; |
58 |
|
|
}; |
59 |
|
|
}; |
60 |
|
|
|
61 |
|
|
class SystemEventObject: public Object { |
62 |
|
|
public: |
63 |
|
|
SystemEvent mEv; |
64 |
|
|
|
65 |
|
|
SystemEventObject(const SystemEvent &ev) : mEv(ev) {} |
66 |
|
|
}; |
67 |
|
|
|
68 |
|
|
typedef bool (*SystemEventHandler)(const SystemEvent &ev); |
69 |
|
|
|
70 |
|
|
#endif /* __SYSTEM_EVENT_H__ */ |