91413358e6e09449732fa638d0abbe71d72b0490
[profile/ivi/ecore.git] / src / lib / ecore_win32 / Ecore_Win32.h
1 #ifndef __ECORE_WIN32_H__
2 #define __ECORE_WIN32_H__
3
4 /*
5  * DO NOT USE THIS HEADER. IT IS WORK IN PROGRESS. IT IS NOT FINAL AND
6  * THE API MAY CHANGE.
7  */
8
9 #ifndef ECORE_WIN32_WIP_POZEFLKSD
10 # ifdef _MSC_VER
11 #  pragma message ("You are using a work in progress API. This API is not stable")
12 #  pragma message ("and is subject to change. You use this at your own risk.")
13 # else
14 #  warning "You are using a work in progress API. This API is not stable"
15 #  warning "and is subject to change. You use this at your own risk."
16 # endif
17 #endif
18
19 #include <Eina.h>
20
21 #ifdef EAPI
22 # undef EAPI
23 #endif
24
25 #ifdef _WIN32
26 # ifdef EFL_ECORE_WIN32_BUILD
27 #  ifdef DLL_EXPORT
28 #   define EAPI __declspec(dllexport)
29 #  else
30 #   define EAPI
31 #  endif /* ! DLL_EXPORT */
32 # else
33 #  define EAPI __declspec(dllimport)
34 # endif /* ! EFL_ECORE_WIN32_BUILD */
35 #else
36 # ifdef __GNUC__
37 #  if __GNUC__ >= 4
38 #   define EAPI __attribute__ ((visibility("default")))
39 #  else
40 #   define EAPI
41 #  endif
42 # else
43 #  define EAPI
44 # endif
45 #endif /* ! _WIN32 */
46
47
48 #ifdef __cplusplus
49 extern "C" {
50 #endif
51
52 /**
53  * @defgroup Ecore_Win32_Group Ecore_Win32 library
54  *
55  * @{
56  */
57
58 /**
59  * @typedef Ecore_Win32_Window_State
60  * State of a window.
61  */
62 typedef enum
63 {
64    ECORE_WIN32_WINDOW_STATE_ICONIFIED, /**< iconified window */
65    ECORE_WIN32_WINDOW_STATE_MODAL, /**< modal dialog box */
66    ECORE_WIN32_WINDOW_STATE_STICKY, /**< sticky window */
67    ECORE_WIN32_WINDOW_STATE_MAXIMIZED_VERT, /**< maximum vertical sized window */
68    ECORE_WIN32_WINDOW_STATE_MAXIMIZED_HORZ, /**< maximum horizontal sized window */
69    ECORE_WIN32_WINDOW_STATE_MAXIMIZED, /**< maximum sized window */
70    ECORE_WIN32_WINDOW_STATE_SHADED, /**< shaded window */
71    ECORE_WIN32_WINDOW_STATE_HIDDEN, /**< hidden (minimized or iconified) window */
72    ECORE_WIN32_WINDOW_STATE_FULLSCREEN, /**< fullscreen window */
73    ECORE_WIN32_WINDOW_STATE_ABOVE, /**< above window */
74    ECORE_WIN32_WINDOW_STATE_BELOW, /**< below window */
75    ECORE_WIN32_WINDOW_STATE_DEMANDS_ATTENTION, /**< To document */
76    ECORE_WIN32_WINDOW_STATE_UNKNOWN /**< Unknown state */
77 } Ecore_Win32_Window_State;
78
79 /**
80  * @typedef Ecore_Win32_Window_Type
81  * Type of a window.
82  */
83 typedef enum
84 {
85    ECORE_WIN32_WINDOW_TYPE_DESKTOP, /**< Desktop feature */
86    ECORE_WIN32_WINDOW_TYPE_DOCK,    /**< Dock window (should be on top of other windows) */
87    ECORE_WIN32_WINDOW_TYPE_TOOLBAR, /**< Toolbar window */
88    ECORE_WIN32_WINDOW_TYPE_MENU,    /**< Menu window */
89    ECORE_WIN32_WINDOW_TYPE_UTILITY, /**< Small persistent utility window, such as a palette or toolbox */
90    ECORE_WIN32_WINDOW_TYPE_SPLASH,  /**< Splash screen window displayed as an application is starting up */
91    ECORE_WIN32_WINDOW_TYPE_DIALOG,  /**< Dialog window */
92    ECORE_WIN32_WINDOW_TYPE_NORMAL,  /**< Normal top-level window */
93    ECORE_WIN32_WINDOW_TYPE_UNKNOWN  /**< Unknown type */
94 } Ecore_Win32_Window_Type;
95
96 /**
97  * @typedef Ecore_Win32_Cursor_Shape
98  * Shape of a cursor.
99  */
100 typedef enum
101 {
102    ECORE_WIN32_CURSOR_SHAPE_APP_STARTING, /**< Standard arrow and small hourglass */
103    ECORE_WIN32_CURSOR_SHAPE_ARROW,        /**< Standard arrow */
104    ECORE_WIN32_CURSOR_SHAPE_CROSS,        /**< Crosshair */
105    ECORE_WIN32_CURSOR_SHAPE_HAND,         /**< Hand */
106    ECORE_WIN32_CURSOR_SHAPE_HELP,         /**< Arrow and question mark */
107    ECORE_WIN32_CURSOR_SHAPE_I_BEAM,       /**< I-beam */
108    ECORE_WIN32_CURSOR_SHAPE_NO,           /**< Slashed circle */
109    ECORE_WIN32_CURSOR_SHAPE_SIZE_ALL,     /**< Four-pointed arrow pointing north, south, east, and west */
110    ECORE_WIN32_CURSOR_SHAPE_SIZE_NESW,    /**< Double-pointed arrow pointing northeast and southwest */
111    ECORE_WIN32_CURSOR_SHAPE_SIZE_NS,      /**< Double-pointed arrow pointing north and south */
112    ECORE_WIN32_CURSOR_SHAPE_SIZE_NWSE,    /**< Double-pointed arrow pointing northwest and southeast */
113    ECORE_WIN32_CURSOR_SHAPE_SIZE_WE,      /**< Double-pointed arrow pointing west and east */
114    ECORE_WIN32_CURSOR_SHAPE_UP_ARROW,     /**< Vertical arrow */
115    ECORE_WIN32_CURSOR_SHAPE_WAIT          /**< Hourglass */
116 } Ecore_Win32_Cursor_Shape;
117
118 /**
119  * @typedef Ecore_Win32_DnD_State
120  * State of a DnD operation.
121  */
122 typedef enum
123 {
124    ECORE_WIN32_DND_EVENT_DRAG_ENTER = 1, /**< Drag enter */
125    ECORE_WIN32_DND_EVENT_DRAG_OVER  = 2, /**< Drag over */
126    ECORE_WIN32_DND_EVENT_DRAG_LEAVE = 3, /**< Drag leave */
127    ECORE_WIN32_DND_EVENT_DROP       = 4  /**< Drop */
128 } Ecore_Win32_DnD_State;
129
130 /**
131  * @typedef Ecore_Win32_Window
132  * Abstract type for a window.
133  */
134 typedef struct _Ecore_Win32_Window Ecore_Win32_Window;
135
136 /**
137  * @typedef Ecore_Win32_Cursor
138  * Abstract type for a cursor.
139  */
140 typedef void Ecore_Win32_Cursor;
141
142
143 /**
144  * @typedef Ecore_Win32_Event_Mouse_In
145  * Event sent when the mouse enters the window.
146  */
147 typedef struct _Ecore_Win32_Event_Mouse_In              Ecore_Win32_Event_Mouse_In;
148
149 /**
150  * @typedef Ecore_Win32_Event_Mouse_Out
151  * Event sent when the mouse leaves the window.
152  */
153 typedef struct _Ecore_Win32_Event_Mouse_Out             Ecore_Win32_Event_Mouse_Out;
154
155 /**
156  * @typedef Ecore_Win32_Event_Window_Focus_In
157  * Event sent when the window gets the focus.
158  */
159 typedef struct _Ecore_Win32_Event_Window_Focus_In       Ecore_Win32_Event_Window_Focus_In;
160
161 /**
162  * @typedef Ecore_Win32_Event_Window_Focus_Out
163  * Event sent when the window looses the focus.
164  */
165 typedef struct _Ecore_Win32_Event_Window_Focus_Out      Ecore_Win32_Event_Window_Focus_Out;
166
167 /**
168  * @typedef Ecore_Win32_Event_Window_Damage
169  * Event sent when the window is damaged.
170  */
171 typedef struct _Ecore_Win32_Event_Window_Damage         Ecore_Win32_Event_Window_Damage;
172
173 /**
174  * @typedef Ecore_Win32_Event_Window_Create
175  * Event sent when the window is created.
176  */
177 typedef struct _Ecore_Win32_Event_Window_Create         Ecore_Win32_Event_Window_Create;
178
179 /**
180  * @typedef Ecore_Win32_Event_Window_Destroy
181  * Event sent when the window is destroyed.
182  */
183 typedef struct _Ecore_Win32_Event_Window_Destroy        Ecore_Win32_Event_Window_Destroy;
184
185 /**
186  * @typedef Ecore_Win32_Event_Window_Hide
187  * Event sent when the window is hidden.
188  */
189 typedef struct _Ecore_Win32_Event_Window_Hide           Ecore_Win32_Event_Window_Hide;
190
191 /**
192  * @typedef Ecore_Win32_Event_Window_Show
193  * Event sent when the window is shown.
194  */
195 typedef struct _Ecore_Win32_Event_Window_Show           Ecore_Win32_Event_Window_Show;
196
197 /**
198  * @typedef Ecore_Win32_Event_Window_Configure
199  * Event sent when the window is configured.
200  */
201 typedef struct _Ecore_Win32_Event_Window_Configure      Ecore_Win32_Event_Window_Configure;
202
203 /**
204  * @typedef Ecore_Win32_Event_Window_Resize
205  * Event sent when the window is resized.
206  */
207 typedef struct _Ecore_Win32_Event_Window_Resize         Ecore_Win32_Event_Window_Resize;
208
209 /**
210  * @typedef Ecore_Win32_Event_Window_Delete_Request
211  * Event sent when the window is deleted.
212  */
213 typedef struct _Ecore_Win32_Event_Window_Delete_Request Ecore_Win32_Event_Window_Delete_Request;
214
215 /**
216  * @struct _Ecore_Win32_Event_Mouse_In
217  * Event sent when the mouse enters the window.
218  */
219 struct _Ecore_Win32_Event_Mouse_In
220 {
221    Ecore_Win32_Window *window; /**< The window that received the event */
222    int                 x; /**< The x coordinate where the mouse leaved */
223    int                 y; /**< The y coordinate where the mouse entered */
224    long                time; /**< The time the event occured */
225 };
226
227 /**
228  * @struct _Ecore_Win32_Event_Mouse_Out
229  * Event sent when the mouse leaves the window.
230  */
231 struct _Ecore_Win32_Event_Mouse_Out
232 {
233    Ecore_Win32_Window *window; /**< The window that received the event */
234    int                 x; /**< The x coordinate where the mouse leaved */
235    int                 y; /**< The y coordinate where the mouse leaved */
236    long                time; /**< The time the event occured */
237 };
238
239 /**
240  * @struct _Ecore_Win32_Event_Window_Focus_In
241  * Event sent when the window gets the focus.
242  */
243 struct _Ecore_Win32_Event_Window_Focus_In
244 {
245    Ecore_Win32_Window *window; /**< The window that received the event */
246    long  long          time; /**< The time the event occured */
247 };
248
249 /**
250  * @struct _Ecore_Win32_Event_Window_Focus_Out
251  * Event sent when the window looses the focus.
252  */
253 struct _Ecore_Win32_Event_Window_Focus_Out
254 {
255    Ecore_Win32_Window *window; /**< The window that received the event */
256    long                time; /**< The time the event occured */
257 };
258
259 /**
260  * @struct _Ecore_Win32_Event_Window_Damage
261  * Event sent when the window is damaged.
262  */
263 struct _Ecore_Win32_Event_Window_Damage
264 {
265    Ecore_Win32_Window *window; /**< The window that received the event */
266    int                 x; /**< The x coordinate of the top left corner of the damaged region */
267    int                 y; /**< The y coordinate of the top left corner of the damaged region */
268    int                 width; /**< The width of the damaged region */
269    int                 height; /**< The time the event occured */
270    long                time; /**< The time the event occured */
271 };
272
273 /**
274  * @struct _Ecore_Win32_Event_Window_Create
275  * Event sent when the window is created.
276  */
277 struct _Ecore_Win32_Event_Window_Create
278 {
279    Ecore_Win32_Window *window; /**< The window that received the event */
280    long                time; /**< The time the event occured */
281 };
282
283 /**
284  * @struct _Ecore_Win32_Event_Window_Destroy
285  * Event sent when the window is destroyed.
286  */
287 struct _Ecore_Win32_Event_Window_Destroy
288 {
289    Ecore_Win32_Window *window; /**< The window that received the event */
290    long                time; /**< The time the event occured */
291 };
292
293 /**
294  * @struct _Ecore_Win32_Event_Window_Hide
295  * Event sent when the window is hidden.
296  */
297 struct _Ecore_Win32_Event_Window_Hide
298 {
299    Ecore_Win32_Window *window; /**< The window that received the event */
300    long                time; /**< The time the event occured */
301 };
302
303 /**
304  * @struct _Ecore_Win32_Event_Window_Show
305  * Event sent when the window is shown.
306  */
307 struct _Ecore_Win32_Event_Window_Show
308 {
309    Ecore_Win32_Window *window; /**< The window that received the event */
310    long                time; /**< The time the event occured */
311 };
312
313 /**
314  * @struct _Ecore_Win32_Event_Window_Configure
315  * Event sent when the window is configured.
316  */
317 struct _Ecore_Win32_Event_Window_Configure
318 {
319    Ecore_Win32_Window *window; /**< The window that received the event */
320    Ecore_Win32_Window *abovewin;
321    int                 x; /**< The new x coordinate of the top left corner */
322    int                 y; /**< The new y coordinate of the top left corner */
323    int                 width; /**< The new width */
324    int                 height; /**< The new height */
325    long                time; /**< The time the event occured */
326 };
327
328 /**
329  * @struct _Ecore_Win32_Event_Window_Resize
330  * Event sent when the window is resized.
331  */
332 struct _Ecore_Win32_Event_Window_Resize
333 {
334    Ecore_Win32_Window *window; /**< The window that received the event */
335    int                 width; /**< The new width */
336    int                 height; /**< The new height */
337    long                time; /**< The time the event occured */
338 };
339
340 /**
341  * @struct _Ecore_Win32_Event_Window_Delete_Request
342  * Event sent when the window is deleted.
343  */
344 struct _Ecore_Win32_Event_Window_Delete_Request
345 {
346    Ecore_Win32_Window *window; /**< The window that received the event */
347    long                time; /**< The time the event occured */
348 };
349
350 /**
351  * @typedef Ecore_Win32_Dnd_DropTarget_Callback
352  * Callback type for Drop operations. See ecore_win32_dnd_register_drop_target().
353  */
354 typedef int (*Ecore_Win32_Dnd_DropTarget_Callback)(void *window, int event, int pt_x, int pt_y, void *data, int size);
355
356 EAPI extern int ECORE_WIN32_EVENT_MOUSE_IN; /**< Ecore_Event for the #Ecore_Win32_Event_Mouse_In event */
357 EAPI extern int ECORE_WIN32_EVENT_MOUSE_OUT; /**< Ecore_Event for the #Ecore_Win32_Event_Mouse_Out event */
358 EAPI extern int ECORE_WIN32_EVENT_WINDOW_FOCUS_IN; /**< Ecore_Event for the #Ecore_Win32_Event_Window_Focus_In event */
359 EAPI extern int ECORE_WIN32_EVENT_WINDOW_FOCUS_OUT; /**< Ecore_Event for the #Ecore_Win32_Event_Window_Focus_Out event */
360 EAPI extern int ECORE_WIN32_EVENT_WINDOW_DAMAGE; /**< Ecore_Event for the #Ecore_Win32_Event_Damage event */
361 EAPI extern int ECORE_WIN32_EVENT_WINDOW_CREATE; /**< Ecore_Event for the #Ecore_Win32_Event_Create event */
362 EAPI extern int ECORE_WIN32_EVENT_WINDOW_DESTROY; /**< Ecore_Event for the #Ecore_Win32_Event_Destroy event */
363 EAPI extern int ECORE_WIN32_EVENT_WINDOW_HIDE; /**< Ecore_Event for the #Ecore_Win32_Event_Hide event */
364 EAPI extern int ECORE_WIN32_EVENT_WINDOW_SHOW; /**< Ecore_Event for the #Ecore_Win32_Event_Show event */
365 EAPI extern int ECORE_WIN32_EVENT_WINDOW_CONFIGURE; /**< Ecore_Event for the #Ecore_Win32_Event_Configure event */
366 EAPI extern int ECORE_WIN32_EVENT_WINDOW_RESIZE; /**< Ecore_Event for the #Ecore_Win32_Event_Resize event */
367 EAPI extern int ECORE_WIN32_EVENT_WINDOW_DELETE_REQUEST; /**< Ecore_Event for the #Ecore_Win32_Event_Window_Delete_Request event */
368
369
370 /* Core */
371
372 EAPI int    ecore_win32_init();
373 EAPI int    ecore_win32_shutdown();
374 EAPI int    ecore_win32_screen_depth_get();
375 EAPI void   ecore_win32_double_click_time_set(double t);
376 EAPI double ecore_win32_double_click_time_get(void);
377 EAPI long   ecore_win32_current_time_get(void);
378
379 /* Window */
380
381 EAPI Ecore_Win32_Window *ecore_win32_window_new(Ecore_Win32_Window *parent,
382                                                 int                 x,
383                                                 int                 y,
384                                                 int                 width,
385                                                 int                 height);
386 EAPI Ecore_Win32_Window *ecore_win32_window_override_new(Ecore_Win32_Window *parent,
387                                                          int                 x,
388                                                          int                 y,
389                                                          int                 width,
390                                                          int                 height);
391
392 EAPI void ecore_win32_window_free(Ecore_Win32_Window *window);
393
394 EAPI void *ecore_win32_window_hwnd_get(Ecore_Win32_Window *window);
395
396 EAPI void ecore_win32_window_move(Ecore_Win32_Window *window,
397                                   int                 x,
398                                   int                 y);
399
400 EAPI void ecore_win32_window_resize(Ecore_Win32_Window *window,
401                                     int                 width,
402                                     int                 height);
403
404 EAPI void ecore_win32_window_move_resize(Ecore_Win32_Window *window,
405                                          int                 x,
406                                          int                 y,
407                                          int                 width,
408                                          int                 height);
409
410 EAPI void ecore_win32_window_geometry_get(Ecore_Win32_Window *window,
411                                           int                *x,
412                                           int                *y,
413                                           int                *width,
414                                           int                *height);
415
416 EAPI void ecore_win32_window_size_get(Ecore_Win32_Window *window,
417                                       int                *width,
418                                       int                *height);
419
420 EAPI void ecore_win32_window_size_min_set(Ecore_Win32_Window *window,
421                                           unsigned int        min_width,
422                                           unsigned int        min_height);
423
424 EAPI void ecore_win32_window_size_min_get(Ecore_Win32_Window *window,
425                                           unsigned int       *min_width,
426                                           unsigned int       *min_height);
427
428 EAPI void ecore_win32_window_size_max_set(Ecore_Win32_Window *window,
429                                           unsigned int        max_width,
430                                           unsigned int        max_height);
431
432 EAPI void ecore_win32_window_size_max_get(Ecore_Win32_Window *window,
433                                           unsigned int       *max_width,
434                                           unsigned int       *max_height);
435
436 EAPI void ecore_win32_window_size_base_set(Ecore_Win32_Window *window,
437                                            unsigned int        base_width,
438                                            unsigned int        base_height);
439
440 EAPI void ecore_win32_window_size_base_get(Ecore_Win32_Window *window,
441                                            unsigned int       *base_width,
442                                            unsigned int       *base_height);
443
444 EAPI void ecore_win32_window_size_step_set(Ecore_Win32_Window *window,
445                                            unsigned int        step_width,
446                                            unsigned int        step_height);
447
448 EAPI void ecore_win32_window_size_step_get(Ecore_Win32_Window *window,
449                                            unsigned int       *step_width,
450                                            unsigned int       *step_height);
451
452 EAPI void ecore_win32_window_show(Ecore_Win32_Window *window);
453
454 EAPI void ecore_win32_window_hide(Ecore_Win32_Window *window);
455
456 EAPI void ecore_win32_window_raise(Ecore_Win32_Window *window);
457
458 EAPI void ecore_win32_window_lower(Ecore_Win32_Window *window);
459
460 EAPI void ecore_win32_window_title_set(Ecore_Win32_Window *window,
461                                        const char         *title);
462
463 EAPI void ecore_win32_window_focus_set(Ecore_Win32_Window *window);
464
465 EAPI void ecore_win32_window_iconified_set(Ecore_Win32_Window *window,
466                                            Eina_Bool           on);
467
468 EAPI void ecore_win32_window_borderless_set(Ecore_Win32_Window *window,
469                                             Eina_Bool           on);
470
471 EAPI void ecore_win32_window_fullscreen_set(Ecore_Win32_Window *window,
472                                             Eina_Bool           on);
473
474 EINA_DEPRECATED EAPI void ecore_win32_window_shape_set(Ecore_Win32_Window *window,
475                                                        unsigned short      width,
476                                                        unsigned short      height,
477                                                        unsigned char      *mask);
478
479 EAPI void ecore_win32_window_cursor_set(Ecore_Win32_Window *window,
480                                         Ecore_Win32_Cursor *cursor);
481
482 EAPI void ecore_win32_window_state_set(Ecore_Win32_Window       *window,
483                                        Ecore_Win32_Window_State *state,
484                                        unsigned int              num);
485
486 EAPI void ecore_win32_window_state_request_send(Ecore_Win32_Window      *window,
487                                                 Ecore_Win32_Window_State state,
488                                                 unsigned int             set);
489
490 EAPI void ecore_win32_window_type_set(Ecore_Win32_Window      *window,
491                                       Ecore_Win32_Window_Type  type);
492
493 /* Cursor */
494
495 EAPI Ecore_Win32_Cursor *ecore_win32_cursor_new(const void *pixels_and,
496                                                 const void *pixels_xor,
497                                                 int         width,
498                                                 int         height,
499                                                 int         hot_x,
500                                                 int         hot_y);
501
502 EAPI void                ecore_win32_cursor_free(Ecore_Win32_Cursor *cursor);
503
504 EAPI Ecore_Win32_Cursor *ecore_win32_cursor_shaped_new(Ecore_Win32_Cursor_Shape shape);
505
506 EAPI void                ecore_win32_cursor_size_get(int *width, int *height);
507
508
509
510 /* Drag and drop */
511 EAPI int       ecore_win32_dnd_init();
512 EAPI int       ecore_win32_dnd_shutdown();
513 EAPI Eina_Bool ecore_win32_dnd_begin(const char *data,
514                                      int         size);
515 EAPI Eina_Bool ecore_win32_dnd_register_drop_target(Ecore_Win32_Window                 *window,
516                                                     Ecore_Win32_Dnd_DropTarget_Callback callback);
517 EAPI void      ecore_win32_dnd_unregister_drop_target(Ecore_Win32_Window *window);
518
519 /**
520  * @}
521  */
522
523
524 #ifdef __cplusplus
525 }
526 #endif
527
528
529 #endif /* __ECORE_WIN32_H__ */