svn update: 48958 (latest:48959)
[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    struct
101      {
102         int        device; /* 0 if normal mouse, 1+ for other mouse-devices (eg multi-touch - other fingers) */
103         double     radius, radius_x, radius_y; /* radius of press point - radius_x and y if its an ellipse (radius is the average of the 2) */
104         double     pressure; /* pressure - 1.0 == normal, > 1.0 == more, 0.0 == none */
105         double     angle; /* angle relative to perpendicular (0.0 == perpendicular), in degrees */
106         double     x, y; /* same as x, y root.x, root.y, but with sub-pixel precision, if available */
107         struct
108           {
109              double  x, y;
110           } root;
111      } multi;
112 };
113
114 typedef struct _Ecore_Event_Mouse_Wheel Ecore_Event_Mouse_Wheel;
115 struct _Ecore_Event_Mouse_Wheel
116 {
117    Ecore_Window  window;
118    Ecore_Window  root_window;
119    Ecore_Window  event_window;
120
121    unsigned int  timestamp;
122    unsigned int  modifiers;
123
124    int           same_screen;
125    int           direction;
126    int           z;
127
128    int           x;
129    int           y;
130    struct
131    {
132       int        x;
133       int        y;
134    } root;
135 };
136
137 typedef struct _Ecore_Event_Mouse_Move Ecore_Event_Mouse_Move;
138 struct _Ecore_Event_Mouse_Move
139 {
140    Ecore_Window  window;
141    Ecore_Window  root_window;
142    Ecore_Window  event_window;
143
144    unsigned int  timestamp;
145    unsigned int  modifiers;
146
147    int           same_screen;
148
149    int           x;
150    int           y;
151    struct
152    {
153       int        x;
154       int        y;
155    } root;
156
157    struct
158      {
159         int        device; /* 0 if normal mouse, 1+ for other mouse-devices (eg multi-touch - other fingers) */
160         double     radius, radius_x, radius_y; /* radius of press point - radius_x and y if its an ellipse (radius is the average of the 2) */
161         double     pressure; /* pressure - 1.0 == normal, > 1.0 == more, 0.0 == none */
162         double     angle; /* angle relative to perpendicular (0.0 == perpendicular), in degrees */
163         double     x, y; /* same as x, y root.x, root.y, but with sub-pixel precision, if available */
164         struct
165           {
166              double  x, y;
167           } root;
168      } multi;
169 };
170
171 typedef struct _Ecore_Event_Mouse_IO Ecore_Event_Mouse_IO;
172 struct _Ecore_Event_Mouse_IO
173 {
174    Ecore_Window  window;
175    Ecore_Window  event_window;
176
177    unsigned int  timestamp;
178    unsigned int  modifiers;
179
180    int           x;
181    int           y;
182 };
183
184 enum _Ecore_Event_Modifier
185 {
186   ECORE_NONE,
187   ECORE_SHIFT,
188   ECORE_CTRL,
189   ECORE_ALT,
190   ECORE_WIN,
191   ECORE_SCROLL,
192   ECORE_CAPS,
193   ECORE_LAST
194 };
195
196 enum _Ecore_Event_Press
197 {
198   ECORE_DOWN,
199   ECORE_UP
200 };
201
202 enum _Ecore_Event_IO
203 {
204   ECORE_IN,
205   ECORE_OUT
206 };
207
208 typedef enum _Ecore_Event_IO Ecore_Event_IO;
209 typedef enum _Ecore_Event_Press Ecore_Event_Press;
210 typedef enum _Ecore_Event_Modifier Ecore_Event_Modifier;
211
212 typedef struct _Ecore_Event_Modifiers Ecore_Event_Modifiers;
213 struct _Ecore_Event_Modifiers
214 {
215    unsigned int size;
216    unsigned int array[ECORE_LAST];
217 };
218
219 EAPI int         ecore_event_init(void);
220 EAPI int         ecore_event_shutdown(void);
221
222 EAPI unsigned int ecore_event_modifier_mask(Ecore_Event_Modifier modifier);
223 EAPI Ecore_Event_Modifier ecore_event_update_modifier(const char *key, Ecore_Event_Modifiers *modifiers, int inc);
224
225 #ifdef __cplusplus
226 }
227 #endif
228
229 #endif