[Tizen] Add codes for Dali Windows Backend
[platform/core/uifw/dali-adaptor.git] / dali / internal / window-system / windows / event-system-win.h
1 #pragma once\r
2 #ifndef _WINDOWEVENTSYSTEM_H_\r
3 #define _WINDOWEVENTSYSTEM_H_\r
4 \r
5 #define EVENT_MOUSE_BUTTON_DOWN   WM_LBUTTONDOWN\r
6 #define EVENT_MOUSE_BUTTON_UP     WM_LBUTTONUP\r
7 #define EVENT_MOUSE_MOVE          WM_MOUSEMOVE\r
8 #define EVENT_MOUSE_OUT           WM_MOUSELEAVE\r
9 #define EVENT_MOUSE_WHEEL         WM_MOUSEWHEEL\r
10 \r
11 #define EVENT_KEY_DOWN            WM_KEYDOWN\r
12 #define EVENT_KEY_UP              WM_KEYUP\r
13 \r
14 #define WIN_EVENT_WINDOW_FOCUS_IN   WM_SETFOCUS\r
15 #define WIN_EVENT_WINDOW_FOCUS_OUT  WM_KILLFOCUS\r
16 \r
17 #define WIN_EVENT_WINDOW_DAMAGE     WM_PAINT\r
18 \r
19 #define WIN_EVENT_XDND_ENTER        0\r
20 #define WIN_EVENT_XDND_POSITION     0\r
21 #define WIN_EVENT_XDND_LEAVE        0\r
22 #define WIN_EVENT_XDND_DROP         0\r
23 \r
24 #define WIN_EVENT_XDND_FINISHED     0\r
25 #define WIN_EVENT_XDND_STATUS       0\r
26 \r
27 #define WIN_EVENT_CLIENT_MESSAGE    0\r
28 #define WIN_EVENT_SELECTION_CLEAR   0\r
29 #define WIN_EVENT_SELECTION_NOTIFY  0\r
30 \r
31 #define CALLBACK_PASS_ON true;\r
32 \r
33 #define EVENT_MODIFIER_SHIFT      0x0001\r
34 #define EVENT_MODIFIER_CTRL       0x0002\r
35 #define EVENT_MODIFIER_ALT        0x0004\r
36 #define EVENT_MODIFIER_WIN        0x0008\r
37 #define EVENT_MODIFIER_SCROLL     0x0010\r
38 #define EVENT_MODIFIER_NUM        0x0020\r
39 #define EVENT_MODIFIER_CAPS       0x0040\r
40 #define EVENT_LOCK_SCROLL         0x0080\r
41 #define EVENT_LOCK_NUM            0x0100\r
42 #define EVENT_LOCK_CAPS           0x0200\r
43 #define EVENT_LOCK_SHIFT          0x0300\r
44 #define EVENT_MODIFIER_ALTGR      0x0400 /**< @since 1.7 */\r
45 \r
46 #define DEVICE_MOUSE                    0\r
47 \r
48 // INTERNAL INCLUDES\r
49 #include <dali/internal/window-system/windows/platform-implement-win.h>\r
50 \r
51 namespace Dali\r
52 {\r
53 \r
54 namespace Internal\r
55 {\r
56 \r
57 namespace Adaptor\r
58 {\r
59 \r
60 typedef enum\r
61 {\r
62     IMF_KEYBOARD_MODIFIER_NONE = 0,      /**< No active modifiers */\r
63     IMF_KEYBOARD_MODIFIER_CTRL = 1 << 0, /**< "Control" is pressed */\r
64     IMF_KEYBOARD_MODIFIER_ALT = 1 << 1, /**< "Alt" is pressed */\r
65     IMF_KEYBOARD_MODIFIER_SHIFT = 1 << 2, /**< "Shift" is pressed */\r
66     IMF_KEYBOARD_MODIFIER_WIN = 1 << 3, /**< "Win" (between "Ctrl" and "Alt") is pressed */\r
67     IMF_KEYBOARD_MODIFIER_ALTGR = 1 << 4  /**< "AltGr" is pressed @since 1.7 */\r
68 } IMF_Keyboard_Modifiers;\r
69 \r
70 struct _Event_Key\r
71 {\r
72     const char      *keyname; /**< The key name */\r
73     const char      *key; /**< The key symbol */\r
74     const char      *string;\r
75     const char      *compose; /**< final string corresponding to the key symbol composed */\r
76     winWindow       window; /**< The main window where event happened */\r
77     winWindow       root_window; /**< The root window where event happened */\r
78     winWindow       event_window; /**< The child window where event happened */\r
79 \r
80     unsigned int    timestamp; /**< Time when the event occurred */\r
81 \r
82     unsigned int    keycode; /**< Key scan code numeric value @since 1.10 */\r
83 \r
84     void            *data; /**< User data associated with an Event_Key @since 1.10 */\r
85 };\r
86 \r
87 /**\r
88 * @struct _Event_Mouse_Button\r
89 * Contains information about an Ecore mouse button event.\r
90 */\r
91 \r
92 struct _Event_Mouse_Button\r
93 {\r
94     winWindow     window; /**< The main window where event happened */\r
95 \r
96     unsigned int     timestamp; /**< Time when the event occurred */\r
97     unsigned int     buttons; /**< The button that was used */\r
98 \r
99     int              x; /**< x coordinate relative to window where event happened */\r
100     int              y; /**< y coordinate relative to window where event happened */\r
101 \r
102     struct\r
103     {\r
104         int           device; /**< 0 if normal mouse, 1+ for other mouse-devices (eg multi-touch - other fingers) */\r
105         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) */\r
106         double        pressure; /**< pressure - 1.0 == normal, > 1.0 == more, 0.0 == none */\r
107         double        angle; /**< angle relative to perpendicular (0.0 == perpendicular), in degrees */\r
108         double        x, y; /**< same as x, y, but with sub-pixel precision, if available */\r
109         struct\r
110         {\r
111             double     x, y;\r
112         } root; /**< same as root.x, root.y, but with sub-pixel precision, if available */\r
113     } multi;\r
114 };\r
115 \r
116 /**\r
117 * @struct _Event_Mouse_Wheel\r
118 * Contains information about an Ecore mouse wheel event.\r
119 */\r
120 struct _Event_Mouse_Wheel\r
121 {\r
122     winWindow     window; /**< The main window where event happened */\r
123     winWindow     root_window; /**< The root window where event happened */\r
124     winWindow     event_window; /**< The child window where event happened */\r
125 \r
126     unsigned int     timestamp; /**< Time when the event occurred */\r
127     unsigned int     modifiers; /**< The combination of modifiers key (SHIFT,CTRL,ALT,..)*/\r
128 \r
129     int              direction; /**< Orientation of the wheel (horizontal/vertical) */\r
130     int              z; /**< Value of the wheel event (+1/-1) */\r
131 \r
132     int              x; /**< x coordinate relative to window where event happened */\r
133     int              y; /**< y coordinate relative to window where event happened */\r
134     struct\r
135     {\r
136         int           x;\r
137         int           y;\r
138     } root; /**< Coordinates relative to root window */\r
139 };\r
140 \r
141 /**\r
142 * @struct _Event_Mouse_Move\r
143 * Contains information about an Ecore mouse move event.\r
144 */\r
145 struct _Event_Mouse_Move\r
146 {\r
147     winWindow     window; /**< The main window where event happened */\r
148     winWindow     root_window; /**< The root window where event happened */\r
149     winWindow     event_window; /**< The child window where event happened */\r
150 \r
151     unsigned int     timestamp; /**< Time when the event occurred */\r
152     unsigned int     modifiers; /**< The combination of modifiers key (SHIFT,CTRL,ALT,..)*/\r
153 \r
154     int              x; /**< x coordinate relative to window where event happened */\r
155     int              y; /**< y coordinate relative to window where event happened */\r
156     struct\r
157     {\r
158         int           x;\r
159         int           y;\r
160     } root; /**< Coordinates relative to root window */\r
161 \r
162     struct\r
163     {\r
164         int           device; /**< 0 if normal mouse, 1+ for other mouse-devices (eg multi-touch - other fingers) */\r
165         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) */\r
166         double        pressure; /**< pressure - 1.0 == normal, > 1.0 == more, 0.0 == none */\r
167         double        angle; /**< angle relative to perpendicular (0.0 == perpendicular), in degrees */\r
168         double        x, y; /**< same as x, y root.x, root.y, but with sub-pixel precision, if available */\r
169         struct\r
170         {\r
171             double     x, y;\r
172         } root;\r
173     } multi;\r
174 };\r
175 \r
176 typedef enum _Win_Event_Mode\r
177 {\r
178     WIN_EVENT_MODE_NORMAL,\r
179     WIN_EVENT_MODE_WHILE_GRABBED,\r
180     WIN_EVENT_MODE_GRAB,\r
181     WIN_EVENT_MODE_UNGRAB\r
182 } Win_Event_Mode;\r
183 \r
184 typedef enum _Win_Event_Detail\r
185 {\r
186     WIN_EVENT_DETAIL_ANCESTOR,\r
187     WIN_EVENT_DETAIL_VIRTUAL,\r
188     WIN_EVENT_DETAIL_INFERIOR,\r
189     WIN_EVENT_DETAIL_NON_LINEAR,\r
190     WIN_EVENT_DETAIL_NON_LINEAR_VIRTUAL,\r
191     WIN_EVENT_DETAIL_POINTER,\r
192     WIN_EVENT_DETAIL_POINTER_ROOT,\r
193     WIN_EVENT_DETAIL_DETAIL_NONE\r
194 } Win_Event_Detail;\r
195 \r
196 typedef unsigned int Win_Time;\r
197 \r
198 struct _Win_Event_Mouse_In\r
199 {\r
200     int                  modifiers;\r
201     int                  x, y;\r
202 \r
203     struct\r
204     {\r
205         int x, y;\r
206     } root;\r
207     winWindow       win;\r
208     winWindow       event_win;\r
209     winWindow       root_win;\r
210     Win_Event_Mode   mode;\r
211     Win_Event_Detail detail;\r
212     Win_Time         time;\r
213 };\r
214 \r
215 struct _Win_Event_Mouse_Out\r
216 {\r
217     int                  modifiers;\r
218     int                  x, y;\r
219 \r
220     struct\r
221     {\r
222         int x, y;\r
223     } root;\r
224     winWindow       win;\r
225     winWindow       event_win;\r
226     winWindow       root_win;\r
227     Win_Event_Mode   mode;\r
228     Win_Event_Detail detail;\r
229     Win_Time         time;\r
230 };\r
231 \r
232 struct _Win_Event_Window_Focus_In\r
233 {\r
234     winWindow       win;\r
235 };\r
236 \r
237 struct _Win_Event_Window_Focus_Out\r
238 {\r
239     winWindow       win;\r
240 };\r
241 \r
242 typedef struct _Event_Key          Event_Key;\r
243 typedef struct _Event_Mouse_Button Event_Mouse_Button;\r
244 typedef struct _Event_Mouse_Wheel  Event_Mouse_Wheel;\r
245 typedef struct _Event_Mouse_Move   Event_Mouse_Move;\r
246 typedef struct _Win_Event_Mouse_In                     Win_Event_Mouse_In;\r
247 typedef struct _Win_Event_Mouse_Out                    Win_Event_Mouse_Out;\r
248 typedef struct _Win_Event_Window_Focus_In              Win_Event_Window_Focus_In;\r
249 typedef struct _Win_Event_Window_Focus_Out             Win_Event_Window_Focus_Out;\r
250 \r
251 typedef int Event_Handler;\r
252 \r
253 struct TWinEventInfo\r
254 {\r
255     TWinEventInfo(long hWnd, unsigned int uMsg, long wParam, long lParam)\r
256     {\r
257         this->mWindow = (winWindow)hWnd;\r
258         this->uMsg = uMsg;\r
259         this->wParam = wParam;\r
260         this->lParam = lParam;\r
261     }\r
262 \r
263     winWindow mWindow;\r
264     unsigned int uMsg;\r
265     long wParam;\r
266     long lParam;\r
267 };\r
268 \r
269 typedef bool(*EventCallback)(void* data, int type, TWinEventInfo* event);\r
270 \r
271 Event_Handler event_handler_add(int eventType, EventCallback callback, void* handler);\r
272 \r
273 void event_handler_del(Event_Handler handler);\r
274 \r
275 void* GetEventHandler(int eventType);\r
276 EventCallback GetCallback(int eventType);\r
277
278 } // namespace Adaptor
279
280 } // namespace internal
281
282 } // namespace Dali\r
283 \r
284 #endif\r