fix shutdown+init cycle with deferred win free
[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 "els_pan.h"
17 #include "els_scroller.h"
18 #include "els_box.h"
19 #include "els_icon.h"
20
21 #include "elm_widget.h"
22
23 #define CRITICAL(...) EINA_LOG_DOM_CRIT(_elm_log_dom, __VA_ARGS__)
24 #define ERR(...)      EINA_LOG_DOM_ERR (_elm_log_dom, __VA_ARGS__)
25 #define WRN(...)      EINA_LOG_DOM_WARN(_elm_log_dom, __VA_ARGS__)
26 #define INF(...)      EINA_LOG_DOM_INFO(_elm_log_dom, __VA_ARGS__)
27 #define DBG(...)      EINA_LOG_DOM_DBG (_elm_log_dom, __VA_ARGS__)
28
29 #define _(string) gettext(string)
30
31 typedef struct _Elm_Config    Elm_Config;
32 typedef struct _Elm_Module    Elm_Module;
33
34 struct _Elm_Theme
35 {
36    Eina_List  *overlay;
37    Eina_List  *themes;
38    Eina_List  *extension;
39    Eina_Hash  *cache;
40    Elm_Theme  *ref_theme;
41    Eina_List  *referrers;
42    const char *theme;
43    int         ref;
44 };
45
46 /* increment this whenever we change config enough that you need new
47  * defaults for elm to work.
48  */
49 #define ELM_CONFIG_EPOCH           0x0001
50 /* increment this whenever a new set of config values are added but the users
51  * config doesn't need to be wiped - simply new values need to be put in
52  */
53 #define ELM_CONFIG_FILE_GENERATION 0x0003
54 #define ELM_CONFIG_VERSION         ((ELM_CONFIG_EPOCH << 16) | ELM_CONFIG_FILE_GENERATION)
55 /* NB: profile configuration files (.src) must have their
56  * "config_version" entry's value up-to-date with ELM_CONFIG_VERSION
57  * (in decimal)!! */
58
59 /* note: always remember to sync it with elm_config.c */
60 extern const char *_elm_engines[];
61
62 #define ELM_SOFTWARE_X11      (_elm_engines[0])
63 #define ELM_SOFTWARE_FB       (_elm_engines[1])
64 #define ELM_SOFTWARE_DIRECTFB (_elm_engines[2])
65 #define ELM_SOFTWARE_16_X11   (_elm_engines[3])
66 #define ELM_SOFTWARE_8_X11    (_elm_engines[4])
67 #define ELM_XRENDER_X11       (_elm_engines[5])
68 #define ELM_OPENGL_X11        (_elm_engines[6])
69 #define ELM_SOFTWARE_WIN32    (_elm_engines[7])
70 #define ELM_SOFTWARE_16_WINCE (_elm_engines[8])
71 #define ELM_SOFTWARE_SDL      (_elm_engines[9])
72 #define ELM_SOFTWARE_16_SDL   (_elm_engines[10])
73 #define ELM_OPENGL_SDL        (_elm_engines[11])
74
75 #define ELM_FONT_TOKEN_STYLE ":style="
76
77 struct _Elm_Config
78 {
79    int          config_version;
80    const char  *engine;
81    Eina_Bool    thumbscroll_enable;
82    int          thumbscroll_threshold;
83    double       thumbscroll_momentum_threshold;
84    double       thumbscroll_friction;
85    double       thumbscroll_bounce_friction;
86    double       page_scroll_friction;
87    double       bring_in_scroll_friction;
88    double       zoom_friction;
89    Eina_Bool    thumbscroll_bounce_enable;
90    double       thumbscroll_border_friction;
91    double       scale;
92    int          bgpixmap;
93    int          compositing;
94    Eina_List   *font_dirs;
95    Eina_List   *font_overlays;
96    int          font_hinting;
97    int          cache_flush_poll_interval;
98    Eina_Bool    cache_flush_enable;
99    int          image_cache;
100    int          font_cache;
101    int          edje_cache;
102    int          edje_collection_cache;
103    int          finger_size;
104    double       fps;
105    const char  *theme;
106    const char  *modules;
107    double       tooltip_delay;
108    Eina_Bool    cursor_engine_only;
109    Eina_Bool    focus_highlight_enable;
110    Eina_Bool    focus_highlight_animate;
111    int          toolbar_shrink_mode;
112    Eina_Bool    fileselector_expand_enable;
113    Eina_Bool    inwin_dialogs_enable;
114    int          icon_size;
115    double       longpress_timeout;
116    Eina_Bool    is_mirrored : 1;
117    Eina_Bool    effect_enable;
118 };
119
120 struct _Elm_Module
121 {
122    int          version;
123    const char  *name;
124    const char  *as;
125    const char  *so_path;
126    const char  *data_dir;
127    const char  *bin_dir;
128    void        *handle;
129    void        *data;
130    void        *api;
131    int        (*init_func) (Elm_Module *m);
132    int        (*shutdown_func) (Elm_Module *m);
133    int          references;
134 };
135
136 void                _elm_win_shutdown(void);
137 void                _elm_win_rescale(Elm_Theme *th, Eina_Bool use_theme);
138
139 Eina_Bool           _elm_theme_object_set(Evas_Object *parent, Evas_Object *o, const char *clas, const char *group, const char *style);
140 Eina_Bool           _elm_theme_object_icon_set(Evas_Object *parent, Evas_Object *o, const char *group, const char *style);
141 Eina_Bool           _elm_theme_set(Elm_Theme *th, Evas_Object *o, const char *clas, const char *group, const char *style);
142 Eina_Bool           _elm_theme_icon_set(Elm_Theme *th, Evas_Object *o, const char *group, const char *style);
143 Eina_Bool           _elm_theme_parse(Elm_Theme *th, const char *theme);
144 void                _elm_theme_shutdown(void);
145
146 void                _elm_module_init(void);
147 void                _elm_module_shutdown(void);
148 void                _elm_module_parse(const char *s);
149 Elm_Module         *_elm_module_find_as(const char *as);
150 Elm_Module         *_elm_module_add(const char *name, const char *as);
151 void                _elm_module_del(Elm_Module *m);
152 Eina_Bool           _elm_module_load(Elm_Module *m);
153 void                _elm_module_unload(Elm_Module *m);
154 const void         *_elm_module_symbol_get(Elm_Module *m, const char *name);
155
156 void                _elm_widget_type_clear(void);
157 void                _elm_widget_focus_region_show(const Evas_Object *obj);
158
159 void                _elm_unneed_ethumb(void);
160
161 void                _elm_rescale(void);
162 void                _elm_widget_mirrored_reload(Evas_Object *obj);
163
164 void                _elm_config_init(void);
165 void                _elm_config_sub_init(void);
166 void                _elm_config_shutdown(void);
167 Eina_Bool           _elm_config_save(void);
168 void                _elm_config_reload(void);
169
170 void                _elm_recache(void);
171
172 const char         *_elm_config_current_profile_get(void);
173 const char         *_elm_config_profile_dir_get(const char *prof, Eina_Bool is_user);
174 Eina_List          *_elm_config_profiles_list(void);
175 void                _elm_config_profile_set(const char *profile);
176
177 void                _elm_config_engine_set(const char *engine);
178
179 Eina_List          *_elm_config_font_overlays_list(void);
180 void                _elm_config_font_overlay_set(const char *text_class, const char *font, Evas_Font_Size size);
181 void                _elm_config_font_overlay_remove(const char *text_class);
182 void                _elm_config_font_overlay_apply(void);
183 Eina_List          *_elm_config_text_classes_get(void);
184 void                _elm_config_text_classes_free(Eina_List *l);
185
186 Elm_Font_Properties *_elm_font_properties_get(Eina_Hash **font_hash, const char *font);
187 Eina_Hash           *_elm_font_available_hash_add(Eina_Hash *font_hash, const char *full_name);
188 void                 _elm_font_available_hash_del(Eina_Hash *hash);
189
190 void                 elm_tooltip_theme(Elm_Tooltip *tt);
191 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);
192 void                 elm_cursor_theme(Elm_Cursor *cur);
193 void                 elm_object_sub_cursor_set(Evas_Object *eventarea, Evas_Object *owner, const char *cursor);
194
195 void                 elm_menu_clone(Evas_Object *from_menu, Evas_Object *to_menu, Elm_Menu_Item *parent);
196
197 Eina_Bool           _elm_dangerous_call_check(const char *call);
198
199 Evas_Object        *_elm_scroller_edje_object_get(Evas_Object *obj);
200
201 char               *_elm_util_mkup_to_text(const char *mkup);
202 char               *_elm_util_text_to_mkup(const char *text);
203
204 extern char        *_elm_appname;
205 extern Elm_Config  *_elm_config;
206 extern const char  *_elm_data_dir;
207 extern const char  *_elm_lib_dir;
208 extern int          _elm_log_dom;
209 extern Eina_List   *_elm_win_list;
210 extern int          _elm_win_deferred_free;
211
212 #endif