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;
24 _elm_dangerous_call_check(const char *call)
29 snprintf(buf, sizeof(buf), "%i.%i.%i.%i", VMAJ, VMIN, VMIC, VREV);
30 eval = getenv("ELM_NO_FINGER_WAGGLING");
31 if ((eval) && (!strcmp(eval, buf)))
33 printf("ELEMENTARY FINGER WAGGLE!!!!!!!!!!\n"
36 "PLEASE see the API documentation for this function. This call\n"
37 "should almost never be used. Only in very special cases.\n"
39 "To remove this warning please set the environment variable:\n"
40 " ELM_NO_FINGER_WAGGLING\n"
41 "To the value of the Elementary version + revision number. e.g.:\n"
50 * @defgroup Start Getting Started
52 * To write an Elementary app, you can get started with the following:
55 * #include <Elementary.h>
56 * #ifndef ELM_LIB_QUICKLAUNCH
58 * elm_main(int argc, char **argv)
60 * // create window(s) here and do any application init
61 * elm_run(); // run main loop
62 * elm_shutdown(); // after mainloop finishes running, shutdown
63 * return 0; // exit 0 for exit code
69 * To take full advantage of the quicklaunch architecture for launching
70 * processes as quickly as possible (saving time at startup time like
71 * connecting to X11, loading and linking shared libraries) you may want to
72 * use the following configure.in/configure.ac and Makefile.am and autogen.sh
73 * script to generate your files. It is assumed your application uses the
74 * main.c file for its code.
76 * configure.in/configure.ac:
79 AC_INIT(myapp, 0.0.0, myname@mydomain.com)
81 AC_CONFIG_SRCDIR(configure.in)
83 AM_INIT_AUTOMAKE(1.6 dist-bzip2)
84 AM_CONFIG_HEADER(config.h)
94 define([AC_LIBTOOL_LANG_CXX_CONFIG], [:])dnl
95 define([AC_LIBTOOL_LANG_F77_CONFIG], [:])dnl
98 PKG_CHECK_MODULES([ELEMENTARY], elementary)
106 AUTOMAKE_OPTIONS = 1.4 foreign
107 MAINTAINERCLEANFILES = Makefile.in
109 INCLUDES = -I$(top_srcdir) @ELEMENTARY_CFLAGS@
112 myapp_LTLIBRARIES = myapp.la
116 myapp_la_SOURCES = main.c
117 myapp_la_LIBADD = @ELEMENTARY_LIBS@
119 myapp_la_LDFLAGS = -module -avoid-version -no-undefined
121 myapp_SOURCES = main.c
122 myapp_LDADD = @ELEMENTARY_LIBS@
123 myapp_CFLAGS = -DELM_LIB_QUICKLAUNCH=1
130 rm -rf autom4te.cache
131 rm -f aclocal.m4 ltmain.sh
136 echo "Running aclocal..." ; aclocal $ACLOCAL_FLAGS -I m4 || exit 1
137 echo "Running autoheader..." ; autoheader || exit 1
138 echo "Running autoconf..." ; autoconf || exit 1
139 echo "Running libtoolize..." ; (libtoolize --copy --automake || glibtoolize --automake) || exit 1
140 echo "Running automake..." ; automake --add-missing --copy --gnu || exit 1
142 if [ -z "$NOCONFIGURE" ]; then
147 * To gnerate all the things needed to bootstrap just run:
153 * This will generate Makefile.in's, the confgure script and everything else.
154 * After this it works like all normal autotools projects:
161 * Note sudo was assumed to get root permissions, as this would install in
162 * /usr/local which is system-owned. Use any way you like to gain root, or
163 * specify a different prefix with configure:
166 ./confiugre --prefix=$HOME/mysoftware
169 * Also remember that autotools buys you some useful commands like:
174 * This uninstalls the software after it was installed with "make install".
175 * It is very useful to clear up what you built if you wish to clean the
182 * This firstly checks if your build tree is "clean" and ready for
183 * distribution. It also builds a tarball (myapp-0.0.0.tar.gz) that is
184 * ready to upload and distribute to the world, that contains the generated
185 * Makefile.in's and configure script. The users do not need to run
186 * autogen.sh - just configure and on. They don't need autotools installed.
187 * This tarball also builds cleanly, has all the sources it needs to build
188 * included (that is sources for your application, not libraries it depends
189 * on like Elementary). It builds cleanly in a buildroot and does not
190 * contain any files that are temporarily generated like binaries and other
191 * build-generated files, so the tarball is clean, and no need to worry
192 * about cleaning up your tree before packaging.
198 * This cleans up all build files (binaries, objects etc.) from the tree.
204 * This cleans out all files from the build and from configure's output too.
207 make maintainer-clean
210 * This deletes all the files autogen.sh will produce so the tree is clean
211 * to be put into a revision-control system (like CVS, SVN or GIT for example).
213 * The above will build a library - libmyapp.so and install in the target
214 * library directory (default is /usr/local/lib). You will also get a
215 * myapp.a and myapp.la - these are useless and can be deleted. Libtool likes
216 * to generate these all the time. You will also get a binary in the target
217 * binary directory (default is /usr/local/bin). This is a "debug binary".
218 * This will run and dlopen() the myapp.so and then jump to it's elm_main
219 * function. This allows for easy debugging with GDB and Valgrind. When you
220 * are ready to go to production do the following:
222 * 1. delete the myapp binary. i.e. rm /usr/local/bin/myapp
224 * 2. symlink the myapp binary to elementary_run (supplied by elementary).
225 * i.e. ln -s elmentary_run /usr/local/bin/myapp
227 * 3. run elementary_quicklaunch as part of your graphical login session and
230 * This will man elementary_quicklaunch does pre-initialization before the
231 * application needs to be run, saving the effort at the time the application
232 * is needed, thus speeding up the time it takes to appear.
234 * If you don't want to use the quicklaunch infrastructure (which is
235 * optional), you can execute the old fashioned way by just running the
236 * myapp binary loader than will load the myapp.so for you, or you can
237 * remove the split-file binary and put it into one binary as things always
238 * have been with the following configure.in/configure.ac and Makfile.am
241 * configure.in/configure.ac:
244 AC_INIT(myapp, 0.0.0, myname@mydomain.com)
246 AC_CONFIG_SRCDIR(configure.in)
248 AM_INIT_AUTOMAKE(1.6 dist-bzip2)
249 AM_CONFIG_HEADER(config.h)
258 PKG_CHECK_MODULES([ELEMENTARY], elementary)
266 AUTOMAKE_OPTIONS = 1.4 foreign
267 MAINTAINERCLEANFILES = Makefile.in
269 INCLUDES = -I$(top_srcdir) @ELEMENTARY_CFLAGS@
273 myapp_SOURCES = main.c
274 myapp_LDADD = @ELEMENTARY_LIBS@
278 * Notice that they are the same as before, just with libtool and library
279 * building sections removed. Both ways work for building elementary
280 * applications. It is up to you to decide what is best for you. If you just
281 * follow the template above, you can do it both ways and can decide at build
282 * time. The more advanced of you may suggest making it a configure option.
283 * That is perfectly valid, but has been left out here for simplicity, as our
284 * aim to have an Elementary (and EFL) tutorial, not an autoconf & automake
289 static Eina_Bool _elm_signal_exit(void *data,
293 static Eina_Prefix *pfx = NULL;
294 char *_elm_appname = NULL;
295 const char *_elm_data_dir = NULL;
296 const char *_elm_lib_dir = NULL;
297 int _elm_log_dom = -1;
299 EAPI int ELM_EVENT_POLICY_CHANGED = 0;
301 static int _elm_init_count = 0;
302 static int _elm_sub_init_count = 0;
303 static int _elm_ql_init_count = 0;
304 static int _elm_policies[ELM_POLICY_LAST];
305 static Ecore_Event_Handler *_elm_exit_handler = NULL;
306 static Eina_Bool quicklaunch_on = 0;
309 _elm_signal_exit(void *data __UNUSED__,
310 int ev_type __UNUSED__,
314 return ECORE_CALLBACK_PASS_ON;
320 edje_scale_set(_elm_config->scale);
321 _elm_win_rescale(NULL, EINA_FALSE);
324 static void *app_mainfunc = NULL;
325 static const char *app_domain = NULL;
326 static const char *app_checkfile = NULL;
328 static const char *app_compile_bin_dir = NULL;
329 static const char *app_compile_lib_dir = NULL;
330 static const char *app_compile_data_dir = NULL;
331 static const char *app_compile_locale_dir = NULL;
332 static const char *app_prefix_dir = NULL;
333 static const char *app_bin_dir = NULL;
334 static const char *app_lib_dir = NULL;
335 static const char *app_data_dir = NULL;
336 static const char *app_locale_dir = NULL;
338 static Eina_Prefix *app_pfx = NULL;
345 const char *dirs[4] = { NULL, NULL, NULL, NULL };
346 char *caps = NULL, *p1, *p2;
349 if (!app_domain) return;
351 ecore_app_args_get(&argc, &argv);
352 if (argc < 1) return;
354 dirs[0] = app_compile_bin_dir;
355 dirs[1] = app_compile_lib_dir;
356 dirs[2] = app_compile_data_dir;
357 dirs[3] = app_compile_locale_dir;
359 if (!dirs[1]) dirs[1] = dirs[0];
360 if (!dirs[0]) dirs[0] = dirs[1];
361 if (!dirs[3]) dirs[3] = dirs[2];
362 if (!dirs[2]) dirs[2] = dirs[3];
366 caps = alloca(strlen(app_domain) + 1);
367 for (p1 = (char *)app_domain, p2 = caps; *p1; p1++, p2++)
371 app_pfx = eina_prefix_new(argv[0], app_mainfunc, caps, app_domain,
372 app_checkfile, dirs[0], dirs[1], dirs[2], dirs[3]);
376 _prefix_shutdown(void)
378 if (app_pfx) eina_prefix_free(app_pfx);
379 if (app_domain) eina_stringshare_del(app_domain);
380 if (app_checkfile) eina_stringshare_del(app_checkfile);
381 if (app_compile_bin_dir) eina_stringshare_del(app_compile_bin_dir);
382 if (app_compile_lib_dir) eina_stringshare_del(app_compile_lib_dir);
383 if (app_compile_data_dir) eina_stringshare_del(app_compile_data_dir);
384 if (app_compile_locale_dir) eina_stringshare_del(app_compile_locale_dir);
385 if (app_prefix_dir) eina_stringshare_del(app_prefix_dir);
386 if (app_bin_dir) eina_stringshare_del(app_bin_dir);
387 if (app_lib_dir) eina_stringshare_del(app_lib_dir);
388 if (app_data_dir) eina_stringshare_del(app_data_dir);
389 if (app_locale_dir) eina_stringshare_del(app_locale_dir);
392 app_checkfile = NULL;
393 app_compile_bin_dir = NULL;
394 app_compile_lib_dir = NULL;
395 app_compile_data_dir = NULL;
396 app_compile_locale_dir = NULL;
397 app_prefix_dir = NULL;
401 app_locale_dir = NULL;
406 * @defgroup General General
410 * Inititalise Elementary
412 * @return The init counter value.
414 * This call is exported only for use by the ELM_MAIN() macro. There is no
415 * need to use this if you use this macro (which is highly advisable).
423 if (_elm_init_count > 1) return _elm_init_count;
424 elm_quicklaunch_init(argc, argv);
425 elm_quicklaunch_sub_init(argc, argv);
427 return _elm_init_count;
431 * Shut down Elementary
433 * @return The init counter value.
435 * This should be called at the end of your application just before it ceases
436 * to do any more processing. This will clean up any permanent resources your
437 * application may have allocated via Elementary that would otherwise persist
438 * on an exit without this call.
445 if (_elm_init_count > 0) return _elm_init_count;
447 while (_elm_win_deferred_free) ecore_main_loop_iterate();
449 // _prefix_shutdown();
450 elm_quicklaunch_sub_shutdown();
451 elm_quicklaunch_shutdown();
452 return _elm_init_count;
456 elm_app_info_set(void *mainfunc, const char *dom, const char *checkfile)
458 app_mainfunc = mainfunc;
459 eina_stringshare_replace(&app_domain, dom);
460 eina_stringshare_replace(&app_checkfile, checkfile);
464 elm_app_compile_bin_dir_set(const char *dir)
466 eina_stringshare_replace(&app_compile_bin_dir, dir);
470 elm_app_compile_lib_dir_set(const char *dir)
472 eina_stringshare_replace(&app_compile_lib_dir, dir);
476 elm_app_compile_data_dir_set(const char *dir)
478 eina_stringshare_replace(&app_compile_data_dir, dir);
482 elm_app_compile_locale_set(const char *dir)
484 eina_stringshare_replace(&app_compile_locale_dir, dir);
488 elm_app_prefix_dir_get(void)
490 if (app_prefix_dir) return app_prefix_dir;
492 if (!app_pfx) return "";
493 app_prefix_dir = eina_prefix_get(app_pfx);
494 return app_prefix_dir;
498 elm_app_bin_dir_get(void)
500 if (app_bin_dir) return app_bin_dir;
502 if (!app_pfx) return "";
503 app_bin_dir = eina_prefix_bin_get(app_pfx);
508 elm_app_lib_dir_get(void)
510 if (app_lib_dir) return app_lib_dir;
512 if (!app_pfx) return "";
513 app_lib_dir = eina_prefix_lib_get(app_pfx);
518 elm_app_data_dir_get(void)
520 if (app_data_dir) return app_data_dir;
522 if (!app_pfx) return "";
523 app_data_dir = eina_prefix_data_get(app_pfx);
528 elm_app_locale_dir_get(void)
530 if (app_locale_dir) return app_locale_dir;
532 if (!app_pfx) return "";
533 app_locale_dir = eina_prefix_locale_get(app_pfx);
534 return app_locale_dir;
538 static int _elm_need_e_dbus = 0;
541 elm_need_e_dbus(void)
544 if (_elm_need_e_dbus++) return EINA_TRUE;
553 _elm_unneed_e_dbus(void)
556 if (--_elm_need_e_dbus) return;
558 _elm_need_e_dbus = 0;
564 static int _elm_need_efreet = 0;
567 elm_need_efreet(void)
570 if (_elm_need_efreet++) return EINA_TRUE;
578 list = efreet_icon_extra_list_get();
581 e_user_dir_concat_static(buf, "icons");
582 *list = eina_list_prepend(*list, (void *)eina_stringshare_add(buf));
583 e_prefix_data_concat_static(buf, "data/icons");
584 *list = eina_list_prepend(*list, (void *)eina_stringshare_add(buf));
595 _elm_unneed_efreet(void)
598 if (--_elm_need_efreet) return;
600 _elm_need_efreet = 0;
601 efreet_trash_shutdown();
602 efreet_mime_shutdown();
608 elm_quicklaunch_mode_set(Eina_Bool ql_on)
610 quicklaunch_on = ql_on;
614 elm_quicklaunch_mode_get(void)
616 return quicklaunch_on;
620 elm_quicklaunch_init(int argc,
623 _elm_ql_init_count++;
624 if (_elm_ql_init_count > 1) return _elm_ql_init_count;
626 _elm_log_dom = eina_log_domain_register("elementary", EINA_COLOR_LIGHTBLUE);
629 EINA_LOG_ERR("could not register elementary log domain.");
630 _elm_log_dom = EINA_LOG_DOMAIN_GLOBAL;
635 ecore_app_args_set(argc, (const char **)argv);
637 memset(_elm_policies, 0, sizeof(_elm_policies));
638 if (!ELM_EVENT_POLICY_CHANGED)
639 ELM_EVENT_POLICY_CHANGED = ecore_event_type_new();
643 _elm_exit_handler = ecore_event_handler_add(ECORE_EVENT_SIGNAL_EXIT, _elm_signal_exit, NULL);
645 if (argv) _elm_appname = strdup(ecore_file_file_get(argv[0]));
647 pfx = eina_prefix_new(NULL, elm_init,
648 "ELM", "elementary", "config/profile.cfg",
649 PACKAGE_LIB_DIR, /* don't have a bin dir currently */
655 _elm_data_dir = eina_stringshare_add(eina_prefix_data_get(pfx));
656 _elm_lib_dir = eina_stringshare_add(eina_prefix_lib_get(pfx));
658 if (!_elm_data_dir) _elm_data_dir = eina_stringshare_add("/");
659 if (!_elm_lib_dir) _elm_lib_dir = eina_stringshare_add("/");
662 return _elm_ql_init_count;
666 elm_quicklaunch_sub_init(int argc,
669 _elm_sub_init_count++;
670 if (_elm_sub_init_count > 1) return _elm_sub_init_count;
673 #ifdef SEMI_BROKEN_QUICKLAUNCH
674 return _elm_sub_init_count;
679 ecore_app_args_set(argc, (const char **)argv);
683 _elm_config_sub_init();
684 #define ENGINE_COMPARE(name) (!strcmp(_elm_config->engine, name))
685 if (ENGINE_COMPARE(ELM_SOFTWARE_X11) ||
686 ENGINE_COMPARE(ELM_SOFTWARE_16_X11) ||
687 ENGINE_COMPARE(ELM_XRENDER_X11) ||
688 ENGINE_COMPARE(ELM_OPENGL_X11))
689 #undef ENGINE_COMPARE
691 #ifdef HAVE_ELEMENTARY_X
695 ecore_evas_init(); // FIXME: check errors
698 return _elm_sub_init_count;
702 elm_quicklaunch_sub_shutdown(void)
704 _elm_sub_init_count--;
705 if (_elm_sub_init_count > 0) return _elm_sub_init_count;
708 #ifdef SEMI_BROKEN_QUICKLAUNCH
709 return _elm_sub_init_count;
715 _elm_module_shutdown();
716 ecore_imf_shutdown();
717 ecore_evas_shutdown();
718 #define ENGINE_COMPARE(name) (!strcmp(_elm_config->engine, name))
719 if (ENGINE_COMPARE(ELM_SOFTWARE_X11) ||
720 ENGINE_COMPARE(ELM_SOFTWARE_16_X11) ||
721 ENGINE_COMPARE(ELM_XRENDER_X11) ||
722 ENGINE_COMPARE(ELM_OPENGL_X11))
723 #undef ENGINE_COMPARE
725 #ifdef HAVE_ELEMENTARY_X
726 ecore_x_disconnect();
729 #define ENGINE_COMPARE(name) (!strcmp(_elm_config->engine, name))
730 if (ENGINE_COMPARE(ELM_SOFTWARE_X11) ||
731 ENGINE_COMPARE(ELM_SOFTWARE_16_X11) ||
732 ENGINE_COMPARE(ELM_XRENDER_X11) ||
733 ENGINE_COMPARE(ELM_OPENGL_X11) ||
734 ENGINE_COMPARE(ELM_SOFTWARE_SDL) ||
735 ENGINE_COMPARE(ELM_SOFTWARE_16_SDL) ||
736 ENGINE_COMPARE(ELM_OPENGL_SDL) ||
737 ENGINE_COMPARE(ELM_SOFTWARE_WIN32) ||
738 ENGINE_COMPARE(ELM_SOFTWARE_16_WINCE))
739 #undef ENGINE_COMPARE
740 evas_cserve_disconnect();
744 return _elm_sub_init_count;
748 elm_quicklaunch_shutdown(void)
750 _elm_ql_init_count--;
751 if (_elm_ql_init_count > 0) return _elm_ql_init_count;
752 if (pfx) eina_prefix_free(pfx);
754 eina_stringshare_del(_elm_data_dir);
755 _elm_data_dir = NULL;
756 eina_stringshare_del(_elm_lib_dir);
762 _elm_config_shutdown();
764 ecore_event_handler_del(_elm_exit_handler);
765 _elm_exit_handler = NULL;
767 _elm_theme_shutdown();
768 _elm_unneed_efreet();
769 _elm_unneed_e_dbus();
770 _elm_unneed_ethumb();
771 ecore_file_shutdown();
775 if ((_elm_log_dom > -1) && (_elm_log_dom != EINA_LOG_DOMAIN_GLOBAL))
777 eina_log_domain_unregister(_elm_log_dom);
781 _elm_widget_type_clear();
784 return _elm_ql_init_count;
788 elm_quicklaunch_seed(void)
790 #ifndef SEMI_BROKEN_QUICKLAUNCH
793 Evas_Object *win, *bg, *bt;
795 win = elm_win_add(NULL, "seed", ELM_WIN_BASIC);
796 bg = elm_bg_add(win);
797 elm_win_resize_object_add(win, bg);
798 evas_object_show(bg);
799 bt = elm_button_add(win);
800 elm_button_label_set(bt, " abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789~-_=+\\|]}[{;:'\",<.>/?");
801 elm_win_resize_object_add(win, bt);
802 ecore_main_loop_iterate();
803 evas_object_del(win);
804 ecore_main_loop_iterate();
805 #define ENGINE_COMPARE(name) (!strcmp(_elm_config->engine, name))
806 if (ENGINE_COMPARE(ELM_SOFTWARE_X11) ||
807 ENGINE_COMPARE(ELM_SOFTWARE_16_X11) ||
808 ENGINE_COMPARE(ELM_XRENDER_X11) ||
809 ENGINE_COMPARE(ELM_OPENGL_X11))
810 #undef ENGINE_COMPARE
812 # ifdef HAVE_ELEMENTARY_X
816 ecore_main_loop_iterate();
821 static void *qr_handle = NULL;
822 static int (*qr_main)(int argc,
826 elm_quicklaunch_prepare(int argc __UNUSED__,
830 char *exe = elm_quicklaunch_exe_path_get(argv[0]);
833 ERR("requested quicklaunch binary '%s' does not exist\n", argv[0]);
841 exe2 = malloc(strlen(exe) + 1 + 10);
843 p = strrchr(exe2, '/');
846 exename = alloca(strlen(p) + 1);
849 strcat(p, "../lib/");
852 if (!access(exe2, R_OK | X_OK))
860 qr_handle = dlopen(exe, RTLD_NOW | RTLD_GLOBAL);
863 fprintf(stderr, "dlerr: %s\n", dlerror());
864 WRN("dlopen('%s') failed: %s", exe, dlerror());
868 INF("dlopen('%s') = %p", exe, qr_handle);
869 qr_main = dlsym(qr_handle, "elm_main");
870 INF("dlsym(%p, 'elm_main') = %p", qr_handle, qr_main);
873 WRN("not quicklauncher capable: no elm_main in '%s'", exe);
892 extern char **environ;
897 for (i = 0, size = 0; environ[i]; i++)
898 size += strlen(environ[i]) + 1;
900 p = malloc((i + 1) * sizeof(char *));
905 for (i = 0; oldenv[i]; i++)
906 environ[i] = strdup(oldenv[i]);
913 elm_quicklaunch_fork(int argc,
916 void (postfork_func) (void *data),
926 // need to accept current environment from elementary_run
933 if (child > 0) return EINA_TRUE;
936 perror("could not fork");
941 perror("could not chdir");
942 args = alloca((argc + 1) * sizeof(char *));
943 for (i = 0; i < argc; i++) args[i] = argv[i];
945 WRN("%s not quicklaunch capable, fallback...", argv[0]);
946 execvp(argv[0], args);
947 ERR("failed to execute '%s': %s", argv[0], strerror(errno));
951 if (child > 0) return EINA_TRUE;
954 perror("could not fork");
957 if (postfork_func) postfork_func(postfork_data);
961 #ifdef SEMI_BROKEN_QUICKLAUNCH
962 ecore_app_args_set(argc, (const char **)argv);
965 _elm_config_sub_init();
966 #define ENGINE_COMPARE(name) (!strcmp(_elm_config->engine, name))
967 if (ENGINE_COMPARE(ELM_SOFTWARE_X11) ||
968 ENGINE_COMPARE(ELM_SOFTWARE_16_X11) ||
969 ENGINE_COMPARE(ELM_XRENDER_X11) ||
970 ENGINE_COMPARE(ELM_OPENGL_X11))
971 #undef ENGINE_COMPARE
973 # ifdef HAVE_ELEMENTARY_X
977 ecore_evas_init(); // FIXME: check errors
985 perror("could not chdir");
986 // FIXME: this is very linux specific. it changes argv[0] of the process
987 // so ps etc. report what you'd expect. for other unixes and os's this
994 ecore_app_args_get(&real_argc, &real_argv);
995 lastarg = real_argv[real_argc - 1] + strlen(real_argv[real_argc - 1]);
996 for (p = real_argv[0]; p < lastarg; p++) *p = 0;
997 strcpy(real_argv[0], argv[0]);
999 ecore_app_args_set(argc, (const char **)argv);
1000 ret = qr_main(argc, argv);
1008 (void)postfork_func;
1009 (void)postfork_data;
1014 elm_quicklaunch_cleanup(void)
1027 elm_quicklaunch_fallback(int argc,
1031 elm_quicklaunch_init(argc, argv);
1032 elm_quicklaunch_sub_init(argc, argv);
1033 elm_quicklaunch_prepare(argc, argv);
1034 ret = qr_main(argc, argv);
1040 elm_quicklaunch_exe_path_get(const char *exe)
1042 static char *path = NULL;
1043 static Eina_List *pathlist = NULL;
1044 const char *pathitr;
1047 if (exe[0] == '/') return strdup(exe);
1048 if ((exe[0] == '.') && (exe[1] == '/')) return strdup(exe);
1049 if ((exe[0] == '.') && (exe[1] == '.') && (exe[2] == '/')) return strdup(exe);
1054 path = getenv("PATH");
1055 buf2 = alloca(strlen(path) + 1);
1060 if ((*p == ':') || (!*p))
1065 strncpy(buf2, pp, len);
1067 pathlist = eina_list_append(pathlist, eina_stringshare_add(buf2));
1079 EINA_LIST_FOREACH(pathlist, l, pathitr)
1081 snprintf(buf, sizeof(buf), "%s/%s", pathitr, exe);
1082 if (!access(buf, R_OK | X_OK)) return strdup(buf);
1090 * This call should be called just after all initialization is complete. This
1091 * function will not return until elm_exit() is called. It will keep looping
1092 * running the main event/processing loop for Elementary.
1098 ecore_main_loop_begin();
1102 * Exit the main loop
1104 * If this call is called, it will flag the main loop to cease processing and
1105 * return back to its parent function.
1111 ecore_main_loop_quit();
1115 * Set new policy value.
1117 * This will emit the ecore event ELM_EVENT_POLICY_CHANGED in the main
1118 * loop giving the event information Elm_Event_Policy_Changed with
1119 * policy identifier, new and old values.
1121 * @param policy policy identifier as in Elm_Policy.
1122 * @param value policy value, depends on identifiers, usually there is
1123 * an enumeration with the same prefix as the policy name, for
1124 * example: ELM_POLICY_QUIT and Elm_Policy_Quit
1125 * (ELM_POLICY_QUIT_NONE, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED).
1128 * @return @c EINA_TRUE on success or @c EINA_FALSE on error (right
1129 * now just invalid policy identifier, but in future policy
1130 * value might be enforced).
1133 elm_policy_set(unsigned int policy,
1136 Elm_Event_Policy_Changed *ev;
1138 if (policy >= ELM_POLICY_LAST)
1141 if (value == _elm_policies[policy])
1144 /* TODO: validade policy? */
1146 ev = malloc(sizeof(*ev));
1147 ev->policy = policy;
1148 ev->new_value = value;
1149 ev->old_value = _elm_policies[policy];
1151 _elm_policies[policy] = value;
1153 ecore_event_add(ELM_EVENT_POLICY_CHANGED, ev, NULL, NULL);
1159 * Gets the policy value set for given identifier.
1161 * @param policy policy identifier as in Elm_Policy.
1164 * @return policy value. Will be 0 if policy identifier is invalid.
1167 elm_policy_get(unsigned int policy)
1169 if (policy >= ELM_POLICY_LAST)
1171 return _elm_policies[policy];
1175 * @defgroup UI-Mirroring Selective Widget mirroring
1177 * These functions allow you to set ui-mirroring on specific widgets or the
1178 * whole interface. Widgets can be in one of two modes, automatic and manual.
1179 * Automatic means they'll be changed according to the system mirroring mode
1180 * and manual means only explicit changes will matter. You are not supposed to
1181 * change mirroring state of a widget set to automatic, will mostly work, but
1182 * the behavior is not really defined.
1186 * Returns the widget's mirrored mode.
1188 * @param obj The widget.
1189 * @return mirrored mode of the object.
1193 elm_object_mirrored_get(const Evas_Object *obj)
1195 EINA_SAFETY_ON_NULL_RETURN_VAL(obj, EINA_FALSE);
1196 return elm_widget_mirrored_get(obj);
1200 * Sets the widget's mirrored mode.
1202 * @param obj The widget.
1203 * @param mirrored EINA_TRUE to set mirrored mode. EINA_FALSE to unset.
1206 elm_object_mirrored_set(Evas_Object *obj, Eina_Bool mirrored)
1208 EINA_SAFETY_ON_NULL_RETURN(obj);
1209 elm_widget_mirrored_set(obj, mirrored);
1213 * Returns the widget's mirrored mode setting.
1215 * @param obj The widget.
1216 * @return mirrored mode setting of the object.
1220 elm_object_mirrored_automatic_get(const Evas_Object *obj)
1222 EINA_SAFETY_ON_NULL_RETURN_VAL(obj, EINA_FALSE);
1223 return elm_widget_mirrored_automatic_get(obj);
1227 * Sets the widget's mirrored mode setting.
1228 * When widget in automatic mode, it follows the system mirrored mode set by
1229 * elm_mirrored_set().
1230 * @param obj The widget.
1231 * @param automatic EINA_TRUE for auto mirrored mode. EINA_FALSE for manual.
1234 elm_object_mirrored_automatic_set(Evas_Object *obj, Eina_Bool automatic)
1236 EINA_SAFETY_ON_NULL_RETURN(obj);
1237 elm_widget_mirrored_automatic_set(obj, automatic);
1241 * @defgroup Scaling Selective Widget Scaling
1243 * Different widgets can be scaled independently. These functions allow you to
1244 * manipulate this scaling on a per-widget basis. The object and all its
1245 * children get their scaling factors multiplied by the scale factor set.
1246 * This is multiplicative, in that if a child also has a scale size set it is
1247 * in turn multiplied by its parent's scale size. 1.0 means “don't scale”,
1248 * 2.0 is double size, 0.5 is half etc.
1252 * Set the scaling factor
1254 * @param obj The object
1255 * @param scale Scale factor (from 0.0 up, with 1.0 == no scaling)
1259 elm_object_scale_set(Evas_Object *obj,
1262 EINA_SAFETY_ON_NULL_RETURN(obj);
1263 elm_widget_scale_set(obj, scale);
1267 * Get the scaling factor
1269 * @param obj The object
1270 * @return The scaling factor set by elm_object_scale_set()
1274 elm_object_scale_get(const Evas_Object *obj)
1276 EINA_SAFETY_ON_NULL_RETURN_VAL(obj, 0.0);
1277 return elm_widget_scale_get(obj);
1281 * Get the global scaling factor
1283 * This gets the globally configured scaling factor that is applied to all
1286 * @return The scaling factor
1292 return _elm_config->scale;
1296 * Set the global scaling factor
1298 * This sets the globally configured scaling factor that is applied to all
1301 * @param scale The scaling factor to set
1305 elm_scale_set(double scale)
1307 if (_elm_config->scale == scale) return;
1308 _elm_config->scale = scale;
1313 * Set the global scaling factor for all applications on the display
1315 * This sets the globally configured scaling factor that is applied to all
1316 * objects for all applications.
1317 * @param scale The scaling factor to set
1321 elm_scale_all_set(double scale)
1323 #ifdef HAVE_ELEMENTARY_X
1324 static Ecore_X_Atom atom = 0;
1325 unsigned int scale_i = (unsigned int)(scale * 1000.0);
1327 if (!atom) atom = ecore_x_atom_get("ENLIGHTENMENT_SCALE");
1328 ecore_x_window_prop_card32_set(ecore_x_window_root_first_get(),
1334 * @defgroup Styles Styles
1336 * Widgets can have different styles of look. These generic API's set
1337 * styles of widgets, if they support them (and if the theme(s) do).
1343 * This sets the name of the style
1344 * @param obj The object
1345 * @param style The style name to use
1349 elm_object_style_set(Evas_Object *obj,
1352 EINA_SAFETY_ON_NULL_RETURN(obj);
1353 elm_widget_style_set(obj, style);
1359 * This gets the style being used for that widget. Note that the string
1360 * pointer is only valid as longas the object is valid and the style doesn't
1363 * @param obj The object
1364 * @return The style name
1368 elm_object_style_get(const Evas_Object *obj)
1370 EINA_SAFETY_ON_NULL_RETURN_VAL(obj, NULL);
1371 return elm_widget_style_get(obj);
1375 * Set the disable state
1377 * This sets the disable state for the widget.
1379 * @param obj The object
1380 * @param disabled The state
1384 elm_object_disabled_set(Evas_Object *obj,
1387 EINA_SAFETY_ON_NULL_RETURN(obj);
1388 elm_widget_disabled_set(obj, disabled);
1392 * Get the disable state
1394 * This gets the disable state for the widget.
1396 * @param obj The object
1397 * @return True, if the widget is disabled
1401 elm_object_disabled_get(const Evas_Object *obj)
1403 EINA_SAFETY_ON_NULL_RETURN_VAL(obj, EINA_FALSE);
1404 return elm_widget_disabled_get(obj);
1408 * @defgroup Config Elementary Config
1410 * Elementary configuration is formed by a set options bounded to a
1411 * given @ref Profile profile, like @ref Theme theme, @ref Fingers
1412 * "finger size", etc. These are functions with which one syncronizes
1413 * changes made to those values to the configuration storing files, de
1414 * facto. You most probably don't want to use the functions in this
1415 * group unlees you're writing an elementary configuration manager.
1419 * Save back Elementary's configuration, so that it will persist on
1422 * @return @c EINA_TRUE, when sucessful. @c EINA_FALSE, otherwise.
1425 * This function will take effect -- thus, do I/O -- immediately. Use
1426 * it when you want to apply all configuration changes at once. The
1427 * current configuration set will get saved onto the current profile
1428 * configuration file.
1432 elm_config_save(void)
1434 return _elm_config_save();
1438 * Reload Elementary's configuration, bounded to current selected
1441 * @return @c EINA_TRUE, when sucessful. @c EINA_FALSE, otherwise.
1444 * Useful when you want to force reloading of configuration values for
1445 * a profile. If one removes user custom configuration directories,
1446 * for example, it will force a reload with system values insted.
1450 elm_config_reload(void)
1452 _elm_config_reload();
1456 * @defgroup Profile Elementary Profile
1458 * Profiles are pre-set options that affect the whole look-and-feel of
1459 * Elementary-based applications. There are, for example, profiles
1460 * aimed at desktop computer applications and others aimed at mobile,
1461 * touchscreen-based ones. You most probably don't want to use the
1462 * functions in this group unlees you're writing an elementary
1463 * configuration manager.
1467 * Get Elementary's profile in use.
1469 * This gets the global profile that is applied to all Elementary
1472 * @return The profile's name
1476 elm_profile_current_get(void)
1478 return _elm_config_current_profile_get();
1482 * Get an Elementary's profile directory path in the filesystem. One
1483 * may want to fetch a system profile's dir or an user one (fetched
1486 * @param profile The profile's name
1487 * @param is_user Whether to lookup for an user profile (@c EINA_TRUE)
1488 * or a system one (@c EINA_FALSE)
1489 * @return The profile's directory path.
1492 * @note You must free it with elm_profile_dir_free().
1495 elm_profile_dir_get(const char *profile,
1498 return _elm_config_profile_dir_get(profile, is_user);
1502 * Free an Elementary's profile directory path, as returned by
1503 * elm_profile_dir_get().
1505 * @param p_dir The profile's path
1510 elm_profile_dir_free(const char *p_dir)
1512 free((void *)p_dir);
1516 * Get Elementary's list of available profiles.
1518 * @return The profiles list. List node data are the profile name
1522 * @note One must free this list, after usage, with the function
1523 * elm_profile_list_free().
1526 elm_profile_list_get(void)
1528 return _elm_config_profiles_list();
1532 * Free Elementary's list of available profiles.
1534 * @param The profiles list, as returned by elm_profile_list_get().
1539 elm_profile_list_free(Eina_List *l)
1543 EINA_LIST_FREE(l, dir)
1544 eina_stringshare_del(dir);
1548 * Set Elementary's profile.
1550 * This sets the global profile that is applied to Elementary
1551 * applications. Just the process the call comes from will be
1554 * @param profile The profile's name
1559 elm_profile_set(const char *profile)
1561 EINA_SAFETY_ON_NULL_RETURN(profile);
1562 _elm_config_profile_set(profile);
1566 * Set Elementary's profile.
1568 * This sets the global profile that is applied to all Elementary
1569 * applications. All running Elementary windows will be affected.
1571 * @param profile The profile's name
1576 elm_profile_all_set(const char *profile)
1578 #ifdef HAVE_ELEMENTARY_X
1579 static Ecore_X_Atom atom = 0;
1581 if (!atom) atom = ecore_x_atom_get("ENLIGHTENMENT_PROFILE");
1582 ecore_x_window_prop_string_set(ecore_x_window_root_first_get(),
1588 * @defgroup Engine Elementary Engine
1590 * These are functions setting and querying which rendering engine
1591 * Elementary will use for drawing its windows' pixels.
1595 * Get Elementary's rendering engine in use.
1597 * This gets the global rendering engine that is applied to all
1598 * Elementary applications.
1600 * @return The rendering engine's name
1603 * @note there's no need to free the returned string, here.
1606 elm_engine_current_get(void)
1608 return _elm_config->engine;
1612 * Set Elementary's rendering engine for use.
1614 * This gets sets global rendering engine that is applied to all
1615 * Elementary applications. Note that it will take effect only to
1616 * subsequent Elementary window creations.
1618 * @param The rendering engine's name
1621 * @note there's no need to free the returned string, here.
1624 elm_engine_set(const char *engine)
1626 EINA_SAFETY_ON_NULL_RETURN(engine);
1628 _elm_config_engine_set(engine);
1632 * @defgroup Fonts Elementary Fonts
1634 * These are functions dealing with font rendering, selection and the
1635 * like for Elementary applications. One might fetch which system
1636 * fonts are there to use and set custom fonts for individual classes
1637 * of UI items containing text (text classes).
1641 * Get Elementary's list of supported text classes.
1643 * @return The text classes list, with @c Elm_Text_Class blobs as data.
1646 * Release the list with elm_text_classes_list_free().
1648 EAPI const Eina_List *
1649 elm_text_classes_list_get(void)
1651 return _elm_config_text_classes_get();
1655 * Free Elementary's list of supported text classes.
1659 * @see elm_text_classes_list_get().
1662 elm_text_classes_list_free(const Eina_List *list)
1664 _elm_config_text_classes_free((Eina_List *)list);
1668 * Get Elementary's list of font overlays, set with
1669 * elm_font_overlay_set().
1671 * @return The font overlays list, with @c Elm_Font_Overlay blobs as
1676 * For each text class, one can set a <b>font overlay</b> for it,
1677 * overriding the default font properties for that class coming from
1678 * the theme in use. There is no need to free this list.
1680 * @see elm_font_overlay_set() and elm_font_overlay_unset().
1682 EAPI const Eina_List *
1683 elm_font_overlay_list_get(void)
1685 return _elm_config_font_overlays_list();
1689 * Set a font overlay for a given Elementary text class.
1691 * @param text_class Text class name
1692 * @param font Font name and style string
1693 * @param size Font size
1697 * @p font has to be in the format returned by
1698 * elm_font_fontconfig_name_get(). @see elm_font_overlay_list_get()
1699 * and @elm_font_overlay_unset().
1702 elm_font_overlay_set(const char *text_class,
1704 Evas_Font_Size size)
1706 _elm_config_font_overlay_set(text_class, font, size);
1710 * Unset a font overlay for a given Elementary text class.
1712 * @param text_class Text class name
1716 * This will bring back text elements belonging to text class @p
1717 * text_class back to their default font settings.
1720 elm_font_overlay_unset(const char *text_class)
1722 _elm_config_font_overlay_remove(text_class);
1726 * Apply the changes made with elm_font_overlay_set() and
1727 * elm_font_overlay_unset() on the current Elementary window.
1731 * This applies all font overlays set to all objects in the UI.
1734 elm_font_overlay_apply(void)
1736 _elm_config_font_overlay_apply();
1740 * Apply the changes made with elm_font_overlay_set() and
1741 * elm_font_overlay_unset() on all Elementary application windows.
1745 * This applies all font overlays set to all objects in the UI.
1748 elm_font_overlay_all_apply(void)
1750 #ifdef HAVE_ELEMENTARY_X
1751 static Ecore_X_Atom atom = 0;
1752 unsigned int dummy = (unsigned int)(1 * 1000.0);
1754 if (!atom) atom = ecore_x_atom_get("ENLIGHTENMENT_FONT_OVERLAY");
1755 ecore_x_window_prop_card32_set(ecore_x_window_root_first_get(), atom, &dummy,
1761 * Translate a font (family) name string in fontconfig's font names
1762 * syntax into an @c Elm_Font_Properties struct.
1764 * @param font The font name and styles string
1765 * @return the font properties struct
1769 * @note The reverse translation can be achived with
1770 * elm_font_fontconfig_name_get(), for one style only (single font
1771 * instance, not family).
1773 EAPI Elm_Font_Properties *
1774 elm_font_properties_get(const char *font)
1776 EINA_SAFETY_ON_NULL_RETURN_VAL(font, NULL);
1777 return _elm_font_properties_get(NULL, font);
1781 * Free font properties return by elm_font_properties_get().
1783 * @param efp the font properties struct
1788 elm_font_properties_free(Elm_Font_Properties *efp)
1792 EINA_SAFETY_ON_NULL_RETURN(efp);
1793 EINA_LIST_FREE(efp->styles, str)
1794 if (str) eina_stringshare_del(str);
1795 if (efp->name) eina_stringshare_del(efp->name);
1800 * Translate a font name, bound to a style, into fontconfig's font names
1803 * @param name The font (family) name
1804 * @param style The given style (may be @c NULL)
1806 * @return the font name and style string
1810 * @note The reverse translation can be achived with
1811 * elm_font_properties_get(), for one style only (single font
1812 * instance, not family).
1815 elm_font_fontconfig_name_get(const char *name,
1820 EINA_SAFETY_ON_NULL_RETURN_VAL(name, NULL);
1821 if (!style || style[0] == 0) return eina_stringshare_add(name);
1822 snprintf(buf, 256, "%s" ELM_FONT_TOKEN_STYLE "%s", name, style);
1823 return eina_stringshare_add(buf);
1827 * Free the font string return by elm_font_fontconfig_name_get().
1829 * @param efp the font properties struct
1834 elm_font_fontconfig_name_free(const char *name)
1836 eina_stringshare_del(name);
1840 * Create a font hash table of available system fonts.
1842 * One must call it with @p list being the return value of
1843 * evas_font_available_list(). The hash will be indexed by font
1844 * (family) names, being its values @c Elm_Font_Properties blobs.
1846 * @param list The list of available system fonts, as returned by
1847 * evas_font_available_list().
1848 * @return the font hash.
1852 * @note The user is supposed to get it populated at least with 3
1853 * default font families (Sans, Serif, Monospace), which should be
1854 * present on most systems.
1857 elm_font_available_hash_add(Eina_List *list)
1859 Eina_Hash *font_hash;
1865 /* populate with default font families */
1866 font_hash = _elm_font_available_hash_add(font_hash, "Sans:style=Regular");
1867 font_hash = _elm_font_available_hash_add(font_hash, "Sans:style=Bold");
1868 font_hash = _elm_font_available_hash_add(font_hash, "Sans:style=Oblique");
1869 font_hash = _elm_font_available_hash_add(font_hash,
1870 "Sans:style=Bold Oblique");
1872 font_hash = _elm_font_available_hash_add(font_hash, "Serif:style=Regular");
1873 font_hash = _elm_font_available_hash_add(font_hash, "Serif:style=Bold");
1874 font_hash = _elm_font_available_hash_add(font_hash, "Serif:style=Oblique");
1875 font_hash = _elm_font_available_hash_add(font_hash,
1876 "Serif:style=Bold Oblique");
1878 font_hash = _elm_font_available_hash_add(font_hash,
1879 "Monospace:style=Regular");
1880 font_hash = _elm_font_available_hash_add(font_hash,
1881 "Monospace:style=Bold");
1882 font_hash = _elm_font_available_hash_add(font_hash,
1883 "Monospace:style=Oblique");
1884 font_hash = _elm_font_available_hash_add(font_hash,
1885 "Monospace:style=Bold Oblique");
1887 EINA_LIST_FOREACH(list, l, key)
1888 font_hash = _elm_font_available_hash_add(font_hash, key);
1894 * Free the hash return by elm_font_available_hash_add().
1896 * @param hash the hash to be freed.
1901 elm_font_available_hash_del(Eina_Hash *hash)
1903 _elm_font_available_hash_del(hash);
1907 * @defgroup Fingers Fingers
1909 * Elementary is designed to be finger-friendly for touchscreens, and so in
1910 * addition to scaling for display resolution, it can also scale based on
1911 * finger "resolution" (or size).
1915 * Get the configured finger size
1917 * This gets the globally configured finger size in pixels
1919 * @return The finger size
1923 elm_finger_size_get(void)
1925 return _elm_config->finger_size;
1929 * Set the configured finger size
1931 * This sets the globally configured finger size in pixels
1933 * @param size The finger size
1937 elm_finger_size_set(Evas_Coord size)
1939 if (_elm_config->finger_size == size) return;
1940 _elm_config->finger_size = size;
1945 * Set the configured finger size for all applications on the display
1947 * This sets the globally configured finger size in pixels for all applications
1950 * @param size The finger size
1954 elm_finger_size_all_set(Evas_Coord size)
1956 #ifdef HAVE_ELEMENTARY_X
1957 static Ecore_X_Atom atom = 0;
1958 unsigned int size_i = (unsigned int)size;
1960 if (!atom) atom = ecore_x_atom_get("ENLIGHTENMENT_FINGER_SIZE");
1961 ecore_x_window_prop_card32_set(ecore_x_window_root_first_get(),
1967 * Adjust size of an element for finger usage
1969 * This takes width and height sizes (in pixels) as input and a size multiple
1970 * (which is how many fingers you want to place within the area), and adjusts
1971 * the size tobe large enough to accommodate finger. On return the w and h
1972 * sizes poiner do by these parameters will be modified.
1974 * @param times_w How many fingers should fit horizontally
1975 * @param w Pointer to the width size to adjust
1976 * @param times_h How many fingers should fit vertically
1977 * @param h Pointer to the height size to adjust
1981 elm_coords_finger_size_adjust(int times_w,
1986 if ((w) && (*w < (_elm_config->finger_size * times_w)))
1987 *w = _elm_config->finger_size * times_w;
1988 if ((h) && (*h < (_elm_config->finger_size * times_h)))
1989 *h = _elm_config->finger_size * times_h;
1993 * @defgroup Caches Caches
1995 * These are functions which let one fine-tune some cache values for
1996 * Elementary applications, thus allowing for performance adjustments.
2000 * Flush all caches & dump all data that can be to lean down to use
2011 edje_file_cache_flush();
2012 edje_collection_cache_flush();
2014 EINA_LIST_FOREACH(_elm_win_list, l, obj)
2016 Evas *e = evas_object_evas_get(obj);
2017 evas_image_cache_flush(e);
2018 evas_font_cache_flush(e);
2019 evas_render_dump(e);
2024 * Get the configured cache flush interval time
2026 * This gets the globally configured cache flush interval time, in
2029 * @return The cache flush interval time
2032 * @see elm_all_flush()
2035 elm_cache_flush_interval_get(void)
2037 return _elm_config->cache_flush_poll_interval;
2041 * Set the configured cache flush interval time
2043 * This sets the globally configured cache flush interval time, in ticks
2045 * @param size The cache flush interval time
2048 * @see elm_all_flush()
2051 elm_cache_flush_interval_set(int size)
2053 if (_elm_config->cache_flush_poll_interval == size) return;
2054 _elm_config->cache_flush_poll_interval = size;
2060 * Set the configured cache flush interval time for all applications on the
2063 * This sets the globally configured cache flush interval time -- in ticks
2064 * -- for all applications on the display.
2066 * @param size The cache flush interval time
2070 elm_cache_flush_interval_all_set(int size)
2072 #ifdef HAVE_ELEMENTARY_X
2073 static Ecore_X_Atom atom = 0;
2074 unsigned int size_i = (unsigned int)size;
2076 if (!atom) atom = ecore_x_atom_get("ENLIGHTENMENT_CACHE_FLUSH_INTERVAL");
2077 ecore_x_window_prop_card32_set(ecore_x_window_root_first_get(),
2083 * Get the configured cache flush enabled state
2085 * This gets the globally configured cache flush state - if it is enabled
2086 * or not. When cache flushing is enabled, elementary will regularly
2087 * (see elm_cache_flush_interval_get() ) flush caches and dump data out of
2088 * memory and allow usage to re-seed caches and data in memory where it
2089 * can do so. An idle application will thus minimise its memory usage as
2090 * data will be freed from memory and not be re-loaded as it is idle and
2091 * not rendering or doing anything graphically right now.
2093 * @return The cache flush state
2096 * @see elm_all_flush()
2099 elm_cache_flush_enabled_get(void)
2101 return _elm_config->cache_flush_enable;
2105 * Set the configured cache flush enabled state
2107 * This sets the globally configured cache flush enabled state
2109 * @param size The cache flush enabled state
2112 * @see elm_all_flush()
2115 elm_cache_flush_enabled_set(Eina_Bool enabled)
2117 enabled = !!enabled;
2118 if (_elm_config->cache_flush_enable == enabled) return;
2119 _elm_config->cache_flush_enable = enabled;
2125 * Set the configured cache flush enabled state for all applications on the
2128 * This sets the globally configured cache flush enabled state for all
2129 * applications on the display.
2131 * @param size The cache flush enabled state
2135 elm_cache_flush_enabled_all_set(Eina_Bool enabled)
2137 #ifdef HAVE_ELEMENTARY_X
2138 static Ecore_X_Atom atom = 0;
2139 unsigned int enabled_i = (unsigned int)enabled;
2141 if (!atom) atom = ecore_x_atom_get("ENLIGHTENMENT_CACHE_FLUSH_ENABLE");
2142 ecore_x_window_prop_card32_set(ecore_x_window_root_first_get(),
2143 atom, &enabled_i, 1);
2148 * Get the configured font cache size
2150 * This gets the globally configured font cache size, in bytes
2152 * @return The font cache size
2156 elm_font_cache_get(void)
2158 return _elm_config->font_cache;
2162 * Set the configured font cache size
2164 * This sets the globally configured font cache size, in bytes
2166 * @param size The font cache size
2170 elm_font_cache_set(int size)
2172 if (_elm_config->font_cache == size) return;
2173 _elm_config->font_cache = size;
2179 * Set the configured font cache size for all applications on the
2182 * This sets the globally configured font cache size -- in bytes
2183 * -- for all applications on the display.
2185 * @param size The font cache size
2189 elm_font_cache_all_set(int size)
2191 #ifdef HAVE_ELEMENTARY_X
2192 static Ecore_X_Atom atom = 0;
2193 unsigned int size_i = (unsigned int)size;
2195 if (!atom) atom = ecore_x_atom_get("ENLIGHTENMENT_FONT_CACHE");
2196 ecore_x_window_prop_card32_set(ecore_x_window_root_first_get(),
2202 * Get the configured image cache size
2204 * This gets the globally configured image cache size, in bytes
2206 * @return The image cache size
2210 elm_image_cache_get(void)
2212 return _elm_config->image_cache;
2216 * Set the configured image cache size
2218 * This sets the globally configured image cache size, in bytes
2220 * @param size The image cache size
2224 elm_image_cache_set(int size)
2226 if (_elm_config->image_cache == size) return;
2227 _elm_config->image_cache = size;
2233 * Set the configured image cache size for all applications on the
2236 * This sets the globally configured image cache size -- in bytes
2237 * -- for all applications on the display.
2239 * @param size The image cache size
2243 elm_image_cache_all_set(int size)
2245 #ifdef HAVE_ELEMENTARY_X
2246 static Ecore_X_Atom atom = 0;
2247 unsigned int size_i = (unsigned int)size;
2249 if (!atom) atom = ecore_x_atom_get("ENLIGHTENMENT_IMAGE_CACHE");
2250 ecore_x_window_prop_card32_set(ecore_x_window_root_first_get(),
2256 * Get the configured edje file cache size.
2258 * This gets the globally configured edje file cache size, in number
2261 * @return The edje file cache size
2265 elm_edje_file_cache_get(void)
2267 return _elm_config->edje_cache;
2271 * Set the configured edje file cache size
2273 * This sets the globally configured edje file cache size, in number
2276 * @param size The edje file cache size
2280 elm_edje_file_cache_set(int size)
2282 if (_elm_config->edje_cache == size) return;
2283 _elm_config->edje_cache = size;
2289 * Set the configured edje file cache size for all applications on the
2292 * This sets the globally configured edje file cache size -- in number
2293 * of files -- for all applications on the display.
2295 * @param size The edje file cache size
2299 elm_edje_file_cache_all_set(int size)
2301 #ifdef HAVE_ELEMENTARY_X
2302 static Ecore_X_Atom atom = 0;
2303 unsigned int size_i = (unsigned int)size;
2305 if (!atom) atom = ecore_x_atom_get("ENLIGHTENMENT_EDJE_FILE_CACHE");
2306 ecore_x_window_prop_card32_set(ecore_x_window_root_first_get(),
2312 * Get the configured edje collections (groups) cache size.
2314 * This gets the globally configured edje collections cache size, in
2315 * number of collections.
2317 * @return The edje collections cache size
2321 elm_edje_collection_cache_get(void)
2323 return _elm_config->edje_collection_cache;
2327 * Set the configured edje collections (groups) cache size
2329 * This sets the globally configured edje collections cache size, in
2330 * number of collections.
2332 * @param size The edje collections cache size
2336 elm_edje_collection_cache_set(int size)
2338 if (_elm_config->edje_collection_cache == size) return;
2339 _elm_config->edje_collection_cache = size;
2345 * Set the configured edje collections (groups) cache size for all
2346 * applications on the display
2348 * This sets the globally configured edje collections cache size -- in
2349 * number of collections -- for all applications on the display.
2351 * @param size The edje collections cache size
2355 elm_edje_collection_cache_all_set(int size)
2357 #ifdef HAVE_ELEMENTARY_X
2358 static Ecore_X_Atom atom = 0;
2359 unsigned int size_i = (unsigned int)size;
2361 if (!atom) atom = ecore_x_atom_get("ENLIGHTENMENT_EDJE_COLLECTION_CACHE");
2362 ecore_x_window_prop_card32_set(ecore_x_window_root_first_get(),
2368 * @defgroup Focus Focus
2370 * Objects have focus. This is what determines where the keyboard input goes to
2371 * within the application window.
2375 * Get the focus of the object
2377 * This gets the focused property of the object.
2379 * @param obj The object
2380 * @return 1 if the object is focused, 0 if not.
2384 elm_object_focus_get(const Evas_Object *obj)
2386 EINA_SAFETY_ON_NULL_RETURN_VAL(obj, EINA_FALSE);
2387 return elm_widget_focus_get(obj);
2391 * Set the focus to the object
2393 * This sets the focus target for keyboard input to be the object indicated.
2395 * @param obj The object
2399 elm_object_focus(Evas_Object *obj)
2401 EINA_SAFETY_ON_NULL_RETURN(obj);
2402 if (elm_widget_focus_get(obj))
2405 elm_widget_focus_cycle(obj, ELM_FOCUS_NEXT);
2409 * Remove the focus from the object
2411 * This removes the focus target for keyboard input from be the object
2414 * @param obj The object
2418 elm_object_unfocus(Evas_Object *obj)
2420 EINA_SAFETY_ON_NULL_RETURN(obj);
2421 if (!elm_widget_can_focus_get(obj)) return;
2422 elm_widget_focused_object_clear(obj);
2426 * Set the ability for the object to focus
2428 * This sets the ability for the object to be able to get keyboard focus or
2429 * not. By default all objects are able to be focused.
2431 * @param obj The object
2432 * @param enable 1 if the object can be focused, 0 if not
2436 elm_object_focus_allow_set(Evas_Object *obj,
2439 EINA_SAFETY_ON_NULL_RETURN(obj);
2440 elm_widget_can_focus_set(obj, enable);
2444 * Get the ability for the object to focus
2446 * This gets the ability for the object to be able to get keyboard focus or
2447 * not. By default all objects are able to be focused.
2449 * @param obj The object
2450 * @return 1 if the object is allowed to be focused, 0 if not.
2454 elm_object_focus_allow_get(const Evas_Object *obj)
2456 EINA_SAFETY_ON_NULL_RETURN_VAL(obj, EINA_FALSE);
2457 return (elm_widget_can_focus_get(obj)) || (elm_widget_child_can_focus_get(obj));
2461 * Set custom focus chain.
2463 * This function i set one new and overwrite any previous custom focus chain
2464 * with the list of objects. The previous list will be deleted and this list
2465 * will be managed. After setted, don't modity it.
2467 * @note On focus cycle, only will be evaluated children of this container.
2469 * @param obj The container object
2470 * @param objs Chain of objects to pass focus
2474 elm_object_focus_custom_chain_set(Evas_Object *obj,
2477 EINA_SAFETY_ON_NULL_RETURN(obj);
2478 elm_widget_focus_custom_chain_set(obj, objs);
2482 * Unset custom focus chain
2484 * @param obj The container object
2488 elm_object_focus_custom_chain_unset(Evas_Object *obj)
2490 EINA_SAFETY_ON_NULL_RETURN(obj);
2491 elm_widget_focus_custom_chain_unset(obj);
2495 * Get custom focus chain
2497 * @param obj The container object
2500 EAPI const Eina_List *
2501 elm_object_focus_custom_chain_get(const Evas_Object *obj)
2503 EINA_SAFETY_ON_NULL_RETURN_VAL(obj, NULL);
2504 return elm_widget_focus_custom_chain_get(obj);
2508 * Append object to custom focus chain.
2510 * @note If relative_child equal to NULL or not in custom chain, the object
2511 * will be added in end.
2513 * @note On focus cycle, only will be evaluated children of this container.
2515 * @param obj The container object
2516 * @param child The child to be added in custom chain
2517 * @param relative_child The relative object to position the child
2521 elm_object_focus_custom_chain_append(Evas_Object *obj,
2523 Evas_Object *relative_child)
2525 EINA_SAFETY_ON_NULL_RETURN(obj);
2526 EINA_SAFETY_ON_NULL_RETURN(child);
2527 elm_widget_focus_custom_chain_append(obj, child, relative_child);
2531 * Prepend object to custom focus chain.
2533 * @note If relative_child equal to NULL or not in custom chain, the object
2534 * will be added in begin.
2536 * @note On focus cycle, only will be evaluated children of this container.
2538 * @param obj The container object
2539 * @param child The child to be added in custom chain
2540 * @param relative_child The relative object to position the child
2544 elm_object_focus_custom_chain_prepend(Evas_Object *obj,
2546 Evas_Object *relative_child)
2548 EINA_SAFETY_ON_NULL_RETURN(obj);
2549 EINA_SAFETY_ON_NULL_RETURN(child);
2550 elm_widget_focus_custom_chain_prepend(obj, child, relative_child);
2554 * Give focus to next object in object tree.
2556 * Give focus to next object in focus chain of one object sub-tree.
2557 * If the last object of chain already have focus, the focus will go to the
2558 * first object of chain.
2560 * @param obj The object root of sub-tree
2561 * @param dir Direction to cycle the focus
2566 elm_object_focus_cycle(Evas_Object *obj,
2567 Elm_Focus_Direction dir)
2569 EINA_SAFETY_ON_NULL_RETURN(obj);
2570 elm_widget_focus_cycle(obj, dir);
2574 * Give focus to near object in one direction.
2576 * Give focus to near object in direction of one object.
2577 * If none focusable object in given direction, the focus will not change.
2579 * @param obj The reference object
2580 * @param x Horizontal component of direction to focus
2581 * @param y Vertical component of direction to focus
2586 elm_object_focus_direction_go(Evas_Object *obj,
2590 EINA_SAFETY_ON_NULL_RETURN(obj);
2591 elm_widget_focus_direction_go(obj, x, y);
2595 * Get the enable status of the focus highlight
2597 * This gets whether the highlight on focused objects is enabled or not
2601 elm_focus_highlight_enabled_get(void)
2603 return _elm_config->focus_highlight_enable;
2607 * Set the enable status of the focus highlight
2609 * Set whether to show or not the highlight on focused objects
2610 * @param enable Enable highlight if EINA_TRUE, disable otherwise
2614 elm_focus_highlight_enabled_set(Eina_Bool enable)
2616 _elm_config->focus_highlight_enable = !!enable;
2620 * Get the enable status of the highlight animation
2622 * Get whether the focus highlight, if enabled, will animate its switch from
2623 * one object to the next
2627 elm_focus_highlight_animate_get(void)
2629 return _elm_config->focus_highlight_animate;
2633 * Set the enable status of the highlight animation
2635 * Set whether the focus highlight, if enabled, will animate its switch from
2636 * one object to the next
2637 * @param animate Enable animation if EINA_TRUE, disable otherwise
2641 elm_focus_highlight_animate_set(Eina_Bool animate)
2643 _elm_config->focus_highlight_animate = !!animate;
2647 * @defgroup Scrolling Scrolling
2649 * These are functions setting how scrollable views in Elementary
2650 * widgets should behave on user interaction.
2654 * Get whether scrollers should bounce when they reach their
2655 * viewport's edge during a scroll.
2657 * @return the thumb scroll bouncing state
2659 * This is the default behavior for touch screens, in general.
2660 * @ingroup Scrolling
2663 elm_scroll_bounce_enabled_get(void)
2665 return _elm_config->thumbscroll_bounce_enable;
2669 * Set whether scrollers should bounce when they reach their
2670 * viewport's edge during a scroll.
2672 * @param enabled the thumb scroll bouncing state
2674 * @see elm_thumbscroll_bounce_enabled_get()
2675 * @ingroup Scrolling
2678 elm_scroll_bounce_enabled_set(Eina_Bool enabled)
2680 _elm_config->thumbscroll_bounce_enable = enabled;
2684 * Set whether scrollers should bounce when they reach their
2685 * viewport's edge during a scroll, for all Elementary application
2688 * @param enabled the thumb scroll bouncing state
2690 * @see elm_thumbscroll_bounce_enabled_get()
2691 * @ingroup Scrolling
2694 elm_scroll_bounce_enabled_all_set(Eina_Bool enabled)
2696 #ifdef HAVE_ELEMENTARY_X
2697 static Ecore_X_Atom atom = 0;
2698 unsigned int bounce_enable_i = (unsigned int)enabled;
2701 atom = ecore_x_atom_get("ENLIGHTENMENT_THUMBSCROLL_BOUNCE_ENABLE");
2702 ecore_x_window_prop_card32_set(ecore_x_window_root_first_get(),
2703 atom, &bounce_enable_i, 1);
2708 * Get the amount of inertia a scroller will impose at bounce
2711 * @return the thumb scroll bounce friction
2713 * @ingroup Scrolling
2716 elm_scroll_bounce_friction_get(void)
2718 return _elm_config->thumbscroll_bounce_friction;
2722 * Set the amount of inertia a scroller will impose at bounce
2725 * @param friction the thumb scroll bounce friction
2727 * @see elm_thumbscroll_bounce_friction_get()
2728 * @ingroup Scrolling
2731 elm_scroll_bounce_friction_set(double friction)
2733 _elm_config->thumbscroll_bounce_friction = friction;
2737 * Set the amount of inertia a scroller will impose at bounce
2738 * animations, for all Elementary application windows.
2740 * @param friction the thumb scroll bounce friction
2742 * @see elm_thumbscroll_bounce_friction_get()
2743 * @ingroup Scrolling
2746 elm_scroll_bounce_friction_all_set(double friction)
2748 #ifdef HAVE_ELEMENTARY_X
2749 static Ecore_X_Atom atom = 0;
2750 unsigned int bounce_friction_i = (unsigned int)(friction * 1000.0);
2753 atom = ecore_x_atom_get("ENLIGHTENMENT_THUMBSCROLL_BOUNCE_FRICTION");
2754 ecore_x_window_prop_card32_set(ecore_x_window_root_first_get(),
2755 atom, &bounce_friction_i, 1);
2760 * Get the amount of inertia a <b>paged</b> scroller will impose at
2761 * page fitting animations.
2763 * @return the page scroll friction
2765 * @ingroup Scrolling
2768 elm_scroll_page_scroll_friction_get(void)
2770 return _elm_config->page_scroll_friction;
2774 * Set the amount of inertia a <b>paged</b> scroller will impose at
2775 * page fitting animations.
2777 * @param friction the page scroll friction
2779 * @see elm_thumbscroll_page_scroll_friction_get()
2780 * @ingroup Scrolling
2783 elm_scroll_page_scroll_friction_set(double friction)
2785 _elm_config->page_scroll_friction = friction;
2789 * Set the amount of inertia a <b>paged</b> scroller will impose at
2790 * page fitting animations, for all Elementary application windows.
2792 * @param friction the page scroll friction
2794 * @see elm_thumbscroll_page_scroll_friction_get()
2795 * @ingroup Scrolling
2798 elm_scroll_page_scroll_friction_all_set(double friction)
2800 #ifdef HAVE_ELEMENTARY_X
2801 static Ecore_X_Atom atom = 0;
2802 unsigned int page_scroll_friction_i = (unsigned int)(friction * 1000.0);
2805 atom = ecore_x_atom_get("ENLIGHTENMENT_THUMBSCROLL_PAGE_SCROLL_FRICTION");
2806 ecore_x_window_prop_card32_set(ecore_x_window_root_first_get(),
2807 atom, &page_scroll_friction_i, 1);
2812 * Get the amount of inertia a scroller will impose at region bring
2815 * @return the bring in scroll friction
2817 * @ingroup Scrolling
2820 elm_scroll_bring_in_scroll_friction_get(void)
2822 return _elm_config->bring_in_scroll_friction;
2826 * Set the amount of inertia a scroller will impose at region bring
2829 * @param friction the bring in scroll friction
2831 * @see elm_thumbscroll_bring_in_scroll_friction_get()
2832 * @ingroup Scrolling
2835 elm_scroll_bring_in_scroll_friction_set(double friction)
2837 _elm_config->bring_in_scroll_friction = friction;
2841 * Set the amount of inertia a scroller will impose at region bring
2842 * animations, for all Elementary application windows.
2844 * @param friction the bring in scroll friction
2846 * @see elm_thumbscroll_bring_in_scroll_friction_get()
2847 * @ingroup Scrolling
2850 elm_scroll_bring_in_scroll_friction_all_set(double friction)
2852 #ifdef HAVE_ELEMENTARY_X
2853 static Ecore_X_Atom atom = 0;
2854 unsigned int bring_in_scroll_friction_i = (unsigned int)(friction * 1000.0);
2858 ecore_x_atom_get("ENLIGHTENMENT_THUMBSCROLL_BRING_IN_SCROLL_FRICTION");
2859 ecore_x_window_prop_card32_set(ecore_x_window_root_first_get(),
2860 atom, &bring_in_scroll_friction_i, 1);
2865 * Get the amount of inertia scrollers will impose at animations
2866 * triggered by Elementary widgets' zooming API.
2868 * @return the zoom friction
2870 * @ingroup Scrolling
2873 elm_scroll_zoom_friction_get(void)
2875 return _elm_config->zoom_friction;
2879 * Set the amount of inertia scrollers will impose at animations
2880 * triggered by Elementary widgets' zooming API.
2882 * @param friction the zoom friction
2884 * @see elm_thumbscroll_zoom_friction_get()
2885 * @ingroup Scrolling
2888 elm_scroll_zoom_friction_set(double friction)
2890 _elm_config->zoom_friction = friction;
2894 * Set the amount of inertia scrollers will impose at animations
2895 * triggered by Elementary widgets' zooming API, for all Elementary
2896 * application windows.
2898 * @param friction the zoom friction
2900 * @see elm_thumbscroll_zoom_friction_get()
2901 * @ingroup Scrolling
2904 elm_scroll_zoom_friction_all_set(double friction)
2906 #ifdef HAVE_ELEMENTARY_X
2907 static Ecore_X_Atom atom = 0;
2908 unsigned int zoom_friction_i = (unsigned int)(friction * 1000.0);
2911 atom = ecore_x_atom_get("ENLIGHTENMENT_THUMBSCROLL_ZOOM_FRICTION");
2912 ecore_x_window_prop_card32_set(ecore_x_window_root_first_get(),
2913 atom, &zoom_friction_i, 1);
2918 * Get whether scrollers should be draggable from any point in their
2921 * @return the thumb scroll state
2923 * @note This is the default behavior for touch screens, in general.
2924 * @note All other functions namespaced with "thumbscroll" will only
2925 * have effect if this mode is enabled.
2927 * @ingroup Scrolling
2930 elm_scroll_thumbscroll_enabled_get(void)
2932 return _elm_config->thumbscroll_enable;
2936 * Set whether scrollers should be draggable from any point in their
2939 * @param enabled the thumb scroll state
2941 * @see elm_thumbscroll_enabled_get()
2942 * @ingroup Scrolling
2945 elm_scroll_thumbscroll_enabled_set(Eina_Bool enabled)
2947 _elm_config->thumbscroll_enable = enabled;
2951 * Set whether scrollers should be draggable from any point in their
2952 * views, for all Elementary application windows.
2954 * @param enabled the thumb scroll state
2956 * @see elm_thumbscroll_enabled_get()
2957 * @ingroup Scrolling
2960 elm_scroll_thumbscroll_enabled_all_set(Eina_Bool enabled)
2962 #ifdef HAVE_ELEMENTARY_X
2963 static Ecore_X_Atom atom = 0;
2964 unsigned int ts_enable_i = (unsigned int)enabled;
2966 if (!atom) atom = ecore_x_atom_get("ENLIGHTENMENT_THUMBSCROLL_ENABLE");
2967 ecore_x_window_prop_card32_set(ecore_x_window_root_first_get(),
2968 atom, &ts_enable_i, 1);
2973 * Get the number of pixels one should travel while dragging a
2974 * scroller's view to actually trigger scrolling.
2976 * @return the thumb scroll threshould
2978 * One would use higher values for touch screens, in general, because
2979 * of their inherent imprecision.
2980 * @ingroup Scrolling
2983 elm_scroll_thumbscroll_threshold_get(void)
2985 return _elm_config->thumbscroll_threshold;
2989 * Set the number of pixels one should travel while dragging a
2990 * scroller's view to actually trigger scrolling.
2992 * @param threshold the thumb scroll threshould
2994 * @see elm_thumbscroll_threshould_get()
2995 * @ingroup Scrolling
2998 elm_scroll_thumbscroll_threshold_set(unsigned int threshold)
3000 _elm_config->thumbscroll_threshold = threshold;
3004 * Set the number of pixels one should travel while dragging a
3005 * scroller's view to actually trigger scrolling, for all Elementary
3006 * application windows.
3008 * @param threshold the thumb scroll threshould
3010 * @see elm_thumbscroll_threshould_get()
3011 * @ingroup Scrolling
3014 elm_scroll_thumbscroll_threshold_all_set(unsigned int threshold)
3016 #ifdef HAVE_ELEMENTARY_X
3017 static Ecore_X_Atom atom = 0;
3018 unsigned int ts_threshold_i = (unsigned int)threshold;
3020 if (!atom) atom = ecore_x_atom_get("ENLIGHTENMENT_THUMBSCROLL_THRESHOLD");
3021 ecore_x_window_prop_card32_set(ecore_x_window_root_first_get(),
3022 atom, &ts_threshold_i, 1);
3027 * Get the minimum speed of mouse cursor movement which will trigger
3028 * list self scrolling animation after a mouse up event
3031 * @return the thumb scroll momentum threshould
3033 * @ingroup Scrolling
3036 elm_scroll_thumbscroll_momentum_threshold_get(void)
3038 return _elm_config->thumbscroll_momentum_threshold;
3042 * Set the minimum speed of mouse cursor movement which will trigger
3043 * list self scrolling animation after a mouse up event
3046 * @param threshold the thumb scroll momentum threshould
3048 * @see elm_thumbscroll_momentum_threshould_get()
3049 * @ingroup Scrolling
3052 elm_scroll_thumbscroll_momentum_threshold_set(double threshold)
3054 _elm_config->thumbscroll_momentum_threshold = threshold;
3058 * Set the minimum speed of mouse cursor movement which will trigger
3059 * list self scrolling animation after a mouse up event
3060 * (pixels/second), for all Elementary application windows.
3062 * @param threshold the thumb scroll momentum threshould
3064 * @see elm_thumbscroll_momentum_threshould_get()
3065 * @ingroup Scrolling
3068 elm_scroll_thumbscroll_momentum_threshold_all_set(double threshold)
3070 #ifdef HAVE_ELEMENTARY_X
3071 static Ecore_X_Atom atom = 0;
3072 unsigned int ts_momentum_threshold_i = (unsigned int)(threshold * 1000.0);
3075 atom = ecore_x_atom_get("ENLIGHTENMENT_THUMBSCROLL_MOMENTUM_THRESHOLD");
3076 ecore_x_window_prop_card32_set(ecore_x_window_root_first_get(),
3077 atom, &ts_momentum_threshold_i, 1);
3082 * Get the amount of inertia a scroller will impose at self scrolling
3085 * @return the thumb scroll friction
3087 * @ingroup Scrolling
3090 elm_scroll_thumbscroll_friction_get(void)
3092 return _elm_config->thumbscroll_friction;
3096 * Set the amount of inertia a scroller will impose at self scrolling
3099 * @param friction the thumb scroll friction
3101 * @see elm_thumbscroll_friction_get()
3102 * @ingroup Scrolling
3105 elm_scroll_thumbscroll_friction_set(double friction)
3107 _elm_config->thumbscroll_friction = friction;
3111 * Set the amount of inertia a scroller will impose at self scrolling
3112 * animations, for all Elementary application windows.
3114 * @param friction the thumb scroll friction
3116 * @see elm_thumbscroll_friction_get()
3117 * @ingroup Scrolling
3120 elm_scroll_thumbscroll_friction_all_set(double friction)
3122 #ifdef HAVE_ELEMENTARY_X
3123 static Ecore_X_Atom atom = 0;
3124 unsigned int ts_friction_i = (unsigned int)(friction * 1000.0);
3126 if (!atom) atom = ecore_x_atom_get("ENLIGHTENMENT_THUMBSCROLL_FRICTION");
3127 ecore_x_window_prop_card32_set(ecore_x_window_root_first_get(),
3128 atom, &ts_friction_i, 1);
3133 * Get the amount of lag between your actual mouse cursor dragging
3134 * movement and a scroller's view movement itself, while pushing it
3135 * into bounce state manually.
3137 * @return the thumb scroll border friction
3139 * @ingroup Scrolling
3142 elm_scroll_thumbscroll_border_friction_get(void)
3144 return _elm_config->thumbscroll_border_friction;
3148 * Set the amount of lag between your actual mouse cursor dragging
3149 * movement and a scroller's view movement itself, while pushing it
3150 * into bounce state manually.
3152 * @param friction the thumb scroll border friction. @c 0.0 for
3153 * perfect synchrony between two movements, @c 1.0 for maximum
3156 * @see elm_thumbscroll_border_friction_get()
3157 * @note parameter value will get bound to 0.0 - 1.0 interval, always
3159 * @ingroup Scrolling
3162 elm_scroll_thumbscroll_border_friction_set(double friction)
3170 _elm_config->thumbscroll_friction = friction;
3174 * Set the amount of lag between your actual mouse cursor dragging
3175 * movement and a scroller's view movement itself, while pushing it
3176 * into bounce state manually, for all Elementary application windows.
3178 * @param friction the thumb scroll border friction. @c 0.0 for
3179 * perfect synchrony between two movements, @c 1.0 for maximum
3182 * @see elm_thumbscroll_border_friction_get()
3183 * @note parameter value will get bound to 0.0 - 1.0 interval, always
3185 * @ingroup Scrolling
3188 elm_scroll_thumbscroll_border_friction_all_set(double friction)
3196 #ifdef HAVE_ELEMENTARY_X
3197 static Ecore_X_Atom atom = 0;
3198 unsigned int border_friction_i = (unsigned int)(friction * 1000.0);
3201 atom = ecore_x_atom_get("ENLIGHTENMENT_THUMBSCROLL_BORDER_FRICTION");
3202 ecore_x_window_prop_card32_set(ecore_x_window_root_first_get(),
3203 atom, &border_friction_i, 1);
3208 * @defgroup Scrollhints Scrollhints
3210 * Objects when inside a scroller can scroll, but this may not always be
3211 * desirable in certain situations. This allows an object to hint to itself
3212 * and parents to "not scroll" in one of 2 ways.
3214 * 1. To hold on scrolling. This means just flicking and dragging may no
3215 * longer scroll, but pressing/dragging near an edge of the scroller will
3216 * still scroll. This is automastically used by the entry object when
3218 * 2. To totally freeze scrolling. This means it stops. until popped/released.
3222 * Push the scroll hold by 1
3224 * This increments the scroll hold count by one. If it is more than 0 it will
3225 * take effect on the parents of the indicated object.
3227 * @param obj The object
3228 * @ingroup Scrollhints
3231 elm_object_scroll_hold_push(Evas_Object *obj)
3233 EINA_SAFETY_ON_NULL_RETURN(obj);
3234 elm_widget_scroll_hold_push(obj);
3238 * Pop the scroll hold by 1
3240 * This decrements the scroll hold count by one. If it is more than 0 it will
3241 * take effect on the parents of the indicated object.
3243 * @param obj The object
3244 * @ingroup Scrollhints
3247 elm_object_scroll_hold_pop(Evas_Object *obj)
3249 EINA_SAFETY_ON_NULL_RETURN(obj);
3250 elm_widget_scroll_hold_pop(obj);
3254 * Push the scroll freeze by 1
3256 * This increments the scroll freeze count by one. If it is more than 0 it will
3257 * take effect on the parents of the indicated object.
3259 * @param obj The object
3260 * @ingroup Scrollhints
3263 elm_object_scroll_freeze_push(Evas_Object *obj)
3265 EINA_SAFETY_ON_NULL_RETURN(obj);
3266 elm_widget_scroll_freeze_push(obj);
3270 * Lock the scrolling of the given widget (and thus all parents)
3272 * This locks the given object from scrolling in the X axis (and implicitly
3273 * also locks all parent scrollers too from doing the same).
3275 * @param obj The object
3276 * @param lock The lock state (1 == locked, 0 == unlocked)
3277 * @ingroup Scrollhints
3280 elm_object_scroll_lock_x_set(Evas_Object *obj,
3283 EINA_SAFETY_ON_NULL_RETURN(obj);
3284 elm_widget_drag_lock_x_set(obj, lock);
3288 * Lock the scrolling of the given widget (and thus all parents)
3290 * This locks the given object from scrolling in the Y axis (and implicitly
3291 * also locks all parent scrollers too from doing the same).
3293 * @param obj The object
3294 * @param lock The lock state (1 == locked, 0 == unlocked)
3295 * @ingroup Scrollhints
3298 elm_object_scroll_lock_y_set(Evas_Object *obj,
3301 EINA_SAFETY_ON_NULL_RETURN(obj);
3302 elm_widget_drag_lock_y_set(obj, lock);
3306 * Get the scrolling lock of the given widget
3308 * This gets the lock for X axis scrolling.
3310 * @param obj The object
3311 * @ingroup Scrollhints
3314 elm_object_scroll_lock_x_get(const Evas_Object *obj)
3316 EINA_SAFETY_ON_NULL_RETURN_VAL(obj, EINA_FALSE);
3317 return elm_widget_drag_lock_x_get(obj);
3321 * Get the scrolling lock of the given widget
3323 * This gets the lock for X axis scrolling.
3325 * @param obj The object
3326 * @ingroup Scrollhints
3329 elm_object_scroll_lock_y_get(const Evas_Object *obj)
3331 EINA_SAFETY_ON_NULL_RETURN_VAL(obj, EINA_FALSE);
3332 return elm_widget_drag_lock_y_get(obj);
3336 * Pop the scroll freeze by 1
3338 * This decrements the scroll freeze count by one. If it is more than 0 it will
3339 * take effect on the parents of the indicated object.
3341 * @param obj The object
3342 * @ingroup Scrollhints
3345 elm_object_scroll_freeze_pop(Evas_Object *obj)
3347 EINA_SAFETY_ON_NULL_RETURN(obj);
3348 elm_widget_scroll_freeze_pop(obj);
3352 * @defgroup WidgetNavigation Widget Tree Navigation.
3354 * How to check if an Evas Object is an Elementary widget? How to get
3355 * the first elementary widget that is parent of the given object?
3356 * These are all covered in widget tree navigation.
3360 * Check if the given Evas Object is an Elementary widget.
3362 * @param obj the object to query.
3363 * @return @c EINA_TRUE if it is an elementary widget variant,
3364 * @c EINA_FALSE otherwise
3365 * @ingroup WidgetNavigation
3368 elm_object_widget_check(const Evas_Object *obj)
3370 EINA_SAFETY_ON_NULL_RETURN_VAL(obj, EINA_FALSE);
3371 return elm_widget_is(obj);
3375 * Get the first parent of the given object that is an Elementary widget.
3377 * @param obj the object to query.
3378 * @return the parent object that is an Elementary widget, or @c NULL
3379 * if no parent is, or no parents at all.
3380 * @ingroup WidgetNavigation
3383 elm_object_parent_widget_get(const Evas_Object *obj)
3385 EINA_SAFETY_ON_NULL_RETURN_VAL(obj, NULL);
3386 return elm_widget_parent_widget_get(obj);
3390 * Get the top level parent of an Elementary widget.
3392 * @param obj The object to query.
3393 * @return The top level Elementary widget, or @c NULL if parent cannot be
3395 * @ingroup WidgetNavigation
3398 elm_object_top_widget_get(const Evas_Object *obj)
3400 EINA_SAFETY_ON_NULL_RETURN_VAL(obj, NULL);
3401 return elm_widget_top_get(obj);
3405 * Get the string that represents this Elementary widget.
3407 * @note Elementary is weird and exposes itself as a single
3408 * Evas_Object_Smart_Class of type "elm_widget", so
3409 * evas_object_type_get() always return that, making debug and
3410 * language bindings hard. This function tries to mitigate this
3411 * problem, but the solution is to change Elementary to use
3412 * proper inheritance.
3414 * @param obj the object to query.
3415 * @return Elementary widget name, or @c NULL if not a valid widget.
3416 * @ingroup WidgetNavigation
3419 elm_object_widget_type_get(const Evas_Object *obj)
3421 EINA_SAFETY_ON_NULL_RETURN_VAL(obj, NULL);
3422 return elm_widget_type_get(obj);
3426 * Send a signal to the widget edje object.
3428 * This function sends a signal to the edje object of the obj. An edje program
3429 * can respond to a signal by specifying matching 'signal' and
3432 * @param obj The object
3433 * @param emission The signal's name.
3434 * @param source The signal's source.
3438 elm_object_signal_emit(Evas_Object *obj,
3439 const char *emission,
3442 EINA_SAFETY_ON_NULL_RETURN(obj);
3443 elm_widget_signal_emit(obj, emission, source);
3447 * Add a callback for a signal emitted by widget edje object.
3449 * This function connects a callback function to a signal emitted by the
3450 * edje object of the obj.
3451 * Globs can occur in either the emission or source name.
3453 * @param obj The object
3454 * @param emission The signal's name.
3455 * @param source The signal's source.
3456 * @param func The callback function to be executed when the signal is
3458 * @param data A pointer to data to pass in to the callback function.
3462 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)
3464 EINA_SAFETY_ON_NULL_RETURN(obj);
3465 EINA_SAFETY_ON_NULL_RETURN(func);
3466 elm_widget_signal_callback_add(obj, emission, source, func, data);
3470 * Remove a signal-triggered callback from an widget edje object.
3472 * This function removes a callback, previoulsy attached to a signal emitted
3473 * by the edje object of the obj.
3474 * The parameters emission, source and func must match exactly those passed to
3475 * a previous call to elm_object_signal_callback_add(). The data pointer that
3476 * was passed to this call will be returned.
3478 * @param obj The object
3479 * @param emission The signal's name.
3480 * @param source The signal's source.
3481 * @param func The callback function to be executed when the signal is
3483 * @return The data pointer
3487 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))
3489 EINA_SAFETY_ON_NULL_RETURN_VAL(obj, NULL);
3490 EINA_SAFETY_ON_NULL_RETURN_VAL(func, NULL);
3491 return elm_widget_signal_callback_del(obj, emission, source, func);
3495 * Add a callback for a event emitted by widget or their children.
3497 * This function connects a callback function to any key_down key_up event
3498 * emitted by the @p obj or their children.
3499 * This only will be called if no other callback has consumed the event.
3500 * If you want consume the event, and no other get it, func should return
3501 * EINA_TRUE and put EVAS_EVENT_FLAG_ON_HOLD in event_flags.
3503 * @warning Accept duplicated callback addition.
3505 * @param obj The object
3506 * @param func The callback function to be executed when the event is
3508 * @param data Data to pass in to the callback function.
3512 elm_object_event_callback_add(Evas_Object *obj, Elm_Event_Cb func, const void *data)
3514 EINA_SAFETY_ON_NULL_RETURN(obj);
3515 EINA_SAFETY_ON_NULL_RETURN(func);
3516 elm_widget_event_callback_add(obj, func, data);
3520 * Remove a event callback from an widget.
3522 * This function removes a callback, previoulsy attached to event emission
3524 * The parameters func and data must match exactly those passed to
3525 * a previous call to elm_object_event_callback_add(). The data pointer that
3526 * was passed to this call will be returned.
3528 * @param obj The object
3529 * @param func The callback function to be executed when the event is
3531 * @param data Data to pass in to the callback function.
3532 * @return The data pointer
3536 elm_object_event_callback_del(Evas_Object *obj, Elm_Event_Cb func, const void *data)
3538 EINA_SAFETY_ON_NULL_RETURN_VAL(obj, NULL);
3539 EINA_SAFETY_ON_NULL_RETURN_VAL(func, NULL);
3540 return elm_widget_event_callback_del(obj, func, data);
3545 * @defgroup Debug Debug
3549 * Print Tree object hierarchy in stdout
3551 * @param obj The root object
3555 elm_object_tree_dump(const Evas_Object *top)
3558 elm_widget_tree_dump(top);
3566 * Print Elm Objects tree hierarchy in file as dot(graphviz) syntax.
3568 * @param obj The root object
3569 * @param file The path of output file
3573 elm_object_tree_dot_dump(const Evas_Object *top,
3577 FILE *f = fopen(file, "w");
3578 elm_widget_tree_dot_dump(top, f);
3588 * Set the duration for occuring long press event.
3590 * @param lonpress_timeout Timeout for long press event
3591 * @ingroup Longpress
3594 elm_longpress_timeout_set(double longpress_timeout)
3596 _elm_config->longpress_timeout = longpress_timeout;
3600 * Get the duration for occuring long press event.
3602 * @return Timeout for long press event
3603 * @ingroup Longpress
3606 elm_longpress_timeout_get(void)
3608 return _elm_config->longpress_timeout;