62b7e5fd561774331f888c431044552382882bd4
[framework/uifw/ecore.git] / src / lib / ecore_input / Ecore_Input.h
1 /*
2  * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
3  */
4
5 #ifndef _ECORE_INPUT_H
6 #define _ECORE_INPUT_H
7
8
9 #ifdef EAPI
10 # undef EAPI
11 #endif
12
13 #ifdef _WIN32
14 # ifdef EFL_ECORE_INPUT_BUILD
15 #  ifdef DLL_EXPORT
16 #   define EAPI __declspec(dllexport)
17 #  else
18 #   define EAPI
19 #  endif /* ! DLL_EXPORT */
20 # else
21 #  define EAPI __declspec(dllimport)
22 # endif /* ! EFL_ECORE_INPUT_BUILD */
23 #else
24 # ifdef __GNUC__
25 #  if __GNUC__ >= 4
26 #   define EAPI __attribute__ ((visibility("default")))
27 #  else
28 #   define EAPI
29 #  endif
30 # else
31 #  define EAPI
32 # endif
33 #endif
34
35 #ifdef __cplusplus
36 extern "C" {
37 #endif
38
39 EAPI extern int ECORE_EVENT_KEY_DOWN;
40 EAPI extern int ECORE_EVENT_KEY_UP;
41 EAPI extern int ECORE_EVENT_MOUSE_BUTTON_DOWN;
42 EAPI extern int ECORE_EVENT_MOUSE_BUTTON_UP;
43 EAPI extern int ECORE_EVENT_MOUSE_MOVE;
44 EAPI extern int ECORE_EVENT_MOUSE_WHEEL;
45 EAPI extern int ECORE_EVENT_MOUSE_IN;
46 EAPI extern int ECORE_EVENT_MOUSE_OUT;
47
48 #define ECORE_EVENT_MODIFIER_SHIFT      0x0001
49 #define ECORE_EVENT_MODIFIER_CTRL       0x0002
50 #define ECORE_EVENT_MODIFIER_ALT        0x0004
51 #define ECORE_EVENT_MODIFIER_WIN        0x0008
52 #define ECORE_EVENT_MODIFIER_SCROLL     0x0010
53 #define ECORE_EVENT_MODIFIER_NUM        0x0020
54 #define ECORE_EVENT_MODIFIER_CAPS       0x0040
55 #define ECORE_EVENT_LOCK_SCROLL         0x0080
56 #define ECORE_EVENT_LOCK_NUM            0x0100
57 #define ECORE_EVENT_LOCK_CAPS           0x0200
58
59 typedef uintptr_t Ecore_Window;
60
61 typedef struct _Ecore_Event_Key Ecore_Event_Key;
62 struct _Ecore_Event_Key
63 {
64    const char   *keyname;
65    const char   *key;
66    const char   *string;
67    const char   *compose;
68    Ecore_Window  window;
69    Ecore_Window  root_window;
70    Ecore_Window  event_window;
71
72    unsigned int  timestamp;
73    unsigned int  modifiers;
74
75    int           same_screen;
76 };
77
78 typedef struct _Ecore_Event_Mouse_Button Ecore_Event_Mouse_Button;
79 struct _Ecore_Event_Mouse_Button
80 {
81    Ecore_Window  window;
82    Ecore_Window  root_window;
83    Ecore_Window  event_window;
84
85    unsigned int  timestamp;
86    unsigned int  modifiers;
87    unsigned int  buttons;
88    unsigned int  double_click;
89    unsigned int  triple_click;
90    int           same_screen;
91
92    int           x;
93    int           y;
94    struct
95    {
96       int        x;
97       int        y;
98    } root;
99 };
100
101 typedef struct _Ecore_Event_Mouse_Wheel Ecore_Event_Mouse_Wheel;
102 struct _Ecore_Event_Mouse_Wheel
103 {
104    Ecore_Window  window;
105    Ecore_Window  root_window;
106    Ecore_Window  event_window;
107
108    unsigned int  timestamp;
109    unsigned int  modifiers;
110
111    int           same_screen;
112    int           direction;
113    int           z;
114
115    int           x;
116    int           y;
117    struct
118    {
119       int        x;
120       int        y;
121    } root;
122 };
123
124 typedef struct _Ecore_Event_Mouse_Move Ecore_Event_Mouse_Move;
125 struct _Ecore_Event_Mouse_Move
126 {
127    Ecore_Window  window;
128    Ecore_Window  root_window;
129    Ecore_Window  event_window;
130
131    unsigned int  timestamp;
132    unsigned int  modifiers;
133
134    int           same_screen;
135
136    int           x;
137    int           y;
138    struct
139    {
140       int        x;
141       int        y;
142    } root;
143 };
144
145 typedef struct _Ecore_Event_Mouse_IO Ecore_Event_Mouse_IO;
146 struct _Ecore_Event_Mouse_IO
147 {
148    Ecore_Window  window;
149    Ecore_Window  event_window;
150
151    unsigned int  timestamp;
152    unsigned int  modifiers;
153
154    int           x;
155    int           y;
156 };
157
158 enum _Ecore_Event_Modifier
159 {
160   ECORE_NONE,
161   ECORE_SHIFT,
162   ECORE_CTRL,
163   ECORE_ALT,
164   ECORE_WIN,
165   ECORE_SCROLL,
166   ECORE_CAPS,
167   ECORE_LAST
168 };
169
170 enum _Ecore_Event_Press
171 {
172   ECORE_DOWN,
173   ECORE_UP
174 };
175
176 enum _Ecore_Event_IO
177 {
178   ECORE_IN,
179   ECORE_OUT
180 };
181
182 typedef enum _Ecore_Event_IO Ecore_Event_IO;
183 typedef enum _Ecore_Event_Press Ecore_Event_Press;
184 typedef enum _Ecore_Event_Modifier Ecore_Event_Modifier;
185
186 typedef struct _Ecore_Event_Modifiers Ecore_Event_Modifiers;
187 struct _Ecore_Event_Modifiers
188 {
189    unsigned int size;
190    unsigned int array[ECORE_LAST];
191 };
192
193 EAPI int         ecore_event_init(void);
194 EAPI int         ecore_event_shutdown(void);
195
196 EAPI unsigned int ecore_event_modifier_mask(Ecore_Event_Modifier modifier);
197 EAPI Ecore_Event_Modifier ecore_event_update_modifier(const char *key, Ecore_Event_Modifiers *modifiers, int inc);
198
199 #ifdef __cplusplus
200 }
201 #endif
202
203 #endif