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