2 # include "elementary_config.h"
9 #include <dlfcn.h> /* dlopen,dlclose,etc */
11 #ifdef HAVE_CRT_EXTERNS_H
12 # include <crt_externs.h>
19 #include <Elementary.h>
22 static Elm_Version _version = { VMAJ, VMIN, VMIC, VREV };
23 EAPI Elm_Version *elm_version = &_version;
26 _elm_dangerous_call_check(const char *call)
31 snprintf(buf, sizeof(buf), "%i.%i.%i.%i", VMAJ, VMIN, VMIC, VREV);
32 eval = getenv("ELM_NO_FINGER_WAGGLING");
33 if ((eval) && (!strcmp(eval, buf)))
35 printf("ELEMENTARY FINGER WAGGLE!!!!!!!!!!\n"
38 "PLEASE see the API documentation for this function. This call\n"
39 "should almost never be used. Only in very special cases.\n"
41 "To remove this warning please set the environment variable:\n"
42 " ELM_NO_FINGER_WAGGLING\n"
43 "To the value of the Elementary version + revision number. e.g.:\n"
52 * @defgroup Start Getting Started
54 * To write an Elementary app, you can get started with the following:
57 * #include <Elementary.h>
58 * #ifndef ELM_LIB_QUICKLAUNCH
60 * elm_main(int argc, char **argv)
62 * // create window(s) here and do any application init
63 * elm_run(); // run main loop
64 * elm_shutdown(); // after mainloop finishes running, shutdown
65 * return 0; // exit 0 for exit code
71 * To take full advantage of the quicklaunch architecture for launching
72 * processes as quickly as possible (saving time at startup time like
73 * connecting to X11, loading and linking shared libraries) you may want to
74 * use the following configure.in/configure.ac and Makefile.am and autogen.sh
75 * script to generate your files. It is assumed your application uses the
76 * main.c file for its code.
78 * configure.in/configure.ac:
81 AC_INIT(myapp, 0.0.0, myname@mydomain.com)
83 AC_CONFIG_SRCDIR(configure.in)
85 AM_INIT_AUTOMAKE(1.6 dist-bzip2)
86 AM_CONFIG_HEADER(config.h)
96 define([AC_LIBTOOL_LANG_CXX_CONFIG], [:])dnl
97 define([AC_LIBTOOL_LANG_F77_CONFIG], [:])dnl
100 PKG_CHECK_MODULES([ELEMENTARY], elementary)
108 AUTOMAKE_OPTIONS = 1.4 foreign
109 MAINTAINERCLEANFILES = Makefile.in
111 INCLUDES = -I$(top_srcdir) @ELEMENTARY_CFLAGS@
114 myapp_LTLIBRARIES = myapp.la
118 myapp_la_SOURCES = main.c
119 myapp_la_LIBADD = @ELEMENTARY_LIBS@
121 myapp_la_LDFLAGS = -module -avoid-version -no-undefined
123 myapp_SOURCES = main.c
124 myapp_LDADD = @ELEMENTARY_LIBS@
125 myapp_CFLAGS = -DELM_LIB_QUICKLAUNCH=1
132 rm -rf autom4te.cache
133 rm -f aclocal.m4 ltmain.sh
138 echo "Running aclocal..." ; aclocal $ACLOCAL_FLAGS -I m4 || exit 1
139 echo "Running autoheader..." ; autoheader || exit 1
140 echo "Running autoconf..." ; autoconf || exit 1
141 echo "Running libtoolize..." ; (libtoolize --copy --automake || glibtoolize --automake) || exit 1
142 echo "Running automake..." ; automake --add-missing --copy --gnu || exit 1
144 if [ -z "$NOCONFIGURE" ]; then
149 * To gnerate all the things needed to bootstrap just run:
155 * This will generate Makefile.in's, the confgure script and everything else.
156 * After this it works like all normal autotools projects:
163 * Note sudo was assumed to get root permissions, as this would install in
164 * /usr/local which is system-owned. Ue any way you like to gain root, or
165 * specify a different prefix with configure:
168 ./confiugre --prefix=$HOME/mysoftware
171 * Also remember that autotools buys you some useful commands like:
176 * This uninstalls the software after it was installed with "make install".
177 * It is very useful to clear up what you built if you wish to clean the
184 * This firstly checks if your build tree is "clean" and ready for
185 * distribution. It also builds a tarball (myapp-0.0.0.tar.gz) that is
186 * ready to upload and distribute to the world, that contains the generated
187 * Makefile.in's and configure script. The users do not need to run
188 * autogen.sh - just configure and on. They don't need autotools installed.
189 * This tarball also builds cleanly, has all the sources it needs to build
190 * included (that is sources for your application, not libraries it depends
191 * on like Elementary). It builds cleanly in a buildroot and does not
192 * contain any files that are temporarily generated like binaries and other
193 * build-gnerated files, so the tarball is clean, and no need to worry
194 * about cleaning up your tree before packaging.
200 * This cleans up all build files (binaries, objects etc.) from the tree.
206 * This cleans out all files from the build and from configure's output too.
209 make maintainer-clean
212 * This deletes all the files autogen.sh will produce so the tree is clean
213 * to be put into a revision-control system (like CVS, SVN or GIT for example).
215 * The above will build a library - libmyapp.so and install in the target
216 * library directory (default is /usr/local/lib). You will also get a
217 * myapp.a and myapp.la - these are useless and can be deleted. Libtool likes
218 * to generate these all the time. You will also get a binary in the target
219 * binary directory (default is /usr/local/bin). This is a "debug binary".
220 * This will run and dlopen() the myapp.so and then jump to it's elm_main
221 * function. This allows for easy debugging with GDB and Valgrind. When you
222 * are ready to go to production do the following:
224 * 1. delete the myapp binary. i.e. rm /usr/local/bin/myapp
226 * 2. symlink the myapp binary to elementary_run (supplied by elementary).
227 * i.e. ln -s elmentary_run /usr/local/bin/myapp
229 * 3. run elementary_quicklaunch as part of your graphical login session and
232 * This will man elementary_quicklaunch does pre-initialization before the
233 * application needs to be run, saving the effort at the time the application
234 * is needed, thus speeding up the time it takes to appear.
236 * If you don't want to use the quicklaunch infrastructure (which is
237 * optional), you can execute the old fashioned way by just running the
238 * myapp binary loader than will load the myapp.so for you, or you can
239 * remove the split-file binary and put it into one binary as things always
240 * have been with the following configure.in/configure.ac and Makfile.am
243 * configure.in/configure.ac:
246 AC_INIT(myapp, 0.0.0, myname@mydomain.com)
248 AC_CONFIG_SRCDIR(configure.in)
250 AM_INIT_AUTOMAKE(1.6 dist-bzip2)
251 AM_CONFIG_HEADER(config.h)
260 PKG_CHECK_MODULES([ELEMENTARY], elementary)
268 AUTOMAKE_OPTIONS = 1.4 foreign
269 MAINTAINERCLEANFILES = Makefile.in
271 INCLUDES = -I$(top_srcdir) @ELEMENTARY_CFLAGS@
275 myapp_SOURCES = main.c
276 myapp_LDADD = @ELEMENTARY_LIBS@
280 * Notice that they are the same as before, just with libtool and library
281 * building sections removed. Both ways work for building elementary
282 * applications. It is up to you to decide what is best for you. If you just
283 * follow the template above, you can do it both ways and can decide at build
284 * time. The more advanced of you may suggest making it a configure option.
285 * That is perfectly valid, but has been left out here for simplicity, as our
286 * aim to have an Elementary (and EFL) tutorial, not an autoconf & automake
291 static Eina_Bool _elm_signal_exit(void *data, int ev_type, void *ev);
293 char *_elm_appname = NULL;
294 const char *_elm_data_dir = NULL;
295 const char *_elm_lib_dir = NULL;
296 int _elm_log_dom = -1;
298 EAPI int ELM_EVENT_POLICY_CHANGED = 0;
300 static int _elm_init_count = 0;
301 static int _elm_policies[ELM_POLICY_LAST];
302 static Ecore_Event_Handler *_elm_exit_handler = NULL;
305 _elm_signal_exit(void *data __UNUSED__, int ev_type __UNUSED__, void *ev __UNUSED__)
308 return ECORE_CALLBACK_PASS_ON;
314 edje_scale_set(_elm_config->scale);
318 static Eina_List *widtypes = NULL;
321 _elm_widtype_register(const char **ptr)
323 widtypes = eina_list_append(widtypes, (void *)ptr);
327 _elm_widtype_clear(void)
331 EINA_LIST_FREE(widtypes, ptr)
333 eina_stringshare_del(*ptr);
339 * @defgroup General General
343 * Inititalise Elementary
345 * This call is exported only for use by the ELM_MAIN() macro. There is no
346 * need to use this if you use this macro (which is highly advisable).
350 elm_init(int argc, char **argv)
353 if (_elm_init_count != 1) return;
354 elm_quicklaunch_init(argc, argv);
355 elm_quicklaunch_sub_init(argc, argv);
359 * Shut down Elementary
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;
372 elm_quicklaunch_sub_shutdown();
373 elm_quicklaunch_shutdown();
377 static Eina_Bool _elm_need_e_dbus = EINA_FALSE;
380 elm_need_e_dbus(void)
383 if (_elm_need_e_dbus) return;
384 _elm_need_e_dbus = 1;
391 _elm_unneed_e_dbus(void)
394 if (_elm_need_e_dbus)
396 _elm_need_e_dbus = 0;
404 static Eina_Bool _elm_need_efreet = EINA_FALSE;
407 elm_need_efreet(void)
410 if (_elm_need_efreet) return;
411 _elm_need_efreet = 1;
419 list = efreet_icon_extra_list_get();
422 e_user_dir_concat_static(buf, "icons");
423 *list = eina_list_prepend(*list, (void *)eina_stringshare_add(buf));
424 e_prefix_data_concat_static(buf, "data/icons");
425 *list = eina_list_prepend(*list, (void *)eina_stringshare_add(buf));
433 _elm_unneed_efreet(void)
436 if (_elm_need_efreet)
438 _elm_need_efreet = 0;
439 efreet_trash_shutdown();
440 efreet_mime_shutdown();
447 elm_quicklaunch_init(int argc, char **argv)
449 char buf[PATH_MAX], *s;
452 _elm_log_dom = eina_log_domain_register("elementary", EINA_COLOR_LIGHTBLUE);
455 EINA_LOG_ERR("could not register elementary log domain.");
456 _elm_log_dom = EINA_LOG_DOMAIN_GLOBAL;
461 ecore_app_args_set(argc, (const char **)argv);
463 memset(_elm_policies, 0, sizeof(_elm_policies));
464 if (ELM_EVENT_POLICY_CHANGED == 0)
465 ELM_EVENT_POLICY_CHANGED = ecore_event_type_new();
470 ecore_evas_init(); // FIXME: check errors
474 _elm_exit_handler = ecore_event_handler_add(ECORE_EVENT_SIGNAL_EXIT, _elm_signal_exit, NULL);
476 if (argv) _elm_appname = strdup(ecore_file_file_get(argv[0]));
480 s = getenv("ELM_DATA_DIR");
481 _elm_data_dir = eina_stringshare_add(s);
485 s = getenv("ELM_PREFIX");
488 snprintf(buf, sizeof(buf), "%s/share/elementary", s);
489 _elm_data_dir = eina_stringshare_add(buf);
494 s = getenv("ELM_LIB_DIR");
495 _elm_lib_dir = eina_stringshare_add(s);
499 s = getenv("ELM_PREFIX");
502 snprintf(buf, sizeof(buf), "%s/lib", s);
503 _elm_lib_dir = eina_stringshare_add(buf);
507 if ((!_elm_data_dir) || (!_elm_lib_dir))
509 Dl_info elementary_dl;
510 // libelementary.so/../../share/elementary/
511 if (dladdr(elm_init, &elementary_dl))
515 dir = ecore_file_dir_get(elementary_dl.dli_fname);
520 if (ecore_file_is_dir(dir))
521 _elm_lib_dir = eina_stringshare_add(dir);
525 dir2 = ecore_file_dir_get(dir);
528 snprintf(buf, sizeof(buf), "%s/share/elementary", dir2);
529 if (ecore_file_is_dir(buf))
530 _elm_data_dir = eina_stringshare_add(buf);
540 _elm_data_dir = eina_stringshare_add(PACKAGE_DATA_DIR);
542 _elm_data_dir = eina_stringshare_add("/");
544 _elm_lib_dir = eina_stringshare_add(PACKAGE_LIB_DIR);
546 _elm_lib_dir = eina_stringshare_add("/");
552 elm_quicklaunch_sub_init(int argc, char **argv)
554 ecore_app_args_set(argc, (const char **)argv);
555 _elm_config_sub_init();
559 elm_quicklaunch_sub_shutdown(void)
562 if ((_elm_config->engine == ELM_SOFTWARE_X11) ||
563 (_elm_config->engine == ELM_SOFTWARE_16_X11) ||
564 (_elm_config->engine == ELM_XRENDER_X11) ||
565 (_elm_config->engine == ELM_OPENGL_X11) ||
566 (_elm_config->engine == ELM_SOFTWARE_SDL) ||
567 (_elm_config->engine == ELM_SOFTWARE_16_SDL) ||
568 (_elm_config->engine == ELM_OPENGL_SDL) ||
569 (_elm_config->engine == ELM_SOFTWARE_WIN32) ||
570 (_elm_config->engine == ELM_SOFTWARE_16_WINCE))
572 #ifdef HAVE_ELEMENTARY_X
573 ecore_x_disconnect();
575 evas_cserve_disconnect();
580 elm_quicklaunch_shutdown(void)
582 eina_stringshare_del(_elm_data_dir);
583 _elm_data_dir = NULL;
584 eina_stringshare_del(_elm_lib_dir);
590 _elm_config_shutdown();
592 ecore_event_handler_del(_elm_exit_handler);
593 _elm_exit_handler = NULL;
595 _elm_theme_shutdown();
596 _elm_unneed_efreet();
597 _elm_unneed_e_dbus();
598 _elm_unneed_ethumb();
599 _elm_module_shutdown();
600 ecore_imf_shutdown();
601 ecore_evas_shutdown();
604 ecore_file_shutdown();
608 if ((_elm_log_dom > -1) && (_elm_log_dom != EINA_LOG_DOMAIN_GLOBAL))
610 eina_log_domain_unregister(_elm_log_dom);
614 _elm_widtype_clear();
620 elm_quicklaunch_seed(void)
622 Evas_Object *win, *bg, *bt;
624 win = elm_win_add(NULL, "seed", ELM_WIN_BASIC);
625 bg = elm_bg_add(win);
626 elm_win_resize_object_add(win, bg);
627 evas_object_show(bg);
628 bt = elm_button_add(win);
629 elm_button_label_set(bt, " abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789~-_=+\\|]}[{;:'\",<.>/?");
630 elm_win_resize_object_add(win, bt);
631 ecore_main_loop_iterate();
632 evas_object_del(win);
633 ecore_main_loop_iterate();
634 if ((_elm_config->engine == ELM_SOFTWARE_X11) ||
635 (_elm_config->engine == ELM_SOFTWARE_16_X11) ||
636 (_elm_config->engine == ELM_XRENDER_X11) ||
637 (_elm_config->engine == ELM_OPENGL_X11))
639 #ifdef HAVE_ELEMENTARY_X
643 ecore_main_loop_iterate();
646 static void *qr_handle = NULL;
647 static int (*qr_main) (int argc, char **argv) = NULL;
650 elm_quicklaunch_prepare(int argc __UNUSED__, char **argv)
653 char *exe = elm_quicklaunch_exe_path_get(argv[0]);
656 ERR("requested quicklaunch binary '%s' does not exist\n", argv[0]);
664 exe2 = malloc(strlen(exe) + 1 + 10);
666 p = strrchr(exe2, '/');
669 exename = alloca(strlen(p) + 1);
672 strcat(p, "../lib/");
675 if (access(exe2, R_OK | X_OK) == 0)
683 qr_handle = dlopen(exe, RTLD_NOW | RTLD_GLOBAL);
686 fprintf(stderr, "dlerr: %s\n", dlerror());
687 WRN("dlopen('%s') failed: %s", exe, dlerror());
691 INF("dlopen('%s') = %p", exe, qr_handle);
693 qr_main = dlsym(qr_handle, "elm_main");
694 INF("dlsym(%p, 'elm_main') = %p", qr_handle, qr_main);
697 WRN("not quicklauncher capable: no elm_main in '%s'", exe);
713 extern char **environ;
718 for (i = 0, size = 0; environ[i] != NULL; i++)
719 size += strlen(environ[i]) + 1;
721 p = malloc((i + 1) * sizeof(char *));
726 for (i = 0; oldenv[i] != NULL; i++)
727 environ[i] = strdup(oldenv[i]);
733 elm_quicklaunch_fork(int argc, char **argv, char *cwd, void (postfork_func) (void *data), void *postfork_data)
742 // need to accept current environment from elementary_run
749 if (child > 0) return EINA_TRUE;
752 perror("could not fork");
757 perror("could not chdir");
758 args = alloca((argc + 1) * sizeof(char *));
759 for (i = 0; i < argc; i++) args[i] = argv[i];
761 WRN("%s not quicklaunch capable, fallback...", argv[0]);
762 execvp(argv[0], args);
763 ERR("failed to execute '%s': %s", argv[0], strerror(errno));
767 if (child > 0) return EINA_TRUE;
770 perror("could not fork");
773 if (postfork_func) postfork_func(postfork_data);
777 perror("could not chdir");
778 // FIXME: this is very linux specific. it changes argv[0] of the process
779 // so ps etc. report what you'd expect. for other unixes and os's this
786 ecore_app_args_get(&real_argc, &real_argv);
787 lastarg = real_argv[real_argc - 1] + strlen(real_argv[real_argc - 1]);
788 for (p = real_argv[0]; p < lastarg; p++) *p = 0;
789 strcpy(real_argv[0], argv[0]);
791 ecore_app_args_set(argc, (const char **)argv);
792 ret = qr_main(argc, argv);
801 elm_quicklaunch_cleanup(void)
814 elm_quicklaunch_fallback(int argc, char **argv)
817 elm_quicklaunch_init(argc, argv);
818 elm_quicklaunch_sub_init(argc, argv);
819 elm_quicklaunch_prepare(argc, argv);
820 ret = qr_main(argc, argv);
826 elm_quicklaunch_exe_path_get(const char *exe)
828 static char *path = NULL;
829 static Eina_List *pathlist = NULL;
833 if (exe[0] == '/') return strdup(exe);
834 if ((exe[0] == '.') && (exe[1] == '/')) return strdup(exe);
835 if ((exe[0] == '.') && (exe[1] == '.') && (exe[2] == '/')) return strdup(exe);
840 path = getenv("PATH");
841 buf2 = alloca(strlen(path) + 1);
846 if ((*p == ':') || (*p == 0))
851 strncpy(buf2, pp, len);
853 pathlist = eina_list_append(pathlist, eina_stringshare_add(buf2));
865 EINA_LIST_FOREACH(pathlist, l, pathitr)
867 snprintf(buf, sizeof(buf), "%s/%s", pathitr, exe);
868 if (access(buf, R_OK | X_OK) == 0) return strdup(buf);
876 * This call should be called just after all initialization is complete. This
877 * function will not return until elm_exit() is called. It will keep looping
878 * running the main event/processing loop for Elementary.
884 ecore_main_loop_begin();
890 * If this call is called, it will flag the main loop to cease processing and
891 * return back to its parent function.
897 ecore_main_loop_quit();
902 * Set new policy value.
904 * This will emit the ecore event ELM_EVENT_POLICY_CHANGED in the main
905 * loop giving the event information Elm_Event_Policy_Changed with
906 * policy identifier, new and old values.
908 * @param policy policy identifier as in Elm_Policy.
909 * @param value policy value, depends on identifiers, usually there is
910 * an enumeration with the same prefix as the policy name, for
911 * example: ELM_POLICY_QUIT and Elm_Policy_Quit
912 * (ELM_POLICY_QUIT_NONE, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED).
914 * @return @c EINA_TRUE on success or @c EINA_FALSE on error (right
915 * now just invalid policy identifier, but in future policy
916 * value might be enforced).
919 elm_policy_set(unsigned int policy, int value)
921 Elm_Event_Policy_Changed *ev;
923 if (policy >= ELM_POLICY_LAST)
926 if (value == _elm_policies[policy])
929 /* TODO: validade policy? */
931 ev = malloc(sizeof(*ev));
933 ev->new_value = value;
934 ev->old_value = _elm_policies[policy];
936 _elm_policies[policy] = value;
938 ecore_event_add(ELM_EVENT_POLICY_CHANGED, ev, NULL, NULL);
944 * Gets the policy value set for given identifier.
946 * @param policy policy identifier as in Elm_Policy.
948 * @return policy value. Will be 0 if policy identifier is invalid.
951 elm_policy_get(unsigned int policy)
953 if (policy >= ELM_POLICY_LAST)
955 return _elm_policies[policy];
959 * Flush all caches & dump all data that can be to lean down to use less memory
967 EINA_LIST_FOREACH(_elm_win_list, l, obj)
969 Evas *e = evas_object_evas_get(obj);
970 edje_file_cache_flush();
971 edje_collection_cache_flush();
972 evas_image_cache_flush(e);
973 evas_font_cache_flush(e);
979 * @defgroup Scaling Selective Widget Scaling
981 * Different widgets can be scaled independently. These functions allow you to
982 * manipulate this scaling on a per-widget basis. The object and all its
983 * children get their scaling factors multiplied by the scale factor set.
984 * This is multiplicative, in that if a child also has a scale size set it is
985 * in turn multiplied by its parent's scale size. 1.0 means “don't scale”,
986 * 2.0 is double size, 0.5 is half etc.
990 * Set the scaling factor
992 * @param obj The object
993 * @param scale Scale factor (from 0.0 up, with 1.0 == no scaling)
997 elm_object_scale_set(Evas_Object *obj, double scale)
999 elm_widget_scale_set(obj, scale);
1003 * Get the scaling factor
1005 * @param obj The object
1006 * @return The scaling factor set by elm_object_scale_set()
1010 elm_object_scale_get(const Evas_Object *obj)
1012 return elm_widget_scale_get(obj);
1016 * @defgroup Styles Styles
1018 * Widgets can have different styles of look. These generic API's set
1019 * styles of widgets, if they support them (and if the theme(s) do).
1025 * This sets the name of the style
1026 * @param obj The object
1027 * @param style The style name to use
1031 elm_object_style_set(Evas_Object *obj, const char *style)
1033 elm_widget_style_set(obj, style);
1039 * This gets the style being used for that widget. Note that the string
1040 * pointer is only valid as longas the object is valid and the style doesn't
1043 * @param obj The object
1044 * @return The style name
1048 elm_object_style_get(const Evas_Object *obj)
1050 return elm_widget_style_get(obj);
1054 * Set the disable state
1056 * This sets the disable state for the widget.
1058 * @param obj The object
1059 * @param disabled The state
1063 elm_object_disabled_set(Evas_Object *obj, Eina_Bool disabled)
1065 elm_widget_disabled_set(obj, disabled);
1069 * Get the disable state
1071 * This gets the disable state for the widget.
1073 * @param obj The object
1074 * @return True, if the widget is disabled
1078 elm_object_disabled_get(const Evas_Object *obj)
1080 return elm_widget_disabled_get(obj);
1084 * Get the global scaling factor
1086 * This gets the globally configured scaling factor that is applied to all
1089 * @return The scaling factor
1095 return _elm_config->scale;
1099 * Set the global scaling factor
1101 * This sets the globally configured scaling factor that is applied to all
1104 * @param scale The scaling factor to set
1108 elm_scale_set(double scale)
1110 if (_elm_config->scale == scale) return;
1111 _elm_config->scale = scale;
1116 * Set the global scaling factor for all applications on the display
1118 * This sets the globally configured scaling factor that is applied to all
1119 * objects for all applications.
1120 * @param scale The scaling factor to set
1124 elm_scale_all_set(double scale)
1126 #ifdef HAVE_ELEMENTARY_X
1127 static Ecore_X_Atom atom = 0;
1128 unsigned int scale_i = (unsigned int)(scale * 1000.0);
1130 if (!atom) atom = ecore_x_atom_get("ENLIGHTENMENT_SCALE");
1131 ecore_x_window_prop_card32_set(ecore_x_window_root_first_get(),
1137 * @defgroup Fingers Fingers
1139 * Elementary is designed to be finger-friendly for touchscreens, and so in
1140 * addition to scaling for display resolution, it can also scale based on
1141 * finger "resolution" (or size).
1145 * Get the configured finger size
1147 * This gets the globally configured finger size in pixels
1149 * @return The finger size
1153 elm_finger_size_get(void)
1155 return _elm_config->finger_size;
1159 * Set the configured finger size
1161 * This sets the globally configured finger size in pixels
1163 * @param size The finger size
1167 elm_finger_size_set(Evas_Coord size)
1169 if (_elm_config->finger_size == size) return;
1170 _elm_config->finger_size = size;
1175 * Set the configured finger size for all applications on the display
1177 * This sets the globally configured finger size in pixels for all applications
1180 * @param size The finger size
1184 elm_finger_size_all_set(Evas_Coord size)
1186 #ifdef HAVE_ELEMENTARY_X
1187 static Ecore_X_Atom atom = 0;
1188 unsigned int size_i = (unsigned int)size;
1190 if (!atom) atom = ecore_x_atom_get("ENLIGHTENMENT_FINGER_SIZE");
1191 ecore_x_window_prop_card32_set(ecore_x_window_root_first_get(),
1197 * Adjust size of an element for finger usage
1199 * This takes width and height sizes (in pixels) as input and a size multiple
1200 * (which is how many fingers you want to place within the area), and adjusts
1201 * the size tobe large enough to accomodate finger. On return the w and h
1202 * sizes poiner do by these parameters will be modified.
1204 * @param times_w How many fingers should fit horizontally
1205 * @param w Pointer to the width size to adjust
1206 * @param times_h How many fingers should fit vertically
1207 * @param h Pointer to the height size to adjust
1211 elm_coords_finger_size_adjust(int times_w, Evas_Coord *w, int times_h, Evas_Coord *h)
1213 if ((w) && (*w < (_elm_config->finger_size * times_w)))
1214 *w = _elm_config->finger_size * times_w;
1215 if ((h) && (*h < (_elm_config->finger_size * times_h)))
1216 *h = _elm_config->finger_size * times_h;
1220 * @defgroup Focus Focus
1222 * Objects have focus. This is what determines where the keyboard input goes to
1223 * within the application window.
1227 * Get the focus of the object
1229 * This gets the focused property of the object.
1231 * @param obj The object
1232 * @return 1 if the object is focused, 0 if not.
1236 elm_object_focus_get(Evas_Object *obj)
1238 return elm_widget_focus_get(obj);
1242 * Set the focus to the object
1244 * This sets the focus target for keyboard input to be the object indicated.
1246 * @param obj The object
1250 elm_object_focus(Evas_Object *obj)
1252 if (!elm_widget_can_focus_get(obj)) return;
1253 elm_widget_focus_steal(obj);
1257 * Remove the focus from the object
1259 * This removes the focus target for keyboard input from be the object
1262 * @param obj The object
1266 elm_object_unfocus(Evas_Object *obj)
1268 if (!elm_widget_can_focus_get(obj)) return;
1269 elm_widget_focused_object_clear(obj);
1273 * Set the ability for the object to focus
1275 * This sets the ability for the object to be able to get keyboard focus or
1276 * not. By default all objects are able to be focused.
1278 * @param obj The object
1279 * @param enable 1 if the object can be focused, 0 if not
1283 elm_object_focus_allow_set(Evas_Object *obj, Eina_Bool enable)
1285 elm_widget_can_focus_set(obj, enable);
1289 * Get the ability for the object to focus
1291 * This gets the ability for the object to be able to get keyboard focus or
1292 * not. By default all objects are able to be focused.
1294 * @param obj The object
1295 * @return 1 if the object is allowed to be focused, 0 if not.
1299 elm_object_focus_allow_get(const Evas_Object *obj)
1301 return elm_widget_can_focus_get(obj);
1305 * @defgroup Scrollhints Scrollhints
1307 * Objects when inside a scroller can scroll, but this may not always be
1308 * desireable in certain situations. This allows an object to hint to itself
1309 * and parents to "not scroll" in one of 2 ways.
1311 * 1. To hold on scrolling. This means just flicking and dragging may no
1312 * longer scroll, but pressing/dragging near an edge of the scroller will
1313 * still scroll. This is automastically used by the entry object when
1315 * 2. To totally freeze scrolling. This means it stops. until popped/released.
1319 * Push the scroll hold by 1
1321 * This increments the scroll hold count by one. If it is more than 0 it will
1322 * take effect on the parents of the indicated object.
1324 * @param obj The object
1325 * @ingroup Scrollhints
1328 elm_object_scroll_hold_push(Evas_Object *obj)
1330 elm_widget_scroll_hold_push(obj);
1334 * Pop the scroll hold by 1
1336 * This decrements the scroll hold count by one. If it is more than 0 it will
1337 * take effect on the parents of the indicated object.
1339 * @param obj The object
1340 * @ingroup Scrollhints
1343 elm_object_scroll_hold_pop(Evas_Object *obj)
1345 elm_widget_scroll_hold_pop(obj);
1349 * Push the scroll freeze by 1
1351 * This increments the scroll freeze count by one. If it is more than 0 it will
1352 * take effect on the parents of the indicated object.
1354 * @param obj The object
1355 * @ingroup Scrollhints
1358 elm_object_scroll_freeze_push(Evas_Object *obj)
1360 elm_widget_scroll_freeze_push(obj);
1364 * Lock the scrolling of the given widget (and thus all parents)
1366 * This locks the given object from scrolling in the X axis (and implicitly
1367 * also locks all parent scrollers too from doing the same).
1369 * @param obj The object
1370 * @param lock The lock state (1 == locked, 0 == unlocked)
1371 * @ingroup Scrollhints
1374 elm_object_scroll_lock_x_set(Evas_Object *obj, Eina_Bool lock)
1376 elm_widget_drag_lock_x_set(obj, lock);
1380 * Lock the scrolling of the given widget (and thus all parents)
1382 * This locks the given object from scrolling in the Y axis (and implicitly
1383 * also locks all parent scrollers too from doing the same).
1385 * @param obj The object
1386 * @param lock The lock state (1 == locked, 0 == unlocked)
1387 * @ingroup Scrollhints
1390 elm_object_scroll_lock_y_set(Evas_Object *obj, Eina_Bool lock)
1392 elm_widget_drag_lock_y_set(obj, lock);
1396 * Get the scrolling lock of the given widget
1398 * This gets the lock for X axis scrolling.
1400 * @param obj The object
1401 * @ingroup Scrollhints
1404 elm_object_scroll_lock_x_get(const Evas_Object *obj)
1406 return elm_widget_drag_lock_x_get(obj);
1410 * Get the scrolling lock of the given widget
1412 * This gets the lock for X axis scrolling.
1414 * @param obj The object
1415 * @ingroup Scrollhints
1418 elm_object_scroll_lock_y_get(const Evas_Object *obj)
1420 return elm_widget_drag_lock_y_get(obj);
1424 * Pop the scroll freeze by 1
1426 * This decrements the scroll freeze count by one. If it is more than 0 it will
1427 * take effect on the parents of the indicated object.
1429 * @param obj The object
1430 * @ingroup Scrollhints
1433 elm_object_scroll_freeze_pop(Evas_Object *obj)
1435 elm_widget_scroll_freeze_pop(obj);
1439 * @defgroup WidgetNavigation Widget Tree Navigation.
1441 * How to check if an Evas Object is an Elementary widget? How to get
1442 * the first elementary widget that is parent of the given object?
1443 * These are all covered in widget tree navigation.
1447 * Check if the given Evas Object is an Elementary widget.
1449 * @param obj the object to query.
1450 * @return @c EINA_TRUE if it is an elementary widget variant,
1451 * @c EINA_FALSE otherwise
1454 elm_object_widget_check(const Evas_Object *obj)
1456 return elm_widget_is(obj);
1460 * Get the first parent of the given object that is an Elementary widget.
1462 * @param obj the object to query.
1463 * @return the parent object that is an Elementary widget, or @c NULL
1464 * if no parent is, or no parents at all.
1467 elm_object_parent_widget_get(const Evas_Object *obj)
1469 return elm_widget_parent_widget_get(obj);
1473 * Get the top level parent of an Elementary widget.
1475 * @param obj The object to query.
1476 * @return The top level Elementary widget, or @c NULL if parent cannot be
1480 elm_object_top_widget_get(const Evas_Object *obj)
1482 return elm_widget_top_get(obj);
1486 * Get the string that represents this Elementary widget.
1488 * @note Elementary is weird and exposes itself as a single
1489 * Evas_Object_Smart_Class of type "elm_widget", so
1490 * evas_object_type_get() always return that, making debug and
1491 * language bindings hard. This function tries to mitigate this
1492 * problem, but the solution is to change Elementary to use
1493 * proper inheritance.
1495 * @param obj the object to query.
1496 * @return Elementary widget name, or @c NULL if not a valid widget.
1499 elm_object_widget_type_get(const Evas_Object *obj)
1501 return elm_widget_type_get(obj);
1505 * Send a signal to the widget edje object.
1507 * This function sends a signal to the edje object of the obj. An edje program
1508 * can respond to a signal by specifying matching 'signal' and
1511 * @param obj The object
1512 * @param emission The signal's name.
1513 * @param source The signal's source.
1516 EAPI void elm_object_signal_emit(Evas_Object *obj, const char *emission, const char *source)
1518 elm_widget_signal_emit(obj, emission, source);
1522 * Add a callback for a signal emitted by widget edje object.
1524 * This function connects a callback function to a signal emitted by the
1525 * edje object of the obj.
1526 * Globs can occur in either the emission or source name.
1528 * @param obj The object
1529 * @param emission The signal's name.
1530 * @param source The signal's source.
1531 * @param func The callback function to be executed when the signal is
1533 * @param data A pointer to data to pass in to the callback function.
1536 EAPI void 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)
1538 elm_widget_signal_callback_add(obj, emission, source, func, data);
1542 * Remove a signal-triggered callback from an widget edje object.
1544 * This function removes a callback, previoulsy attached to a signal emitted
1545 * by the edje object of the obj.
1546 * The parameters emission, source and func must match exactly those passed to
1547 * a previous call to elm_object_signal_callback_add(). The data pointer that
1548 * was passed to this call will be returned.
1550 * @param obj The object
1551 * @param emission The signal's name.
1552 * @param source The signal's source.
1553 * @param func The callback function to be executed when the signal is
1555 * @return The data pointer
1558 EAPI void *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))
1560 return elm_widget_signal_callback_del(obj, emission, source, func);