Tizen 2.1 base
[framework/uifw/ecore.git] / src / lib / ecore_input / Ecore_Input.h
1 #ifndef _ECORE_INPUT_H
2 #define _ECORE_INPUT_H
3
4 #ifdef _WIN32
5 # include <stddef.h>
6 #else
7 # include <inttypes.h>
8 #endif
9
10 #include <Eina.h>
11
12 #ifdef EAPI
13 # undef EAPI
14 #endif
15
16 #ifdef _WIN32
17 # ifdef EFL_ECORE_INPUT_BUILD
18 #  ifdef DLL_EXPORT
19 #   define EAPI __declspec(dllexport)
20 #  else
21 #   define EAPI
22 #  endif /* ! DLL_EXPORT */
23 # else
24 #  define EAPI __declspec(dllimport)
25 # endif /* ! EFL_ECORE_INPUT_BUILD */
26 #else
27 # ifdef __GNUC__
28 #  if __GNUC__ >= 4
29 #   define EAPI __attribute__ ((visibility("default")))
30 #  else
31 #   define EAPI
32 #  endif
33 # else
34 #  define EAPI
35 # endif
36 #endif
37
38 #ifdef __cplusplus
39 extern "C" {
40 #endif
41
42    EAPI extern int ECORE_EVENT_KEY_DOWN;
43    EAPI extern int ECORE_EVENT_KEY_UP;
44    EAPI extern int ECORE_EVENT_MOUSE_BUTTON_DOWN;
45    EAPI extern int ECORE_EVENT_MOUSE_BUTTON_UP;
46    EAPI extern int ECORE_EVENT_MOUSE_MOVE;
47    EAPI extern int ECORE_EVENT_MOUSE_WHEEL;
48    EAPI extern int ECORE_EVENT_MOUSE_IN;
49    EAPI extern int ECORE_EVENT_MOUSE_OUT;
50
51 #define ECORE_EVENT_MODIFIER_SHIFT      0x0001
52 #define ECORE_EVENT_MODIFIER_CTRL       0x0002
53 #define ECORE_EVENT_MODIFIER_ALT        0x0004
54 #define ECORE_EVENT_MODIFIER_WIN        0x0008
55 #define ECORE_EVENT_MODIFIER_SCROLL     0x0010
56 #define ECORE_EVENT_MODIFIER_NUM        0x0020
57 #define ECORE_EVENT_MODIFIER_CAPS       0x0040
58 #define ECORE_EVENT_LOCK_SCROLL         0x0080
59 #define ECORE_EVENT_LOCK_NUM            0x0100
60 #define ECORE_EVENT_LOCK_CAPS           0x0200
61 #define ECORE_EVENT_LOCK_SHIFT          0x0300
62 #define ECORE_EVENT_MODIFIER_ALTGR      0x0400 /**< @since 1.7 */
63
64    typedef uintptr_t                        Ecore_Window;
65    typedef struct _Ecore_Event_Key          Ecore_Event_Key;
66    typedef struct _Ecore_Event_Mouse_Button Ecore_Event_Mouse_Button;
67    typedef struct _Ecore_Event_Mouse_Wheel  Ecore_Event_Mouse_Wheel;
68    typedef struct _Ecore_Event_Mouse_Move   Ecore_Event_Mouse_Move;
69    typedef struct _Ecore_Event_Mouse_IO     Ecore_Event_Mouse_IO;
70    typedef struct _Ecore_Event_Modifiers    Ecore_Event_Modifiers;
71    
72    typedef enum _Ecore_Event_Modifier
73      {
74         ECORE_NONE,
75         ECORE_SHIFT,
76         ECORE_CTRL,
77         ECORE_ALT,
78         ECORE_WIN,
79         ECORE_SCROLL,
80         ECORE_CAPS,
81         ECORE_MODE, /**< @since 1.7 */
82         ECORE_LAST
83      } Ecore_Event_Modifier;
84
85    typedef enum _Ecore_Event_Press
86      {
87         ECORE_DOWN,
88         ECORE_UP
89      } Ecore_Event_Press;
90
91    typedef enum _Ecore_Event_IO
92      {
93         ECORE_IN,
94         ECORE_OUT
95      } Ecore_Event_IO;
96
97    typedef enum _Ecore_Compose_State
98      {   
99         ECORE_COMPOSE_NONE,
100         ECORE_COMPOSE_MIDDLE,
101         ECORE_COMPOSE_DONE
102      } Ecore_Compose_State;
103
104    struct _Ecore_Event_Key
105      {
106         const char      *keyname;
107         const char      *key;
108         const char      *string;
109         const char      *compose;
110         Ecore_Window     window;
111         Ecore_Window     root_window;
112         Ecore_Window     event_window;
113         
114         unsigned int     timestamp;
115         unsigned int     modifiers;
116         
117         int              same_screen;
118      };
119
120    struct _Ecore_Event_Mouse_Button
121      {
122         Ecore_Window     window;
123         Ecore_Window     root_window;
124         Ecore_Window     event_window;
125         
126         unsigned int     timestamp;
127         unsigned int     modifiers;
128         unsigned int     buttons;
129         unsigned int     double_click;
130         unsigned int     triple_click;
131         int              same_screen;
132         
133         int              x;
134         int              y;
135         struct {
136            int           x;
137            int           y;
138         } root;
139         
140         struct {
141            int           device; /* 0 if normal mouse, 1+ for other mouse-devices (eg multi-touch - other fingers) */
142            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) */
143            double        pressure; /* pressure - 1.0 == normal, > 1.0 == more, 0.0 == none */
144            double        angle; /* angle relative to perpendicular (0.0 == perpendicular), in degrees */
145            double        x, y; /* same as x, y root.x, root.y, but with sub-pixel precision, if available */
146            struct {
147               double     x, y;
148            } root;
149         } multi;
150      };
151    
152    struct _Ecore_Event_Mouse_Wheel
153      {
154         Ecore_Window     window;
155         Ecore_Window     root_window;
156         Ecore_Window     event_window;
157         
158         unsigned int     timestamp;
159         unsigned int     modifiers;
160         
161         int              same_screen;
162         int              direction;
163         int              z;
164         
165         int              x;
166         int              y;
167         struct {
168            int           x;
169            int           y;
170         } root;
171      };
172    
173    struct _Ecore_Event_Mouse_Move
174      {
175         Ecore_Window     window;
176         Ecore_Window     root_window;
177         Ecore_Window     event_window;
178         
179         unsigned int     timestamp;
180         unsigned int     modifiers;
181         
182         int              same_screen;
183         
184         int              x;
185         int              y;
186         struct {
187            int           x;
188            int           y;
189         } root;
190         
191         struct {
192            int           device; /* 0 if normal mouse, 1+ for other mouse-devices (eg multi-touch - other fingers) */
193            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) */
194            double        pressure; /* pressure - 1.0 == normal, > 1.0 == more, 0.0 == none */
195            double        angle; /* angle relative to perpendicular (0.0 == perpendicular), in degrees */
196            double        x, y; /* same as x, y root.x, root.y, but with sub-pixel precision, if available */
197            struct {
198               double     x, y;
199            } root;
200         } multi;
201      };
202    
203    struct _Ecore_Event_Mouse_IO
204      {
205         Ecore_Window     window;
206         Ecore_Window     event_window;
207         
208         unsigned int     timestamp;
209         unsigned int     modifiers;
210         
211         int              x;
212         int              y;
213      };
214
215    struct _Ecore_Event_Modifiers
216      {
217         unsigned int size;
218         unsigned int array[ECORE_LAST];
219      };
220    
221    EAPI int                  ecore_event_init(void);
222    EAPI int                  ecore_event_shutdown(void);
223    
224    EAPI unsigned int         ecore_event_modifier_mask(Ecore_Event_Modifier modifier);
225    EAPI Ecore_Event_Modifier ecore_event_update_modifier(const char *key, Ecore_Event_Modifiers *modifiers, int inc);
226
227    /**
228     * @since 1.7
229     */
230    EAPI Ecore_Compose_State  ecore_compose_get(const Eina_List *seq, char **seqstr_ret);
231    
232 #ifdef __cplusplus
233 }
234 #endif
235
236 #endif