2 # include "elementary_config.h"
5 #include <dlfcn.h> /* dlopen,dlclose,etc */
7 #ifdef HAVE_CRT_EXTERNS_H
8 # include <crt_externs.h>
15 #include <Elementary.h>
18 #define SEMI_BROKEN_QUICKLAUNCH 1
20 static Elm_Version _version = { VMAJ, VMIN, VMIC, VREV };
21 EAPI Elm_Version *elm_version = &_version;
26 * This group includes functions of elm_main.c
31 _elm_dangerous_call_check(const char *call)
36 snprintf(buf, sizeof(buf), "%i.%i.%i.%i", VMAJ, VMIN, VMIC, VREV);
37 eval = getenv("ELM_NO_FINGER_WAGGLING");
38 if ((eval) && (!strcmp(eval, buf)))
40 printf("ELEMENTARY FINGER WAGGLE!!!!!!!!!!\n"
43 "PLEASE see the API documentation for this function. This call\n"
44 "should almost never be used. Only in very special cases.\n"
46 "To remove this warning please set the environment variable:\n"
47 " ELM_NO_FINGER_WAGGLING\n"
48 "To the value of the Elementary version + revision number. e.g.:\n"
57 * @defgroup Start Getting Started
60 * To write an Elementary app, you can get started with the following:
63 * #include <Elementary.h>
64 * #ifndef ELM_LIB_QUICKLAUNCH
66 * elm_main(int argc, char **argv)
68 * // create window(s) here and do any application init
69 * elm_run(); // run main loop
70 * elm_shutdown(); // after mainloop finishes running, shutdown
71 * return 0; // exit 0 for exit code
77 * To take full advantage of the quicklaunch architecture for launching
78 * processes as quickly as possible (saving time at startup time like
79 * connecting to X11, loading and linking shared libraries) you may want to
80 * use the following configure.in/configure.ac and Makefile.am and autogen.sh
81 * script to generate your files. It is assumed your application uses the
82 * main.c file for its code.
84 * configure.in/configure.ac:
87 AC_INIT(myapp, 0.0.0, myname@mydomain.com)
89 AC_CONFIG_SRCDIR(configure.in)
91 AM_INIT_AUTOMAKE(1.6 dist-bzip2)
92 AM_CONFIG_HEADER(config.h)
102 define([AC_LIBTOOL_LANG_CXX_CONFIG], [:])dnl
103 define([AC_LIBTOOL_LANG_F77_CONFIG], [:])dnl
106 PKG_CHECK_MODULES([ELEMENTARY], elementary)
114 AUTOMAKE_OPTIONS = 1.4 foreign
115 MAINTAINERCLEANFILES = Makefile.in
117 INCLUDES = -I$(top_srcdir) @ELEMENTARY_CFLAGS@
120 myapp_LTLIBRARIES = myapp.la
124 myapp_la_SOURCES = main.c
125 myapp_la_LIBADD = @ELEMENTARY_LIBS@
127 myapp_la_LDFLAGS = -module -avoid-version -no-undefined
129 myapp_SOURCES = main.c
130 myapp_LDADD = @ELEMENTARY_LIBS@
131 myapp_CFLAGS = -DELM_LIB_QUICKLAUNCH=1
138 rm -rf autom4te.cache
139 rm -f aclocal.m4 ltmain.sh
144 echo "Running aclocal..." ; aclocal $ACLOCAL_FLAGS -I m4 || exit 1
145 echo "Running autoheader..." ; autoheader || exit 1
146 echo "Running autoconf..." ; autoconf || exit 1
147 echo "Running libtoolize..." ; (libtoolize --copy --automake || glibtoolize --automake) || exit 1
148 echo "Running automake..." ; automake --add-missing --copy --gnu || exit 1
150 if [ -z "$NOCONFIGURE" ]; then
155 * To gnerate all the things needed to bootstrap just run:
161 * This will generate Makefile.in's, the confgure script and everything else.
162 * After this it works like all normal autotools projects:
169 * Note sudo was assumed to get root permissions, as this would install in
170 * /usr/local which is system-owned. Ue any way you like to gain root, or
171 * specify a different prefix with configure:
174 ./confiugre --prefix=$HOME/mysoftware
177 * Also remember that autotools buys you some useful commands like:
182 * This uninstalls the software after it was installed with "make install".
183 * It is very useful to clear up what you built if you wish to clean the
190 * This firstly checks if your build tree is "clean" and ready for
191 * distribution. It also builds a tarball (myapp-0.0.0.tar.gz) that is
192 * ready to upload and distribute to the world, that contains the generated
193 * Makefile.in's and configure script. The users do not need to run
194 * autogen.sh - just configure and on. They don't need autotools installed.
195 * This tarball also builds cleanly, has all the sources it needs to build
196 * included (that is sources for your application, not libraries it depends
197 * on like Elementary). It builds cleanly in a buildroot and does not
198 * contain any files that are temporarily generated like binaries and other
199 * build-gnerated files, so the tarball is clean, and no need to worry
200 * about cleaning up your tree before packaging.
206 * This cleans up all build files (binaries, objects etc.) from the tree.
212 * This cleans out all files from the build and from configure's output too.
215 make maintainer-clean
218 * This deletes all the files autogen.sh will produce so the tree is clean
219 * to be put into a revision-control system (like CVS, SVN or GIT for example).
221 * The above will build a library - libmyapp.so and install in the target
222 * library directory (default is /usr/local/lib). You will also get a
223 * myapp.a and myapp.la - these are useless and can be deleted. Libtool likes
224 * to generate these all the time. You will also get a binary in the target
225 * binary directory (default is /usr/local/bin). This is a "debug binary".
226 * This will run and dlopen() the myapp.so and then jump to it's elm_main
227 * function. This allows for easy debugging with GDB and Valgrind. When you
228 * are ready to go to production do the following:
230 * 1. delete the myapp binary. i.e. rm /usr/local/bin/myapp
232 * 2. symlink the myapp binary to elementary_run (supplied by elementary).
233 * i.e. ln -s elmentary_run /usr/local/bin/myapp
235 * 3. run elementary_quicklaunch as part of your graphical login session and
238 * This will man elementary_quicklaunch does pre-initialization before the
239 * application needs to be run, saving the effort at the time the application
240 * is needed, thus speeding up the time it takes to appear.
242 * If you don't want to use the quicklaunch infrastructure (which is
243 * optional), you can execute the old fashioned way by just running the
244 * myapp binary loader than will load the myapp.so for you, or you can
245 * remove the split-file binary and put it into one binary as things always
246 * have been with the following configure.in/configure.ac and Makfile.am
249 * configure.in/configure.ac:
252 AC_INIT(myapp, 0.0.0, myname@mydomain.com)
254 AC_CONFIG_SRCDIR(configure.in)
256 AM_INIT_AUTOMAKE(1.6 dist-bzip2)
257 AM_CONFIG_HEADER(config.h)
266 PKG_CHECK_MODULES([ELEMENTARY], elementary)
274 AUTOMAKE_OPTIONS = 1.4 foreign
275 MAINTAINERCLEANFILES = Makefile.in
277 INCLUDES = -I$(top_srcdir) @ELEMENTARY_CFLAGS@
281 myapp_SOURCES = main.c
282 myapp_LDADD = @ELEMENTARY_LIBS@
286 * Notice that they are the same as before, just with libtool and library
287 * building sections removed. Both ways work for building elementary
288 * applications. It is up to you to decide what is best for you. If you just
289 * follow the template above, you can do it both ways and can decide at build
290 * time. The more advanced of you may suggest making it a configure option.
291 * That is perfectly valid, but has been left out here for simplicity, as our
292 * aim to have an Elementary (and EFL) tutorial, not an autoconf & automake
297 static Eina_Bool _elm_signal_exit(void *data,
301 char *_elm_appname = NULL;
302 const char *_elm_data_dir = NULL;
303 const char *_elm_lib_dir = NULL;
304 int _elm_log_dom = -1;
306 EAPI int ELM_EVENT_POLICY_CHANGED = 0;
308 static int _elm_init_count = 0;
309 static int _elm_sub_init_count = 0;
310 static int _elm_ql_init_count = 0;
311 static int _elm_policies[ELM_POLICY_LAST];
312 static Ecore_Event_Handler *_elm_exit_handler = NULL;
313 static Eina_Bool quicklaunch_on = 0;
316 _elm_signal_exit(void *data __UNUSED__,
317 int ev_type __UNUSED__,
321 return ECORE_CALLBACK_PASS_ON;
327 edje_scale_set(_elm_config->scale);
328 _elm_win_rescale(NULL, EINA_FALSE);
332 * @defgroup General General
337 * Inititalise Elementary
339 * @return The init counter value.
341 * This call is exported only for use by the ELM_MAIN() macro. There is no
342 * need to use this if you use this macro (which is highly advisable).
350 if (_elm_init_count > 1) return _elm_init_count;
351 elm_quicklaunch_init(argc, argv);
352 elm_quicklaunch_sub_init(argc, argv);
353 return _elm_init_count;
357 * Shut down Elementary
359 * @return The init counter value.
361 * This should be called at the end of your application just before it ceases
362 * to do any more processing. This will clean up any permanent resources your
363 * application may have allocated via Elementary that would otherwise persist
364 * on an exit without this call.
371 if (_elm_init_count > 0) return _elm_init_count;
372 // FIXME : it can cause abnormal program exit
373 // _elm_win_shutdown();
374 while (_elm_win_deferred_free) ecore_main_loop_iterate();
375 elm_quicklaunch_sub_shutdown();
376 elm_quicklaunch_shutdown();
377 return _elm_init_count;
381 static int _elm_need_e_dbus = 0;
384 elm_need_e_dbus(void)
387 if (_elm_need_e_dbus++) return EINA_TRUE;
397 _elm_unneed_e_dbus(void)
400 if (--_elm_need_e_dbus) return;
402 _elm_need_e_dbus = 0;
409 static int _elm_need_efreet = 0;
412 elm_need_efreet(void)
415 if (_elm_need_efreet++) return EINA_TRUE;
423 list = efreet_icon_extra_list_get();
426 e_user_dir_concat_static(buf, "icons");
427 *list = eina_list_prepend(*list, (void *)eina_stringshare_add(buf));
428 e_prefix_data_concat_static(buf, "data/icons");
429 *list = eina_list_prepend(*list, (void *)eina_stringshare_add(buf));
440 _elm_unneed_efreet(void)
443 if (--_elm_need_efreet) return;
445 _elm_need_efreet = 0;
446 efreet_trash_shutdown();
447 efreet_mime_shutdown();
453 elm_quicklaunch_mode_set(Eina_Bool ql_on)
455 quicklaunch_on = ql_on;
459 elm_quicklaunch_mode_get(void)
461 return quicklaunch_on;
465 elm_quicklaunch_init(int argc,
468 char buf[PATH_MAX], *s;
470 _elm_ql_init_count++;
471 if (_elm_ql_init_count > 1) return _elm_ql_init_count;
473 _elm_log_dom = eina_log_domain_register("elementary", EINA_COLOR_LIGHTBLUE);
476 EINA_LOG_ERR("could not register elementary log domain.");
477 _elm_log_dom = EINA_LOG_DOMAIN_GLOBAL;
482 ecore_app_args_set(argc, (const char **)argv);
484 memset(_elm_policies, 0, sizeof(_elm_policies));
485 if (!ELM_EVENT_POLICY_CHANGED)
486 ELM_EVENT_POLICY_CHANGED = ecore_event_type_new();
490 _elm_exit_handler = ecore_event_handler_add(ECORE_EVENT_SIGNAL_EXIT, _elm_signal_exit, NULL);
492 if (argv) _elm_appname = strdup(ecore_file_file_get(argv[0]));
496 s = getenv("ELM_DATA_DIR");
497 _elm_data_dir = eina_stringshare_add(s);
501 s = getenv("ELM_PREFIX");
504 snprintf(buf, sizeof(buf), "%s/share/elementary", s);
505 _elm_data_dir = eina_stringshare_add(buf);
510 s = getenv("ELM_LIB_DIR");
511 _elm_lib_dir = eina_stringshare_add(s);
515 s = getenv("ELM_PREFIX");
518 snprintf(buf, sizeof(buf), "%s/lib", s);
519 _elm_lib_dir = eina_stringshare_add(buf);
523 if ((!_elm_data_dir) || (!_elm_lib_dir))
525 Dl_info elementary_dl;
526 // libelementary.so/../../share/elementary/
527 if (dladdr(elm_init, &elementary_dl))
531 dir = ecore_file_dir_get(elementary_dl.dli_fname);
536 if (ecore_file_is_dir(dir))
537 _elm_lib_dir = eina_stringshare_add(dir);
541 dir2 = ecore_file_dir_get(dir);
544 snprintf(buf, sizeof(buf), "%s/share/elementary", dir2);
545 if (ecore_file_is_dir(buf))
546 _elm_data_dir = eina_stringshare_add(buf);
556 _elm_data_dir = eina_stringshare_add(PACKAGE_DATA_DIR);
558 _elm_data_dir = eina_stringshare_add("/");
560 _elm_lib_dir = eina_stringshare_add(PACKAGE_LIB_DIR);
562 _elm_lib_dir = eina_stringshare_add("/");
565 return _elm_ql_init_count;
569 elm_quicklaunch_sub_init(int argc,
572 _elm_sub_init_count++;
573 if (_elm_sub_init_count > 1) return _elm_sub_init_count;
576 #ifdef SEMI_BROKEN_QUICKLAUNCH
577 return _elm_sub_init_count;
582 ecore_app_args_set(argc, (const char **)argv);
586 _elm_config_sub_init();
587 #define ENGINE_COMPARE(name) (!strcmp(_elm_config->engine, name))
588 if (ENGINE_COMPARE(ELM_SOFTWARE_X11) ||
589 ENGINE_COMPARE(ELM_SOFTWARE_16_X11) ||
590 ENGINE_COMPARE(ELM_XRENDER_X11) ||
591 ENGINE_COMPARE(ELM_OPENGL_X11))
592 #undef ENGINE_COMPARE
594 #ifdef HAVE_ELEMENTARY_X
598 ecore_evas_init(); // FIXME: check errors
601 return _elm_sub_init_count;
605 elm_quicklaunch_sub_shutdown(void)
607 _elm_sub_init_count--;
608 if (_elm_sub_init_count > 0) return _elm_sub_init_count;
611 #ifdef SEMI_BROKEN_QUICKLAUNCH
612 return _elm_sub_init_count;
618 _elm_module_shutdown();
619 ecore_imf_shutdown();
620 ecore_evas_shutdown();
621 #define ENGINE_COMPARE(name) (!strcmp(_elm_config->engine, name))
622 if (ENGINE_COMPARE(ELM_SOFTWARE_X11) ||
623 ENGINE_COMPARE(ELM_SOFTWARE_16_X11) ||
624 ENGINE_COMPARE(ELM_XRENDER_X11) ||
625 ENGINE_COMPARE(ELM_OPENGL_X11))
626 #undef ENGINE_COMPARE
628 #ifdef HAVE_ELEMENTARY_X
629 ecore_x_disconnect();
632 #define ENGINE_COMPARE(name) (!strcmp(_elm_config->engine, name))
633 if (ENGINE_COMPARE(ELM_SOFTWARE_X11) ||
634 ENGINE_COMPARE(ELM_SOFTWARE_16_X11) ||
635 ENGINE_COMPARE(ELM_XRENDER_X11) ||
636 ENGINE_COMPARE(ELM_OPENGL_X11) ||
637 ENGINE_COMPARE(ELM_SOFTWARE_SDL) ||
638 ENGINE_COMPARE(ELM_SOFTWARE_16_SDL) ||
639 ENGINE_COMPARE(ELM_OPENGL_SDL) ||
640 ENGINE_COMPARE(ELM_SOFTWARE_WIN32) ||
641 ENGINE_COMPARE(ELM_SOFTWARE_16_WINCE))
642 #undef ENGINE_COMPARE
643 evas_cserve_disconnect();
647 return _elm_sub_init_count;
651 elm_quicklaunch_shutdown(void)
653 _elm_ql_init_count--;
654 if (_elm_ql_init_count > 0) return _elm_ql_init_count;
655 eina_stringshare_del(_elm_data_dir);
656 _elm_data_dir = NULL;
657 eina_stringshare_del(_elm_lib_dir);
663 _elm_config_shutdown();
665 ecore_event_handler_del(_elm_exit_handler);
666 _elm_exit_handler = NULL;
668 _elm_theme_shutdown();
669 _elm_unneed_efreet();
670 _elm_unneed_e_dbus();
671 _elm_unneed_ethumb();
672 ecore_file_shutdown();
676 if ((_elm_log_dom > -1) && (_elm_log_dom != EINA_LOG_DOMAIN_GLOBAL))
678 eina_log_domain_unregister(_elm_log_dom);
682 _elm_widget_type_clear();
685 return _elm_ql_init_count;
689 elm_quicklaunch_seed(void)
691 #ifndef SEMI_BROKEN_QUICKLAUNCH
694 Evas_Object *win, *bg, *bt;
696 win = elm_win_add(NULL, "seed", ELM_WIN_BASIC);
697 bg = elm_bg_add(win);
698 elm_win_resize_object_add(win, bg);
699 evas_object_show(bg);
700 bt = elm_button_add(win);
701 elm_button_label_set(bt, " abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789~-_=+\\|]}[{;:'\",<.>/?");
702 elm_win_resize_object_add(win, bt);
703 ecore_main_loop_iterate();
704 evas_object_del(win);
705 ecore_main_loop_iterate();
706 #define ENGINE_COMPARE(name) (!strcmp(_elm_config->engine, name))
707 if (ENGINE_COMPARE(ELM_SOFTWARE_X11) ||
708 ENGINE_COMPARE(ELM_SOFTWARE_16_X11) ||
709 ENGINE_COMPARE(ELM_XRENDER_X11) ||
710 ENGINE_COMPARE(ELM_OPENGL_X11))
711 #undef ENGINE_COMPARE
713 # ifdef HAVE_ELEMENTARY_X
717 ecore_main_loop_iterate();
722 static void *qr_handle = NULL;
723 static int (*qr_main)(int argc,
727 elm_quicklaunch_prepare(int argc __UNUSED__,
731 char *exe = elm_quicklaunch_exe_path_get(argv[0]);
734 ERR("requested quicklaunch binary '%s' does not exist\n", argv[0]);
742 exe2 = malloc(strlen(exe) + 1 + 10);
744 p = strrchr(exe2, '/');
747 exename = alloca(strlen(p) + 1);
750 strcat(p, "../lib/");
753 if (!access(exe2, R_OK | X_OK))
761 qr_handle = dlopen(exe, RTLD_NOW | RTLD_GLOBAL);
764 fprintf(stderr, "dlerr: %s\n", dlerror());
765 WRN("dlopen('%s') failed: %s", exe, dlerror());
769 INF("dlopen('%s') = %p", exe, qr_handle);
770 qr_main = dlsym(qr_handle, "elm_main");
771 INF("dlsym(%p, 'elm_main') = %p", qr_handle, qr_main);
774 WRN("not quicklauncher capable: no elm_main in '%s'", exe);
793 extern char **environ;
798 for (i = 0, size = 0; environ[i]; i++)
799 size += strlen(environ[i]) + 1;
801 p = malloc((i + 1) * sizeof(char *));
806 for (i = 0; oldenv[i]; i++)
807 environ[i] = strdup(oldenv[i]);
814 elm_quicklaunch_fork(int argc,
817 void (postfork_func) (void *data),
827 // need to accept current environment from elementary_run
834 if (child > 0) return EINA_TRUE;
837 perror("could not fork");
842 perror("could not chdir");
843 args = alloca((argc + 1) * sizeof(char *));
844 for (i = 0; i < argc; i++) args[i] = argv[i];
846 WRN("%s not quicklaunch capable, fallback...", argv[0]);
847 execvp(argv[0], args);
848 ERR("failed to execute '%s': %s", argv[0], strerror(errno));
852 if (child > 0) return EINA_TRUE;
855 perror("could not fork");
858 if (postfork_func) postfork_func(postfork_data);
862 #ifdef SEMI_BROKEN_QUICKLAUNCH
863 ecore_app_args_set(argc, (const char **)argv);
866 _elm_config_sub_init();
867 #define ENGINE_COMPARE(name) (!strcmp(_elm_config->engine, name))
868 if (ENGINE_COMPARE(ELM_SOFTWARE_X11) ||
869 ENGINE_COMPARE(ELM_SOFTWARE_16_X11) ||
870 ENGINE_COMPARE(ELM_XRENDER_X11) ||
871 ENGINE_COMPARE(ELM_OPENGL_X11))
872 #undef ENGINE_COMPARE
874 # ifdef HAVE_ELEMENTARY_X
878 ecore_evas_init(); // FIXME: check errors
886 perror("could not chdir");
887 // FIXME: this is very linux specific. it changes argv[0] of the process
888 // so ps etc. report what you'd expect. for other unixes and os's this
895 ecore_app_args_get(&real_argc, &real_argv);
896 lastarg = real_argv[real_argc - 1] + strlen(real_argv[real_argc - 1]);
897 for (p = real_argv[0]; p < lastarg; p++) *p = 0;
898 strcpy(real_argv[0], argv[0]);
900 ecore_app_args_set(argc, (const char **)argv);
901 ret = qr_main(argc, argv);
915 elm_quicklaunch_cleanup(void)
928 elm_quicklaunch_fallback(int argc,
932 elm_quicklaunch_init(argc, argv);
933 elm_quicklaunch_sub_init(argc, argv);
934 elm_quicklaunch_prepare(argc, argv);
935 ret = qr_main(argc, argv);
941 elm_quicklaunch_exe_path_get(const char *exe)
943 static char *path = NULL;
944 static Eina_List *pathlist = NULL;
948 if (exe[0] == '/') return strdup(exe);
949 if ((exe[0] == '.') && (exe[1] == '/')) return strdup(exe);
950 if ((exe[0] == '.') && (exe[1] == '.') && (exe[2] == '/')) return strdup(exe);
955 path = getenv("PATH");
956 buf2 = alloca(strlen(path) + 1);
961 if ((*p == ':') || (!*p))
966 strncpy(buf2, pp, len);
968 pathlist = eina_list_append(pathlist, eina_stringshare_add(buf2));
980 EINA_LIST_FOREACH(pathlist, l, pathitr)
982 snprintf(buf, sizeof(buf), "%s/%s", pathitr, exe);
983 if (!access(buf, R_OK | X_OK)) return strdup(buf);
991 * This call should be called just after all initialization is complete. This
992 * function will not return until elm_exit() is called. It will keep looping
993 * running the main event/processing loop for Elementary.
999 ecore_main_loop_begin();
1003 * Exit the main loop
1005 * If this call is called, it will flag the main loop to cease processing and
1006 * return back to its parent function.
1012 ecore_main_loop_quit();
1016 * Set new policy value.
1018 * This will emit the ecore event ELM_EVENT_POLICY_CHANGED in the main
1019 * loop giving the event information Elm_Event_Policy_Changed with
1020 * policy identifier, new and old values.
1022 * @param policy policy identifier as in Elm_Policy.
1023 * @param value policy value, depends on identifiers, usually there is
1024 * an enumeration with the same prefix as the policy name, for
1025 * example: ELM_POLICY_QUIT and Elm_Policy_Quit
1026 * (ELM_POLICY_QUIT_NONE, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED).
1029 * @return @c EINA_TRUE on success or @c EINA_FALSE on error (right
1030 * now just invalid policy identifier, but in future policy
1031 * value might be enforced).
1034 elm_policy_set(unsigned int policy,
1037 Elm_Event_Policy_Changed *ev;
1039 if (policy >= ELM_POLICY_LAST)
1042 if (value == _elm_policies[policy])
1045 /* TODO: validade policy? */
1047 ev = malloc(sizeof(*ev));
1048 ev->policy = policy;
1049 ev->new_value = value;
1050 ev->old_value = _elm_policies[policy];
1052 _elm_policies[policy] = value;
1054 ecore_event_add(ELM_EVENT_POLICY_CHANGED, ev, NULL, NULL);
1060 * Gets the policy value set for given identifier.
1062 * @param policy policy identifier as in Elm_Policy.
1065 * @return policy value. Will be 0 if policy identifier is invalid.
1068 elm_policy_get(unsigned int policy)
1070 if (policy >= ELM_POLICY_LAST)
1072 return _elm_policies[policy];
1076 * @defgroup UI-Mirroring Selective Widget mirroring
1078 * These functions allow you to set ui-miroring on specific widgets or whe
1079 * whole interface. Widgets can be in one of two modes, automatic and manual.
1080 * Automatic means they'll be changed according to the system mirroring mode
1081 * and manual means only explicit changes will matter. You are not supposed to
1082 * change mirroring state of a widget set to automatic, will mostly work, but
1083 * the behavior is not really defined.
1087 * Returns the widget's mirrored mode.
1089 * @param obj The widget.
1090 * @return mirrored mode of the object.
1094 elm_object_mirrored_get(const Evas_Object *obj)
1096 EINA_SAFETY_ON_NULL_RETURN_VAL(obj, EINA_FALSE);
1097 return elm_widget_mirrored_get(obj);
1101 * Sets the widget's mirrored mode.
1103 * @param obj The widget.
1104 * @param mirrored EINA_TRUE to set mirrored mode. EINA_FALSE to unset.
1107 elm_object_mirrored_set(Evas_Object *obj, Eina_Bool mirrored)
1109 EINA_SAFETY_ON_NULL_RETURN(obj);
1110 elm_widget_mirrored_set(obj, mirrored);
1114 * Returns the widget's mirrored mode setting.
1116 * @param obj The widget.
1117 * @return mirrored mode setting of the object.
1121 elm_object_mirrored_automatic_get(const Evas_Object *obj)
1123 EINA_SAFETY_ON_NULL_RETURN_VAL(obj, EINA_FALSE);
1124 return elm_widget_mirrored_automatic_get(obj);
1128 * Sets the widget's mirrored mode setting.
1129 * When widget in automatic mode, it follows the system mirrored mode set by
1130 * elm_mirrored_set().
1131 * @param obj The widget.
1132 * @param automatic EINA_TRUE for auto mirrored mode. EINA_FALSE for manual.
1135 elm_object_mirrored_automatic_set(Evas_Object *obj, Eina_Bool automatic)
1137 EINA_SAFETY_ON_NULL_RETURN(obj);
1138 elm_widget_mirrored_automatic_set(obj, automatic);
1142 * @defgroup Scaling Selective Widget Scaling
1145 * Different widgets can be scaled independently. These functions allow you to
1146 * manipulate this scaling on a per-widget basis. The object and all its
1147 * children get their scaling factors multiplied by the scale factor set.
1148 * This is multiplicative, in that if a child also has a scale size set it is
1149 * in turn multiplied by its parent's scale size. 1.0 means “don't scale”,
1150 * 2.0 is double size, 0.5 is half etc.
1154 * Set the scaling factor
1156 * @param obj The object
1157 * @param scale Scale factor (from 0.0 up, with 1.0 == no scaling)
1161 elm_object_scale_set(Evas_Object *obj,
1164 EINA_SAFETY_ON_NULL_RETURN(obj);
1165 elm_widget_scale_set(obj, scale);
1169 * Get the scaling factor
1171 * @param obj The object
1172 * @return The scaling factor set by elm_object_scale_set()
1176 elm_object_scale_get(const Evas_Object *obj)
1178 EINA_SAFETY_ON_NULL_RETURN_VAL(obj, 0.0);
1179 return elm_widget_scale_get(obj);
1183 * Get the global scaling factor
1185 * This gets the globally configured scaling factor that is applied to all
1188 * @return The scaling factor
1194 return _elm_config->scale;
1198 * Set the global scaling factor
1200 * This sets the globally configured scaling factor that is applied to all
1203 * @param scale The scaling factor to set
1207 elm_scale_set(double scale)
1209 if (_elm_config->scale == scale) return;
1210 _elm_config->scale = scale;
1215 * Set the global scaling factor for all applications on the display
1217 * This sets the globally configured scaling factor that is applied to all
1218 * objects for all applications.
1219 * @param scale The scaling factor to set
1223 elm_scale_all_set(double scale)
1225 #ifdef HAVE_ELEMENTARY_X
1226 static Ecore_X_Atom atom = 0;
1227 unsigned int scale_i = (unsigned int)(scale * 1000.0);
1229 if (!atom) atom = ecore_x_atom_get("ENLIGHTENMENT_SCALE");
1230 ecore_x_window_prop_card32_set(ecore_x_window_root_first_get(),
1236 * @defgroup Styles Styles
1239 * Widgets can have different styles of look. These generic API's set
1240 * styles of widgets, if they support them (and if the theme(s) do).
1246 * This sets the name of the style
1247 * @param obj The object
1248 * @param style The style name to use
1252 elm_object_style_set(Evas_Object *obj,
1255 EINA_SAFETY_ON_NULL_RETURN(obj);
1256 elm_widget_style_set(obj, style);
1262 * This gets the style being used for that widget. Note that the string
1263 * pointer is only valid as longas the object is valid and the style doesn't
1266 * @param obj The object
1267 * @return The style name
1271 elm_object_style_get(const Evas_Object *obj)
1273 EINA_SAFETY_ON_NULL_RETURN_VAL(obj, NULL);
1274 return elm_widget_style_get(obj);
1278 * Set the disable state
1280 * This sets the disable state for the widget.
1282 * @param obj The object
1283 * @param disabled The state
1287 elm_object_disabled_set(Evas_Object *obj,
1290 EINA_SAFETY_ON_NULL_RETURN(obj);
1291 elm_widget_disabled_set(obj, disabled);
1295 * Get the disable state
1297 * This gets the disable state for the widget.
1299 * @param obj The object
1300 * @return True, if the widget is disabled
1304 elm_object_disabled_get(const Evas_Object *obj)
1306 EINA_SAFETY_ON_NULL_RETURN_VAL(obj, EINA_FALSE);
1307 return elm_widget_disabled_get(obj);
1311 * @defgroup Config Elementary Config
1314 * Elementary configuration is formed by a set options bounded to a
1315 * given @ref Profile profile, like @ref Theme theme, @ref Fingers
1316 * "finger size", etc. These are functions with which one syncronizes
1317 * changes made to those values to the configuration storing files, de
1318 * facto. You most probably don't want to use the functions in this
1319 * group unlees you're writing an elementary configuration manager.
1323 * Save back Elementary's configuration, so that it will persist on
1326 * @return @c EINA_TRUE, when sucessful. @c EINA_FALSE, otherwise.
1329 * This function will take effect -- thus, do I/O -- immediately. Use
1330 * it when you want to apply all configuration changes at once. The
1331 * current configuration set will get saved onto the current profile
1332 * configuration file.
1336 elm_config_save(void)
1338 return _elm_config_save();
1342 * Reload Elementary's configuration, bounded to current selected
1345 * @return @c EINA_TRUE, when sucessful. @c EINA_FALSE, otherwise.
1348 * Useful when you want to force reloading of configuration values for
1349 * a profile. If one removes user custom configuration directories,
1350 * for example, it will force a reload with system values insted.
1354 elm_config_reload(void)
1356 _elm_config_reload();
1360 * @defgroup Profile Elementary Profile
1363 * Profiles are pre-set options that affect the whole look-and-feel of
1364 * Elementary-based applications. There are, for example, profiles
1365 * aimed at desktop computer applications and others aimed at mobile,
1366 * touchscreen-based ones. You most probably don't want to use the
1367 * functions in this group unlees you're writing an elementary
1368 * configuration manager.
1372 * Get Elementary's profile in use.
1374 * This gets the global profile that is applied to all Elementary
1377 * @return The profile's name
1381 elm_profile_current_get(void)
1383 return _elm_config_current_profile_get();
1387 * Get an Elementary's profile directory path in the filesystem. One
1388 * may want to fetch a system profile's dir or an user one (fetched
1391 * @param profile The profile's name
1392 * @param is_user Whether to lookup for an user profile (@c EINA_TRUE)
1393 * or a system one (@c EINA_FALSE)
1394 * @return The profile's directory path.
1397 * @note You must free it with elm_profile_dir_free().
1400 elm_profile_dir_get(const char *profile,
1403 return _elm_config_profile_dir_get(profile, is_user);
1407 * Free an Elementary's profile directory path, as returned by
1408 * elm_profile_dir_get().
1410 * @param p_dir The profile's path
1415 elm_profile_dir_free(const char *p_dir)
1417 free((void *)p_dir);
1421 * Get Elementary's list of available profiles.
1423 * @return The profiles list. List node data are the profile name
1427 * @note One must free this list, after usage, with the function
1428 * elm_profile_list_free().
1431 elm_profile_list_get(void)
1433 return _elm_config_profiles_list();
1437 * Free Elementary's list of available profiles.
1439 * @param The profiles list, as returned by elm_profile_list_get().
1444 elm_profile_list_free(Eina_List *l)
1448 EINA_LIST_FREE(l, dir)
1449 eina_stringshare_del(dir);
1453 * Set Elementary's profile.
1455 * This sets the global profile that is applied to Elementary
1456 * applications. Just the process the call comes from will be
1459 * @param profile The profile's name
1464 elm_profile_set(const char *profile)
1466 EINA_SAFETY_ON_NULL_RETURN(profile);
1467 _elm_config_profile_set(profile);
1471 * Set Elementary's profile.
1473 * This sets the global profile that is applied to all Elementary
1474 * applications. All running Elementary windows will be affected.
1476 * @param profile The profile's name
1481 elm_profile_all_set(const char *profile)
1483 #ifdef HAVE_ELEMENTARY_X
1484 static Ecore_X_Atom atom = 0;
1486 if (!atom) atom = ecore_x_atom_get("ENLIGHTENMENT_PROFILE");
1487 ecore_x_window_prop_string_set(ecore_x_window_root_first_get(),
1493 * @defgroup Engine Elementary Engine
1496 * These are functions setting and querying which rendering engine
1497 * Elementary will use for drawing its windows' pixels.
1501 * Get Elementary's rendering engine in use.
1503 * This gets the global rendering engine that is applied to all
1504 * Elementary applications.
1506 * @return The rendering engine's name
1509 * @note there's no need to free the returned string, here.
1512 elm_engine_current_get(void)
1514 return _elm_config->engine;
1518 * Set Elementary's rendering engine for use.
1520 * This gets sets global rendering engine that is applied to all
1521 * Elementary applications. Note that it will take effect only to
1522 * subsequent Elementary window creations.
1524 * @param The rendering engine's name
1527 * @note there's no need to free the returned string, here.
1530 elm_engine_set(const char *engine)
1532 EINA_SAFETY_ON_NULL_RETURN(engine);
1534 _elm_config_engine_set(engine);
1538 * @defgroup Fonts Elementary Fonts
1541 * These are functions dealing with font rendering, selection and the
1542 * like for Elementary applications. One might fetch which system
1543 * fonts are there to use and set custom fonts for individual classes
1544 * of UI items containing text (text classes).
1548 * Get Elementary's list of supported text classes.
1550 * @return The text classes list, with @c Elm_Text_Class blobs as data.
1553 * Release the list with elm_text_classes_list_free().
1555 EAPI const Eina_List *
1556 elm_text_classes_list_get(void)
1558 return _elm_config_text_classes_get();
1562 * Free Elementary's list of supported text classes.
1566 * @see elm_text_classes_list_get().
1569 elm_text_classes_list_free(const Eina_List *list)
1571 _elm_config_text_classes_free((Eina_List *)list);
1575 * Get Elementary's list of font overlays, set with
1576 * elm_font_overlay_set().
1578 * @return The font overlays list, with @c Elm_Font_Overlay blobs as
1583 * For each text class, one can set a <b>font overlay</b> for it,
1584 * overriding the default font properties for that class coming from
1585 * the theme in use. There is no need to free this list.
1587 * @see elm_font_overlay_set() and elm_font_overlay_unset().
1589 EAPI const Eina_List *
1590 elm_font_overlay_list_get(void)
1592 return _elm_config_font_overlays_list();
1596 * Set a font overlay for a given Elementary text class.
1598 * @param text_class Text class name
1599 * @param font Font name and style string
1600 * @param size Font size
1604 * @p font has to be in the format returned by
1605 * elm_font_fontconfig_name_get(). @see elm_font_overlay_list_get()
1606 * and @elm_font_overlay_unset().
1609 elm_font_overlay_set(const char *text_class,
1611 Evas_Font_Size size)
1613 _elm_config_font_overlay_set(text_class, font, size);
1617 * Unset a font overlay for a given Elementary text class.
1619 * @param text_class Text class name
1623 * This will bring back text elements belonging to text class @p
1624 * text_class back to their default font settings.
1627 elm_font_overlay_unset(const char *text_class)
1629 _elm_config_font_overlay_remove(text_class);
1633 * Apply the changes made with elm_font_overlay_set() and
1634 * elm_font_overlay_unset() on the current Elementary window.
1638 * This applies all font overlays set to all objects in the UI.
1641 elm_font_overlay_apply(void)
1643 _elm_config_font_overlay_apply();
1647 * Apply the changes made with elm_font_overlay_set() and
1648 * elm_font_overlay_unset() on all Elementary application windows.
1652 * This applies all font overlays set to all objects in the UI.
1655 elm_font_overlay_all_apply(void)
1657 #ifdef HAVE_ELEMENTARY_X
1658 static Ecore_X_Atom atom = 0;
1659 unsigned int dummy = (unsigned int)(1 * 1000.0);
1661 if (!atom) atom = ecore_x_atom_get("ENLIGHTENMENT_FONT_OVERLAY");
1662 ecore_x_window_prop_card32_set(ecore_x_window_root_first_get(), atom, &dummy,
1668 * Translate a font (family) name string in fontconfig's font names
1669 * syntax into an @c Elm_Font_Properties struct.
1671 * @param font The font name and styles string
1672 * @return the font properties struct
1676 * @note The reverse translation can be achived with
1677 * elm_font_fontconfig_name_get(), for one style only (single font
1678 * instance, not family).
1680 EAPI Elm_Font_Properties *
1681 elm_font_properties_get(const char *font)
1683 EINA_SAFETY_ON_NULL_RETURN_VAL(font, NULL);
1684 return _elm_font_properties_get(NULL, font);
1688 * Free font properties return by elm_font_properties_get().
1690 * @param efp the font properties struct
1695 elm_font_properties_free(Elm_Font_Properties *efp)
1699 EINA_SAFETY_ON_NULL_RETURN(efp);
1700 EINA_LIST_FREE(efp->styles, str)
1701 if (str) eina_stringshare_del(str);
1702 if (efp->name) eina_stringshare_del(efp->name);
1707 * Translate a font name, bound to a style, into fontconfig's font names
1710 * @param name The font (family) name
1711 * @param style The given style (may be @c NULL)
1713 * @return the font name and style string
1717 * @note The reverse translation can be achived with
1718 * elm_font_properties_get(), for one style only (single font
1719 * instance, not family).
1722 elm_font_fontconfig_name_get(const char *name,
1727 EINA_SAFETY_ON_NULL_RETURN_VAL(name, NULL);
1728 if (!style || style[0] == 0) return eina_stringshare_add(name);
1729 snprintf(buf, 256, "%s" ELM_FONT_TOKEN_STYLE "%s", name, style);
1730 return eina_stringshare_add(buf);
1734 * Free the font string return by elm_font_fontconfig_name_get().
1736 * @param efp the font properties struct
1741 elm_font_fontconfig_name_free(const char *name)
1743 eina_stringshare_del(name);
1747 * Create a font hash table of available system fonts.
1749 * One must call it with @p list being the return value of
1750 * evas_font_available_list(). The hash will be indexed by font
1751 * (family) names, being its values @c Elm_Font_Properties blobs.
1753 * @param list The list of available system fonts, as returned by
1754 * evas_font_available_list().
1755 * @return the font hash.
1759 * @note The user is supposed to get it populated at least with 3
1760 * default font families (Sans, Serif, Monospace), which should be
1761 * present on most systems.
1764 elm_font_available_hash_add(Eina_List *list)
1766 Eina_Hash *font_hash;
1772 /* populate with default font families */
1773 font_hash = _elm_font_available_hash_add(font_hash, "Sans:style=Regular");
1774 font_hash = _elm_font_available_hash_add(font_hash, "Sans:style=Bold");
1775 font_hash = _elm_font_available_hash_add(font_hash, "Sans:style=Oblique");
1776 font_hash = _elm_font_available_hash_add(font_hash,
1777 "Sans:style=Bold Oblique");
1779 font_hash = _elm_font_available_hash_add(font_hash, "Serif:style=Regular");
1780 font_hash = _elm_font_available_hash_add(font_hash, "Serif:style=Bold");
1781 font_hash = _elm_font_available_hash_add(font_hash, "Serif:style=Oblique");
1782 font_hash = _elm_font_available_hash_add(font_hash,
1783 "Serif:style=Bold Oblique");
1785 font_hash = _elm_font_available_hash_add(font_hash,
1786 "Monospace:style=Regular");
1787 font_hash = _elm_font_available_hash_add(font_hash,
1788 "Monospace:style=Bold");
1789 font_hash = _elm_font_available_hash_add(font_hash,
1790 "Monospace:style=Oblique");
1791 font_hash = _elm_font_available_hash_add(font_hash,
1792 "Monospace:style=Bold Oblique");
1794 EINA_LIST_FOREACH(list, l, key)
1795 font_hash = _elm_font_available_hash_add(font_hash, key);
1801 * Free the hash return by elm_font_available_hash_add().
1803 * @param hash the hash to be freed.
1808 elm_font_available_hash_del(Eina_Hash *hash)
1810 _elm_font_available_hash_del(hash);
1814 * @defgroup Fingers Fingers
1817 * Elementary is designed to be finger-friendly for touchscreens, and so in
1818 * addition to scaling for display resolution, it can also scale based on
1819 * finger "resolution" (or size).
1823 * Get the configured finger size
1825 * This gets the globally configured finger size in pixels
1827 * @return The finger size
1831 elm_finger_size_get(void)
1833 return _elm_config->finger_size;
1837 * Set the configured finger size
1839 * This sets the globally configured finger size in pixels
1841 * @param size The finger size
1845 elm_finger_size_set(Evas_Coord size)
1847 if (_elm_config->finger_size == size) return;
1848 _elm_config->finger_size = size;
1853 * Set the configured finger size for all applications on the display
1855 * This sets the globally configured finger size in pixels for all applications
1858 * @param size The finger size
1862 elm_finger_size_all_set(Evas_Coord size)
1864 #ifdef HAVE_ELEMENTARY_X
1865 static Ecore_X_Atom atom = 0;
1866 unsigned int size_i = (unsigned int)size;
1868 if (!atom) atom = ecore_x_atom_get("ENLIGHTENMENT_FINGER_SIZE");
1869 ecore_x_window_prop_card32_set(ecore_x_window_root_first_get(),
1875 elm_autocapitalization_allow_all_set(Eina_Bool on)
1877 #ifdef HAVE_ELEMENTARY_X
1878 static Ecore_X_Atom atom = 0;
1879 unsigned int on_i = (unsigned int)on;
1881 if (!atom) atom = ecore_x_atom_get("ENLIGHTENMENT_AUTOCAPITAL_ALLOW");
1882 ecore_x_window_prop_card32_set(ecore_x_window_root_first_get(),
1888 elm_autoperiod_allow_all_set(Eina_Bool on)
1890 #ifdef HAVE_ELEMENTARY_X
1891 static Ecore_X_Atom atom = 0;
1892 unsigned int on_i = (unsigned int)on;
1894 if (!atom) atom = ecore_x_atom_get("ENLIGHTENMENT_AUTOPERIOD_ALLOW");
1895 ecore_x_window_prop_card32_set(ecore_x_window_root_first_get(),
1900 * Adjust size of an element for finger usage
1902 * This takes width and height sizes (in pixels) as input and a size multiple
1903 * (which is how many fingers you want to place within the area), and adjusts
1904 * the size tobe large enough to accommodate finger. On return the w and h
1905 * sizes poiner do by these parameters will be modified.
1907 * @param times_w How many fingers should fit horizontally
1908 * @param w Pointer to the width size to adjust
1909 * @param times_h How many fingers should fit vertically
1910 * @param h Pointer to the height size to adjust
1914 elm_coords_finger_size_adjust(int times_w,
1919 if ((w) && (*w < (_elm_config->finger_size * times_w)))
1920 *w = _elm_config->finger_size * times_w;
1921 if ((h) && (*h < (_elm_config->finger_size * times_h)))
1922 *h = _elm_config->finger_size * times_h;
1926 * @defgroup Caches Caches
1929 * These are functions which let one fine-tune some cache values for
1930 * Elementary applications, thus allowing for performance adjustments.
1934 * Flush all caches & dump all data that can be to lean down to use
1945 edje_file_cache_flush();
1946 edje_collection_cache_flush();
1948 EINA_LIST_FOREACH(_elm_win_list, l, obj)
1950 Evas *e = evas_object_evas_get(obj);
1951 evas_image_cache_flush(e);
1952 evas_font_cache_flush(e);
1953 evas_render_dump(e);
1958 * Get the configured cache flush interval time
1960 * This gets the globally configured cache flush interval time, in
1963 * @return The cache flush interval time
1966 * @see elm_all_flush()
1969 elm_cache_flush_interval_get(void)
1971 return _elm_config->cache_flush_poll_interval;
1975 * Set the configured cache flush interval time
1977 * This sets the globally configured cache flush interval time, in ticks
1979 * @param size The cache flush interval time
1982 * @see elm_all_flush()
1985 elm_cache_flush_interval_set(int size)
1987 if (_elm_config->cache_flush_poll_interval == size) return;
1988 _elm_config->cache_flush_poll_interval = size;
1994 * Set the configured cache flush interval time for all applications on the
1997 * This sets the globally configured cache flush interval time -- in ticks
1998 * -- for all applications on the display.
2000 * @param size The cache flush interval time
2004 elm_cache_flush_interval_all_set(int size)
2006 #ifdef HAVE_ELEMENTARY_X
2007 static Ecore_X_Atom atom = 0;
2008 unsigned int size_i = (unsigned int)size;
2010 if (!atom) atom = ecore_x_atom_get("ENLIGHTENMENT_CACHE_FLUSH_INTERVAL");
2011 ecore_x_window_prop_card32_set(ecore_x_window_root_first_get(),
2017 * Get the configured cache flush enabled state
2019 * This gets the globally configured cache flush state - if it is enabled
2020 * or not. When cache flushing is enabled, elementary will regularly
2021 * (see elm_cache_flush_interval_get() ) flush caches and dump data out of
2022 * memory and allow usage to re-seed caches and data in memory where it
2023 * can do so. An idle application will thus minimise its memory usage as
2024 * data will be freed from memory and not be re-loaded as it is idle and
2025 * not rendering or doing anything graphically right now.
2027 * @return The cache flush state
2030 * @see elm_all_flush()
2033 elm_cache_flush_enabled_get(void)
2035 return _elm_config->cache_flush_enable;
2039 * Set the configured cache flush enabled state
2041 * This sets the globally configured cache flush enabled state
2043 * @param size The cache flush enabled state
2046 * @see elm_all_flush()
2049 elm_cache_flush_enabled_set(Eina_Bool enabled)
2051 enabled = !!enabled;
2052 if (_elm_config->cache_flush_enable == enabled) return;
2053 _elm_config->cache_flush_enable = enabled;
2059 * Set the configured cache flush enabled state for all applications on the
2062 * This sets the globally configured cache flush enabled state for all
2063 * applications on the display.
2065 * @param size The cache flush enabled state
2069 elm_cache_flush_enabled_all_set(Eina_Bool enabled)
2071 #ifdef HAVE_ELEMENTARY_X
2072 static Ecore_X_Atom atom = 0;
2073 unsigned int enabled_i = (unsigned int)enabled;
2075 if (!atom) atom = ecore_x_atom_get("ENLIGHTENMENT_CACHE_FLUSH_ENABLE");
2076 ecore_x_window_prop_card32_set(ecore_x_window_root_first_get(),
2077 atom, &enabled_i, 1);
2082 * Get the configured font cache size
2084 * This gets the globally configured font cache size, in bytes
2086 * @return The font cache size
2090 elm_font_cache_get(void)
2092 return _elm_config->font_cache;
2096 * Set the configured font cache size
2098 * This sets the globally configured font cache size, in bytes
2100 * @param size The font cache size
2104 elm_font_cache_set(int size)
2106 if (_elm_config->font_cache == size) return;
2107 _elm_config->font_cache = size;
2113 * Set the configured font cache size for all applications on the
2116 * This sets the globally configured font cache size -- in bytes
2117 * -- for all applications on the display.
2119 * @param size The font cache size
2123 elm_font_cache_all_set(int size)
2125 #ifdef HAVE_ELEMENTARY_X
2126 static Ecore_X_Atom atom = 0;
2127 unsigned int size_i = (unsigned int)size;
2129 if (!atom) atom = ecore_x_atom_get("ENLIGHTENMENT_FONT_CACHE");
2130 ecore_x_window_prop_card32_set(ecore_x_window_root_first_get(),
2136 * Get the configured image cache size
2138 * This gets the globally configured image cache size, in bytes
2140 * @return The image cache size
2144 elm_image_cache_get(void)
2146 return _elm_config->image_cache;
2150 * Set the configured image cache size
2152 * This sets the globally configured image cache size, in bytes
2154 * @param size The image cache size
2158 elm_image_cache_set(int size)
2160 if (_elm_config->image_cache == size) return;
2161 _elm_config->image_cache = size;
2167 * Set the configured image cache size for all applications on the
2170 * This sets the globally configured image cache size -- in bytes
2171 * -- for all applications on the display.
2173 * @param size The image cache size
2177 elm_image_cache_all_set(int size)
2179 #ifdef HAVE_ELEMENTARY_X
2180 static Ecore_X_Atom atom = 0;
2181 unsigned int size_i = (unsigned int)size;
2183 if (!atom) atom = ecore_x_atom_get("ENLIGHTENMENT_IMAGE_CACHE");
2184 ecore_x_window_prop_card32_set(ecore_x_window_root_first_get(),
2190 * Get the configured edje file cache size.
2192 * This gets the globally configured edje file cache size, in number
2195 * @return The edje file cache size
2199 elm_edje_file_cache_get(void)
2201 return _elm_config->edje_cache;
2205 * Set the configured edje file cache size
2207 * This sets the globally configured edje file cache size, in number
2210 * @param size The edje file cache size
2214 elm_edje_file_cache_set(int size)
2216 if (_elm_config->edje_cache == size) return;
2217 _elm_config->edje_cache = size;
2223 * Set the configured edje file cache size for all applications on the
2226 * This sets the globally configured edje file cache size -- in number
2227 * of files -- for all applications on the display.
2229 * @param size The edje file cache size
2233 elm_edje_file_cache_all_set(int size)
2235 #ifdef HAVE_ELEMENTARY_X
2236 static Ecore_X_Atom atom = 0;
2237 unsigned int size_i = (unsigned int)size;
2239 if (!atom) atom = ecore_x_atom_get("ENLIGHTENMENT_EDJE_FILE_CACHE");
2240 ecore_x_window_prop_card32_set(ecore_x_window_root_first_get(),
2246 * Get the configured edje collections (groups) cache size.
2248 * This gets the globally configured edje collections cache size, in
2249 * number of collections.
2251 * @return The edje collections cache size
2255 elm_edje_collection_cache_get(void)
2257 return _elm_config->edje_collection_cache;
2261 * Set the configured edje collections (groups) cache size
2263 * This sets the globally configured edje collections cache size, in
2264 * number of collections.
2266 * @param size The edje collections cache size
2270 elm_edje_collection_cache_set(int size)
2272 if (_elm_config->edje_collection_cache == size) return;
2273 _elm_config->edje_collection_cache = size;
2279 * Set the configured edje collections (groups) cache size for all
2280 * applications on the display
2282 * This sets the globally configured edje collections cache size -- in
2283 * number of collections -- for all applications on the display.
2285 * @param size The edje collections cache size
2289 elm_edje_collection_cache_all_set(int size)
2291 #ifdef HAVE_ELEMENTARY_X
2292 static Ecore_X_Atom atom = 0;
2293 unsigned int size_i = (unsigned int)size;
2295 if (!atom) atom = ecore_x_atom_get("ENLIGHTENMENT_EDJE_COLLECTION_CACHE");
2296 ecore_x_window_prop_card32_set(ecore_x_window_root_first_get(),
2302 * @defgroup Focus Focus
2305 * Objects have focus. This is what determines where the keyboard input goes to
2306 * within the application window.
2310 * Get the focus of the object
2312 * This gets the focused property of the object.
2314 * @param obj The object
2315 * @return 1 if the object is focused, 0 if not.
2319 elm_object_focus_get(const Evas_Object *obj)
2321 EINA_SAFETY_ON_NULL_RETURN_VAL(obj, EINA_FALSE);
2322 return elm_widget_focus_get(obj);
2326 * Set the focus to the object
2328 * This sets the focus target for keyboard input to be the object indicated.
2330 * @param obj The object
2334 elm_object_focus(Evas_Object *obj)
2336 EINA_SAFETY_ON_NULL_RETURN(obj);
2337 if (elm_widget_focus_get(obj))
2340 elm_widget_focus_cycle(obj, ELM_FOCUS_NEXT);
2344 * Remove the focus from the object
2346 * This removes the focus target for keyboard input from be the object
2349 * @param obj The object
2353 elm_object_unfocus(Evas_Object *obj)
2355 EINA_SAFETY_ON_NULL_RETURN(obj);
2356 if (!elm_widget_can_focus_get(obj)) return;
2357 elm_widget_focused_object_clear(obj);
2361 * Set the ability for the object to focus
2363 * This sets the ability for the object to be able to get keyboard focus or
2364 * not. By default all objects are able to be focused.
2366 * @param obj The object
2367 * @param enable 1 if the object can be focused, 0 if not
2371 elm_object_focus_allow_set(Evas_Object *obj,
2374 EINA_SAFETY_ON_NULL_RETURN(obj);
2375 elm_widget_can_focus_set(obj, enable);
2379 * Get the ability for the object to focus
2381 * This gets the ability for the object to be able to get keyboard focus or
2382 * not. By default all objects are able to be focused.
2384 * @param obj The object
2385 * @return 1 if the object is allowed to be focused, 0 if not.
2389 elm_object_focus_allow_get(const Evas_Object *obj)
2391 EINA_SAFETY_ON_NULL_RETURN_VAL(obj, EINA_FALSE);
2392 return (elm_widget_can_focus_get(obj)) || (elm_widget_child_can_focus_get(obj));
2396 * Set custom focus chain.
2398 * This function i set one new and overwrite any previous custom focus chain
2399 * with the list of objects. The previous list will be deleted and this list
2400 * will be managed. After setted, don't modity it.
2402 * @note On focus cycle, only will be evaluated children of this container.
2404 * @param obj The container object
2405 * @param objs Chain of objects to pass focus
2409 elm_object_focus_custom_chain_set(Evas_Object *obj,
2412 EINA_SAFETY_ON_NULL_RETURN(obj);
2413 elm_widget_focus_custom_chain_set(obj, objs);
2417 * Unset custom focus chain
2419 * @param obj The container object
2423 elm_object_focus_custom_chain_unset(Evas_Object *obj)
2425 EINA_SAFETY_ON_NULL_RETURN(obj);
2426 elm_widget_focus_custom_chain_unset(obj);
2430 * Get custom focus chain
2432 * @param obj The container object
2435 EAPI const Eina_List *
2436 elm_object_focus_custom_chain_get(const Evas_Object *obj)
2438 EINA_SAFETY_ON_NULL_RETURN_VAL(obj, NULL);
2439 return elm_widget_focus_custom_chain_get(obj);
2443 * Append object to custom focus chain.
2445 * @note If relative_child equal to NULL or not in custom chain, the object
2446 * will be added in end.
2448 * @note On focus cycle, only will be evaluated children of this container.
2450 * @param obj The container object
2451 * @param child The child to be added in custom chain
2452 * @param relative_child The relative object to position the child
2456 elm_object_focus_custom_chain_append(Evas_Object *obj,
2458 Evas_Object *relative_child)
2460 EINA_SAFETY_ON_NULL_RETURN(obj);
2461 EINA_SAFETY_ON_NULL_RETURN(child);
2462 elm_widget_focus_custom_chain_append(obj, child, relative_child);
2466 * Prepend object to custom focus chain.
2468 * @note If relative_child equal to NULL or not in custom chain, the object
2469 * will be added in begin.
2471 * @note On focus cycle, only will be evaluated children of this container.
2473 * @param obj The container object
2474 * @param child The child to be added in custom chain
2475 * @param relative_child The relative object to position the child
2479 elm_object_focus_custom_chain_prepend(Evas_Object *obj,
2481 Evas_Object *relative_child)
2483 EINA_SAFETY_ON_NULL_RETURN(obj);
2484 EINA_SAFETY_ON_NULL_RETURN(child);
2485 elm_widget_focus_custom_chain_prepend(obj, child, relative_child);
2489 * Give focus to next object in object tree.
2491 * Give focus to next object in focus chain of one object sub-tree.
2492 * If the last object of chain already have focus, the focus will go to the
2493 * first object of chain.
2495 * @param obj The object root of sub-tree
2496 * @param dir Direction to cycle the focus
2501 elm_object_focus_cycle(Evas_Object *obj,
2502 Elm_Focus_Direction dir)
2504 EINA_SAFETY_ON_NULL_RETURN(obj);
2505 elm_widget_focus_cycle(obj, dir);
2509 * Give focus to near object in one direction.
2511 * Give focus to near object in direction of one object.
2512 * If none focusable object in given direction, the focus will not change.
2514 * @param obj The reference object
2515 * @param x Horizontal component of direction to focus
2516 * @param y Vertical component of direction to focus
2521 elm_object_focus_direction_go(Evas_Object *obj,
2525 EINA_SAFETY_ON_NULL_RETURN(obj);
2526 elm_widget_focus_direction_go(obj, x, y);
2530 * Get the enable status of the focus highlight
2532 * This gets whether the highlight on focused objects is enabled or not
2536 elm_focus_highlight_enabled_get(void)
2538 return _elm_config->focus_highlight_enable;
2542 * Set the enable status of the focus highlight
2544 * Set whether to show or not the highlight on focused objects
2545 * @param enable Enable highlight if EINA_TRUE, disable otherwise
2549 elm_focus_highlight_enabled_set(Eina_Bool enable)
2551 _elm_config->focus_highlight_enable = !!enable;
2555 * Get the enable status of the highlight animation
2557 * Get whether the focus highlight, if enabled, will animate its switch from
2558 * one object to the next
2562 elm_focus_highlight_animate_get(void)
2564 return _elm_config->focus_highlight_animate;
2568 * Set the enable status of the highlight animation
2570 * Set whether the focus highlight, if enabled, will animate its switch from
2571 * one object to the next
2572 * @param animate Enable animation if EINA_TRUE, disable otherwise
2576 elm_focus_highlight_animate_set(Eina_Bool animate)
2578 _elm_config->focus_highlight_animate = !!animate;
2582 * @defgroup Scrolling Scrolling
2585 * These are functions setting how scrollable views in Elementary
2586 * widgets should behave on user interaction.
2590 * Get whether scrollers should bounce when they reach their
2591 * viewport's edge during a scroll.
2593 * @return the thumb scroll bouncing state
2595 * This is the default behavior for touch screens, in general.
2596 * @ingroup Scrolling
2599 elm_scroll_bounce_enabled_get(void)
2601 return _elm_config->thumbscroll_bounce_enable;
2605 * Set whether scrollers should bounce when they reach their
2606 * viewport's edge during a scroll.
2608 * @param enabled the thumb scroll bouncing state
2610 * @see elm_thumbscroll_bounce_enabled_get()
2611 * @ingroup Scrolling
2614 elm_scroll_bounce_enabled_set(Eina_Bool enabled)
2616 _elm_config->thumbscroll_bounce_enable = enabled;
2620 * Set whether scrollers should bounce when they reach their
2621 * viewport's edge during a scroll, for all Elementary application
2624 * @param enabled the thumb scroll bouncing state
2626 * @see elm_thumbscroll_bounce_enabled_get()
2627 * @ingroup Scrolling
2630 elm_scroll_bounce_enabled_all_set(Eina_Bool enabled)
2632 #ifdef HAVE_ELEMENTARY_X
2633 static Ecore_X_Atom atom = 0;
2634 unsigned int bounce_enable_i = (unsigned int)enabled;
2637 atom = ecore_x_atom_get("ENLIGHTENMENT_THUMBSCROLL_BOUNCE_ENABLE");
2638 ecore_x_window_prop_card32_set(ecore_x_window_root_first_get(),
2639 atom, &bounce_enable_i, 1);
2644 * Get the amount of inertia a scroller will impose at bounce
2647 * @return the thumb scroll bounce friction
2649 * @ingroup Scrolling
2652 elm_scroll_bounce_friction_get(void)
2654 return _elm_config->thumbscroll_bounce_friction;
2658 * Set the amount of inertia a scroller will impose at bounce
2661 * @param friction the thumb scroll bounce friction
2663 * @see elm_thumbscroll_bounce_friction_get()
2664 * @ingroup Scrolling
2667 elm_scroll_bounce_friction_set(double friction)
2669 _elm_config->thumbscroll_bounce_friction = friction;
2673 * Set the amount of inertia a scroller will impose at bounce
2674 * animations, for all Elementary application windows.
2676 * @param friction the thumb scroll bounce friction
2678 * @see elm_thumbscroll_bounce_friction_get()
2679 * @ingroup Scrolling
2682 elm_scroll_bounce_friction_all_set(double friction)
2684 #ifdef HAVE_ELEMENTARY_X
2685 static Ecore_X_Atom atom = 0;
2686 unsigned int bounce_friction_i = (unsigned int)(friction * 1000.0);
2689 atom = ecore_x_atom_get("ENLIGHTENMENT_THUMBSCROLL_BOUNCE_FRICTION");
2690 ecore_x_window_prop_card32_set(ecore_x_window_root_first_get(),
2691 atom, &bounce_friction_i, 1);
2696 * Get the amount of inertia a <b>paged</b> scroller will impose at
2697 * page fitting animations.
2699 * @return the page scroll friction
2701 * @ingroup Scrolling
2704 elm_scroll_page_scroll_friction_get(void)
2706 return _elm_config->page_scroll_friction;
2710 * Set the amount of inertia a <b>paged</b> scroller will impose at
2711 * page fitting animations.
2713 * @param friction the page scroll friction
2715 * @see elm_thumbscroll_page_scroll_friction_get()
2716 * @ingroup Scrolling
2719 elm_scroll_page_scroll_friction_set(double friction)
2721 _elm_config->page_scroll_friction = friction;
2725 * Set the amount of inertia a <b>paged</b> scroller will impose at
2726 * page fitting animations, for all Elementary application windows.
2728 * @param friction the page scroll friction
2730 * @see elm_thumbscroll_page_scroll_friction_get()
2731 * @ingroup Scrolling
2734 elm_scroll_page_scroll_friction_all_set(double friction)
2736 #ifdef HAVE_ELEMENTARY_X
2737 static Ecore_X_Atom atom = 0;
2738 unsigned int page_scroll_friction_i = (unsigned int)(friction * 1000.0);
2741 atom = ecore_x_atom_get("ENLIGHTENMENT_THUMBSCROLL_PAGE_SCROLL_FRICTION");
2742 ecore_x_window_prop_card32_set(ecore_x_window_root_first_get(),
2743 atom, &page_scroll_friction_i, 1);
2748 * Get the amount of inertia a scroller will impose at region bring
2751 * @return the bring in scroll friction
2753 * @ingroup Scrolling
2756 elm_scroll_bring_in_scroll_friction_get(void)
2758 return _elm_config->bring_in_scroll_friction;
2762 * Set the amount of inertia a scroller will impose at region bring
2765 * @param friction the bring in scroll friction
2767 * @see elm_thumbscroll_bring_in_scroll_friction_get()
2768 * @ingroup Scrolling
2771 elm_scroll_bring_in_scroll_friction_set(double friction)
2773 _elm_config->bring_in_scroll_friction = friction;
2777 * Set the amount of inertia a scroller will impose at region bring
2778 * animations, for all Elementary application windows.
2780 * @param friction the bring in scroll friction
2782 * @see elm_thumbscroll_bring_in_scroll_friction_get()
2783 * @ingroup Scrolling
2786 elm_scroll_bring_in_scroll_friction_all_set(double friction)
2788 #ifdef HAVE_ELEMENTARY_X
2789 static Ecore_X_Atom atom = 0;
2790 unsigned int bring_in_scroll_friction_i = (unsigned int)(friction * 1000.0);
2794 ecore_x_atom_get("ENLIGHTENMENT_THUMBSCROLL_BRING_IN_SCROLL_FRICTION");
2795 ecore_x_window_prop_card32_set(ecore_x_window_root_first_get(),
2796 atom, &bring_in_scroll_friction_i, 1);
2801 * Get the amount of inertia scrollers will impose at animations
2802 * triggered by Elementary widgets' zooming API.
2804 * @return the zoom friction
2806 * @ingroup Scrolling
2809 elm_scroll_zoom_friction_get(void)
2811 return _elm_config->zoom_friction;
2815 * Set the amount of inertia scrollers will impose at animations
2816 * triggered by Elementary widgets' zooming API.
2818 * @param friction the zoom friction
2820 * @see elm_thumbscroll_zoom_friction_get()
2821 * @ingroup Scrolling
2824 elm_scroll_zoom_friction_set(double friction)
2826 _elm_config->zoom_friction = friction;
2830 * Set the amount of inertia scrollers will impose at animations
2831 * triggered by Elementary widgets' zooming API, for all Elementary
2832 * application windows.
2834 * @param friction the zoom friction
2836 * @see elm_thumbscroll_zoom_friction_get()
2837 * @ingroup Scrolling
2840 elm_scroll_zoom_friction_all_set(double friction)
2842 #ifdef HAVE_ELEMENTARY_X
2843 static Ecore_X_Atom atom = 0;
2844 unsigned int zoom_friction_i = (unsigned int)(friction * 1000.0);
2847 atom = ecore_x_atom_get("ENLIGHTENMENT_THUMBSCROLL_ZOOM_FRICTION");
2848 ecore_x_window_prop_card32_set(ecore_x_window_root_first_get(),
2849 atom, &zoom_friction_i, 1);
2854 * Get whether scrollers should be draggable from any point in their
2857 * @return the thumb scroll state
2859 * @note This is the default behavior for touch screens, in general.
2860 * @note All other functions namespaced with "thumbscroll" will only
2861 * have effect if this mode is enabled.
2863 * @ingroup Scrolling
2866 elm_scroll_thumbscroll_enabled_get(void)
2868 return _elm_config->thumbscroll_enable;
2872 * Set whether scrollers should be draggable from any point in their
2875 * @param enabled the thumb scroll state
2877 * @see elm_thumbscroll_enabled_get()
2878 * @ingroup Scrolling
2881 elm_scroll_thumbscroll_enabled_set(Eina_Bool enabled)
2883 _elm_config->thumbscroll_enable = enabled;
2887 * Set whether scrollers should be draggable from any point in their
2888 * views, for all Elementary application windows.
2890 * @param enabled the thumb scroll state
2892 * @see elm_thumbscroll_enabled_get()
2893 * @ingroup Scrolling
2896 elm_scroll_thumbscroll_enabled_all_set(Eina_Bool enabled)
2898 #ifdef HAVE_ELEMENTARY_X
2899 static Ecore_X_Atom atom = 0;
2900 unsigned int ts_enable_i = (unsigned int)enabled;
2902 if (!atom) atom = ecore_x_atom_get("ENLIGHTENMENT_THUMBSCROLL_ENABLE");
2903 ecore_x_window_prop_card32_set(ecore_x_window_root_first_get(),
2904 atom, &ts_enable_i, 1);
2909 * Get the number of pixels one should travel while dragging a
2910 * scroller's view to actually trigger scrolling.
2912 * @return the thumb scroll threshould
2914 * One would use higher values for touch screens, in general, because
2915 * of their inherent imprecision.
2916 * @ingroup Scrolling
2919 elm_scroll_thumbscroll_threshold_get(void)
2921 return _elm_config->thumbscroll_threshold;
2925 * Set the number of pixels one should travel while dragging a
2926 * scroller's view to actually trigger scrolling.
2928 * @param threshold the thumb scroll threshould
2930 * @see elm_thumbscroll_threshould_get()
2931 * @ingroup Scrolling
2934 elm_scroll_thumbscroll_threshold_set(unsigned int threshold)
2936 _elm_config->thumbscroll_threshold = threshold;
2940 * Set the number of pixels one should travel while dragging a
2941 * scroller's view to actually trigger scrolling, for all Elementary
2942 * application windows.
2944 * @param threshold the thumb scroll threshould
2946 * @see elm_thumbscroll_threshould_get()
2947 * @ingroup Scrolling
2950 elm_scroll_thumbscroll_threshold_all_set(unsigned int threshold)
2952 #ifdef HAVE_ELEMENTARY_X
2953 static Ecore_X_Atom atom = 0;
2954 unsigned int ts_threshold_i = (unsigned int)threshold;
2956 if (!atom) atom = ecore_x_atom_get("ENLIGHTENMENT_THUMBSCROLL_THRESHOLD");
2957 ecore_x_window_prop_card32_set(ecore_x_window_root_first_get(),
2958 atom, &ts_threshold_i, 1);
2963 * Get the minimum speed of mouse cursor movement which will trigger
2964 * list self scrolling animation after a mouse up event
2967 * @return the thumb scroll momentum threshould
2969 * @ingroup Scrolling
2972 elm_scroll_thumbscroll_momentum_threshold_get(void)
2974 return _elm_config->thumbscroll_momentum_threshold;
2978 * Set the minimum speed of mouse cursor movement which will trigger
2979 * list self scrolling animation after a mouse up event
2982 * @param threshold the thumb scroll momentum threshould
2984 * @see elm_thumbscroll_momentum_threshould_get()
2985 * @ingroup Scrolling
2988 elm_scroll_thumbscroll_momentum_threshold_set(double threshold)
2990 _elm_config->thumbscroll_momentum_threshold = threshold;
2994 * Set the minimum speed of mouse cursor movement which will trigger
2995 * list self scrolling animation after a mouse up event
2996 * (pixels/second), for all Elementary application windows.
2998 * @param threshold the thumb scroll momentum threshould
3000 * @see elm_thumbscroll_momentum_threshould_get()
3001 * @ingroup Scrolling
3004 elm_scroll_thumbscroll_momentum_threshold_all_set(double threshold)
3006 #ifdef HAVE_ELEMENTARY_X
3007 static Ecore_X_Atom atom = 0;
3008 unsigned int ts_momentum_threshold_i = (unsigned int)(threshold * 1000.0);
3011 atom = ecore_x_atom_get("ENLIGHTENMENT_THUMBSCROLL_MOMENTUM_THRESHOLD");
3012 ecore_x_window_prop_card32_set(ecore_x_window_root_first_get(),
3013 atom, &ts_momentum_threshold_i, 1);
3018 * Get the amount of inertia a scroller will impose at self scrolling
3021 * @return the thumb scroll friction
3023 * @ingroup Scrolling
3026 elm_scroll_thumbscroll_friction_get(void)
3028 return _elm_config->thumbscroll_friction;
3032 * Set the amount of inertia a scroller will impose at self scrolling
3035 * @param friction the thumb scroll friction
3037 * @see elm_thumbscroll_friction_get()
3038 * @ingroup Scrolling
3041 elm_scroll_thumbscroll_friction_set(double friction)
3043 _elm_config->thumbscroll_friction = friction;
3047 * Set the amount of inertia a scroller will impose at self scrolling
3048 * animations, for all Elementary application windows.
3050 * @param friction the thumb scroll friction
3052 * @see elm_thumbscroll_friction_get()
3053 * @ingroup Scrolling
3056 elm_scroll_thumbscroll_friction_all_set(double friction)
3058 #ifdef HAVE_ELEMENTARY_X
3059 static Ecore_X_Atom atom = 0;
3060 unsigned int ts_friction_i = (unsigned int)(friction * 1000.0);
3062 if (!atom) atom = ecore_x_atom_get("ENLIGHTENMENT_THUMBSCROLL_FRICTION");
3063 ecore_x_window_prop_card32_set(ecore_x_window_root_first_get(),
3064 atom, &ts_friction_i, 1);
3069 * Get the amount of lag between your actual mouse cursor dragging
3070 * movement and a scroller's view movement itself, while pushing it
3071 * into bounce state manually.
3073 * @return the thumb scroll border friction
3075 * @ingroup Scrolling
3078 elm_scroll_thumbscroll_border_friction_get(void)
3080 return _elm_config->thumbscroll_border_friction;
3084 * Set the amount of lag between your actual mouse cursor dragging
3085 * movement and a scroller's view movement itself, while pushing it
3086 * into bounce state manually.
3088 * @param friction the thumb scroll border friction. @c 0.0 for
3089 * perfect synchrony between two movements, @c 1.0 for maximum
3092 * @see elm_thumbscroll_border_friction_get()
3093 * @note parameter value will get bound to 0.0 - 1.0 interval, always
3095 * @ingroup Scrolling
3098 elm_scroll_thumbscroll_border_friction_set(double friction)
3106 _elm_config->thumbscroll_friction = friction;
3110 * Set the amount of lag between your actual mouse cursor dragging
3111 * movement and a scroller's view movement itself, while pushing it
3112 * into bounce state manually, for all Elementary application windows.
3114 * @param friction the thumb scroll border friction. @c 0.0 for
3115 * perfect synchrony between two movements, @c 1.0 for maximum
3118 * @see elm_thumbscroll_border_friction_get()
3119 * @note parameter value will get bound to 0.0 - 1.0 interval, always
3121 * @ingroup Scrolling
3124 elm_scroll_thumbscroll_border_friction_all_set(double friction)
3132 #ifdef HAVE_ELEMENTARY_X
3133 static Ecore_X_Atom atom = 0;
3134 unsigned int border_friction_i = (unsigned int)(friction * 1000.0);
3137 atom = ecore_x_atom_get("ENLIGHTENMENT_THUMBSCROLL_BORDER_FRICTION");
3138 ecore_x_window_prop_card32_set(ecore_x_window_root_first_get(),
3139 atom, &border_friction_i, 1);
3144 * @defgroup Scrollhints Scrollhints
3147 * Objects when inside a scroller can scroll, but this may not always be
3148 * desirable in certain situations. This allows an object to hint to itself
3149 * and parents to "not scroll" in one of 2 ways.
3151 * 1. To hold on scrolling. This means just flicking and dragging may no
3152 * longer scroll, but pressing/dragging near an edge of the scroller will
3153 * still scroll. This is automastically used by the entry object when
3155 * 2. To totally freeze scrolling. This means it stops. until popped/released.
3159 * Push the scroll hold by 1
3161 * This increments the scroll hold count by one. If it is more than 0 it will
3162 * take effect on the parents of the indicated object.
3164 * @param obj The object
3165 * @ingroup Scrollhints
3168 elm_object_scroll_hold_push(Evas_Object *obj)
3170 EINA_SAFETY_ON_NULL_RETURN(obj);
3171 elm_widget_scroll_hold_push(obj);
3175 * Pop the scroll hold by 1
3177 * This decrements the scroll hold count by one. If it is more than 0 it will
3178 * take effect on the parents of the indicated object.
3180 * @param obj The object
3181 * @ingroup Scrollhints
3184 elm_object_scroll_hold_pop(Evas_Object *obj)
3186 EINA_SAFETY_ON_NULL_RETURN(obj);
3187 elm_widget_scroll_hold_pop(obj);
3191 * Push the scroll freeze by 1
3193 * This increments the scroll freeze count by one. If it is more than 0 it will
3194 * take effect on the parents of the indicated object.
3196 * @param obj The object
3197 * @ingroup Scrollhints
3200 elm_object_scroll_freeze_push(Evas_Object *obj)
3202 EINA_SAFETY_ON_NULL_RETURN(obj);
3203 elm_widget_scroll_freeze_push(obj);
3207 * Lock the scrolling of the given widget (and thus all parents)
3209 * This locks the given object from scrolling in the X axis (and implicitly
3210 * also locks all parent scrollers too from doing the same).
3212 * @param obj The object
3213 * @param lock The lock state (1 == locked, 0 == unlocked)
3214 * @ingroup Scrollhints
3217 elm_object_scroll_lock_x_set(Evas_Object *obj,
3220 EINA_SAFETY_ON_NULL_RETURN(obj);
3221 elm_widget_drag_lock_x_set(obj, lock);
3225 * Lock the scrolling of the given widget (and thus all parents)
3227 * This locks the given object from scrolling in the Y axis (and implicitly
3228 * also locks all parent scrollers too from doing the same).
3230 * @param obj The object
3231 * @param lock The lock state (1 == locked, 0 == unlocked)
3232 * @ingroup Scrollhints
3235 elm_object_scroll_lock_y_set(Evas_Object *obj,
3238 EINA_SAFETY_ON_NULL_RETURN(obj);
3239 elm_widget_drag_lock_y_set(obj, lock);
3243 * Get the scrolling lock of the given widget
3245 * This gets the lock for X axis scrolling.
3247 * @param obj The object
3248 * @ingroup Scrollhints
3251 elm_object_scroll_lock_x_get(const Evas_Object *obj)
3253 EINA_SAFETY_ON_NULL_RETURN_VAL(obj, EINA_FALSE);
3254 return elm_widget_drag_lock_x_get(obj);
3258 * Get the scrolling lock of the given widget
3260 * This gets the lock for X axis scrolling.
3262 * @param obj The object
3263 * @ingroup Scrollhints
3266 elm_object_scroll_lock_y_get(const Evas_Object *obj)
3268 EINA_SAFETY_ON_NULL_RETURN_VAL(obj, EINA_FALSE);
3269 return elm_widget_drag_lock_y_get(obj);
3273 * Pop the scroll freeze by 1
3275 * This decrements the scroll freeze count by one. If it is more than 0 it will
3276 * take effect on the parents of the indicated object.
3278 * @param obj The object
3279 * @ingroup Scrollhints
3282 elm_object_scroll_freeze_pop(Evas_Object *obj)
3284 EINA_SAFETY_ON_NULL_RETURN(obj);
3285 elm_widget_scroll_freeze_pop(obj);
3289 * @defgroup WidgetNavigation Widget Tree Navigation.
3292 * How to check if an Evas Object is an Elementary widget? How to get
3293 * the first elementary widget that is parent of the given object?
3294 * These are all covered in widget tree navigation.
3298 * Check if the given Evas Object is an Elementary widget.
3300 * @param obj the object to query.
3301 * @return @c EINA_TRUE if it is an elementary widget variant,
3302 * @c EINA_FALSE otherwise
3303 * @ingroup WidgetNavigation
3306 elm_object_widget_check(const Evas_Object *obj)
3308 EINA_SAFETY_ON_NULL_RETURN_VAL(obj, EINA_FALSE);
3309 return elm_widget_is(obj);
3313 * Get the first parent of the given object that is an Elementary widget.
3315 * @param obj the object to query.
3316 * @return the parent object that is an Elementary widget, or @c NULL
3317 * if no parent is, or no parents at all.
3318 * @ingroup WidgetNavigation
3321 elm_object_parent_widget_get(const Evas_Object *obj)
3323 EINA_SAFETY_ON_NULL_RETURN_VAL(obj, NULL);
3324 return elm_widget_parent_widget_get(obj);
3328 * Get the top level parent of an Elementary widget.
3330 * @param obj The object to query.
3331 * @return The top level Elementary widget, or @c NULL if parent cannot be
3333 * @ingroup WidgetNavigation
3336 elm_object_top_widget_get(const Evas_Object *obj)
3338 EINA_SAFETY_ON_NULL_RETURN_VAL(obj, NULL);
3339 return elm_widget_top_get(obj);
3343 * Get the string that represents this Elementary widget.
3345 * @note Elementary is weird and exposes itself as a single
3346 * Evas_Object_Smart_Class of type "elm_widget", so
3347 * evas_object_type_get() always return that, making debug and
3348 * language bindings hard. This function tries to mitigate this
3349 * problem, but the solution is to change Elementary to use
3350 * proper inheritance.
3352 * @param obj the object to query.
3353 * @return Elementary widget name, or @c NULL if not a valid widget.
3354 * @ingroup WidgetNavigation
3357 elm_object_widget_type_get(const Evas_Object *obj)
3359 EINA_SAFETY_ON_NULL_RETURN_VAL(obj, NULL);
3360 return elm_widget_type_get(obj);
3364 * Send a signal to the widget edje object.
3366 * This function sends a signal to the edje object of the obj. An edje program
3367 * can respond to a signal by specifying matching 'signal' and
3370 * @param obj The object
3371 * @param emission The signal's name.
3372 * @param source The signal's source.
3376 elm_object_signal_emit(Evas_Object *obj,
3377 const char *emission,
3380 EINA_SAFETY_ON_NULL_RETURN(obj);
3381 elm_widget_signal_emit(obj, emission, source);
3385 * Add a callback for a signal emitted by widget edje object.
3387 * This function connects a callback function to a signal emitted by the
3388 * edje object of the obj.
3389 * Globs can occur in either the emission or source name.
3391 * @param obj The object
3392 * @param emission The signal's name.
3393 * @param source The signal's source.
3394 * @param func The callback function to be executed when the signal is
3396 * @param data A pointer to data to pass in to the callback function.
3400 elm_object_signal_callback_add(Evas_Object *obj, const char *emission, const char *source, void (*func) (void *data, Evas_Object *o, const char *emission, const char *source), void *data)
3402 EINA_SAFETY_ON_NULL_RETURN(obj);
3403 EINA_SAFETY_ON_NULL_RETURN(func);
3404 elm_widget_signal_callback_add(obj, emission, source, func, data);
3408 * Remove a signal-triggered callback from an widget edje object.
3410 * This function removes a callback, previoulsy attached to a signal emitted
3411 * by the edje object of the obj.
3412 * The parameters emission, source and func must match exactly those passed to
3413 * a previous call to elm_object_signal_callback_add(). The data pointer that
3414 * was passed to this call will be returned.
3416 * @param obj The object
3417 * @param emission The signal's name.
3418 * @param source The signal's source.
3419 * @param func The callback function to be executed when the signal is
3421 * @return The data pointer
3425 elm_object_signal_callback_del(Evas_Object *obj, const char *emission, const char *source, void (*func) (void *data, Evas_Object *o, const char *emission, const char *source))
3427 EINA_SAFETY_ON_NULL_RETURN_VAL(obj, NULL);
3428 EINA_SAFETY_ON_NULL_RETURN_VAL(func, NULL);
3429 return elm_widget_signal_callback_del(obj, emission, source, func);
3433 * Add a callback for a event emitted by widget or their children.
3435 * This function connects a callback function to any key_down key_up event
3436 * emitted by the @p obj or their children.
3437 * This only will be called if no other callback has consumed the event.
3438 * If you want consume the event, and no other get it, func should return
3439 * EINA_TRUE and put EVAS_EVENT_FLAG_ON_HOLD in event_flags.
3441 * @warning Accept duplicated callback addition.
3443 * @param obj The object
3444 * @param func The callback function to be executed when the event is
3446 * @param data Data to pass in to the callback function.
3450 elm_object_event_callback_add(Evas_Object *obj, Elm_Event_Cb func, const void *data)
3452 EINA_SAFETY_ON_NULL_RETURN(obj);
3453 EINA_SAFETY_ON_NULL_RETURN(func);
3454 elm_widget_event_callback_add(obj, func, data);
3458 * Remove a event callback from an widget.
3460 * This function removes a callback, previoulsy attached to event emission
3462 * The parameters func and data must match exactly those passed to
3463 * a previous call to elm_object_event_callback_add(). The data pointer that
3464 * was passed to this call will be returned.
3466 * @param obj The object
3467 * @param func The callback function to be executed when the event is
3469 * @param data Data to pass in to the callback function.
3470 * @return The data pointer
3474 elm_object_event_callback_del(Evas_Object *obj, Elm_Event_Cb func, const void *data)
3476 EINA_SAFETY_ON_NULL_RETURN_VAL(obj, NULL);
3477 EINA_SAFETY_ON_NULL_RETURN_VAL(func, NULL);
3478 return elm_widget_event_callback_del(obj, func, data);
3483 * @defgroup Debug Debug
3488 * Print Tree object hierarchy in stdout
3490 * @param obj The root object
3494 elm_object_tree_dump(const Evas_Object *top)
3497 elm_widget_tree_dump(top);
3505 * Print Elm Objects tree hierarchy in file as dot(graphviz) syntax.
3507 * @param obj The root object
3508 * @param file The path of output file
3512 elm_object_tree_dot_dump(const Evas_Object *top,
3516 FILE *f = fopen(file, "w");
3517 elm_widget_tree_dot_dump(top, f);
3527 * Set the duration for occuring long press event.
3529 * @param lonpress_timeout Timeout for long press event
3530 * @ingroup Longpress
3533 elm_longpress_timeout_set(double longpress_timeout)
3535 _elm_config->longpress_timeout = longpress_timeout;
3539 * Get the duration for occuring long press event.
3541 * @return Timeout for long press event
3542 * @ingroup Longpress
3545 elm_longpress_timeout_get(void)
3547 return _elm_config->longpress_timeout;