[access] call a callback function with information
[framework/uifw/elementary.git] / src / lib / elm_priv.h
1 #ifndef ELM_PRIV_H
2 #define ELM_PRIV_H
3 #ifdef HAVE_CONFIG_H
4 #include "elementary_config.h"
5 #endif
6 #ifdef HAVE_ELEMENTARY_X
7 #include <Ecore_X.h>
8 #endif
9 #ifdef HAVE_ELEMENTARY_FB
10 #include <Ecore_Fb.h>
11 #endif
12 #ifdef HAVE_ELEMENTARY_WINCE
13 #include <Ecore_WinCE.h>
14 #endif
15 #ifdef HAVE_ELEMENTARY_WAYLAND
16 #include <Ecore_Wayland.h>
17 #endif
18
19 #ifdef HAVE_EIO
20 # include <Eio.h>
21 #endif
22
23 #ifdef EAPI
24 # undef EAPI
25 #endif
26
27 #ifdef _WIN32
28 # ifdef ELEMENTARY_BUILD
29 #  ifdef DLL_EXPORT
30 #   define EAPI __declspec(dllexport)
31 #  else
32 #   define EAPI
33 #  endif /* ! DLL_EXPORT */
34 # else
35 #  define EAPI __declspec(dllimport)
36 # endif /* ! EFL_EVAS_BUILD */
37 #else
38 # ifdef __GNUC__
39 #  if __GNUC__ >= 4
40 #   define EAPI __attribute__ ((visibility("default")))
41 #  else
42 #   define EAPI
43 #  endif
44 # else
45 #  define EAPI
46 # endif
47 #endif /* ! _WIN32 */
48
49 #include "elm_widget.h"
50
51 #ifdef HAVE_LANGINFO_H
52 # include <langinfo.h>
53 #endif
54
55 #define CRITICAL(...) EINA_LOG_DOM_CRIT(_elm_log_dom, __VA_ARGS__)
56 #define ERR(...)      EINA_LOG_DOM_ERR(_elm_log_dom, __VA_ARGS__)
57 #define WRN(...)      EINA_LOG_DOM_WARN(_elm_log_dom, __VA_ARGS__)
58 #define INF(...)      EINA_LOG_DOM_INFO(_elm_log_dom, __VA_ARGS__)
59 #define DBG(...)      EINA_LOG_DOM_DBG(_elm_log_dom, __VA_ARGS__)
60
61 #ifdef ENABLE_NLS
62 # include <libintl.h>
63 # define E_(string)    _elm_dgettext(string)
64 #else
65 # ifndef setlocale
66 #  define setlocale(c, l)
67 # endif
68 # ifndef libintl_setlocale
69 #  define libintl_setlocale(c, l)
70 # endif
71 # ifndef bindtextdomain
72 #  define bindtextdomain(domain, dir)
73 # endif
74 # ifndef libintl_bindtextdomain
75 #  define libintl_bindtextdomain(domain, dir)
76 # endif
77 # define E_(string) (string)
78 #endif
79 #define N_(string) (string)
80
81 typedef struct _Edje_Signal_Data         Edje_Signal_Data;
82 typedef struct _Elm_Config               Elm_Config;
83 typedef struct _Elm_Module               Elm_Module;
84 typedef struct _Elm_Datetime_Module_Data Elm_Datetime_Module_Data;
85
86 struct _Edje_Signal_Data
87 {
88    Evas_Object   *obj;
89    Edje_Signal_Cb func;
90    const char    *emission;
91    const char    *source;
92    void          *data;
93 };
94
95 struct _Elm_Theme
96 {
97    Eina_List  *overlay;
98    Eina_List  *themes;
99    Eina_List  *extension;
100    Eina_Hash  *cache;
101    Eina_Hash  *cache_data;
102    Elm_Theme  *ref_theme;
103    Eina_List  *referrers;
104    const char *theme;
105    int         ref;
106 };
107
108 /* increment this whenever we change config enough that you need new
109  * defaults for elm to work.
110  */
111 #define ELM_CONFIG_EPOCH           0x0001
112 /* increment this whenever a new set of config values are added but
113  * the users config doesn't need to be wiped - simply new values need
114  * to be put in
115  */
116 #define ELM_CONFIG_FILE_GENERATION 0x0003
117 #define ELM_CONFIG_VERSION         ((ELM_CONFIG_EPOCH << 16) | \
118                                     ELM_CONFIG_FILE_GENERATION)
119 /* NB: profile configuration files (.src) must have their
120  * "config_version" entry's value up-to-date with ELM_CONFIG_VERSION
121  * (in decimal)!! */
122
123 /* note: always remember to sync it with elm_config.c */
124 extern const char *_elm_engines[];
125
126 #define ELM_SOFTWARE_X11      (_elm_engines[0])
127 #define ELM_SOFTWARE_FB       (_elm_engines[1])
128 #define ELM_SOFTWARE_DIRECTFB (_elm_engines[2])
129 #define ELM_SOFTWARE_16_X11   (_elm_engines[3])
130 #define ELM_SOFTWARE_8_X11    (_elm_engines[4])
131 #define ELM_XRENDER_X11       (_elm_engines[5])
132 #define ELM_OPENGL_X11        (_elm_engines[6])
133 #define ELM_SOFTWARE_WIN32    (_elm_engines[7])
134 #define ELM_SOFTWARE_16_WINCE (_elm_engines[8])
135 #define ELM_SOFTWARE_SDL      (_elm_engines[9])
136 #define ELM_SOFTWARE_16_SDL   (_elm_engines[10])
137 #define ELM_OPENGL_SDL        (_elm_engines[11])
138 #define ELM_BUFFER            (_elm_engines[12])
139 #define ELM_EWS               (_elm_engines[13])
140 #define ELM_OPENGL_COCOA      (_elm_engines[14])
141 #define ELM_SOFTWARE_PSL1GHT  (_elm_engines[15])
142 #define ELM_WAYLAND_SHM       (_elm_engines[16])
143 #define ELM_WAYLAND_EGL       (_elm_engines[17])
144
145 #define ELM_FONT_TOKEN_STYLE  ":style="
146
147 #define ELM_ACCESS_MODE_OFF   EINA_FALSE
148 #define ELM_ACCESS_MODE_ON    EINA_TRUE
149
150 #undef MIN
151 #define MIN(x, y) (((x) < (y)) ? (x) : (y))
152 #undef MAX
153 #define MAX(x, y) (((x) > (y)) ? (x) : (y))
154
155 struct _Elm_Config
156 {
157    int           config_version;
158    const char   *engine;
159    unsigned char vsync;
160    unsigned char thumbscroll_enable;
161    int           thumbscroll_threshold;
162    int           thumbscroll_hold_threshold;
163    double        thumbscroll_momentum_threshold;
164    double        thumbscroll_friction;
165    double        thumbscroll_bounce_friction;
166    double        page_scroll_friction;
167    double        bring_in_scroll_friction;
168    double        zoom_friction;
169    unsigned char thumbscroll_bounce_enable;
170    double        thumbscroll_border_friction;
171    double        thumbscroll_sensitivity_friction;
172    double        scroll_smooth_time_interval;
173    double        scroll_smooth_amount;
174    double        scroll_smooth_history_weight;
175    double        scroll_smooth_future_time;
176    double        scroll_smooth_time_window;
177    double        scale;
178    int           bgpixmap;
179    int           compositing;
180    Eina_List    *font_dirs;
181    Eina_List    *font_overlays;
182    int           font_hinting;
183    int           cache_flush_poll_interval;
184    unsigned char cache_flush_enable;
185    int           image_cache;
186    int           font_cache;
187    int           edje_cache;
188    int           edje_collection_cache;
189    int           finger_size;
190    double        fps;
191    const char   *theme;
192    const char   *modules;
193    double        tooltip_delay;
194    unsigned char cursor_engine_only;
195    unsigned char focus_highlight_enable;
196    unsigned char focus_highlight_animate;
197    int           toolbar_shrink_mode;
198    unsigned char fileselector_expand_enable;
199    unsigned char inwin_dialogs_enable;
200    int           icon_size;
201    double        longpress_timeout;
202    unsigned char effect_enable;
203    unsigned char desktop_entry;
204    unsigned char password_show_last;
205    double        password_show_last_timeout;
206    unsigned char glayer_zoom_finger_enable;
207    double        glayer_zoom_finger_factor;
208    double        glayer_zoom_wheel_factor;
209    double        glayer_zoom_distance_tolerance;
210    double        glayer_rotate_finger_enable;
211    double        glayer_rotate_angular_tolerance;
212    double        glayer_line_min_length;
213    double        glayer_line_distance_tolerance;
214    double        glayer_line_angular_tolerance;
215    unsigned int  glayer_flick_time_limit_ms;
216    double        glayer_long_tap_start_timeout;
217    double        glayer_double_tap_timeout;
218    Eina_Bool     access_mode;
219    unsigned char glayer_continues_enable;
220    int           week_start;
221    int           weekend_start;
222    int           weekend_len;
223    int           year_min;
224    int           year_max;
225    Eina_List    *color_palette;
226    unsigned char softcursor_mode;
227    unsigned char auto_norender_withdrawn;
228    unsigned char auto_norender_iconified_same_as_withdrawn;
229    unsigned char auto_flush_withdrawn;
230    unsigned char auto_dump_withdrawn;
231    unsigned char auto_throttle;
232    double        auto_throttle_amount;
233    const char   *indicator_service_0;
234    const char   *indicator_service_90;
235    const char   *indicator_service_180;
236    const char   *indicator_service_270;
237    unsigned char selection_clear_enable;
238
239    /* Not part of the EET file */
240    Eina_Bool     is_mirrored : 1;
241    Eina_Bool     translate : 1;
242 };
243
244 struct _Elm_Module
245 {
246    int          version;
247    const char  *name;
248    const char  *as;
249    const char  *so_path;
250    const char  *data_dir;
251    const char  *bin_dir;
252    Eina_Module *module;
253    void        *data;
254    void        *api;
255    int          (*init_func)(Elm_Module *m);
256    int          (*shutdown_func)(Elm_Module *m);
257    int          references;
258 };
259
260 struct _Elm_Datetime_Module_Data
261 {
262    Evas_Object *base;
263    void         (*field_limit_get)(Evas_Object *obj,
264                                    Elm_Datetime_Field_Type field_type,
265                                    int *range_min,
266                                    int *range_max);
267    const char  *(*field_format_get)(Evas_Object * obj,
268                                     Elm_Datetime_Field_Type field_type);
269 };
270
271 void                 _elm_emotion_init(void);
272 void                 _elm_emotion_shutdown(void);
273
274 int                  _elm_ews_wm_init(void);
275 void                 _elm_ews_wm_shutdown(void);
276 void                 _elm_ews_wm_rescale(Elm_Theme *th,
277                                          Eina_Bool use_theme);
278
279 void                 _elm_win_shutdown(void);
280 void                 _elm_win_rescale(Elm_Theme *th,
281                                       Eina_Bool use_theme);
282 void                 _elm_win_access(Eina_Bool is_access);
283 void                 _elm_win_translate(void);
284
285 Ecore_X_Window       _elm_ee_xwin_get(const Ecore_Evas *ee);
286
287 Eina_Bool            _elm_theme_object_set(Evas_Object *parent,
288                                            Evas_Object *o,
289                                            const char *clas,
290                                            const char *group,
291                                            const char *style);
292 Eina_Bool            _elm_theme_object_icon_set(Evas_Object *o,
293                                                 const char *group,
294                                                 const char *style);
295 Eina_Bool             _elm_theme_set(Elm_Theme *th,
296                                     Evas_Object *o,
297                                     const char *clas,
298                                     const char *group,
299                                     const char *style);
300 Eina_Bool            _elm_theme_icon_set(Elm_Theme *th,
301                                          Evas_Object *o,
302                                          const char *group,
303                                          const char *style);
304 Eina_Bool            _elm_theme_parse(Elm_Theme *th,
305                                       const char *theme);
306 void                 _elm_theme_shutdown(void);
307
308 void                 _elm_module_init(void);
309 void                 _elm_module_shutdown(void);
310 void                 _elm_module_parse(const char *s);
311 Elm_Module          *_elm_module_find_as(const char *as);
312 Elm_Module          *_elm_module_add(const char *name,
313                                      const char *as);
314 void                 _elm_module_del(Elm_Module *m);
315 Eina_Bool            _elm_module_load(Elm_Module *m);
316 void                 _elm_module_unload(Elm_Module *m);
317 const void          *_elm_module_symbol_get(Elm_Module *m,
318                                             const char *name);
319
320 void                 _elm_widget_top_win_focused_set(Evas_Object *obj,
321                                                      Eina_Bool top_win_focused);
322 Eina_Bool            _elm_widget_top_win_focused_get(const Evas_Object *obj);
323
324 void                 _elm_unneed_ethumb(void);
325 void                 _elm_unneed_web(void);
326
327 void                 _elm_rescale(void);
328
329 void                 _elm_config_init(void);
330 void                 _elm_config_sub_init(void);
331 void                 _elm_config_shutdown(void);
332 void                 _elm_config_sub_shutdown(void);
333 Eina_Bool            _elm_config_save(void);
334 void                 _elm_config_reload(void);
335
336 void                 _elm_recache(void);
337
338 const char          *_elm_config_current_profile_get(void);
339 const char          *_elm_config_profile_dir_get(const char *prof,
340                                                  Eina_Bool is_user);
341 Eina_List           *_elm_config_profiles_list(void);
342 void                 _elm_config_all_update(void);
343 void                 _elm_config_profile_set(const char *profile);
344 Eina_Bool            _elm_config_profile_exists(const char *profile);
345
346 void                 _elm_config_engine_set(const char *engine);
347
348 Eina_List           *_elm_config_font_overlays_list(void);
349 void                 _elm_config_font_overlay_set(const char *text_class,
350                                                   const char *font,
351                                                   Evas_Font_Size size);
352 void                 _elm_config_font_overlay_remove(const char *text_class);
353 void                 _elm_config_font_overlay_apply(void);
354 Eina_List           *_elm_config_text_classes_get(void);
355 void                 _elm_config_text_classes_free(Eina_List *l);
356
357 Eina_Bool            _elm_config_access_get(void);
358 void                 _elm_config_access_set(Eina_Bool is_access);
359
360 Elm_Font_Properties *_elm_font_properties_get(Eina_Hash **font_hash,
361                                               const char *font);
362 Eina_Hash           *_elm_font_available_hash_add(Eina_Hash *font_hash,
363                                                   const char *full_name);
364 void                 _elm_font_available_hash_del(Eina_Hash *hash);
365
366 void                 elm_tooltip_theme(Elm_Tooltip *tt);
367 void                 elm_object_sub_tooltip_content_cb_set(Evas_Object *eventarea,
368                                                            Evas_Object *owner,
369                                                            Elm_Tooltip_Content_Cb func,
370                                                            const void *data,
371                                                            Evas_Smart_Cb del_cb);
372 void                 elm_cursor_theme(Elm_Cursor *cur);
373 void                 elm_object_sub_cursor_set(Evas_Object *eventarea,
374                                                Evas_Object *owner,
375                                                const char *cursor);
376
377 void                 elm_menu_clone(Evas_Object *from_menu,
378                                     Evas_Object *to_menu,
379                                     Elm_Object_Item *parent);
380
381 char                *_elm_util_mkup_to_text(const char *mkup);
382 char                *_elm_util_text_to_mkup(const char *text);
383
384 Eina_Bool            _elm_video_check(Evas_Object *video);
385
386 Eina_List           *_elm_config_color_list_get(const char *palette_name);
387 void                 _elm_config_color_set(const char *palette_name,
388                                            int r,
389                                            int g,
390                                            int b,
391                                            int a);
392 void                 _elm_config_colors_free(const char *palette_name);
393
394 /* DEPRECATED, will be removed on next release */
395 void                 _elm_icon_signal_emit(Evas_Object *obj,
396                                            const char *emission,
397                                            const char *source);
398 void                 _elm_icon_signal_callback_add(Evas_Object *obj,
399                                                    const char *emission,
400                                                    const char *source,
401                                                    Edje_Signal_Cb func_cb,
402                                                    void *data);
403 void                *_elm_icon_signal_callback_del(Evas_Object *obj,
404                                                    const char *emission,
405                                                    const char *source,
406                                                    Edje_Signal_Cb func_cb);
407 /* end of DEPRECATED */
408
409 extern char *_elm_appname;
410 extern Elm_Config *_elm_config;
411 extern const char *_elm_data_dir;
412 extern const char *_elm_lib_dir;
413 extern int _elm_log_dom;
414 extern Eina_List *_elm_win_list;
415 extern int _elm_win_deferred_free;
416 extern const char *_elm_preferred_engine;
417
418 #ifdef ENABLE_NLS
419 /* Our gettext wrapper, used to disable translation of elm if the app
420  * is not translated. */
421 static inline const char *
422 _elm_dgettext(const char *string)
423 {
424    if (EINA_UNLIKELY(_elm_config->translate == EINA_FALSE))
425      {
426         return string;
427      }
428
429    return dgettext(PACKAGE, string);
430 }
431
432 #endif
433
434 /* Used by the paste handler */
435 void   _elm_entry_entry_paste(Evas_Object *obj, const char *entry);
436
437 double _elm_atof(const char *s);
438
439 #endif