Elementary: Add support for the PSL1GHT engine
[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
16 #include "elm_widget.h"
17
18 #define CRITICAL(...) EINA_LOG_DOM_CRIT(_elm_log_dom, __VA_ARGS__)
19 #define ERR(...)      EINA_LOG_DOM_ERR (_elm_log_dom, __VA_ARGS__)
20 #define WRN(...)      EINA_LOG_DOM_WARN(_elm_log_dom, __VA_ARGS__)
21 #define INF(...)      EINA_LOG_DOM_INFO(_elm_log_dom, __VA_ARGS__)
22 #define DBG(...)      EINA_LOG_DOM_DBG (_elm_log_dom, __VA_ARGS__)
23
24 #ifdef ENABLE_NLS
25 # include <libintl.h>
26 # define E_(string) _elm_dgettext(string)
27 #else
28 # ifndef setlocale
29 #  define setlocale(c, l)
30 # endif
31 # ifndef libintl_setlocale
32 #  define libintl_setlocale(c, l)
33 # endif
34 # ifndef bindtextdomain
35 #  define bindtextdomain(domain,dir)
36 # endif
37 # ifndef libintl_bindtextdomain
38 #  define libintl_bindtextdomain(domain,dir)
39 # endif
40 # define E_(string) (string)
41 #endif
42 #define N_(string) (string)
43
44 typedef struct _Elm_Config    Elm_Config;
45 typedef struct _Elm_Module    Elm_Module;
46
47 struct _Elm_Theme
48 {
49    Eina_List  *overlay;
50    Eina_List  *themes;
51    Eina_List  *extension;
52    Eina_Hash  *cache;
53    Eina_Hash  *cache_data;
54    Elm_Theme  *ref_theme;
55    Eina_List  *referrers;
56    const char *theme;
57    int         ref;
58 };
59
60 /* increment this whenever we change config enough that you need new
61  * defaults for elm to work.
62  */
63 #define ELM_CONFIG_EPOCH           0x0001
64 /* increment this whenever a new set of config values are added but the users
65  * config doesn't need to be wiped - simply new values need to be put in
66  */
67 #define ELM_CONFIG_FILE_GENERATION 0x0003
68 #define ELM_CONFIG_VERSION         ((ELM_CONFIG_EPOCH << 16) | ELM_CONFIG_FILE_GENERATION)
69 /* NB: profile configuration files (.src) must have their
70  * "config_version" entry's value up-to-date with ELM_CONFIG_VERSION
71  * (in decimal)!! */
72
73 /* note: always remember to sync it with elm_config.c */
74 extern const char *_elm_engines[];
75
76 #define ELM_SOFTWARE_X11      (_elm_engines[0])
77 #define ELM_SOFTWARE_FB       (_elm_engines[1])
78 #define ELM_SOFTWARE_DIRECTFB (_elm_engines[2])
79 #define ELM_SOFTWARE_16_X11   (_elm_engines[3])
80 #define ELM_SOFTWARE_8_X11    (_elm_engines[4])
81 #define ELM_XRENDER_X11       (_elm_engines[5])
82 #define ELM_OPENGL_X11        (_elm_engines[6])
83 #define ELM_SOFTWARE_WIN32    (_elm_engines[7])
84 #define ELM_SOFTWARE_16_WINCE (_elm_engines[8])
85 #define ELM_SOFTWARE_SDL      (_elm_engines[9])
86 #define ELM_SOFTWARE_16_SDL   (_elm_engines[10])
87 #define ELM_OPENGL_SDL        (_elm_engines[11])
88 #define ELM_BUFFER            (_elm_engines[12])
89 #define ELM_EWS               (_elm_engines[13])
90 #define ELM_OPENGL_COCOA      (_elm_engines[14])
91 #define ELM_SOFTWARE_PSL1GHT  (_elm_engines[15])
92
93 #define ELM_FONT_TOKEN_STYLE ":style="
94
95 #define ELM_ACCESS_MODE_OFF 0
96 #define ELM_ACCESS_MODE_ON 1
97
98 struct _Elm_Config
99 {
100    int            config_version;
101    const char    *engine;
102    unsigned char  vsync;
103    unsigned char  thumbscroll_enable;
104    int            thumbscroll_threshold;
105    double         thumbscroll_momentum_threshold;
106    double         thumbscroll_friction;
107    double         thumbscroll_bounce_friction;
108    double         page_scroll_friction;
109    double         bring_in_scroll_friction;
110    double         zoom_friction;
111    unsigned char  thumbscroll_bounce_enable;
112    double         thumbscroll_border_friction;
113    double         thumbscroll_sensitivity_friction;
114    double         scroll_smooth_amount;
115    double         scroll_smooth_history_weight;
116    double         scroll_smooth_future_time;
117    double         scroll_smooth_time_window;
118    double         scale;
119    int            bgpixmap;
120    int            compositing;
121    Eina_List     *font_dirs;
122    Eina_List     *font_overlays;
123    int            font_hinting;
124    int            cache_flush_poll_interval;
125    unsigned char  cache_flush_enable;
126    int            image_cache;
127    int            font_cache;
128    int            edje_cache;
129    int            edje_collection_cache;
130    int            finger_size;
131    double         fps;
132    const char    *theme;
133    const char    *modules;
134    double         tooltip_delay;
135    unsigned char  cursor_engine_only;
136    unsigned char  focus_highlight_enable;
137    unsigned char  focus_highlight_animate;
138    int            toolbar_shrink_mode;
139    unsigned char  fileselector_expand_enable;
140    unsigned char  inwin_dialogs_enable;
141    int            icon_size;
142    double         longpress_timeout;
143    unsigned char  effect_enable;
144    unsigned char  desktop_entry;
145    Eina_Bool      password_show_last;
146    double         password_show_last_timeout;
147    double         glayer_zoom_finger_factor;
148    double         glayer_zoom_wheel_factor;
149    double         glayer_zoom_distance_tolerance;
150    double         glayer_rotate_angular_tolerance;
151    double         glayer_line_min_length;
152    double         glayer_line_distance_tolerance;
153    double         glayer_line_angular_tolerance;
154    unsigned int   glayer_flick_time_limit_ms;
155    double         glayer_long_tap_start_timeout;
156    int            access_mode;
157    Eina_Bool      glayer_continues_enable;
158
159    /* Not part of the EET file */
160    Eina_Bool      is_mirrored : 1;
161    Eina_Bool      translate : 1;
162 };
163
164 struct _Elm_Module
165 {
166    int          version;
167    const char  *name;
168    const char  *as;
169    const char  *so_path;
170    const char  *data_dir;
171    const char  *bin_dir;
172    Eina_Module *module;
173    void        *data;
174    void        *api;
175    int        (*init_func) (Elm_Module *m);
176    int        (*shutdown_func) (Elm_Module *m);
177    int          references;
178 };
179
180 int                 _elm_ews_wm_init(void);
181 void                _elm_ews_wm_shutdown(void);
182 void                _elm_ews_wm_rescale(Elm_Theme *th, Eina_Bool use_theme);
183
184 void                _elm_win_shutdown(void);
185 void                _elm_win_rescale(Elm_Theme *th, Eina_Bool use_theme);
186 void                _elm_win_translate(void);
187
188 Eina_Bool           _elm_theme_object_set(Evas_Object *parent, Evas_Object *o, const char *clas, const char *group, const char *style);
189 Eina_Bool           _elm_theme_object_icon_set(Evas_Object *parent, Evas_Object *o, const char *group, const char *style);
190 Eina_Bool           _elm_theme_set(Elm_Theme *th, Evas_Object *o, const char *clas, const char *group, const char *style);
191 Eina_Bool           _elm_theme_icon_set(Elm_Theme *th, Evas_Object *o, const char *group, const char *style);
192 Eina_Bool           _elm_theme_parse(Elm_Theme *th, const char *theme);
193 void                _elm_theme_shutdown(void);
194
195 void                _elm_module_init(void);
196 void                _elm_module_shutdown(void);
197 void                _elm_module_parse(const char *s);
198 Elm_Module         *_elm_module_find_as(const char *as);
199 Elm_Module         *_elm_module_add(const char *name, const char *as);
200 void                _elm_module_del(Elm_Module *m);
201 Eina_Bool           _elm_module_load(Elm_Module *m);
202 void                _elm_module_unload(Elm_Module *m);
203 const void         *_elm_module_symbol_get(Elm_Module *m, const char *name);
204
205 void                _elm_widget_type_clear(void);
206 void                _elm_widget_focus_region_show(const Evas_Object *obj);
207 void                _elm_widget_top_win_focused_set(Evas_Object *obj, Eina_Bool top_win_focused);
208 Eina_Bool           _elm_widget_top_win_focused_get(const Evas_Object *obj);
209
210 void                _elm_unneed_ethumb(void);
211 void                _elm_unneed_web(void);
212
213 void                _elm_rescale(void);
214 void                _elm_widget_mirrored_reload(Evas_Object *obj);
215
216 void                _elm_config_init(void);
217 void                _elm_config_sub_init(void);
218 void                _elm_config_shutdown(void);
219 void                _elm_config_sub_shutdown(void);
220 Eina_Bool           _elm_config_save(void);
221 void                _elm_config_reload(void);
222
223 void                _elm_recache(void);
224
225 const char         *_elm_config_current_profile_get(void);
226 const char         *_elm_config_profile_dir_get(const char *prof, Eina_Bool is_user);
227 Eina_List          *_elm_config_profiles_list(void);
228 void                _elm_config_all_update(void);
229 void                _elm_config_profile_set(const char *profile);
230
231 void                _elm_config_engine_set(const char *engine);
232
233 Eina_List          *_elm_config_font_overlays_list(void);
234 void                _elm_config_font_overlay_set(const char *text_class, const char *font, Evas_Font_Size size);
235 void                _elm_config_font_overlay_remove(const char *text_class);
236 void                _elm_config_font_overlay_apply(void);
237 Eina_List          *_elm_config_text_classes_get(void);
238 void                _elm_config_text_classes_free(Eina_List *l);
239
240 Elm_Font_Properties *_elm_font_properties_get(Eina_Hash **font_hash, const char *font);
241 Eina_Hash           *_elm_font_available_hash_add(Eina_Hash *font_hash, const char *full_name);
242 void                 _elm_font_available_hash_del(Eina_Hash *hash);
243
244 void                 elm_tooltip_theme(Elm_Tooltip *tt);
245 void                 elm_object_sub_tooltip_content_cb_set(Evas_Object *eventarea, Evas_Object *owner, Elm_Tooltip_Content_Cb func, const void *data, Evas_Smart_Cb del_cb);
246 void                 elm_cursor_theme(Elm_Cursor *cur);
247 void                 elm_object_sub_cursor_set(Evas_Object *eventarea, Evas_Object *owner, const char *cursor);
248
249 void                 elm_menu_clone(Evas_Object *from_menu, Evas_Object *to_menu, Elm_Menu_Item *parent);
250
251 Eina_Bool           _elm_dangerous_call_check(const char *call);
252
253 Evas_Object        *_elm_scroller_edje_object_get(Evas_Object *obj);
254
255 char               *_elm_util_mkup_to_text(const char *mkup);
256 char               *_elm_util_text_to_mkup(const char *text);
257
258 Eina_Bool           _elm_video_check(Evas_Object *video);
259
260
261 extern char        *_elm_appname;
262 extern Elm_Config  *_elm_config;
263 extern const char  *_elm_data_dir;
264 extern const char  *_elm_lib_dir;
265 extern int          _elm_log_dom;
266 extern Eina_List   *_elm_win_list;
267 extern int          _elm_win_deferred_free;
268
269 /* Our gettext wrapper, used to disable translation of elm if the app
270  * is not translated. */
271 static inline const char *
272 _elm_dgettext(const char *string)
273 {
274    if (EINA_UNLIKELY(_elm_config->translate == EINA_FALSE))
275      {
276         return string;
277      }
278
279    return dgettext(PACKAGE, string);
280 }
281
282
283 /* Used by the paste handler */
284 void _elm_entry_entry_paste(Evas_Object *obj, const char *entry);
285
286 #endif