more quartz -> cocoa renaming
[framework/uifw/ecore.git] / src / lib / ecore_evas / Ecore_Evas.h
1 /*
2  * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
3  */
4
5 #ifndef _ECORE_EVAS_H
6 #define _ECORE_EVAS_H
7
8 #include <Evas.h>
9 #include <Ecore_Getopt.h>
10
11 #ifdef EAPI
12 # undef EAPI
13 #endif
14
15 #ifdef _WIN32
16 # ifdef EFL_ECORE_EVAS_BUILD
17 #  ifdef DLL_EXPORT
18 #   define EAPI __declspec(dllexport)
19 #  else
20 #   define EAPI
21 #  endif /* ! DLL_EXPORT */
22 # else
23 #  define EAPI __declspec(dllimport)
24 # endif /* ! EFL_ECORE_EVAS_BUILD */
25 #else
26 # ifdef __GNUC__
27 #  if __GNUC__ >= 4
28 #   define EAPI __attribute__ ((visibility("default")))
29 #  else
30 #   define EAPI
31 #  endif
32 # else
33 #  define EAPI
34 # endif
35 #endif /* ! _WIN32 */
36
37 /**
38  * @file Ecore_Evas.h
39  * @brief Evas wrapper functions
40  */
41
42 /* FIXME:
43  * to do soon:
44  * - iconfication api needs to work
45  * - maximization api needs to work
46  * - document all calls
47  *
48  * later:
49  * - buffer back-end that renders to an evas_image_object ???
50  * - qt back-end ???
51  * - dfb back-end ??? (dfb's threads make this REALLY HARD)
52  */
53
54 #ifdef __cplusplus
55 extern "C" {
56 #endif
57
58 /* these are dummy and just tell u what API levels ecore_evas supports - not if
59  * the actual support is compiled in. you need to query for that separately.
60  */
61 #define HAVE_ECORE_EVAS_X 1
62 #define HAVE_ECORE_EVAS_FB 1
63 #define HAVE_ECORE_EVAS_X11_GL 1
64 #define HAVE_ECORE_EVAS_X11_16 1
65 #define HAVE_ECORE_EVAS_DIRECTFB 1
66 #define HAVE_ECORE_EVAS_WIN32 1
67 #define HAVE_ECORE_EVAS_COCOA 1
68 #define HAVE_ECORE_EVAS_SDL 1
69 #define HAVE_ECORE_EVAS_WINCE 1
70
71 typedef enum _Ecore_Evas_Engine_Type
72 {
73    ECORE_EVAS_ENGINE_SOFTWARE_BUFFER,
74    ECORE_EVAS_ENGINE_SOFTWARE_XLIB,
75    ECORE_EVAS_ENGINE_XRENDER_X11,
76    ECORE_EVAS_ENGINE_OPENGL_X11,
77    ECORE_EVAS_ENGINE_SOFTWARE_XCB,
78    ECORE_EVAS_ENGINE_XRENDER_XCB,
79    ECORE_EVAS_ENGINE_SOFTWARE_GDI,
80    ECORE_EVAS_ENGINE_SOFTWARE_DDRAW,
81    ECORE_EVAS_ENGINE_DIRECT3D,
82    ECORE_EVAS_ENGINE_OPENGL_GLEW,
83    ECORE_EVAS_ENGINE_COCOA,
84    ECORE_EVAS_ENGINE_SOFTWARE_SDL,
85    ECORE_EVAS_ENGINE_DIRECTFB,
86    ECORE_EVAS_ENGINE_SOFTWARE_FB,
87    ECORE_EVAS_ENGINE_SOFTWARE_16_X11,
88    ECORE_EVAS_ENGINE_SOFTWARE_16_DDRAW,
89    ECORE_EVAS_ENGINE_SOFTWARE_16_WINCE,
90    ECORE_EVAS_ENGINE_OPENGL_SDL
91 } Ecore_Evas_Engine_Type;
92
93 typedef enum _Ecore_Evas_Avoid_Damage_Type
94 {
95    ECORE_EVAS_AVOID_DAMAGE_NONE = 0,
96    ECORE_EVAS_AVOID_DAMAGE_EXPOSE = 1,
97    ECORE_EVAS_AVOID_DAMAGE_BUILT_IN = 2
98 } Ecore_Evas_Avoid_Damage_Type;
99
100 typedef enum _Ecore_Evas_Object_Associate_Flags
101 {
102   ECORE_EVAS_OBJECT_ASSOCIATE_BASE  = 0,
103   ECORE_EVAS_OBJECT_ASSOCIATE_STACK = 1 << 0,
104   ECORE_EVAS_OBJECT_ASSOCIATE_LAYER = 1 << 1,
105   ECORE_EVAS_OBJECT_ASSOCIATE_DEL = 1 << 2
106 } Ecore_Evas_Object_Associate_Flags;
107
108 #ifndef _ECORE_X_H
109 #define _ECORE_X_WINDOW_PREDEF
110 typedef unsigned int Ecore_X_Window;
111 #endif
112
113 #ifndef _ECORE_DIRECTFB_H
114 #define _ECORE_DIRECTFB_WINDOW_PREDEF
115 typedef struct _Ecore_DirectFB_Window Ecore_DirectFB_Window;
116 #endif
117
118 #ifndef __ECORE_WIN32_H__
119 typedef struct _Ecore_Win32_Window Ecore_Win32_Window;
120 #endif
121
122 #ifndef __ECORE_WINCE_H__
123 typedef void Ecore_WinCE_Window;
124 #endif
125
126 #ifndef _ECORE_EVAS_PRIVATE_H
127 /* basic data types */
128 typedef struct _Ecore_Evas Ecore_Evas;
129 #endif
130
131 #include <Ecore_Input.h>
132
133 /* module setup/shutdown calls */
134
135 EAPI int         ecore_evas_engine_type_supported_get(Ecore_Evas_Engine_Type engine);
136
137 EAPI int         ecore_evas_init(void);
138 EAPI int         ecore_evas_shutdown(void);
139
140 EAPI void        ecore_evas_app_comp_sync_set(int do_sync);
141 EAPI int         ecore_evas_app_comp_sync_get(void);
142    
143 EAPI Eina_List  *ecore_evas_engines_get(void);
144 EAPI void        ecore_evas_engines_free(Eina_List *engines);
145 EAPI Ecore_Evas *ecore_evas_new(const char *engine_name, int x, int y, int w, int h, const char *extra_options);
146
147
148 /* engine/target specific init calls */
149 EAPI Ecore_Evas     *ecore_evas_software_x11_new(const char *disp_name, Ecore_X_Window parent, int x, int y, int w, int h);
150 EAPI Ecore_X_Window  ecore_evas_software_x11_window_get(const Ecore_Evas *ee);
151 EAPI void            ecore_evas_software_x11_direct_resize_set(Ecore_Evas *ee, int on);
152 EAPI int             ecore_evas_software_x11_direct_resize_get(const Ecore_Evas *ee);
153 EAPI void            ecore_evas_software_x11_extra_event_window_add(Ecore_Evas *ee, Ecore_X_Window win);
154
155 #define ECORE_EVAS_GL_X11_OPT_NONE     0
156 #define ECORE_EVAS_GL_X11_OPT_INDIRECT 1
157 #define ECORE_EVAS_GL_X11_OPT_LAST     2
158
159 EAPI Ecore_Evas     *ecore_evas_gl_x11_new(const char *disp_name, Ecore_X_Window parent, int x, int y, int w, int h);
160 EAPI Ecore_Evas     *ecore_evas_gl_x11_options_new(const char *disp_name, Ecore_X_Window parent, int x, int y, int w, int h, const int *opt);
161 EAPI Ecore_X_Window  ecore_evas_gl_x11_window_get(const Ecore_Evas *ee);
162 EAPI void            ecore_evas_gl_x11_direct_resize_set(Ecore_Evas *ee, int on);
163 EAPI int             ecore_evas_gl_x11_direct_resize_get(const Ecore_Evas *ee);
164 EAPI void            ecore_evas_gl_x11_extra_event_window_add(Ecore_Evas *ee, Ecore_X_Window win);
165 EAPI void            ecore_evas_gl_x11_pre_post_swap_callback_set(const Ecore_Evas *ee, void *data, void (*pre_cb) (void *data, Evas *e), void (*post_cb) (void *data, Evas *e));
166        
167 EAPI Ecore_Evas     *ecore_evas_xrender_x11_new(const char *disp_name, Ecore_X_Window parent, int x, int y, int w, int h);
168 EAPI Ecore_X_Window  ecore_evas_xrender_x11_window_get(const Ecore_Evas *ee);
169 EAPI void            ecore_evas_xrender_x11_direct_resize_set(Ecore_Evas *ee, int on);
170 EAPI int             ecore_evas_xrender_x11_direct_resize_get(const Ecore_Evas *ee);
171 EAPI void            ecore_evas_xrender_x11_extra_event_window_add(Ecore_Evas *ee, Ecore_X_Window win);
172
173 EAPI Ecore_Evas     *ecore_evas_software_x11_16_new(const char *disp_name, Ecore_X_Window parent, int x, int y, int w, int h);
174 EAPI Ecore_X_Window  ecore_evas_software_x11_16_window_get(const Ecore_Evas *ee);
175 EAPI void            ecore_evas_software_x11_16_direct_resize_set(Ecore_Evas *ee, int on);
176 EAPI int             ecore_evas_software_x11_16_direct_resize_get(const Ecore_Evas *ee);
177 EAPI void            ecore_evas_software_x11_16_extra_event_window_add(Ecore_Evas *ee, Ecore_X_Window win);
178
179 EAPI Ecore_Evas     *ecore_evas_fb_new(const char *disp_name, int rotation, int w, int h);
180
181 EAPI Ecore_Evas     *ecore_evas_directfb_new(const char *disp_name, int windowed, int x, int y, int w, int h);
182 EAPI Ecore_DirectFB_Window *ecore_evas_directfb_window_get(const Ecore_Evas *ee);
183
184 EAPI Ecore_Evas     *ecore_evas_buffer_new(int w, int h);
185 EAPI const void     *ecore_evas_buffer_pixels_get(Ecore_Evas *ee);
186
187 EAPI Evas_Object    *ecore_evas_object_image_new(Ecore_Evas *ee_target);
188
189 EAPI Ecore_Evas     *ecore_evas_software_gdi_new(Ecore_Win32_Window *parent,
190                                                  int                 x,
191                                                  int                 y,
192                                                  int                 width,
193                                                  int                 height);
194
195 EAPI Ecore_Evas     *ecore_evas_software_ddraw_new(Ecore_Win32_Window *parent,
196                                                    int                 x,
197                                                    int                 y,
198                                                    int                 width,
199                                                    int                 height);
200
201 EAPI Ecore_Evas     *ecore_evas_software_16_ddraw_new(Ecore_Win32_Window *parent,
202                                                       int                 x,
203                                                       int                 y,
204                                                       int                 width,
205                                                       int                 height);
206
207 EAPI Ecore_Evas     *ecore_evas_direct3d_new(Ecore_Win32_Window *parent,
208                                              int                 x,
209                                              int                 y,
210                                              int                 width,
211                                              int                 height);
212
213 EAPI Ecore_Evas *ecore_evas_gl_glew_new(Ecore_Win32_Window *parent,
214                                         int                 x,
215                                         int                 y,
216                                         int                 width,
217                                         int                 height);
218
219 EAPI Ecore_Win32_Window *ecore_evas_win32_window_get(const Ecore_Evas *ee);
220
221 EAPI Ecore_Evas     *ecore_evas_sdl_new(const char* name, int w, int h, int fullscreen, int hwsurface, int noframe, int alpha);
222 EAPI Ecore_Evas     *ecore_evas_sdl16_new(const char* name, int w, int h, int fullscreen, int hwsurface, int noframe, int alpha);
223 EAPI Ecore_Evas     *ecore_evas_gl_sdl_new(const char* name, int w, int h, int fullscreen, int noframe);
224
225 EAPI Ecore_Evas     *ecore_evas_software_wince_new(Ecore_WinCE_Window *parent,
226                                                    int                 x,
227                                                    int                 y,
228                                                    int                 width,
229                                                    int                 height);
230
231 EAPI Ecore_Evas     *ecore_evas_software_wince_fb_new(Ecore_WinCE_Window *parent,
232                                                       int                 x,
233                                                       int                 y,
234                                                       int                 width,
235                                                       int                 height);
236
237 EAPI Ecore_Evas     *ecore_evas_software_wince_gapi_new(Ecore_WinCE_Window *parent,
238                                                         int                 x,
239                                                         int                 y,
240                                                         int                 width,
241                                                         int                 height);
242
243 EAPI Ecore_Evas     *ecore_evas_software_wince_ddraw_new(Ecore_WinCE_Window *parent,
244                                                          int                 x,
245                                                          int                 y,
246                                                          int                 width,
247                                                          int                 height);
248
249 EAPI Ecore_Evas     *ecore_evas_software_wince_gdi_new(Ecore_WinCE_Window *parent,
250                                                        int                 x,
251                                                        int                 y,
252                                                        int                 width,
253                                                        int                 height);
254
255 EAPI Ecore_WinCE_Window *ecore_evas_software_wince_window_get(const Ecore_Evas *ee);
256
257 EAPI Ecore_Evas *ecore_evas_cocoa_new(const char* name, int w, int h);
258
259 /* generic manipulation calls */
260 EAPI const char *ecore_evas_engine_name_get(const Ecore_Evas *ee);
261 EAPI Ecore_Evas *ecore_evas_ecore_evas_get(const Evas *e);
262 EAPI void        ecore_evas_free(Ecore_Evas *ee);
263 EAPI void       *ecore_evas_data_get(const Ecore_Evas *ee, const char *key);
264 EAPI void        ecore_evas_data_set(Ecore_Evas *ee, const char *key, const void *data);
265 EAPI void        ecore_evas_callback_resize_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee));
266 EAPI void        ecore_evas_callback_move_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee));
267 EAPI void        ecore_evas_callback_show_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee));
268 EAPI void        ecore_evas_callback_hide_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee));
269 EAPI void        ecore_evas_callback_delete_request_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee));
270 EAPI void        ecore_evas_callback_destroy_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee));
271 EAPI void        ecore_evas_callback_focus_in_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee));
272 EAPI void        ecore_evas_callback_focus_out_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee));
273 EAPI void        ecore_evas_callback_sticky_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee));
274 EAPI void        ecore_evas_callback_unsticky_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee));
275 EAPI void        ecore_evas_callback_mouse_in_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee));
276 EAPI void        ecore_evas_callback_mouse_out_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee));
277 EAPI void        ecore_evas_callback_pre_render_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee));
278 EAPI void        ecore_evas_callback_post_render_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee));
279 EAPI void        ecore_evas_callback_pre_free_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee));
280 EAPI Evas       *ecore_evas_get(const Ecore_Evas *ee);
281 EAPI void        ecore_evas_move(Ecore_Evas *ee, int x, int y);
282 EAPI void        ecore_evas_managed_move(Ecore_Evas *ee, int x, int y);
283 EAPI void        ecore_evas_resize(Ecore_Evas *ee, int w, int h);
284 EAPI void        ecore_evas_move_resize(Ecore_Evas *ee, int x, int y, int w, int h);
285 EAPI void        ecore_evas_geometry_get(const Ecore_Evas *ee, int *x, int *y, int *w, int *h);
286 EAPI void        ecore_evas_rotation_set(Ecore_Evas *ee, int rot);
287 EAPI void        ecore_evas_rotation_with_resize_set(Ecore_Evas *ee, int rot);
288 EAPI int         ecore_evas_rotation_get(const Ecore_Evas *ee);
289 EAPI void        ecore_evas_shaped_set(Ecore_Evas *ee, int shaped);
290 EAPI int         ecore_evas_shaped_get(const Ecore_Evas *ee);
291 EAPI void        ecore_evas_alpha_set(Ecore_Evas *ee, int alpha);
292 EAPI int         ecore_evas_alpha_get(const Ecore_Evas *ee);
293 EAPI void        ecore_evas_transparent_set(Ecore_Evas *ee, int transparent);
294 EAPI int         ecore_evas_transparent_get(const Ecore_Evas *ee);
295 EAPI void        ecore_evas_show(Ecore_Evas *ee);
296 EAPI void        ecore_evas_hide(Ecore_Evas *ee);
297 EAPI int         ecore_evas_visibility_get(const Ecore_Evas *ee);
298 EAPI void        ecore_evas_raise(Ecore_Evas *ee);
299 EAPI void        ecore_evas_lower(Ecore_Evas *ee);
300 EAPI void        ecore_evas_activate(Ecore_Evas *ee);
301 EAPI void        ecore_evas_title_set(Ecore_Evas *ee, const char *t);
302 EAPI const char *ecore_evas_title_get(const Ecore_Evas *ee);
303 EAPI void        ecore_evas_name_class_set(Ecore_Evas *ee, const char *n, const char *c);
304 EAPI void        ecore_evas_name_class_get(const Ecore_Evas *ee, const char **n, const char **c);
305 EAPI void        ecore_evas_size_min_set(Ecore_Evas *ee, int w, int h);
306 EAPI void        ecore_evas_size_min_get(const Ecore_Evas *ee, int *w, int *h);
307 EAPI void        ecore_evas_size_max_set(Ecore_Evas *ee, int w, int h);
308 EAPI void        ecore_evas_size_max_get(const Ecore_Evas *ee, int *w, int *h);
309 EAPI void        ecore_evas_size_base_set(Ecore_Evas *ee, int w, int h);
310 EAPI void        ecore_evas_size_base_get(const Ecore_Evas *ee, int *w, int *h);
311 EAPI void        ecore_evas_size_step_set(Ecore_Evas *ee, int w, int h);
312 EAPI void        ecore_evas_size_step_get(const Ecore_Evas *ee, int *w, int *h);
313 EAPI void        ecore_evas_cursor_set(Ecore_Evas *ee, const char *file, int layer, int hot_x, int hot_y);
314 EAPI void        ecore_evas_object_cursor_set(Ecore_Evas *ee, Evas_Object *obj, int layer, int hot_x, int hot_y);
315 EAPI void        ecore_evas_cursor_get(const Ecore_Evas *ee, Evas_Object **obj, int *layer, int *hot_x, int *hot_y);
316 EAPI void        ecore_evas_layer_set(Ecore_Evas *ee, int layer);
317 EAPI int         ecore_evas_layer_get(const Ecore_Evas *ee);
318 EAPI void        ecore_evas_focus_set(Ecore_Evas *ee, int on);
319 EAPI int         ecore_evas_focus_get(const Ecore_Evas *ee);
320 EAPI void        ecore_evas_iconified_set(Ecore_Evas *ee, int on);
321 EAPI int         ecore_evas_iconified_get(const Ecore_Evas *ee);
322 EAPI void        ecore_evas_borderless_set(Ecore_Evas *ee, int on);
323 EAPI int         ecore_evas_borderless_get(const Ecore_Evas *ee);
324 EAPI void        ecore_evas_override_set(Ecore_Evas *ee, int on);
325 EAPI int         ecore_evas_override_get(const Ecore_Evas *ee);
326 EAPI void        ecore_evas_maximized_set(Ecore_Evas *ee, int on);
327 EAPI int         ecore_evas_maximized_get(const Ecore_Evas *ee);
328 EAPI void        ecore_evas_fullscreen_set(Ecore_Evas *ee, int on);
329 EAPI int         ecore_evas_fullscreen_get(const Ecore_Evas *ee);
330 EAPI void        ecore_evas_avoid_damage_set(Ecore_Evas *ee, Ecore_Evas_Avoid_Damage_Type on);
331 EAPI Ecore_Evas_Avoid_Damage_Type ecore_evas_avoid_damage_get(const Ecore_Evas *ee);
332 EAPI void        ecore_evas_withdrawn_set(Ecore_Evas *ee, int withdrawn);
333 EAPI int         ecore_evas_withdrawn_get(const Ecore_Evas *ee);
334 EAPI void        ecore_evas_sticky_set(Ecore_Evas *ee, int sticky);
335 EAPI int         ecore_evas_sticky_get(const Ecore_Evas *ee);
336 EAPI void        ecore_evas_ignore_events_set(Ecore_Evas *ee, int ignore);
337 EAPI int         ecore_evas_ignore_events_get(const Ecore_Evas *ee);
338 EAPI void        ecore_evas_manual_render_set(Ecore_Evas *ee, int manual_render);
339 EAPI int         ecore_evas_manual_render_get(const Ecore_Evas *ee);
340 EAPI void        ecore_evas_manual_render(Ecore_Evas *ee);
341 EAPI void        ecore_evas_comp_sync_set(Ecore_Evas *ee, int do_sync);
342 EAPI int         ecore_evas_comp_sync_get(const Ecore_Evas *ee);
343        
344 EAPI Ecore_Window ecore_evas_window_get(const Ecore_Evas *ee);
345
346
347 EAPI int          ecore_evas_object_associate(Ecore_Evas *ee, Evas_Object *obj, Ecore_Evas_Object_Associate_Flags flags);
348 EAPI int          ecore_evas_object_dissociate(Ecore_Evas *ee, Evas_Object *obj);
349 EAPI Evas_Object *ecore_evas_object_associate_get(const Ecore_Evas *ee);
350
351 /* helper function to be used with ECORE_GETOPT_CALLBACK_*() */
352 EAPI unsigned char ecore_getopt_callback_ecore_evas_list_engines(const Ecore_Getopt *parser, const Ecore_Getopt_Desc *desc, const char *str, void *data, Ecore_Getopt_Value *storage);
353
354 #ifdef __cplusplus
355 }
356 #endif
357
358 #endif