aboutsummaryrefslogtreecommitdiffstats
path: root/src/bin/elementary
diff options
context:
space:
mode:
authorCedric BAIL <cedric@osg.samsung.com>2016-03-23 12:56:14 -0700
committerCedric BAIL <cedric@osg.samsung.com>2016-03-23 13:24:41 -0700
commitc2a1c49ab2042f559b28e840e54feb8494888e0e (patch)
treec6eb110b7c479499854eede9d0c3ab0a80c9a11a /src/bin/elementary
parentMerge elementary into the EFL. (diff)
downloadefl-c2a1c49ab2042f559b28e840e54feb8494888e0e.tar.gz
elementary: move all legacy files to their expected new location.
Diffstat (limited to 'src/bin/elementary')
-rw-r--r--src/bin/elementary/.gitignore7
-rw-r--r--src/bin/elementary/Makefile.am195
-rw-r--r--src/bin/elementary/config.c4115
-rw-r--r--src/bin/elementary/elementary_codegen.c887
-rw-r--r--src/bin/elementary/elm_prefs_cc.c201
-rw-r--r--src/bin/elementary/elm_prefs_cc.h107
-rw-r--r--src/bin/elementary/elm_prefs_cc_handlers.c1218
-rw-r--r--src/bin/elementary/elm_prefs_cc_mem.c35
-rw-r--r--src/bin/elementary/elm_prefs_cc_out.c52
-rw-r--r--src/bin/elementary/elm_prefs_cc_parse.c1401
-rw-r--r--src/bin/elementary/quicklaunch.c347
-rw-r--r--src/bin/elementary/run.c213
-rw-r--r--src/bin/elementary/test.c1030
-rw-r--r--src/bin/elementary/test.h12
-rw-r--r--src/bin/elementary/test_3d.c333
-rw-r--r--src/bin/elementary/test_access.c398
-rw-r--r--src/bin/elementary/test_actionslider.c209
-rw-r--r--src/bin/elementary/test_anim.c97
-rw-r--r--src/bin/elementary/test_application_server.c206
-rw-r--r--src/bin/elementary/test_bg.c270
-rw-r--r--src/bin/elementary/test_box.c882
-rw-r--r--src/bin/elementary/test_bubble.c176
-rw-r--r--src/bin/elementary/test_button.c205
-rw-r--r--src/bin/elementary/test_calendar.c375
-rw-r--r--src/bin/elementary/test_check.c190
-rw-r--r--src/bin/elementary/test_clock.c363
-rw-r--r--src/bin/elementary/test_cnp.c135
-rw-r--r--src/bin/elementary/test_colorclass.c24
-rw-r--r--src/bin/elementary/test_colorselector.c212
-rw-r--r--src/bin/elementary/test_combobox.c278
-rw-r--r--src/bin/elementary/test_config.c534
-rw-r--r--src/bin/elementary/test_conform.c195
-rw-r--r--src/bin/elementary/test_conform_indicator.c384
-rw-r--r--src/bin/elementary/test_ctxpopup.c433
-rw-r--r--src/bin/elementary/test_cursor.c473
-rw-r--r--src/bin/elementary/test_datetime.c107
-rw-r--r--src/bin/elementary/test_dayselector.c125
-rw-r--r--src/bin/elementary/test_disable.c207
-rw-r--r--src/bin/elementary/test_diskselector.c355
-rw-r--r--src/bin/elementary/test_dnd.c1399
-rw-r--r--src/bin/elementary/test_eio.c245
-rw-r--r--src/bin/elementary/test_entry.c2716
-rw-r--r--src/bin/elementary/test_entry_anchor.c236
-rw-r--r--src/bin/elementary/test_entry_anchor2.c109
-rw-r--r--src/bin/elementary/test_explode.c211
-rw-r--r--src/bin/elementary/test_explode.h1
-rw-r--r--src/bin/elementary/test_external.c182
-rw-r--r--src/bin/elementary/test_factory.c181
-rw-r--r--src/bin/elementary/test_fileselector.c589
-rw-r--r--src/bin/elementary/test_fileselector_button.c248
-rw-r--r--src/bin/elementary/test_fileselector_entry.c259
-rw-r--r--src/bin/elementary/test_flip.c711
-rw-r--r--src/bin/elementary/test_flip_page.c909
-rw-r--r--src/bin/elementary/test_flipselector.c188
-rw-r--r--src/bin/elementary/test_floating.c101
-rw-r--r--src/bin/elementary/test_focus.c902
-rw-r--r--src/bin/elementary/test_focus_custom_chain.c243
-rw-r--r--src/bin/elementary/test_focus_policy.c150
-rw-r--r--src/bin/elementary/test_focus_style.c234
-rw-r--r--src/bin/elementary/test_gengrid.c2231
-rw-r--r--src/bin/elementary/test_genlist.c5300
-rw-r--r--src/bin/elementary/test_gesture_layer.c400
-rw-r--r--src/bin/elementary/test_gesture_layer2.c808
-rw-r--r--src/bin/elementary/test_gesture_layer3.c585
-rw-r--r--src/bin/elementary/test_glview.c717
-rw-r--r--src/bin/elementary/test_glview_manygears.c951
-rw-r--r--src/bin/elementary/test_glview_simple.c290
-rw-r--r--src/bin/elementary/test_grid.c189
-rw-r--r--src/bin/elementary/test_hover.c249
-rw-r--r--src/bin/elementary/test_hoversel.c416
-rw-r--r--src/bin/elementary/test_icon.c437
-rw-r--r--src/bin/elementary/test_icon_animated.c57
-rw-r--r--src/bin/elementary/test_icon_desktops.c106
-rw-r--r--src/bin/elementary/test_image.c193
-rw-r--r--src/bin/elementary/test_index.c585
-rw-r--r--src/bin/elementary/test_inwin.c129
-rw-r--r--src/bin/elementary/test_label.c376
-rw-r--r--src/bin/elementary/test_launcher.c921
-rw-r--r--src/bin/elementary/test_layout.c271
-rw-r--r--src/bin/elementary/test_list.c1953
-rw-r--r--src/bin/elementary/test_main_menu.c77
-rw-r--r--src/bin/elementary/test_map.c1208
-rw-r--r--src/bin/elementary/test_menu.c312
-rw-r--r--src/bin/elementary/test_multi.c132
-rw-r--r--src/bin/elementary/test_multibuttonentry.c254
-rw-r--r--src/bin/elementary/test_naviframe.c388
-rw-r--r--src/bin/elementary/test_naviframe_complex.c367
-rw-r--r--src/bin/elementary/test_notify.c448
-rw-r--r--src/bin/elementary/test_panel.c369
-rw-r--r--src/bin/elementary/test_panes.c105
-rw-r--r--src/bin/elementary/test_photo.c100
-rw-r--r--src/bin/elementary/test_photocam.c616
-rw-r--r--src/bin/elementary/test_popup.c934
-rw-r--r--src/bin/elementary/test_prefs.c119
-rw-r--r--src/bin/elementary/test_progressbar.c397
-rw-r--r--src/bin/elementary/test_radio.c189
-rw-r--r--src/bin/elementary/test_scaling.c119
-rw-r--r--src/bin/elementary/test_scroller.c730
-rw-r--r--src/bin/elementary/test_segment_control.c156
-rw-r--r--src/bin/elementary/test_separator.c67
-rw-r--r--src/bin/elementary/test_slider.c307
-rw-r--r--src/bin/elementary/test_slideshow.c236
-rw-r--r--src/bin/elementary/test_spinner.c113
-rw-r--r--src/bin/elementary/test_store.c267
-rw-r--r--src/bin/elementary/test_sys_notify.c148
-rw-r--r--src/bin/elementary/test_systray.c192
-rw-r--r--src/bin/elementary/test_table.c539
-rw-r--r--src/bin/elementary/test_task_switcher.c400
-rw-r--r--src/bin/elementary/test_thumb.c63
-rw-r--r--src/bin/elementary/test_toolbar.c1314
-rw-r--r--src/bin/elementary/test_tooltip.c745
-rw-r--r--src/bin/elementary/test_transit.c770
-rw-r--r--src/bin/elementary/test_transit_bezier.c315
-rw-r--r--src/bin/elementary/test_video.c58
-rw-r--r--src/bin/elementary/test_weather.c168
-rw-r--r--src/bin/elementary/test_web.c693
-rw-r--r--src/bin/elementary/test_win_dialog.c48
-rw-r--r--src/bin/elementary/test_win_inline.c254
-rw-r--r--src/bin/elementary/test_win_keygrab.c243
-rw-r--r--src/bin/elementary/test_win_plug.c211
-rw-r--r--src/bin/elementary/test_win_socket.c202
-rw-r--r--src/bin/elementary/test_win_state.c630
-rw-r--r--src/bin/elementary/test_win_wm_rotation.c214
123 files changed, 59181 insertions, 0 deletions
diff --git a/src/bin/elementary/.gitignore b/src/bin/elementary/.gitignore
new file mode 100644
index 0000000000..5cbbb5c189
--- /dev/null
+++ b/src/bin/elementary/.gitignore
@@ -0,0 +1,7 @@
+/elementary_config
+/elementary_quicklaunch
+/elementary_run
+/elementary_test
+/elementary_codegen
+/elementary_testql
+/elm_prefs_cc
diff --git a/src/bin/elementary/Makefile.am b/src/bin/elementary/Makefile.am
new file mode 100644
index 0000000000..46db673e5d
--- /dev/null
+++ b/src/bin/elementary/Makefile.am
@@ -0,0 +1,195 @@
+AUTOMAKE_OPTIONS = 1.4 foreign
+
+MAINTAINERCLEANFILES = Makefile.in
+
+AM_CPPFLAGS = \
+-I$(top_srcdir) \
+-I$(top_srcdir)/src/lib \
+-I$(top_builddir)/src/lib \
+-I$(top_srcdir)/src/bin \
+-DPACKAGE_BIN_DIR=\"$(bindir)\" \
+-DPACKAGE_LIB_DIR=\"$(libdir)\" \
+-DPACKAGE_DATA_DIR=\"$(pkgdatadir)\" \
+@ELEMENTARY_CFLAGS@
+
+bin_PROGRAMS = \
+@ELEMENTARY_TEST_PRG@ \
+@ELEMENTARY_CONFIG_PRG@ \
+@ELEMENTARY_CODEGEN_PRG@ \
+@ELM_PREFS_CC_PRG@
+
+if BUILD_QUICKLAUNCH
+bin_PROGRAMS += elementary_quicklaunch elementary_run
+endif
+
+EXTRA_PROGRAMS = elementary_test elementary_config elementary_codegen elm_prefs_cc
+
+elementary_test_SOURCES = \
+test.c \
+test_explode.c \
+test_explode.h \
+test_3d.c \
+test_access.c \
+test_actionslider.c \
+test_anim.c \
+test_application_server.c \
+test_bg.c \
+test_box.c \
+test_bubble.c \
+test_button.c \
+test_calendar.c \
+test_check.c \
+test_clock.c \
+test_cnp.c \
+test_colorselector.c \
+test_colorclass.c \
+test_combobox.c \
+test_config.c \
+test_conform.c \
+test_conform_indicator.c \
+test_ctxpopup.c \
+test_cursor.c \
+test_datetime.c \
+test_dayselector.c \
+test_disable.c \
+test_diskselector.c \
+test_dnd.c \
+test_eio.c \
+test_entry.c \
+test_entry_anchor.c \
+test_entry_anchor2.c \
+test_external.c \
+test_fileselector_button.c \
+test_fileselector.c \
+test_fileselector_entry.c \
+test_flip.c \
+test_flip_page.c \
+test_flipselector.c \
+test_floating.c \
+test_focus.c \
+test_focus_custom_chain.c \
+test_focus_policy.c \
+test_focus_style.c \
+test_gengrid.c \
+test_genlist.c \
+test_gesture_layer.c \
+test_gesture_layer2.c \
+test_gesture_layer3.c \
+test_glview_simple.c \
+test_glview.c \
+test_glview_manygears.c \
+test_grid.c \
+test_hover.c \
+test_hoversel.c \
+test_icon.c \
+test_icon_desktops.c \
+test_icon_animated.c \
+test_image.c \
+test_index.c \
+test_inwin.c \
+test_label.c \
+test_launcher.c \
+test_layout.c \
+test_list.c \
+test_map.c \
+test_main_menu.c \
+test_menu.c \
+test_multi.c \
+test_multibuttonentry.c \
+test_naviframe.c \
+test_naviframe_complex.c \
+test_notify.c \
+test_panel.c \
+test_panes.c \
+test_photo.c \
+test_photocam.c \
+test_popup.c \
+test_prefs.c \
+test_progressbar.c \
+test_radio.c \
+test_scaling.c \
+test_scroller.c \
+test_segment_control.c \
+test_separator.c \
+test_slider.c \
+test_slideshow.c \
+test_spinner.c \
+test_store.c \
+test_sys_notify.c \
+test_systray.c \
+test_task_switcher.c \
+test_table.c \
+test_thumb.c \
+test_toolbar.c \
+test_tooltip.c \
+test_transit.c \
+test_transit_bezier.c \
+test_video.c \
+test_weather.c \
+test_web.c \
+test_win_inline.c \
+test_win_keygrab.c \
+test_win_socket.c \
+test_win_plug.c \
+test_win_state.c \
+test_win_wm_rotation.c \
+test_win_dialog.c \
+test.h
+
+elementary_test_LDADD = $(top_builddir)/src/lib/libelementary.la \
+ @ELEMENTARY_LIBS@
+elementary_test_CFLAGS =
+elementary_test_LDFLAGS =
+
+elementary_config_SOURCES = \
+config.c
+
+elementary_config_LDADD = $(top_builddir)/src/lib/libelementary.la \
+ @ELEMENTARY_LIBS@
+elementary_config_LDFLAGS =
+
+elementary_codegen_SOURCES = \
+elementary_codegen.c
+
+elementary_codegen_LDADD = \
+ $(top_builddir)/src/lib/libelementary.la \
+ @ELEMENTARY_LIBS@
+elementary_codegen_LDFLAGS =
+
+noinst_HEADERS = \
+elm_prefs_cc.h
+
+elm_prefs_cc_SOURCES = \
+elm_prefs_cc.c \
+elm_prefs_cc_mem.c \
+elm_prefs_cc_out.c \
+elm_prefs_cc_parse.c \
+elm_prefs_cc_handlers.c
+
+elm_prefs_cc_LDADD = \
+$(top_builddir)/src/lib/libelementary.la \
+@ELEMENTARY_LIBS@
+
+if BUILD_QUICKLAUNCH
+elementary_quicklaunch_SOURCES = quicklaunch.c
+elementary_quicklaunch_LDADD = $(top_builddir)/src/lib/libelementary.la \
+ @ELEMENTARY_LIBS@
+elementary_quicklaunch_LDFLAGS =
+
+if BUILD_RUN
+elementary_run_CPPFLAGS = -I$(top_srcdir) \
+-I$(top_srcdir)/src/lib \
+-I$(top_builddir)/src/lib \
+-I$(top_srcdir)/src/bin \
+-DPACKAGE_BIN_DIR=\"$(bindir)\" \
+-DPACKAGE_LIB_DIR=\"$(libdir)\" \
+-DPACKAGE_DATA_DIR=\"$(pkgdatadir)\"
+
+elementary_run_SOURCES = run.c
+elementary_run_LDADD =
+elementary_run_LDFLAGS =
+endif
+endif
+
+EXTRA_DIST = \
+test_factory.c
diff --git a/src/bin/elementary/config.c b/src/bin/elementary/config.c
new file mode 100644
index 0000000000..d63bcef157
--- /dev/null
+++ b/src/bin/elementary/config.c
@@ -0,0 +1,4115 @@
+#ifdef HAVE_CONFIG_H
+# include "elementary_config.h"
+#endif
+#include <Elementary.h>
+
+typedef struct _Theme Theme;
+typedef struct _Fonts_Data Fonts_Data;
+typedef struct _Elm_Text_Class_Data Elm_Text_Class_Data;
+typedef struct _Elm_Font_Size_Data Elm_Font_Size_Data;
+
+struct _Theme
+{
+ const char *label;
+ const char *name;
+ const char *path;
+ Eina_Bool in_search_path;
+};
+
+static const Eina_List *tsel = NULL;
+static Eina_List *themes = NULL;
+
+struct _Elm_Text_Class_Data
+{
+ const char *name;
+ const char *desc;
+ const char *font;
+ const char *style;
+ Evas_Font_Size size;
+};
+
+struct _Elm_Font_Size_Data
+{
+ const char *size_str;
+ Evas_Font_Size size;
+};
+
+struct _Fonts_Data
+{
+ Eina_List *text_classes;
+
+ Eina_Hash *font_hash;
+ Eina_List *font_px_list;
+ Eina_List *font_scale_list;
+
+ const char *cur_font;
+ const char *cur_style;
+ double cur_size;
+};
+
+#define ELM_LIST_DISABLE(list) \
+ do \
+ { \
+ const Eina_List *_l = elm_list_items_get(list); \
+ if (_l) \
+ { \
+ elm_list_item_show(eina_list_data_get(_l));\
+ elm_object_disabled_set(list, EINA_TRUE); \
+ } \
+ } \
+ while (0)
+
+#define ELM_LIST_ENABLE(list) \
+ do \
+ { \
+ elm_object_disabled_set(list, EINA_FALSE); \
+ } \
+ while (0)
+
+#define LABEL_FRAME_ADD(label) \
+ do \
+ { \
+ pd = elm_frame_add(win); \
+ evas_object_size_hint_weight_set(pd, EVAS_HINT_EXPAND, 0.0); \
+ evas_object_size_hint_align_set(pd, EVAS_HINT_FILL, 0.5); \
+ elm_object_style_set(pd, "pad_medium"); \
+ elm_box_pack_end(bx, pd); \
+ evas_object_show(pd); \
+ \
+ lb = elm_label_add(win); \
+ evas_object_size_hint_weight_set(lb, EVAS_HINT_EXPAND, 0.0); \
+ evas_object_size_hint_align_set(lb, EVAS_HINT_FILL, 0.5); \
+ elm_object_text_set(lb, label); \
+ elm_object_content_set(pd, lb); \
+ evas_object_show(lb); \
+ } \
+ while (0)
+
+#define CHECK_ADD(_label, _desc, _cb, _cb_param) \
+ ck = elm_check_add(win); \
+ elm_object_text_set(ck, _label); \
+ elm_object_tooltip_text_set(ck, _desc); \
+ evas_object_size_hint_weight_set(ck, EVAS_HINT_EXPAND, 0.0); \
+ evas_object_size_hint_align_set(ck, EVAS_HINT_FILL, 0.5); \
+ elm_box_pack_end(bx, ck); \
+ evas_object_show(ck); \
+ evas_object_smart_callback_add(ck, "changed", _cb, _cb_param);
+
+static int quiet = 0;
+static int interactive = 1;
+
+static const char *theme_set = NULL;
+static const char *finger_size_set = NULL;
+static const char *scale_set = NULL;
+static const char *web_backend = NULL;
+static Fonts_Data fndata = {NULL, NULL, NULL, NULL, NULL, NULL, 0.0};
+static Evas_Object *web_backend_entry = NULL;
+
+static void
+_font_styles_list_sel(void *data EINA_UNUSED,
+ Evas_Object *obj,
+ void *event_info);
+
+static void
+config_exit(void *data EINA_UNUSED,
+ Evas_Object *obj EINA_UNUSED,
+ void *event_info EINA_UNUSED)
+{
+ Elm_Text_Class_Data *tc_data;
+ Elm_Font_Size_Data *sd;
+
+ EINA_LIST_FREE(fndata.text_classes, tc_data)
+ {
+ eina_stringshare_del(tc_data->name);
+ eina_stringshare_del(tc_data->desc);
+ eina_stringshare_del(tc_data->font);
+ eina_stringshare_del(tc_data->style);
+ free(tc_data);
+ }
+
+ elm_font_available_hash_del(fndata.font_hash);
+ fndata.font_hash = NULL;
+
+ EINA_LIST_FREE(fndata.font_px_list, sd)
+ {
+ eina_stringshare_del(sd->size_str);
+ free(sd);
+ }
+
+ EINA_LIST_FREE(fndata.font_scale_list, sd)
+ {
+ eina_stringshare_del(sd->size_str);
+ free(sd);
+ }
+
+ if (fndata.cur_font) eina_stringshare_del(fndata.cur_font);
+ fndata.cur_font = NULL;
+
+ if (fndata.cur_style) eina_stringshare_del(fndata.cur_style);
+ fndata.cur_style = NULL;
+
+ elm_config_save();
+ elm_exit(); /* exit the program's main loop that runs in elm_run() */
+}
+
+static void
+scroll_animation_disable_change(void *data EINA_UNUSED, Evas_Object *obj, void *event_info EINA_UNUSED)
+{
+ Eina_Bool val = elm_check_state_get(obj);
+ Eina_Bool sb = elm_config_scroll_animation_disable_get();
+
+ if (val == sb) return;
+ elm_config_scroll_animation_disable_set(val);
+ elm_config_all_flush();
+}
+
+static void
+scroll_accel_factor_change(void *data EINA_UNUSED, Evas_Object *obj, void *event_info EINA_UNUSED)
+{
+ double bf = elm_config_scroll_accel_factor_get();
+ double val = elm_slider_value_get(obj);
+
+ if (fabs(bf - val) < DBL_EPSILON) return;
+ elm_config_scroll_accel_factor_set(val);
+ elm_config_all_flush();
+}
+
+static void
+sb_change(void *data EINA_UNUSED,
+ Evas_Object *obj,
+ void *event_info EINA_UNUSED)
+{
+ Eina_Bool val = elm_check_state_get(obj);
+ Eina_Bool sb = elm_config_scroll_bounce_enabled_get();
+
+ if (val == sb) return;
+ elm_config_scroll_bounce_enabled_set(val);
+ elm_config_all_flush();
+
+ /*TODO: enable/disable subordinate sliders (make 'em support it 1st)*/
+}
+
+static void
+ss_change(void *data EINA_UNUSED,
+ Evas_Object *obj,
+ void *event_info EINA_UNUSED)
+{
+ Eina_Bool val = elm_check_state_get(obj);
+ Eina_Bool ss = elm_config_scroll_thumbscroll_smooth_start_get();
+
+ if (val == ss) return;
+ elm_config_scroll_thumbscroll_smooth_start_set(val);
+ elm_config_all_flush();
+}
+
+static void
+bf_round(void *data EINA_UNUSED,
+ Evas_Object *obj,
+ void *event_info EINA_UNUSED)
+{
+ double val = elm_slider_value_get(obj);
+ double v;
+
+ v = ((double)((int)(val * 10.0))) / 10.0;
+ if (v != val) elm_slider_value_set(obj, v);
+}
+
+static void
+bf_change(void *data EINA_UNUSED,
+ Evas_Object *obj,
+ void *event_info EINA_UNUSED)
+{
+ double bf = elm_config_scroll_bounce_friction_get();
+ double val = elm_slider_value_get(obj);
+
+ if (bf == val) return;
+ elm_config_scroll_bounce_friction_set(val);
+ elm_config_all_flush();
+}
+
+static void
+ps_round(void *data EINA_UNUSED,
+ Evas_Object *obj,
+ void *event_info EINA_UNUSED)
+{
+ double val = elm_slider_value_get(obj);
+ double v;
+
+ v = ((double)((int)(val * 10.0))) / 10.0;
+ if (v != val) elm_slider_value_set(obj, v);
+}
+
+static void
+ps_change(void *data EINA_UNUSED,
+ Evas_Object *obj,
+ void *event_info EINA_UNUSED)
+{
+ double ps = elm_config_scroll_page_scroll_friction_get();
+ double val = elm_slider_value_get(obj);
+
+ if (ps == val) return;
+ elm_config_scroll_page_scroll_friction_set(val);
+ elm_config_all_flush();
+}
+
+static void
+bis_round(void *data EINA_UNUSED,
+ Evas_Object *obj,
+ void *event_info EINA_UNUSED)
+{
+ double val = elm_slider_value_get(obj);
+ double v;
+
+ v = ((double)((int)(val * 10.0))) / 10.0;
+ if (v != val) elm_slider_value_set(obj, v);
+}
+
+static void
+bis_change(void *data EINA_UNUSED,
+ Evas_Object *obj,
+ void *event_info EINA_UNUSED)
+{
+ double bis = elm_config_scroll_bring_in_scroll_friction_get();
+ double val = elm_slider_value_get(obj);
+
+ if (bis == val) return;
+ elm_config_scroll_bring_in_scroll_friction_set(val);
+ elm_config_all_flush();
+}
+
+static void
+zf_round(void *data EINA_UNUSED,
+ Evas_Object *obj,
+ void *event_info EINA_UNUSED)
+{
+ double val = elm_slider_value_get(obj);
+ double v;
+
+ v = ((double)((int)(val * 10.0))) / 10.0;
+ if (v != val) elm_slider_value_set(obj, v);
+}
+
+static void
+zf_change(void *data EINA_UNUSED,
+ Evas_Object *obj,
+ void *event_info EINA_UNUSED)
+{
+ double zf = elm_config_scroll_zoom_friction_get();
+ double val = elm_slider_value_get(obj);
+
+ if (zf == val) return;
+ elm_config_scroll_zoom_friction_set(val);
+ elm_config_all_flush();
+}
+
+static void
+smooth_round(void *data EINA_UNUSED,
+ Evas_Object *obj,
+ void *event_info EINA_UNUSED)
+{
+ double val = elm_slider_value_get(obj);
+ double v;
+
+ v = ((double)((int)(val * 100.0))) / 100.0;
+ if (v != val) elm_slider_value_set(obj, v);
+}
+
+static void
+smooth_change(void *data EINA_UNUSED,
+ Evas_Object *obj,
+ void *event_info EINA_UNUSED)
+{
+ double zf = elm_config_scroll_thumbscroll_smooth_amount_get();
+ double val = elm_slider_value_get(obj);
+
+ if (zf == val) return;
+ elm_config_scroll_thumbscroll_smooth_amount_set(val);
+ elm_config_all_flush();
+}
+
+static void
+smooth_win_round(void *data EINA_UNUSED,
+ Evas_Object *obj,
+ void *event_info EINA_UNUSED)
+{
+ double val = elm_slider_value_get(obj);
+ double v;
+
+ v = ((double)((int)(val * 100.0))) / 100.0;
+ if (v != val) elm_slider_value_set(obj, v);
+}
+
+static void
+smooth_win_change(void *data EINA_UNUSED,
+ Evas_Object *obj,
+ void *event_info EINA_UNUSED)
+{
+ double zf = elm_config_scroll_thumbscroll_smooth_time_window_get();
+ double val = elm_slider_value_get(obj);
+
+ if (zf == val) return;
+ elm_config_scroll_thumbscroll_smooth_time_window_set(val);
+ elm_config_all_flush();
+}
+
+static void
+ts_change(void *data EINA_UNUSED,
+ Evas_Object *obj,
+ void *event_info EINA_UNUSED)
+{
+ Eina_Bool val = elm_check_state_get(obj);
+ Eina_Bool sb = elm_config_scroll_thumbscroll_enabled_get();
+
+ if (val == sb) return;
+ elm_config_scroll_thumbscroll_enabled_set(val);
+ elm_config_all_flush();
+
+ /*TODO: enable/disable subordinate sliders (make 'em support it 1st)*/
+}
+
+static void
+tst_round(void *data EINA_UNUSED,
+ Evas_Object *obj,
+ void *event_info EINA_UNUSED)
+{
+ double val = elm_slider_value_get(obj);
+ double v;
+
+ v = ((double)((int)(val * 10.0))) / 10.0;
+ if (v != val) elm_slider_value_set(obj, v);
+}
+
+static void
+tst_change(void *data EINA_UNUSED,
+ Evas_Object *obj,
+ void *event_info EINA_UNUSED)
+{
+ double tst = elm_config_scroll_thumbscroll_threshold_get();
+ double val = elm_slider_value_get(obj);
+
+ if (tst == val) return;
+ elm_config_scroll_thumbscroll_threshold_set(val);
+ elm_config_all_flush();
+}
+
+static void
+tsht_round(void *data EINA_UNUSED,
+ Evas_Object *obj,
+ void *event_info EINA_UNUSED)
+{
+ double val = elm_slider_value_get(obj);
+ double v;
+
+ v = ((double)((int)(val * 10.0))) / 10.0;
+ if (v != val) elm_slider_value_set(obj, v);
+}
+
+static void
+tsht_change(void *data EINA_UNUSED,
+ Evas_Object *obj,
+ void *event_info EINA_UNUSED)
+{
+ double tst = elm_config_scroll_thumbscroll_hold_threshold_get();
+ double val = elm_slider_value_get(obj);
+
+ if (tst == val) return;
+ elm_config_scroll_thumbscroll_hold_threshold_set(val);
+ elm_config_all_flush();
+}
+
+static void
+tsmt_round(void *data EINA_UNUSED,
+ Evas_Object *obj,
+ void *event_info EINA_UNUSED)
+{
+ double val = elm_slider_value_get(obj);
+ double v;
+
+ v = ((double)((int)(val * 10.0))) / 10.0;
+ if (v != val) elm_slider_value_set(obj, v);
+}
+
+static void
+tsmt_change(void *data EINA_UNUSED,
+ Evas_Object *obj,
+ void *event_info EINA_UNUSED)
+{
+ double tsmt = elm_config_scroll_thumbscroll_momentum_threshold_get();
+ double val = elm_slider_value_get(obj);
+
+ if (tsmt == val) return;
+ elm_config_scroll_thumbscroll_momentum_threshold_set(val);
+ elm_config_all_flush();
+}
+
+static void
+tsfdt_round(void *data EINA_UNUSED,
+ Evas_Object *obj,
+ void *event_info EINA_UNUSED)
+{
+ double val = elm_slider_value_get(obj);
+ double v;
+
+ v = ((double)((int)(val * 10.0))) / 10.0;
+ if (v != val) elm_slider_value_set(obj, v);
+}
+
+static void
+tsfdt_change(void *data EINA_UNUSED,
+ Evas_Object *obj,
+ void *event_info EINA_UNUSED)
+{
+ double tsfdt = elm_config_scroll_thumbscroll_flick_distance_tolerance_get();
+ double val = elm_slider_value_get(obj);
+
+ if (tsfdt == val) return;
+ elm_config_scroll_thumbscroll_flick_distance_tolerance_set(val);
+ elm_config_all_flush();
+}
+
+static void
+tsf_round(void *data EINA_UNUSED,
+ Evas_Object *obj,
+ void *event_info EINA_UNUSED)
+{
+ double val = elm_slider_value_get(obj);
+ double v;
+
+ v = ((double)((int)(val * 10.0))) / 10.0;
+ if (v != val) elm_slider_value_set(obj, v);
+}
+
+static void
+tsf_change(void *data EINA_UNUSED,
+ Evas_Object *obj,
+ void *event_info EINA_UNUSED)
+{
+ double tsf = elm_config_scroll_thumbscroll_friction_get();
+ double val = elm_slider_value_get(obj);
+
+ if (tsf == val) return;
+ elm_config_scroll_thumbscroll_friction_set(val);
+ elm_config_all_flush();
+}
+
+static void
+tsmf_round(void *data EINA_UNUSED,
+ Evas_Object *obj,
+ void *event_info EINA_UNUSED)
+{
+ double val = elm_slider_value_get(obj);
+ double v;
+
+ v = ((double)((int)(val * 10.0))) / 10.0;
+ if (v != val) elm_slider_value_set(obj, v);
+}
+
+static void
+tsmf_change(void *data EINA_UNUSED,
+ Evas_Object *obj,
+ void *event_info EINA_UNUSED)
+{
+ double tsmf = elm_config_scroll_thumbscroll_min_friction_get();
+ double val = elm_slider_value_get(obj);
+
+ if (tsmf == val) return;
+ elm_config_scroll_thumbscroll_min_friction_set(val);
+ elm_config_all_flush();
+}
+
+static void
+tsfs_round(void *data EINA_UNUSED,
+ Evas_Object *obj,
+ void *event_info EINA_UNUSED)
+{
+ double val = elm_slider_value_get(obj);
+ double v;
+
+ v = ((double)((int)(val * 10.0))) / 10.0;
+ if (v != val) elm_slider_value_set(obj, v);
+}
+
+static void
+tsfs_change(void *data EINA_UNUSED,
+ Evas_Object *obj,
+ void *event_info EINA_UNUSED)
+{
+ double tsfs = elm_config_scroll_thumbscroll_friction_standard_get();
+ double val = elm_slider_value_get(obj);
+
+ if (tsfs == val) return;
+ elm_config_scroll_thumbscroll_friction_standard_set(val);
+ elm_config_all_flush();
+}
+
+static void
+tsbf_round(void *data EINA_UNUSED,
+ Evas_Object *obj,
+ void *event_info EINA_UNUSED)
+{
+ double val = elm_slider_value_get(obj);
+ double v;
+
+ v = ((double)((int)(val * 10.0))) / 10.0;
+ if (v != val) elm_slider_value_set(obj, v);
+}
+
+static void
+tsbf_change(void *data EINA_UNUSED,
+ Evas_Object *obj,
+ void *event_info EINA_UNUSED)
+{
+ double tsbf = elm_config_scroll_thumbscroll_border_friction_get();
+ double val = elm_slider_value_get(obj);
+
+ if (tsbf == val) return;
+ elm_config_scroll_thumbscroll_border_friction_set(val);
+ elm_config_all_flush();
+}
+
+static void
+tssf_round(void *data EINA_UNUSED,
+ Evas_Object *obj,
+ void *event_info EINA_UNUSED)
+{
+ double val = elm_slider_value_get(obj);
+ double v;
+
+ v = ((double)((int)(val * 20.0))) / 20.0;
+ if (v != val) elm_slider_value_set(obj, v);
+}
+
+static void
+tssf_change(void *data EINA_UNUSED,
+ Evas_Object *obj,
+ void *event_info EINA_UNUSED)
+{
+ double tssf = elm_config_scroll_thumbscroll_sensitivity_friction_get();
+ double val = elm_slider_value_get(obj);
+
+ if (tssf == val) return;
+ elm_config_scroll_thumbscroll_sensitivity_friction_set(val);
+ elm_config_all_flush();
+}
+
+static void
+tsat_round(void *data EINA_UNUSED,
+ Evas_Object *obj,
+ void *event_info EINA_UNUSED)
+{
+ double val = elm_slider_value_get(obj);
+ double v;
+
+ v = ((double)((int)(val * 10.0))) / 10.0;
+ if (v != val) elm_slider_value_set(obj, v);
+}
+
+static void
+tsat_change(void *data EINA_UNUSED,
+ Evas_Object *obj,
+ void *event_info EINA_UNUSED)
+{
+ double tsat = elm_config_scroll_thumbscroll_acceleration_threshold_get();
+ double val = elm_slider_value_get(obj);
+
+ if (tsat == val) return;
+ elm_config_scroll_thumbscroll_acceleration_threshold_set(val);
+ elm_config_all_flush();
+}
+
+static void
+tsatl_round(void *data EINA_UNUSED,
+ Evas_Object *obj,
+ void *event_info EINA_UNUSED)
+{
+ double val = elm_slider_value_get(obj);
+ double v;
+
+ v = ((double)((int)(val * 10.0))) / 10.0;
+ if (v != val) elm_slider_value_set(obj, v);
+}
+
+static void
+tsatl_change(void *data EINA_UNUSED,
+ Evas_Object *obj,
+ void *event_info EINA_UNUSED)
+{
+ double tsatl = elm_config_scroll_thumbscroll_acceleration_time_limit_get();
+ double val = elm_slider_value_get(obj);
+
+ if (tsatl == val) return;
+ elm_config_scroll_thumbscroll_acceleration_time_limit_set(val);
+ elm_config_all_flush();
+}
+
+static void
+tsaw_round(void *data EINA_UNUSED,
+ Evas_Object *obj,
+ void *event_info EINA_UNUSED)
+{
+ double val = elm_slider_value_get(obj);
+ double v;
+
+ v = ((double)((int)(val * 10.0))) / 10.0;
+ if (v != val) elm_slider_value_set(obj, v);
+}
+
+static void
+tsaw_change(void *data EINA_UNUSED,
+ Evas_Object *obj,
+ void *event_info EINA_UNUSED)
+{
+ double tsaw = elm_config_scroll_thumbscroll_acceleration_weight_get();
+ double val = elm_slider_value_get(obj);
+
+ if (tsaw == val) return;
+ elm_config_scroll_thumbscroll_acceleration_weight_set(val);
+ elm_config_all_flush();
+}
+
+static void
+cf_enable(void *data,
+ Evas_Object *obj,
+ void *event_info EINA_UNUSED)
+{
+ Eina_Bool cf = elm_config_cache_flush_enabled_get();
+ Eina_Bool val = elm_check_state_get(obj);
+
+ if (cf == val) return;
+ elm_object_disabled_set((Evas_Object *)data, !val);
+ elm_config_cache_flush_enabled_set(val);
+ elm_config_all_flush();
+}
+
+static void
+cf_round(void *data EINA_UNUSED,
+ Evas_Object *obj,
+ void *event_info EINA_UNUSED)
+{
+ double val = elm_slider_value_get(obj);
+ double v;
+
+ v = ((double)((int)(val * 5.0))) / 5.0;
+ if (v != val) elm_slider_value_set(obj, v);
+}
+
+static void
+cf_change(void *data EINA_UNUSED,
+ Evas_Object *obj,
+ void *event_info EINA_UNUSED)
+{
+ double cf = elm_config_cache_flush_interval_get();
+ double val = elm_slider_value_get(obj);
+
+ if (cf == val) return;
+ elm_config_cache_flush_interval_set(val);
+ elm_config_all_flush();
+}
+
+static void
+fc_round(void *data EINA_UNUSED,
+ Evas_Object *obj,
+ void *event_info EINA_UNUSED)
+{
+ double val = elm_slider_value_get(obj);
+ double v;
+
+ v = ((double)((int)(val * 10.0))) / 10.0;
+ if (v != val) elm_slider_value_set(obj, v);
+}
+
+static void
+fc_change(void *data EINA_UNUSED,
+ Evas_Object *obj,
+ void *event_info EINA_UNUSED)
+{
+ double font_cache = elm_config_cache_font_cache_size_get();
+ double val = elm_slider_value_get(obj);
+
+ if (font_cache == val) return;
+ elm_config_cache_font_cache_size_set(val * 1024);
+ elm_config_all_flush();
+}
+
+static void
+ic_round(void *data EINA_UNUSED,
+ Evas_Object *obj,
+ void *event_info EINA_UNUSED)
+{
+ double val = elm_slider_value_get(obj);
+ double v;
+
+ v = ((double)((int)(val * 10.0))) / 10.0;
+ if (v != val) elm_slider_value_set(obj, v);
+}
+
+static void
+ic_change(void *data EINA_UNUSED,
+ Evas_Object *obj,
+ void *event_info EINA_UNUSED)
+{
+ double image_cache = elm_config_cache_image_cache_size_get();
+ double val = elm_slider_value_get(obj);
+
+ if (image_cache == val) return;
+ elm_config_cache_image_cache_size_set(val * 1024);
+ elm_config_all_flush();
+}
+
+static void
+sc_round(void *data EINA_UNUSED,
+ Evas_Object *obj,
+ void *event_info EINA_UNUSED)
+{
+ double val = elm_slider_value_get(obj);
+ double v;
+
+ v = ((double)((int)(val * 10.0))) / 10.0;
+ if (v != val) elm_slider_value_set(obj, v);
+}
+
+static void
+sc_change(void *data EINA_UNUSED,
+ Evas_Object *obj,
+ void *event_info EINA_UNUSED)
+{
+ double scale = elm_config_scale_get();
+ double val = elm_slider_value_get(obj);
+
+ if (scale == val) return;
+ elm_config_scale_set(val);
+ elm_config_all_flush();
+}
+
+static void
+fs_round(void *data EINA_UNUSED,
+ Evas_Object *obj,
+ void *event_info EINA_UNUSED)
+{
+ double val = elm_slider_value_get(obj);
+ double v;
+
+ v = ((double)((int)(val * 5.0))) / 5.0;
+ if (v != val) elm_slider_value_set(obj, v);
+}
+
+static void
+fs_change(void *data EINA_UNUSED,
+ Evas_Object *obj,
+ void *event_info EINA_UNUSED)
+{
+ double fs = elm_config_finger_size_get();
+ double val = elm_slider_value_get(obj);
+
+ if (fs == val) return;
+ elm_config_finger_size_set(val);
+ elm_config_all_flush();
+}
+
+static void
+efc_round(void *data EINA_UNUSED,
+ Evas_Object *obj,
+ void *event_info EINA_UNUSED)
+{
+ double val = elm_slider_value_get(obj);
+ double v;
+
+ v = ((double)((int)(val * 5.0))) / 5.0;
+ if (v != val) elm_slider_value_set(obj, v);
+}
+
+static void
+efc_change(void *data EINA_UNUSED,
+ Evas_Object *obj,
+ void *event_info EINA_UNUSED)
+{
+ double efc = elm_config_cache_edje_file_cache_size_get();
+ double val = elm_slider_value_get(obj);
+
+ if (efc == val) return;
+ elm_config_cache_edje_file_cache_size_set(val);
+ elm_config_all_flush();
+}
+
+static void
+ecc_round(void *data EINA_UNUSED,
+ Evas_Object *obj,
+ void *event_info EINA_UNUSED)
+{
+ double val = elm_slider_value_get(obj);
+ double v;
+
+ v = ((double)((int)(val * 5.0))) / 5.0;
+ if (v != val) elm_slider_value_set(obj, v);
+}
+
+static void
+ecc_change(void *data EINA_UNUSED,
+ Evas_Object *obj,
+ void *event_info EINA_UNUSED)
+{
+ double ecc = elm_config_cache_edje_collection_cache_size_get();
+ double val = elm_slider_value_get(obj);
+
+ if (ecc == val) return;
+ elm_config_cache_edje_collection_cache_size_set(val);
+ elm_config_all_flush();
+}
+
+static void
+ac_change(void *data EINA_UNUSED,
+ Evas_Object *obj,
+ void *event_info EINA_UNUSED)
+{
+ Eina_Bool val = elm_check_state_get(obj);
+ Eina_Bool ac = elm_config_access_get();
+
+ if (val == ac) return;
+ elm_config_access_set(val);
+ elm_config_all_flush();
+}
+
+static void
+sel_change(void *data EINA_UNUSED,
+ Evas_Object *obj,
+ void *event_info EINA_UNUSED)
+{
+ Eina_Bool val = elm_check_state_get(obj);
+ Eina_Bool sel = elm_config_selection_unfocused_clear_get();
+
+ if (val == sel) return;
+ elm_config_selection_unfocused_clear_set(val);
+ elm_config_all_flush();
+}
+
+static void
+dbg_change(void *data EINA_UNUSED,
+ Evas_Object *obj,
+ void *event_info EINA_UNUSED)
+{
+ Eina_Bool val = elm_check_state_get(obj);
+ Eina_Bool sel = elm_config_clouseau_enabled_get();
+
+ if (val == sel) return;
+ elm_config_clouseau_enabled_set(val);
+ elm_config_all_flush();
+}
+
+static void
+atspi_change(void *data EINA_UNUSED,
+ Evas_Object *obj,
+ void *event_info EINA_UNUSED)
+{
+ Eina_Bool val = elm_check_state_get(obj);
+ Eina_Bool sel = elm_config_atspi_mode_get();
+
+ if (val == sel) return;
+ elm_config_atspi_mode_set(val);
+ elm_config_all_flush();
+}
+
+static void
+transition_duration_change(void *data EINA_UNUSED,
+ Evas_Object *obj,
+ void *event_info EINA_UNUSED)
+{
+ double val = elm_slider_value_get(obj);
+ Eina_Bool scale = elm_config_transition_duration_factor_get();
+
+ if (scale == val) return;
+ elm_config_transition_duration_factor_set(val);
+ elm_config_all_flush();
+}
+
+static void
+_status_basic(Evas_Object *win,
+ Evas_Object *bx0)
+{
+ Evas_Object *lb, *fr;
+
+ fr = elm_frame_add(win);
+ evas_object_size_hint_weight_set(fr, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ elm_object_text_set(fr, "Information");
+ elm_box_pack_end(bx0, fr);
+ evas_object_show(fr);
+
+ lb = elm_label_add(win);
+ elm_object_text_set(lb,
+ "Applying configuration change"
+ );
+ elm_object_content_set(fr, lb);
+ evas_object_show(lb);
+}
+
+static void
+_status_config(Evas_Object *win,
+ Evas_Object *bx0)
+{
+ Evas_Object *lb, *pd, *bx, *fr, *sl, *sp;
+
+ fr = elm_frame_add(win);
+ evas_object_size_hint_weight_set(fr, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(fr, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ elm_object_text_set(fr, "Sizing");
+ elm_box_pack_end(bx0, fr);
+ evas_object_show(fr);
+
+ bx = elm_box_add(win);
+ evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, 0.0);
+ evas_object_size_hint_align_set(bx, EVAS_HINT_FILL, 0.5);
+
+ LABEL_FRAME_ADD("<hilight>Scale</>");
+
+ sl = elm_slider_add(win);
+ evas_object_size_hint_weight_set(sl, EVAS_HINT_EXPAND, 0.0);
+ evas_object_size_hint_align_set(sl, EVAS_HINT_FILL, 0.5);
+ elm_slider_span_size_set(sl, 120);
+ elm_slider_unit_format_set(sl, "%1.2f");
+ elm_slider_indicator_format_set(sl, "%1.2f");
+ elm_slider_min_max_set(sl, 0.25, 5.0);
+ elm_slider_value_set(sl, elm_config_scale_get());
+ elm_box_pack_end(bx, sl);
+ evas_object_show(sl);
+
+ evas_object_smart_callback_add(sl, "changed", sc_round, NULL);
+ evas_object_smart_callback_add(sl, "delay,changed", sc_change, NULL);
+
+ sp = elm_separator_add(win);
+ elm_separator_horizontal_set(sp, EINA_TRUE);
+ evas_object_size_hint_weight_set(sp, EVAS_HINT_EXPAND, 0.0);
+ evas_object_size_hint_align_set(sp, EVAS_HINT_FILL, 0.5);
+ elm_box_pack_end(bx, sp);
+ evas_object_show(sp);
+
+ LABEL_FRAME_ADD("<hilight>Finger Size</><br/>");
+
+ sl = elm_slider_add(win);
+ evas_object_size_hint_weight_set(sl, EVAS_HINT_EXPAND, 0.0);
+ evas_object_size_hint_align_set(sl, EVAS_HINT_FILL, 0.5);
+ elm_slider_span_size_set(sl, 120);
+ elm_slider_unit_format_set(sl, "%1.0f");
+ elm_slider_indicator_format_set(sl, "%1.0f");
+ elm_slider_min_max_set(sl, 5, 200);
+ elm_slider_value_set(sl, elm_config_finger_size_get());
+ elm_box_pack_end(bx, sl);
+ evas_object_show(sl);
+
+ evas_object_smart_callback_add(sl, "changed", fs_round, NULL);
+ evas_object_smart_callback_add(sl, "delay,changed", fs_change, NULL);
+
+ // FIXME: add theme selector (basic mode and advanced for fallbacks)
+ // FIXME: save config
+ // FIXME: profile selector / creator etc.
+ elm_object_content_set(fr, bx);
+ evas_object_show(bx);
+}
+
+static void
+_flip_to(Evas_Object *win,
+ const char *name)
+{
+ Evas_Object *wid, *naviframe;
+ wid = evas_object_data_get(win, name);
+ naviframe = evas_object_data_get(win, "naviframe");
+ if (!naviframe) return;
+ elm_naviframe_item_simple_promote(naviframe, wid);
+}
+
+static void
+_cf_sizing(void *data,
+ Evas_Object *obj EINA_UNUSED,
+ void *event_info EINA_UNUSED)
+{
+ _flip_to(data, "sizing");
+}
+
+static void
+_cf_themes(void *data,
+ Evas_Object *obj EINA_UNUSED,
+ void *event_info EINA_UNUSED)
+{
+ _flip_to(data, "themes");
+}
+
+static void
+_cf_fonts(void *data,
+ Evas_Object *obj EINA_UNUSED,
+ void *event_info EINA_UNUSED)
+{
+ _flip_to(data, "fonts");
+}
+
+static void
+_cf_profiles(void *data,
+ Evas_Object *obj EINA_UNUSED,
+ void *event_info EINA_UNUSED)
+{
+ _flip_to(data, "profiles");
+}
+
+static void
+_cf_scrolling(void *data,
+ Evas_Object *obj EINA_UNUSED,
+ void *event_info EINA_UNUSED)
+{
+ _flip_to(data, "scrolling");
+}
+
+static void
+_cf_rendering(void *data,
+ Evas_Object *obj EINA_UNUSED,
+ void *event_info EINA_UNUSED)
+{
+ _flip_to(data, "rendering");
+}
+
+static void
+_cf_caches(void *data,
+ Evas_Object *obj EINA_UNUSED,
+ void *event_info EINA_UNUSED)
+{
+ _flip_to(data, "caches");
+}
+
+static void
+_cf_audio(void *data,
+ Evas_Object *obj EINA_UNUSED,
+ void *event_info EINA_UNUSED)
+{
+ _flip_to(data,"audio");
+}
+
+static void
+_cf_focus(void *data,
+ Evas_Object *obj EINA_UNUSED,
+ void *event_info EINA_UNUSED)
+{
+ _flip_to(data, "focus");
+}
+
+static void
+_cf_etc(void *data,
+ Evas_Object *obj EINA_UNUSED,
+ void *event_info EINA_UNUSED)
+{
+ _flip_to(data,"etc");
+}
+
+const char *
+_elm_theme_current_get(const char *theme_search_order)
+{
+ const char *ret;
+ const char *p;
+
+ if (!theme_search_order)
+ return NULL;
+
+ for (p = theme_search_order;; p++)
+ {
+ if ((*p == ':') || (!*p))
+ {
+ if (p > theme_search_order)
+ {
+ char *n = malloc(p - theme_search_order + 1);
+ if (!n)
+ return NULL;
+
+ strncpy(n, theme_search_order, p - theme_search_order);
+ n[p - theme_search_order] = 0;
+ ret = eina_stringshare_add(n);
+ free(n);
+ break;
+ }
+ }
+ }
+
+ return ret;
+}
+
+static void
+_font_overlay_set_all(void *data,
+ Evas_Object *obj EINA_UNUSED,
+ void *event_info EINA_UNUSED)
+{
+ Evas_Object *win, *fclasses;
+ Elm_Text_Class_Data *tc_data, *tc;
+ Elm_Object_Item *list_it;
+ Eina_List *l;
+
+ win = data;
+
+ fclasses = evas_object_data_get(win, "font_classes_list");
+ list_it = elm_list_selected_item_get(fclasses);
+ if (!list_it) return;
+ tc_data = elm_object_item_data_get(list_it);
+ if (!tc_data) return;
+
+ EINA_LIST_FOREACH(fndata.text_classes, l, tc)
+ {
+ eina_stringshare_replace(&tc->font, tc_data->font);
+ eina_stringshare_replace(&tc->style, tc_data->style);
+ tc->size = tc_data->size;
+ }
+
+ elm_config_all_flush();
+}
+
+static void
+_font_overlay_reset(void *data,
+ Evas_Object *obj EINA_UNUSED,
+ void *event_info EINA_UNUSED)
+{
+ Evas_Object *win, *fclasses, *fnames, *fstyles, *fsizes;
+ Elm_Text_Class_Data *tc_data;
+ Elm_Object_Item *list_it;
+
+ win = data;
+
+ fclasses = evas_object_data_get(win, "font_classes_list");
+ list_it = elm_list_selected_item_get(fclasses);
+ if (!list_it) return;
+ tc_data = elm_object_item_data_get(list_it);
+ if (!tc_data) return;
+
+ fnames = evas_object_data_get(win, "font_names_list");
+ fstyles = evas_object_data_get(win, "font_styles_list");
+ fsizes = evas_object_data_get(win, "font_sizes_list");
+
+ elm_config_font_overlay_unset(tc_data->name);
+
+ eina_stringshare_replace(&fndata.cur_font, NULL);
+ eina_stringshare_replace(&tc_data->font, NULL);
+ eina_stringshare_replace(&fndata.cur_style, NULL);
+ eina_stringshare_replace(&tc_data->style, NULL);
+ fndata.cur_size = 0.0;
+ tc_data->size = 0.0;
+
+ ELM_LIST_DISABLE(fnames);
+ ELM_LIST_DISABLE(fstyles);
+ ELM_LIST_DISABLE(fsizes);
+
+ elm_config_all_flush();
+}
+
+static void
+_font_overlay_reset_all(void *data,
+ Evas_Object *obj EINA_UNUSED,
+ void *event_info EINA_UNUSED)
+{
+ Evas_Object *win, *fclasses, *fnames, *fstyles, *fsizes;
+ Elm_Text_Class_Data *tc_data;
+ Elm_Object_Item *list_it;
+ Eina_List *l;
+
+ win = data;
+ eina_stringshare_replace(&fndata.cur_font, NULL);
+ eina_stringshare_replace(&fndata.cur_style, NULL);
+ fndata.cur_size = 0.0;
+
+ EINA_LIST_FOREACH(fndata.text_classes, l, tc_data)
+ {
+ elm_config_font_overlay_unset(tc_data->name);
+
+ eina_stringshare_replace(&tc_data->font, NULL);
+ eina_stringshare_replace(&tc_data->style, NULL);
+ tc_data->size = 0.0;
+ }
+
+ fclasses = evas_object_data_get(win, "font_classes_list");
+ fnames = evas_object_data_get(win, "font_names_list");
+ fstyles = evas_object_data_get(win, "font_styles_list");
+ fsizes = evas_object_data_get(win, "font_sizes_list");
+
+ list_it = elm_list_selected_item_get(fclasses);
+ if (list_it) elm_list_item_selected_set(list_it, EINA_FALSE);
+
+ ELM_LIST_DISABLE(fnames);
+ ELM_LIST_DISABLE(fstyles);
+ ELM_LIST_DISABLE(fsizes);
+
+ elm_config_all_flush();
+}
+
+static void
+_font_overlay_change(void *data EINA_UNUSED,
+ Evas_Object *obj EINA_UNUSED,
+ void *event_info EINA_UNUSED)
+{
+ Elm_Text_Class_Data *tc_data;
+ Eina_List *l;
+
+ EINA_LIST_FOREACH(fndata.text_classes, l, tc_data)
+ {
+ if (tc_data->font)
+ {
+ char *name;
+
+ name = elm_font_fontconfig_name_get(tc_data->font,
+ tc_data->style);
+ elm_config_font_overlay_set(tc_data->name, name,
+ tc_data->size ? tc_data->size : -100);
+ elm_font_fontconfig_name_free(name);
+ }
+ else
+ elm_config_font_overlay_unset(tc_data->name);
+ }
+
+ elm_config_font_overlay_apply();
+ elm_config_all_flush();
+
+ /* TODO: apply hinting */
+}
+
+static void
+_config_display_update(Evas_Object *win)
+{
+ int flush_interval, font_c, image_c, edje_file_c, edje_col_c, ts_threshould,
+ ts_hold_threshold;
+ double scale, s_bounce_friction, ts_momentum_threshold,
+ ts_flick_distance_tolerance, ts_friction,
+ ts_min_friction, ts_friction_standard, ts_border_friction,
+ ts_sensitivity_friction, ts_acceleration_threshold,
+ ts_acceleration_time_limit, ts_acceleration_weight, page_friction,
+ bring_in_friction, zoom_friction, transition_duration,
+ smooth_amount, smooth_time_window;
+ const char *curr_theme;
+ Eina_Bool s_bounce, ts, smooth_start;
+ Elm_Theme *th;
+ int fs;
+
+ scale = elm_config_scale_get();
+ fs = elm_config_finger_size_get();
+ flush_interval = elm_config_cache_flush_interval_get();
+ font_c = elm_config_cache_font_cache_size_get();
+ image_c = elm_config_cache_image_cache_size_get();
+ transition_duration = elm_config_transition_duration_factor_get();
+ edje_file_c = elm_config_cache_edje_file_cache_size_get();
+ edje_col_c = elm_config_cache_edje_collection_cache_size_get();
+
+ s_bounce = elm_config_scroll_bounce_enabled_get();
+ s_bounce_friction = elm_config_scroll_bounce_friction_get();
+ ts = elm_config_scroll_thumbscroll_enabled_get();
+ ts_threshould = elm_config_scroll_thumbscroll_threshold_get();
+ ts_hold_threshold = elm_config_scroll_thumbscroll_hold_threshold_get();
+ ts_momentum_threshold = elm_config_scroll_thumbscroll_momentum_threshold_get();
+ ts_flick_distance_tolerance = elm_config_scroll_thumbscroll_flick_distance_tolerance_get();
+ ts_friction = elm_config_scroll_thumbscroll_friction_get();
+ ts_min_friction = elm_config_scroll_thumbscroll_min_friction_get();
+ ts_friction_standard = elm_config_scroll_thumbscroll_friction_standard_get();
+ ts_border_friction = elm_config_scroll_thumbscroll_border_friction_get();
+ ts_sensitivity_friction = elm_config_scroll_thumbscroll_sensitivity_friction_get();
+ ts_acceleration_threshold = elm_config_scroll_thumbscroll_acceleration_threshold_get();
+ ts_acceleration_time_limit = elm_config_scroll_thumbscroll_acceleration_time_limit_get();
+ ts_acceleration_weight = elm_config_scroll_thumbscroll_acceleration_weight_get();
+ page_friction = elm_config_scroll_page_scroll_friction_get();
+ bring_in_friction = elm_config_scroll_bring_in_scroll_friction_get();
+ zoom_friction = elm_config_scroll_zoom_friction_get();
+ smooth_start = elm_config_scroll_thumbscroll_smooth_start_get();
+ smooth_amount = elm_config_scroll_thumbscroll_smooth_amount_get();
+ smooth_time_window = elm_config_scroll_thumbscroll_smooth_time_window_get();
+
+ /* gotta update root windows' atoms */
+ elm_slider_value_set(evas_object_data_get(win, "scale_slider"), scale);
+ elm_slider_value_set(evas_object_data_get(win, "fs_slider"), fs);
+
+ elm_slider_value_set(evas_object_data_get(win,
+ "cache_flush_interval_slider"),
+ flush_interval);
+ elm_slider_value_set(evas_object_data_get(win, "font_cache_slider"),
+ font_c / 1024.0);
+ elm_slider_value_set(evas_object_data_get(win, "image_cache_slider"),
+ image_c / 1024.0);
+ elm_slider_value_set(evas_object_data_get(win, "edje_file_cache_slider"),
+ edje_file_c);
+ elm_slider_value_set(evas_object_data_get(win,
+ "edje_collection_cache_slider"),
+ edje_col_c);
+
+ elm_check_state_set(evas_object_data_get(win, "scroll_bounce_check"),
+ s_bounce);
+ elm_slider_value_set(evas_object_data_get(win, "bounce_friction_slider"),
+ s_bounce_friction);
+ elm_check_state_set(evas_object_data_get(win, "thumbscroll_check"), ts);
+ elm_slider_value_set(evas_object_data_get(win,
+ "ts_threshold_slider"),
+ ts_threshould);
+ elm_slider_value_set(evas_object_data_get(win,
+ "ts_hold_threshold_slider"),
+ ts_hold_threshold);
+ elm_slider_value_set(evas_object_data_get(win,
+ "ts_momentum_threshold_slider"),
+ ts_momentum_threshold);
+ elm_slider_value_set(evas_object_data_get(win,
+ "ts_flick_distance_tolerance_slider"),
+ ts_flick_distance_tolerance);
+ elm_slider_value_set(evas_object_data_get(win,
+ "ts_friction_slider"),
+ ts_friction);
+ elm_slider_value_set(evas_object_data_get(win,
+ "ts_min_friction_slider"),
+ ts_min_friction);
+ elm_slider_value_set(evas_object_data_get(win,
+ "ts_friction_standard_slider"),
+ ts_friction_standard);
+ elm_slider_value_set(evas_object_data_get(win, "ts_border_friction_slider"),
+ ts_border_friction);
+ elm_slider_value_set(evas_object_data_get(win, "ts_sensitivity_friction_slider"),
+ ts_sensitivity_friction);
+ elm_slider_value_set(evas_object_data_get(win, "ts_acceleration_threshold_slider"),
+ ts_acceleration_threshold);
+ elm_slider_value_set(evas_object_data_get(win, "ts_acceleration_time_limit_slider"),
+ ts_acceleration_time_limit);
+ elm_slider_value_set(evas_object_data_get(win, "ts_acceleration_weight_slider"),
+ ts_acceleration_weight);
+ elm_slider_value_set(evas_object_data_get(win,
+ "page_scroll_friction_slider"),
+ page_friction);
+ elm_slider_value_set(evas_object_data_get(win,
+ "bring_in_scroll_friction_slider"),
+ bring_in_friction);
+ elm_slider_value_set(evas_object_data_get(win,
+ "zoom_scroll_friction_slider"),
+ zoom_friction);
+
+ elm_check_state_set(evas_object_data_get(win, "scroll_smooth_start"),
+ smooth_start);
+ elm_slider_value_set(evas_object_data_get(win,
+ "scroll_smooth_amount"),
+ smooth_amount);
+ elm_slider_value_set(evas_object_data_get(win,
+ "scroll_smooth_time_window"),
+ smooth_time_window);
+
+ curr_theme = _elm_theme_current_get(elm_theme_get(NULL));
+
+ th = elm_theme_new();
+ elm_theme_set(th, curr_theme);
+ elm_object_theme_set(evas_object_data_get(win, "theme_preview"), th);
+ elm_theme_free(th);
+ elm_config_transition_duration_factor_set(transition_duration);
+ eina_stringshare_del(curr_theme);
+}
+
+static Eina_Bool
+_config_all_changed(void *data,
+ int ev_type EINA_UNUSED,
+ void *ev EINA_UNUSED)
+{
+ Evas_Object *win = data;
+ _config_display_update(win);
+ return ECORE_CALLBACK_PASS_ON;
+}
+
+static void
+_profile_use(void *data,
+ Evas_Object *obj EINA_UNUSED,
+ void *event_info EINA_UNUSED)
+{
+ Evas_Object *li;
+ const char *selection;
+ const char *profile;
+
+ li = data;
+ selection = elm_object_item_data_get(elm_list_selected_item_get(li));
+ if (!selection) return;
+ profile = elm_config_profile_get();
+
+ if (!profile)
+ {
+ fprintf(stderr, "No profile currently set!\n"); /* FIXME: log domain */
+ return;
+ }
+
+ if (!strcmp(profile, selection))
+ return;
+
+ elm_config_profile_set(selection); /* just here to update info for getters below */
+
+ _config_display_update(elm_object_top_widget_get(li));
+ elm_config_all_flush();
+}
+
+static void
+_btn_todo(void *data EINA_UNUSED,
+ Evas_Object *obj EINA_UNUSED,
+ void *event_info EINA_UNUSED)
+{
+ printf("To be done!\n");
+}
+
+static void
+_profile_reset(void *data,
+ Evas_Object *obj EINA_UNUSED,
+ void *event_info EINA_UNUSED)
+{
+ const char *selection;
+ const char *pdir;
+ Evas_Object *li;
+
+ li = data;
+ selection = elm_object_item_data_get(elm_list_selected_item_get(li));
+ if (!selection) return;
+
+ elm_config_all_flush();
+
+ pdir = elm_config_profile_dir_get(selection, EINA_TRUE);
+ if (!pdir)
+ return;
+
+ ecore_file_recursive_rm(pdir);
+ elm_config_profile_dir_free(pdir);
+
+ elm_config_reload();
+
+ elm_config_all_flush();
+ _config_display_update(elm_object_top_widget_get(li));
+}
+
+static void
+_theme_use(void *data EINA_UNUSED,
+ Evas_Object *obj EINA_UNUSED,
+ void *event_info EINA_UNUSED)
+{
+ const char *defth;
+ Elm_Theme *th;
+ Evas_Object *win = elm_object_top_widget_get(obj);
+ Evas_Object *sample = evas_object_data_get(win, "theme_preview");
+
+ th = elm_object_theme_get(sample);
+ defth = elm_theme_get(th);
+ elm_theme_set(NULL, defth);
+ elm_config_all_flush();
+}
+
+static void
+_theme_sel(void *data EINA_UNUSED,
+ Evas_Object *obj,
+ void *event_info EINA_UNUSED)
+{
+ Evas_Object *win = elm_object_top_widget_get(obj);
+ Evas_Object *sample = evas_object_data_get(win, "theme_preview");
+ Elm_Theme *th;
+ Elm_Object_Item *list_it;
+ Eina_Strbuf *newth;
+ Eina_List *l;
+
+ if (!sample) return;
+ tsel = elm_list_selected_items_get(obj);
+ newth = eina_strbuf_new();
+ EINA_SAFETY_ON_NULL_RETURN(newth);
+ th = elm_theme_new();
+ if (!th)
+ {
+ eina_strbuf_free(newth);
+ return;
+ }
+ EINA_LIST_REVERSE_FOREACH((Eina_List*)tsel, l, list_it)
+ {
+ Theme *t = elm_object_item_data_get(list_it);
+ if (!t) continue;
+
+ eina_strbuf_append_printf(newth, "%s:", t->name);
+ if ((!l->prev) && strcmp(t->name, "default"))
+ /* ensure default theme is always there for fallback */
+ eina_strbuf_append(newth, "default");
+ }
+ elm_theme_set(th, eina_strbuf_string_get(newth));
+ eina_strbuf_free(newth);
+ elm_object_theme_set(sample, th);
+ elm_theme_free(th);
+}
+
+/*static void
+ _theme_browse(void *data, Evas_Object *obj, void *event_info)
+ {
+ printf("not implemented\n");
+ }*/
+
+static void
+_status_config_sizing(Evas_Object *win,
+ Evas_Object *naviframe)
+{
+ Evas_Object *lb, *pd, *bx, *sl, *sp;
+
+ bx = elm_box_add(win);
+ evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, 0.0);
+ evas_object_size_hint_align_set(bx, EVAS_HINT_FILL, 0.5);
+
+ LABEL_FRAME_ADD("<hilight>Scale</>");
+
+ sl = elm_slider_add(win);
+ evas_object_data_set(win, "scale_slider", sl);
+ evas_object_size_hint_weight_set(sl, EVAS_HINT_EXPAND, 0.0);
+ evas_object_size_hint_align_set(sl, EVAS_HINT_FILL, 0.5);
+ elm_slider_span_size_set(sl, 120);
+ elm_slider_unit_format_set(sl, "%1.2f");
+ elm_slider_indicator_format_set(sl, "%1.2f");
+ elm_slider_min_max_set(sl, 0.25, 5.0);
+ elm_slider_value_set(sl, elm_config_scale_get());
+ elm_box_pack_end(bx, sl);
+ evas_object_show(sl);
+
+ evas_object_smart_callback_add(sl, "changed", sc_round, NULL);
+ evas_object_smart_callback_add(sl, "delay,changed", sc_change, NULL);
+
+ sp = elm_separator_add(win);
+ elm_separator_horizontal_set(sp, EINA_TRUE);
+ evas_object_size_hint_weight_set(sp, EVAS_HINT_EXPAND, 0.0);
+ evas_object_size_hint_align_set(sp, EVAS_HINT_FILL, 0.5);
+ elm_box_pack_end(bx, sp);
+ evas_object_show(sp);
+
+ LABEL_FRAME_ADD("<hilight>Finger Size</><br/>");
+
+ sl = elm_slider_add(win);
+ evas_object_data_set(win, "fs_slider", sl);
+ evas_object_size_hint_weight_set(sl, EVAS_HINT_EXPAND, 0.0);
+ evas_object_size_hint_align_set(sl, EVAS_HINT_FILL, 0.5);
+ elm_slider_span_size_set(sl, 120);
+ elm_slider_unit_format_set(sl, "%1.0f");
+ elm_slider_indicator_format_set(sl, "%1.0f");
+ elm_slider_min_max_set(sl, 5, 200);
+ elm_slider_value_set(sl, elm_config_finger_size_get());
+ elm_box_pack_end(bx, sl);
+ evas_object_show(sl);
+
+ evas_object_smart_callback_add(sl, "changed", fs_round, NULL);
+ evas_object_smart_callback_add(sl, "delay,changed", fs_change, NULL);
+
+ evas_object_data_set(win, "sizing", bx);
+
+ elm_naviframe_item_simple_push(naviframe, bx);
+}
+
+#define MUTE_CB(_cb, _chan) \
+static void \
+_cb(void *data EINA_UNUSED, \
+ Evas_Object *obj, \
+ void *event_info EINA_UNUSED) \
+{ \
+ Eina_Bool val = elm_check_state_get(obj); \
+ Eina_Bool v = elm_config_audio_mute_get(_chan); \
+ if (val == v) return; \
+ elm_config_audio_mute_set(_chan, val); \
+ elm_config_all_flush(); \
+}
+
+MUTE_CB(mute_effect_change, EDJE_CHANNEL_EFFECT)
+MUTE_CB(mute_background_change, EDJE_CHANNEL_BACKGROUND)
+MUTE_CB(mute_music_change, EDJE_CHANNEL_MUSIC)
+MUTE_CB(mute_foreground_change, EDJE_CHANNEL_FOREGROUND)
+MUTE_CB(mute_interface_change, EDJE_CHANNEL_INTERFACE)
+MUTE_CB(mute_input_change, EDJE_CHANNEL_INPUT)
+MUTE_CB(mute_alert_change, EDJE_CHANNEL_ALERT)
+MUTE_CB(mute_all_change, EDJE_CHANNEL_ALL)
+
+static void
+_status_config_audio(Evas_Object *win,
+ Evas_Object *naviframe)
+{
+ Evas_Object *bx, *ck;
+
+ bx = elm_box_add(win);
+ evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, 0.0);
+ evas_object_size_hint_align_set(bx, EVAS_HINT_FILL, 0.5);
+
+#define MUTE_CHECK(_label, _chan, _cb) \
+ CHECK_ADD(_label, _label, _cb, NULL) \
+ elm_check_state_set(ck, elm_config_audio_mute_get(_chan));
+
+ MUTE_CHECK("Mute Effects", EDJE_CHANNEL_EFFECT, mute_effect_change);
+ MUTE_CHECK("Mute Background", EDJE_CHANNEL_BACKGROUND, mute_background_change);
+ MUTE_CHECK("Mute Music", EDJE_CHANNEL_MUSIC, mute_music_change);
+ MUTE_CHECK("Mute Foreground", EDJE_CHANNEL_FOREGROUND, mute_foreground_change);
+ MUTE_CHECK("Mute Interface", EDJE_CHANNEL_INTERFACE, mute_interface_change);
+ MUTE_CHECK("Mute Input", EDJE_CHANNEL_INPUT, mute_input_change);
+ MUTE_CHECK("Mute Alert", EDJE_CHANNEL_ALERT, mute_alert_change);
+ MUTE_CHECK("Mute Everything", EDJE_CHANNEL_ALL, mute_all_change);
+
+ evas_object_data_set(win, "audio", bx);
+
+ elm_naviframe_item_simple_push(naviframe, bx);
+}
+
+static void
+_config_focus_highlight_enabled_cb(void *data EINA_UNUSED, Evas_Object *obj,
+ void *event_info EINA_UNUSED)
+{
+ Eina_Bool cf = elm_config_focus_highlight_enabled_get();
+ Eina_Bool val = elm_check_state_get(obj);
+
+ printf("%d %d\n", cf, val);
+ if (cf == val) return;
+ elm_config_focus_highlight_enabled_set(val);
+ elm_config_all_flush();
+}
+
+static void
+_config_focus_highlight_anim_cb(void *data EINA_UNUSED, Evas_Object *obj,
+ void *event_info EINA_UNUSED)
+{
+ Eina_Bool cf = elm_config_focus_highlight_animate_get();
+ Eina_Bool val = elm_check_state_get(obj);
+
+ if (cf == val) return;
+ elm_config_focus_highlight_animate_set(val);
+ elm_config_all_flush();
+}
+
+static void
+_config_focus_highlight_clip_cb(void *data EINA_UNUSED, Evas_Object *obj,
+ void *event_info EINA_UNUSED)
+{
+ Eina_Bool cf = elm_config_focus_highlight_clip_disabled_get();
+ Eina_Bool val = elm_check_state_get(obj);
+
+ if (cf == val) return;
+ elm_config_focus_highlight_clip_disabled_set(val);
+ elm_config_all_flush();
+}
+
+static void
+_config_focus_item_select_on_focus_cb(void *data EINA_UNUSED, Evas_Object *obj,
+ void *event_info EINA_UNUSED)
+{
+ Eina_Bool cf = elm_config_item_select_on_focus_disabled_get();
+ Eina_Bool val = elm_check_state_get(obj);
+
+ if (cf == val) return;
+ elm_config_item_select_on_focus_disabled_set(val);
+ elm_config_all_flush();
+}
+
+static void
+_status_config_focus_autoscroll_changed_cb(void *data EINA_UNUSED,
+ Evas_Object *obj,
+ void *event_info EINA_UNUSED)
+{
+ elm_config_focus_autoscroll_mode_set(elm_radio_value_get(obj));
+}
+
+static void
+_config_focus_auto_show_cb(void *data EINA_UNUSED, Evas_Object *obj,
+ void *event_info EINA_UNUSED)
+{
+ Eina_Bool cf = elm_config_window_auto_focus_enable_get();
+ Eina_Bool val = elm_check_state_get(obj);
+
+ if (cf == val) return;
+ elm_config_window_auto_focus_enable_set(val);
+ elm_config_all_flush();
+}
+
+static void
+_config_focus_auto_animate_cb(void *data EINA_UNUSED, Evas_Object *obj,
+ void *event_info EINA_UNUSED)
+{
+ Eina_Bool cf = elm_config_window_auto_focus_animate_get();
+ Eina_Bool val = elm_check_state_get(obj);
+
+ if (cf == val) return;
+ elm_config_window_auto_focus_animate_set(val);
+ elm_config_all_flush();
+}
+
+static void
+_status_config_focus(Evas_Object *win,
+ Evas_Object *naviframe)
+{
+ Evas_Object *bx, *ck, *fr;
+
+ bx = elm_box_add(win);
+
+ CHECK_ADD("Enable Focus Highlight (only new window)",
+ "Set whether enable/disable focus highlight.<br/>"
+ "This feature is disabled by default.",
+ _config_focus_highlight_enabled_cb, NULL);
+ elm_check_state_set(ck, elm_config_focus_highlight_enabled_get());
+
+ CHECK_ADD("Enable Focus Highlight Animation (only new window)",
+ "Set whether enable/disable focus highlight animation.<br/>"
+ "This feature is disabled by default",
+ _config_focus_highlight_anim_cb, NULL);
+ elm_check_state_set(ck, elm_config_focus_highlight_animate_get());
+
+ CHECK_ADD("Disable Focus Highlight clip",
+ "Set whether enable/disable focus highlight clip feature.<br/>"
+ "If the focus highlight clip is disabled,<br/>"
+ "focus highlight object would not be clipped"
+ "by the target object's parent",
+ _config_focus_highlight_clip_cb, NULL);
+ elm_check_state_set(ck, elm_config_focus_highlight_clip_disabled_get());
+
+ CHECK_ADD("Disable Item Select on Focus",
+ "Set whether item would be selected on item focus.<br/>"
+ "This is enabled by default.",
+ _config_focus_item_select_on_focus_cb, NULL);
+ elm_check_state_set(ck, elm_config_item_select_on_focus_disabled_get());
+
+ CHECK_ADD("Enable Automatic focus display",
+ "Set whether enable/disable focus highlight automatically.",
+ _config_focus_auto_show_cb, NULL);
+ elm_check_state_set(ck, elm_config_window_auto_focus_enable_get());
+ CHECK_ADD("Enable Automatic focus animation",
+ "Set whether enable/disable focus highlight animation<br/>"
+ "automatically when automatic focus shows.",
+ _config_focus_auto_animate_cb, NULL);
+ elm_check_state_set(ck, elm_config_window_auto_focus_enable_get());
+
+ fr = elm_frame_add(bx);
+ elm_object_text_set(fr, "Focus Autoscroll Mode");
+ evas_object_size_hint_weight_set(fr, EVAS_HINT_EXPAND, 0.0);
+ evas_object_size_hint_align_set(fr, EVAS_HINT_FILL, 0.5);
+ elm_box_pack_end(bx, fr);
+ evas_object_show(fr);
+ {
+ Evas_Object *bx2, *rdg, *rd;
+ bx2 = elm_box_add(fr);
+ elm_object_content_set(fr, bx2);
+ evas_object_show(bx2);
+
+ rdg = rd = elm_radio_add(bx2);
+ elm_radio_state_value_set(rd, ELM_FOCUS_AUTOSCROLL_MODE_SHOW);
+ elm_object_text_set(rd, "ELM_FOCUS_AUTOSCROLL_MODE_SHOW");
+ elm_object_tooltip_text_set(rd, "Directly show the focused region<br/>"
+ "or item automatically inside a scroller.");
+ evas_object_size_hint_weight_set(rd, EVAS_HINT_EXPAND, 0.0);
+ evas_object_size_hint_align_set(rd, 0.0, EVAS_HINT_FILL);
+ elm_box_pack_end(bx2, rd);
+ evas_object_show(rd);
+ evas_object_smart_callback_add(rd, "changed",
+ _status_config_focus_autoscroll_changed_cb,
+ NULL);
+
+ rd = elm_radio_add(bx2);
+ elm_radio_state_value_set(rd, ELM_FOCUS_AUTOSCROLL_MODE_NONE);
+ elm_object_text_set(rd, "ELM_FOCUS_AUTOSCROLL_MODE_NONE");
+ elm_object_tooltip_text_set(rd, "Do not show the focused region or<br/>"
+ "item automatically inside a scroller.");
+ evas_object_size_hint_weight_set(rd, EVAS_HINT_EXPAND, 0.0);
+ evas_object_size_hint_align_set(rd, 0.0, EVAS_HINT_FILL);
+ elm_box_pack_end(bx2, rd);
+ elm_radio_group_add(rd, rdg);
+ evas_object_show(rd);
+ evas_object_smart_callback_add(rd, "changed",
+ _status_config_focus_autoscroll_changed_cb,
+ NULL);
+
+
+ rd = elm_radio_add(bx2);
+ elm_radio_state_value_set(rd, ELM_FOCUS_AUTOSCROLL_MODE_BRING_IN);
+ elm_object_text_set(rd, "ELM_FOCUS_AUTOSCROLL_MODE_BRING_IN");
+ elm_object_tooltip_text_set(rd, "Bring in the focused region or item<br/>"
+ "automatically which might invole the scrolling.");
+ evas_object_size_hint_weight_set(rd, EVAS_HINT_EXPAND, 0.0);
+ evas_object_size_hint_align_set(rd, 0.0, EVAS_HINT_FILL);
+ elm_box_pack_end(bx2, rd);
+ elm_radio_group_add(rd, rdg);
+ evas_object_show(rd);
+ evas_object_smart_callback_add(rd, "changed",
+ _status_config_focus_autoscroll_changed_cb,
+ NULL);
+
+ elm_radio_value_set(rdg, elm_config_focus_autoscroll_mode_get());
+ }
+
+ evas_object_data_set(win, "focus", bx);
+
+ elm_naviframe_item_simple_push(naviframe, bx);
+}
+
+static void
+_status_config_etc(Evas_Object *win,
+ Evas_Object *naviframe)
+{
+ Evas_Object *bx, *ck, *sl, *fr, *bx2, *fr2, *bx3, *en;
+
+ bx = elm_box_add(win);
+ evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, 0.0);
+ evas_object_size_hint_align_set(bx, EVAS_HINT_FILL, 0.5);
+
+ // access
+ CHECK_ADD("Enable Access Mode", "Set access mode", ac_change, NULL);
+ elm_check_state_set(ck, elm_config_access_get());
+
+ // selection
+ CHECK_ADD("Enable clear selection when unfocus", "Set selection mode",
+ sel_change, NULL);
+ elm_check_state_set(ck, elm_config_selection_unfocused_clear_get());
+
+ // clouseau
+ CHECK_ADD("Enable clouseau", "Set clouseau mode", dbg_change, NULL);
+ elm_check_state_set(ck, elm_config_clouseau_enabled_get());
+
+ // atspi
+ CHECK_ADD("Enable ATSPI support", "Set atspi mode", atspi_change, NULL);
+ elm_check_state_set(ck, elm_config_atspi_mode_get());
+
+ // transition duration in edje
+ fr = elm_frame_add(bx);
+ elm_object_text_set(fr, "Edje Transition Duration Factor");
+ evas_object_size_hint_weight_set(fr, EVAS_HINT_EXPAND, 0.0);
+ evas_object_size_hint_align_set(fr, EVAS_HINT_FILL, 0.5);
+ elm_box_pack_end(bx, fr);
+ evas_object_show(fr);
+
+ bx2 = elm_box_add(fr);
+ elm_object_content_set(fr, bx2);
+ evas_object_show(bx2);
+
+ sl = elm_slider_add(bx2);
+ evas_object_size_hint_weight_set(sl, EVAS_HINT_EXPAND, 0.0);
+ evas_object_size_hint_align_set(sl, EVAS_HINT_FILL, 0.5);
+ elm_slider_span_size_set(sl, 120);
+ elm_slider_unit_format_set(sl, "%1.1f");
+ elm_slider_indicator_format_set(sl, "%1.1f");
+ elm_slider_min_max_set(sl, 0, 20.0);
+ elm_slider_value_set(sl, elm_config_transition_duration_factor_get());
+ elm_box_pack_end(bx2, sl);
+ evas_object_show(sl);
+ evas_object_smart_callback_add(sl, "changed", sc_round, NULL);
+ evas_object_smart_callback_add(sl, "delay,changed", transition_duration_change, NULL);
+
+ // Web backend
+ fr2 = elm_frame_add(bx);
+ elm_object_text_set(fr2, "Elm_Web backend");
+ evas_object_size_hint_weight_set(fr2, EVAS_HINT_EXPAND, 0.0);
+ evas_object_size_hint_align_set(fr2, EVAS_HINT_FILL, 0.5);
+ elm_box_pack_end(bx, fr2);
+ evas_object_show(fr2);
+
+ bx3 = elm_box_add(fr2);
+ elm_object_content_set(fr2, bx3);
+ evas_object_show(bx3);
+
+ en = elm_entry_add(win);
+ elm_entry_editable_set(en, EINA_TRUE);
+ elm_entry_scrollable_set(en, EINA_FALSE);
+ elm_object_text_set(en, elm_config_web_backend_get());
+ evas_object_size_hint_weight_set(en, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(en, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ evas_object_show(en);
+ elm_box_pack_end(bx3, en);
+
+ web_backend_entry = en;
+
+ evas_object_data_set(win, "etc", bx);
+
+ elm_naviframe_item_simple_push(naviframe, bx);
+}
+
+static Evas_Object *
+_sample_theme_new(Evas_Object *win)
+{
+ Evas_Object *base, *bg, *bt, *ck, *rd, *rdg, *sl, *fr, *li, *rc, *sp;
+
+ base = elm_table_add(win);
+ evas_object_size_hint_weight_set(base, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(base, EVAS_HINT_FILL, EVAS_HINT_FILL);
+
+ bg = elm_bg_add(win);
+ evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(bg, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ elm_table_pack(base, bg, 0, 0, 2, 5);
+ evas_object_show(bg);
+
+ bt = elm_button_add(win);
+ evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
+ elm_object_text_set(bt, "Button");
+ elm_table_pack(base, bt, 0, 0, 1, 1);
+ evas_object_show(bt);
+
+ ck = elm_check_add(win);
+ evas_object_size_hint_weight_set(ck, EVAS_HINT_EXPAND, 0.0);
+ elm_object_text_set(ck, "Check");
+ elm_table_pack(base, ck, 0, 1, 1, 1);
+ evas_object_show(ck);
+
+ rd = elm_radio_add(win);
+ evas_object_size_hint_weight_set(rd, EVAS_HINT_EXPAND, 0.0);
+ elm_radio_state_value_set(rd, 0);
+ elm_object_text_set(rd, "Radio 1");
+ elm_table_pack(base, rd, 1, 0, 1, 1);
+ evas_object_show(rd);
+ rdg = rd;
+
+ rd = elm_radio_add(win);
+ evas_object_size_hint_weight_set(rd, EVAS_HINT_EXPAND, 0.0);
+ elm_radio_state_value_set(rd, 1);
+ elm_object_text_set(rd, "Radio 2");
+ elm_radio_group_add(rd, rdg);
+ elm_table_pack(base, rd, 1, 1, 1, 1);
+ evas_object_show(rd);
+
+ sp = elm_separator_add(win);
+ elm_separator_horizontal_set(sp, EINA_TRUE);
+ evas_object_size_hint_weight_set(sp, EVAS_HINT_EXPAND, 0.0);
+ evas_object_size_hint_align_set(sp, EVAS_HINT_FILL, 0.5);
+ elm_table_pack(base, sp, 0, 2, 2, 1);
+ evas_object_show(sp);
+
+ sl = elm_slider_add(win);
+ elm_object_text_set(sl, "Slider");
+ elm_slider_span_size_set(sl, 120);
+ elm_slider_min_max_set(sl, 1, 10);
+ elm_slider_value_set(sl, 4);
+ evas_object_size_hint_weight_set(sl, EVAS_HINT_EXPAND, 0.0);
+ evas_object_size_hint_align_set(sl, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ elm_table_pack(base, sl, 0, 3, 2, 1);
+ evas_object_show(sl);
+
+ fr = elm_frame_add(win);
+ elm_object_text_set(fr, "Frame");
+ elm_table_pack(base, fr, 0, 4, 2, 1);
+ evas_object_size_hint_weight_set(fr, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(fr, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ evas_object_show(fr);
+
+ li = elm_list_add(win);
+ evas_object_size_hint_weight_set(li, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(li, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ elm_object_content_set(fr, li);
+ evas_object_show(li);
+
+ elm_list_item_append(li, "List Item 1", NULL, NULL, NULL, NULL);
+ elm_list_item_append(li, "Second Item", NULL, NULL, NULL, NULL);
+ elm_list_item_append(li, "Third Item", NULL, NULL, NULL, NULL);
+ elm_list_go(li);
+
+ rc = evas_object_rectangle_add(evas_object_evas_get(win));
+ evas_object_size_hint_weight_set(rc, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_min_set(rc, 160, 120);
+ elm_table_pack(base, rc, 0, 4, 2, 1);
+
+ return base;
+}
+
+static void
+_status_config_themes(Evas_Object *win,
+ Evas_Object *naviframe)
+{
+ Evas_Object *tb, *rc, *sc, *sp, *li, *pd, *fr, *bt, *sample;
+ Eina_List *list, *l;
+ char *th, *s, *ext;
+ Elm_Theme *d;
+ Elm_Object_Item *list_it, *def_it = NULL;
+ const char *theme_name, *sep[20];
+ unsigned int x;
+
+ tb = elm_table_add(win);
+ evas_object_size_hint_weight_set(tb, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(tb, EVAS_HINT_FILL, EVAS_HINT_FILL);
+
+ rc = evas_object_rectangle_add(evas_object_evas_get(win));
+ evas_object_size_hint_weight_set(rc, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_min_set(rc, 0, 130);
+ elm_table_pack(tb, rc, 0, 0, 1, 1);
+
+ rc = evas_object_rectangle_add(evas_object_evas_get(win));
+ evas_object_size_hint_weight_set(rc, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_min_set(rc, 0, 200);
+ elm_table_pack(tb, rc, 0, 1, 1, 1);
+
+ /////////////////////////////////////////////
+
+ pd = elm_frame_add(win);
+ elm_object_style_set(pd, "pad_medium");
+ evas_object_size_hint_weight_set(pd, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(pd, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ elm_table_pack(tb, pd, 0, 0, 1, 1);
+ evas_object_show(pd);
+
+ li = elm_list_add(win);
+ elm_list_multi_select_set(li, EINA_TRUE);
+ evas_object_size_hint_weight_set(li, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(li, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ elm_object_content_set(pd, li);
+ evas_object_show(li);
+
+ list = elm_theme_name_available_list_new();
+ d = elm_theme_default_get();
+ theme_name = elm_theme_get(d);
+ for (x = 1, sep[0] = theme_name; x < sizeof(sep) / sizeof(sep[0]); x++)
+ {
+ sep[x] = strchr(sep[x - 1] + 1, ':');
+ if (!sep[x]) break;
+ }
+ EINA_LIST_FOREACH(list, l, th)
+ {
+ Theme *t;
+ int y;
+
+ t = calloc(1, sizeof(Theme));
+ t->name = eina_stringshare_add(th);
+ s = elm_theme_list_item_path_get(th, &(t->in_search_path));
+ if (s)
+ {
+ t->path = eina_stringshare_add(s);
+ free(s);
+ }
+ if (t->in_search_path)
+ {
+ s = strdup(th);
+ if (s)
+ {
+ s[0] = toupper(s[0]);
+ t->label = eina_stringshare_add(s);
+ free(s);
+ }
+ else
+ t->label = eina_stringshare_add(s);
+ }
+ else
+ {
+ s = strdup(ecore_file_file_get(th));
+ if (s)
+ {
+ s[0] = toupper(s[0]);
+ ext = strrchr(s, '.');
+ if (ext) *ext = 0;
+ t->label = eina_stringshare_add(s);
+ free(s);
+ }
+ else
+ t->label = eina_stringshare_add(s);
+ }
+ themes = eina_list_append(themes, t);
+ list_it = elm_list_item_append(li, t->label, NULL, NULL, NULL, t);
+ if (!strcmp(t->name, "default")) def_it = list_it;
+ for (y = x - 1 /* ignore default e theme */; y > 0; y--)
+ {
+ const char *start = (sep[y - 1][0] == ':') ? sep[y - 1] + 1 : sep[y - 1];
+ unsigned int len = (unsigned int)(sep[y] - start);
+ if (strncmp(start , t->name, len) || (strlen(t->name) != len)) continue;
+
+ if (!elm_list_item_selected_get(list_it))
+ elm_list_item_selected_set(list_it, EINA_TRUE);
+ break;
+ }
+ }
+ if (!elm_list_selected_items_get(li))
+ elm_list_item_selected_set(def_it, EINA_TRUE);
+ evas_object_smart_callback_add(li, "selected", _theme_sel, NULL);
+ evas_object_smart_callback_add(li, "unselected", _theme_sel, NULL);
+ elm_theme_name_available_list_free(list);
+
+ elm_list_go(li);
+
+ pd = elm_frame_add(win);
+ elm_object_style_set(pd, "pad_medium");
+ evas_object_size_hint_weight_set(pd, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(pd, 0.9, 0.9);
+ elm_table_pack(tb, pd, 0, 0, 1, 1);
+ evas_object_show(pd);
+
+ /* FIXME: not implemented yet
+ bt = elm_button_add(win);
+ evas_object_smart_callback_add(bt, "clicked", _theme_browse, win);
+ elm_object_text_set(bt, "Browse...");
+ evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(bt, 0.9, 0.9);
+ elm_object_content_set(pd, bt);
+ evas_object_show(bt);
+ */
+ pd = elm_frame_add(win);
+ elm_object_style_set(pd, "pad_medium");
+ evas_object_size_hint_weight_set(pd, EVAS_HINT_EXPAND, 0.0);
+ evas_object_size_hint_align_set(pd, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ elm_table_pack(tb, pd, 0, 1, 1, 1);
+ evas_object_show(pd);
+
+ fr = elm_frame_add(win);
+ elm_object_text_set(fr, "Preview");
+ evas_object_size_hint_weight_set(fr, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(fr, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ elm_object_content_set(pd, fr);
+ evas_object_show(fr);
+
+ sc = elm_scroller_add(win);
+ elm_scroller_bounce_set(sc, EINA_FALSE, EINA_FALSE);
+ evas_object_size_hint_weight_set(sc, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(sc, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ elm_object_content_set(fr, sc);
+ evas_object_show(sc);
+
+ sample = _sample_theme_new(win);
+ elm_object_content_set(sc, sample);
+ evas_object_show(sample);
+ evas_object_data_set(win, "theme_preview", sample);
+
+ /////////////////////////////////////////////
+ sp = elm_separator_add(win);
+ elm_separator_horizontal_set(sp, EINA_TRUE);
+ evas_object_size_hint_weight_set(sp, EVAS_HINT_EXPAND, 0.0);
+ evas_object_size_hint_align_set(sp, EVAS_HINT_FILL, 0.5);
+ elm_table_pack(tb, sp, 0, 2, 1, 1);
+ evas_object_show(sp);
+
+ pd = elm_frame_add(win);
+ elm_object_style_set(pd, "pad_medium");
+ evas_object_size_hint_weight_set(pd, EVAS_HINT_EXPAND, 0.0);
+ evas_object_size_hint_align_set(pd, 0.5, 0.5);
+ elm_table_pack(tb, pd, 0, 3, 1, 1);
+ evas_object_show(pd);
+
+ bt = elm_button_add(win);
+ evas_object_smart_callback_add(bt, "clicked", _theme_use, win);
+ elm_object_text_set(bt, "Use Theme");
+ evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
+ evas_object_size_hint_align_set(bt, 0.5, 0.5);
+ elm_object_content_set(pd, bt);
+ evas_object_show(bt);
+
+ evas_object_data_set(win, "themes", tb);
+ elm_naviframe_item_simple_push(naviframe, tb);
+}
+
+static void
+_font_preview_update(Evas_Object *win)
+{
+ Evas_Font_Size sz;
+ char *name;
+
+ if (!fndata.cur_font)
+ return;
+
+ name = elm_font_fontconfig_name_get(fndata.cur_font, fndata.cur_style);
+ sz = fndata.cur_size;
+
+ if (sz < 0)
+ sz = (-sz * 10) / 100;
+ if (sz == 0)
+ sz = 10;
+
+ edje_object_text_class_set(evas_object_data_get(win, "font_preview"),
+ "font_preview", name, sz);
+
+ elm_font_fontconfig_name_free(name);
+}
+
+static void
+_font_classes_list_sel(void *data EINA_UNUSED,
+ Evas_Object *obj,
+ void *event_info)
+{
+ const Eina_List *f_names_items, *l;
+ Elm_Text_Class_Data *tc_data;
+ Evas_Object *f_names_list;
+ Elm_Object_Item *list_it;
+
+ tc_data = elm_object_item_data_get(event_info);
+ if (!tc_data) return;
+
+ f_names_list = evas_object_data_get(elm_object_top_widget_get(obj),
+ "font_names_list");
+ ELM_LIST_ENABLE(f_names_list);
+
+ f_names_items = elm_list_items_get(f_names_list);
+
+ EINA_LIST_FOREACH(f_names_items, l, list_it)
+ {
+ const char *s;
+
+ s = elm_object_item_text_get(list_it);
+ if (!s) continue;
+
+ if (tc_data->font && !strcmp(s, tc_data->font))
+ {
+ elm_list_item_selected_set(list_it, EINA_TRUE);
+ elm_list_item_show(list_it);
+ break;
+ }
+ }
+}
+
+static void
+_font_names_list_sel(void *data EINA_UNUSED,
+ Evas_Object *obj,
+ void *event_info)
+{
+ Evas_Object *style_list, *cls_list, *win;
+ const char *style, *sel_font;
+ Elm_Text_Class_Data *tc_data;
+ Elm_Object_Item *list_it, *fc_list_it;
+ Elm_Font_Properties *efp;
+ const Eina_List *l;
+
+ list_it = event_info;
+ sel_font = elm_object_item_text_get(list_it);
+
+ win = elm_object_top_widget_get(obj);
+ style_list = evas_object_data_get(win, "font_styles_list");
+ cls_list = evas_object_data_get(win, "font_classes_list");
+
+ fc_list_it = elm_list_selected_item_get(cls_list);
+ if (!fc_list_it) return; /* should not happen, fonts list disabled in
+ * this case */
+
+ eina_stringshare_replace(&fndata.cur_font, sel_font);
+
+ tc_data = elm_object_item_data_get(fc_list_it);
+ if (!tc_data) return;
+ if (tc_data->font) eina_stringshare_del(tc_data->font);
+ if (fndata.cur_font) tc_data->font = eina_stringshare_ref(fndata.cur_font);
+
+ /* load styles list */
+ efp = eina_hash_find(fndata.font_hash, sel_font);
+ if (!efp) return;
+
+ ELM_LIST_ENABLE(style_list);
+ elm_list_clear(style_list);
+
+ evas_event_freeze(evas_object_evas_get(style_list));
+ edje_freeze();
+
+ list_it = NULL;
+
+ EINA_LIST_FOREACH(efp->styles, l, style)
+ {
+ Elm_Object_Item *i;
+
+ i = elm_list_item_append(style_list, style, NULL, NULL,
+ _font_styles_list_sel, NULL);
+
+ if (tc_data->style && (!strcmp(style, tc_data->style)))
+ list_it = i;
+ }
+
+ elm_list_go(style_list);
+
+ edje_thaw();
+ evas_event_thaw(evas_object_evas_get(style_list));
+
+ if (list_it)
+ elm_list_item_selected_set(list_it, EINA_TRUE);
+
+ _font_preview_update(win);
+}
+
+static void
+_font_styles_list_sel(void *data EINA_UNUSED,
+ Evas_Object *obj,
+ void *event_info)
+{
+ Evas_Object *fc_list, *fs_list, *win;
+ Elm_Text_Class_Data *tc_data;
+ const Eina_List *l;
+ Elm_Object_Item *list_it;
+
+ win = elm_object_top_widget_get(obj);
+ fc_list = evas_object_data_get(win, "font_classes_list");
+ fs_list = evas_object_data_get(win, "font_sizes_list");
+
+ list_it = elm_list_selected_item_get(fc_list);
+ if (!list_it) return; /* should not happen */
+
+ eina_stringshare_replace(&fndata.cur_style,
+ elm_object_item_text_get(event_info));
+ ELM_LIST_ENABLE(fs_list);
+
+ tc_data = elm_object_item_data_get(list_it);
+ if (!tc_data) return;
+ eina_stringshare_del(tc_data->style);
+ tc_data->style = eina_stringshare_ref(fndata.cur_style);
+
+ evas_event_freeze(evas_object_evas_get(fs_list));
+ edje_freeze();
+
+ EINA_LIST_FOREACH(elm_list_items_get(fs_list), l, list_it)
+ {
+ Elm_Font_Size_Data *sdata;
+
+ sdata = elm_object_item_data_get(list_it);
+ if (!sdata) continue;
+ elm_list_item_selected_set(l->data, EINA_FALSE);
+
+ if (tc_data->size == sdata->size)
+ {
+ elm_list_item_selected_set(list_it, EINA_TRUE);
+ elm_list_item_show(list_it);
+ break;
+ }
+ }
+
+ edje_thaw();
+ evas_event_thaw(evas_object_evas_get(fs_list));
+
+ _font_preview_update(win);
+}
+
+static void
+_font_sizes_list_sel(void *data EINA_UNUSED,
+ Evas_Object *obj EINA_UNUSED,
+ void *event_info EINA_UNUSED)
+{
+ Elm_Text_Class_Data *tc_data;
+ Evas_Object *fc_list, *win;
+ Elm_Font_Size_Data *sd;
+ Elm_Object_Item *list_it;
+
+ win = elm_object_top_widget_get(obj);
+ fc_list = evas_object_data_get(win, "font_classes_list");
+
+ list_it = elm_list_selected_item_get(fc_list);
+ if (!list_it) return; /* should not happen */
+ sd = elm_object_item_data_get(event_info);
+ if (!sd) return;
+
+ fndata.cur_size = sd->size;
+
+ tc_data = elm_object_item_data_get(list_it);
+ if (!tc_data) return;
+ tc_data->size = fndata.cur_size;
+
+ _font_preview_update(win);
+}
+
+static void
+_fstyle_list_unselect_cb(void *data EINA_UNUSED,
+ Evas_Object *obj,
+ void *event_info EINA_UNUSED)
+{
+ Evas_Object *sizes_list, *win;
+
+ if (elm_list_selected_item_get(obj)) return;
+
+ win = elm_object_top_widget_get(obj);
+
+ sizes_list = evas_object_data_get(win, "font_sizes_list");
+ ELM_LIST_DISABLE(sizes_list);
+}
+
+static void
+_fc_list_unselect_cb(void *data EINA_UNUSED,
+ Evas_Object *obj,
+ void *event_info EINA_UNUSED)
+{
+ Evas_Object *font_names_list, *styles_list, *sizes_list, *win;
+
+ if (elm_list_selected_item_get(obj)) return;
+
+ win = elm_object_top_widget_get(obj);
+
+ font_names_list = evas_object_data_get(win, "font_names_list");
+ ELM_LIST_DISABLE(font_names_list);
+
+ styles_list = evas_object_data_get(win, "font_styles_list");
+ ELM_LIST_DISABLE(styles_list);
+
+ sizes_list = evas_object_data_get(win, "font_sizes_list");
+ ELM_LIST_DISABLE(sizes_list);
+}
+
+static void
+_font_classes_list_load(Evas_Object *li)
+{
+ Elm_Text_Class_Data *tc_data;
+ Eina_List *l;
+ Evas *evas;
+
+ evas = evas_object_evas_get(li);
+ evas_event_freeze(evas);
+ edje_freeze();
+
+ EINA_LIST_FOREACH(fndata.text_classes, l, tc_data)
+ elm_list_item_append(li, tc_data->desc, NULL, NULL,
+ _font_classes_list_sel, tc_data);
+
+ evas_object_smart_callback_add(li, "unselected", _fc_list_unselect_cb,
+ NULL);
+
+ elm_list_go(li);
+ edje_thaw();
+ evas_event_thaw(evas);
+}
+
+static void
+_fonts_data_fill(Evas *evas)
+{
+ const Eina_List *fo_list, *l;
+ Eina_List *text_classes;
+ Elm_Text_Class_Data *tc_data;
+ Elm_Font_Size_Data *sd;
+ Elm_Font_Overlay *efo;
+ Eina_List *evas_fonts;
+ Elm_Text_Class *etc;
+ int i;
+
+ evas_fonts = evas_font_available_list(evas);
+ fndata.font_hash = elm_font_available_hash_add(evas_fonts);
+ evas_font_available_list_free(evas, evas_fonts);
+
+ text_classes = elm_config_text_classes_list_get();
+ fo_list = elm_config_font_overlay_list_get();
+
+ EINA_LIST_FOREACH(text_classes, l, etc)
+ {
+ const Eina_List *ll;
+
+ tc_data = calloc(1, sizeof(*tc_data));
+ if (!tc_data) continue;
+
+ tc_data->name = eina_stringshare_add(etc->name);
+ tc_data->desc = eina_stringshare_add(etc->desc);
+
+ EINA_LIST_FOREACH(fo_list, ll, efo)
+ {
+ if (strcmp(tc_data->name, efo->text_class))
+ continue;
+
+ if (efo->font)
+ {
+ Elm_Font_Properties *efp;
+
+ efp = elm_font_properties_get(efo->font);
+ if (efp)
+ {
+ tc_data->font = eina_stringshare_add(efp->name);
+ /* we're sure we recorded with only 1 style selected */
+ tc_data->style = eina_stringshare_add(efp->styles->data);
+ elm_font_properties_free(efp);
+ }
+ }
+ tc_data->size = efo->size;
+ }
+
+ fndata.text_classes = eina_list_append(fndata.text_classes, tc_data);
+ }
+
+ elm_config_text_classes_list_free(text_classes);
+
+ /* FIXME: hinting later */
+ /* fndata.hinting = e_config->font_hinting; */
+
+ sd = calloc(1, sizeof(Elm_Font_Size_Data));
+ sd->size_str = eina_stringshare_add("Tiny");
+ sd->size = -50;
+ fndata.font_scale_list = eina_list_append(fndata.font_scale_list, sd);
+
+ sd = calloc(1, sizeof(Elm_Font_Size_Data));
+ sd->size_str = eina_stringshare_add("Small");
+ sd->size = -80;
+ fndata.font_scale_list = eina_list_append(fndata.font_scale_list, sd);
+
+ sd = calloc(1, sizeof(Elm_Font_Size_Data));
+ sd->size_str = eina_stringshare_add("Normal");
+ sd->size = -100;
+ fndata.font_scale_list = eina_list_append(fndata.font_scale_list, sd);
+
+ sd = calloc(1, sizeof(Elm_Font_Size_Data));
+ sd->size_str = eina_stringshare_add("Big");
+ sd->size = -150;
+ fndata.font_scale_list = eina_list_append(fndata.font_scale_list, sd);
+
+ sd = calloc(1, sizeof(Elm_Font_Size_Data));
+ sd->size_str = eina_stringshare_add("Really Big");
+ sd->size = -190;
+ fndata.font_scale_list = eina_list_append(fndata.font_scale_list, sd);
+
+ sd = calloc(1, sizeof(Elm_Font_Size_Data));
+ sd->size_str = eina_stringshare_add("Huge");
+ sd->size = -250;
+ fndata.font_scale_list = eina_list_append(fndata.font_scale_list, sd);
+
+ for (i = 5; i < 51; i++)
+ {
+ char str[16];
+
+ str[0] = 0;
+ snprintf(str, sizeof(str), "%d pixels", i);
+
+ sd = calloc(1, sizeof(Elm_Font_Size_Data));
+ sd->size_str = eina_stringshare_add(str);
+ sd->size = i;
+ fndata.font_px_list = eina_list_append(fndata.font_px_list, sd);
+ }
+}
+
+static int
+_font_sort_cb(const void *data1,
+ const void *data2)
+{
+ if (!data1) return 1;
+ if (!data2) return -1;
+ return strcmp(data1, data2);
+}
+
+static void
+_font_sizes_list_load(Evas_Object *size_list)
+{
+ Elm_Font_Size_Data *size_data;
+ Eina_List *l;
+ Evas *evas;
+
+ evas = evas_object_evas_get(size_list);
+ evas_event_freeze(evas);
+ edje_freeze();
+
+ EINA_LIST_FOREACH(fndata.font_scale_list, l, size_data)
+ elm_list_item_append(size_list, size_data->size_str, NULL, NULL,
+ _font_sizes_list_sel, size_data);
+
+ EINA_LIST_FOREACH(fndata.font_px_list, l, size_data)
+ elm_list_item_append(size_list, size_data->size_str, NULL, NULL,
+ _font_sizes_list_sel, size_data);
+
+ elm_list_go(size_list);
+ edje_thaw();
+ evas_event_thaw(evas);
+}
+
+static void
+_fnames_list_unselect_cb(void *data EINA_UNUSED,
+ Evas_Object *obj,
+ void *event_info EINA_UNUSED)
+{
+ Evas_Object *styles_list, *sizes_list, *win;
+
+ if (elm_list_selected_item_get(obj)) return;
+
+ win = elm_object_top_widget_get(obj);
+
+ styles_list = evas_object_data_get(win, "font_styles_list");
+ ELM_LIST_DISABLE(styles_list);
+
+ sizes_list = evas_object_data_get(win, "font_sizes_list");
+ ELM_LIST_DISABLE(sizes_list);
+}
+
+static Eina_Bool
+_font_list_fill(const Eina_Hash *hash EINA_UNUSED,
+ const void *key EINA_UNUSED,
+ void *data,
+ void *fdata)
+{
+ Elm_Font_Properties *efp;
+ Eina_List **flist;
+
+ flist = fdata;
+ efp = data;
+
+ *flist = eina_list_append(*flist, efp->name);
+
+ return EINA_TRUE;
+}
+
+static void
+_font_names_list_load(Evas_Object *flist)
+{
+ Eina_List *l, *names_list = NULL;
+ const char *font;
+ Evas *evas;
+
+ evas = evas_object_evas_get(flist);
+ evas_event_freeze(evas);
+ edje_freeze();
+
+ eina_hash_foreach(fndata.font_hash, _font_list_fill, &names_list);
+ names_list = eina_list_sort(names_list, eina_list_count(names_list),
+ _font_sort_cb);
+
+ EINA_LIST_FOREACH(names_list, l, font)
+ elm_list_item_append(flist, font, NULL, NULL, _font_names_list_sel, NULL);
+
+ eina_list_free(names_list);
+
+ evas_object_smart_callback_add(flist, "unselected",
+ _fnames_list_unselect_cb, NULL);
+
+ elm_list_go(flist);
+
+ edje_thaw();
+ evas_event_thaw(evas);
+}
+
+static void
+_status_config_fonts(Evas_Object *win,
+ Evas_Object *naviframe)
+{
+ Evas_Object *base, *fr, *li, *rc, *preview, *sp, *pd, *bt, *bx;
+ char buf[PATH_MAX];
+
+ _fonts_data_fill(evas_object_evas_get(win));
+
+ base = elm_table_add(win);
+ evas_object_size_hint_weight_set(base, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(base, EVAS_HINT_FILL, EVAS_HINT_FILL);
+
+ /* yeah, dummy rectangles are ugly as hell, but no good way yet of
+ fixing sizes */
+ rc = evas_object_rectangle_add(evas_object_evas_get(win));
+ evas_object_size_hint_weight_set(rc, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(rc, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ evas_object_size_hint_min_set(rc, 70, 170);
+ elm_table_pack(base, rc, 1, 0, 1, 1);
+
+ fr = elm_frame_add(win);
+ elm_object_text_set(fr, "Font Class");
+ elm_table_pack(base, fr, 0, 0, 1, 2);
+ evas_object_size_hint_weight_set(fr, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(fr, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ evas_object_show(fr);
+
+ /* FIXME: no multiselection for this list, for now */
+ li = elm_list_add(win);
+ evas_object_size_hint_weight_set(li, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(li, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ elm_object_content_set(fr, li);
+ evas_object_show(li);
+
+ evas_object_data_set(win, "font_classes_list", li);
+ _font_classes_list_load(li);
+
+ fr = elm_frame_add(win);
+ elm_object_text_set(fr, "Font");
+ elm_table_pack(base, fr, 1, 0, 1, 2);
+ evas_object_size_hint_weight_set(fr, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(fr, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ evas_object_show(fr);
+
+ li = elm_list_add(win);
+ evas_object_size_hint_weight_set(li, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(li, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ elm_object_content_set(fr, li);
+ evas_object_show(li);
+
+ evas_object_data_set(win, "font_names_list", li);
+ _font_names_list_load(li);
+ ELM_LIST_DISABLE(li);
+
+ rc = evas_object_rectangle_add(evas_object_evas_get(win));
+ evas_object_size_hint_weight_set(rc, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(rc, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ evas_object_size_hint_min_set(rc, 70, 130);
+ elm_table_pack(base, rc, 1, 2, 1, 1);
+
+ fr = elm_frame_add(win);
+ elm_object_text_set(fr, "Style");
+ elm_table_pack(base, fr, 0, 2, 1, 1);
+ evas_object_size_hint_weight_set(fr, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(fr, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ evas_object_show(fr);
+ ELM_LIST_DISABLE(li);
+
+ li = elm_list_add(win);
+ evas_object_size_hint_weight_set(li, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(li, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ elm_object_content_set(fr, li);
+ evas_object_show(li);
+
+ evas_object_data_set(win, "font_styles_list", li);
+ evas_object_smart_callback_add(li, "unselected", _fstyle_list_unselect_cb,
+ NULL);
+
+ fr = elm_frame_add(win);
+ elm_object_text_set(fr, "Size");
+ elm_table_pack(base, fr, 1, 2, 1, 1);
+ evas_object_size_hint_weight_set(fr, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(fr, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ evas_object_show(fr);
+
+ li = elm_list_add(win);
+ evas_object_size_hint_weight_set(li, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(li, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ elm_object_content_set(fr, li);
+ evas_object_show(li);
+
+ evas_object_data_set(win, "font_sizes_list", li);
+ _font_sizes_list_load(li);
+ ELM_LIST_DISABLE(li);
+
+ bx = elm_box_add(win);
+ evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(bx, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ elm_table_pack(base, bx, 0, 3, 2, 1);
+ evas_object_show(bx);
+
+ /* FIXME: what to do here? dedicated widget? some new entry API set? */
+ snprintf(buf, sizeof(buf), "%s/objects/font_preview.edj", elm_app_data_dir_get());
+ preview = elm_layout_add(win);
+ elm_layout_file_set(preview, buf, "font_preview");
+ elm_object_part_text_set(preview, "elm.text", "Preview Text — 我真的会写中文");
+ evas_object_size_hint_weight_set(preview, EVAS_HINT_EXPAND, 0.0);
+ evas_object_size_hint_align_set(preview, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ evas_object_show(preview);
+
+ elm_box_pack_end(bx, preview);
+ evas_object_data_set(win, "font_preview", elm_layout_edje_get(preview));
+
+ /////////////////////////////////////////////
+ sp = elm_separator_add(win);
+ elm_separator_horizontal_set(sp, EINA_TRUE);
+ evas_object_size_hint_weight_set(sp, EVAS_HINT_EXPAND, 0.0);
+ evas_object_size_hint_align_set(sp, EVAS_HINT_FILL, 0.5);
+ elm_table_pack(base, sp, 0, 4, 2, 1);
+ evas_object_show(sp);
+
+ pd = elm_frame_add(win);
+ elm_object_style_set(pd, "pad_medium");
+ evas_object_size_hint_weight_set(pd, EVAS_HINT_EXPAND, 0.0);
+ evas_object_size_hint_align_set(pd, 0.5, 0.5);
+ elm_table_pack(base, pd, 0, 5, 2, 1);
+ evas_object_show(pd);
+
+ bx = elm_box_add(win);
+ elm_box_horizontal_set(bx, EINA_TRUE);
+ evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(bx, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ evas_object_show(bx);
+
+ bt = elm_button_add(win);
+ evas_object_smart_callback_add(bt, "clicked", _font_overlay_set_all, win);
+ elm_object_text_set(bt, "Set to All");
+ evas_object_size_hint_weight_set(bt, 0.0, 0.0);
+ evas_object_size_hint_align_set(bt, 0.5, 0.5);
+ elm_box_pack_end(bx, bt);
+ evas_object_show(bt);
+
+ bt = elm_button_add(win);
+ evas_object_smart_callback_add(bt, "clicked", _font_overlay_reset, win);
+ elm_object_text_set(bt, "Reset");
+ evas_object_size_hint_weight_set(bt, 0.0, 0.0);
+ evas_object_size_hint_align_set(bt, 0.5, 0.5);
+ elm_box_pack_end(bx, bt);
+ evas_object_show(bt);
+
+ bt = elm_button_add(win);
+ evas_object_smart_callback_add(bt, "clicked", _font_overlay_reset_all, win);
+ elm_object_text_set(bt, "Reset All");
+ evas_object_size_hint_weight_set(bt, 0.0, 0.0);
+ evas_object_size_hint_align_set(bt, 0.5, 0.5);
+ elm_box_pack_end(bx, bt);
+ evas_object_show(bt);
+
+ bt = elm_button_add(win);
+ evas_object_smart_callback_add(bt, "clicked", _font_overlay_change, win);
+ elm_object_text_set(bt, "Apply");
+ evas_object_size_hint_weight_set(bt, 0.0, 0.0);
+ evas_object_size_hint_align_set(bt, 0.5, 0.5);
+ elm_box_pack_end(bx, bt);
+ evas_object_show(bt);
+
+ elm_object_content_set(pd, bx);
+
+ evas_object_data_set(win, "fonts", base);
+
+ elm_naviframe_item_simple_push(naviframe, base);
+}
+
+static void
+_profiles_list_item_del_cb(void *data,
+ Evas_Object *obj EINA_UNUSED,
+ void *event_info EINA_UNUSED)
+{
+ free(data);
+}
+
+static void
+_profiles_list_selected_cb(void *data,
+ Evas_Object *obj,
+ void *event_info EINA_UNUSED)
+{
+ const char *cur_profile = NULL;
+ const char *sel_profile, *pdir;
+ const char *prof_name;
+ char buf[PATH_MAX];
+ Evas_Object *en;
+#ifdef ELM_EFREET
+ Efreet_Desktop *desk = NULL;
+#endif
+
+ sel_profile = data;
+ if (!sel_profile)
+ return;
+
+ cur_profile = elm_config_profile_get();
+
+ pdir = elm_config_profile_dir_get(sel_profile, EINA_TRUE);
+ if (!pdir) pdir = elm_config_profile_dir_get(sel_profile, EINA_FALSE);
+#ifdef ELM_EFREET
+ snprintf(buf, sizeof(buf), "%s/profile.desktop", pdir);
+ desk = efreet_desktop_new(buf);
+ if ((desk) && (desk->name)) prof_name = desk->name;
+ else
+ {
+ if (desk) efreet_desktop_free(desk);
+ if (pdir) elm_config_profile_dir_free(pdir);
+
+ pdir = elm_config_profile_dir_get(sel_profile, EINA_FALSE);
+ snprintf(buf, sizeof(buf), "%s/profile.desktop", pdir);
+ desk = efreet_desktop_new(buf);
+ if ((desk) && (desk->name)) prof_name = desk->name;
+ else prof_name = cur_profile;
+ }
+#endif
+
+ if (!pdir)
+ elm_object_disabled_set(evas_object_data_get(obj, "prof_reset_btn"),
+ EINA_TRUE);
+ else
+ {
+ elm_object_disabled_set(evas_object_data_get(obj, "prof_del_btn"),
+ EINA_TRUE);
+ elm_object_disabled_set(evas_object_data_get(obj, "prof_reset_btn"),
+ EINA_FALSE);
+ elm_object_disabled_set(evas_object_data_get(obj, "prof_use_btn"),
+ EINA_FALSE);
+ elm_config_profile_dir_free(pdir);
+ }
+
+ snprintf(buf, sizeof(buf), "<hilight>Selected profile: %s</><br/>",
+ prof_name);
+ elm_object_text_set(evas_object_data_get(obj, "prof_name_lbl"), buf);
+
+ en = evas_object_data_get(obj, "prof_desc_entry");
+#ifdef ELM_EFREET
+ if (desk) elm_object_text_set(en, desk->comment);
+ else
+#endif
+ elm_object_text_set(en, "Unknown");
+
+#ifdef ELM_EFREET
+ if (desk) efreet_desktop_free(desk);
+#endif
+}
+
+static void
+_profiles_list_fill(Evas_Object *l_widget,
+ Eina_List *p_names)
+{
+ const char *cur_profile = NULL;
+ const char *profile;
+ void *sel_it = NULL;
+ Eina_List *l;
+
+ if (!p_names)
+ return;
+
+ elm_list_clear(l_widget);
+
+ cur_profile = elm_config_profile_get();
+
+ EINA_LIST_FOREACH(p_names, l, profile)
+ {
+#ifdef ELM_EFREET
+ Efreet_Desktop *desk = NULL;
+#endif
+ const char *label, *ext, *pdir;
+ char buf[PATH_MAX];
+ Elm_Object_Item *list_it;
+ Evas_Object *ic;
+
+ pdir = elm_config_profile_dir_get(profile, EINA_TRUE);
+ if (!pdir) pdir = elm_config_profile_dir_get(profile, EINA_FALSE);
+
+#ifdef ELM_EFREET
+ snprintf(buf, sizeof(buf), "%s/profile.desktop", pdir);
+ desk = efreet_desktop_new(buf);
+ if ((desk) && (desk->name)) label = desk->name;
+ else
+ {
+ if (desk) efreet_desktop_free(desk);
+ if (pdir) elm_config_profile_dir_free(pdir);
+
+ pdir = elm_config_profile_dir_get(profile, EINA_FALSE);
+ snprintf(buf, sizeof(buf), "%s/profile.desktop", pdir);
+ desk = efreet_desktop_new(buf);
+ if ((desk) && (desk->name)) label = desk->name;
+ else label = profile;
+ }
+#endif
+
+ buf[0] = 0;
+ if (pdir) snprintf(buf, sizeof(buf), "%s/icon.edj", pdir);
+#ifdef ELM_EFREET
+ if ((desk) && (desk->icon) && (pdir))
+ snprintf(buf, sizeof(buf), "%s/%s", pdir, desk->icon);
+#endif
+ ic = elm_icon_add(l_widget);
+ ext = strrchr(buf, '.');
+ if (ext)
+ {
+ if (!strcmp(ext, ".edj")) elm_image_file_set(ic, buf, "icon");
+ else elm_image_file_set(ic, buf, NULL);
+ }
+
+ evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL,
+ 1, 1);
+ evas_object_show(ic);
+
+ list_it = elm_list_item_append(l_widget, label, ic, NULL,
+ _profiles_list_selected_cb,
+ strdup(profile));
+ elm_object_item_del_cb_set(list_it, _profiles_list_item_del_cb);
+ if (cur_profile && !strcmp(profile, cur_profile))
+ sel_it = list_it;
+
+ elm_config_profile_dir_free(pdir);
+
+#ifdef ELM_EFREET
+ if (desk) efreet_desktop_free(desk);
+#endif
+ }
+
+ if (sel_it) elm_list_item_selected_set(sel_it, EINA_TRUE);
+ elm_list_go(l_widget);
+}
+
+static void
+_profiles_list_unselect_cb(void *data EINA_UNUSED,
+ Evas_Object *obj,
+ void *event_info EINA_UNUSED)
+{
+ if (elm_list_selected_item_get(obj)) return;
+ elm_object_disabled_set(evas_object_data_get(obj, "prof_del_btn"),
+ EINA_TRUE);
+ elm_object_disabled_set(evas_object_data_get(obj, "prof_reset_btn"),
+ EINA_TRUE);
+ elm_object_disabled_set(evas_object_data_get(obj, "prof_use_btn"),
+ EINA_TRUE);
+}
+
+static void
+_status_config_profiles(Evas_Object *win,
+ Evas_Object *naviframe)
+{
+ Evas_Object *li, *bx, *fr_bx1, *fr_bx2, *btn_bx, *fr, *lb, *en, *sp, *pd,
+ *bt;
+ Eina_List *profs;
+ Evas *evas;
+
+ bx = elm_box_add(win);
+ evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(bx, EVAS_HINT_FILL, EVAS_HINT_FILL);
+
+ fr_bx1 = elm_box_add(win);
+ evas_object_size_hint_weight_set(fr_bx1, EVAS_HINT_EXPAND,
+ EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(fr_bx1, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ elm_box_homogeneous_set(fr_bx1, EINA_TRUE);
+ evas_object_show(fr_bx1);
+
+ fr_bx2 = elm_box_add(win);
+ evas_object_size_hint_weight_set(fr_bx2, EVAS_HINT_EXPAND,
+ EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(fr_bx2, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ evas_object_show(fr_bx2);
+
+ fr = elm_frame_add(win);
+ elm_object_text_set(fr, "Available Profiles");
+ evas_object_size_hint_weight_set(fr, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(fr, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ elm_object_content_set(fr, fr_bx1);
+ elm_box_pack_end(bx, fr);
+ evas_object_show(fr);
+
+ li = elm_list_add(win);
+ evas_object_size_hint_weight_set(li, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(li, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ evas_object_smart_callback_add(li, "unselected", _profiles_list_unselect_cb,
+ NULL);
+
+ profs = elm_config_profile_list_get();
+
+ evas_object_show(li);
+ elm_box_pack_end(fr_bx2, li);
+
+ lb = elm_label_add(win);
+ evas_object_size_hint_weight_set(lb, EVAS_HINT_EXPAND, 0.0);
+ evas_object_size_hint_align_set(lb, EVAS_HINT_FILL, 0.5);
+
+ evas_object_show(lb);
+
+ en = elm_entry_add(win);
+ elm_entry_scrollable_set(en, EINA_TRUE);
+ elm_entry_editable_set(en, EINA_FALSE);
+ evas_object_size_hint_weight_set(en, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(en, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ evas_object_show(en);
+
+ evas_object_data_set(li, "prof_name_lbl", lb);
+ evas_object_data_set(li, "prof_desc_entry", en);
+
+ elm_box_pack_end(fr_bx2, lb);
+ elm_box_pack_end(fr_bx1, fr_bx2);
+ elm_box_pack_end(fr_bx1, en);
+
+ /////////////////////////////////////////////
+ sp = elm_separator_add(win);
+ elm_separator_horizontal_set(sp, EINA_TRUE);
+ evas_object_size_hint_weight_set(sp, EVAS_HINT_EXPAND, 0.0);
+ evas_object_size_hint_align_set(sp, EVAS_HINT_FILL, 0.5);
+ elm_box_pack_end(bx, sp);
+ evas_object_show(sp);
+
+ pd = elm_frame_add(win);
+ elm_object_style_set(pd, "pad_medium");
+ evas_object_size_hint_weight_set(pd, 0.0, 0.0);
+ evas_object_size_hint_align_set(pd, 0.5, 0.5);
+ elm_box_pack_end(bx, pd);
+ evas_object_show(pd);
+
+ btn_bx = elm_box_add(win);
+ elm_box_horizontal_set(btn_bx, EINA_TRUE);
+ evas_object_size_hint_weight_set(btn_bx, EVAS_HINT_EXPAND,
+ EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(btn_bx, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ evas_object_show(btn_bx);
+
+ bt = elm_button_add(win);
+ evas_object_smart_callback_add(bt, "clicked", _profile_use, li);
+ elm_object_text_set(bt, "Use");
+ evas_object_size_hint_weight_set(bt, 0.0, 0.0);
+ evas_object_size_hint_align_set(bt, 0.5, 0.5);
+ elm_box_pack_end(btn_bx, bt);
+ evas_object_show(bt);
+
+ evas_object_data_set(li, "prof_use_btn", bt);
+
+ bt = elm_button_add(win);
+ evas_object_smart_callback_add(bt, "clicked", _btn_todo, NULL); /* TODO */
+ elm_object_text_set(bt, "Delete");
+ evas_object_size_hint_weight_set(bt, 0.0, 0.0);
+ evas_object_size_hint_align_set(bt, 0.5, 0.5);
+ elm_box_pack_end(btn_bx, bt);
+ evas_object_show(bt);
+
+ evas_object_data_set(li, "prof_del_btn", bt);
+
+ bt = elm_button_add(win);
+ evas_object_smart_callback_add(bt, "clicked", _profile_reset, li);
+ elm_object_text_set(bt, "Reset");
+ evas_object_size_hint_weight_set(bt, 0.0, 0.0);
+ evas_object_size_hint_align_set(bt, 0.5, 0.5);
+ elm_box_pack_end(btn_bx, bt);
+ evas_object_show(bt);
+
+ evas_object_data_set(li, "prof_reset_btn", bt);
+
+ bt = elm_button_add(win);
+ evas_object_smart_callback_add(bt, "clicked", _btn_todo, NULL); /* TODO */
+ elm_object_text_set(bt, "Add new");
+ evas_object_size_hint_weight_set(bt, 0.0, 0.0);
+ evas_object_size_hint_align_set(bt, 0.5, 0.5);
+ elm_box_pack_end(btn_bx, bt);
+ evas_object_show(bt);
+
+ elm_object_content_set(pd, btn_bx);
+
+ evas = evas_object_evas_get(li);
+ evas_event_freeze(evas);
+ edje_freeze();
+
+ _profiles_list_fill(li, profs);
+
+ elm_config_profile_list_free(profs);
+
+ edje_thaw();
+ evas_event_thaw(evas);
+
+ evas_object_data_set(win, "profiles", bx);
+ elm_naviframe_item_simple_push(naviframe, bx);
+}
+
+static void
+_status_config_scrolling_bounce(Evas_Object *win, Evas_Object *box)
+{
+ Evas_Object *fr, *bx, *ck, *pd, *lb, *sl;
+
+ fr = elm_frame_add(box);
+ evas_object_size_hint_weight_set(fr, EVAS_HINT_EXPAND, 0.0);
+ evas_object_size_hint_align_set(fr, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ elm_object_text_set(fr, "Bounce");
+ elm_box_pack_end(box, fr);
+ evas_object_show(fr);
+
+ bx = elm_box_add(fr);
+ elm_object_content_set(fr, bx);
+ evas_object_show(bx);
+
+ /* Enable Scroll Bounce */
+ CHECK_ADD("Enable scroll bounce",
+ "Set whether scrollers should bounce<br/>"
+ "when they reach their viewport's edge<br/>"
+ "during a scroll",
+ sb_change, NULL);
+ evas_object_data_set(win, "scroll_bounce_check", ck);
+ elm_check_state_set(ck, elm_config_scroll_bounce_enabled_get());
+
+ /* Scroll bounce friction */
+ LABEL_FRAME_ADD("<hilight>Scroll bounce friction</>");
+
+ sl = elm_slider_add(bx);
+ elm_object_tooltip_text_set(sl, "This is the amount of inertia a <br/>"
+ "scroller will impose at bounce animations");
+ evas_object_data_set(win, "bounce_friction_slider", sl);
+ evas_object_size_hint_weight_set(sl, EVAS_HINT_EXPAND, 0.0);
+ evas_object_size_hint_align_set(sl, EVAS_HINT_FILL, 0.5);
+ elm_slider_span_size_set(sl, 120);
+ elm_slider_unit_format_set(sl, "%1.2f");
+ elm_slider_indicator_format_set(sl, "%1.2f");
+ elm_slider_min_max_set(sl, 0.0, 4.0);
+ elm_slider_value_set(sl, elm_config_scroll_bounce_friction_get());
+ elm_box_pack_end(bx, sl);
+ evas_object_show(sl);
+
+ evas_object_smart_callback_add(sl, "changed", bf_round, NULL);
+ evas_object_smart_callback_add(sl, "delay,changed", bf_change, NULL);
+}
+
+static void
+_status_config_scrolling_thumb(Evas_Object *win, Evas_Object *box)
+{
+ Evas_Object *fr, *bx, *ck, *sl, *sp, *pd, *lb;
+
+ fr = elm_frame_add(box);
+ evas_object_size_hint_weight_set(fr, EVAS_HINT_EXPAND, 0.0);
+ evas_object_size_hint_align_set(fr, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ elm_object_text_set(fr, "Thumb Scroll");
+ elm_box_pack_end(box, fr);
+ evas_object_show(fr);
+
+ bx = elm_box_add(fr);
+ elm_object_content_set(fr, bx);
+ evas_object_show(bx);
+
+ /* Enable thumb scroll */
+ CHECK_ADD("Enable thumb scroll",
+ "Set whether scrollers should be<br/>"
+ "draggable from any point in their views",
+ ts_change, NULL);
+ evas_object_data_set(win, "thumbscroll_check", ck);
+ elm_check_state_set(ck, elm_config_scroll_thumbscroll_enabled_get());
+
+ /* Thumb scroll threadhold */
+ LABEL_FRAME_ADD("<hilight>Thumb scroll threshold</>");
+
+ sl = elm_slider_add(win);
+ elm_object_tooltip_text_set(sl, "This is the number of pixels one should<br/>"
+ "travel while dragging a scroller's view<br/>"
+ "to actually trigger scrolling");
+ evas_object_data_set(win, "ts_threshold_slider", sl);
+ evas_object_size_hint_weight_set(sl, EVAS_HINT_EXPAND, 0.0);
+ evas_object_size_hint_align_set(sl, EVAS_HINT_FILL, 0.5);
+ elm_slider_span_size_set(sl, 120);
+ elm_slider_unit_format_set(sl, "%1.0f pixels");
+ elm_slider_indicator_format_set(sl, "%1.0f");
+ elm_slider_min_max_set(sl, 8.0, 50.0);
+ elm_slider_value_set(sl, elm_config_scroll_thumbscroll_threshold_get());
+ elm_box_pack_end(bx, sl);
+ evas_object_show(sl);
+
+ evas_object_smart_callback_add(sl, "changed", tst_round, NULL);
+ evas_object_smart_callback_add(sl, "delay,changed", tst_change, NULL);
+
+ /* Thumb scroll hold threashold */
+ LABEL_FRAME_ADD("<hilight>Thumb scroll hold threshold</>");
+
+ sl = elm_slider_add(win);
+ elm_object_tooltip_text_set(sl, "This is the number of pixels the range<br/>"
+ "which can be scrolled, while the scroller<br/>"
+ "is holed");
+ evas_object_data_set(win, "ts_hold_threshold_slider", sl);
+ evas_object_size_hint_weight_set(sl, EVAS_HINT_EXPAND, 0.0);
+ evas_object_size_hint_align_set(sl, EVAS_HINT_FILL, 0.5);
+ elm_slider_span_size_set(sl, 120);
+ elm_slider_unit_format_set(sl, "%1.0f pixels");
+ elm_slider_indicator_format_set(sl, "%1.0f");
+ elm_slider_min_max_set(sl, 4.0, 500.0);
+ elm_slider_value_set(sl, elm_config_scroll_thumbscroll_hold_threshold_get());
+ elm_box_pack_end(bx, sl);
+ evas_object_show(sl);
+
+ evas_object_smart_callback_add(sl, "changed", tsht_round, NULL);
+ evas_object_smart_callback_add(sl, "delay,changed", tsht_change, NULL);
+
+ /* Thumb scroll momentum threshold */
+ LABEL_FRAME_ADD("<hilight>Thumb scroll momentum threshold</>");
+
+ sl = elm_slider_add(win);
+ elm_object_tooltip_text_set(sl, "This is the minimum speed of mouse <br/>"
+ "cursor movement which will trigger<br/>"
+ "list self scrolling animation after a<br/>"
+ "mouse up event (pixels/second)");
+ evas_object_data_set(win, "ts_momentum_threshold_slider", sl);
+ evas_object_size_hint_weight_set(sl, EVAS_HINT_EXPAND, 0.0);
+ evas_object_size_hint_align_set(sl, EVAS_HINT_FILL, 0.5);
+ elm_slider_span_size_set(sl, 120);
+ elm_slider_unit_format_set(sl, "%1.0f pixels/s");
+ elm_slider_indicator_format_set(sl, "%1.0f");
+ elm_slider_min_max_set(sl, 10.0, 200.0);
+ elm_slider_value_set(sl, elm_config_scroll_thumbscroll_momentum_threshold_get());
+ elm_box_pack_end(bx, sl);
+ evas_object_show(sl);
+
+ evas_object_smart_callback_add(sl, "changed", tsmt_round, NULL);
+ evas_object_smart_callback_add(sl, "delay,changed", tsmt_change,
+ NULL);
+
+ /* Thumb scroll flick distance tolerance */
+ LABEL_FRAME_ADD("<hilight>Thumb scroll flick distance tolerance</>");
+
+ sl = elm_slider_add(win);
+ elm_object_tooltip_text_set(sl, "This is the number of pixels the maximum<br/>"
+ "distance which can be flicked. If it is<br/>"
+ "flicked more than this, the flick distance<br/>"
+ "is same with maximum distance");
+ evas_object_data_set(win, "ts_flick_distance_tolerance_slider", sl);
+ evas_object_size_hint_weight_set(sl, EVAS_HINT_EXPAND, 0.0);
+ evas_object_size_hint_align_set(sl, EVAS_HINT_FILL, 0.5);
+ elm_slider_span_size_set(sl, 120);
+ elm_slider_unit_format_set(sl, "%1.0f pixels");
+ elm_slider_indicator_format_set(sl, "%1.0f");
+ elm_slider_min_max_set(sl, 100.0, 3000.0);
+ elm_slider_value_set(sl, elm_config_scroll_thumbscroll_flick_distance_tolerance_get());
+ elm_box_pack_end(bx, sl);
+ evas_object_show(sl);
+
+ evas_object_smart_callback_add(sl, "changed", tsfdt_round, NULL);
+ evas_object_smart_callback_add(sl, "delay,changed", tsfdt_change, NULL);
+
+ /* Thumb scroll friction */
+ LABEL_FRAME_ADD("<hilight>Thumb scroll friction</>");
+
+ sl = elm_slider_add(win);
+ elm_object_tooltip_text_set(sl, "This is the amount of inertia a<br/>"
+ "scroller will impose at self scrolling<br/>"
+ "animations");
+ evas_object_data_set(win, "ts_friction_slider", sl);
+ evas_object_size_hint_weight_set(sl, EVAS_HINT_EXPAND, 0.0);
+ evas_object_size_hint_align_set(sl, EVAS_HINT_FILL, 0.5);
+ elm_slider_span_size_set(sl, 120);
+ elm_slider_unit_format_set(sl, "%1.1f");
+ elm_slider_indicator_format_set(sl, "%1.1f");
+ elm_slider_min_max_set(sl, 0.1, 10.0);
+ elm_slider_value_set(sl, elm_config_scroll_thumbscroll_friction_get());
+ elm_box_pack_end(bx, sl);
+ evas_object_show(sl);
+
+ evas_object_smart_callback_add(sl, "changed", tsf_round, NULL);
+ evas_object_smart_callback_add(sl, "delay,changed", tsf_change, NULL);
+
+ /* Thumb scroll min friction */
+ LABEL_FRAME_ADD("<hilight>Thumb scroll min friction</>");
+
+ sl = elm_slider_add(win);
+ elm_object_tooltip_text_set(sl, "This is the min amount of inertia a<br/>"
+ "scroller will impose at self scrolling<br/>"
+ "animations");
+ evas_object_data_set(win, "ts_min_friction_slider", sl);
+ evas_object_size_hint_weight_set(sl, EVAS_HINT_EXPAND, 0.0);
+ evas_object_size_hint_align_set(sl, EVAS_HINT_FILL, 0.5);
+ elm_slider_span_size_set(sl, 120);
+ elm_slider_unit_format_set(sl, "%1.1f");
+ elm_slider_indicator_format_set(sl, "%1.1f");
+ elm_slider_min_max_set(sl, 0.1, 10.0);
+ elm_slider_value_set(sl, elm_config_scroll_thumbscroll_min_friction_get());
+ elm_box_pack_end(bx, sl);
+ evas_object_show(sl);
+
+ evas_object_smart_callback_add(sl, "changed", tsmf_round, NULL);
+ evas_object_smart_callback_add(sl, "delay,changed", tsmf_change, NULL);
+
+ /* Thumb scroll friction standard */
+ LABEL_FRAME_ADD("<hilight>Thumb scroll friction standard</>");
+
+ sl = elm_slider_add(win);
+ elm_object_tooltip_text_set(sl, "This is the standard velocity of the scroller."
+ "<br/>The scroll animation time is same<br/>"
+ "with thumbscroll friction, if the velocity"
+ "<br/>is same with standard velocity.");
+ evas_object_data_set(win, "ts_friction_standard_slider", sl);
+ evas_object_size_hint_weight_set(sl, EVAS_HINT_EXPAND, 0.0);
+ evas_object_size_hint_align_set(sl, EVAS_HINT_FILL, 0.5);
+ elm_slider_span_size_set(sl, 120);
+ elm_slider_unit_format_set(sl, "%1.0f pixel/s");
+ elm_slider_indicator_format_set(sl, "%1.0f");
+ elm_slider_min_max_set(sl, 10.0, 5000.0);
+ elm_slider_value_set(sl, elm_config_scroll_thumbscroll_friction_standard_get());
+ elm_box_pack_end(bx, sl);
+ evas_object_show(sl);
+
+ evas_object_smart_callback_add(sl, "changed", tsfs_round, NULL);
+ evas_object_smart_callback_add(sl, "delay,changed", tsfs_change, NULL);
+
+ /* Thumb scroll border friction */
+ LABEL_FRAME_ADD("<hilight>Thumb scroll border friction</>");
+
+ sl = elm_slider_add(win);
+ elm_object_tooltip_text_set(sl, "This is the amount of lag between your<br/>"
+ "actual mouse cursor dragging movement<br/>"
+ "and a scroller's view movement itself,<br/>"
+ "while pushing it into bounce state<br/>"
+ "manually");
+ evas_object_data_set(win, "ts_border_friction_slider", sl);
+ evas_object_size_hint_weight_set(sl, EVAS_HINT_EXPAND, 0.0);
+ evas_object_size_hint_align_set(sl, EVAS_HINT_FILL, 0.5);
+ elm_slider_span_size_set(sl, 120);
+ elm_slider_unit_format_set(sl, "%1.2f");
+ elm_slider_indicator_format_set(sl, "%1.2f");
+ elm_slider_min_max_set(sl, 0.0, 1.0);
+ elm_slider_value_set(sl, elm_config_scroll_thumbscroll_border_friction_get());
+ elm_box_pack_end(bx, sl);
+ evas_object_show(sl);
+
+ evas_object_smart_callback_add(sl, "changed", tsbf_round, NULL);
+ evas_object_smart_callback_add(sl, "delay,changed", tsbf_change, NULL);
+
+ /* Thumb scroll sensitivity friction */
+ LABEL_FRAME_ADD("<hilight>Thumb scroll sensitivity friction</>");
+
+ sl = elm_slider_add(win);
+ elm_object_tooltip_text_set(sl, "This is the sensitivity amount which<br/>"
+ "is be multiplied by the length of mouse<br/>"
+ "dragging.");
+ evas_object_data_set(win, "ts_sensitivity_friction_slider", sl);
+ evas_object_size_hint_weight_set(sl, EVAS_HINT_EXPAND, 0.0);
+ evas_object_size_hint_align_set(sl, EVAS_HINT_FILL, 0.5);
+ elm_slider_span_size_set(sl, 120);
+ elm_slider_unit_format_set(sl, "%1.2f");
+ elm_slider_indicator_format_set(sl, "%1.2f");
+ elm_slider_min_max_set(sl, 0.1, 1.0);
+ elm_slider_value_set(sl, elm_config_scroll_thumbscroll_sensitivity_friction_get());
+ elm_box_pack_end(bx, sl);
+ evas_object_show(sl);
+
+ evas_object_smart_callback_add(sl, "changed", tssf_round, NULL);
+ evas_object_smart_callback_add(sl, "delay,changed", tssf_change, NULL);
+
+ sp = elm_separator_add(win);
+ elm_separator_horizontal_set(sp, EINA_TRUE);
+ evas_object_size_hint_weight_set(sp, EVAS_HINT_EXPAND, 0.0);
+ evas_object_size_hint_align_set(sp, EVAS_HINT_FILL, 0.5);
+ elm_box_pack_end(bx, sp);
+ evas_object_show(sp);
+}
+
+static void
+_status_config_scrolling_acceleration(Evas_Object *win, Evas_Object *box)
+{
+ Evas_Object *fr, *bx, *sl, *pd, *lb;
+
+ fr = elm_frame_add(box);
+ evas_object_size_hint_weight_set(fr, EVAS_HINT_EXPAND, 0.0);
+ evas_object_size_hint_align_set(fr, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ elm_object_text_set(fr, "Thumb Scroll Acceleration");
+ elm_box_pack_end(box, fr);
+ evas_object_show(fr);
+
+ bx = elm_box_add(fr);
+ elm_object_content_set(fr, bx);
+ evas_object_show(bx);
+
+ /* Thumb scroll acceleration threshold */
+ LABEL_FRAME_ADD("<hilight>Thumb scroll acceleration threshold</>");
+
+ sl = elm_slider_add(bx);
+ elm_object_tooltip_text_set(sl, "This is the minimum speed of mouse <br/>"
+ "cursor movement which will accelerate<br/>"
+ "scrolling velocity after a<br/>"
+ "mouse up event (pixels/second)");
+ evas_object_data_set(win, "ts_acceleration_threshold_slider", sl);
+ evas_object_size_hint_weight_set(sl, EVAS_HINT_EXPAND, 0.0);
+ evas_object_size_hint_align_set(sl, EVAS_HINT_FILL, 0.5);
+ elm_slider_span_size_set(sl, 120);
+ elm_slider_unit_format_set(sl, "%1.0f pixels/s");
+ elm_slider_indicator_format_set(sl, "%1.0f");
+ elm_slider_min_max_set(sl, 10.0, 5000.0);
+ elm_slider_value_set(sl, elm_config_scroll_thumbscroll_acceleration_threshold_get());
+ elm_box_pack_end(bx, sl);
+ evas_object_show(sl);
+
+ evas_object_smart_callback_add(sl, "changed", tsat_round, NULL);
+ evas_object_smart_callback_add(sl, "delay,changed", tsat_change, NULL);
+
+ /* Thumb scroll acceleration time limit */
+ LABEL_FRAME_ADD("<hilight>Thumb scroll acceleration time limit</>");
+
+ sl = elm_slider_add(bx);
+ elm_object_tooltip_text_set(sl, "This is the time limit for<br/>"
+ "accelerating velocity<br/>");
+ evas_object_data_set(win, "ts_acceleration_time_limit_slider", sl);
+ evas_object_size_hint_weight_set(sl, EVAS_HINT_EXPAND, 0.0);
+ evas_object_size_hint_align_set(sl, EVAS_HINT_FILL, 0.5);
+ elm_slider_span_size_set(sl, 120);
+ elm_slider_unit_format_set(sl, "%1.1f");
+ elm_slider_indicator_format_set(sl, "%1.1f");
+ elm_slider_min_max_set(sl, 0.0, 15.0);
+ elm_slider_value_set(sl, elm_config_scroll_thumbscroll_acceleration_time_limit_get());
+ elm_box_pack_end(bx, sl);
+ evas_object_show(sl);
+
+ evas_object_smart_callback_add(sl, "changed", tsatl_round, NULL);
+ evas_object_smart_callback_add(sl, "delay,changed", tsatl_change, NULL);
+
+ /* Thumb scroll acceleration weight */
+ LABEL_FRAME_ADD("<hilight>Thumb scroll acceleration weight</>");
+
+ sl = elm_slider_add(bx);
+ elm_object_tooltip_text_set(sl, "This is the weight for acceleration");
+ evas_object_data_set(win, "ts_acceleration_weight_slider", sl);
+ evas_object_size_hint_weight_set(sl, EVAS_HINT_EXPAND, 0.0);
+ evas_object_size_hint_align_set(sl, EVAS_HINT_FILL, 0.5);
+ elm_slider_span_size_set(sl, 120);
+ elm_slider_unit_format_set(sl, "%1.1f");
+ elm_slider_indicator_format_set(sl, "%1.1f");
+ elm_slider_min_max_set(sl, 1.0, 10.0);
+ elm_slider_value_set(sl, elm_config_scroll_thumbscroll_acceleration_weight_get());
+ elm_box_pack_end(bx, sl);
+ evas_object_show(sl);
+
+ evas_object_smart_callback_add(sl, "changed", tsaw_round, NULL);
+ evas_object_smart_callback_add(sl, "delay,changed", tsaw_change, NULL);
+}
+
+static void
+_status_config_scrolling(Evas_Object *win,
+ Evas_Object *naviframe)
+{
+ Evas_Object *lb, *pd, *box, *bx, *sl, *sc, *ck, *fr;
+
+ box = elm_box_add(win);
+ evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, 0.0);
+ evas_object_size_hint_align_set(box, EVAS_HINT_FILL, 0.5);
+
+ sc = elm_scroller_add(win);
+ elm_scroller_step_size_set(sc, 32, 64 * elm_config_scale_get());
+ evas_object_size_hint_weight_set(sc, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(sc, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ elm_scroller_bounce_set(sc, EINA_FALSE, EINA_TRUE);
+ evas_object_show(sc);
+ elm_object_content_set(sc, box);
+
+ fr = elm_frame_add(box);
+ evas_object_size_hint_weight_set(fr, EVAS_HINT_EXPAND, 0.0);
+ evas_object_size_hint_align_set(fr, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ elm_object_text_set(fr, "Acceleration");
+ elm_box_pack_end(box, fr);
+ evas_object_show(fr);
+
+ bx = elm_box_add(fr);
+ elm_object_content_set(fr, bx);
+ evas_object_show(bx);
+
+ LABEL_FRAME_ADD("<hilight>Wheel acceleration factor</>");
+
+ sl = elm_slider_add(win);
+ elm_object_tooltip_text_set(sl, "This is the factor by which scrolling<br/>"
+ "increments will be multiplied when scrolling<br/>"
+ "quickly");
+ evas_object_data_set(win, "scroll_accel_factor", sl);
+ evas_object_size_hint_weight_set(sl, EVAS_HINT_EXPAND, 0.0);
+ evas_object_size_hint_align_set(sl, EVAS_HINT_FILL, 0.5);
+ elm_slider_span_size_set(sl, 120);
+ elm_slider_unit_format_set(sl, "%1.1f");
+ elm_slider_indicator_format_set(sl, "%2.1f");
+ elm_slider_min_max_set(sl, 0.0, 10.0);
+ elm_slider_value_set(sl, elm_config_scroll_accel_factor_get());
+ elm_box_pack_end(bx, sl);
+ evas_object_show(sl);
+
+ evas_object_smart_callback_add(sl, "changed", bis_round, NULL);
+ evas_object_smart_callback_add(sl, "delay,changed", scroll_accel_factor_change, NULL);
+
+ fr = elm_frame_add(box);
+ evas_object_size_hint_weight_set(fr, EVAS_HINT_EXPAND, 0.0);
+ evas_object_size_hint_align_set(fr, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ elm_object_text_set(fr, "Animation");
+ elm_box_pack_end(box, fr);
+ evas_object_show(fr);
+
+ bx = elm_box_add(fr);
+ elm_object_content_set(fr, bx);
+ evas_object_show(bx);
+
+ /* Disable Scroll Animation */
+ CHECK_ADD("Disable scroll animation",
+ "Set whether scrollers should scroll<br/>"
+ "immediately instead of animating",
+ scroll_animation_disable_change, NULL);
+ evas_object_data_set(win, "scroll_animation_disable", ck);
+ elm_check_state_set(ck, elm_config_scroll_animation_disable_get());
+
+ /* Bounce */
+ _status_config_scrolling_bounce(win, box);
+
+ _status_config_scrolling_thumb(win, box);
+
+ /* Acceleration */
+ _status_config_scrolling_acceleration(win, box);
+
+ fr = elm_frame_add(box);
+ evas_object_size_hint_weight_set(fr, EVAS_HINT_EXPAND, 0.0);
+ evas_object_size_hint_align_set(fr, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ elm_object_text_set(fr, "Friction");
+ elm_box_pack_end(box, fr);
+ evas_object_show(fr);
+
+ bx = elm_box_add(fr);
+ elm_object_content_set(fr, bx);
+ evas_object_show(bx);
+ /* Page scroll friction */
+ LABEL_FRAME_ADD("<hilight>Page scroll friction</>");
+
+ sl = elm_slider_add(win);
+ elm_object_tooltip_text_set(sl, "This is the amount of inertia a<br/>"
+ "paged scroller will impose at<br/>"
+ "page fitting animations");
+ evas_object_data_set(win, "page_scroll_friction_slider", sl);
+ evas_object_size_hint_weight_set(sl, EVAS_HINT_EXPAND, 0.0);
+ evas_object_size_hint_align_set(sl, EVAS_HINT_FILL, 0.5);
+ elm_slider_span_size_set(sl, 120);
+ elm_slider_unit_format_set(sl, "%1.1f");
+ elm_slider_indicator_format_set(sl, "%1.1f");
+ elm_slider_min_max_set(sl, 0.0, 5.0);
+ elm_slider_value_set(sl, elm_config_scroll_page_scroll_friction_get());
+ elm_box_pack_end(bx, sl);
+ evas_object_show(sl);
+
+ evas_object_smart_callback_add(sl, "changed", ps_round, NULL);
+ evas_object_smart_callback_add(sl, "delay,changed", ps_change, NULL);
+
+ /* Bring in scroll friction */
+ LABEL_FRAME_ADD("<hilight>Bring in scroll friction</>");
+
+ sl = elm_slider_add(win);
+ elm_object_tooltip_text_set(sl, "This is the amount of inertia a<br/>"
+ "scroller will impose at region bring<br/>"
+ "animations");
+ evas_object_data_set(win, "bring_in_scroll_friction_slider", sl);
+ evas_object_size_hint_weight_set(sl, EVAS_HINT_EXPAND, 0.0);
+ evas_object_size_hint_align_set(sl, EVAS_HINT_FILL, 0.5);
+ elm_slider_span_size_set(sl, 120);
+ elm_slider_unit_format_set(sl, "%1.1f");
+ elm_slider_indicator_format_set(sl, "%1.1f");
+ elm_slider_min_max_set(sl, 0.0, 5.0);
+ elm_slider_value_set(sl, elm_config_scroll_bring_in_scroll_friction_get());
+ elm_box_pack_end(bx, sl);
+ evas_object_show(sl);
+
+ evas_object_smart_callback_add(sl, "changed", bis_round, NULL);
+ evas_object_smart_callback_add(sl, "delay,changed", bis_change, NULL);
+
+ /* Zoom scroll friction */
+ LABEL_FRAME_ADD("<hilight>Zoom scroll friction</>");
+
+ sl = elm_slider_add(win);
+ elm_object_tooltip_text_set(sl, "This is the amount of inertia<br/>"
+ "scrollers will impose at animations<br/>"
+ "triggered by Elementary widgets'<br/>"
+ "zooming API");
+ evas_object_data_set(win, "zoom_scroll_friction_slider", sl);
+ evas_object_size_hint_weight_set(sl, EVAS_HINT_EXPAND, 0.0);
+ evas_object_size_hint_align_set(sl, EVAS_HINT_FILL, 0.5);
+ elm_slider_span_size_set(sl, 120);
+ elm_slider_unit_format_set(sl, "%1.1f");
+ elm_slider_indicator_format_set(sl, "%1.1f");
+ elm_slider_min_max_set(sl, 0.0, 5.0);
+ elm_slider_value_set(sl, elm_config_scroll_zoom_friction_get());
+ elm_box_pack_end(bx, sl);
+ evas_object_show(sl);
+
+ evas_object_smart_callback_add(sl, "changed", zf_round, NULL);
+ evas_object_smart_callback_add(sl, "delay,changed", zf_change, NULL);
+
+ fr = elm_frame_add(box);
+ evas_object_size_hint_weight_set(fr, EVAS_HINT_EXPAND, 0.0);
+ evas_object_size_hint_align_set(fr, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ elm_object_text_set(fr, "Smooth Start");
+ elm_box_pack_end(box, fr);
+ evas_object_show(fr);
+
+ bx = elm_box_add(fr);
+ elm_object_content_set(fr, bx);
+ evas_object_show(bx);
+ CHECK_ADD("Enable smooth start",
+ "Set whether scrollers start smoothly on thumb<br/>"
+ "scroll",
+ ss_change, NULL);
+ evas_object_data_set(win, "scroll_smooth_start", ck);
+ elm_check_state_set(ck, elm_config_scroll_thumbscroll_smooth_start_get());
+
+ /* Scroll Smooth Amount */
+ LABEL_FRAME_ADD("<hilight>Scroll Smooth Amount</>");
+
+ sl = elm_slider_add(win);
+ elm_object_tooltip_text_set(sl, "This is the amount smoothing to apply<br/>"
+ "to thumbscroll to avoid jerky input");
+ evas_object_data_set(win, "scroll_smooth_amount", sl);
+ evas_object_size_hint_weight_set(sl, EVAS_HINT_EXPAND, 0.0);
+ evas_object_size_hint_align_set(sl, EVAS_HINT_FILL, 0.5);
+ elm_slider_span_size_set(sl, 120);
+ elm_slider_unit_format_set(sl, "%1.2f");
+ elm_slider_indicator_format_set(sl, "%1.2f");
+ elm_slider_min_max_set(sl, 0.0, 1.0);
+ elm_slider_value_set(sl, elm_config_scroll_thumbscroll_smooth_amount_get());
+ elm_box_pack_end(bx, sl);
+ evas_object_show(sl);
+
+ evas_object_smart_callback_add(sl, "changed", smooth_round, NULL);
+ evas_object_smart_callback_add(sl, "delay,changed", smooth_change, NULL);
+
+ /* Scroll Smooth Time Window */
+ LABEL_FRAME_ADD("<hilight>Scroll Smooth Time Window</>");
+
+ sl = elm_slider_add(win);
+ elm_object_tooltip_text_set(sl, "This is the window of time to look back<br/>"
+ "into for smoothing of thumbscroll");
+ evas_object_data_set(win, "scroll_smooth_time_window", sl);
+ evas_object_size_hint_weight_set(sl, EVAS_HINT_EXPAND, 0.0);
+ evas_object_size_hint_align_set(sl, EVAS_HINT_FILL, 0.5);
+ elm_slider_span_size_set(sl, 120);
+ elm_slider_unit_format_set(sl, "%1.2f");
+ elm_slider_indicator_format_set(sl, "%1.2f");
+ elm_slider_min_max_set(sl, 0.0, 1.0);
+ elm_slider_value_set(sl, elm_config_scroll_thumbscroll_smooth_time_window_get());
+ elm_box_pack_end(bx, sl);
+ evas_object_show(sl);
+
+ evas_object_smart_callback_add(sl, "changed", smooth_win_round, NULL);
+ evas_object_smart_callback_add(sl, "delay,changed", smooth_win_change, NULL);
+
+
+ evas_object_data_set(win, "scrolling", sc);
+
+ elm_naviframe_item_simple_push(naviframe, sc);
+}
+
+static void
+_cb_accel(void *data, Evas_Object *obj EINA_UNUSED, void *info EINA_UNUSED)
+{
+ const char *val = data;
+ const char *ss = elm_config_accel_preference_get();
+
+ if ((!ss) || (ss && (strcasecmp(ss, val))))
+ {
+ elm_config_accel_preference_set(val);
+ elm_config_all_flush();
+ }
+}
+
+static void
+_cb_accel_override(void *data EINA_UNUSED, Evas_Object *obj, void *info EINA_UNUSED)
+{
+ Eina_Bool val = elm_check_state_get(obj);
+ Eina_Bool sb = elm_config_accel_preference_override_get();
+
+ if (val != sb)
+ {
+ elm_config_accel_preference_override_set(val);
+ elm_config_all_flush();
+ }
+}
+
+static void
+_cb_vsync(void *data EINA_UNUSED, Evas_Object *obj, void *info EINA_UNUSED)
+{
+ Eina_Bool val = elm_check_state_get(obj);
+ Eina_Bool sb = elm_config_vsync_get();
+
+ if (val != sb)
+ {
+ elm_config_vsync_set(val);
+ elm_config_all_flush();
+ }
+}
+
+static void
+_status_config_rendering(Evas_Object *win,
+ Evas_Object *naviframe)
+{
+ Evas_Object *li, *bx, *ck, *sp;
+ Elm_Object_Item *it;
+
+ bx = elm_box_add(win);
+ evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(bx, EVAS_HINT_FILL, EVAS_HINT_FILL);
+
+ li = elm_list_add(win);
+ evas_object_size_hint_weight_set(li, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(li, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ elm_box_pack_end(bx, li);
+ evas_object_show(li);
+
+ it = elm_list_item_append(li, "No Acceleration", NULL, NULL,
+ _cb_accel, "none");
+ if (!elm_config_accel_preference_get() ||
+ (!strcasecmp(elm_config_accel_preference_get(), "none")))
+ elm_list_item_selected_set(it, EINA_TRUE);
+
+ it = elm_list_item_append(li, "OpenGL / OpenGL-ES", NULL, NULL,
+ _cb_accel, "gl");
+ if (elm_config_accel_preference_get() &&
+ ((!strcasecmp(elm_config_accel_preference_get(), "gl")) ||
+ (!strcasecmp(elm_config_accel_preference_get(), "opengl"))))
+ elm_list_item_selected_set(it, EINA_TRUE);
+
+ it = elm_list_item_append(li, "3D (any 3D hardware)", NULL, NULL,
+ _cb_accel, "3d");
+ if (elm_config_accel_preference_get() &&
+ (!strcasecmp(elm_config_accel_preference_get(), "3d")))
+ elm_list_item_selected_set(it, EINA_TRUE);
+
+ it = elm_list_item_append(li, "Hardware (any hardware)", NULL, NULL,
+ _cb_accel, "hw");
+ if (elm_config_accel_preference_get() &&
+ ((!strcasecmp(elm_config_accel_preference_get(), "hw")) ||
+ (!strcasecmp(elm_config_accel_preference_get(), "hardware")) ||
+ (!strcasecmp(elm_config_accel_preference_get(), "accel"))))
+ elm_list_item_selected_set(it, EINA_TRUE);
+
+ elm_list_go(li);
+
+ CHECK_ADD("Override Preferred Acceleration",
+ "Force any application requesting<br>"
+ "acceleration to use the system<br>"
+ "configured acceleration as above",
+ _cb_accel_override, NULL);
+ elm_check_state_set(ck, elm_config_accel_preference_override_get());
+
+ /////////////////////////////////////////////
+ sp = elm_separator_add(win);
+ elm_separator_horizontal_set(sp, EINA_TRUE);
+ evas_object_size_hint_weight_set(sp, EVAS_HINT_EXPAND, 0.0);
+ evas_object_size_hint_align_set(sp, EVAS_HINT_FILL, 0.5);
+ elm_box_pack_end(bx, sp);
+ evas_object_show(sp);
+
+ CHECK_ADD("Tear-free rendering (VSync)",
+ "This enables Vsync hints for some<br>"
+ "rendering engines to try keep display<br>"
+ "VSynced and from Tearing",
+ _cb_vsync, NULL);
+ elm_check_state_set(ck, elm_config_vsync_get());
+
+ evas_object_data_set(win, "rendering", bx);
+ elm_naviframe_item_simple_push(naviframe, bx);
+}
+
+static void
+_status_config_caches(Evas_Object *win,
+ Evas_Object *naviframe)
+{
+ Evas_Object *lb, *pd, *bx, *sl, *sp, *ck;
+
+ bx = elm_box_add(win);
+ evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, 0.0);
+ evas_object_size_hint_align_set(bx, EVAS_HINT_FILL, 0.5);
+
+ LABEL_FRAME_ADD("<hilight>Cache Flush Interval (8 ticks per second)</>");
+
+ sl = elm_slider_add(win);
+ evas_object_data_set(win, "cache_flush_interval_slider", sl);
+ evas_object_size_hint_weight_set(sl, EVAS_HINT_EXPAND, 0.0);
+ evas_object_size_hint_align_set(sl, EVAS_HINT_FILL, 0.5);
+ elm_slider_span_size_set(sl, 120);
+ elm_slider_unit_format_set(sl, "%1.0f ticks");
+ elm_slider_indicator_format_set(sl, "%1.0f");
+ elm_slider_min_max_set(sl, 8.0, 4096.0);
+ elm_slider_value_set(sl, elm_config_cache_flush_interval_get());
+ elm_object_disabled_set(sl, !elm_config_cache_flush_enabled_get());
+
+ CHECK_ADD("Enable Flushing", "Enable Flushing", cf_enable, sl);
+ elm_check_state_set(ck, elm_config_cache_flush_enabled_get());
+
+ elm_box_pack_end(bx, sl);
+ evas_object_show(sl);
+
+ evas_object_smart_callback_add(sl, "changed", cf_round, NULL);
+ evas_object_smart_callback_add(sl, "delay,changed", cf_change, NULL);
+
+ sp = elm_separator_add(win);
+ elm_separator_horizontal_set(sp, EINA_TRUE);
+ evas_object_size_hint_weight_set(sp, EVAS_HINT_EXPAND, 0.0);
+ evas_object_size_hint_align_set(sp, EVAS_HINT_FILL, 0.5);
+ elm_box_pack_end(bx, sp);
+ evas_object_show(sp);
+
+ LABEL_FRAME_ADD("<hilight>Font Cache Size</>");
+
+ sl = elm_slider_add(win);
+ evas_object_data_set(win, "font_cache_slider", sl);
+ evas_object_size_hint_weight_set(sl, EVAS_HINT_EXPAND, 0.0);
+ evas_object_size_hint_align_set(sl, EVAS_HINT_FILL, 0.5);
+ elm_slider_span_size_set(sl, 120);
+ elm_slider_unit_format_set(sl, "%1.1f MB");
+ elm_slider_indicator_format_set(sl, "%1.1f");
+ elm_slider_min_max_set(sl, 0.0, 4.0);
+ elm_slider_value_set(sl, (double)elm_config_cache_font_cache_size_get() / 1024.0);
+ elm_box_pack_end(bx, sl);
+ evas_object_show(sl);
+
+ evas_object_smart_callback_add(sl, "changed", fc_round, NULL);
+ evas_object_smart_callback_add(sl, "delay,changed", fc_change, NULL);
+
+ sp = elm_separator_add(win);
+ elm_separator_horizontal_set(sp, EINA_TRUE);
+ evas_object_size_hint_weight_set(sp, EVAS_HINT_EXPAND, 0.0);
+ evas_object_size_hint_align_set(sp, EVAS_HINT_FILL, 0.5);
+ elm_box_pack_end(bx, sp);
+ evas_object_show(sp);
+
+ LABEL_FRAME_ADD("<hilight>Image Cache Size</>");
+
+ sl = elm_slider_add(win);
+ evas_object_data_set(win, "image_cache_slider", sl);
+ evas_object_size_hint_weight_set(sl, EVAS_HINT_EXPAND, 0.0);
+ evas_object_size_hint_align_set(sl, EVAS_HINT_FILL, 0.5);
+ elm_slider_span_size_set(sl, 120);
+ elm_slider_unit_format_set(sl, "%1.0f MB");
+ elm_slider_indicator_format_set(sl, "%1.0f");
+ elm_slider_min_max_set(sl, 0, 32);
+ elm_slider_value_set(sl, (double)elm_config_cache_image_cache_size_get() / 1024.0);
+ elm_box_pack_end(bx, sl);
+ evas_object_show(sl);
+
+ evas_object_smart_callback_add(sl, "changed", ic_round, NULL);
+ evas_object_smart_callback_add(sl, "delay,changed", ic_change, NULL);
+
+ sp = elm_separator_add(win);
+ elm_separator_horizontal_set(sp, EINA_TRUE);
+ evas_object_size_hint_weight_set(sp, EVAS_HINT_EXPAND, 0.0);
+ evas_object_size_hint_align_set(sp, EVAS_HINT_FILL, 0.5);
+ elm_box_pack_end(bx, sp);
+ evas_object_show(sp);
+
+ LABEL_FRAME_ADD("<hilight>Number of Edje Files to Cache</>");
+
+ sl = elm_slider_add(win);
+ evas_object_data_set(win, "edje_file_cache_slider", sl);
+ evas_object_size_hint_weight_set(sl, EVAS_HINT_EXPAND, 0.0);
+ evas_object_size_hint_align_set(sl, EVAS_HINT_FILL, 0.5);
+ elm_slider_span_size_set(sl, 120);
+ elm_slider_unit_format_set(sl, "%1.0f files");
+ elm_slider_indicator_format_set(sl, "%1.0f");
+ elm_slider_min_max_set(sl, 0, 32);
+ elm_slider_value_set(sl, elm_config_cache_edje_file_cache_size_get());
+ elm_box_pack_end(bx, sl);
+ evas_object_show(sl);
+
+ evas_object_smart_callback_add(sl, "changed", efc_round, NULL);
+ evas_object_smart_callback_add(sl, "delay,changed", efc_change, NULL);
+
+ sp = elm_separator_add(win);
+ elm_separator_horizontal_set(sp, EINA_TRUE);
+ evas_object_size_hint_weight_set(sp, EVAS_HINT_EXPAND, 0.0);
+ evas_object_size_hint_align_set(sp, EVAS_HINT_FILL, 0.5);
+ elm_box_pack_end(bx, sp);
+ evas_object_show(sp);
+
+ LABEL_FRAME_ADD("<hilight>Number of Edje Collections to Cache</>");
+
+ sl = elm_slider_add(win);
+ evas_object_data_set(win, "edje_collection_cache_slider", sl);
+ evas_object_size_hint_weight_set(sl, EVAS_HINT_EXPAND, 0.0);
+ evas_object_size_hint_align_set(sl, EVAS_HINT_FILL, 0.5);
+ elm_slider_span_size_set(sl, 120);
+ elm_slider_unit_format_set(sl, "%1.0f collections");
+ elm_slider_indicator_format_set(sl, "%1.0f");
+ elm_slider_min_max_set(sl, 0, 128);
+ elm_slider_value_set(sl, elm_config_cache_edje_collection_cache_size_get());
+ elm_box_pack_end(bx, sl);
+ evas_object_show(sl);
+
+ evas_object_smart_callback_add(sl, "changed", ecc_round, NULL);
+ evas_object_smart_callback_add(sl, "delay,changed", ecc_change, NULL);
+
+ evas_object_data_set(win, "caches", bx);
+
+ elm_naviframe_item_simple_push(naviframe, bx);
+}
+
+static void
+_status_config_full(Evas_Object *win,
+ Evas_Object *bx0)
+{
+ Evas_Object *tb, *naviframe;
+ Elm_Object_Item *tb_sizing, *tb_it;
+
+ tb = elm_toolbar_add(win);
+ elm_toolbar_select_mode_set(tb, ELM_OBJECT_SELECT_MODE_ALWAYS);
+ elm_toolbar_menu_parent_set(tb, win);
+ elm_toolbar_homogeneous_set(tb, EINA_FALSE);
+ evas_object_size_hint_weight_set(tb, EVAS_HINT_EXPAND, 0.0);
+ evas_object_size_hint_align_set(tb, EVAS_HINT_FILL, EVAS_HINT_FILL);
+
+ tb_sizing = elm_toolbar_item_append(tb, "zoom-fit-best", "Sizing",
+ _cf_sizing, win);
+ elm_toolbar_item_priority_set(tb_sizing, 100);
+
+ tb_it = elm_toolbar_item_append(tb, "preferences-desktop-theme", "Theme",
+ _cf_themes, win);
+ elm_toolbar_item_priority_set(tb_it, 90);
+
+ elm_toolbar_item_append(tb, "preferences-desktop-font", "Fonts",
+ _cf_fonts, win);
+
+ tb_it = elm_toolbar_item_append(tb, "system-users", "Profiles",
+ _cf_profiles, win);
+ elm_toolbar_item_priority_set(tb_it, 90);
+
+ elm_toolbar_item_append(tb, "system-run", "Scrolling", _cf_scrolling, win);
+ elm_toolbar_item_append(tb, "video-display", "Rendering",
+ _cf_rendering, win);
+ elm_toolbar_item_append(tb, "appointment-new", "Caches", _cf_caches, win);
+ elm_toolbar_item_append(tb, "sound", "Audio", _cf_audio, win);
+ elm_toolbar_item_append(tb, NULL, "Focus", _cf_focus, win);
+ elm_toolbar_item_append(tb, NULL, "Etc", _cf_etc, win);
+
+ elm_box_pack_end(bx0, tb);
+ evas_object_show(tb);
+
+ naviframe = elm_naviframe_add(win);
+ evas_object_size_hint_align_set(naviframe, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ evas_object_size_hint_weight_set(naviframe, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_data_set(win, "naviframe", naviframe);
+
+ _status_config_themes(win, naviframe);
+ _status_config_fonts(win, naviframe);
+ _status_config_profiles(win, naviframe);
+ _status_config_rendering(win, naviframe);
+ _status_config_scrolling(win, naviframe);
+ _status_config_caches(win, naviframe);
+ _status_config_audio(win, naviframe);
+ _status_config_focus(win, naviframe);
+ _status_config_etc(win, naviframe);
+ _status_config_sizing(win, naviframe); // Note: call this at the end.
+
+ // FIXME uncomment after flip style fix, please
+ //elm_object_style_set(naviframe, "flip");
+ elm_toolbar_item_selected_set(tb_sizing, EINA_TRUE);
+ elm_box_pack_end(bx0, naviframe);
+ evas_object_show(naviframe);
+}
+
+static void
+win_create(void)
+{
+ Evas_Object *win, *bx0;
+
+ win = elm_win_util_standard_add("main", "Elementary Config");
+ if (!win) exit(1);
+ ecore_event_handler_add(ELM_EVENT_CONFIG_ALL_CHANGED, _config_all_changed,
+ win);
+ evas_object_smart_callback_add(win, "delete,request", config_exit, NULL);
+
+ bx0 = elm_box_add(win);
+ evas_object_size_hint_weight_set(bx0, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ elm_win_resize_object_add(win, bx0);
+ evas_object_show(bx0);
+
+ if (!interactive) _status_basic(win, bx0);
+ else if (0)
+ _status_config(win, bx0);
+ else _status_config_full(win, bx0);
+
+ evas_object_resize(win, 320, 480);
+ evas_object_show(win);
+}
+
+static Eina_Bool
+_exit_timer(void *data EINA_UNUSED)
+{
+ elm_exit();
+ return ECORE_CALLBACK_CANCEL;
+}
+
+/* this is your elementary main function - it MUST be called IMMEDIATELY
+ * after elm_init() and MUST be passed argc and argv, and MUST be called
+ * elm_main and not be static - must be a visible symbol with EAPI infront */
+EAPI_MAIN int
+elm_main(int argc,
+ char **argv)
+{
+ int i;
+
+ elm_app_info_set(elm_main, "elementary", "images/logo.png");
+ elm_app_compile_bin_dir_set(PACKAGE_BIN_DIR);
+ elm_app_compile_data_dir_set(PACKAGE_DATA_DIR);
+
+ for (i = 1; i < argc; i++)
+ {
+ if (!strcmp(argv[i], "-h"))
+ {
+ printf("Usage:\n"
+ " -h This help\n"
+ " -q Quiet mode (dont show window)\n"
+ " -t THEME Set theme to THEME (ELM_THEME spec)\n"
+ " -f SIZE Set finger size to SIZE pixels\n"
+ " -s SCALE Set scale factor to SCALE\n"
+ " -w WEB_BACKEND Set the web backend to be used\n"
+ );
+ }
+ else if (!strcmp(argv[i], "-q"))
+ {
+ quiet = 1;
+ interactive = 0;
+ }
+ else if ((!strcmp(argv[i], "-t")) && (i < argc - 1))
+ {
+ i++;
+ theme_set = argv[i];
+ interactive = 0;
+ }
+ else if ((!strcmp(argv[i], "-f")) && (i < argc - 1))
+ {
+ i++;
+ finger_size_set = argv[i];
+ interactive = 0;
+ }
+ else if ((!strcmp(argv[i], "-s")) && (i < argc - 1))
+ {
+ i++;
+ scale_set = argv[i];
+ interactive = 0;
+ }
+ else if ((!strcmp(argv[i], "-w")) && (i < argc - 1))
+ {
+ i++;
+ web_backend = argv[i];
+ interactive = 0;
+ }
+ }
+ /* put here any init code specific to this app like parsing args, etc. */
+ if (!quiet)
+ {
+#ifdef ELM_EFREET
+ elm_need_efreet();
+#endif
+ win_create(); /* create main window */
+ if (!interactive)
+ ecore_timer_add(2.0, _exit_timer, NULL);
+ }
+ if (!interactive)
+ {
+ if (theme_set) elm_theme_set(NULL, theme_set);
+ if (finger_size_set) elm_config_finger_size_set(atoi(finger_size_set));
+ if (scale_set) elm_config_scale_set(atof(scale_set));
+ if (web_backend) elm_config_web_backend_set(web_backend);
+
+ elm_config_all_flush();
+
+ if (quiet) elm_exit();
+ }
+ elm_run(); /* and run the program now and handle all events, etc. */
+ /* if the mainloop that elm_run() runs exists, we exit the app */
+ /* exit code */
+
+ if (interactive)
+ {
+ const char *web_backend_set = elm_config_web_backend_get();
+
+ web_backend = elm_object_text_get(web_backend_entry);
+ fprintf(stderr, "[%s] vs [%s]\n", web_backend, web_backend_set);
+ if (strcmp(web_backend, web_backend_set))
+ {
+ elm_config_web_backend_set(web_backend);
+ fprintf(stderr, "web backend set to : [%s]\n", elm_config_web_backend_get());
+ elm_config_all_flush();
+ }
+ }
+
+ return 0;
+}
+/* All elementary apps should use this. Put it right after elm_main() */
+ELM_MAIN()
diff --git a/src/bin/elementary/elementary_codegen.c b/src/bin/elementary/elementary_codegen.c
new file mode 100644
index 0000000000..e9cc685b66
--- /dev/null
+++ b/src/bin/elementary/elementary_codegen.c
@@ -0,0 +1,887 @@
+#ifdef HAVE_CONFIG_H
+# include "elementary_config.h"
+#endif
+
+#include <Ecore.h>
+#include <Ecore_Evas.h>
+#include <Ecore_Getopt.h>
+#include <Edje.h>
+#define EDJE_EDIT_IS_UNSTABLE_AND_I_KNOW_ABOUT_IT 1
+#include <Edje_Edit.h>
+#include <Eina.h>
+
+#include <Elementary.h>
+
+#include <ctype.h>
+#include <fcntl.h>
+#include <locale.h>
+#include <stdio.h>
+#include <unistd.h>
+
+#ifndef ENABLE_NLS
+# ifndef libintl_setlocale
+# define libintl_setlocale(c, l)
+# endif
+#endif
+
+static int _log_dom;
+#define DBG(...) EINA_LOG_DOM_DBG(_log_dom, __VA_ARGS__)
+#define ERR(...) EINA_LOG_DOM_ERR(_log_dom, __VA_ARGS__)
+#define WRN(...) EINA_LOG_DOM_WARN(_log_dom, __VA_ARGS__)
+
+static Ecore_Evas *ee = NULL;
+static char *file = NULL;
+static char *group = NULL;
+static char *prefix = NULL;
+static FILE *source_fd = NULL;
+static FILE *header_fd = NULL;
+
+#define H_HEADER \
+ "#ifndef _%s\n" \
+ "#define _%s\n\n" \
+ "#include <Edje.h>\n" \
+ "#include <Elementary.h>\n" \
+ "#include <Evas.h>\n\n" \
+ "#include <stdlib.h>\n\n"
+
+#define H_FOOTER \
+ "\n#endif /* _%s */\n"
+
+#define C_HEADER \
+ "#include \"%s\"\n\n"
+
+#define H_CODEGEN_LAYOUT_ADD \
+ "/**\n * @brief Creates the layout object and set the theme\n" \
+ " * @param o The parent\n" \
+ " * @param th The theme to add to, or if NULL, the default theme\n" \
+ " * @param edje_file The path to edj, if NULL it's used the path given\n" \
+ " * to elementary_codegen\n */\n" \
+ "Evas_Object *%s_layout_add(Evas_Object *o, Elm_Theme *th, " \
+ "const char *edje_file);\n"
+
+#define C_CODEGEN_LAYOUT_ADD \
+ "Evas_Object *\n" \
+ "%s_layout_add(Evas_Object *o, Elm_Theme *th, const char *edje_file)\n" \
+ "{\n" \
+ " Evas_Object *l;\n\n" \
+ " if (edje_file)\n" \
+ " elm_theme_extension_add(th, edje_file);\n" \
+ " else\n" \
+ " elm_theme_extension_add(th, \"./%s\");\n\n" \
+ " l = elm_layout_add(o);\n" \
+ " if (!l) return NULL;\n\n" \
+ " if (!elm_layout_theme_set(l, \"%s\", \"%s\", \"%s\"))\n" \
+ " {\n" \
+ " evas_object_del(l);\n" \
+ " return NULL;\n" \
+ " }\n\n" \
+ " return l;\n" \
+ "}\n\n"
+
+#define C_CODEGEN_PART_CONTENT_SET \
+ "void\n" \
+ "%s_%s_set(Evas_Object *o, Evas_Object *value)\n" \
+ "{\n" \
+ " elm_layout_content_set(o, \"%s\", value);\n" \
+ "}\n\n"
+
+#define C_CODEGEN_PART_TEXT_SET \
+ "void\n" \
+ "%s_%s_set(Evas_Object *o, const char *value)\n" \
+ "{\n" \
+ " elm_layout_text_set(o, \"%s\", value);\n" \
+ "}\n\n"
+
+#define C_CODEGEN_PART_CONTENT_UNSET \
+ "Evas_Object *\n" \
+ "%s_%s_unset(Evas_Object *o)\n" \
+ "{\n" \
+ " return elm_layout_content_unset(o, \"%s\");\n" \
+ "}\n\n"
+
+#define H_CODEGEN_PART_CONTENT_SET \
+ "void %s_%s_set(Evas_Object *o, Evas_Object *value);\n"
+
+#define H_CODEGEN_PART_TEXT_SET \
+ "void %s_%s_set(Evas_Object *o, const char *value);\n"
+
+#define H_CODEGEN_PART_CONTENT_UNSET \
+ "Evas_Object *%s_%s_unset(Evas_Object *o);\n"
+
+#define C_CODEGEN_PART_CONTENT_GET \
+ "Evas_Object *\n" \
+ "%s_%s_get(const Evas_Object *o)\n" \
+ "{\n" \
+ " return elm_layout_content_get(o, \"%s\");\n" \
+ "}\n\n"
+
+#define H_CODEGEN_PART_CONTENT_GET \
+ "Evas_Object *%s_%s_get(const Evas_Object *o);\n"
+
+#define C_CODEGEN_PART_TEXT_GET \
+ "const char *\n" \
+ "%s_%s_get(const Evas_Object *o)\n" \
+ "{\n" \
+ " return elm_layout_text_get(o, \"%s\");\n" \
+ "}\n\n"
+
+#define H_CODEGEN_PART_TEXT_GET \
+ "const char *%s_%s_get(const Evas_Object *o);\n"
+
+#define C_CODEGEN_PART_BOX_APPEND \
+ "Eina_Bool\n" \
+ "%s_%s_append(Evas_Object *o, Evas_Object *child)\n" \
+ "{\n" \
+ " return elm_layout_box_append(o, \"%s\", child);\n" \
+ "}\n\n"
+
+#define H_CODEGEN_PART_BOX_APPEND \
+ "Eina_Bool %s_%s_append(Evas_Object *o, Evas_Object *child);\n"
+
+#define C_CODEGEN_PART_BOX_PREPEND \
+ "Eina_Bool\n" \
+ "%s_%s_prepend(Evas_Object *o, Evas_Object *child)\n" \
+ "{\n" \
+ " return elm_layout_box_prepend(o, \"%s\", child);\n" \
+ "}\n\n"
+
+#define H_CODEGEN_PART_BOX_PREPEND \
+ "Eina_Bool %s_%s_prepend(Evas_Object *o, Evas_Object *child);\n"
+
+#define C_CODEGEN_PART_BOX_INSERT_BEFORE \
+ "Eina_Bool\n" \
+ "%s_%s_insert_before(Evas_Object *o, Evas_Object *child, " \
+ "const Evas_Object *reference)\n" \
+ "{\n" \
+ " return elm_layout_box_insert_before(o, \"%s\", " \
+ "child, reference);\n" \
+ "}\n\n"
+
+#define H_CODEGEN_PART_BOX_INSERT_BEFORE \
+ "Eina_Bool %s_%s_insert_before(Evas_Object *o, Evas_Object *child, " \
+ "const Evas_Object *reference);\n"
+
+#define C_CODEGEN_PART_BOX_INSERT_AT \
+ "Eina_Bool\n" \
+ "%s_%s_insert_at(Evas_Object *o, Evas_Object *child, unsigned int pos)\n" \
+ "{\n" \
+ " return elm_layout_box_insert_at(o, \"%s\", child, pos);\n" \
+ "}\n\n"
+
+#define H_CODEGEN_PART_BOX_INSERT_AT \
+ "Eina_Bool %s_%s_insert_at(Evas_Object *o, Evas_Object *child, " \
+ "unsigned int pos);\n"
+
+#define C_CODEGEN_PART_BOX_REMOVE \
+ "Evas_Object *\n" \
+ "%s_%s_remove(Evas_Object *o, Evas_Object *child)\n" \
+ "{\n" \
+ " return elm_layout_box_remove(o, \"%s\", child);\n" \
+ "}\n\n"
+
+#define H_CODEGEN_PART_BOX_REMOVE \
+ "Evas_Object *%s_%s_remove(Evas_Object *o, Evas_Object *child);\n"
+
+#define C_CODEGEN_PART_BOX_REMOVE_ALL \
+ "Eina_Bool\n" \
+ "%s_%s_remove_all(Evas_Object *o, Eina_Bool clear)\n" \
+ "{\n" \
+ " return elm_layout_box_remove_all(o, \"%s\", clear);\n" \
+ "}\n\n"
+
+#define H_CODEGEN_PART_BOX_REMOVE_ALL \
+ "Eina_Bool %s_%s_remove_all(Evas_Object *o, Eina_Bool clear);\n"
+
+#define C_CODEGEN_PART_TABLE_PACK \
+ "Eina_Bool\n" \
+ "%s_%s_pack(Evas_Object *o, Evas_Object *child, unsigned short col, " \
+ "unsigned short row, unsigned short colspan, unsigned short rowspan)\n" \
+ "{\n" \
+ " return elm_layout_table_pack(o, \"%s\", child, col, row, " \
+ "colspan, rowspan);\n" \
+ "}\n\n"
+
+#define H_CODEGEN_PART_TABLE_PACK \
+ "Eina_Bool %s_%s_pack(Evas_Object *o, Evas_Object *child, " \
+ "unsigned short col, unsigned short row, unsigned short " \
+ "colspan, unsigned short rowspan);\n"
+
+#define C_CODEGEN_PART_TABLE_UNPACK \
+ "Evas_Object *\n" \
+ "%s_%s_unpack(Evas_Object *o, Evas_Object *child)\n" \
+ "{\n" \
+ " return elm_layout_table_unpack(o, \"%s\", child);\n" \
+ "}\n\n"
+
+#define H_CODEGEN_PART_TABLE_UNPACK \
+ "Evas_Object *%s_%s_unpack(Evas_Object *o, Evas_Object *child);\n"
+
+#define C_CODEGEN_PART_TABLE_CLEAR \
+ "Eina_Bool\n" \
+ "%s_%s_clear(Evas_Object *o, Eina_Bool clear)\n" \
+ "{\n" \
+ " return elm_layout_table_clear(o, \"%s\", clear);\n" \
+ "}\n\n"
+
+#define H_CODEGEN_PART_TABLE_CLEAR \
+ "Eina_Bool %s_%s_clear(Evas_Object *o, Eina_Bool clear);\n"
+
+#define C_CODEGEN_PROGRAM_EMIT \
+ "void\n" \
+ "%s_%s_emit(Evas_Object *o)\n" \
+ "{\n" \
+ " elm_layout_signal_emit(o, \"%s\", \"%s\");\n" \
+ "}\n\n"
+
+#define H_CODEGEN_PROGRAM_EMIT \
+ "void %s_%s_emit(Evas_Object *o);\n"
+
+#define C_CODEGEN_PROGRAM_CALLBACK_ADD \
+ "void\n" \
+ "%s_%s_callback_add(Evas_Object *o, Edje_Signal_Cb func, void *data)\n" \
+ "{\n" \
+ " elm_layout_signal_callback_add(o, \"%s\", \"%s\", func, data);\n" \
+ "}\n\n"
+
+#define H_CODEGEN_PROGRAM_CALLBACK_ADD \
+ "void %s_%s_callback_add(Evas_Object *o, Edje_Signal_Cb func, " \
+ "void *data);\n"
+
+#define C_CODEGEN_PROGRAM_CALLBACK_DEL \
+ "void\n" \
+ "%s_%s_callback_del(Evas_Object *o, Edje_Signal_Cb func)\n" \
+ "{\n" \
+ " elm_layout_signal_callback_del(o, \"%s\", \"%s\", func);\n" \
+ "}\n\n"
+
+#define H_CODEGEN_PROGRAM_CALLBACK_DEL \
+ "void %s_%s_callback_del(Evas_Object *o, Edje_Signal_Cb func);\n"
+
+const Ecore_Getopt optdesc =
+{
+ "elm_codegen",
+ "%prog [options] <file.edj> <group> <source_file_name> <header_file_name>",
+ PACKAGE_VERSION,
+ "(C) 2012 - The Enlightenment Project",
+ "BSD",
+ "elm_codegen generates the boilerplate code to get and set the "
+ "parts of a group from a compiled (binary) edje "
+ "file avoiding common errors with typos.\n",
+ 0,
+ {
+ ECORE_GETOPT_STORE_STR('p', "prefix", "The prefix for the " \
+ "generataed code."),
+ ECORE_GETOPT_LICENSE('L', "license"),
+ ECORE_GETOPT_COPYRIGHT('C', "copyright"),
+ ECORE_GETOPT_VERSION('V', "version"),
+ ECORE_GETOPT_HELP('h', "help"),
+ ECORE_GETOPT_SENTINEL
+ }
+};
+
+static char *
+_header_standardize(const char *filename)
+{
+ char *str, *itr, *aux;
+
+ aux = strrchr(filename, '/');
+ str = itr = strdup(aux ? aux + 1 : filename);
+
+ for (; *itr; itr++)
+ if (*itr == '.')
+ *itr = '_';
+ else
+ *itr = toupper(*itr);
+
+ return str;
+}
+
+static Eina_Bool
+_file_descriptors_open(const char *source, const char *header)
+{
+ header_fd = fopen(header, "w");
+ if (!header_fd)
+ return EINA_FALSE;
+
+ source_fd = fopen(source, "w");
+ if (!source_fd)
+ goto err;
+
+ return EINA_TRUE;
+
+ err:
+ fclose(header_fd);
+ return EINA_FALSE;
+}
+
+static Eina_Bool
+_file_descriptors_close(void)
+{
+ Eina_Bool ret = EINA_FALSE;
+
+ if (!fclose(header_fd))
+ ret = EINA_TRUE;
+
+ if (!fclose(source_fd))
+ ret &= EINA_TRUE;
+
+ return ret;
+}
+
+static Eina_Bool
+_headers_write(const char *filename)
+{
+ char buf[512];
+ char *str;
+
+ str = _header_standardize(filename);
+ snprintf(buf, sizeof(buf), H_HEADER, str, str);
+ if (fwrite(buf, strlen(buf), 1, header_fd) != 1)
+ {
+ free(str);
+ return EINA_FALSE;
+ }
+
+ free(str);
+
+ snprintf(buf, sizeof(buf), C_HEADER, filename);
+ if (fwrite(buf, strlen(buf), 1, source_fd) != 1)
+ return EINA_FALSE;
+
+ return EINA_TRUE;
+}
+
+static Eina_Bool
+_footer_write(const char *filename)
+{
+ char buf[512];
+ char *str;
+
+ str = _header_standardize(filename);
+ snprintf(buf, sizeof(buf), H_FOOTER, str);
+ if (fwrite(buf, strlen(buf), 1, header_fd) != 1)
+ {
+ free(str);
+ return EINA_FALSE;
+ }
+
+ free(str);
+
+ return EINA_TRUE;
+}
+
+static Eina_Bool
+_theme_set_write(void)
+{
+ Eina_Bool ret = EINA_FALSE;
+ char *str[3]; /* *klas, *style, *group */
+ char *token, *_group, buf[512];
+ int i;
+
+ str[0] = str[1] = str[2] = NULL;
+ if (strncmp(group, "elm/", 4)) return EINA_FALSE;
+
+ _group = strdup(group);
+ if (!_group) return EINA_FALSE;
+
+ strtok(_group, "/");
+ for (i = 0; i < 3; i++)
+ {
+ token = strtok(NULL, "/");
+ if (!token) break;
+
+ str[i] = token;
+ }
+
+ if (!str[0] || !str[1] || !str[2])
+ goto end;
+
+ snprintf(buf, sizeof(buf), C_CODEGEN_LAYOUT_ADD, prefix, file, str[0],
+ str[1], str[2]);
+ if (fwrite(buf, strlen(buf), 1, source_fd) != 1)
+ goto end;
+
+ snprintf(buf, sizeof(buf), H_CODEGEN_LAYOUT_ADD, prefix);
+ if (fwrite(buf, strlen(buf), 1, header_fd) != 1)
+ goto end;
+
+ ret = EINA_TRUE;
+
+end:
+ free(_group);
+ return ret;
+}
+
+static Eina_Bool
+_part_write(const char *apiname, const char *partname, const char *description,
+ Edje_Part_Type type)
+{
+ char buf[1024];
+
+#define TEMPLATE_NAME(sufix) \
+ do { \
+ snprintf(buf, sizeof(buf), C_CODEGEN_PART_##sufix, prefix, \
+ apiname, partname); \
+ if (fwrite(buf, strlen(buf), 1, source_fd) != 1) \
+ goto err; \
+ snprintf(buf, sizeof(buf), H_CODEGEN_PART_##sufix, prefix, \
+ apiname); \
+ if (fwrite(buf, strlen(buf), 1, header_fd) != 1) \
+ goto err; \
+ } while(0)
+
+ if (description)
+ {
+ snprintf(buf, sizeof(buf), "\n/**\n * @brief %s\n */\n", description);
+ if (fwrite(buf, strlen(buf), 1, header_fd) != 1)
+ goto err;
+ }
+
+ switch (type)
+ {
+ case EDJE_PART_TYPE_BOX:
+ TEMPLATE_NAME(BOX_APPEND);
+ TEMPLATE_NAME(BOX_PREPEND);
+ TEMPLATE_NAME(BOX_INSERT_BEFORE);
+ TEMPLATE_NAME(BOX_INSERT_AT);
+ TEMPLATE_NAME(BOX_REMOVE);
+ TEMPLATE_NAME(BOX_REMOVE_ALL);
+ break;
+
+ case EDJE_PART_TYPE_TABLE:
+ TEMPLATE_NAME(TABLE_PACK);
+ TEMPLATE_NAME(TABLE_UNPACK);
+ TEMPLATE_NAME(TABLE_CLEAR);
+ break;
+
+ case EDJE_PART_TYPE_TEXT:
+ TEMPLATE_NAME(TEXT_SET);
+ TEMPLATE_NAME(TEXT_GET);
+ break;
+
+ default:
+ TEMPLATE_NAME(CONTENT_SET);
+ TEMPLATE_NAME(CONTENT_UNSET);
+ TEMPLATE_NAME(CONTENT_GET);
+ break;
+ }
+
+#undef TEMPLATE_NAME
+
+ return EINA_TRUE;
+
+ err:
+ ERR("Could not write the part: %s", partname);
+ return EINA_FALSE;
+}
+
+static inline Eina_Bool
+_c_id_allowed(char c)
+{
+ if ((c >= '0') && (c <= '9')) return EINA_TRUE;
+ if ((c >= 'a') && (c <= 'z')) return EINA_TRUE;
+ if ((c >= 'A') && (c <= 'Z')) return EINA_TRUE;
+
+ return EINA_FALSE;
+}
+
+static char *
+_api_name_fix(const char *orig)
+{
+ char *d, *d_end, buf[256];
+ const char *s;
+
+ if (!orig) return NULL;
+
+ s = orig;
+ d = buf;
+ d_end = d + sizeof(buf) - 1;
+
+ for (; (*s != '\0') && (d < d_end); s++, d++)
+ if (_c_id_allowed(*s)) *d = *s;
+ else *d = '_';
+ *d = '\0';
+
+ return strdup(buf);
+}
+
+static char *
+_part_api_name_get(Evas_Object *ed, const char *program)
+{
+ const char *orig;
+ char *fix;
+
+ orig = edje_edit_part_api_name_get(ed, program);
+ fix = _api_name_fix(orig);
+ edje_edit_string_free(orig);
+
+ return fix;
+}
+
+static Eina_Bool
+_parts_parse(Evas_Object *ed)
+{
+ Eina_List *parts, *l;
+ const char *name, *description;
+ char *apiname;
+ Edje_Part_Type type;
+ Eina_Bool ret = EINA_TRUE;
+
+ parts = edje_edit_parts_list_get(ed);
+ EINA_LIST_FOREACH(parts, l, name)
+ {
+ if (!(apiname = _part_api_name_get(ed, name)))
+ {
+ DBG("filter out part '%s': not API.", name);
+ continue;
+ }
+
+ type = edje_edit_part_type_get(ed, name);
+ if ((type != EDJE_PART_TYPE_SWALLOW) &&
+ (type != EDJE_PART_TYPE_TEXT) &&
+ (type != EDJE_PART_TYPE_BOX) &&
+ (type != EDJE_PART_TYPE_TABLE))
+ {
+ free(apiname);
+ continue;
+ }
+
+ description = edje_edit_part_api_description_get(ed, name);
+ if (!_part_write(apiname, name, description, type))
+ {
+ ret = EINA_FALSE;
+ edje_edit_string_free(description);
+ free(apiname);
+ break;
+ }
+
+ edje_edit_string_free(description);
+ free(apiname);
+ }
+
+ edje_edit_string_list_free(parts);
+ return ret;
+}
+
+static Eina_Bool
+_program_emit_write(const char *apiname, const char *source, const char *sig,
+ const char *description)
+{
+ char buf[512];
+
+ snprintf(buf, sizeof(buf), C_CODEGEN_PROGRAM_EMIT, prefix,
+ apiname, sig, source);
+ if (fwrite(buf, strlen(buf), 1, source_fd) != 1)
+ goto err;
+
+ if (description)
+ {
+ snprintf(buf, sizeof(buf), "\n/**\n * @brief %s\n */\n", description);
+ if (fwrite(buf, strlen(buf), 1, header_fd) != 1)
+ goto err;
+ }
+
+ snprintf(buf, sizeof(buf), H_CODEGEN_PROGRAM_EMIT, prefix,
+ apiname);
+ if (fwrite(buf, strlen(buf), 1, header_fd) != 1)
+ goto err;
+
+ return EINA_TRUE;
+
+ err:
+ ERR("Could not write the program: %s", apiname);
+ return EINA_FALSE;
+}
+
+static Eina_Bool
+_program_add_write(const char *apiname, const char *source, const char *sig,
+ const char *description)
+{
+ char buf[512];
+
+ snprintf(buf, sizeof(buf), C_CODEGEN_PROGRAM_CALLBACK_ADD, prefix,
+ apiname, sig, source);
+ if (fwrite(buf, strlen(buf), 1, source_fd) != 1)
+ goto err;
+
+ snprintf(buf, sizeof(buf), C_CODEGEN_PROGRAM_CALLBACK_DEL, prefix,
+ apiname, sig, source);
+ if (fwrite(buf, strlen(buf), 1, source_fd) != 1)
+ goto err;
+
+ if (description)
+ {
+ snprintf(buf, sizeof(buf), "\n/**\n * @brief %s\n */\n", description);
+ if (fwrite(buf, strlen(buf), 1, header_fd) != 1)
+ goto err;
+ }
+
+ snprintf(buf, sizeof(buf), H_CODEGEN_PROGRAM_CALLBACK_ADD, prefix,
+ apiname);
+ if (fwrite(buf, strlen(buf), 1, header_fd) != 1)
+ goto err;
+
+ snprintf(buf, sizeof(buf), H_CODEGEN_PROGRAM_CALLBACK_DEL, prefix,
+ apiname);
+ if (fwrite(buf, strlen(buf), 1, header_fd) != 1)
+ goto err;
+
+ return EINA_TRUE;
+
+ err:
+ ERR("Could not write the program [action]: %s", apiname);
+ return EINA_FALSE;
+}
+
+static char *
+_program_api_name_get(Evas_Object *ed, const char *program)
+{
+ const char *orig;
+ char *fix;
+
+ orig = edje_edit_program_api_name_get(ed, program);
+ fix = _api_name_fix(orig);
+ edje_edit_string_free(orig);
+
+ return fix;
+}
+
+static Eina_Bool
+_programs_parse(Evas_Object *ed)
+{
+ Eina_Bool ret = EINA_TRUE;
+ Eina_List *programs, *l;
+ const char *name, *source = NULL, *sig = NULL, *description;
+ char *apiname;
+ Edje_Action_Type type;
+
+ programs = edje_edit_programs_list_get(ed);
+ EINA_LIST_FOREACH(programs, l, name)
+ {
+ if (!(apiname = _program_api_name_get(ed, name)))
+ {
+ DBG("filter out program '%s': not API.", name);
+ continue;
+ }
+
+ description = edje_edit_program_api_description_get(ed, name);
+ type = edje_edit_program_action_get(ed, name);
+ if (type == EDJE_ACTION_TYPE_SIGNAL_EMIT)
+ {
+ const char *str, *str2;
+ str = edje_edit_program_state_get(ed, name);
+ str2 = edje_edit_program_state2_get(ed, name);
+
+ if (!_program_add_write(apiname, str2, str, description))
+ {
+ ret = EINA_FALSE;
+ edje_edit_string_free(str);
+ edje_edit_string_free(str2);
+ break;
+ }
+
+ edje_edit_string_free(str);
+ edje_edit_string_free(str2);
+ }
+
+ sig = edje_edit_program_signal_get(ed, name);
+ if (!sig) sig = eina_stringshare_add("");
+
+ source = edje_edit_program_source_get(ed, name);
+ if (!source) source = eina_stringshare_add("");
+
+ if (strlen (sig))
+ {
+ if (!_program_emit_write(apiname, source, sig, description))
+ {
+ ret = EINA_FALSE;
+ break;
+ }
+ }
+
+ edje_edit_string_free(description);
+ edje_edit_string_free(sig);
+ edje_edit_string_free(source);
+ free(apiname);
+ }
+
+ edje_edit_string_list_free(programs);
+ if (!ret)
+ {
+ edje_edit_string_free(description);
+ edje_edit_string_free(sig);
+ edje_edit_string_free(source);
+ free(apiname);
+ }
+
+ return ret;
+}
+
+static Eina_Bool
+_parse(void)
+{
+ Evas_Object *ed;
+ Eina_Bool ret;
+
+ ed = edje_edit_object_add(ecore_evas_get(ee));
+ if (!edje_object_file_set(ed, file, group))
+ {
+ Edje_Load_Error err = edje_object_load_error_get(ed);
+ const char *errmsg = edje_load_error_str(err);
+ ERR("could not load group '%s' from file '%s': %s",
+ group, file, errmsg);
+ evas_object_del(ed);
+ return EINA_FALSE;
+ }
+
+ ret = _parts_parse(ed) && _programs_parse(ed);
+
+ evas_object_del(ed);
+ return ret;
+}
+
+int
+main(int argc, char *argv[])
+{
+ Eina_Bool quit_option = EINA_FALSE;
+ char *source = NULL, *header = NULL;
+ int arg_index, ret = 0;
+ Ecore_Getopt_Value values[] = {
+ ECORE_GETOPT_VALUE_STR(prefix),
+ ECORE_GETOPT_VALUE_BOOL(quit_option),
+ ECORE_GETOPT_VALUE_BOOL(quit_option),
+ ECORE_GETOPT_VALUE_BOOL(quit_option),
+ ECORE_GETOPT_VALUE_BOOL(quit_option),
+ ECORE_GETOPT_VALUE_NONE
+ };
+
+ setlocale(LC_NUMERIC, "C");
+
+ eina_init();
+ ecore_init();
+ ecore_evas_init();
+ edje_init();
+
+ if (argc < 2)
+ {
+ fprintf(stderr, "Missing action. See '--help or -h'.\n");
+ ret = 1;
+ goto error_log;
+ }
+
+ _log_dom = eina_log_domain_register("elementary_codegen", EINA_COLOR_YELLOW);
+ if (_log_dom < 0)
+ {
+ EINA_LOG_CRIT("could not register log domain 'elementary_codegen'");
+ ret = 1;
+ goto error_log;
+ }
+
+ arg_index = ecore_getopt_parse(&optdesc, values, argc, argv);
+ if (arg_index < 0)
+ {
+ ERR("could not parse arguments.");
+ ret = 1;
+ goto error_getopt;
+ }
+ else if (quit_option) goto error_getopt;
+ else if (arg_index != argc - 4)
+ {
+ fprintf(stderr, "Incorrect number of parameters. Requires " \
+ "fours arguments, an edje, the group, " \
+ "the source output (foo.c) and the header(foo.h).\n" \
+ "See %s --help\n", argv[0]);
+ ret = 1;
+ goto error_getopt;
+ }
+
+ file = argv[arg_index++];
+
+ // check if the file is accessible
+ if (access(file, R_OK) == -1)
+ {
+ ERR("File '%s' not accessible, error %d (%s).\n",
+ file, errno, strerror(errno));
+ ret = 1;
+ goto error_getopt;
+ }
+
+ group = argv[arg_index++];
+ source = argv[arg_index++];
+ header = argv[arg_index++];
+
+ if (!edje_file_group_exists(file, group))
+ {
+ ERR("The group %s not exists", group);
+ ret = 2;
+ goto error_getopt;
+ }
+
+ ee = ecore_evas_buffer_new(1, 1);
+ if (!ee)
+ {
+ ERR("could not create ecore_evas_buffer");
+ ret = 3;
+ goto error_getopt;
+ }
+
+ if (!_file_descriptors_open(source, header))
+ {
+ ERR("Could not create the source files, error %d (%s)",
+ errno, strerror(errno));
+ ret = 4;
+ goto error_getopt;
+ }
+
+ if (!_headers_write(header))
+ {
+ ERR("Could not write the header, error %d (%s)",
+ errno, strerror(errno));
+ ret = 5;
+ goto error_getopt;
+ }
+
+ if (!_theme_set_write())
+ WRN("Theme set getter/setter not created. Group name: %s invalid.", group);
+
+ if (!_parse())
+ {
+ ERR("Could not parsing the EDJE");
+ ret = 6;
+ goto error_getopt;
+ }
+
+ if (!_footer_write(header))
+ {
+ ERR("Could not write the footer, error %d (%s)",
+ errno, strerror(errno));
+ ret = 7;
+ goto error_getopt;
+ }
+
+ if (!_file_descriptors_close())
+ {
+ ERR("Could not close the source files, error %d (%s)",
+ errno, strerror(errno));
+ ret = 8;
+ }
+
+error_getopt:
+ if (ee)
+ ecore_evas_free(ee);
+
+error_log:
+ edje_shutdown();
+ ecore_evas_shutdown();
+ ecore_shutdown();
+ eina_log_domain_unregister(_log_dom);
+ eina_shutdown();
+
+ if (ret > 4)
+ {
+ unlink(header);
+ unlink(source);
+ }
+
+ return ret;
+}
diff --git a/src/bin/elementary/elm_prefs_cc.c b/src/bin/elementary/elm_prefs_cc.c
new file mode 100644
index 0000000000..9f5da87bf9
--- /dev/null
+++ b/src/bin/elementary/elm_prefs_cc.c
@@ -0,0 +1,201 @@
+#ifdef HAVE_CONFIG_H
+# include "elementary_config.h"
+#endif
+
+#include <string.h>
+#include <locale.h>
+#include <limits.h>
+#include <sys/stat.h>
+
+#include "elm_prefs_cc.h"
+
+int _elm_prefs_cc_log_dom = -1;
+static void main_help(void);
+
+Eina_Prefix *pfx = NULL;
+char *file_in = NULL;
+const char *tmp_dir = NULL;
+char *file_out = NULL;
+
+static const char *progname = NULL;
+
+static void
+_elm_prefs_cc_log_cb(const Eina_Log_Domain *d,
+ Eina_Log_Level level,
+ const char *file,
+ const char *fnc,
+ int _line,
+ const char *fmt,
+ EINA_UNUSED void *data,
+ va_list args)
+{
+ if ((d->name) && (d->namelen == sizeof("elm_prefs_cc") - 1) &&
+ (memcmp(d->name, "elm_prefs_cc", sizeof("elm_prefs_cc") - 1) == 0))
+ {
+ const char *prefix;
+
+ eina_log_console_color_set(stderr, eina_log_level_color_get(level));
+ switch (level)
+ {
+ case EINA_LOG_LEVEL_CRITICAL:
+ prefix = "Critical. ";
+ break;
+
+ case EINA_LOG_LEVEL_ERR:
+ prefix = "Error. ";
+ break;
+
+ case EINA_LOG_LEVEL_WARN:
+ prefix = "Warning. ";
+ break;
+
+ default:
+ prefix = "";
+ }
+ fprintf(stderr, "%s: %s", progname, prefix);
+ eina_log_console_color_set(stderr, EINA_COLOR_RESET);
+
+ vfprintf(stderr, fmt, args);
+ putc('\n', stderr);
+ }
+ else
+ eina_log_print_cb_stderr(d, level, file, fnc, _line, fmt, NULL, args);
+}
+
+static void
+main_help(void)
+{
+ printf
+ ("Usage:\n"
+ "\t%s [OPTIONS] input_file.epc [output_file.epb]\n"
+ "\n"
+ "Where OPTIONS is one or more of:\n"
+ "\n"
+ "-v Verbose output\n"
+ , progname);
+}
+
+int
+main(int argc, char **argv)
+{
+ int i;
+ struct stat st;
+#ifdef HAVE_REALPATH
+ char rpath[PATH_MAX], rpath2[PATH_MAX];
+#endif
+
+ setlocale(LC_NUMERIC, "C");
+
+ if (!eina_init())
+ return -1;
+
+ _elm_prefs_cc_log_dom = eina_log_domain_register
+ ("elm_prefs_cc", ELM_PREFS_CC_DEFAULT_LOG_COLOR);
+ if (_elm_prefs_cc_log_dom < 0)
+ {
+ EINA_LOG_ERR("Unable to create a log domain.");
+ exit(-1);
+ }
+ if (!eina_log_domain_level_check(_elm_prefs_cc_log_dom, EINA_LOG_LEVEL_WARN))
+ eina_log_domain_level_set("elm_prefs_cc", EINA_LOG_LEVEL_WARN);
+
+ progname = ecore_file_file_get(argv[0]);
+ eina_log_print_cb_set(_elm_prefs_cc_log_cb, NULL);
+
+ tmp_dir = eina_environment_tmp_get();
+
+ for (i = 1; i < argc; i++)
+ {
+ if (!strcmp(argv[i], "-h"))
+ {
+ main_help();
+ exit(0);
+ }
+ else if (!strcmp(argv[i], "-v"))
+ {
+ eina_log_domain_level_set("elm_prefs_cc", EINA_LOG_LEVEL_INFO);
+ }
+ else if (!file_in)
+ file_in = argv[i];
+ else if (!file_out)
+ file_out = argv[i];
+ }
+
+ if (!file_in)
+ {
+ ERR("no input file specified.");
+ main_help();
+ exit(-1);
+ }
+
+ pfx = eina_prefix_new(argv[0], /* argv[0] value (optional) */
+ main, /* an optional symbol to check path of */
+ "ELM_PREFS", /* env var prefix to use (XXX_PREFIX, XXX_BIN_DIR etc. */
+ "elementary", /* dir to add after "share" (PREFIX/share/DIRNAME) */
+ "themes/default.edj", /* a magic file to check for in PREFIX/share/DIRNAME for success */
+ PACKAGE_BIN_DIR, /* package bin dir @ compile time */
+ PACKAGE_LIB_DIR, /* package lib dir @ compile time */
+ PACKAGE_DATA_DIR, /* package data dir @ compile time */
+ PACKAGE_DATA_DIR); /* if locale needed use LOCALE_DIR */
+
+ /* check whether file_in exists */
+#ifdef HAVE_REALPATH
+ if (!realpath(file_in, rpath) || stat(rpath, &st) || !S_ISREG(st.st_mode))
+#else
+ if (stat(file_in, &st) || !S_ISREG(st.st_mode))
+#endif
+ {
+ ERR("file not found: %s.", file_in);
+ main_help();
+ exit(-1);
+ }
+
+ if (!file_out)
+ {
+ char *suffix;
+
+ if ((suffix = strstr(file_in, ".epc")) && (suffix[4] == 0))
+ {
+ file_out = strdup(file_in);
+ if (file_out)
+ {
+ suffix = strstr(file_out, ".epc");
+ strcpy(suffix, ".epb");
+ }
+ }
+ }
+ if (!file_out)
+ {
+ ERR("no output file specified.");
+ main_help();
+ exit(-1);
+ }
+
+#ifdef HAVE_REALPATH
+ if (realpath(file_out, rpath2) && !strcmp(rpath, rpath2))
+#else
+ if (!strcmp(file_in, file_out))
+#endif
+ {
+ ERR("input file equals output file.");
+ main_help();
+ exit(-1);
+ }
+
+ elm_prefs_file = mem_alloc(SZ(Elm_Prefs_File));
+ elm_prefs_file->compiler = strdup("elm_prefs_cc");
+
+ compile();
+
+ data_init();
+ data_write();
+ data_shutdown();
+
+ eina_prefix_free(pfx);
+ pfx = NULL;
+
+ eina_log_domain_unregister(_elm_prefs_cc_log_dom);
+ eina_shutdown();
+
+ return 0;
+}
diff --git a/src/bin/elementary/elm_prefs_cc.h b/src/bin/elementary/elm_prefs_cc.h
new file mode 100644
index 0000000000..ef848babc8
--- /dev/null
+++ b/src/bin/elementary/elm_prefs_cc.h
@@ -0,0 +1,107 @@
+#ifndef ELM_PREFS_CC_H
+#define ELM_PREFS_CC_H
+
+#include <Elementary.h>
+
+#define ELM_INTERNAL_API_ARGESFSDFEFC
+#include "elm_priv.h"
+#include "elm_widget_prefs.h"
+
+extern Eina_Prefix *pfx;
+
+/*
+ * On Windows, if the file is not opened in binary mode,
+ * read does not return the correct size, because of
+ * CR / LF translation.
+ */
+#ifndef O_BINARY
+# define O_BINARY 0
+#endif
+
+/* logging variables */
+extern int _elm_prefs_cc_log_dom;
+#define ELM_PREFS_CC_DEFAULT_LOG_COLOR EINA_COLOR_CYAN
+
+#ifdef ERR
+# undef ERR
+#endif
+#define ERR(...) EINA_LOG_DOM_ERR(_elm_prefs_cc_log_dom, __VA_ARGS__)
+#ifdef INF
+# undef INF
+#endif
+#define INF(...) EINA_LOG_DOM_INFO(_elm_prefs_cc_log_dom, __VA_ARGS__)
+#ifdef WRN
+# undef WRN
+#endif
+#define WRN(...) EINA_LOG_DOM_WARN(_elm_prefs_cc_log_dom, __VA_ARGS__)
+#ifdef CRI
+# undef CRI
+#endif
+#define CRI(...) EINA_LOG_DOM_CRIT(_elm_prefs_cc_log_dom, __VA_ARGS__)
+#ifdef DBG
+# undef DBG
+#endif
+#define DBG(...) EINA_LOG_DOM_DBG(_elm_prefs_cc_log_dom, __VA_ARGS__)
+
+/* types */
+typedef struct _Elm_Prefs_File Elm_Prefs_File;
+typedef struct _New_Object_Handler New_Object_Handler;
+typedef struct _New_Statement_Handler New_Statement_Handler;
+
+struct _Elm_Prefs_File
+{
+ const char *compiler;
+
+ Eina_List *pages;
+};
+
+struct _New_Object_Handler
+{
+ const char *type;
+ void (*func)(void);
+};
+
+struct _New_Statement_Handler
+{
+ const char *type;
+ void (*func)(void);
+};
+
+/* global fn calls */
+void compile(void);
+char *parse_str(int n);
+int parse_enum(int n, ...);
+int parse_int(int n);
+int parse_int_range(int n, int f, int t);
+int parse_bool(int n);
+double parse_float(int n);
+void check_arg_count(int n);
+void check_regex(const char *regex);
+void set_verbatim(char *s, int l1, int l2);
+
+void data_init(void);
+void data_write(void);
+void data_shutdown(void);
+
+int object_handler_num(void);
+int statement_handler_num(void);
+
+void *mem_alloc(size_t size);
+char *mem_strdup(const char *s);
+#define SZ sizeof
+
+/* global vars */
+extern char *file_in;
+extern const char *tmp_dir;
+extern char *file_out;
+extern int line;
+extern Eina_List *stack;
+extern Eina_List *params;
+
+extern Elm_Prefs_File *elm_prefs_file;
+
+extern Eina_List *elm_prefs_pages;
+extern New_Object_Handler object_handlers[];
+extern New_Statement_Handler statement_handlers[];
+
+#endif
diff --git a/src/bin/elementary/elm_prefs_cc_handlers.c b/src/bin/elementary/elm_prefs_cc_handlers.c
new file mode 100644
index 0000000000..93577ed38f
--- /dev/null
+++ b/src/bin/elementary/elm_prefs_cc_handlers.c
@@ -0,0 +1,1218 @@
+/*
+ Concerning the EPC reference:
+
+ The formatting for blocks and properties has been implemented as a table
+ which is filled using ALIASES.
+ For maximum flexibility I implemented them in the \@code/\@encode style,
+ this means that missing one or changing the order most certainly cause
+ formatting errors.
+
+ \@block
+ block name
+ \@context
+ code sample of the block
+ \@description
+ the block's description
+ \@endblock
+
+ \@property
+ property name
+ \@parameters
+ property's parameter list
+ \@effect
+ the property description (lol)
+ \@endproperty
+*/
+
+#ifdef HAVE_CONFIG_H
+# include "elementary_config.h"
+#endif
+
+#include <string.h>
+#include <errno.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <sys/mman.h>
+#include <unistd.h>
+
+#include "elm_prefs_cc.h"
+
+void check_min_arg_count(int min_required_args);
+int params_min_check(int n);
+
+/**
+ * @page epcref Elementary Prefs Data Collection Reference
+ * An Elementary Prefs Collection is a plain text file (normally
+ * identified with the .epc extension), consisting of instructions for the
+ * Elm Prefs Compiler.
+ *
+ * The syntax for the elementary prefs data files follows a simple structure of
+ * "blocks { .. }" that can contain "properties: ..", more blocks, or both.
+ *
+ * @anchor sec_quickaccess Quick access to block descriptions:
+ * <ul>
+ * <li>@ref sec_page "Page"</li>
+ * <li>@ref sec_items "Items"</li>
+ * <ul>
+ * <li>@ref sec_items_bool "Bool"</li>
+ * <li>@ref sec_items_int "Int"</li>
+ * <li>@ref sec_items_float "Float"</li>
+ * <li>@ref sec_items_date "Date"</li>
+ * <li>@ref sec_items_text "Text"</li>
+ * <li>@ref sec_items_textarea "Text Area"</li>
+ * </ul>
+ * </ul>
+ *
+ * @author Ricardo de Almeida Gonzaga (ricardotk) ricardo@profusion.mobi
+ *
+ * <table class="edcref" border="0">
+ */
+
+static Elm_Prefs_Page_Node *current_page = NULL;
+static Elm_Prefs_Item_Node *current_item = NULL;
+
+/* objects and statments */
+
+/* Collection */
+static void ob_collection(void);
+
+/**
+ @epcsection{page,Page}
+ */
+
+/**
+ @page epcref
+ @block
+ page
+ @context
+ collection {
+ ..
+ page {
+ name: "main";
+ version: 1;
+ title: "Preference Widgets";
+ subtitle: "Subtitle";
+ widget: "elm/vertical_frame";
+
+ items { }
+ }
+ ..
+ }
+ @description
+ A "page" block is a grouping of prefs items together. A prefs widget
+ must always be bound to a page, that can address other pages in the
+ collection too as @b sub-pages.
+ @endblock
+
+ @property
+ name
+ @parameters
+ [page name]
+ @effect
+ The name of the page (to be referred by the application). It must be
+ unique within the collection.
+ @endproperty
+
+ @property
+ version
+ @parameters
+ [page version]
+ @effect
+ The page's version.
+ @endproperty
+
+ @property
+ title
+ @parameters
+ [page title]
+ @effect
+ Set page's title.
+ @endproperty
+
+ @property
+ subtitle
+ @parameters
+ [page subtitle]
+ @effect
+ Set page's subtitle.
+ @endproperty
+
+ @property
+ widget
+ @parameters
+ [page widget]
+ @effect
+ Set the widget from among the available page widgets. Valid, built-in
+ page widgets are:
+ @li elm/horizontal_box
+ @li elm/vertical_box
+ @li elm/horizontal_frame
+ @li elm/vertical_frame
+ @endproperty
+
+ @property
+ style
+ @parameters
+ [page style]
+ @effect
+ Set page's style.
+ @endproperty
+
+ @property
+ icon
+ @parameters
+ [page icon]
+ @effect
+ Set page's icon.
+ @endproperty
+
+ @property
+ autosave
+ @parameters
+ [1 or 0]
+ @effect
+ Takes a boolean value specifying whether page is autosaved (1)
+ or not (0). The default value is 1.
+ @endproperty
+*/
+
+/* Page */
+static void ob_collection_page(void);
+static void st_collection_page_name(void);
+static void st_collection_page_version(void);
+static void st_collection_page_title(void);
+static void st_collection_page_subtitle(void);
+static void st_collection_page_widget(void);
+static void st_collection_page_style(void);
+static void st_collection_page_icon(void);
+static void st_collection_page_autosave(void);
+
+/**
+ @epcsection{items,Items}
+ */
+
+/**
+ @page epcref
+ @block
+ items
+ @context
+ page {
+ ..
+ items {
+ name: "item";
+ type: INT;
+ label: "Just a item label...";
+
+ type { }
+ }
+ ..
+ }
+
+ @description
+ An "item" block declares a new Prefs item, along with its properties.
+ @endblock
+
+ @property
+ name
+ @parameters
+ [item name]
+ @effect
+ The item's name, to be referred by the application. It must be unique
+ within the page.
+ @endproperty
+
+ @property
+ type
+ @parameters
+ [TYPE]
+ @effect
+ Set the type (all types must be entered in capitals) from among the
+ available types, that are:
+ @li BOOL - Checkbox.
+ @li INT - Slider.
+ @li FLOAT - Slider.
+ @li DATE - Date/time display and input widget.
+ @li TEXT - Single-line text entry.
+ @li TEXTAREA - Text entry.
+ @li LABEL - Read-only label.
+ @li PAGE - Prefs subpage object.
+ @li SEPARATOR - Line that serves only to divide and organize prefs
+ item.
+ @li SWALLOW - Swallows an Evas_Object.
+ @li SAVE - Button that will get all the values bounded to items and
+ save it on CFG file.
+ @li ACTION - Button that will emit a signal to .C file and call a
+ smart callback.
+ @li RESET - Button that will return all the values bounded to items
+ as default declared on .EPC file.
+ @endproperty
+
+ @property
+ label
+ @parameters
+ [a string to label]
+ @effect
+ Set a string to item's label.
+ @endproperty
+
+ @property
+ icon
+ @parameters
+ [item icon]
+ @effect
+ This is the item icon.
+ @endproperty
+
+ @property
+ persistent
+ @parameters
+ [1 or 0]
+ @effect
+ Takes a boolean value specifying whether item is persistent (1) or
+ not (0). The default value is 1. A non persistent item doesn't save
+ its values when saved.
+ @endproperty
+
+ @property
+ editable
+ @parameters
+ [1 or 0]
+ @effect
+ Takes a boolean value specifying whether item is editable (1)
+ or not (0). The default value is 1.
+ @endproperty
+
+ @property
+ visible
+ @parameters
+ [1 or 0]
+ @effect
+ Takes a boolean value specifying whether item is visible (1) or not (0).
+ The default value is 1.
+ @endproperty
+
+ @property
+ style
+ @parameters
+ [item style]
+ @effect
+ This is the item's style.
+ @endproperty
+
+ @property
+ widget
+ @parameters
+ [item widget]
+ @effect
+ This is the item's widget, for cases where a widget differs than the
+ default assigned to the type is desired.
+ @endproperty
+*/
+/* Items */
+
+static void ob_collection_page_items(void);
+
+static void ob_collection_page_items_item(void);
+static void st_collection_page_items_item_name(void);
+static void st_collection_page_items_item_type(void);
+static void st_collection_page_items_item_label(void);
+static void st_collection_page_items_item_icon(void);
+static void st_collection_page_items_item_persistent(void);
+static void st_collection_page_items_item_editable(void);
+static void st_collection_page_items_item_visible(void);
+static void st_collection_page_items_item_source(void);
+static void st_collection_page_items_item_style(void);
+static void st_collection_page_items_item_widget(void);
+
+/**
+ @epcsection{items_bool,Bool item sub blocks}
+ */
+
+/**
+ @page epcref
+
+ @block
+ bool
+ @context
+ item {
+ ..
+ bool {
+ default: true;
+ }
+ ..
+ }
+ @description
+ @endblock
+
+ @property
+ default
+ @parameters
+ [true or false]
+ @effect
+ Takes a boolean value specifying whether item is checked (true)
+ or not (false).
+ @endproperty
+*/
+
+/* Item: Bool */
+static void ob_collection_page_items_item_bool(void);
+static void st_collection_page_items_item_bool_default(void);
+
+/**
+ @epcsection{items_int,Int item sub blocks}
+ */
+
+/**
+ @page epcref
+
+ @block
+ int
+ @context
+ item {
+ ..
+ int {
+ default: 150;
+ min: 0;
+ max: 300;
+ }
+ ..
+ }
+ @description
+ @endblock
+
+ @property
+ default
+ @parameters
+ [value]
+ @effect
+ Set a default (initial) value to the item.
+ @endproperty
+
+ @property
+ min
+ @parameters
+ [value]
+ @effect
+ Set a minimum value to the item. Note that, without a minimum
+ value, the widget implementing the item visually will get an
+ available range of values bound to the minimum of the least
+ integer number representable, and it might not be what you
+ want.
+
+ @endproperty
+
+ @property
+ max
+ @parameters
+ [value]
+ @effect
+ Set a maximum value to the item. Note that, without a maximum
+ value, the widget implementing the item visually will get an
+ available range of values bound to the maximum of the least
+ integer number representable, and it might not be what you
+ want.
+ @endproperty
+*/
+
+/* Item: Integer */
+static void ob_collection_page_items_item_int(void);
+static void st_collection_page_items_item_int_default(void);
+static void st_collection_page_items_item_int_max(void);
+static void st_collection_page_items_item_int_min(void);
+
+/**
+ @epcsection{items_float,Float item sub blocks}
+ */
+
+/**
+ @page epcref
+
+ @block
+ float
+ @context
+ item {
+ ..
+ float {
+ default: 0.5;
+ min: 0;
+ max: 1;
+ }
+ ..
+ }
+ @description
+ @endblock
+
+ @property
+ default
+ @parameters
+ [value]
+ @effect
+ Set a default (initial) value to the item.
+ @endproperty
+
+ @property
+ min
+ @parameters
+ [value]
+ @effect
+ Set a minimum value to the item. Note that, without a minimum
+ value, the widget implementing the item visually will get an
+ available range of values bound to the minimum of the least
+ floating point number representable, and it might not be what you
+ want.
+ @endproperty
+
+ @property
+ max
+ @parameters
+ [value]
+ @effect
+ Set a maximum value to the item. Note that, without a maximum
+ value, the widget implementing the item visually will get an
+ available range of values bound to the maximum of the least
+ floating point number representable, and it might not be what you
+ want.
+ @endproperty
+*/
+
+/* Item: Float */
+static void ob_collection_page_items_item_float(void);
+static void st_collection_page_items_item_float_default(void);
+static void st_collection_page_items_item_float_max(void);
+static void st_collection_page_items_item_float_min(void);
+
+/**
+ @epcsection{items_date,Date item sub blocks}
+ */
+
+/**
+ @page epcref
+
+ @block
+ date
+ @context
+ item {
+ ..
+ date {
+ default: 2012 11 05;
+ min: 1900 1 1;
+ max: 2200 12 31;
+ }
+ ..
+ }
+ @description
+ @endblock
+
+ @property
+ default
+ @parameters
+ [year month date] or "today"
+ @effect
+ Set a default (initial) date to the item. "today" will translate
+ to current date.
+ @endproperty
+
+ @property
+ min
+ @parameters
+ [year month date] or "today"
+ @effect
+ Set a minimum date to the item. "today" will translate
+ to current date.
+ @endproperty
+
+ @property
+ max
+ @parameters
+ [year month date] or "today"
+ @effect
+ Set a maximum date to the item. "today" will translate
+ to current date.
+ @endproperty
+*/
+
+/* Item: Date */
+static void ob_collection_page_items_item_date(void);
+static void st_collection_page_items_item_date_default(void);
+static void st_collection_page_items_item_date_max(void);
+static void st_collection_page_items_item_date_min(void);
+
+/**
+ @epcsection{items_text,Text item sub blocks}
+ */
+
+/**
+ @page epcref
+
+ @block
+ text
+ @context
+ item {
+ ..
+ text {
+ default: "Default text";
+ placeholder: "Text:";
+ accept: "^[a-zA-Z ]$";
+ deny: "";
+ }
+ ..
+ }
+ @description
+ @endblock
+
+ @property
+ default
+ @parameters
+ [a string of text]
+ @effect
+ Set a default text.
+ @endproperty
+
+ @property
+ placeholder
+ @parameters
+ [a string of text]
+ @effect
+ Set a placeholder.
+ @endproperty
+
+ @property
+ accept
+ @parameters
+ [regular expression]
+ @effect
+ Set an acceptance regular expression. It must be a valid one.
+ @endproperty
+
+ @property
+ deny
+ @parameters
+ [regular expression]
+ @effect
+ Set a denial regular expression. It must be a valid one.
+ @endproperty
+*/
+
+/**
+ @epcsection{items_textarea,Text Area item sub blocks}
+ */
+
+/**
+ @page epcref
+
+ @block
+ textarea
+ @context
+ item {
+ ..
+ textarea {
+ default: "Default text";
+ placeholder: "No Numbers!";
+ accept: "";
+ deny: "^[0-9]*$";
+ }
+ ..
+ }
+ @description
+ @endblock
+
+ @property
+ default
+ @parameters
+ [a string of text]
+ @effect
+ Set a default text.
+ @endproperty
+
+ @property
+ placeholder
+ @parameters
+ [a string of text]
+ @effect
+ Set a placeholder.
+ @endproperty
+
+ @property
+ accept
+ @parameters
+ [regular expression]
+ @effect
+ Set an acceptance regular expression. It must be a valid one.
+ @endproperty
+
+ @property
+ deny
+ @parameters
+ [regular expression]
+ @effect
+ Set a denial regular expression. It must be a valid one.
+ @endproperty
+*/
+
+/* Item: Text and Text Area */
+static void ob_collection_page_items_item_text(void);
+static void ob_collection_page_items_item_textarea(void);
+
+/* String shared statements */
+static void st_collection_page_items_item_string_default(void);
+static void st_collection_page_items_item_string_placeholder(void);
+static void st_collection_page_items_item_string_accept(void);
+static void st_collection_page_items_item_string_deny(void);
+static void st_collection_page_items_item_string_max(void);
+static void st_collection_page_items_item_string_min(void);
+
+/* Statement Array */
+New_Statement_Handler statement_handlers[] =
+{
+ {"collection.page.name", st_collection_page_name},
+ {"collection.page.name", st_collection_page_name},
+ {"collection.page.version", st_collection_page_version},
+ {"collection.page.title", st_collection_page_title},
+ {"collection.page.subtitle", st_collection_page_subtitle},
+ {"collection.page.widget", st_collection_page_widget},
+ {"collection.page.style", st_collection_page_style},
+ {"collection.page.icon", st_collection_page_icon},
+ {"collection.page.autosave", st_collection_page_autosave},
+
+ {"collection.page.items.item.name", st_collection_page_items_item_name},
+ {"collection.page.items.item.type", st_collection_page_items_item_type},
+ {"collection.page.items.item.label", st_collection_page_items_item_label},
+ {"collection.page.items.item.icon", st_collection_page_items_item_icon},
+ {"collection.page.items.item.persistent", st_collection_page_items_item_persistent},
+ {"collection.page.items.item.editable", st_collection_page_items_item_editable},
+ {"collection.page.items.item.visible", st_collection_page_items_item_visible},
+ {"collection.page.items.item.source", st_collection_page_items_item_source},
+ {"collection.page.items.item.style", st_collection_page_items_item_style},
+ {"collection.page.items.item.widget", st_collection_page_items_item_widget},
+
+ {"collection.page.items.item.bool.default", st_collection_page_items_item_bool_default},
+
+ {"collection.page.items.item.int.default", st_collection_page_items_item_int_default},
+ {"collection.page.items.item.int.max", st_collection_page_items_item_int_max},
+ {"collection.page.items.item.int.min", st_collection_page_items_item_int_min},
+
+ {"collection.page.items.item.float.default", st_collection_page_items_item_float_default},
+ {"collection.page.items.item.float.max", st_collection_page_items_item_float_max},
+ {"collection.page.items.item.float.min", st_collection_page_items_item_float_min},
+
+ {"collection.page.items.item.date.default", st_collection_page_items_item_date_default},
+ {"collection.page.items.item.date.max", st_collection_page_items_item_date_max},
+ {"collection.page.items.item.date.min", st_collection_page_items_item_date_min},
+
+ {"collection.page.items.item.text.placeholder", st_collection_page_items_item_string_placeholder},
+ {"collection.page.items.item.text.default", st_collection_page_items_item_string_default},
+ {"collection.page.items.item.text.accept", st_collection_page_items_item_string_accept},
+ {"collection.page.items.item.text.deny", st_collection_page_items_item_string_deny},
+ {"collection.page.items.item.text.max", st_collection_page_items_item_string_max},
+ {"collection.page.items.item.text.min", st_collection_page_items_item_string_min},
+
+ {"collection.page.items.item.textarea.placeholder", st_collection_page_items_item_string_placeholder},
+ {"collection.page.items.item.textarea.default", st_collection_page_items_item_string_default},
+ {"collection.page.items.item.textarea.accept", st_collection_page_items_item_string_accept},
+ {"collection.page.items.item.textarea.deny", st_collection_page_items_item_string_deny},
+ {"collection.page.items.item.textarea.max", st_collection_page_items_item_string_max},
+ {"collection.page.items.item.textarea.min", st_collection_page_items_item_string_min}
+};
+
+/* Object Array */
+New_Object_Handler object_handlers[] =
+{
+ {"collection", ob_collection},
+ {"collection.page", ob_collection_page},
+
+ {"collection.page.items", ob_collection_page_items},
+ {"collection.page.items.item", ob_collection_page_items_item},
+ {"collection.page.items.item.bool", ob_collection_page_items_item_bool},
+ {"collection.page.items.item.int", ob_collection_page_items_item_int},
+ {"collection.page.items.item.float", ob_collection_page_items_item_float},
+ {"collection.page.items.item.date", ob_collection_page_items_item_date},
+ {"collection.page.items.item.text", ob_collection_page_items_item_text},
+ {"collection.page.items.item.textarea", ob_collection_page_items_item_textarea}
+};
+
+int
+object_handler_num(void)
+{
+ return sizeof(object_handlers) / sizeof (New_Object_Handler);
+}
+
+int
+statement_handler_num(void)
+{
+ return sizeof(statement_handlers) / sizeof (New_Object_Handler);
+}
+
+static void
+ob_collection(void)
+{
+ // NULL
+}
+
+static void
+ob_collection_page(void)
+{
+ current_page = mem_alloc(SZ(Elm_Prefs_Page_Node));
+ if (current_page)
+ elm_prefs_file->pages =
+ eina_list_append(elm_prefs_file->pages, current_page);
+}
+
+static void
+st_collection_page_name(void)
+{
+ check_arg_count(1);
+
+ current_page->name = parse_str(0);
+
+ //TODO: check for duplicated name entries.
+}
+
+static void
+st_collection_page_version(void)
+{
+ check_arg_count(1);
+
+ current_page->version = parse_int(0);
+}
+
+static void
+st_collection_page_title(void)
+{
+ check_arg_count(1);
+
+ current_page->title = parse_str(0);
+}
+
+static void
+st_collection_page_subtitle(void)
+{
+ check_arg_count(1);
+
+ current_page->sub_title = parse_str(0);
+}
+
+static void
+st_collection_page_widget(void)
+{
+ check_arg_count(1);
+
+ current_page->widget = parse_str(0);
+}
+
+static void
+st_collection_page_style(void)
+{
+ check_arg_count(1);
+
+ current_page->style = parse_str(0);
+}
+
+static void
+st_collection_page_icon(void)
+{
+ check_arg_count(1);
+
+ current_page->icon = parse_str(0);
+}
+
+static void
+st_collection_page_autosave(void)
+{
+ check_arg_count(1);
+
+ current_page->autosave = parse_bool(0);
+}
+
+static void
+ob_collection_page_items(void)
+{
+ // NULL
+}
+
+static void
+ob_collection_page_items_item(void)
+{
+ current_item = mem_alloc(SZ(Elm_Prefs_Item_Node));
+ if (current_item)
+ {
+ current_item->visible = EINA_TRUE;
+ current_item->persistent = EINA_TRUE;
+ current_item->editable = EINA_TRUE;
+ current_page->items =
+ eina_list_append(current_page->items, current_item);
+ }
+}
+
+static void
+st_collection_page_items_item_name(void)
+{
+ check_arg_count(1);
+
+ current_item->name = parse_str(0);
+}
+
+static void
+st_collection_page_items_item_type(void)
+{
+ check_arg_count(1);
+
+ current_item->type = parse_enum(0,
+ "ACTION", ELM_PREFS_TYPE_ACTION,
+ "BOOL", ELM_PREFS_TYPE_BOOL,
+ "INT", ELM_PREFS_TYPE_INT,
+ "FLOAT", ELM_PREFS_TYPE_FLOAT,
+ "DATE", ELM_PREFS_TYPE_DATE,
+ "LABEL", ELM_PREFS_TYPE_LABEL,
+ "PAGE", ELM_PREFS_TYPE_PAGE,
+ "TEXT", ELM_PREFS_TYPE_TEXT,
+ "TEXTAREA", ELM_PREFS_TYPE_TEXTAREA,
+ "RESET", ELM_PREFS_TYPE_RESET,
+ "SAVE", ELM_PREFS_TYPE_SAVE,
+ "SEPARATOR", ELM_PREFS_TYPE_SEPARATOR,
+ "SWALLOW", ELM_PREFS_TYPE_SWALLOW,
+ NULL);
+
+ switch (current_item->type)
+ {
+ case ELM_PREFS_TYPE_ACTION:
+ case ELM_PREFS_TYPE_LABEL:
+ case ELM_PREFS_TYPE_RESET:
+ case ELM_PREFS_TYPE_SEPARATOR:
+ case ELM_PREFS_TYPE_SWALLOW:
+ current_item->editable = EINA_FALSE;
+ current_item->persistent = EINA_FALSE;
+ break;
+
+ case ELM_PREFS_TYPE_INT:
+ current_item->spec.i.max = INT_MAX;
+ current_item->spec.i.min = INT_MIN;
+ break;
+
+ case ELM_PREFS_TYPE_FLOAT:
+ current_item->spec.f.max = FLT_MAX;
+ current_item->spec.f.min = -FLT_MAX;
+ break;
+
+ case ELM_PREFS_TYPE_DATE:
+ {
+ time_t t = time(NULL);
+ struct tm *lt = localtime(&t);
+
+ current_item->spec.d.def.y = lt->tm_year + 1900;
+ current_item->spec.d.def.m = lt->tm_mon + 1;
+ current_item->spec.d.def.d = lt->tm_mday;
+
+ current_item->spec.d.min.y = 1900;
+ current_item->spec.d.min.m = 1;
+ current_item->spec.d.min.d = 1;
+
+ current_item->spec.d.max.y = 10000 - 1900;
+ current_item->spec.d.max.m = 1;
+ current_item->spec.d.max.d = 1;
+ }
+ break;
+
+ case ELM_PREFS_TYPE_TEXT:
+ case ELM_PREFS_TYPE_TEXTAREA:
+ current_item->spec.s.length.max = INT_MAX;
+ break;
+
+ default:
+ break;
+ }
+}
+
+static void
+st_collection_page_items_item_label(void)
+{
+ check_arg_count(1);
+
+ current_item->label = parse_str(0);
+}
+
+static void
+st_collection_page_items_item_icon(void)
+{
+ check_arg_count(1);
+
+ current_item->icon = parse_str(0);
+}
+
+static void
+st_collection_page_items_item_persistent(void)
+{
+ check_arg_count(1);
+
+ current_item->persistent = parse_bool(0);
+}
+
+static void
+st_collection_page_items_item_editable(void)
+{
+ check_arg_count(1);
+
+ current_item->editable = parse_bool(0);
+}
+
+static void
+st_collection_page_items_item_visible(void)
+{
+ check_arg_count(1);
+
+ current_item->visible = parse_bool(0);
+}
+
+static void
+st_collection_page_items_item_source(void)
+{
+ check_arg_count(1);
+
+ current_item->spec.p.source = parse_str(0);
+}
+
+static void
+st_collection_page_items_item_style(void)
+{
+ check_arg_count(1);
+
+ current_item->style = parse_str(0);
+}
+
+static void
+st_collection_page_items_item_widget(void)
+{
+ check_arg_count(1);
+
+ current_item->widget = parse_str(0);
+}
+
+static void
+ob_collection_page_items_item_bool(void)
+{
+ //TODO: check if current item type match
+}
+
+static void
+st_collection_page_items_item_bool_default(void)
+{
+ check_arg_count(1);
+
+ current_item->spec.b.def = parse_bool(0);
+}
+
+static void
+ob_collection_page_items_item_int(void)
+{
+ //TODO: check if current item type match
+}
+
+static void
+st_collection_page_items_item_int_default(void)
+{
+ check_arg_count(1);
+
+ current_item->spec.i.def = parse_int(0);
+}
+
+static void
+st_collection_page_items_item_int_max(void)
+{
+ check_arg_count(1);
+
+ current_item->spec.i.max = parse_int(0);
+}
+
+static void
+st_collection_page_items_item_int_min(void)
+{
+ check_arg_count(1);
+
+ current_item->spec.i.min = parse_int(0);
+}
+
+static void
+ob_collection_page_items_item_float(void)
+{
+ //TODO: check if current item type match
+}
+
+static void
+st_collection_page_items_item_float_default(void)
+{
+ check_arg_count(1);
+
+ current_item->spec.f.def = parse_float(0);
+}
+
+static void
+st_collection_page_items_item_float_max(void)
+{
+ check_arg_count(1);
+
+ current_item->spec.f.max = parse_float(0);
+}
+
+static void
+st_collection_page_items_item_float_min(void)
+{
+ check_arg_count(1);
+
+ current_item->spec.f.min = parse_float(0);
+}
+
+static void
+ob_collection_page_items_item_date(void)
+{
+ //TODO: check if current item type match
+}
+
+static void
+st_collection_page_items_item_date_default(void)
+{
+ check_min_arg_count(1);
+
+ if (params_min_check(1))
+ {
+ check_arg_count(3);
+
+ current_item->spec.d.def.y = parse_int_range(0, 1900, 10000);
+ current_item->spec.d.def.m = parse_int_range(1, 1, 12);
+ current_item->spec.d.def.d = parse_int_range(2, 1, 31);
+ }
+ else
+ {
+ const char *date = parse_str(0);
+ if (!strcasecmp(date, "today"))
+ {
+ time_t t = time(NULL);
+ struct tm *lt = localtime(&t);
+
+ current_item->spec.d.def.y = lt->tm_year + 1900;
+ current_item->spec.d.def.m = lt->tm_mon + 1;
+ current_item->spec.d.def.d = lt->tm_mday;
+ }
+ free((void *)date);
+ }
+}
+
+static void
+st_collection_page_items_item_date_max(void)
+{
+ check_min_arg_count(1);
+
+ if (params_min_check(1))
+ {
+ check_arg_count(3);
+
+ current_item->spec.d.max.y = parse_int_range(0, 1900, 10000);
+ current_item->spec.d.max.m = parse_int_range(1, 1, 12);
+ current_item->spec.d.max.d = parse_int_range(2, 1, 31);
+ }
+ else
+ {
+ const char *date = parse_str(0);
+ if (!strcasecmp(date, "today"))
+ {
+ time_t t = time(NULL);
+ struct tm *lt = localtime(&t);
+
+ current_item->spec.d.max.y = lt->tm_year + 1900;
+ current_item->spec.d.max.m = lt->tm_mon + 1;
+ current_item->spec.d.max.d = lt->tm_mday;
+ }
+ free((void *)date);
+ }
+}
+
+static void
+st_collection_page_items_item_date_min(void)
+{
+ check_min_arg_count(1);
+
+ if (params_min_check(1))
+ {
+ check_arg_count(3);
+
+ current_item->spec.d.min.y = parse_int_range(0, 1900, 10000);
+ current_item->spec.d.min.m = parse_int_range(1, 1, 12);
+ current_item->spec.d.min.d = parse_int_range(2, 1, 31);
+ }
+ else
+ {
+ const char *date = parse_str(0);
+ if (!strcasecmp(date, "today"))
+ {
+ time_t t = time(NULL);
+ struct tm *lt = localtime(&t);
+
+ current_item->spec.d.min.y = lt->tm_year + 1900;
+ current_item->spec.d.min.m = lt->tm_mon + 1;
+ current_item->spec.d.min.d = lt->tm_mday;
+ }
+ free((void *)date);
+ }
+}
+
+static void
+ob_collection_page_items_item_text(void)
+{
+ //TODO: check if current item type match
+}
+
+static void
+ob_collection_page_items_item_textarea(void)
+{
+ //todo: check if current item type match
+}
+
+static void
+st_collection_page_items_item_string_placeholder(void)
+{
+ check_arg_count(1);
+
+ current_item->spec.s.placeholder = parse_str(0);
+}
+
+static void
+st_collection_page_items_item_string_default(void)
+{
+ check_arg_count(1);
+
+ current_item->spec.s.def = parse_str(0);
+}
+
+static void
+st_collection_page_items_item_string_accept(void)
+{
+ check_arg_count(1);
+
+ current_item->spec.s.accept = parse_str(0);
+
+ check_regex(current_item->spec.s.accept);
+}
+
+static void
+st_collection_page_items_item_string_deny(void)
+{
+ check_arg_count(1);
+
+ current_item->spec.s.deny = parse_str(0);
+
+ check_regex(current_item->spec.s.deny);
+}
+
+static void
+st_collection_page_items_item_string_max(void)
+{
+ check_arg_count(1);
+
+ current_item->spec.s.length.max = parse_int(0);
+}
+
+static void
+st_collection_page_items_item_string_min(void)
+{
+ check_arg_count(1);
+
+ current_item->spec.s.length.min = parse_int(0);
+}
diff --git a/src/bin/elementary/elm_prefs_cc_mem.c b/src/bin/elementary/elm_prefs_cc_mem.c
new file mode 100644
index 0000000000..3e269d3674
--- /dev/null
+++ b/src/bin/elementary/elm_prefs_cc_mem.c
@@ -0,0 +1,35 @@
+#ifdef HAVE_CONFIG_H
+# include "elementary_config.h"
+#endif
+
+#include <string.h>
+#include <errno.h>
+
+#include "elm_prefs_cc.h"
+
+void *
+mem_alloc(size_t size)
+{
+ void *mem;
+
+ mem = calloc(1, size);
+ if (mem) return mem;
+ ERR("%s:%i memory allocation of %zu bytes failed. %s",
+ file_in, line, size, strerror(errno));
+ exit(-1);
+ return NULL;
+}
+
+char *
+mem_strdup(const char *s)
+{
+ void *str;
+
+ str = strdup(s);
+ if (str) return str;
+ ERR("%s:%i memory allocation of %zu bytes failed. %s. string "
+ "being duplicated: \"%s\"",
+ file_in, line, strlen(s) + 1, strerror(errno), s);
+ exit(-1);
+ return NULL;
+}
diff --git a/src/bin/elementary/elm_prefs_cc_out.c b/src/bin/elementary/elm_prefs_cc_out.c
new file mode 100644
index 0000000000..8913b71712
--- /dev/null
+++ b/src/bin/elementary/elm_prefs_cc_out.c
@@ -0,0 +1,52 @@
+#ifdef HAVE_CONFIG_H
+# include "elementary_config.h"
+#endif
+
+#include "elm_prefs_cc.h"
+#include "elm_prefs_edd.x"
+
+Elm_Prefs_File *elm_prefs_file = NULL;
+
+void
+data_init()
+{
+ eet_init();
+ _elm_prefs_descriptors_init();
+}
+
+void
+data_shutdown()
+{
+ _elm_prefs_descriptors_shutdown();
+ eet_shutdown();
+}
+
+void
+data_write()
+{
+ Eina_List *l;
+ Eet_File *ef;
+ Elm_Prefs_Page_Node *page;
+
+ if (!elm_prefs_file || !elm_prefs_file->pages)
+ {
+ ERR("No data to put in \"%s\"", file_out);
+ exit(-1);
+ }
+
+ ef = eet_open(file_out, EET_FILE_MODE_WRITE);
+ if (!ef)
+ {
+ ERR("Unable to open \"%s\" for writing output", file_out);
+ exit(-1);
+ }
+
+ EINA_LIST_FOREACH (elm_prefs_file->pages, l, page)
+ {
+ if (!(eet_data_write
+ (ef, _page_edd, page->name, page, EET_COMPRESSION_DEFAULT)))
+ ERR("Failed to write page %s to file %s", page->name, file_out);
+ }
+
+ eet_close(ef);
+}
diff --git a/src/bin/elementary/elm_prefs_cc_parse.c b/src/bin/elementary/elm_prefs_cc_parse.c
new file mode 100644
index 0000000000..5fda91eed1
--- /dev/null
+++ b/src/bin/elementary/elm_prefs_cc_parse.c
@@ -0,0 +1,1401 @@
+#ifdef HAVE_CONFIG_H
+# include "elementary_config.h"
+#endif
+
+#ifdef HAVE_ALLOCA_H
+# include <alloca.h>
+#elif defined __GNUC__
+# define alloca __builtin_alloca
+#elif defined _AIX
+# define alloca __alloca
+#elif defined _MSC_VER
+# include <malloc.h>
+# define alloca _alloca
+#else
+# include <stddef.h>
+# ifdef __cplusplus
+extern "C"
+# endif
+void *alloca(size_t);
+#endif
+
+#include <string.h>
+#include <ctype.h>
+#include <limits.h>
+#include <errno.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <math.h>
+#include <regex.h>
+
+#include "elm_prefs_cc.h"
+#include <Ecore.h>
+#include <Ecore_File.h>
+
+#ifdef _WIN32
+# define EPP_EXT ".exe"
+#else
+# define EPP_EXT
+#endif
+
+static void new_object(void);
+static void new_statement(void);
+static char *perform_math(char *input);
+static int isdelim(char c);
+static char *next_token(char *p, char *end, char **new_p, int *delim);
+static const char *stack_id(void);
+static void parse(char *data, off_t size);
+
+/* simple expression parsing protos */
+static int my_atoi(const char *s);
+static char *_alphai(char *s, int *val);
+static char *_betai(char *s, int *val);
+static char *_gammai(char *s, int *val);
+static char *_deltai(char *s, int *val);
+static char *_get_numi(char *s, int *val);
+static int _is_numi(char c);
+static int _is_op1i(char c);
+static int _is_op2i(char c);
+static int _calci(char op, int a, int b);
+
+static double my_atof(const char *s);
+static char *_alphaf(char *s, double *val);
+static char *_betaf(char *s, double *val);
+static char *_gammaf(char *s, double *val);
+static char *_deltaf(char *s, double *val);
+static char *_get_numf(char *s, double *val);
+static int _is_numf(char c);
+static int _is_op1f(char c);
+static int _is_op2f(char c);
+static double _calcf(char op, double a, double b);
+static int strstrip(const char *in, char *out, size_t size);
+
+int line = 0;
+Eina_List *stack = NULL;
+Eina_List *params = NULL;
+
+static char file_buf[4096];
+static int verbatim = 0;
+static int verbatim_line1 = 0;
+static int verbatim_line2 = 0;
+static char *verbatim_str = NULL;
+static Eina_Strbuf *stack_buf = NULL;
+
+static void
+err_show_stack(void)
+{
+ const char *s;
+
+ s = stack_id();
+ if (s)
+ ERR("PARSE STACK:\n%s", s);
+ else
+ ERR("NO PARSE STACK");
+}
+
+static void
+err_show_params(void)
+{
+ Eina_List *l;
+ char *p;
+
+ ERR("PARAMS:");
+ EINA_LIST_FOREACH(params, l, p)
+ {
+ ERR(" %s", p);
+ }
+}
+
+static void
+err_show(void)
+{
+ err_show_stack();
+ err_show_params();
+}
+
+static char *
+_parse_param_get(int n)
+{
+ if (n < (int) eina_list_count(params))
+ return eina_list_nth(params, n);
+ return NULL;
+}
+
+static Eina_Hash *_new_object_hash = NULL;
+static Eina_Hash *_new_statement_hash = NULL;
+
+static void
+fill_object_statement_hashes(void)
+{
+ int i, n;
+
+ if (_new_object_hash) return;
+
+ _new_object_hash = eina_hash_string_superfast_new(NULL);
+ _new_statement_hash = eina_hash_string_superfast_new(NULL);
+
+ n = object_handler_num();
+ for (i = 0; i < n; i++)
+ {
+ eina_hash_direct_add(_new_object_hash, object_handlers[i].type,
+ &(object_handlers[i]));
+ }
+ n = statement_handler_num();
+ for (i = 0; i < n; i++)
+ {
+ eina_hash_direct_add(_new_statement_hash, statement_handlers[i].type,
+ &(statement_handlers[i]));
+ }
+}
+
+static void
+new_object(void)
+{
+ const char *id;
+ New_Object_Handler *oh;
+ New_Statement_Handler *sh;
+
+ fill_object_statement_hashes();
+ id = stack_id();
+ oh = eina_hash_find(_new_object_hash, id);
+ if (oh)
+ {
+ if (oh->func) oh->func();
+ }
+ else
+ {
+ sh = eina_hash_find(_new_statement_hash, id);
+ if (!sh)
+ {
+ ERR("%s:%i unhandled keyword %s",
+ file_in, line - 1,
+ (char *)eina_list_data_get(eina_list_last(stack)));
+ err_show();
+ exit(-1);
+ }
+ }
+}
+
+static void
+new_statement(void)
+{
+ const char *id;
+ New_Statement_Handler *sh;
+
+ fill_object_statement_hashes();
+ id = stack_id();
+ sh = eina_hash_find(_new_statement_hash, id);
+ if (sh)
+ {
+ if (sh->func) sh->func();
+ }
+ else
+ {
+ ERR("%s:%i unhandled keyword %s",
+ file_in, line - 1,
+ (char *)eina_list_data_get(eina_list_last(stack)));
+ err_show();
+ exit(-1);
+ }
+}
+
+static char *
+perform_math(char *input)
+{
+ char buf[256];
+ double res;
+
+ /* FIXME
+ * Always apply floating-point arithmetic.
+ * Does this cause problems for integer parameters? (yes it will)
+ *
+ * What we should do is, loop over the string and figure out whether
+ * there are floating point operands, too and then switch to
+ * floating point math.
+ */
+ res = my_atof(input);
+ snprintf(buf, sizeof (buf), "%lf", res);
+ return strdup(buf);
+}
+
+static int
+isdelim(char c)
+{
+ const char *delims = "{},;:";
+ char *d;
+
+ d = (char *)delims;
+ while (*d)
+ {
+ if (c == *d) return 1;
+ d++;
+ }
+ return 0;
+}
+
+static char *
+next_token(char *p, char *end, char **new_p, int *delim)
+{
+ char *tok_start = NULL, *tok_end = NULL, *tok = NULL, *sa_start = NULL;
+ int in_tok = 0;
+ int in_quote = 0;
+ int in_parens = 0;
+ int in_comment_ss = 0;
+ int in_comment_cpp = 0;
+ int in_comment_sa = 0;
+ int had_quote = 0;
+ int is_escaped = 0;
+
+ *delim = 0;
+ if (p >= end) return NULL;
+ while (p < end)
+ {
+ if (*p == '\n')
+ {
+ in_comment_ss = 0;
+ in_comment_cpp = 0;
+ line++;
+ }
+ if ((!in_comment_ss) && (!in_comment_sa))
+ {
+ if ((!in_quote) && (*p == '/') && (p < (end - 1)) && (*(p + 1) == '/'))
+ in_comment_ss = 1;
+ if ((!in_quote) && (*p == '#'))
+ in_comment_cpp = 1;
+ if ((!in_quote) && (*p == '/') && (p < (end - 1)) && (*(p + 1) == '*'))
+ {
+ in_comment_sa = 1;
+ sa_start = p;
+ }
+ }
+ if ((in_comment_cpp) && (*p == '#'))
+ {
+ char *pp, fl[4096];
+ char *tmpstr = NULL;
+ int l, nm;
+
+ /* handle cpp comments */
+ /* their line format is
+ * #line <line no. of next line> <filename from next line on> [??]
+ */
+
+ pp = p;
+ while ((pp < end) && (*pp != '\n'))
+ {
+ pp++;
+ }
+ l = pp - p;
+ tmpstr = alloca(l + 1);
+ if (!tmpstr)
+ {
+ ERR("%s:%i malloc %i bytes failed",
+ file_in, line - 1, l + 1);
+ exit(-1);
+ }
+ strncpy(tmpstr, p, l);
+ tmpstr[l] = 0;
+ l = sscanf(tmpstr, "%*s %i \"%[^\"]\"", &nm, fl);
+ if (l == 2)
+ {
+ strcpy(file_buf, fl);
+ line = nm;
+ file_in = file_buf;
+ }
+ }
+ else if ((!in_comment_ss) && (!in_comment_sa) && (!in_comment_cpp))
+ {
+ if (!in_tok)
+ {
+ if (!in_quote)
+ {
+ if (!isspace(*p))
+ {
+ if (*p == '"')
+ {
+ in_quote = 1;
+ had_quote = 1;
+ }
+ else if (*p == '(')
+ in_parens++;
+
+ in_tok = 1;
+ tok_start = p;
+ if (isdelim(*p)) *delim = 1;
+ }
+ }
+ }
+ else
+ {
+ if (in_quote)
+ {
+ if ((*p) == '\\')
+ is_escaped = !is_escaped;
+ else if (((*p) == '"') && (!is_escaped))
+ {
+ in_quote = 0;
+ had_quote = 1;
+ }
+ else if (is_escaped)
+ is_escaped = 0;
+ }
+ else if (in_parens)
+ {
+ if (((*p) == ')') && (!is_escaped))
+ in_parens--;
+ }
+ else
+ {
+ if (*p == '"')
+ {
+ in_quote = 1;
+ had_quote = 1;
+ }
+ else if (*p == '(')
+ in_parens++;
+
+ /* check for end-of-token */
+ if (
+ (isspace(*p)) ||
+ ((*delim) && (!isdelim(*p))) ||
+ (isdelim(*p))
+ ) /*the line below this is never used because it skips to
+ * the 'done' label which is after the return call for
+ * in_tok being 0. is this intentional?
+ */
+ {
+ in_tok = 0;
+
+ tok_end = p - 1;
+ if (*p == '\n') line--;
+ goto done;
+ }
+ }
+ }
+ }
+ if (in_comment_sa)
+ {
+ if ((*p == '/') && (*(p - 1) == '*') && ((p - sa_start) > 2))
+ in_comment_sa = 0;
+ }
+ p++;
+ }
+ if (!in_tok) return NULL;
+ tok_end = p - 1;
+
+done:
+ *new_p = p;
+
+ tok = mem_alloc(tok_end - tok_start + 2);
+ if (!tok) return NULL;
+ strncpy(tok, tok_start, tok_end - tok_start + 1);
+ tok[tok_end - tok_start + 1] = 0;
+
+ if (had_quote)
+ {
+ is_escaped = 0;
+ p = tok;
+
+ while (*p)
+ {
+ if ((*p == '\"') && (!is_escaped))
+ {
+ memmove(p, p + 1, strlen(p));
+ }
+ else if ((*p == '\\') && (*(p + 1) == 'n'))
+ {
+ memmove(p, p + 1, strlen(p));
+ *p = '\n';
+ }
+ else if ((*p == '\\') && (*(p + 1) == 't'))
+ {
+ memmove(p, p + 1, strlen(p));
+ *p = '\t';
+ }
+ else if (*p == '\\')
+ {
+ memmove(p, p + 1, strlen(p));
+ if (*p == '\\') p++;
+ else is_escaped = 1;
+ }
+ else
+ {
+ if (is_escaped) is_escaped = 0;
+ p++;
+ }
+ }
+ }
+ else if (*tok == '(')
+ {
+ char *tmp;
+ tmp = tok;
+ tok = perform_math(tok);
+ free(tmp);
+ }
+
+ return tok;
+}
+
+static void
+stack_push(char *token)
+{
+ if (stack) eina_strbuf_append(stack_buf, ".");
+ eina_strbuf_append(stack_buf, token);
+
+ stack = eina_list_append(stack, token);
+}
+
+static void
+stack_pop(void)
+{
+ char *top;
+ int top_length;
+
+ if (!stack)
+ {
+ ERR("parse error %s:%i. } marker without matching { marker",
+ file_in, line - 1);
+
+ err_show();
+ exit(-1);
+ }
+
+ top = eina_list_data_get(eina_list_last(stack));
+ top_length = strlen(top);
+
+ stack = eina_list_remove_list(stack, eina_list_last(stack));
+
+ if (eina_list_count(stack)) top_length++; // remove '.' as well.
+
+ eina_strbuf_remove(stack_buf,
+ eina_strbuf_length_get(stack_buf) - top_length,
+ eina_strbuf_length_get(stack_buf));
+
+ free(top);
+}
+
+static const char *
+stack_id(void)
+{
+ return eina_strbuf_string_get(stack_buf);
+}
+
+static void
+parse(char *data, off_t size)
+{
+ char *p, *end, *token;
+ int delim = 0;
+ int do_params = 0;
+
+ DBG("Parsing input file");
+
+ p = data;
+ end = data + size;
+ line = 1;
+ while ((token = next_token(p, end, &p, &delim)))
+ {
+ /* if we are in param mode, the only delimiter
+ * we'll accept is the semicolon
+ */
+ if (do_params && delim && *token != ';')
+ {
+ ERR("parse error %s:%i. %c marker before ; marker",
+ file_in, line - 1, *token);
+ err_show();
+ exit(-1);
+ }
+ else if (delim)
+ {
+ if (*token == ',' || *token == ':') do_params = 1;
+ else if (*token == '}')
+ {
+ if (do_params)
+ {
+ ERR("Parse error %s:%i. } marker before ; marker",
+ file_in, line - 1);
+ err_show();
+ exit(-1);
+ }
+ else
+ stack_pop();
+ }
+ else if (*token == ';')
+ {
+ if (do_params)
+ {
+ do_params = 0;
+ new_statement();
+ /* clear out params */
+ while (params)
+ {
+ free(eina_list_data_get(params));
+ params = eina_list_remove(params, eina_list_data_get(params));
+ }
+ /* remove top from stack */
+ stack_pop();
+ }
+ }
+ else if (*token == '{')
+ {
+ if (do_params)
+ {
+ ERR("parse error %s:%i. { marker before ; marker",
+ file_in, line - 1);
+ err_show();
+ exit(-1);
+ }
+ }
+ free(token);
+ }
+ else
+ {
+ if (do_params)
+ params = eina_list_append(params, token);
+ else
+ {
+ stack_push(token);
+ new_object();
+ if ((verbatim == 1) && (p < (end - 2)))
+ {
+ int escaped = 0;
+ int inquotes = 0;
+ int insquotes = 0;
+ int squigglie = 1;
+ int l1 = 0, l2 = 0;
+ char *verbatim_1;
+ char *verbatim_2;
+
+ l1 = line;
+ while ((p[0] != '{') && (p < end))
+ {
+ if (*p == '\n') line++;
+ p++;
+ }
+ p++;
+ verbatim_1 = p;
+ verbatim_2 = NULL;
+ for (; p < end; p++)
+ {
+ if (*p == '\n') line++;
+ if (escaped) escaped = 0;
+ if (!escaped)
+ {
+ if (p[0] == '\\') escaped = 1;
+ else if (p[0] == '\"')
+ {
+ if (!insquotes)
+ {
+ if (inquotes) inquotes = 0;
+ else inquotes = 1;
+ }
+ }
+ else if (p[0] == '\'')
+ {
+ if (!inquotes)
+ {
+ if (insquotes) insquotes = 0;
+ else insquotes = 1;
+ }
+ }
+ else if ((!inquotes) && (!insquotes))
+ {
+ if (p[0] == '{') squigglie++;
+ else if (p[0] == '}')
+ squigglie--;
+ if (squigglie == 0)
+ {
+ verbatim_2 = p - 1;
+ l2 = line;
+ break;
+ }
+ }
+ }
+ }
+ if (verbatim_2 > verbatim_1)
+ {
+ int l;
+ char *v;
+
+ l = verbatim_2 - verbatim_1 + 1;
+ v = malloc(l + 1);
+ strncpy(v, verbatim_1, l);
+ v[l] = 0;
+ set_verbatim(v, l1, l2);
+ }
+ else
+ {
+ ERR("Parse error %s:%i. { marker does not have matching } marker",
+ file_in, line - 1);
+ err_show();
+ exit(-1);
+ }
+ new_object();
+ verbatim = 0;
+ }
+ }
+ }
+ }
+
+ DBG("Parsing done");
+}
+
+void
+set_verbatim(char *s, int l1, int l2)
+{
+ verbatim_line1 = l1;
+ verbatim_line2 = l2;
+ verbatim_str = s;
+}
+
+void
+compile(void)
+{
+ int fd;
+ off_t size;
+ char *data;
+
+ fd = open(file_in, O_RDONLY | O_BINARY, S_IRUSR | S_IWUSR);
+ if (fd < 0)
+ {
+ ERR("Cannot open file \"%s\" for input. %s",
+ file_in, strerror(errno));
+ exit(-1);
+ }
+ DBG("Opening \"%s\" for input", file_in);
+
+ size = lseek(fd, 0, SEEK_END);
+ if (size <= 0)
+ {
+ ERR("lseek failed");
+ close(fd);
+ return;
+ }
+ lseek(fd, 0, SEEK_SET);
+ data = malloc(size);
+ if (data && (read(fd, data, size) == size))
+ {
+ stack_buf = eina_strbuf_new();
+ parse(data, size);
+ eina_strbuf_free(stack_buf);
+ stack_buf = NULL;
+ }
+ else
+ {
+ ERR("Cannot read file \"%s\". %s", file_in, strerror(errno));
+ exit(-1);
+ }
+ free(data);
+ close(fd);
+}
+
+char *
+parse_str(int n)
+{
+ char *str;
+ char *s;
+
+ str = eina_list_nth(params, n);
+ if (!str)
+ {
+ ERR("%s:%i no parameter supplied as argument %i",
+ file_in, line - 1, n + 1);
+ err_show();
+ exit(-1);
+ }
+ s = mem_strdup(str);
+ return s;
+}
+
+static int
+_parse_enum(char *str, va_list va)
+{
+ va_list va2;
+ va_copy(va2, va); /* iterator for the error message */
+
+ for (;; )
+ {
+ char *s;
+ int v;
+
+ s = va_arg(va, char *);
+
+ /* End of the list, nothing matched. */
+ if (!s)
+ {
+ ERR("%s:%i token %s not one of:", file_in, line - 1, str);
+ s = va_arg(va2, char *);
+ while (s)
+ {
+ va_arg(va2, int);
+ fprintf(stderr, " %s", s);
+ s = va_arg(va2, char *);
+ if (!s) break;
+ }
+ fprintf(stderr, "\n");
+ va_end(va2);
+ va_end(va);
+ err_show();
+ exit(-1);
+ }
+
+ v = va_arg(va, int);
+ if (!strcmp(s, str))
+ {
+ va_end(va2);
+ va_end(va);
+ return v;
+ }
+ }
+ va_end(va2);
+ va_end(va);
+ return 0;
+}
+
+int
+parse_enum(int n, ...)
+{
+ char *str;
+ int result;
+ va_list va;
+
+ str = eina_list_nth(params, n);
+ if (!str)
+ {
+ ERR("%s:%i no parameter supplied as argument %i",
+ file_in, line - 1, n + 1);
+ err_show();
+ exit(-1);
+ }
+
+ va_start(va, n);
+ result = _parse_enum(str, va);
+ va_end(va);
+
+ return result;
+}
+
+int
+parse_int(int n)
+{
+ char *str;
+ int i;
+
+ str = eina_list_nth(params, n);
+ if (!str)
+ {
+ ERR("%s:%i no parameter supplied as argument %i",
+ file_in, line - 1, n + 1);
+ err_show();
+ exit(-1);
+ }
+ i = my_atoi(str);
+ return i;
+}
+
+int
+parse_int_range(int n, int f, int t)
+{
+ char *str;
+ int i;
+
+ str = eina_list_nth(params, n);
+ if (!str)
+ {
+ ERR("%s:%i no parameter supplied as argument %i",
+ file_in, line - 1, n + 1);
+ err_show();
+ exit(-1);
+ }
+ i = my_atoi(str);
+ if ((i < f) || (i > t))
+ {
+ ERR("%s:%i integer %i out of range of %i to %i inclusive",
+ file_in, line - 1, i, f, t);
+ err_show();
+ exit(-1);
+ }
+ return i;
+}
+
+int
+parse_bool(int n)
+{
+ char *str, buf[4096];
+ int i;
+
+ str = eina_list_nth(params, n);
+ if (!str)
+ {
+ ERR("%s:%i no parameter supplied as argument %i",
+ file_in, line - 1, n + 1);
+ err_show();
+ exit(-1);
+ }
+
+ if (!strstrip(str, buf, sizeof (buf)))
+ {
+ ERR("%s:%i expression is too long",
+ file_in, line - 1);
+ return 0;
+ }
+
+ if (!strcasecmp(buf, "false") || !strcasecmp(buf, "off"))
+ return 0;
+ if (!strcasecmp(buf, "true") || !strcasecmp(buf, "on"))
+ return 1;
+
+ i = my_atoi(str);
+ if ((i < 0) || (i > 1))
+ {
+ ERR("%s:%i integer %i out of range of 0 to 1 inclusive",
+ file_in, line - 1, i);
+ err_show();
+ exit(-1);
+ }
+ return i;
+}
+
+double
+parse_float(int n)
+{
+ char *str;
+ double i;
+
+ str = eina_list_nth(params, n);
+ if (!str)
+ {
+ ERR("%s:%i no parameter supplied as argument %i",
+ file_in, line - 1, n + 1);
+ err_show();
+ exit(-1);
+ }
+ i = my_atof(str);
+ return i;
+}
+
+int
+get_arg_count(void)
+{
+ return eina_list_count(params);
+}
+
+void
+check_arg_count(int required_args)
+{
+ int num_args = eina_list_count(params);
+
+ if (num_args != required_args)
+ {
+ ERR("%s:%i got %i arguments, but expected %i",
+ file_in, line - 1, num_args, required_args);
+ err_show();
+ exit(-1);
+ }
+}
+
+void
+check_min_arg_count(int min_required_args)
+{
+ int num_args = eina_list_count(params);
+
+ if (num_args < min_required_args)
+ {
+ ERR("%s:%i got %i arguments, but expected at least %i",
+ file_in, line - 1, num_args, min_required_args);
+ err_show();
+ exit(-1);
+ }
+}
+
+void
+check_regex(const char *regex)
+{
+ int ret;
+ char errbuf[1024];
+ regex_t preg;
+
+ ret = regcomp(&preg, regex, REG_EXTENDED | REG_NOSUB);
+ if (ret)
+ {
+ regerror(ret, &preg, errbuf, 1024);
+ ERR("%s:%i Invalid regular expression:\n"
+ "%s", file_in, line, errbuf);
+ err_show();
+ exit(-1);
+ }
+
+ regfree(&preg);
+}
+
+/* simple expression parsing stuff */
+
+/*
+ * alpha ::= beta + beta || beta
+ * beta ::= gamma + gamma || gamma
+ * gamma ::= num || delta
+ * delta ::= '(' alpha ')'
+ *
+ */
+
+/* int set of function */
+
+static int
+my_atoi(const char *s)
+{
+ int res = 0;
+ char buf[4096];
+
+ if (!s) return 0;
+ if (!strstrip(s, buf, sizeof(buf)))
+ {
+ ERR("%s:%i expression is too long",
+ file_in, line - 1);
+ return 0;
+ }
+ _alphai(buf, &res);
+ return res;
+}
+
+static char *
+_deltai(char *s, int *val)
+{
+ if (!val) return NULL;
+ if ('(' != s[0])
+ {
+ ERR("%s:%i unexpected character at %s",
+ file_in, line - 1, s);
+ return s;
+ }
+ else
+ {
+ s++;
+ s = _alphai(s, val);
+ s++;
+ return s;
+ }
+ return s;
+}
+
+static char *
+_funci(char *s, int *val)
+{
+ if (!strncmp(s, "floor(", 6))
+ {
+ s += 5;
+ s = _deltai(s, val);
+ }
+ else if (!strncmp(s, "ceil(", 5))
+ {
+ s += 4;
+ s = _deltai(s, val);
+ }
+ else
+ {
+ ERR("%s:%i unexpected character at %s",
+ file_in, line - 1, s);
+ }
+ return s;
+}
+
+static char *
+_gammai(char *s, int *val)
+{
+ if (!val) return NULL;
+ if (_is_numi(s[0]))
+ {
+ s = _get_numi(s, val);
+ return s;
+ }
+ else if ('(' == s[0])
+ {
+ s = _deltai(s, val);
+ return s;
+ }
+ else
+ {
+ s = _funci(s, val);
+// ERR("%s:%i unexpected character at %s",
+// progname, file_in, line - 1, s);
+ }
+ return s;
+}
+
+static char *
+_betai(char *s, int *val)
+{
+ int a1, a2;
+ char op;
+
+ if (!val) return NULL;
+ s = _gammai(s, &a1);
+ while (_is_op1i(s[0]))
+ {
+ op = s[0];
+ s++;
+ s = _gammai(s, &a2);
+ a1 = _calci(op, a1, a2);
+ }
+ (*val) = a1;
+ return s;
+}
+
+static char *
+_alphai(char *s, int *val)
+{
+ int a1, a2;
+ char op;
+
+ if (!val) return NULL;
+ s = _betai(s, &a1);
+ while (_is_op2i(s[0]))
+ {
+ op = s[0];
+ s++;
+ s = _betai(s, &a2);
+ a1 = _calci(op, a1, a2);
+ }
+ (*val) = a1;
+ return s;
+}
+
+static char *
+_get_numi(char *s, int *val)
+{
+ char buf[4096];
+ int pos = 0;
+
+ if (!val) return s;
+ while ((('0' <= s[pos]) && ('9' >= s[pos])) ||
+ ((0 == pos) && ('-' == s[pos])))
+ {
+ buf[pos] = s[pos];
+ pos++;
+ }
+ buf[pos] = '\0';
+ (*val) = atoi(buf);
+ return s + pos;
+}
+
+static int
+_is_numi(char c)
+{
+ if (((c >= '0') && (c <= '9')) || ('-' == c) || ('+' == c))
+ return 1;
+ else
+ return 0;
+}
+
+static int
+_is_op1i(char c)
+{
+ switch (c)
+ {
+ case '*':;
+
+ case '%':;
+
+ case '/': return 1;
+
+ default: break;
+ }
+ return 0;
+}
+
+static int
+_is_op2i(char c)
+{
+ switch (c)
+ {
+ case '+':;
+
+ case '-': return 1;
+
+ default: break;
+ }
+ return 0;
+}
+
+static int
+_calci(char op, int a, int b)
+{
+ switch (op)
+ {
+ case '+':
+ a += b;
+ return a;
+
+ case '-':
+ a -= b;
+ return a;
+
+ case '/':
+ if (0 != b) a /= b;
+ else
+ ERR("%s:%i divide by zero", file_in, line - 1);
+ return a;
+
+ case '*':
+ a *= b;
+ return a;
+
+ case '%':
+ if (0 != b) a = a % b;
+ else
+ ERR("%s:%i modula by zero", file_in, line - 1);
+ return a;
+
+ default:
+ ERR("%s:%i unexpected character '%c'", file_in, line - 1, op);
+ }
+ return a;
+}
+
+/* float set of functoins */
+
+static double
+my_atof(const char *s)
+{
+ double res = 0;
+ char buf[4096];
+
+ if (!s) return 0;
+
+ if (!strstrip(s, buf, sizeof (buf)))
+ {
+ ERR("%s:%i expression is too long", file_in, line - 1);
+ return 0;
+ }
+ _alphaf(buf, &res);
+ return res;
+}
+
+static char *
+_deltaf(char *s, double *val)
+{
+ if (!val) return NULL;
+ if ('(' != s[0])
+ {
+ ERR("%s:%i unexpected character at %s", file_in, line - 1, s);
+ return s;
+ }
+ else
+ {
+ s++;
+ s = _alphaf(s, val);
+ s++;
+ }
+ return s;
+}
+
+static char *
+_funcf(char *s, double *val)
+{
+ if (!strncmp(s, "floor(", 6))
+ {
+ s += 5;
+ s = _deltaf(s, val);
+ *val = floor(*val);
+ }
+ else if (!strncmp(s, "ceil(", 5))
+ {
+ s += 4;
+ s = _deltaf(s, val);
+ *val = ceil(*val);
+ }
+ else
+ {
+ ERR("%s:%i unexpected character at %s", file_in, line - 1, s);
+ }
+ return s;
+}
+
+static char *
+_gammaf(char *s, double *val)
+{
+ if (!val) return NULL;
+
+ if (_is_numf(s[0]))
+ {
+ s = _get_numf(s, val);
+ return s;
+ }
+ else if ('(' == s[0])
+ {
+ s = _deltaf(s, val);
+ return s;
+ }
+ else
+ {
+ s = _funcf(s, val);
+// ERR("%s:%i unexpected character at %s",
+// progname, file_in, line - 1, s);
+ }
+ return s;
+}
+
+static char *
+_betaf(char *s, double *val)
+{
+ double a1 = 0, a2 = 0;
+ char op;
+
+ if (!val) return NULL;
+ s = _gammaf(s, &a1);
+ while (_is_op1f(s[0]))
+ {
+ op = s[0];
+ s++;
+ s = _gammaf(s, &a2);
+ a1 = _calcf(op, a1, a2);
+ }
+ (*val) = a1;
+ return s;
+}
+
+static char *
+_alphaf(char *s, double *val)
+{
+ double a1 = 0, a2 = 0;
+ char op;
+
+ if (!val) return NULL;
+ s = _betaf(s, &a1);
+ while (_is_op2f(s[0]))
+ {
+ op = s[0];
+ s++;
+ s = _betaf(s, &a2);
+ a1 = _calcf(op, a1, a2);
+ }
+ (*val) = a1;
+ return s;
+}
+
+static char *
+_get_numf(char *s, double *val)
+{
+ char buf[4096];
+ int pos = 0;
+
+ if (!val) return s;
+
+ while ((('0' <= s[pos]) && ('9' >= s[pos])) ||
+ ('.' == s[pos]) ||
+ ((0 == pos) && ('-' == s[pos])))
+ {
+ buf[pos] = s[pos];
+ pos++;
+ }
+ buf[pos] = '\0';
+ (*val) = atof(buf);
+ return s + pos;
+}
+
+int
+params_min_check(int n)
+{
+ char *str;
+
+ str = _parse_param_get(n);
+ if (str) return 1;
+ return 0;
+}
+
+static int
+_is_numf(char c)
+{
+ if (((c >= '0') && (c <= '9'))
+ || ('-' == c)
+ || ('.' == c)
+ || ('+' == c))
+ return 1;
+ return 0;
+}
+
+static int
+_is_op1f(char c)
+{
+ switch (c)
+ {
+ case '*':;
+
+ case '%':;
+
+ case '/': return 1;
+
+ default: break;
+ }
+ return 0;
+}
+
+static int
+_is_op2f(char c)
+{
+ switch (c)
+ {
+ case '+':;
+
+ case '-': return 1;
+
+ default: break;
+ }
+ return 0;
+}
+
+static double
+_calcf(char op, double a, double b)
+{
+ switch (op)
+ {
+ case '+':
+ a += b;
+ return a;
+
+ case '-':
+ a -= b;
+ return a;
+
+ case '/':
+ if (b != 0) a /= b;
+ else
+ ERR("%s:%i divide by zero", file_in, line - 1);
+ return a;
+
+ case '*':
+ a *= b;
+ return a;
+
+ case '%':
+ if (0 != b) a = (double)((int)a % (int)b);
+ else
+ ERR("%s:%i modula by zero", file_in, line - 1);
+ return a;
+
+ default:
+ ERR("%s:%i unexpected character '%c'", file_in, line - 1, op);
+ }
+ return a;
+}
+
+static int
+strstrip(const char *in, char *out, size_t size)
+{
+ if ((size - 1) < strlen(in))
+ {
+ ERR("%s:%i expression is too long", file_in, line - 1);
+ return 0;
+ }
+ /* remove spaces and tabs */
+ while (*in)
+ {
+ if ((0x20 != *in) && (0x09 != *in))
+ {
+ *out = *in;
+ out++;
+ }
+ in++;
+ }
+ *out = '\0';
+ return 1;
+}
diff --git a/src/bin/elementary/quicklaunch.c b/src/bin/elementary/quicklaunch.c
new file mode 100644
index 0000000000..6ca0a3c973
--- /dev/null
+++ b/src/bin/elementary/quicklaunch.c
@@ -0,0 +1,347 @@
+#ifdef HAVE_CONFIG_H
+# include "elementary_config.h"
+#endif
+#include <stdio.h>
+#include <stdlib.h>
+#include <errno.h>
+#include <string.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <sys/un.h>
+#ifdef HAVE_ENVIRON
+# define _GNU_SOURCE 1
+#endif
+#include <unistd.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <signal.h>
+#include <sys/wait.h>
+
+#include <Elementary.h>
+
+#ifdef HAVE_ENVIRON
+extern char **environ;
+#endif
+
+static double restart_time = 0.0;
+
+#define LENGTH_OF_SOCKADDR_UN(s) (strlen((s)->sun_path) + (size_t)(((struct sockaddr_un *)NULL)->sun_path))
+
+static struct sigaction old_sigint;
+static struct sigaction old_sigterm;
+static struct sigaction old_sigquit;
+static struct sigaction old_sigalrm;
+static struct sigaction old_sigusr1;
+static struct sigaction old_sigusr2;
+static struct sigaction old_sighup;
+static struct sigaction old_sigchld;
+static struct sigaction old_sigsegv;
+static struct sigaction old_sigill;
+static struct sigaction old_sigfpe;
+static struct sigaction old_sigbus;
+static struct sigaction old_sigabrt;
+static int _log_dom = -1;
+
+#define CRI(...) EINA_LOG_DOM_CRIT(_log_dom, __VA_ARGS__)
+#define ERR(...) EINA_LOG_DOM_ERR(_log_dom, __VA_ARGS__)
+#define WRN(...) EINA_LOG_DOM_WARN(_log_dom, __VA_ARGS__)
+#define INF(...) EINA_LOG_DOM_INFO(_log_dom, __VA_ARGS__)
+#define DBG(...) EINA_LOG_DOM_DBG(_log_dom, __VA_ARGS__)
+
+static void
+post_fork(void *data EINA_UNUSED)
+{
+ sigaction(SIGINT, &old_sigint, NULL);
+ sigaction(SIGTERM, &old_sigterm, NULL);
+ sigaction(SIGQUIT, &old_sigquit, NULL);
+ sigaction(SIGALRM, &old_sigalrm, NULL);
+ sigaction(SIGUSR1, &old_sigusr1, NULL);
+ sigaction(SIGUSR2, &old_sigusr2, NULL);
+ sigaction(SIGHUP, &old_sighup, NULL);
+ sigaction(SIGCHLD, &old_sigchld, NULL);
+ sigaction(SIGSEGV, &old_sigsegv, NULL);
+ sigaction(SIGILL, &old_sigill, NULL);
+ sigaction(SIGFPE, &old_sigfpe, NULL);
+ sigaction(SIGBUS, &old_sigbus, NULL);
+ sigaction(SIGABRT, &old_sigabrt, NULL);
+ if ((_log_dom > -1) && (_log_dom != EINA_LOG_DOMAIN_GLOBAL))
+ {
+ eina_log_domain_unregister(_log_dom);
+ _log_dom = -1;
+ }
+}
+
+static void
+child_handler(int x EINA_UNUSED, siginfo_t *info EINA_UNUSED, void *data EINA_UNUSED)
+{
+ int status;
+ while (waitpid(-1, &status, WNOHANG) > 0);
+}
+
+static void
+crash_handler(int x EINA_UNUSED, siginfo_t *info EINA_UNUSED, void *data EINA_UNUSED)
+{
+ double t;
+
+ ERR("crash detected. restarting.");
+ t = ecore_time_get();
+ if ((t - restart_time) <= 2.0)
+ {
+ CRI("crash too fast - less than 2 seconds. abort restart");
+ exit(-1);
+ }
+ ecore_app_restart();
+}
+
+static void
+handle_run(int fd, unsigned long bytes)
+{
+ unsigned char *buf = NULL;
+ int i;
+ char **argv = NULL;
+ char **envir = NULL;
+ char *cwd;
+ int argc, envnum;
+ unsigned long off;
+
+ _elm_startup_time = ecore_time_unix_get();
+
+ buf = alloca(bytes);
+ if (read(fd, buf, bytes) != (int)bytes)
+ {
+ CRI("cannot read %i bytes of args and environment data", (int)bytes);
+ close(fd);
+ return;
+ }
+ close(fd);
+
+ argc = ((unsigned long *)(buf))[0];
+ envnum = ((unsigned long *)(buf))[1];
+
+ if (argc <= 0)
+ {
+ CRI("no executable specified");
+ return;
+ }
+
+ argv = alloca(argc * sizeof(char *));
+ if (envnum > 0) envir = alloca(envnum * sizeof(char *));
+ off = ((unsigned long *)(buf))[2 + argc + envnum] - sizeof(unsigned long);
+ cwd = (char *)(buf + off);
+
+ for (i = 0; i < argc; i++)
+ {
+ off = ((unsigned long *)(buf))[2 + i] - sizeof(unsigned long);
+ argv[i] = (char *)(buf + off);
+ }
+
+#ifdef HAVE_ENVIRON
+ if (envir)
+ {
+#ifdef HAVE_CLEARENV
+ clearenv();
+#else
+ environ = NULL;
+#endif
+ for (i = 0; i < envnum; i++)
+ {
+ off = ((unsigned long *)(buf))[2 + argc + i] - sizeof(unsigned long);
+ envir[i] = (char *)(buf + off);
+ putenv(envir[i]);
+ }
+ }
+#endif
+ elm_quicklaunch_prepare(argc, argv, cwd);
+ elm_quicklaunch_fork(argc, argv, cwd, post_fork, NULL);
+ elm_quicklaunch_cleanup();
+}
+
+int
+main(int argc, char **argv)
+{
+ int sock, socket_unix_len;
+ struct stat st;
+ struct sockaddr_un socket_unix;
+ struct linger lin;
+ char buf[PATH_MAX];
+ struct sigaction action;
+ const char *disp;
+ int ret = 0;
+
+ if (!eina_init())
+ {
+ fprintf(stderr, "ERROR: failed to init eina.");
+ exit(-1);
+ }
+ _log_dom = eina_log_domain_register
+ ("elementary_quicklaunch", EINA_COLOR_CYAN);
+ if (_log_dom < 0)
+ {
+ EINA_LOG_ERR("could not register elementary_quicklaunch log domain.");
+ _log_dom = EINA_LOG_DOMAIN_GLOBAL;
+ }
+
+ if (!(disp = getenv("DISPLAY"))) disp = "unknown";
+ snprintf(buf, sizeof(buf), "/tmp/elm-ql-%i", getuid());
+ if (stat(buf, &st) < 0)
+ {
+ ret = mkdir(buf, S_IRUSR | S_IWUSR | S_IXUSR);
+ if (ret < 0)
+ {
+ CRI("cannot create directory '%s'", buf);
+ exit(-1);
+ }
+ }
+ snprintf(buf, sizeof(buf), "/tmp/elm-ql-%i/%s", getuid(), disp);
+ unlink(buf);
+ sock = socket(AF_UNIX, SOCK_STREAM, 0);
+ if (sock < 0)
+ {
+ CRI("cannot create socket for socket for '%s': %s",
+ buf, strerror(errno));
+ exit(-1);
+ }
+ if (fcntl(sock, F_SETFD, FD_CLOEXEC) < 0)
+ {
+ CRI("cannot set close on exec socket for '%s' (fd=%d): %s",
+ buf, sock, strerror(errno));
+ exit(-1);
+ }
+ lin.l_onoff = 1;
+ lin.l_linger = 0;
+ if (setsockopt(sock, SOL_SOCKET, SO_LINGER, &lin, sizeof(struct linger)) < 0)
+ {
+ CRI("cannot set linger for socket for '%s' (fd=%d): %s",
+ buf, sock, strerror(errno));
+ exit(-1);
+ }
+ socket_unix.sun_family = AF_UNIX;
+ strncpy(socket_unix.sun_path, buf, sizeof(socket_unix.sun_path));
+ socket_unix_len = LENGTH_OF_SOCKADDR_UN(&socket_unix);
+ if (bind(sock, (struct sockaddr *)&socket_unix, socket_unix_len) < 0)
+ {
+ CRI("cannot bind socket for '%s' (fd=%d): %s",
+ buf, sock, strerror(errno));
+ exit(-1);
+ }
+ if (listen(sock, 4096) < 0)
+ {
+ CRI("listen(sock=%d, 4096): %s", sock, strerror(errno));
+ exit(-1);
+ }
+ elm_quicklaunch_mode_set(EINA_TRUE);
+ elm_quicklaunch_init(argc, argv);
+ restart_time = ecore_time_get();
+
+ memset(&action, 0, sizeof(struct sigaction));
+ action.sa_handler = SIG_DFL;
+ action.sa_sigaction = NULL;
+ action.sa_flags = SA_RESTART | SA_SIGINFO;
+ sigemptyset(&action.sa_mask);
+ sigaction(SIGINT, &action, &old_sigint);
+
+ action.sa_handler = SIG_DFL;
+ action.sa_sigaction = NULL;
+ action.sa_flags = SA_RESTART | SA_SIGINFO;
+ sigemptyset(&action.sa_mask);
+ sigaction(SIGTERM, &action, &old_sigterm);
+
+ action.sa_handler = SIG_DFL;
+ action.sa_sigaction = NULL;
+ action.sa_flags = SA_RESTART | SA_SIGINFO;
+ sigemptyset(&action.sa_mask);
+ sigaction(SIGQUIT, &action, &old_sigquit);
+
+ action.sa_handler = SIG_DFL;
+ action.sa_sigaction = NULL;
+ action.sa_flags = SA_RESTART | SA_SIGINFO;
+ sigemptyset(&action.sa_mask);
+ sigaction(SIGALRM, &action, &old_sigalrm);
+
+ action.sa_handler = SIG_DFL;
+ action.sa_sigaction = NULL;
+ action.sa_flags = SA_RESTART | SA_SIGINFO;
+ sigemptyset(&action.sa_mask);
+ sigaction(SIGUSR1, &action, &old_sigusr1);
+
+ action.sa_handler = SIG_DFL;
+ action.sa_sigaction = NULL;
+ action.sa_flags = SA_RESTART | SA_SIGINFO;
+ sigemptyset(&action.sa_mask);
+ sigaction(SIGUSR2, &action, &old_sigusr2);
+
+ action.sa_handler = SIG_DFL;
+ action.sa_sigaction = NULL;
+ action.sa_flags = SA_RESTART | SA_SIGINFO;
+ sigemptyset(&action.sa_mask);
+ sigaction(SIGHUP, &action, &old_sighup);
+
+ action.sa_handler = NULL;
+ action.sa_sigaction = child_handler;
+ action.sa_flags = SA_RESTART | SA_SIGINFO;
+ sigemptyset(&action.sa_mask);
+ sigaction(SIGCHLD, &action, &old_sigchld);
+
+ action.sa_handler = NULL;
+ action.sa_sigaction = crash_handler;
+ action.sa_flags = SA_NODEFER | SA_RESETHAND | SA_SIGINFO;
+ sigemptyset(&action.sa_mask);
+ sigaction(SIGSEGV, &action, &old_sigsegv);
+
+ action.sa_handler = NULL;
+ action.sa_sigaction = crash_handler;
+ action.sa_flags = SA_NODEFER | SA_RESETHAND | SA_SIGINFO;
+ sigemptyset(&action.sa_mask);
+ sigaction(SIGILL, &action, &old_sigill);
+
+ action.sa_handler = NULL;
+ action.sa_sigaction = crash_handler;
+ action.sa_flags = SA_NODEFER | SA_RESETHAND | SA_SIGINFO;
+ sigemptyset(&action.sa_mask);
+ sigaction(SIGFPE, &action, &old_sigfpe);
+
+ action.sa_handler = NULL;
+ action.sa_sigaction = crash_handler;
+ action.sa_flags = SA_NODEFER | SA_RESETHAND | SA_SIGINFO;
+ sigemptyset(&action.sa_mask);
+ sigaction(SIGBUS, &action, &old_sigbus);
+
+ action.sa_handler = NULL;
+ action.sa_sigaction = crash_handler;
+ action.sa_flags = SA_NODEFER | SA_RESETHAND | SA_SIGINFO;
+ sigemptyset(&action.sa_mask);
+ sigaction(SIGABRT, &action, &old_sigabrt);
+
+ for (;;)
+ {
+ int fd;
+ struct sockaddr_un client;
+ socklen_t len;
+
+ len = sizeof(struct sockaddr_un);
+ fd = accept(sock, (struct sockaddr *)&client, &len);
+ elm_quicklaunch_sub_init(argc, argv);
+ // don't seed since we are doing this AFTER launch request
+ // elm_quicklaunch_seed();
+ if (fd >= 0)
+ {
+ unsigned long bytes;
+ int num;
+
+ num = read(fd, &bytes, sizeof(unsigned long));
+ if (num == sizeof(unsigned long))
+ handle_run(fd, bytes);
+ }
+ while (elm_quicklaunch_sub_shutdown() > 0);
+ }
+ elm_quicklaunch_shutdown();
+
+ if ((_log_dom > -1) && (_log_dom != EINA_LOG_DOMAIN_GLOBAL))
+ {
+ eina_log_domain_unregister(_log_dom);
+ _log_dom = -1;
+ }
+ eina_shutdown();
+
+ return 0;
+}
diff --git a/src/bin/elementary/run.c b/src/bin/elementary/run.c
new file mode 100644
index 0000000000..a3ad3a4cab
--- /dev/null
+++ b/src/bin/elementary/run.c
@@ -0,0 +1,213 @@
+#include "elementary_config.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include <errno.h>
+#include <string.h>
+#include <limits.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <sys/un.h>
+#ifdef HAVE_ENVIRON
+# define _GNU_SOURCE 1
+#endif
+#include <unistd.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#ifdef HAVE_ALLOCA_H
+# include <alloca.h>
+#endif
+
+#ifdef HAVE_ENVIRON
+extern char **environ;
+#endif
+
+#define LENGTH_OF_SOCKADDR_UN(s) (strlen((s)->sun_path) + (size_t)(((struct sockaddr_un *)NULL)->sun_path))
+
+int
+main(int argc, char **argv)
+{
+ int sock, socket_unix_len, i, n;
+ struct sockaddr_un socket_unix;
+ char buf[PATH_MAX];
+ struct stat st;
+ char *exe;
+ int we_are_elementary_run = 0;
+ char *disp;
+ char *cwd;
+
+ int sargc, slen, envnum;
+ unsigned char *sbuf = NULL, *pos;
+ char **sargv = NULL;
+
+ if (!getcwd(buf, sizeof(buf) - 1))
+ {
+ fprintf(stderr, "elementary_quicklaunch: currect working dir too big.\n");
+ exit(-1);
+ }
+ cwd = strdup(buf);
+ if (!(disp = getenv("DISPLAY"))) disp = "unknown";
+ snprintf(buf, sizeof(buf), "/tmp/elm-ql-%i/%s", getuid(), disp);
+ if ((sock = socket(AF_UNIX, SOCK_STREAM, 0)) < 0)
+ {
+ perror("elementary_quicklaunch: socket(AF_UNIX, SOCK_STREAM, 0)");
+ exit(-1);
+ }
+ socket_unix.sun_family = AF_UNIX;
+ strncpy(socket_unix.sun_path, buf, sizeof(socket_unix.sun_path));
+ socket_unix.sun_path[(int)(sizeof(socket_unix.sun_path)/sizeof(socket_unix.sun_path[0])) - 1] = '\0';
+ socket_unix_len = LENGTH_OF_SOCKADDR_UN(&socket_unix);
+ if (connect(sock, (struct sockaddr *)&socket_unix, socket_unix_len) < 0)
+ {
+ perror("elementary_quicklaunch: connect(sock, (struct sockaddr *)&socket_unix, socket_unix_len)");
+ printf("elementary_quicklaunch: cannot connect to socket '%s'\n", buf);
+ exit(1);
+ }
+ exe = argv[0];
+ if (!(((exe[0] == '/')) ||
+ ((exe[0] == '.') && (exe[1] == '/')) ||
+ ((exe[0] == '.') && (exe[1] == '.') && (exe[2] == '/'))))
+ {
+ char *path = getenv("PATH");
+ int exelen = strlen(argv[0]);
+ if (path)
+ {
+ const char *p, *pp;
+
+ p = path;
+ pp = p;
+ exe = NULL;
+ for (;;)
+ {
+ if ((*p == ':') || (!*p))
+ {
+ unsigned int len;
+
+ len = p - pp;
+ if (len < (sizeof(buf) - exelen - 3))
+ {
+ strncpy(buf, pp, len);
+ strcpy(buf + len, "/");
+ strcpy(buf + len + 1, argv[0]);
+ if (!access(buf, R_OK | X_OK))
+ {
+ exe = buf;
+ break;
+ }
+ if (!*p) break;
+ p++;
+ pp = p;
+ }
+ }
+ else
+ {
+ if (!*p) break;
+ p++;
+ }
+ }
+ }
+ }
+ if (exe)
+ {
+ if (!lstat(exe, &st))
+ {
+ if (S_ISLNK(st.st_mode))
+ {
+ char buf2[PATH_MAX];
+
+ ssize_t len = readlink(exe, buf2, sizeof(buf2) - 1);
+ if (len >= 0)
+ {
+ char *p;
+ buf2[len] = 0;
+ p = strrchr(buf2, '/');
+ if (p) p++;
+ else p = buf2;
+ if (!strncasecmp(p, "elementary_run", 14))
+ we_are_elementary_run = 1;
+ }
+ }
+ }
+ }
+ if (we_are_elementary_run)
+ {
+ sargc = argc;
+ sargv = argv;
+ }
+ else
+ {
+ sargc = argc - 1;
+ sargv = &(argv[1]);
+ }
+
+ slen = 0;
+ envnum = 0;
+
+ // header:
+ // UL 'total bytes'
+ // UL 'argnum'
+ // UL 'envnum'
+ slen += sizeof(unsigned long) * 3;
+
+ for (i = 0; i < sargc; i++)
+ {
+ slen += sizeof(unsigned long);
+ slen += strlen(sargv[i]) + 1;
+ }
+
+#ifdef HAVE_ENVIRON
+ // count how much space is needed for environment
+ for (i = 0; environ[i]; i++)
+ {
+ slen += sizeof(unsigned long);
+ slen += strlen(environ[i]) + 1;
+ envnum++;
+ }
+#endif
+
+ // how much space is needed for cwd
+ slen += sizeof(unsigned long);
+ slen += strlen(cwd) + 1;
+
+ // allocate buffer on stack
+ sbuf = alloca(slen);
+
+ // fill in header
+ ((unsigned long *)(sbuf))[0] = slen - sizeof(unsigned long);
+ ((unsigned long *)(sbuf))[1] = sargc;
+ ((unsigned long *)(sbuf))[2] = envnum;
+ // pos pointer after header
+ pos = (unsigned char *)(&((((unsigned long *)(sbuf))[3 + sargc + envnum + 1])));
+ n = 3;
+
+ // fill in args
+ for (i = 0; i < sargc; i++)
+ {
+ ((unsigned long *)(sbuf))[n] = (unsigned long)pos - (unsigned long)sbuf;
+ strcpy((char *)pos, sargv[i]);
+ pos += strlen(sargv[i]) + 1;
+ n++;
+ }
+
+#ifdef HAVE_ENVIRON
+ // fill in environ
+ for (i = 0; environ[i]; i++)
+ {
+ ((unsigned long *)(sbuf))[n] = (unsigned long)pos - (unsigned long)sbuf;
+ strcpy((char *)pos, environ[i]);
+ pos += strlen(environ[i]) + 1;
+ n++;
+ }
+#endif
+
+ // fill in cwd
+ ((unsigned long *)(sbuf))[n] = (unsigned long)pos - (unsigned long)sbuf;
+ n++;
+ strcpy((char *)pos, cwd);
+
+ if (write(sock, sbuf, slen) < 0)
+ printf("elementary_quicklaunch: cannot write to socket '%s'\n", buf);
+ close(sock);
+
+ free(cwd);
+ return 0;
+}
diff --git a/src/bin/elementary/test.c b/src/bin/elementary/test.c
new file mode 100644
index 0000000000..3bad1c6d2c
--- /dev/null
+++ b/src/bin/elementary/test.c
@@ -0,0 +1,1030 @@
+#ifdef HAVE_CONFIG_H
+# include "elementary_config.h"
+#endif
+
+#include <string.h>
+#include <Elementary.h>
+#include "test.h"
+#include "test_explode.h"
+
+int _log_domain = -1;
+
+/* all tests prototypes */
+void test_access(void *data, Evas_Object *obj, void *event_info);
+void test_access2(void *data, Evas_Object *obj, void *event_info);
+void test_access3(void *data, Evas_Object *obj, void *event_info);
+void test_bg_plain(void *data, Evas_Object *obj, void *event_info);
+void test_bg_image(void *data, Evas_Object *obj, void *event_info);
+void test_bg_options(void *data, Evas_Object *obj, void *event_info);
+void test_icon(void *data, Evas_Object *obj, void *event_info);
+void test_icon_transparent(void *data, Evas_Object *obj, void *event_info);
+void test_icon_standard(void *data, Evas_Object *obj, void *event_info);
+void test_box_vert(void *data, Evas_Object *obj, void *event_info);
+void test_box_vert2(void *data, Evas_Object *obj, void *event_info);
+void test_box_pack(void *data, Evas_Object *obj, void *event_info);
+void test_box_horiz(void *data, Evas_Object *obj, void *event_info);
+void test_box_homo(void *data, Evas_Object *obj, void *event_info);
+void test_box_transition(void *data, Evas_Object *obj, void *event_info);
+void test_box_align(void *data, Evas_Object *obj, void *event_info);
+void test_button(void *data, Evas_Object *obj, void *event_info);
+void test_cnp(void *data, Evas_Object *obj, void *event_info);
+void test_transit(void *data, Evas_Object *obj, void *event_info);
+void test_transit_blend(void *data, Evas_Object *obj, void *event_info);
+void test_transit_chain(void *data, Evas_Object *obj, void *event_info);
+void test_transit_custom(void *data, Evas_Object *obj, void *event_info);
+void test_transit_fade(void *data, Evas_Object *obj, void *event_info);
+void test_transit_flip(void *data, Evas_Object *obj, void *event_info);
+void test_transit_resizable_flip(void *data, Evas_Object *obj, void *event_info);
+void test_transit_resizing(void *data, Evas_Object *obj, void *event_info);
+void test_transit_zoom(void *data, Evas_Object *obj, void *event_info);
+void test_transit_tween(void *data, Evas_Object *obj, void *event_info);
+void test_transit_bezier(void *data, Evas_Object *obj, void *event_info);
+void test_fileselector_button(void *data, Evas_Object *obj, void *event_info);
+void test_fileselector_entry(void *data, Evas_Object *obj, void *event_info);
+void test_clock(void *data, Evas_Object *obj, void *event_info);
+void test_clock_edit(void *data, Evas_Object *obj, void *event_info);
+void test_clock_edit2(void *data, Evas_Object *obj, void *event_info);
+void test_clock_pause(void *data, Evas_Object *obj, void *event_info);
+void test_combobox(void *data, Evas_Object *obj, void *event_info);
+void test_combobox2(void *data, Evas_Object *obj, void *event_info);
+void test_check(void *data, Evas_Object *obj, void *event_info);
+void test_check_toggle(void *data, Evas_Object *obj, void *event_info);
+void test_radio(void *data, Evas_Object *obj, void *event_info);
+void test_layout(void *data, Evas_Object *obj, void *event_info);
+void test_layout2(void *data, Evas_Object *obj, void *event_info);
+void test_hover(void *data, Evas_Object *obj, void *event_info);
+void test_hover2(void *data, Evas_Object *obj, void *event_info);
+void test_hover3(void *data, Evas_Object *obj, void *event_info);
+void test_entry(void *data, Evas_Object *obj, void *event_info);
+void test_entry_style_user(void *data, Evas_Object *obj, void *event_info);
+void test_entry_style_default(void *data, Evas_Object *obj, void *event_info);
+void test_entry_scrolled(void *data, Evas_Object *obj, void *event_info);
+void test_entry3(void *data, Evas_Object *obj, void *event_info);
+void test_entry4(void *data, Evas_Object *obj, void *event_info);
+void test_entry5(void *data, Evas_Object *obj, void *event_info);
+void test_entry6(void *data, Evas_Object *obj, void *event_info);
+void test_entry7(void *data, Evas_Object *obj, void *event_info);
+void test_entry8(void *data, Evas_Object *obj, void *event_info);
+void test_entry_regex(void *data, Evas_Object *obj, void *event_info);
+void test_entry_notepad(void *data, Evas_Object *obj, void *event_info);
+void test_multibuttonentry(void *data, Evas_Object *obj, void *event_info);
+void test_entry_anchor2(void *data, Evas_Object *obj, void *event_info);
+void test_entry_anchor(void *data, Evas_Object *obj, void *event_info);
+void test_entry_emoticon(void *data, Evas_Object *obj, void *event_info);
+void test_toolbar(void *data, Evas_Object *obj, void *event_info);
+void test_toolbar2(void *data, Evas_Object *obj, void *event_info);
+void test_toolbar3(void *data, Evas_Object *obj, void *event_info);
+void test_toolbar4(void *data, Evas_Object *obj, void *event_info);
+void test_toolbar5(void *data, Evas_Object *obj, void *event_info);
+void test_toolbar6(void *data, Evas_Object *obj, void *event_info);
+void test_toolbar7(void *data, Evas_Object *obj, void *event_info);
+void test_toolbar8(void *data, Evas_Object *obj, void *event_info);
+void test_toolbar_vertical(void *data, Evas_Object *obj, void *event_info);
+void test_toolbar_focus(void *data, Evas_Object *obj, void *event_info);
+void test_hoversel(void *data, Evas_Object *obj, void *event_info);
+void test_hoversel_focus(void *data, Evas_Object *obj, void *event_info);
+void test_list(void *data, Evas_Object *obj, void *event_info);
+void test_list_horizontal(void *data, Evas_Object *obj, void *event_info);
+void test_list2(void *data, Evas_Object *obj, void *event_info);
+void test_list3(void *data, Evas_Object *obj, void *event_info);
+void test_list4(void *data, Evas_Object *obj, void *event_info);
+void test_list5(void *data, Evas_Object *obj, void *event_info);
+void test_list6(void *data, Evas_Object *obj, void *event_info);
+void test_list7(void *data, Evas_Object *obj, void *event_info);
+void test_list_focus(void *data, Evas_Object *obj, void *event_info);
+void test_list_horiz_focus(void *data, Evas_Object *obj, void *event_info);
+void test_list_separator(void *data, Evas_Object *obj, void *event_info);
+void test_list_multi_select(void *data, Evas_Object *obj, void *event_info);
+void test_inwin(void *data, Evas_Object *obj, void *event_info);
+void test_inwin2(void *data, Evas_Object *obj, void *event_info);
+void test_scaling(void *data, Evas_Object *obj, void *event_info);
+void test_scaling2(void *data, Evas_Object *obj, void *event_info);
+void test_slider(void *data, Evas_Object *obj, void *event_info);
+void test_actionslider(void *data, Evas_Object *obj, void *event_info);
+void test_genlist(void *data, Evas_Object *obj, void *event_info);
+void test_genlist2(void *data, Evas_Object *obj, void *event_info);
+void test_genlist3(void *data, Evas_Object *obj, void *event_info);
+void test_genlist4(void *data, Evas_Object *obj, void *event_info);
+void test_genlist5(void *data, Evas_Object *obj, void *event_info);
+void test_genlist6(void *data, Evas_Object *obj, void *event_info);
+void test_genlist7(void *data, Evas_Object *obj, void *event_info);
+void test_genlist8(void *data, Evas_Object *obj, void *event_info);
+void test_genlist9(void *data, Evas_Object *obj, void *event_info);
+void test_genlist10(void *data, Evas_Object *obj, void *event_info);
+void test_genlist_reorder(void *data, Evas_Object *obj, void *event_info);
+void test_genlist12(void *data, Evas_Object *obj, void *event_info);
+void test_genlist13(void *data, Evas_Object *obj, void *event_info);
+void test_genlist14(void *data, Evas_Object *obj, void *event_info);
+void test_genlist15(void *data, Evas_Object *obj, void *event_info);
+void test_genlist16(void *data, Evas_Object *obj, void *event_info);
+void test_genlist17(void *data, Evas_Object *obj, void *event_info);
+void test_genlist18(void *data, Evas_Object *obj, void *event_info);
+void test_genlist19(void *data, Evas_Object *obj, void *event_info);
+void test_genlist20(void *data, Evas_Object *obj, void *event_info);
+void test_genlist_focus(void *data, Evas_Object *obj, void *event_info);
+void test_genlist_item_styles(void *data, Evas_Object *obj, void *event_info);
+void test_genlist_multi_select(void *data, Evas_Object *obj, void *event_info);
+void test_genlist_del(void *data, Evas_Object *obj, void *event_info);
+void test_genlist_filter(void *data, Evas_Object *obj, void *event_info);
+void test_genlist_show_bring(void *data, Evas_Object *obj, void *event_info);
+void test_gesture_layer(void *data, Evas_Object *obj, void *event_info);
+void test_gesture_layer2(void *data, Evas_Object *obj, void *event_info);
+void test_gesture_layer3(void *data, Evas_Object *obj, void *event_info);
+void test_table(void *data, Evas_Object *obj, void *event_info);
+void test_table2(void *data, Evas_Object *obj, void *event_info);
+void test_table3(void *data, Evas_Object *obj, void *event_info);
+void test_table4(void *data, Evas_Object *obj, void *event_info);
+void test_table5(void *data, Evas_Object *obj, void *event_info);
+void test_table6(void *data, Evas_Object *obj, void *event_info);
+void test_table7(void *data, Evas_Object *obj, void *event_info);
+void test_table8(void *data, Evas_Object *obj, void *event_info);
+void test_gengrid(void *data, Evas_Object *obj, void *event_info);
+void test_gengrid2(void *data, Evas_Object *obj, void *event_info);
+void test_gengrid3(void *data, Evas_Object *obj, void *event_info);
+void test_gengrid4(void *data, Evas_Object *obj, void *event_info);
+void test_gengrid5(void *data, Evas_Object *obj, void *event_info);
+void test_gengrid_item_styles(void *data, Evas_Object *obj, void *event_info);
+void test_gengrid_speed(void *data, Evas_Object *obj, void *event_info);
+void test_gengrid_focus(void *data, Evas_Object *obj, void *event_info);
+void test_gengrid_update(void *data, Evas_Object *obj, void *event_info);
+void test_win_state(void *data, Evas_Object *obj, void *event_info);
+void test_win_state2(void *data, Evas_Object *obj, void *event_info);
+void test_progressbar(void *data, Evas_Object *obj, void *event_info);
+void test_progressbar2(void *data, Evas_Object *obj, void *event_info);
+void test_fileselector(void *data, Evas_Object *obj, void *event_info);
+void test_separator(void *data, Evas_Object *obj, void *event_info);
+void test_scroller(void *data, Evas_Object *obj, void *event_info);
+void test_scroller2(void *data, Evas_Object *obj, void *event_info);
+void test_scroller3(void *data, Evas_Object *obj, void *event_info);
+void test_scroller4(void *data, Evas_Object *obj, void *event_info);
+void test_spinner(void *data, Evas_Object *obj, void *event_info);
+void test_index(void *data, Evas_Object *obj, void *event_info);
+void test_index2(void *data, Evas_Object *obj, void *event_info);
+void test_index3(void *data, Evas_Object *obj, void *event_info);
+void test_index_horizontal(void *data, Evas_Object *obj, void *event_info);
+void test_photocam(void *data, Evas_Object *obj, void *event_info);
+void test_photocam_remote(void *data, Evas_Object *obj, void *event_info);
+void test_photo(void *data, Evas_Object *obj, void *event_info);
+void test_prefs(void *data, Evas_Object *obj, void *event_info);
+void test_thumb(void *data, Evas_Object *obj, void *event_info);
+void test_icon_desktops(void *data, Evas_Object *obj, void *event_info);
+void test_icon_animated(void *data, Evas_Object *obj, void *event_info);
+void test_notify(void *data, Evas_Object *obj, void *event_info);
+void test_slideshow(void *data, Evas_Object *obj, void *event_info);
+void test_menu(void *data, Evas_Object *obj, void *event_info);
+void test_menu2(void *data, Evas_Object *obj, void *event_info);
+void test_panel(void *data, Evas_Object *obj, void *event_info);
+void test_panel2(void *data, Evas_Object *obj, void *event_info);
+void test_panes(void *data, Evas_Object *obj, void *event_info);
+void test_calendar(void *data, Evas_Object *obj, void *event_info);
+void test_calendar2(void *data, Evas_Object *obj, void *event_info);
+void test_calendar3(void *data, Evas_Object *obj, void *event_info);
+void test_map(void *data, Evas_Object *obj, void *event_info);
+void test_weather(void *data, Evas_Object *obj, void *event_info);
+void test_flip(void *data, Evas_Object *obj, void *event_info);
+void test_flip2(void *data, Evas_Object *obj, void *event_info);
+void test_flip3(void *data, Evas_Object *obj, void *event_info);
+void test_flip_interactive(void *data, Evas_Object *obj, void *event_info);
+void test_flip_to(void *data, Evas_Object *obj, void *event_info);
+void test_flip_page(void *data, Evas_Object *obj, void *event_info);
+void test_label(void *data, Evas_Object *obj, void *event_info);
+void test_label_slide(void *data, Evas_Object *obj, void *event_info);
+void test_label_wrap(void *data, Evas_Object *obj, void *event_info);
+void test_label_ellipsis(void *data, Evas_Object *obj, void *event_info);
+void test_conformant(void *data, Evas_Object *obj, void *event_info);
+void test_conformant2(void *data, Evas_Object *obj, void *event_info);
+void test_conformant_indicator(void *data, Evas_Object *obj, void *event_info);
+void test_main_menu(void *data, Evas_Object *obj, void *event_info);
+void test_multi(void *data, Evas_Object *obj, void *event_info);
+void test_floating(void *data, Evas_Object *obj, void *event_info);
+void test_launcher(void *data, Evas_Object *obj, void *event_info);
+void test_launcher2(void *data, Evas_Object *obj, void *event_info);
+void test_launcher3(void *data, Evas_Object *obj, void *event_info);
+void test_anim(void *data, Evas_Object *obj, void *event_info);
+void test_tooltip(void *data, Evas_Object *obj, void *event_info);
+void test_tooltip2(void *data, Evas_Object *obj, void *event_info);
+void test_tooltip3(void *data, Evas_Object *obj, void *event_info);
+void test_cursor(void *data, Evas_Object *obj, void *event_info);
+void test_cursor2(void *data, Evas_Object *obj, void *event_info);
+void test_cursor3(void *data, Evas_Object *obj, void *event_info);
+void test_cursor4(void *data, Evas_Object *obj, void *event_info);
+void test_focus(void *data, Evas_Object *obj, void *event_info);
+void test_focus2(void *data, Evas_Object *obj, void *event_info);
+void test_focus_hide_del(void *data, Evas_Object *obj, void *event_info);
+void test_focus_custom_chain(void *data, Evas_Object *obj, void *event_info);
+void test_focus_style(void *data, Evas_Object *obj, void *event_info);
+void test_focus_part(void *data, Evas_Object *obj, void *event_info);
+void test_focus3(void *data, Evas_Object *obj, void *event_info);
+void test_focus_object_style(void *data, Evas_Object *obj, void *event_info);
+void test_focus_object_policy(void *data, Evas_Object *obj, void *event_info);
+void test_flipselector(void *data, Evas_Object *obj, void *event_info);
+void test_diskselector(void *data, Evas_Object *obj, void *event_info);
+void test_colorselector(void *data, Evas_Object *obj, void *event_info);
+void test_ctxpopup(void *data, Evas_Object *obj, void *event_info);
+void test_bubble(void *data, Evas_Object *obj, void *event_info);
+void test_segment_control(void *data, Evas_Object *obj, void *event_info);
+void test_store(void *data, Evas_Object *obj, void *event_info);
+void test_sys_notify(void *data, Evas_Object *obj, void *event_info);
+void test_systray(void *data, Evas_Object *obj, void *event_info);
+void test_win_inline(void *data, Evas_Object *obj, void *event_info);
+void test_win_keygrab(void *data, Evas_Object *obj, void *event_info);
+void test_win_socket(void *data, Evas_Object *obj, void *event_info);
+void test_win_plug(void *data, Evas_Object *obj, void *event_info);
+void test_win_wm_rotation(void *data, Evas_Object *obj, void *event_info);
+void test_grid(void *data, Evas_Object *obj, void *event_info);
+void test_glview_simple(void *data, Evas_Object *obj, void *event_info);
+void test_glview(void *data, Evas_Object *obj, void *event_info);
+void test_glview_manygears(void *data, Evas_Object *obj, void *event_info);
+void test_3d(void *data, Evas_Object *obj, void *event_info);
+void test_naviframe(void *data, Evas_Object *obj, void *event_info);
+void test_naviframe2(void *data, Evas_Object *obj, void *event_info);
+void test_naviframe3(void *data, Evas_Object *obj, void *event_info);
+void test_naviframe_complex(void *data, Evas_Object *obj, void *event_info);
+//void test_factory(void *data, Evas_Object *obj, void *event_info);
+void test_datetime(void *data, Evas_Object *obj, void *event_info);
+void test_popup(void *data, Evas_Object *obj, void *event_info);
+void test_dayselector(void *data, Evas_Object *obj, void *event_info);
+void test_image(void *data, Evas_Object *obj, void *event_info);
+void test_remote_image(void *data, Evas_Object *obj, void *event_info);
+void test_click_image(void *data, Evas_Object *obj, void *event_info);
+void test_external_button(void *data, Evas_Object *obj, void *event_info);
+void test_external_slider(void *data, Evas_Object *obj, void *event_info);
+void test_external_scroller(void *data, Evas_Object *obj, void *event_info);
+void test_external_pbar(void *data, Evas_Object *obj, void *event_info);
+void test_external_video(void *data, Evas_Object *obj, void *event_info);
+void test_config(void *data, Evas_Object *obj, void *event_info);
+void test_video(void *data, Evas_Object *obj, void *event_info);
+void test_eio(void *data, Evas_Object *obj, void *event_info);
+#ifdef HAVE_ELEMENTARY_WEB
+void test_web(void *data, Evas_Object *obj, void *event_info);
+void test_web_ui(void *data, Evas_Object *obj, void *event_info);
+#endif
+void test_dnd_genlist_default_anim(void *data, Evas_Object *obj, void *event_info);
+void test_dnd_genlist_user_anim(void *data, Evas_Object *obj, void *event_info);
+void test_dnd_genlist_gengrid(void *data, Evas_Object *obj, void *event_info);
+void test_dnd_multi_features(void *data, Evas_Object *obj, void *event_info);
+void test_dnd_types(void *data, Evas_Object *obj, void *event_info);
+void test_task_switcher(void *data, Evas_Object *obj, void *event_info);
+void test_application_server_message(void *data, Evas_Object *obj, void *event_info);
+void test_application_server_phone(void *data, Evas_Object *obj, void *event_info);
+void test_win_dialog(void *data, Evas_Object *obj, void *event_info);
+void test_box_disable(void *data, Evas_Object *obj, void *event_info);
+void test_layout_disable(void *data, Evas_Object *obj, void *event_info);
+
+void test_colorclass(void *data, Evas_Object *obj, void *event_info);
+
+Evas_Object *win, *tbx; // TODO: refactoring
+void *tt;
+Eina_List *tests;
+
+struct elm_test
+{
+ const char *icon;
+ const char *category;
+ const char *name;
+ void (*cb)(void *, Evas_Object *, void *);
+};
+
+static int
+_elm_test_sort(const void *pa, const void *pb)
+{
+ const struct elm_test *a = pa, *b = pb;
+ int res = strcasecmp(a->category, b->category);
+ if (res) return res;
+ return strcasecmp(a->name, b->name);
+}
+
+static void
+_elm_test_add(Eina_List **p_list, const char *icon, const char *category, const char *name, void (*cb)(void *, Evas_Object *, void *))
+{
+ struct elm_test *t = malloc(sizeof(struct elm_test));
+ t->icon = icon;
+ t->category = category;
+ t->name = name;
+ t->cb = cb;
+ *p_list = eina_list_sorted_insert(*p_list, _elm_test_sort, t);
+}
+
+void
+my_win_del(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
+{
+ elm_exit(); /* exit the program's main loop that runs in elm_run() */
+}
+
+static void
+_ui_tg_changed(void *data, Evas_Object *obj, void *event_info)
+{
+ (void) data; (void) event_info;
+ elm_config_mirrored_set(elm_check_state_get(obj));
+}
+
+static void
+_frame_clicked(void *data EINA_UNUSED, Evas_Object *obj, void *event_info EINA_UNUSED)
+{
+ printf("frame %p is: %s\n", obj, elm_frame_collapse_get(obj) ? "collapsed" : "expanded");
+}
+
+static void
+_menu_create(const char *option_str)
+{
+ struct elm_test *t = NULL;
+ const char *pcat = NULL;
+ Evas_Object *cfr = NULL, *tbx2 = NULL, *bt = NULL, *ic = NULL;
+ char buf[PATH_MAX];
+ Eina_List *l;
+
+ elm_box_clear(tbx);
+ EINA_LIST_FOREACH(tests, l, t)
+ {
+ if (option_str && !strcasestr(t->name, option_str)) continue;
+ if ((!pcat) || (strcmp(pcat, t->category)))
+ {
+ cfr = elm_frame_add(win);
+ // FIXME: add new style of frame for this
+ evas_object_smart_callback_add(cfr, "clicked", _frame_clicked, NULL);
+ elm_frame_autocollapse_set(cfr, EINA_TRUE);
+ elm_object_text_set(cfr, t->category);
+ evas_object_size_hint_weight_set(cfr, EVAS_HINT_EXPAND, 0.0);
+ evas_object_size_hint_fill_set(cfr, EVAS_HINT_FILL, 0.0);
+ elm_box_pack_end(tbx, cfr);
+ evas_object_show(cfr);
+
+ tbx2 = elm_box_add(win);
+ elm_box_layout_set(tbx2, evas_object_box_layout_flow_horizontal, NULL, NULL);
+ evas_object_size_hint_weight_set(tbx2, EVAS_HINT_EXPAND, 0.0);
+ evas_object_size_hint_align_set(tbx2, EVAS_HINT_FILL, 0.0);
+ elm_box_align_set(tbx2, 0.0, 0.5);
+ elm_object_content_set(cfr, tbx2);
+ evas_object_show(tbx2);
+ }
+ bt = elm_button_add(win);
+ // FIXME: add new style of button for this like efm in e17
+ elm_object_text_set(bt, t->name);
+ if (t->icon)
+ {
+ ic = elm_icon_add(win);
+ snprintf(buf, sizeof(buf), "%s/images/%s", elm_app_data_dir_get(), t->icon);
+ elm_image_file_set(ic, buf, NULL);
+ elm_object_part_content_set(bt, "icon", ic);
+ evas_object_show(ic);
+ }
+ elm_box_pack_end(tbx2, bt);
+ evas_object_show(bt);
+ evas_object_smart_callback_add(bt, "clicked", t->cb, win);
+ pcat = t->category;
+ if (t == tt) tt = cfr;
+ }
+}
+
+static void
+_entry_changed_cb(void *data EINA_UNUSED, Evas_Object *obj, void *event_info EINA_UNUSED)
+{
+ const char *str = elm_entry_entry_get(obj);
+ if (!str) return;
+ _menu_create(str);
+}
+
+static char *
+_space_removed_string_get(const char *name)
+{
+ int i = 0, j = 0, len;
+ char *ret;
+
+ len = strlen(name);
+ ret = calloc(len + 1, sizeof(char));
+
+ while (name[i])
+ {
+ if (name[i] != ' ')
+ {
+ ret[j] = name[i];
+ j++;
+ }
+ i++;
+ }
+
+ return ret;
+}
+
+static void
+my_win_main(const char *autorun, Eina_Bool test_win_only)
+{
+ Evas_Object *bg = NULL, *bx0 = NULL, *bx1 = NULL, *lb = NULL;
+ Evas_Object *fr = NULL, *tg = NULL, *sc = NULL, *en = NULL;
+ Eina_List *l = NULL;
+ struct elm_test *t = NULL;
+
+ if (test_win_only) goto add_tests;
+ /* Create an elm window - It returns an evas object. This is a little
+ * special as the object lives in the canvas that is inside the window
+ * so what is returned is really inside the window, but as you manipulate
+ * the evas object returned - the window will respond. elm_win makes sure
+ * of that so you can blindly treat it like any other evas object
+ * pretty much, just as long as you know it has special significance.
+ * The first parameter is a "parent" window - eg for a dialog you want to
+ * have a main window it is related to, here it is NULL meaning there
+ * is no parent. "main" is the name of the window - used by the window
+ * manager for identifying the window uniquely amongst all the windows
+ * within this application (and all instances of the application). The
+ * type is a basic window (the final parameter).
+ * You can call elm_win_util_standard_add() instead. This is a convenient API
+ * for window and bg creation. You don't need to create bg object manually.
+ * You can also set the title of the window at the same time.
+ * ex) win = elm_win_util_standard_add("main", "Elementary Tests"); */
+ win = elm_win_add(NULL, "main", ELM_WIN_BASIC);
+ if (!win) exit(1);
+
+ explode_win_enable(win);
+ /* Set the title of the window - This is in the titlebar. */
+ elm_win_title_set(win, "Elementary Tests");
+
+ /* Set a callback on the window when "delete,request" is emitted as
+ * a callback. When this happens my_win_del() is called and the
+ * data pointer (first param) is passed the final param here (in this
+ * case it is NULL). This is how you can pass specific things to a
+ * callback like objects or data layered on top. */
+ evas_object_smart_callback_add(win, "delete,request", my_win_del, NULL);
+
+ /* Add a background to our window. This just uses the standard theme set
+ * background. Without a background, you could make a window seem
+ * transparent with elm_win_alpha_set(win, EINA_TRUE); For example. if you
+ * have a compositor running this will make the window able to be
+ * semi-transparent and any space not filled by object/widget pixels will
+ * be transparent or translucent based on alpha. If you do not have a
+ * compositor running this should fall back to using shaped windows
+ * (which have a mask). Both these features will be slow and rely on
+ * a lot more resources, so only use it if you need it. */
+ bg = elm_bg_add(win);
+ /* Set weight to 1.0 x 1.0 == expand in both x and y direction. */
+ evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ /* Tell the window that this object is to be resized along with the window.
+ * Also as a result this object will be one of several objects that
+ * controls the minimum/maximum size of the window. */
+ elm_win_resize_object_add(win, bg);
+ /* And show the background. */
+ evas_object_show(bg);
+
+ /* Add a box layout widget to the window. */
+ bx0 = elm_box_add(win);
+ /* Allow base box (bx0) to expand in x and y. */
+ evas_object_size_hint_weight_set(bx0, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ /* Tell the window that the box affects window size and also will be
+ * resized when the window is resized. */
+ elm_win_resize_object_add(win, bx0);
+ evas_object_show(bx0);
+
+ fr = elm_frame_add(win);
+ evas_object_smart_callback_add(fr, "clicked", _frame_clicked, NULL);
+ elm_frame_autocollapse_set(fr, EINA_TRUE);
+ elm_object_text_set(fr, "Information");
+ elm_box_pack_end(bx0, fr);
+ evas_object_show(fr);
+
+ lb = elm_label_add(win);
+ elm_object_text_set(lb,
+ "Please select a test from the list below by clicking<br/>"
+ "the test button to show the test window.");
+ elm_object_content_set(fr, lb);
+ evas_object_show(lb);
+
+ /* This label will not be read out */
+ elm_access_object_unregister(lb);
+
+ tg = elm_check_add(win);
+ elm_object_style_set(tg, "toggle");
+ elm_object_text_set(tg, "UI-Mirroring:");
+ elm_check_state_set(tg, elm_config_mirrored_get());
+ evas_object_smart_callback_add(tg, "changed", _ui_tg_changed, NULL);
+ elm_box_pack_end(bx0, tg);
+ evas_object_show(tg);
+
+ bx1 = elm_box_add(win);
+ elm_box_horizontal_set(bx1, EINA_TRUE);
+ evas_object_size_hint_weight_set(bx1, EVAS_HINT_EXPAND, 0.0);
+ evas_object_size_hint_align_set(bx1, EVAS_HINT_FILL, 0.0);
+ elm_box_pack_end(bx0, bx1);
+ evas_object_show(bx1);
+
+ lb = elm_label_add(win);
+ elm_object_text_set(lb, " Search Menu :");
+ evas_object_size_hint_weight_set(lb, 0.0, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(lb, 0.0, EVAS_HINT_FILL);
+ elm_box_pack_end(bx1, lb);
+ evas_object_show(lb);
+
+ en = elm_entry_add(win);
+ elm_entry_single_line_set(en, EINA_TRUE);
+ elm_entry_scrollable_set(en, EINA_TRUE);
+ elm_object_part_text_set(en, "guide", "Type widget name here to search.");
+ evas_object_size_hint_weight_set(en, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(en, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ evas_object_smart_callback_add(en, "changed,user", _entry_changed_cb, NULL);
+ elm_box_pack_end(bx1, en);
+ evas_object_show(en);
+ elm_object_focus_set(en, EINA_TRUE);
+
+ sc = elm_scroller_add(win);
+ elm_scroller_bounce_set(sc, EINA_FALSE, EINA_TRUE);
+ evas_object_size_hint_weight_set(sc, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_fill_set(sc, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ elm_box_pack_end(bx0, sc);
+ evas_object_show(sc);
+
+ tbx = elm_box_add(win);
+ evas_object_size_hint_weight_set(tbx, EVAS_HINT_EXPAND, 0.0);
+ evas_object_size_hint_align_set(tbx, EVAS_HINT_FILL, 0.0);
+ elm_object_content_set(sc, tbx);
+ evas_object_show(tbx);
+
+add_tests:
+ tests = NULL;
+#define ADD_TEST(icon_, cat_, name_, cb_) _elm_test_add(&tests, icon_, cat_, name_, cb_)
+
+ //------------------------------//
+ ADD_TEST(NULL, "Window / Background", "Bg Plain", test_bg_plain);
+ ADD_TEST(NULL, "Window / Background", "Bg Image", test_bg_image);
+ ADD_TEST(NULL, "Window / Background", "Bg Options", test_bg_options);
+ ADD_TEST(NULL, "Window / Background", "Window States", test_win_state);
+ ADD_TEST(NULL, "Window / Background", "Window States 2", test_win_state2);
+ ADD_TEST(NULL, "Window / Background", "Inwin", test_inwin);
+ ADD_TEST(NULL, "Window / Background", "Inwin 2", test_inwin2);
+ ADD_TEST(NULL, "Window / Background", "Window Inline", test_win_inline);
+ ADD_TEST(NULL, "Window / Background", "Window Socket", test_win_socket);
+ ADD_TEST(NULL, "Window / Background", "Window Plug", test_win_plug);
+ ADD_TEST(NULL, "Window / Background", "Window WM Rotation", test_win_wm_rotation);
+ ADD_TEST(NULL, "Window / Background", "Window Standard/Dialog", test_win_dialog);
+ ADD_TEST(NULL, "Window / Background", "Window Keygrab Set", test_win_keygrab);
+
+ //------------------------------//
+ ADD_TEST(NULL, "Images", "Icon", test_icon);
+ ADD_TEST(NULL, "Images", "Icon Transparent", test_icon_transparent);
+ ADD_TEST(NULL, "Images", "Icon Animation", test_icon_animated);
+ ADD_TEST(NULL, "Images", "Icon Standard", test_icon_standard);
+ ADD_TEST(NULL, "Images", "Photocam", test_photocam);
+ ADD_TEST(NULL, "Images", "Photocam Remote", test_photocam_remote);
+ ADD_TEST(NULL, "Images", "Photo", test_photo);
+ ADD_TEST(NULL, "Images", "Thumb", test_thumb);
+ ADD_TEST(NULL, "Images", "Image", test_image);
+ ADD_TEST(NULL, "Images", "Image Remote", test_remote_image);
+ ADD_TEST(NULL, "Images", "Image Click", test_click_image);
+ ADD_TEST(NULL, "Images", "Slideshow", test_slideshow);
+ ADD_TEST(NULL, "Images", "Video", test_video);
+
+ //------------------------------//
+ ADD_TEST(NULL, "Containers", "Box Vert", test_box_vert);
+ ADD_TEST(NULL, "Containers", "Box Vert 2", test_box_vert2);
+ ADD_TEST(NULL, "Containers", "Box Pack", test_box_pack);
+ ADD_TEST(NULL, "Containers", "Box Horiz", test_box_horiz);
+ ADD_TEST(NULL, "Containers", "Box Homogeneous", test_box_homo);
+ ADD_TEST(NULL, "Containers", "Box Transition", test_box_transition);
+ ADD_TEST(NULL, "Containers", "Box Align", test_box_align);
+ ADD_TEST(NULL, "Containers", "Table", test_table);
+ ADD_TEST(NULL, "Containers", "Table Homogeneous", test_table2);
+ ADD_TEST(NULL, "Containers", "Table 3", test_table3);
+ ADD_TEST(NULL, "Containers", "Table 4", test_table4);
+ ADD_TEST(NULL, "Containers", "Table 5", test_table5);
+ ADD_TEST(NULL, "Containers", "Table 6", test_table6);
+ ADD_TEST(NULL, "Containers", "Table 7", test_table7);
+ ADD_TEST(NULL, "Containers", "Table Padding", test_table8);
+ ADD_TEST(NULL, "Containers", "Layout", test_layout);
+ ADD_TEST(NULL, "Containers", "Layout 2", test_layout2);
+ ADD_TEST(NULL, "Containers", "Grid", test_grid);
+
+ //------------------------------//
+ ADD_TEST(NULL, "Entries", "Entry", test_entry);
+ ADD_TEST(NULL, "Entries", "Entry Style Default", test_entry_style_default);
+ ADD_TEST(NULL, "Entries", "Entry Style User", test_entry_style_user);
+ ADD_TEST(NULL, "Entries", "Entry Scrolled", test_entry_scrolled);
+ ADD_TEST(NULL, "Entries", "Entry 3", test_entry3);
+ ADD_TEST(NULL, "Entries", "Entry 4", test_entry4);
+ ADD_TEST(NULL, "Entries", "Entry 5", test_entry5);
+ ADD_TEST(NULL, "Entries", "Entry 6", test_entry6);
+ ADD_TEST(NULL, "Entries", "Entry 7", test_entry7);
+ ADD_TEST(NULL, "Entries", "Entry 8", test_entry8);
+ ADD_TEST(NULL, "Entries", "Entry Regex", test_entry_regex);
+ ADD_TEST(NULL, "Entries", "Entry Notepad", test_entry_notepad);
+ ADD_TEST(NULL, "Entries", "Multibuttonentry", test_multibuttonentry);
+ ADD_TEST(NULL, "Entries", "Entry Anchor", test_entry_anchor);
+ ADD_TEST(NULL, "Entries", "Entry Anchor2", test_entry_anchor2);
+ ADD_TEST(NULL, "Entries", "Entry Emoticon", test_entry_emoticon);
+
+ //------------------------------//
+ ADD_TEST(NULL, "Buttons", "Button", test_button);
+
+ //------------------------------//
+ ADD_TEST(NULL, "Prefs", "Prefs", test_prefs);
+
+ //------------------------------//
+ ADD_TEST(NULL, "Effects", "Transit", test_transit);
+ ADD_TEST(NULL, "Effects", "Transit Resizing", test_transit_resizing);
+ ADD_TEST(NULL, "Effects", "Transit Flip", test_transit_flip);
+ ADD_TEST(NULL, "Effects", "Transit Zoom", test_transit_zoom);
+ ADD_TEST(NULL, "Effects", "Transit Blend", test_transit_blend);
+ ADD_TEST(NULL, "Effects", "Transit Fade", test_transit_fade);
+ ADD_TEST(NULL, "Effects", "Transit Resizable Flip",
+ test_transit_resizable_flip);
+ ADD_TEST(NULL, "Effects", "Transit Custom", test_transit_custom);
+ ADD_TEST(NULL, "Effects", "Transit Chain", test_transit_chain);
+ ADD_TEST(NULL, "Effects", "Transit Tween", test_transit_tween);
+ ADD_TEST(NULL, "Effects", "Transit Bezier", test_transit_bezier);
+ ADD_TEST(NULL, "Effects", "Flip", test_flip);
+ ADD_TEST(NULL, "Effects", "Flip 2", test_flip2);
+ ADD_TEST(NULL, "Effects", "Flip 3", test_flip3);
+ ADD_TEST(NULL, "Effects", "Flip Interactive", test_flip_interactive);
+ ADD_TEST(NULL, "Effects", "Flip To", test_flip_to);
+ ADD_TEST(NULL, "Effects", "Flip Page", test_flip_page);
+ ADD_TEST(NULL, "Effects", "Animation", test_anim);
+
+ //------------------------------//
+ ADD_TEST(NULL, "Edje External", "ExtButton", test_external_button);
+ ADD_TEST(NULL, "Edje External", "ExtProgressBar", test_external_pbar);
+ ADD_TEST(NULL, "Edje External", "ExtScroller", test_external_scroller);
+ ADD_TEST(NULL, "Edje External", "ExtSlider", test_external_slider);
+ ADD_TEST(NULL, "Edje External", "ExtVideo", test_external_video);
+
+ //------------------------------//
+ ADD_TEST(NULL, "Toolbars", "Toolbar", test_toolbar);
+ ADD_TEST(NULL, "Toolbars", "Toolbar 2", test_toolbar2);
+ ADD_TEST(NULL, "Toolbars", "Toolbar 3", test_toolbar3);
+ ADD_TEST(NULL, "Toolbars", "Toolbar 4", test_toolbar4);
+ ADD_TEST(NULL, "Toolbars", "Toolbar 5", test_toolbar5);
+ ADD_TEST(NULL, "Toolbars", "Toolbar 6", test_toolbar6);
+ ADD_TEST(NULL, "Toolbars", "Toolbar 7", test_toolbar7);
+ ADD_TEST(NULL, "Toolbars", "Toolbar 8", test_toolbar8);
+ ADD_TEST(NULL, "Toolbars", "Toolbar Vertical", test_toolbar_vertical);
+ ADD_TEST(NULL, "Toolbars", "Toolbar Focus", test_toolbar_focus);
+
+ //------------------------------//
+ ADD_TEST(NULL, "Lists - List", "List", test_list);
+ ADD_TEST(NULL, "Lists - List", "List - Horizontal", test_list_horizontal);
+ ADD_TEST(NULL, "Lists - List", "List 2", test_list2);
+ ADD_TEST(NULL, "Lists - List", "List 3", test_list3);
+ ADD_TEST(NULL, "Lists - List", "List 4", test_list4);
+ ADD_TEST(NULL, "Lists - List", "List 5", test_list5);
+ ADD_TEST(NULL, "Lists - List", "List 6", test_list6);
+ ADD_TEST(NULL, "Lists - List", "List 7", test_list7);
+ ADD_TEST(NULL, "Lists - List", "List Focus", test_list_focus);
+ ADD_TEST(NULL, "Lists - List", "List Focus Horizontal", test_list_horiz_focus);
+ ADD_TEST(NULL, "Lists - List", "List Separator", test_list_separator);
+ ADD_TEST(NULL, "Lists - List", "List Multi Select", test_list_multi_select);
+
+ //------------------------------//
+
+ ADD_TEST(NULL, "Lists - Genlist", "Genlist", test_genlist);
+ ADD_TEST(NULL, "Lists - Genlist", "Genlist 2", test_genlist2);
+ ADD_TEST(NULL, "Lists - Genlist", "Genlist 3", test_genlist3);
+ ADD_TEST(NULL, "Lists - Genlist", "Genlist 4", test_genlist4);
+ ADD_TEST(NULL, "Lists - Genlist", "Genlist 5", test_genlist5);
+ ADD_TEST(NULL, "Lists - Genlist", "Genlist 7", test_genlist7);
+ ADD_TEST(NULL, "Lists - Genlist", "Genlist Tree", test_genlist6);
+ ADD_TEST(NULL, "Lists - Genlist", "Genlist Group", test_genlist8);
+ ADD_TEST(NULL, "Lists - Genlist", "Genlist Group Tree", test_genlist9);
+ ADD_TEST(NULL, "Lists - Genlist", "Genlist Decorate Item Mode", test_genlist10);
+ ADD_TEST(NULL, "Lists - Genlist", "Genlist Decorate All Mode", test_genlist15);
+ ADD_TEST(NULL, "Lists - Genlist", "Genlist Reorder Mode", test_genlist_reorder);
+#ifdef HAVE_EIO
+ ADD_TEST(NULL, "Lists - Genlist", "Genlist Eio", test_eio);
+#endif
+ ADD_TEST(NULL, "Lists - Genlist", "Genlist Textblock", test_genlist12);
+ ADD_TEST(NULL, "Lists - Genlist", "Genlist Tree, Insert Sorted", test_genlist13);
+ ADD_TEST(NULL, "Lists - Genlist", "Genlist Tree, Insert Relative", test_genlist14);
+ ADD_TEST(NULL, "Lists - Genlist", "Genlist Flip Mode", test_genlist16);
+ ADD_TEST(NULL, "Lists - Genlist", "Genlist Decorate Modes", test_genlist17);
+ ADD_TEST(NULL, "Lists - Genlist", "Genlist Tree and Decorate All Mode", test_genlist18);
+ ADD_TEST(NULL, "Lists - Genlist", "Genlist Full Widget", test_genlist19);
+ ADD_TEST(NULL, "Lists - Genlist", "Genlist Item Search By Text", test_genlist20);
+ ADD_TEST(NULL, "Lists - Genlist", "Genlist Focus", test_genlist_focus);
+ ADD_TEST(NULL, "Lists - Genlist", "Genlist Item Styles", test_genlist_item_styles);
+ ADD_TEST(NULL, "Lists - Genlist", "Genlist Multi Select", test_genlist_multi_select);
+ ADD_TEST(NULL, "Lists - Genlist", "Genlist Del", test_genlist_del);
+ ADD_TEST(NULL, "Lists - Genlist", "Genlist Filter", test_genlist_filter);
+ ADD_TEST(NULL, "Lists - Genlist", "Genlist Show/Bring", test_genlist_show_bring);
+
+ //------------------------------//
+
+ ADD_TEST(NULL, "Lists - Gengrid", "GenGrid", test_gengrid);
+ ADD_TEST(NULL, "Lists - Gengrid", "GenGrid 2", test_gengrid2);
+ ADD_TEST(NULL, "Lists - Gengrid", "GenGrid Group", test_gengrid3);
+ ADD_TEST(NULL, "Lists - Gengrid", "GenGrid Show/Bring_in", test_gengrid4);
+ ADD_TEST(NULL, "Lists - Gengrid", "GenGrid Item Search by Text", test_gengrid5);
+ ADD_TEST(NULL, "Lists - Gengrid", "GenGrid Item Styles", test_gengrid_item_styles);
+ ADD_TEST(NULL, "Lists - Gengrid", "Gengrid Update Speed", test_gengrid_speed);
+ ADD_TEST(NULL, "Lists - Gengrid", "GenGrid Focus", test_gengrid_focus);
+ ADD_TEST(NULL, "Lists - Gengrid", "GenGrid Update", test_gengrid_update);
+
+ //------------------------------//
+ ADD_TEST(NULL, "General", "Scaling", test_scaling);
+ ADD_TEST(NULL, "General", "Scaling 2", test_scaling2);
+
+ //------------------------------//
+ ADD_TEST(NULL, "3D", "Evas Map 3D", test_3d);
+ ADD_TEST(NULL, "3D", "GLViewSimple", test_glview_simple);
+ ADD_TEST(NULL, "3D", "GLView Gears", test_glview);
+ ADD_TEST(NULL, "3D", "GLView Many Gears", test_glview_manygears);
+
+ //------------------------------//
+#ifdef HAVE_ELEMENTARY_WEB
+ ADD_TEST(NULL, "Web", "Web", test_web);
+ ADD_TEST(NULL, "Web", "Web UI", test_web_ui);
+#endif
+
+ //------------------------------//
+ ADD_TEST(NULL, "Input", "Gesture Layer", test_gesture_layer);
+ ADD_TEST(NULL, "Input", "Gesture Layer 2", test_gesture_layer2);
+ ADD_TEST(NULL, "Input", "Gesture Layer 3", test_gesture_layer3);
+ ADD_TEST(NULL, "Input", "Multi Touch", test_multi);
+
+ //------------------------------//
+ ADD_TEST(NULL, "Selectors", "Index", test_index);
+ ADD_TEST(NULL, "Selectors", "Index 2", test_index2);
+ ADD_TEST(NULL, "Selectors", "Index 3", test_index3);
+ ADD_TEST(NULL, "Selectors", "Index Horizontal", test_index_horizontal);
+ ADD_TEST(NULL, "Selectors", "FileSelector", test_fileselector);
+ ADD_TEST(NULL, "Selectors", "FileSelector Entry", test_fileselector_entry);
+ ADD_TEST(NULL, "Selectors", "FileSelector Button", test_fileselector_button);
+ ADD_TEST(NULL, "Selectors", "Actionslider", test_actionslider);
+ ADD_TEST(NULL, "Selectors", "Menu", test_menu);
+ ADD_TEST(NULL, "Selectors", "Menu 2", test_menu2);
+ ADD_TEST(NULL, "Selectors", "DiskSelector", test_diskselector);
+ ADD_TEST(NULL, "Selectors", "ColorSelector", test_colorselector);
+ ADD_TEST(NULL, "Selectors", "Color Classes", test_colorclass);
+ ADD_TEST(NULL, "Selectors", "SegmentControl", test_segment_control);
+ ADD_TEST(NULL, "Selectors", "Hoversel", test_hoversel);
+ ADD_TEST(NULL, "Selectors", "Hoversel Focus", test_hoversel_focus);
+ ADD_TEST(NULL, "Selectors", "Radio", test_radio);
+ ADD_TEST(NULL, "Selectors", "FlipSelector", test_flipselector);
+ ADD_TEST(NULL, "Selectors", "DaySelector", test_dayselector);
+ ADD_TEST(NULL, "Selectors", "Main menu", test_main_menu);
+ ADD_TEST(NULL, "Selectors", "Combobox", test_combobox);
+ ADD_TEST(NULL, "Selectors", "Combobox Multiple Selection", test_combobox2);
+
+ //------------------------------//
+ ADD_TEST(NULL, "Cursors", "Cursor", test_cursor);
+ ADD_TEST(NULL, "Cursors", "Cursor 2", test_cursor2);
+ ADD_TEST(NULL, "Cursors", "Cursor 3", test_cursor3);
+ ADD_TEST(NULL, "Cursors", "Cursor Layout", test_cursor4);
+
+ //------------------------------//
+ ADD_TEST(NULL, "Scroller", "Scroller", test_scroller);
+ ADD_TEST(NULL, "Scroller", "Scroller 2", test_scroller2);
+ ADD_TEST(NULL, "Scroller", "Scroller 3", test_scroller3);
+ ADD_TEST(NULL, "Scroller", "Page Scroller", test_scroller4);
+
+ //------------------------------//
+ // FIXME: add frame test
+ ADD_TEST(NULL, "Boundaries", "Bubble", test_bubble);
+ ADD_TEST(NULL, "Boundaries", "Separator", test_separator);
+
+ //------------------------------//
+ ADD_TEST(NULL, "Range Values", "Spinner", test_spinner);
+ ADD_TEST(NULL, "Range Values", "Slider", test_slider);
+ ADD_TEST(NULL, "Range Values", "Progressbar", test_progressbar);
+ ADD_TEST(NULL, "Range Values", "Progressbar 2", test_progressbar2);
+
+ //------------------------------//
+ ADD_TEST(NULL, "Booleans", "Check", test_check);
+ ADD_TEST(NULL, "Booleans", "Check Toggle", test_check_toggle);
+
+ //------------------------------//
+ ADD_TEST(NULL, "Popups", "Ctxpopup", test_ctxpopup);
+ ADD_TEST(NULL, "Popups", "Hover", test_hover);
+ ADD_TEST(NULL, "Popups", "Hover 2", test_hover2);
+ ADD_TEST(NULL, "Popups", "Hover 3", test_hover3);
+ ADD_TEST(NULL, "Popups", "Notify", test_notify);
+ ADD_TEST(NULL, "Popups", "Tooltip", test_tooltip);
+ ADD_TEST(NULL, "Popups", "Tooltip 2", test_tooltip2);
+ ADD_TEST(NULL, "Popups", "Tooltip 3", test_tooltip3);
+ ADD_TEST(NULL, "Popups", "Popup", test_popup);
+
+ //------------------------------//
+ ADD_TEST(NULL, "Times & Dates", "Calendar", test_calendar);
+ ADD_TEST(NULL, "Times & Dates", "Calendar 2", test_calendar2);
+ ADD_TEST(NULL, "Times & Dates", "Calendar 3", test_calendar3);
+ ADD_TEST(NULL, "Times & Dates", "Clock", test_clock);
+ ADD_TEST(NULL, "Times & Dates", "Clock Edit", test_clock_edit);
+ ADD_TEST(NULL, "Times & Dates", "Clock Edit 2", test_clock_edit2);
+ ADD_TEST(NULL, "Times & Dates", "Clock Pause", test_clock_pause);
+ ADD_TEST(NULL, "Times & Dates", "Datetime", test_datetime);
+
+ //------------------------------//
+ ADD_TEST(NULL, "Text", "Label", test_label);
+ ADD_TEST(NULL, "Text", "Label Slide", test_label_slide);
+ ADD_TEST(NULL, "Text", "Label Wrap", test_label_wrap);
+ ADD_TEST(NULL, "Text", "Label Ellipsis", test_label_ellipsis);
+
+ //------------------------------//
+ ADD_TEST(NULL, "Stored Surface Buffer", "Launcher", test_launcher);
+ ADD_TEST(NULL, "Stored Surface Buffer", "Launcher 2", test_launcher2);
+ ADD_TEST(NULL, "Stored Surface Buffer", "Launcher 3", test_launcher3);
+
+ //------------------------------//
+ ADD_TEST(NULL, "Focus", "Focus", test_focus);
+ ADD_TEST(NULL, "Focus", "Focus 2", test_focus2);
+ ADD_TEST(NULL, "Focus", "Focus Hide/Del", test_focus_hide_del);
+ ADD_TEST(NULL, "Focus", "Focus Custom Chain", test_focus_custom_chain);
+ ADD_TEST(NULL, "Focus", "Focus Style", test_focus_style);
+ ADD_TEST(NULL, "Focus", "Focus On Part", test_focus_part);
+ ADD_TEST(NULL, "Focus", "Focus 3", test_focus3);
+ ADD_TEST(NULL, "Focus", "Focus Object Style", test_focus_object_style);
+ ADD_TEST(NULL, "Focus", "Focus Object Policy", test_focus_object_policy);
+
+ //------------------------------//
+ ADD_TEST(NULL, "Naviframe", "Naviframe", test_naviframe);
+ ADD_TEST(NULL, "Naviframe", "Naviframe 2", test_naviframe2);
+ ADD_TEST(NULL, "Naviframe", "Naviframe 3", test_naviframe3);
+ ADD_TEST(NULL, "Naviframe", "Naviframe: Complex", test_naviframe_complex);
+
+ //------------------------------//
+ ADD_TEST(NULL, "Geographic", "Map", test_map);
+
+ //------------------------------//
+ ADD_TEST(NULL, "Dividers", "Panel", test_panel);
+ ADD_TEST(NULL, "Dividers", "Panel Scrollable", test_panel2);
+ ADD_TEST(NULL, "Dividers", "Panes", test_panes);
+
+ //------------------------------//
+ ADD_TEST(NULL, "Standardization", "Conformant", test_conformant);
+ ADD_TEST(NULL, "Standardization", "Conformant 2", test_conformant2);
+ ADD_TEST(NULL, "Standardization", "Conformant indicator", test_conformant_indicator);
+
+ //------------------------------//
+ ADD_TEST(NULL, "Helpers", "Store", test_store);
+// ADD_TEST(NULL, "Helpers", "Factory", test_factory);
+
+ //------------------------------//
+ ADD_TEST(NULL, "System", "Notification", test_sys_notify);
+ ADD_TEST(NULL, "System", "Systray Item", test_systray);
+
+ //------------------------------//
+ ADD_TEST(NULL, "Drag & Drop", "Genlist DnD Dflt Anim", test_dnd_genlist_default_anim);
+ ADD_TEST(NULL, "Drag & Drop", "Genlist DnD User Anim", test_dnd_genlist_user_anim);
+ ADD_TEST(NULL, "Drag & Drop", "Genlist-Gengrid DnD", test_dnd_genlist_gengrid);
+ ADD_TEST(NULL, "Drag & Drop", "Features DnD", test_dnd_multi_features);
+ ADD_TEST(NULL, "Drag & Drop", "Types DnD", test_dnd_types);
+
+ //------------------------------//
+ ADD_TEST(NULL, "Miscellaneous", "Copy And Paste", test_cnp);
+ ADD_TEST(NULL, "Miscellaneous", "Weather", test_weather);
+ ADD_TEST(NULL, "Miscellaneous", "Icon Desktops", test_icon_desktops);
+ ADD_TEST(NULL, "Miscellaneous", "Floating Objects", test_floating);
+ ADD_TEST(NULL, "Miscellaneous", "Configuration", test_config);
+ ADD_TEST(NULL, "Miscellaneous", "Accessibility", test_access);
+ ADD_TEST(NULL, "Miscellaneous", "Accessibility2", test_access2);
+ ADD_TEST(NULL, "Miscellaneous", "Accessibility3", test_access3);
+
+ //------------------------------//
+ ADD_TEST(NULL, "Application client/server", "Task switcher", test_task_switcher);
+ ADD_TEST(NULL, "Application client/server", "Phone", test_application_server_phone);
+ ADD_TEST(NULL, "Application client/server", "Message", test_application_server_message);
+
+ ADD_TEST(NULL, "Widgets Disable/Enable", "Box", test_box_disable);
+ ADD_TEST(NULL, "Widgets Disable/Enable", "Layout", test_layout_disable);
+
+#undef ADD_TEST
+
+ if (autorun)
+ {
+ char *tmp = _space_removed_string_get(autorun);
+ EINA_LIST_FOREACH(tests, l, t)
+ {
+ char *name;
+
+ if (!t->name || !t->cb) continue;
+
+ name = _space_removed_string_get(t->name);
+ if (!strcasecmp(name, tmp))
+ {
+ t->cb(NULL, NULL, NULL);
+ free(name);
+ break;
+ }
+ free(name);
+ }
+ free(tmp);
+
+ if (!l)
+ ERR("'%s' is not valid test case name\n", autorun);
+ }
+ tt = t;
+
+ if (test_win_only)
+ {
+ EINA_LIST_FREE(tests, t)
+ free(t);
+
+ if (!l)
+ elm_exit();
+
+ return;
+ }
+
+ if (tests)
+ _menu_create(NULL);
+
+ /* bring in autorun frame */
+ if (autorun)
+ {
+ Evas_Coord x, y;
+ evas_object_geometry_get(tt, &x, &y, NULL, NULL);
+ elm_scroller_region_bring_in(sc, x, y, 0, 0);
+ }
+
+ /* set an initial window size */
+ evas_object_resize(win, 480, 480);
+ evas_object_show(win);
+}
+
+static char *
+colorclass_tl_cb(char *str)
+{
+ /* FIXME: translate? */
+ return str;
+}
+
+static Eina_List *
+colorclass_list_cb(void)
+{
+ Eina_List *l, *ret = NULL;
+ Eina_Iterator *it;
+ Eina_File *f;
+
+ it = edje_file_iterator_new();
+ if (!it) return NULL;
+ EINA_ITERATOR_FOREACH(it, f)
+ {
+ l = elm_color_class_util_edje_file_list(f);
+ if (l)
+ ret = eina_list_merge(ret, l);
+ }
+ eina_iterator_free(it);
+ return ret;
+}
+
+/* this is your elementary main function - it MUST be called IMMEDIATELY
+ * after elm_init() and MUST be passed argc and argv, and MUST be called
+ * elm_main and not be static - must be a visible symbol with EAPI_MAIN infront */
+EAPI_MAIN int
+elm_main(int argc, char **argv)
+{
+ Eina_Bool test_win_only = EINA_FALSE;
+ char *autorun = NULL;
+ struct elm_test *t = NULL;
+
+ _log_domain = eina_log_domain_register("elementary_test", NULL);
+
+ elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED);
+
+ /* tell elm about our app so it can figure out where to get files */
+ elm_app_compile_bin_dir_set(PACKAGE_BIN_DIR);
+ elm_app_compile_lib_dir_set(PACKAGE_LIB_DIR);
+ elm_app_compile_data_dir_set(PACKAGE_DATA_DIR);
+ elm_app_info_set(elm_main, "elementary", "images/logo.png");
+
+ /* if called with a single argument try to autorun a test with
+ * the same name as the given param
+ * ex: elementary_test "Box Vert 2" */
+ if (argc == 2)
+ {
+ if (!strcmp(argv[1], "--help"))
+ {
+ printf("Usages:\n"
+ "$ elementary_test\n"
+ "$ elementary_test --test-win-only [TEST_NAME]\n"
+ "$ elementary_test -to [TEST_NAME]\n\n"
+ "Examples:\n"
+ "$ elementary_test -to Button\n\n");
+ goto end;
+ }
+ autorun = argv[1];
+ }
+ else if (argc == 3)
+ {
+ /* Just a workaround to make the shot module more
+ * useful with elementary test. */
+ if ((!strcmp(argv[1], "--test-win-only")) ||
+ (!strcmp(argv[1], "-to")))
+ {
+ test_win_only = EINA_TRUE;
+ autorun = argv[2];
+ }
+ }
+
+ elm_color_class_translate_cb_set(colorclass_tl_cb);
+ elm_color_class_list_cb_set(colorclass_list_cb);
+ /* put here any init specific to this app like parsing args etc. */
+ my_win_main(autorun, test_win_only); /* create main window */
+ elm_run(); /* and run the program now and handle all events etc. */
+ /* if the mainloop that elm_run() runs exist - we exit the app */
+
+ EINA_LIST_FREE(tests, t)
+ free(t);
+
+end:
+ eina_log_domain_unregister(_log_domain);
+
+ /* exit code */
+ return 0;
+}
+/* all elementary apps should use this. but it should be placed right after
+ * elm_main() */
+ELM_MAIN()
diff --git a/src/bin/elementary/test.h b/src/bin/elementary/test.h
new file mode 100644
index 0000000000..a5e78bb56a
--- /dev/null
+++ b/src/bin/elementary/test.h
@@ -0,0 +1,12 @@
+#ifndef _TEST_H
+#define _TEST_H
+
+extern int _log_domain;
+
+#define CRI(...) EINA_LOG_DOM_CRIT(_log_domain, _VA_ARGS__)
+#define ERR(...) EINA_LOG_DOM_ERR(_log_domain, __VA_ARGS__)
+#define WRN(...) EINA_LOG_DOM_WARN(_log_domain, __VA_ARGS__)
+#define INF(...) EINA_LOG_DOM_INFO(_log_domain, __VA_ARGS__)
+#define DBG(...) EINA_LOG_DOM_DBG(_log_domain, __VA_ARGS__)
+
+#endif
diff --git a/src/bin/elementary/test_3d.c b/src/bin/elementary/test_3d.c
new file mode 100644
index 0000000000..66292727b9
--- /dev/null
+++ b/src/bin/elementary/test_3d.c
@@ -0,0 +1,333 @@
+#include "test.h"
+#ifdef HAVE_CONFIG_H
+# include "elementary_config.h"
+#endif
+#include <Elementary.h>
+
+typedef struct _Point
+{
+ Evas_Coord x, y, z, u, v;
+} Point;
+
+typedef struct _Side
+{
+ Evas_Object *o;
+ Point pt[4];
+} Side;
+
+typedef struct _Cube
+{
+ Side side[6];
+} Cube;
+
+static Cube *cube;
+static double rotx = 0.0, roty = 0.0, rotz = 0.0;
+static double cxo = 0.0, cyo = 0.0, focv = 256.0, z0v = 0.0;
+#define POINT(n, p, xx, yy, zz, uu, vv) \
+ c->side[n].pt[p].x = xx; \
+ c->side[n].pt[p].y = yy; \
+ c->side[n].pt[p].z = zz; \
+ c->side[n].pt[p].u = uu; \
+ c->side[n].pt[p].v = vv
+
+static Cube *
+_cube_new(Evas *evas, Evas_Coord w, Evas_Coord h, Evas_Coord d)
+{
+ Cube *c;
+ int i;
+
+ w -= (w / 2);
+ h -= (h / 2);
+ d -= (d / 2);
+ c = calloc(1, sizeof(Cube));
+ for (i = 0; i < 6; i++)
+ {
+ Evas_Object *o;
+ char buf[PATH_MAX];
+ o = evas_object_image_filled_add(evas);
+ c->side[i].o = o;
+ snprintf(buf, sizeof(buf), "%s/images/%s",
+ elm_app_data_dir_get(), "twofish.jpg");
+ evas_object_image_file_set(o, buf, NULL);
+ evas_object_resize(o, 256, 256);
+ evas_object_pass_events_set(o, EINA_TRUE);
+ evas_object_color_set(o, 235, 235, 235, 235);
+ evas_object_show(o);
+ }
+ POINT(0, 0, -w, -h, -d, 0, 0);
+ POINT(0, 1, w, -h, -d, 256, 0);
+ POINT(0, 2, w, h, -d, 256, 256);
+ POINT(0, 3, -w, h, -d, 0, 256);
+
+ POINT(1, 0, w, -h, -d, 0, 0);
+ POINT(1, 1, w, -h, d, 256, 0);
+ POINT(1, 2, w, h, d, 256, 256);
+ POINT(1, 3, w, h, -d, 0, 256);
+
+ POINT(2, 0, w, -h, d, 0, 0);
+ POINT(2, 1, -w, -h, d, 256, 0);
+ POINT(2, 2, -w, h, d, 256, 256);
+ POINT(2, 3, w, h, d, 0, 256);
+
+ POINT(3, 0, -w, -h, d, 0, 0);
+ POINT(3, 1, -w, -h, -d, 256, 0);
+ POINT(3, 2, -w, h, -d, 256, 256);
+ POINT(3, 3, -w, h, d, 0, 256);
+
+ POINT(4, 0, -w, -h, d, 0, 0);
+ POINT(4, 1, w, -h, d, 256, 0);
+ POINT(4, 2, w, -h, -d, 256, 256);
+ POINT(4, 3, -w, -h, -d, 0, 256);
+
+ POINT(5, 0, -w, h, -d, 0, 0);
+ POINT(5, 1, w, h, -d, 256, 0);
+ POINT(5, 2, w, h, d, 256, 256);
+ POINT(5, 3, -w, h, d, 0, 256);
+
+ return c;
+}
+
+static void
+_cube_pos(Cube *c,
+ Evas_Coord x, Evas_Coord y, Evas_Coord z,
+ double dx, double dy, double dz,
+ Evas_Coord cx, Evas_Coord cy, Evas_Coord z0, Evas_Coord foc)
+{
+ Evas_Map *m;
+ int i, j, order[6], sorted;
+ Evas_Coord mz[6];
+
+ m = evas_map_new(4);
+
+ for (i = 0; i < 6; i++)
+ {
+ Evas_Coord tz[4];
+
+ for (j = 0; j < 4; j++)
+ {
+ evas_map_point_coord_set(m, j,
+ c->side[i].pt[j].x + x,
+ c->side[i].pt[j].y + y,
+ c->side[i].pt[j].z + z);
+ evas_map_point_image_uv_set(m, j,
+ c->side[i].pt[j].u,
+ c->side[i].pt[j].v);
+ evas_map_point_color_set(m, j, 255, 255, 255, 255);
+ }
+ evas_map_util_3d_rotate(m, dx, dy, dz, x, y, z);
+ evas_map_util_3d_lighting(m, -1000, -1000, -1000,
+ 255, 255, 255,
+ 20, 20, 20);
+ evas_map_util_3d_perspective(m, cx, cy, z0, foc);
+ if (evas_map_util_clockwise_get(m))
+ {
+ evas_object_map_enable_set(c->side[i].o, EINA_TRUE);
+ evas_object_map_set(c->side[i].o, m);
+ evas_object_show(c->side[i].o);
+ }
+ else
+ evas_object_hide(c->side[i].o);
+
+ order[i] = i;
+ for (j = 0; j < 4; j++)
+ evas_map_point_coord_get(m, j, NULL, NULL, &(tz[j]));
+ mz[i] = (tz[0] + tz[1] + tz[2] + tz[3]) / 4;
+ }
+ do
+ {
+ sorted = 1;
+ for (i = 0; i < 5; i++)
+ {
+ if (mz[order[i]] > mz[order[i + 1]])
+ {
+ j = order[i];
+ order[i] = order[i + 1];
+ order[i + 1] = j;
+ sorted = 0;
+ }
+ }
+ }
+ while (!sorted);
+
+ evas_object_raise(c->side[order[0]].o);
+ for (i = 1; i < 6; i++)
+ evas_object_stack_below(c->side[order[i]].o, c->side[order[i - 1]].o);
+ evas_map_free(m);
+}
+
+static void
+_cube_update(Evas_Object *win, Cube *c)
+{
+ Evas_Coord w, h;
+
+ evas_object_geometry_get(win, NULL, NULL, &w, &h);
+ _cube_pos(c,
+ (w / 2), (h / 2), 512,
+ rotx, roty, rotz,
+ (w / 2) + cxo, (h / 2) + cyo, z0v, focv);
+}
+
+void
+_ch_rot_x(void *data, Evas_Object *obj, void *event_info EINA_UNUSED)
+{
+ Evas_Object *win = data;
+ rotx = elm_slider_value_get(obj);
+ _cube_update(win, cube);
+}
+
+void
+_ch_rot_y(void *data, Evas_Object *obj, void *event_info EINA_UNUSED)
+{
+ Evas_Object *win = data;
+ roty = elm_slider_value_get(obj);
+ _cube_update(win, cube);
+}
+
+void
+_ch_rot_z(void *data, Evas_Object *obj, void *event_info EINA_UNUSED)
+{
+ Evas_Object *win = data;
+ rotz = elm_slider_value_get(obj);
+ _cube_update(win, cube);
+}
+
+void
+_ch_cx(void *data, Evas_Object *obj, void *event_info EINA_UNUSED)
+{
+ Evas_Object *win = data;
+ cxo = elm_slider_value_get(obj);
+ _cube_update(win, cube);
+}
+
+void
+_ch_cy(void *data, Evas_Object *obj, void *event_info EINA_UNUSED)
+{
+ Evas_Object *win = data;
+ cyo = elm_slider_value_get(obj);
+ _cube_update(win, cube);
+}
+
+void
+_ch_foc(void *data, Evas_Object *obj, void *event_info EINA_UNUSED)
+{
+ Evas_Object *win = data;
+ focv = elm_slider_value_get(obj);
+ _cube_update(win, cube);
+}
+
+void
+_ch_z0(void *data, Evas_Object *obj, void *event_info EINA_UNUSED)
+{
+ Evas_Object *win = data;
+ z0v = elm_slider_value_get(obj);
+ _cube_update(win, cube);
+}
+
+void
+test_3d(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
+{
+ Evas_Object *win, *bx, *sl;
+
+ win = elm_win_util_standard_add("evas-map-3d", "Evas Map 3D");
+ elm_win_autodel_set(win, EINA_TRUE);
+
+ cube = _cube_new(evas_object_evas_get(win), 240, 240, 240);
+
+ bx = elm_box_add(win);
+ evas_object_layer_set(bx, 10);
+ evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ elm_win_resize_object_add(win, bx);
+ evas_object_show(bx);
+
+ sl = elm_slider_add(win);
+ elm_object_text_set(sl, "Rot X");
+ elm_slider_unit_format_set(sl, "%1.0f units");
+ elm_slider_indicator_format_set(sl, "%1.0f units");
+ elm_slider_span_size_set(sl, 360);
+ elm_slider_min_max_set(sl, 0, 360);
+ evas_object_size_hint_align_set(sl, EVAS_HINT_FILL, 0.5);
+ evas_object_size_hint_weight_set(sl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ elm_box_pack_end(bx, sl);
+ evas_object_smart_callback_add(sl, "changed", _ch_rot_x, win);
+ evas_object_show(sl);
+
+ sl = elm_slider_add(win);
+ elm_object_text_set(sl, "Rot Y");
+ elm_slider_unit_format_set(sl, "%1.0f units");
+ elm_slider_indicator_format_set(sl, "%1.0f units");
+ elm_slider_span_size_set(sl, 360);
+ elm_slider_min_max_set(sl, 0, 360);
+ evas_object_size_hint_align_set(sl, EVAS_HINT_FILL, 0.5);
+ evas_object_size_hint_weight_set(sl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ elm_box_pack_end(bx, sl);
+ evas_object_smart_callback_add(sl, "changed", _ch_rot_y, win);
+ evas_object_show(sl);
+
+ sl = elm_slider_add(win);
+ elm_object_text_set(sl, "Rot Z");
+ elm_slider_unit_format_set(sl, "%1.0f units");
+ elm_slider_indicator_format_set(sl, "%1.0f units");
+ elm_slider_span_size_set(sl, 360);
+ elm_slider_min_max_set(sl, 0, 360);
+ evas_object_size_hint_align_set(sl, EVAS_HINT_FILL, 0.5);
+ evas_object_size_hint_weight_set(sl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ elm_box_pack_end(bx, sl);
+ evas_object_smart_callback_add(sl, "changed", _ch_rot_z, win);
+ evas_object_show(sl);
+
+ sl = elm_slider_add(win);
+ elm_object_text_set(sl, "PX Off");
+ elm_slider_unit_format_set(sl, "%1.0f units");
+ elm_slider_indicator_format_set(sl, "%1.0f units");
+ elm_slider_span_size_set(sl, 360);
+ elm_slider_min_max_set(sl, -320, 320);
+ elm_slider_value_set(sl, cxo);
+ evas_object_size_hint_align_set(sl, EVAS_HINT_FILL, 0.5);
+ evas_object_size_hint_weight_set(sl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ elm_box_pack_end(bx, sl);
+ evas_object_smart_callback_add(sl, "changed", _ch_cx, win);
+ evas_object_show(sl);
+
+ sl = elm_slider_add(win);
+ elm_object_text_set(sl, "PY Off");
+ elm_slider_unit_format_set(sl, "%1.0f units");
+ elm_slider_indicator_format_set(sl, "%1.0f units");
+ elm_slider_span_size_set(sl, 360);
+ elm_slider_min_max_set(sl, -320, 320);
+ elm_slider_value_set(sl, cyo);
+ evas_object_size_hint_align_set(sl, EVAS_HINT_FILL, 0.5);
+ evas_object_size_hint_weight_set(sl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ elm_box_pack_end(bx, sl);
+ evas_object_smart_callback_add(sl, "changed", _ch_cy, win);
+ evas_object_show(sl);
+
+ sl = elm_slider_add(win);
+ elm_object_text_set(sl, "Foc");
+ elm_slider_unit_format_set(sl, "%1.0f units");
+ elm_slider_indicator_format_set(sl, "%1.0f units");
+ elm_slider_span_size_set(sl, 360);
+ elm_slider_min_max_set(sl, 1, 2000);
+ elm_slider_value_set(sl, focv);
+ evas_object_size_hint_align_set(sl, EVAS_HINT_FILL, 0.5);
+ evas_object_size_hint_weight_set(sl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ elm_box_pack_end(bx, sl);
+ evas_object_smart_callback_add(sl, "changed", _ch_foc, win);
+ evas_object_show(sl);
+
+ sl = elm_slider_add(win);
+ elm_object_text_set(sl, "Z0");
+ elm_slider_unit_format_set(sl, "%1.0f units");
+ elm_slider_indicator_format_set(sl, "%1.0f units");
+ elm_slider_span_size_set(sl, 360);
+ elm_slider_min_max_set(sl, -2000, 2000);
+ elm_slider_value_set(sl, z0v);
+ evas_object_size_hint_align_set(sl, EVAS_HINT_FILL, 0.5);
+ evas_object_size_hint_weight_set(sl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ elm_box_pack_end(bx, sl);
+ evas_object_smart_callback_add(sl, "changed", _ch_z0, win);
+ evas_object_show(sl);
+
+ evas_object_resize(win, 480, 480);
+ _cube_update(win, cube);
+ evas_object_show(win);
+}
diff --git a/src/bin/elementary/test_access.c b/src/bin/elementary/test_access.c
new file mode 100644
index 0000000000..80b8ea36e6
--- /dev/null
+++ b/src/bin/elementary/test_access.c
@@ -0,0 +1,398 @@
+#ifdef HAVE_CONFIG_H
+# include "elementary_config.h"
+#endif
+#include <Elementary.h>
+
+static void
+_cleanup_cb(void *data EINA_UNUSED, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
+{
+ elm_config_access_set(EINA_FALSE);
+}
+
+typedef struct _Item_Data
+{
+ Elm_Object_Item *item;
+ int index;
+} Item_Data;
+
+static Elm_Genlist_Item_Class *itc1, *itc2;
+char *gl_access_text_get(void *data, Evas_Object *obj EINA_UNUSED, const char *part EINA_UNUSED)
+{
+ char buf[256];
+ Item_Data *id = data;
+ snprintf(buf, sizeof(buf), "Item # %d", id->index);
+ return strdup(buf);
+}
+
+Evas_Object *gl_access_content_get(void *data EINA_UNUSED, Evas_Object *obj, const char *part)
+{
+ char buf[PATH_MAX];
+ Evas_Object *bt;
+
+ if (!strcmp(part, "elm.swallow.end"))
+ {
+ bt = elm_button_add(obj);
+ evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ elm_layout_text_set(bt, NULL, "OK");
+ }
+ else
+ {
+ bt = elm_icon_add(obj);
+ snprintf(buf, sizeof(buf), "%s/images/logo_small.png", elm_app_data_dir_get());
+ elm_image_file_set(bt, buf, NULL);
+ evas_object_size_hint_aspect_set(bt, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
+ }
+
+ return bt;
+}
+
+static void
+gl_del(void *data, Evas_Object *obj EINA_UNUSED)
+{
+ free(data);
+}
+
+static Elm_Gengrid_Item_Class *gic;
+
+Evas_Object *
+grid_access_content_get(void *data, Evas_Object *obj, const char *part)
+{
+ char buf[PATH_MAX];
+ Evas_Object *ic;
+ const Item_Data *id = data;
+
+ if (!strcmp(part, "elm.swallow.icon"))
+ {
+ ic = elm_icon_add(obj);
+ elm_object_scale_set(ic, 0.5);
+ snprintf(buf, sizeof(buf), "%s/images/icon_%02i.png", elm_app_data_dir_get(), (id->index % 4));
+ elm_image_file_set(ic, buf, NULL);
+ elm_image_resizable_set(ic, EINA_FALSE, EINA_FALSE);
+ evas_object_size_hint_weight_set(ic, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(ic, 0.5, 0.5);
+ evas_object_show(ic);
+ return ic;
+ }
+ return NULL;
+}
+
+Evas_Object *gl_access_content_full_get(void *data EINA_UNUSED, Evas_Object *obj, const char *part)
+{
+ int i;
+ Evas_Object *grid;
+
+ if (strcmp(part, "elm.swallow.content")) return NULL;
+
+ grid = elm_gengrid_add(obj);
+ elm_gengrid_item_size_set(grid, ELM_SCALE_SIZE(100), ELM_SCALE_SIZE(100));
+ elm_gengrid_horizontal_set(grid, EINA_FALSE);
+ elm_gengrid_reorder_mode_set(grid, EINA_TRUE);
+ evas_object_size_hint_weight_set(grid, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(grid, EVAS_HINT_FILL, EVAS_HINT_FILL);
+
+ gic = elm_gengrid_item_class_new();
+ gic->item_style = "default";
+ gic->func.text_get = NULL;
+ gic->func.content_get = grid_access_content_get;
+ gic->func.state_get = NULL;
+ gic->func.del = gl_del;
+
+ for (i = 0; i < 4; i++)
+ {
+ Item_Data *id = calloc(1, sizeof(Item_Data));
+ id->index = i;
+
+ elm_gengrid_item_append(grid, gic, id, NULL, NULL);
+ }
+ elm_gengrid_item_class_free(gic);
+
+ evas_object_size_hint_min_set(grid,
+ ELM_SCALE_SIZE(300), ELM_SCALE_SIZE(150));
+ return grid;
+}
+
+static void _realized(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *ei)
+{
+ Evas_Object *content, *bt;
+ Eina_List *items;
+ items = NULL;
+
+ if (!ei) return;
+ Elm_Object_Item *item = ei;
+
+ const Elm_Genlist_Item_Class *itc = elm_genlist_item_item_class_get(item);
+
+ if (!strcmp(itc->item_style, "full"))
+ {
+ /* unregister item itself */
+ elm_object_item_access_unregister(item);
+
+ /* convey highlight to its content */
+ content = elm_object_item_part_content_get(item, "elm.swallow.content");
+ if (!content) return;
+
+ items = eina_list_append(items, content);
+ }
+ else
+ {
+ bt = elm_object_item_part_content_get(item, "elm.swallow.end");
+ if (!bt) return;
+
+ items = eina_list_append(items, bt);
+ }
+
+ elm_object_item_access_order_set(item, items);
+}
+
+void
+test_access(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
+{
+ int i;
+ Evas_Object *win, *bx, *gl;
+
+ win = elm_win_util_standard_add("access", "Access");
+ elm_win_autodel_set(win, EINA_TRUE);
+ evas_object_event_callback_add(win, EVAS_CALLBACK_FREE, _cleanup_cb, NULL);
+
+ elm_config_access_set(EINA_TRUE);
+
+ bx = elm_box_add(win);
+ evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ elm_box_homogeneous_set(bx, EINA_TRUE);
+ elm_box_horizontal_set(bx, EINA_TRUE);
+ elm_win_resize_object_add(win, bx);
+ evas_object_show(bx);
+
+ gl = elm_genlist_add(win);
+ evas_object_size_hint_weight_set(gl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(gl, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ elm_box_pack_end(bx, gl);
+ evas_object_show(gl);
+
+ evas_object_smart_callback_add(gl, "realized", _realized, NULL);
+
+ itc1 = elm_genlist_item_class_new();
+ itc1->item_style = "default";
+ itc1->func.text_get = gl_access_text_get;
+ itc1->func.content_get = gl_access_content_get;
+ itc1->func.state_get = NULL;
+ itc1->func.del = gl_del;
+
+ itc2 = elm_genlist_item_class_new();
+ itc2->item_style = "full";
+ itc2->func.text_get = NULL;
+ itc2->func.content_get = gl_access_content_full_get;
+ itc2->func.state_get = NULL;
+ itc2->func.del = gl_del;
+
+ for (i = 1; i < 10; i++)
+ {
+ Item_Data *id = calloc(1, sizeof(Item_Data));
+ id->index = i;
+
+ if (i % 4)
+ {
+ elm_genlist_item_append(
+ gl,
+ itc1,
+ id,
+ NULL/* parent */,
+ ELM_GENLIST_ITEM_NONE,
+ NULL/* func */,
+ NULL/* func data */
+ );
+ }
+ else
+ {
+ elm_genlist_item_append(
+ gl,
+ itc2,
+ id,
+ NULL/* parent */,
+ ELM_GENLIST_ITEM_NONE,
+ NULL/* func */,
+ NULL/* func data */
+ );
+ }
+ }
+
+ elm_genlist_item_class_free(itc1);
+ elm_genlist_item_class_free(itc2);
+ evas_object_resize(win, 500, 400);
+ evas_object_show(win);
+}
+
+void
+test_access2(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
+{
+ int i, j, k;
+ char buf[PATH_MAX];
+ Evas_Object *win, *bx, *sc, *ly, *ly2, *ic;
+ Evas_Object *ao, *to;
+
+ win = elm_win_util_standard_add("access", "Access");
+ elm_win_autodel_set(win, EINA_TRUE);
+ evas_object_event_callback_add(win, EVAS_CALLBACK_FREE, _cleanup_cb, NULL);
+
+ elm_config_access_set(EINA_TRUE);
+
+ sc = elm_scroller_add(win);
+ elm_scroller_bounce_set(sc, EINA_TRUE, EINA_FALSE);
+ elm_scroller_policy_set(sc, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_OFF);
+ evas_object_size_hint_weight_set(sc, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ elm_win_resize_object_add(win, sc);
+ evas_object_show(sc);
+
+ bx = elm_box_add(win);
+ evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(bx, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ elm_box_homogeneous_set(bx, EINA_TRUE);
+ elm_box_horizontal_set(bx, EINA_TRUE);
+ elm_object_content_set(sc, bx);
+ evas_object_show(bx);
+
+ for (k = 0 ; k < 3; k++)
+ {
+ ly = elm_layout_add(win);
+ snprintf(buf, sizeof(buf), "%s/objects/test.edj", elm_app_data_dir_get());
+ elm_layout_file_set(ly, buf, "access_page");
+ evas_object_size_hint_weight_set(ly, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(ly, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ evas_object_show(ly);
+
+ for (j = 0; j < 3; j++)
+ {
+ for (i = 0; i < 3; i++)
+ {
+ ly2 = elm_layout_add(win);
+ snprintf(buf, sizeof(buf), "%s/objects/test.edj", elm_app_data_dir_get());
+ elm_layout_file_set(ly2, buf, "access_icon");
+ evas_object_size_hint_weight_set(ly2, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(ly2, EVAS_HINT_FILL, EVAS_HINT_FILL);
+
+ ic = elm_icon_add(win);
+ elm_object_scale_set(ic, 0.5);
+ snprintf(buf, sizeof(buf), "%s/images/icon_%02i.png", elm_app_data_dir_get(), (i + (k * 3)));
+ elm_image_file_set(ic, buf, NULL);
+ elm_image_resizable_set(ic, EINA_FALSE, EINA_FALSE);
+ evas_object_size_hint_weight_set(ic, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(ic, 0.5, 0.5);
+ elm_object_part_content_set(ly2, "slot", ic);
+ evas_object_show(ic);
+
+ snprintf(buf, sizeof(buf), "slot.%i.%i", i, j);
+ elm_object_part_content_set(ly, buf, ly2);
+ evas_object_show(ly2);
+
+ /* access */
+ to = (Evas_Object *)edje_object_part_object_get(elm_layout_edje_get(ly2), "access");
+ ao = elm_access_object_register(to, ly2);
+ elm_object_focus_custom_chain_append(ly2, ao, NULL);
+ }
+ }
+
+ elm_box_pack_end(bx, ly);
+ }
+
+ evas_object_resize(win, 300, 300);
+ evas_object_show(win);
+}
+
+static Eina_Bool
+_key_down_cb(void *data, int type EINA_UNUSED, void *ei)
+{
+ Elm_Access_Action_Info *a;
+ Ecore_Event_Key *ev = ei;
+
+ a = calloc(1, sizeof(Elm_Access_Action_Info));
+ if (!a) return ECORE_CALLBACK_PASS_ON;
+
+ if (ev && ev->key)
+ {
+ if (!strcmp(ev->key, "F1"))
+ {
+ a->highlight_cycle = EINA_TRUE;
+ elm_access_action(data, ELM_ACCESS_ACTION_HIGHLIGHT_NEXT, a);
+ }
+ }
+ free(a);
+
+ return ECORE_CALLBACK_PASS_ON;
+}
+
+static char *
+_access_info_cb(void *data, Evas_Object *obj EINA_UNUSED)
+{
+ if (data) return strdup(data);
+ return NULL;
+}
+
+void
+test_access3(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
+{
+ char buf[PATH_MAX];
+ Evas_Object *win, *box, *lbl, *ly, *btn;
+ Evas_Object *red_ao, *green_ao, *blue_ao, *black_ao, *to;
+
+ win = elm_win_util_standard_add("access", "Access");
+ elm_win_autodel_set(win, EINA_TRUE);
+ evas_object_event_callback_add(win, EVAS_CALLBACK_FREE, _cleanup_cb, NULL);
+
+ elm_config_access_set(EINA_TRUE);
+
+ box = elm_box_add(win);
+ evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ elm_win_resize_object_add(win, box);
+ evas_object_show(box);
+
+ lbl = elm_label_add(box);
+ elm_object_text_set(lbl,
+ "Move a mouse pointer to any object and press F1 to "
+ "move access highlight to the next object.");
+ evas_object_size_hint_weight_set(lbl, EVAS_HINT_EXPAND, 0.0);
+ evas_object_size_hint_align_set(lbl, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ elm_box_pack_end(box, lbl);
+ evas_object_show(lbl);
+
+ ly = elm_layout_add(box);
+ snprintf(buf, sizeof(buf), "%s/objects/test.edj", elm_app_data_dir_get());
+ elm_layout_file_set(ly, buf, "access_color_page");
+ evas_object_size_hint_weight_set(ly, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(ly, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ elm_box_pack_end(box, ly);
+ evas_object_show(ly);
+
+ btn = elm_button_add(win);
+ elm_object_text_set(btn, "action");
+ evas_object_size_hint_weight_set(btn, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(btn, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ evas_object_show(btn);
+
+ elm_object_part_content_set(ly, "center", btn);
+
+ to = (Evas_Object *)edje_object_part_object_get(elm_layout_edje_get(ly), "red");
+ red_ao = elm_access_object_register(to, ly);
+ elm_access_info_cb_set(red_ao, ELM_ACCESS_INFO, _access_info_cb, "red");
+ elm_access_highlight_next_set(btn, ELM_HIGHLIGHT_DIR_NEXT, red_ao);
+
+ to = (Evas_Object *)edje_object_part_object_get(elm_layout_edje_get(ly), "green");
+ green_ao = elm_access_object_register(to, ly);
+ elm_access_info_cb_set(green_ao, ELM_ACCESS_INFO, _access_info_cb, "green");
+ elm_access_highlight_next_set(red_ao, ELM_HIGHLIGHT_DIR_NEXT, green_ao);
+
+ to = (Evas_Object *)edje_object_part_object_get(elm_layout_edje_get(ly), "blue");
+ blue_ao = elm_access_object_register(to, ly);
+ elm_access_info_cb_set(blue_ao, ELM_ACCESS_INFO, _access_info_cb, "blue");
+ elm_access_highlight_next_set(green_ao, ELM_HIGHLIGHT_DIR_NEXT, blue_ao);
+
+ to = (Evas_Object *)edje_object_part_object_get(elm_layout_edje_get(ly), "black");
+ black_ao = elm_access_object_register(to, ly);
+ elm_access_info_cb_set(black_ao, ELM_ACCESS_INFO, _access_info_cb, "black");
+ elm_access_highlight_next_set(blue_ao, ELM_HIGHLIGHT_DIR_NEXT, black_ao);
+
+ ecore_event_handler_add(ECORE_EVENT_KEY_DOWN, _key_down_cb, win);
+
+ evas_object_resize(win, 300, 300);
+ evas_object_show(win);
+}
diff --git a/src/bin/elementary/test_actionslider.c b/src/bin/elementary/test_actionslider.c
new file mode 100644
index 0000000000..62b99e67bd
--- /dev/null
+++ b/src/bin/elementary/test_actionslider.c
@@ -0,0 +1,209 @@
+#ifdef HAVE_CONFIG_H
+# include "elementary_config.h"
+#endif
+#include <Elementary.h>
+
+static void _pos_selected_cb(void *data EINA_UNUSED, Evas_Object *obj, void *event_info)
+{
+ Elm_Actionslider_Pos ipos, mpos, epos;
+
+ printf("Selection: %s\n", (char *)event_info);
+ printf("Label selected: %s\n", elm_actionslider_selected_label_get(obj));
+
+ ipos = elm_actionslider_indicator_pos_get(obj);
+
+ switch (ipos)
+ {
+ case ELM_ACTIONSLIDER_NONE:
+ printf("actionslider indicator pos: none!\n");
+ break;
+ case ELM_ACTIONSLIDER_LEFT:
+ printf("actionslider indicator pos: left!\n");
+ break;
+ case ELM_ACTIONSLIDER_CENTER:
+ printf("actionslider indicator pos: center!\n");
+ break;
+ case ELM_ACTIONSLIDER_RIGHT:
+ printf("actionslider indicator pos: right!\n");
+ break;
+ case ELM_ACTIONSLIDER_ALL:
+ printf("actionslider indicator pos: all!\n");
+ break;
+ }
+
+ mpos = elm_actionslider_magnet_pos_get(obj);
+
+ switch (mpos)
+ {
+ case ELM_ACTIONSLIDER_NONE:
+ printf("actionslider magnet pos: none!\n");
+ break;
+ case ELM_ACTIONSLIDER_LEFT:
+ printf("actionslider magnet pos: left!\n");
+ break;
+ case ELM_ACTIONSLIDER_CENTER:
+ printf("actionslider magnet pos: center!\n");
+ break;
+ case ELM_ACTIONSLIDER_RIGHT:
+ printf("actionslider magnet pos: right!\n");
+ break;
+ case ELM_ACTIONSLIDER_ALL:
+ printf("actionslider magnet pos: all!\n");
+ break;
+ }
+
+ epos = elm_actionslider_enabled_pos_get(obj);
+
+ if (epos)
+ {
+ printf("actionslider enabled pos: ");
+ if (epos & ELM_ACTIONSLIDER_LEFT)
+ printf("left ");
+ if (epos & ELM_ACTIONSLIDER_CENTER)
+ printf("center ");
+ if (epos & ELM_ACTIONSLIDER_RIGHT)
+ printf("right ");
+ printf("\n");
+ }
+}
+
+static void
+_position_change_magnetic_cb(void *data EINA_UNUSED, Evas_Object * obj, void *event_info)
+{
+ if (!strcmp((char *)event_info, "left"))
+ elm_actionslider_magnet_pos_set(obj, ELM_ACTIONSLIDER_LEFT);
+ else if (!strcmp((char *)event_info, "right"))
+ elm_actionslider_magnet_pos_set(obj, ELM_ACTIONSLIDER_RIGHT);
+}
+
+static void
+_magnet_enable_disable_cb(void *data EINA_UNUSED, Evas_Object *obj, void *event_info)
+{
+ if (!strcmp((char *)event_info, "left"))
+ elm_actionslider_magnet_pos_set(obj, ELM_ACTIONSLIDER_CENTER);
+ else if (!strcmp((char *)event_info, "right"))
+ elm_actionslider_magnet_pos_set(obj, ELM_ACTIONSLIDER_NONE);
+}
+
+void
+test_actionslider(void *data EINA_UNUSED, Evas_Object * obj EINA_UNUSED, void *event_info EINA_UNUSED)
+{
+ Evas_Object *win, *bx, *as;
+
+ win = elm_win_util_standard_add("actionslider", "Actionslider");
+ elm_win_autodel_set(win, EINA_TRUE);
+
+ bx = elm_box_add(win);
+ evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, 0);
+ elm_win_resize_object_add(win, bx);
+ evas_object_show(bx);
+
+ as = elm_actionslider_add(win);
+ evas_object_size_hint_weight_set(as, EVAS_HINT_EXPAND, 0);
+ evas_object_size_hint_align_set(as, EVAS_HINT_FILL, 0);
+ elm_actionslider_indicator_pos_set(as, ELM_ACTIONSLIDER_RIGHT);
+ elm_actionslider_magnet_pos_set(as, ELM_ACTIONSLIDER_RIGHT);
+ elm_object_part_text_set(as, "left", "Snooze");
+ elm_object_part_text_set(as, "center", NULL);
+ elm_object_part_text_set(as, "right", "Stop");
+ elm_actionslider_enabled_pos_set(as, ELM_ACTIONSLIDER_LEFT |
+ ELM_ACTIONSLIDER_RIGHT);
+ evas_object_smart_callback_add(as, "pos_changed",
+ _position_change_magnetic_cb, NULL);
+ evas_object_smart_callback_add(as, "selected", _pos_selected_cb, NULL);
+ evas_object_show(as);
+ elm_box_pack_end(bx, as);
+
+ as = elm_actionslider_add(win);
+ evas_object_size_hint_weight_set(as, EVAS_HINT_EXPAND, 0);
+ evas_object_size_hint_align_set(as, EVAS_HINT_FILL, 0);
+ elm_actionslider_indicator_pos_set(as, ELM_ACTIONSLIDER_CENTER);
+ elm_actionslider_magnet_pos_set(as, ELM_ACTIONSLIDER_CENTER);
+ elm_object_part_text_set(as, "left", "Snooze");
+ elm_object_part_text_set(as, "center", NULL);
+ elm_object_part_text_set(as, "right", "Stop");
+ elm_actionslider_enabled_pos_set(as, ELM_ACTIONSLIDER_LEFT |
+ ELM_ACTIONSLIDER_RIGHT);
+ evas_object_smart_callback_add(as, "selected", _pos_selected_cb, NULL);
+ evas_object_show(as);
+ elm_box_pack_end(bx, as);
+
+ as = elm_actionslider_add(win);
+ elm_object_style_set(as, "bar");
+ evas_object_size_hint_weight_set(as, EVAS_HINT_EXPAND, 0);
+ evas_object_size_hint_align_set(as, EVAS_HINT_FILL, 0);
+ elm_actionslider_indicator_pos_set(as, ELM_ACTIONSLIDER_LEFT);
+ elm_actionslider_magnet_pos_set(as, ELM_ACTIONSLIDER_CENTER|
+ ELM_ACTIONSLIDER_RIGHT);
+ elm_actionslider_enabled_pos_set(as, ELM_ACTIONSLIDER_CENTER |
+ ELM_ACTIONSLIDER_RIGHT);
+ elm_object_part_text_set(as, "left", NULL);
+ elm_object_part_text_set(as, "center", "Accept");
+ elm_object_part_text_set(as, "right", "Reject");
+ evas_object_smart_callback_add(as, "selected", _pos_selected_cb, NULL);
+ evas_object_show(as);
+ elm_box_pack_end(bx, as);
+
+ as = elm_actionslider_add(win);
+ elm_object_style_set(as, "bar");
+ evas_object_size_hint_weight_set(as, EVAS_HINT_EXPAND, 0);
+ evas_object_size_hint_align_set(as, EVAS_HINT_FILL, 0);
+ elm_actionslider_indicator_pos_set(as, ELM_ACTIONSLIDER_LEFT);
+ elm_actionslider_magnet_pos_set(as, ELM_ACTIONSLIDER_LEFT);
+ elm_object_part_text_set(as, "left", NULL);
+ elm_object_part_text_set(as, "center", "Accept");
+ elm_object_part_text_set(as, "right", "Reject");
+ elm_object_text_set(as, "Go");
+ evas_object_smart_callback_add(as, "pos_changed",
+ _position_change_magnetic_cb, NULL);
+ evas_object_smart_callback_add(as, "selected", _pos_selected_cb, NULL);
+ evas_object_show(as);
+ elm_box_pack_end(bx, as);
+
+ as = elm_actionslider_add(win);
+ elm_object_style_set(as, "bar");
+ elm_object_disabled_set(as, EINA_TRUE);
+ evas_object_size_hint_weight_set(as, EVAS_HINT_EXPAND, 0);
+ evas_object_size_hint_align_set(as, EVAS_HINT_FILL, 0);
+ elm_actionslider_indicator_pos_set(as, ELM_ACTIONSLIDER_LEFT);
+ elm_actionslider_magnet_pos_set(as, ELM_ACTIONSLIDER_LEFT);
+ elm_object_part_text_set(as, "left", NULL);
+ elm_object_part_text_set(as, "center", "Accept");
+ elm_object_part_text_set(as, "right", "Reject");
+ elm_object_text_set(as, "Go");
+ evas_object_smart_callback_add(as, "pos_changed",
+ _position_change_magnetic_cb, NULL);
+ evas_object_smart_callback_add(as, "selected", _pos_selected_cb, NULL);
+ evas_object_show(as);
+ elm_box_pack_end(bx, as);
+
+ as = elm_actionslider_add(win);
+ evas_object_size_hint_weight_set(as, EVAS_HINT_EXPAND, 0);
+ evas_object_size_hint_align_set(as, EVAS_HINT_FILL, 0);
+ elm_actionslider_indicator_pos_set(as, ELM_ACTIONSLIDER_LEFT);
+ elm_actionslider_magnet_pos_set(as, ELM_ACTIONSLIDER_ALL);
+ elm_object_part_text_set(as, "left", "Left");
+ elm_object_part_text_set(as, "center", "Center");
+ elm_object_part_text_set(as, "right", "Right");
+ elm_object_text_set(as, "Go");
+ evas_object_smart_callback_add(as, "selected", _pos_selected_cb, NULL);
+ evas_object_show(as);
+ elm_box_pack_end(bx, as);
+
+ as = elm_actionslider_add(win);
+ evas_object_size_hint_weight_set(as, EVAS_HINT_EXPAND, 0);
+ evas_object_size_hint_align_set(as, EVAS_HINT_FILL, 0);
+ elm_actionslider_indicator_pos_set(as, ELM_ACTIONSLIDER_CENTER);
+ elm_actionslider_magnet_pos_set(as, ELM_ACTIONSLIDER_CENTER);
+ elm_object_part_text_set(as, "left", "Enable");
+ elm_object_part_text_set(as, "center", "Magnet");
+ elm_object_part_text_set(as, "right", "Disable");
+ evas_object_smart_callback_add(as, "pos_changed",
+ _magnet_enable_disable_cb, NULL);
+ evas_object_smart_callback_add(as, "selected", _pos_selected_cb, NULL);
+ evas_object_show(as);
+ elm_box_pack_end(bx, as);
+
+ evas_object_resize(win, 320, 400);
+ evas_object_show(win);
+}
diff --git a/src/bin/elementary/test_anim.c b/src/bin/elementary/test_anim.c
new file mode 100644
index 0000000000..24125bcffa
--- /dev/null
+++ b/src/bin/elementary/test_anim.c
@@ -0,0 +1,97 @@
+#ifdef HAVE_CONFIG_H
+# include "elementary_config.h"
+#endif
+#include <Elementary.h>
+
+static const char *names[] =
+{
+ "bub1", "sh1",
+ "bub2", "sh2",
+ "bub3", "sh3",
+};
+
+static Eina_Bool
+_anim_tick(void *data EINA_UNUSED, const Eo_Event *event)
+{
+ Evas_Object *bub, *sh;
+ Evas_Coord x, y, w, h, vw, vh;
+ double t, xx, yy, zz, r, fac;
+ double lx, ly;
+ unsigned int i;
+
+ evas_output_viewport_get(evas_object_evas_get(event->obj), 0, 0, &vw, &vh);
+ r = 48;
+ t = ecore_loop_time_get();
+ fac = 2.0 / (double)((sizeof(names) / sizeof(char *) / 2));
+ evas_pointer_canvas_xy_get(evas_object_evas_get(event->obj), &x, &y);
+ lx = x;
+ ly = y;
+
+ for (i = 0; i < (sizeof(names) / sizeof(char *) / 2); i++)
+ {
+ bub = evas_object_data_get(event->obj, names[i * 2]);
+ sh = evas_object_data_get(event->obj, names[(i * 2) + 1]);
+ zz = (((2 + sin(t * 6 + (M_PI * (i * fac)))) / 3) * 64) * 2;
+ xx = (cos(t * 4 + (M_PI * (i * fac))) * r) * 2;
+ yy = (sin(t * 6 + (M_PI * (i * fac))) * r) * 2;
+
+ w = zz;
+ h = zz;
+ x = (vw / 2) + xx - (w / 2);
+ y = (vh / 2) + yy - (h / 2);
+
+ evas_object_move(bub, x, y);
+ evas_object_resize(bub, w, h);
+
+ x = x - ((lx - (x + (w / 2))) / 4);
+ y = y - ((ly - (y + (h / 2))) / 4);
+
+ evas_object_move(sh, x, y);
+ evas_object_resize(sh, w, h);
+ }
+ return ECORE_CALLBACK_RENEW;
+}
+
+void
+test_anim(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
+{
+ Evas_Object *win, *bg, *bub, *sh;
+ char buf[PATH_MAX];
+ unsigned int i;
+
+ win = elm_win_add(NULL, "animation", ELM_WIN_BASIC);
+ elm_win_title_set(win, "Animation");
+ elm_win_autodel_set(win, EINA_TRUE);
+
+ bg = elm_bg_add(win);
+ snprintf(buf, sizeof(buf), "%s/images/rock_01.jpg", elm_app_data_dir_get());
+ elm_bg_file_set(bg, buf, NULL);
+ evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ elm_win_resize_object_add(win, bg);
+ evas_object_show(bg);
+
+ snprintf(buf, sizeof(buf), "%s/images/bubble_sh.png", elm_app_data_dir_get());
+ for (i = 0; i < (sizeof(names) / sizeof(char *) / 2); i++)
+ {
+ sh = evas_object_image_filled_add(evas_object_evas_get(win));
+ evas_object_image_file_set(sh, buf, NULL);
+ evas_object_resize(sh, 64, 64);
+ evas_object_show(sh);
+ evas_object_data_set(win, names[(i * 2) + 1], sh);
+ }
+
+ snprintf(buf, sizeof(buf), "%s/images/bubble.png", elm_app_data_dir_get());
+ for (i = 0; i < (sizeof(names) / sizeof(char *) / 2); i++)
+ {
+ bub = evas_object_image_filled_add(evas_object_evas_get(win));
+ evas_object_image_file_set(bub, buf, NULL);
+ evas_object_resize(bub, 64, 64);
+ evas_object_show(bub);
+ evas_object_data_set(win, names[(i * 2)], bub);
+ }
+
+ evas_object_resize(win, 480, 800);
+ evas_object_show(win);
+
+ eo_event_callback_add(win, EFL_ANIMATOR_EVENT_ANIMATOR_TICK, _anim_tick, NULL);
+}
diff --git a/src/bin/elementary/test_application_server.c b/src/bin/elementary/test_application_server.c
new file mode 100644
index 0000000000..d05d74e3ea
--- /dev/null
+++ b/src/bin/elementary/test_application_server.c
@@ -0,0 +1,206 @@
+#ifdef HAVE_CONFIG_H
+# include "elementary_config.h"
+#endif
+#include <Elementary.h>
+
+typedef struct {
+ Evas_Object *win, *label;
+ Eina_Stringshare *view_name;
+} App_View_Context;
+
+static Elm_App_Server *phone_server = NULL, *msg_server = NULL;
+
+static void _text_update(App_View_Context *ctx, const char *state)
+{
+ char buffer[1024];
+
+ if (!ctx->label)
+ return;
+ snprintf(buffer, sizeof(buffer), "%s - state=%s", ctx->view_name, state);
+ elm_object_text_set(ctx->label, buffer);
+}
+
+static void
+_window_create(App_View_Context *ctx)
+{
+ ctx->win = elm_win_util_standard_add("app_view", ctx->view_name);
+
+ ctx->label = elm_label_add(ctx->win);
+ evas_object_size_hint_weight_set(ctx->label, EVAS_HINT_EXPAND,
+ EVAS_HINT_EXPAND);
+ evas_object_data_set(ctx->win, "label", ctx->label);
+
+ _text_update(ctx, "alive");
+
+ elm_win_resize_object_add(ctx->win, ctx->label);
+ evas_object_show(ctx->label);
+
+ evas_object_resize(ctx->win, 400, 300);
+ evas_object_show(ctx->win);
+}
+
+static Eina_Bool
+_close_cb(void *data, const Eo_Event *event)
+{
+ App_View_Context *ctx = data;
+ if (ctx->win)
+ evas_object_del(ctx->win);
+ eo_del(event->obj);
+ return EINA_TRUE;
+}
+
+static Eina_Bool
+_pause_cb(void *data, const Eo_Event *event EINA_UNUSED)
+{
+ App_View_Context *ctx = data;
+ _text_update(ctx, "paused");
+ return EINA_TRUE;
+}
+
+static Eina_Bool
+_resume_cb(void *data, const Eo_Event *event)
+{
+ App_View_Context *ctx = data;
+
+ //shallow state
+ if (!ctx->win)
+ {
+ _window_create(ctx);
+ elm_app_server_view_window_set(event->obj, ctx->win);
+ }
+
+ _text_update(ctx, "alive");
+ return EINA_TRUE;
+}
+
+static Eina_Bool
+_view_del_cb(void *data, const Eo_Event *event)
+{
+ App_View_Context *ctx = data;
+
+ if (ctx->win)
+ evas_object_del(ctx->win);
+ elm_app_server_view_window_set(event->obj, NULL);
+ eina_stringshare_del(ctx->view_name);
+ free(ctx);
+ return EINA_TRUE;
+}
+
+static Elm_App_Server_View *
+_create_view_cb(Elm_App_Server *app_server, const Eina_Value *args EINA_UNUSED, Eina_Stringshare **error_name, Eina_Stringshare **error_message EINA_UNUSED)
+{
+ Elm_App_Server_View *view;
+ const char *id = NULL, *pkg = NULL;
+ App_View_Context *ctx;
+
+ ctx = calloc(1, sizeof(App_View_Context));
+ if (!ctx)
+ {
+ *error_name = eina_stringshare_add("No memory available");
+ return NULL;
+ }
+
+ view = eo_add(ELM_APP_SERVER_VIEW_CLASS, app_server, elm_app_server_view_id_set(eo_self, NULL));
+
+ id = elm_app_server_view_id_get(view);
+ pkg = elm_app_server_package_get(app_server);
+ ctx->view_name = eina_stringshare_printf("%s %s", pkg, id);
+
+ _window_create(ctx);
+
+ elm_app_server_view_title_set(view, ctx->view_name);
+ elm_app_server_view_new_events_set(view, 5);
+ elm_app_server_view_window_set(view, ctx->win);
+ elm_app_server_view_resume(view);
+ eo_event_callback_add(view, ELM_APP_SERVER_VIEW_EVENT_CLOSED, _close_cb, ctx);
+ eo_event_callback_add(view, ELM_APP_SERVER_VIEW_EVENT_PAUSED, _pause_cb, ctx);
+ eo_event_callback_add(view, ELM_APP_SERVER_VIEW_EVENT_RESUMED, _resume_cb, ctx);
+ eo_event_callback_add(view, EO_BASE_EVENT_DEL, _view_del_cb, ctx);
+
+ return view;
+}
+
+static Eina_Bool
+_terminate_cb(void *data EINA_UNUSED, const Eo_Event *event)
+{
+ const char *title = NULL;
+
+ printf("terminate cb\n");
+ elm_app_server_save(event->obj);
+ title = elm_app_server_title_get(event->obj);
+
+ printf("Closing: %s\n", title);
+ eo_unref(event->obj);
+ return EINA_TRUE;
+}
+
+Elm_App_Server *
+test_application_server_common(const char *pkg)
+{
+ Eina_Iterator *views_iter = NULL;
+ Elm_App_Server_View *view;
+ Elm_App_Server *server;
+
+ server = eo_add(ELM_APP_SERVER_CLASS, NULL, elm_app_server_constructor(eo_self, pkg, _create_view_cb));
+ elm_app_server_title_set(server, pkg);
+ views_iter = elm_app_server_views_get(server);
+ eo_event_callback_add(server, ELM_APP_SERVER_EVENT_TERMINATE, _terminate_cb, NULL);
+
+ //views create in shallow state
+ EINA_ITERATOR_FOREACH(views_iter, view)
+ {
+ App_View_Context *ctx;
+ const char *id = NULL;
+
+ ctx = calloc(1, sizeof(App_View_Context));
+
+ id = elm_app_server_view_id_get(view);
+ ctx->view_name = eina_stringshare_printf("%s %s", pkg, id);
+
+ eo_event_callback_add(view, ELM_APP_SERVER_VIEW_EVENT_CLOSED, _close_cb, ctx);
+ eo_event_callback_add(view, ELM_APP_SERVER_VIEW_EVENT_PAUSED, _pause_cb, ctx);
+ eo_event_callback_add(view, ELM_APP_SERVER_VIEW_EVENT_RESUMED, _resume_cb, ctx);
+ eo_event_callback_add(view, EO_BASE_EVENT_DEL, _view_del_cb, ctx);
+ }
+ eina_iterator_free(views_iter);
+
+ return server;
+}
+
+static Eina_Bool
+_server_del_cb(void *data, const Eo_Event *event EINA_UNUSED)
+{
+ Elm_App_Server **server = data;
+ *server = NULL;
+ return EINA_TRUE;
+}
+
+void
+test_application_server_phone(void *data EINA_UNUSED,
+ Evas_Object *obj EINA_UNUSED,
+ void *event_info EINA_UNUSED)
+{
+ if (phone_server)
+ {
+ printf("Phone already running\n");
+ return;
+ }
+ printf("Starting phone\n");
+ phone_server = test_application_server_common("org.enlightenment.phone");
+ eo_event_callback_add(phone_server, EO_BASE_EVENT_DEL, _server_del_cb, &phone_server);
+}
+
+void
+test_application_server_message(void *data EINA_UNUSED,
+ Evas_Object *obj EINA_UNUSED,
+ void *event_info EINA_UNUSED)
+{
+ if (msg_server)
+ {
+ printf("Message already running\n");
+ return;
+ }
+ printf("Starting message\n");
+ msg_server = test_application_server_common( "org.enlightenment.message");
+ eo_event_callback_add(msg_server, EO_BASE_EVENT_DEL, _server_del_cb, &msg_server);
+}
diff --git a/src/bin/elementary/test_bg.c b/src/bin/elementary/test_bg.c
new file mode 100644
index 0000000000..995ae12971
--- /dev/null
+++ b/src/bin/elementary/test_bg.c
@@ -0,0 +1,270 @@
+#ifdef HAVE_CONFIG_H
+# include "elementary_config.h"
+#endif
+#include <Elementary.h>
+
+static void
+_cb_size_radio_changed(void *data, Evas_Object *obj, void *event EINA_UNUSED)
+{
+ Evas_Object *o_bg = data;
+ int size;
+ size = elm_radio_value_get((Evas_Object *)obj);
+ elm_bg_load_size_set(o_bg, size, size);
+}
+
+static void
+_cb_radio_changed(void *data, Evas_Object *obj, void *event EINA_UNUSED)
+{
+ Evas_Object *o_bg = data;
+
+ elm_bg_option_set(o_bg, elm_radio_value_get((Evas_Object *)obj));
+}
+
+static void
+_cb_overlay_changed(void *data, Evas_Object *obj, void *event EINA_UNUSED)
+{
+ Evas_Object *o_bg = data;
+
+ if (elm_check_state_get(obj))
+ {
+ Evas_Object *parent, *over;
+ char buff[PATH_MAX];
+
+ snprintf(buff, sizeof(buff), "%s/objects/test.edj", elm_app_data_dir_get());
+ parent = elm_object_parent_widget_get(o_bg);
+ over = edje_object_add(evas_object_evas_get(parent));
+ edje_object_file_set(over, buff, "bg_overlay");
+ elm_object_part_content_set(o_bg, "overlay", over);
+ }
+ else
+ elm_object_part_content_set(o_bg, "overlay", NULL);
+}
+
+static void
+_cb_color_changed(void *data, Evas_Object *obj, void *event EINA_UNUSED)
+{
+ Evas_Object *o_bg = data;
+ double val = 0.0;
+
+ val = elm_spinner_value_get(obj);
+ if (val == 1.0)
+ elm_bg_color_set(o_bg, 255, 255, 255);
+ else if (val == 2.0)
+ elm_bg_color_set(o_bg, 255, 0, 0);
+ else if (val == 3.0)
+ elm_bg_color_set(o_bg, 0, 0, 255);
+ else if (val == 4.0)
+ elm_bg_color_set(o_bg, 0, 255, 0);
+}
+
+void
+test_bg_plain(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
+{
+ Evas_Object *win, *bg;
+
+ win = elm_win_add(NULL, "bg-plain", ELM_WIN_BASIC);
+ elm_win_title_set(win, "Bg Plain");
+ elm_win_autodel_set(win, EINA_TRUE);
+
+ bg = elm_bg_add(win);
+ /* allow bg to expand in x & y */
+ evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ elm_win_resize_object_add(win, bg);
+ evas_object_show(bg);
+
+ /* set size hints. a minimum size for the bg. this should propagate back
+ * to the window thus limiting its size based off the bg as the bg is one
+ * of the window's resize objects. */
+ evas_object_size_hint_min_set(bg, 160, 160);
+ /* and set a maximum size. not needed very often. normally used together
+ * with evas_object_size_hint_min_set() at the same size to make a
+ * window not resizable */
+ evas_object_size_hint_max_set(bg, 640, 640);
+ /* and now just resize the window to a size you want. normally widgets
+ * will determine the initial size though */
+ evas_object_resize(win, 320, 320);
+ /* and show the window */
+ evas_object_show(win);
+}
+
+void
+test_bg_image(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
+{
+ Evas_Object *win, *bg;
+ Evas_Object *box, *hbox, *o_bg;
+ Evas_Object *rd, *rdg;
+ char buf[PATH_MAX];
+
+ win = elm_win_add(NULL, "bg-image", ELM_WIN_BASIC);
+ elm_win_title_set(win, "Bg Image");
+ elm_win_autodel_set(win, EINA_TRUE);
+
+ bg = elm_bg_add(win);
+ evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ elm_win_resize_object_add(win, bg);
+ evas_object_show(bg);
+
+ box = elm_box_add(win);
+ evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ elm_win_resize_object_add(win, box);
+ evas_object_show(box);
+
+ o_bg = elm_bg_add(win);
+ snprintf(buf, sizeof(buf), "%s/images/plant_01.jpg", elm_app_data_dir_get());
+ elm_bg_file_set(o_bg, buf, NULL);
+ evas_object_size_hint_weight_set(o_bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(o_bg, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ elm_box_pack_end(box, o_bg);
+
+ hbox = elm_box_add(win);
+ elm_box_horizontal_set(hbox, EINA_TRUE);
+ evas_object_size_hint_weight_set(hbox, EVAS_HINT_EXPAND, EVAS_HINT_FILL);
+ evas_object_size_hint_align_set(hbox, EVAS_HINT_FILL, EVAS_HINT_FILL);
+
+ rd = elm_radio_add(win);
+ elm_radio_state_value_set(rd, 50);
+ elm_object_text_set(rd, "50 x 50");
+ evas_object_size_hint_weight_set(rd, EVAS_HINT_EXPAND, EVAS_HINT_FILL);
+ evas_object_smart_callback_add(rd, "changed", _cb_size_radio_changed, o_bg);
+ elm_box_pack_end(hbox, rd);
+ evas_object_show(rd);
+ rdg = rd;
+
+ rd = elm_radio_add(win);
+ elm_radio_state_value_set(rd, 100);
+ elm_radio_group_add(rd, rdg);
+ elm_object_text_set(rd, "100 x 100");
+ evas_object_size_hint_weight_set(rd, EVAS_HINT_EXPAND, EVAS_HINT_FILL);
+ evas_object_smart_callback_add(rd, "changed", _cb_size_radio_changed, o_bg);
+ elm_box_pack_end(hbox, rd);
+ evas_object_show(rd);
+
+ rd = elm_radio_add(win);
+ elm_radio_state_value_set(rd, 200);
+ elm_radio_group_add(rd, rdg);
+ elm_object_text_set(rd, "200 x 200");
+ evas_object_size_hint_weight_set(rd, EVAS_HINT_EXPAND, EVAS_HINT_FILL);
+ evas_object_smart_callback_add(rd, "changed", _cb_size_radio_changed, o_bg);
+ elm_box_pack_end(hbox, rd);
+ evas_object_show(rd);
+
+ elm_radio_value_set(rdg, 200);
+
+ elm_box_pack_end(box, hbox);
+ evas_object_show(hbox);
+
+ evas_object_show(o_bg);
+ evas_object_size_hint_min_set(bg, 160, 160);
+ evas_object_size_hint_max_set(bg, 640, 640);
+ evas_object_resize(win, 320, 320);
+ evas_object_show(win);
+}
+
+void
+test_bg_options(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
+{
+ Evas_Object *win, *bg;
+ Evas_Object *box, *hbox, *o_bg;
+ Evas_Object *rd, *rdg;
+ char buf[PATH_MAX];
+
+ win = elm_win_add(NULL, "bg-options", ELM_WIN_BASIC);
+ elm_win_title_set(win, "Bg Options");
+ elm_win_autodel_set(win, EINA_TRUE);
+
+ bg = elm_bg_add(win);
+ evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ elm_win_resize_object_add(win, bg);
+ evas_object_show(bg);
+
+ box = elm_box_add(win);
+ evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ elm_win_resize_object_add(win, box);
+ evas_object_show(box);
+
+ o_bg = elm_bg_add(win);
+ snprintf(buf, sizeof(buf), "%s/images/plant_01.jpg", elm_app_data_dir_get());
+ elm_bg_file_set(o_bg, buf, NULL);
+ evas_object_size_hint_weight_set(o_bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(o_bg, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ elm_box_pack_end(box, o_bg);
+ evas_object_show(o_bg);
+
+ hbox = elm_box_add(win);
+ elm_box_horizontal_set(hbox, EINA_TRUE);
+ evas_object_size_hint_weight_set(hbox, EVAS_HINT_EXPAND, EVAS_HINT_FILL);
+ evas_object_size_hint_align_set(hbox, EVAS_HINT_FILL, EVAS_HINT_FILL);
+
+ rd = elm_radio_add(win);
+ elm_radio_state_value_set(rd, ELM_BG_OPTION_CENTER);
+ elm_object_text_set(rd, "Center");
+ evas_object_size_hint_weight_set(rd, EVAS_HINT_EXPAND, EVAS_HINT_FILL);
+ evas_object_smart_callback_add(rd, "changed", _cb_radio_changed, o_bg);
+ elm_box_pack_end(hbox, rd);
+ evas_object_show(rd);
+ rdg = rd;
+
+ rd = elm_radio_add(win);
+ elm_radio_state_value_set(rd, ELM_BG_OPTION_SCALE);
+ elm_radio_group_add(rd, rdg);
+ elm_object_text_set(rd, "Scale");
+ evas_object_size_hint_weight_set(rd, EVAS_HINT_EXPAND, EVAS_HINT_FILL);
+ evas_object_smart_callback_add(rd, "changed", _cb_radio_changed, o_bg);
+ elm_box_pack_end(hbox, rd);
+ evas_object_show(rd);
+
+ rd = elm_radio_add(win);
+ elm_radio_state_value_set(rd, ELM_BG_OPTION_STRETCH);
+ elm_radio_group_add(rd, rdg);
+ elm_object_text_set(rd, "Stretch");
+ evas_object_size_hint_weight_set(rd, EVAS_HINT_EXPAND, EVAS_HINT_FILL);
+ evas_object_smart_callback_add(rd, "changed", _cb_radio_changed, o_bg);
+ elm_box_pack_end(hbox, rd);
+ evas_object_show(rd);
+
+ rd = elm_radio_add(win);
+ elm_radio_state_value_set(rd, ELM_BG_OPTION_TILE);
+ elm_radio_group_add(rd, rdg);
+ elm_object_text_set(rd, "Tile");
+ evas_object_size_hint_weight_set(rd, EVAS_HINT_EXPAND, EVAS_HINT_FILL);
+ evas_object_smart_callback_add(rd, "changed", _cb_radio_changed, o_bg);
+ elm_box_pack_end(hbox, rd);
+ evas_object_show(rd);
+
+ elm_radio_value_set(rdg, ELM_BG_OPTION_SCALE);
+
+ rd = elm_check_add(win);
+ elm_object_text_set(rd, "Show Overlay");
+ evas_object_size_hint_weight_set(rd, EVAS_HINT_EXPAND, EVAS_HINT_FILL);
+ evas_object_smart_callback_add(rd, "changed", _cb_overlay_changed, o_bg);
+ elm_box_pack_end(hbox, rd);
+ evas_object_show(rd);
+
+ /* color choices ... this is ghetto, but we don't have a 'colorpicker'
+ * widget yet :( */
+ rd = elm_spinner_add(win);
+ elm_object_tooltip_text_set(rd, "The background's part being affected<br/>"
+ "here may be seen only if you enlarge<br/>"
+ "the window and mark the 'Center' radio.");
+ elm_object_style_set(rd, "vertical");
+ elm_spinner_min_max_set(rd, 1, 4);
+ elm_spinner_label_format_set(rd, "%.0f");
+ elm_spinner_editable_set(rd, EINA_FALSE);
+ elm_spinner_special_value_add(rd, 1, "White");
+ elm_spinner_special_value_add(rd, 2, "Red");
+ elm_spinner_special_value_add(rd, 3, "Blue");
+ elm_spinner_special_value_add(rd, 4, "Green");
+ evas_object_size_hint_weight_set(rd, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(rd, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ evas_object_smart_callback_add(rd, "changed", _cb_color_changed, o_bg);
+ elm_box_pack_end(hbox, rd);
+ evas_object_show(rd);
+
+ elm_box_pack_end(box, hbox);
+ evas_object_show(hbox);
+
+ evas_object_size_hint_min_set(bg, 160, 160);
+ evas_object_size_hint_max_set(bg, 640, 640);
+ evas_object_resize(win, 320, 320);
+ evas_object_show(win);
+}
diff --git a/src/bin/elementary/test_box.c b/src/bin/elementary/test_box.c
new file mode 100644
index 0000000000..6da21d63c4
--- /dev/null
+++ b/src/bin/elementary/test_box.c
@@ -0,0 +1,882 @@
+#include "test.h"
+#ifdef HAVE_CONFIG_H
+# include "elementary_config.h"
+#endif
+#include <Elementary.h>
+
+#define ICON_MAX 24
+
+typedef enum
+{
+ BOX_PACK_POSITION_START,
+ BOX_PACK_POSITION_BEFORE,
+ BOX_PACK_POSITION_AFTER,
+ BOX_PACK_POSITION_END
+} Box_Pack_Position;
+
+struct _api_data
+{
+ unsigned int state; /* What state we are testing */
+ void *box; /* Use this to get box content */
+};
+typedef struct _api_data api_data;
+
+enum _api_state
+{
+ BOX_PACK_START,
+ BOX_PACK_BEFORE,
+ BOX_PACK_AFTER,
+ BOX_PADDING_SET,
+ BOX_ALIGN_SET,
+ BOX_HOMOGENEOUS_SET,
+ BOX_UNPACK_ALL,
+ BOX_CLEAR,
+ API_STATE_LAST
+};
+typedef enum _api_state api_state;
+
+static void
+set_api_state(api_data *api)
+{
+ const Eina_List *items = elm_box_children_get(api->box);
+ if (!eina_list_count(items))
+ return;
+
+ /* use elm_box_children_get() to get list of children */
+ switch(api->state)
+ { /* Put all api-changes under switch */
+ case BOX_PACK_START: /* Move last item to beginning */
+ elm_box_unpack(api->box, eina_list_data_get(eina_list_last(items)));
+ elm_box_pack_start(api->box, eina_list_data_get(eina_list_last(items)));
+ break;
+
+ case BOX_PACK_BEFORE:
+ if (eina_list_count(items) > 1)
+ { /* Put last item before the one preceding it */
+ elm_box_unpack(api->box, eina_list_data_get(eina_list_last(items)));
+ elm_box_pack_before(api->box,
+ eina_list_data_get(eina_list_last(items)),
+ eina_list_nth(items, eina_list_count(items)-2));
+ }
+ break;
+
+ case BOX_PACK_AFTER:
+ if (eina_list_count(items) > 1)
+ { /* Put item before last to last */
+ elm_box_unpack(api->box, eina_list_nth(items,
+ eina_list_count(items)-2));
+ elm_box_pack_after(api->box,
+ eina_list_nth(items, eina_list_count(items)-2),
+ eina_list_data_get(eina_list_last(items)));
+ }
+ break;
+
+ case BOX_PADDING_SET:
+ elm_box_padding_set(api->box, 30, 15);
+ break;
+
+ case BOX_ALIGN_SET:
+ elm_box_align_set(api->box, 0.25, 0.75);
+ break;
+
+ case BOX_HOMOGENEOUS_SET:
+ elm_box_homogeneous_set(api->box, EINA_TRUE);
+ break;
+
+ case BOX_UNPACK_ALL:
+ {
+ Eina_List *l;
+ Evas_Object *data;
+ elm_box_unpack_all(api->box);
+ EINA_LIST_REVERSE_FOREACH(items, l, data)
+ elm_box_pack_end(api->box, data);
+ }
+ break;
+
+ case BOX_CLEAR:
+ elm_box_clear(api->box);
+ break;
+
+ case API_STATE_LAST:
+
+ break;
+ default:
+ return;
+ }
+}
+
+static void
+_api_bt_clicked(void *data, Evas_Object *obj, void *event_info EINA_UNUSED)
+{ /* Will add here a SWITCH command containing code to modify test-object */
+ /* in accordance a->state value. */
+ api_data *a = data;
+ char str[128];
+
+ printf("clicked event on API Button: api_state=<%d>\n", a->state);
+ set_api_state(a);
+ a->state++;
+ sprintf(str, "Next API function (%u)", a->state);
+ elm_object_text_set(obj, str);
+ elm_object_disabled_set(obj, a->state == API_STATE_LAST);
+}
+
+static void
+_cleanup_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
+{
+ free(data);
+}
+
+void
+test_box_vert(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
+{
+ Evas_Object *win, *bx, *ic, *bxx, *bt;
+ char buf[PATH_MAX];
+ api_data *api = calloc(1, sizeof(api_data));
+
+ win = elm_win_util_standard_add("box-vert", "Box Vert");
+ elm_win_autodel_set(win, EINA_TRUE);
+ evas_object_event_callback_add(win, EVAS_CALLBACK_FREE, _cleanup_cb, api);
+
+ bxx = elm_box_add(win);
+ evas_object_size_hint_weight_set(bxx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ elm_win_resize_object_add(win, bxx);
+ evas_object_show(bxx);
+
+ bx = elm_box_add(win);
+ api->box = bx;
+ evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_show(bx);
+
+ bt = elm_button_add(win);
+ elm_object_text_set(bt, "Next API function");
+ evas_object_smart_callback_add(bt, "clicked", _api_bt_clicked, (void *) api);
+ elm_box_pack_end(bxx, bt);
+ elm_object_disabled_set(bt, api->state == API_STATE_LAST);
+ evas_object_show(bt);
+
+ elm_box_pack_end(bxx, bx);
+
+ ic = elm_icon_add(win);
+ snprintf(buf, sizeof(buf), "%s/images/icon_01.png", elm_app_data_dir_get());
+ elm_image_file_set(ic, buf, NULL);
+ elm_image_resizable_set(ic, EINA_FALSE, EINA_FALSE);
+ evas_object_size_hint_align_set(ic, 0.5, 0.5);
+ elm_box_pack_end(bx, ic);
+ evas_object_show(ic);
+
+ ic = elm_icon_add(win);
+ snprintf(buf, sizeof(buf), "%s/images/icon_02.png", elm_app_data_dir_get());
+ elm_image_file_set(ic, buf, NULL);
+ elm_image_resizable_set(ic, EINA_FALSE, EINA_FALSE);
+ evas_object_size_hint_align_set(ic, 0.0, 0.5);
+ elm_box_pack_end(bx, ic);
+ evas_object_show(ic);
+
+ ic = elm_icon_add(win);
+ snprintf(buf, sizeof(buf), "%s/images/icon_03.png", elm_app_data_dir_get());
+ elm_image_file_set(ic, buf, NULL);
+ elm_image_resizable_set(ic, EINA_FALSE, EINA_FALSE);
+ evas_object_size_hint_align_set(ic, EVAS_HINT_EXPAND, 0.5);
+ elm_box_pack_end(bx, ic);
+ evas_object_show(ic);
+
+ evas_object_show(win);
+}
+
+static void
+_del_cb(void *data, Evas_Object *obj, void *event_info EINA_UNUSED)
+{
+ elm_box_unpack(data, obj);
+ evas_object_move(obj, 0, 0);
+ evas_object_color_set(obj, 128, 64, 0, 128);
+ evas_object_del(obj);
+}
+
+void
+test_box_vert2(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
+{
+ Evas_Object *win, *bx, *bt;
+
+ win = elm_win_util_standard_add("box-vert2", "Box Vert 2");
+ elm_win_autodel_set(win, EINA_TRUE);
+
+ bx = elm_box_add(win);
+ evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ elm_win_resize_object_add(win, bx);
+ elm_box_padding_set(bx, 10, 10);
+ evas_object_show(bx);
+
+ bt = elm_button_add(win);
+ elm_object_text_set(bt, "Button 1");
+ evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ evas_object_size_hint_weight_set(bt, 0.0, 0.0);
+ evas_object_smart_callback_add(bt, "clicked", _del_cb, bx);
+ elm_box_pack_end(bx, bt);
+ evas_object_show(bt);
+
+ bt = elm_button_add(win);
+ elm_object_text_set(bt, "Button 2");
+ evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ evas_object_size_hint_weight_set(bt, 0.0, 0.0);
+ evas_object_smart_callback_add(bt, "clicked", _del_cb, bx);
+ elm_box_pack_end(bx, bt);
+ evas_object_show(bt);
+
+ bt = elm_button_add(win);
+ elm_object_text_set(bt, "Button 3");
+ evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ evas_object_size_hint_weight_set(bt, 0.0, 0.0);
+ evas_object_smart_callback_add(bt, "clicked", _del_cb, bx);
+ elm_box_pack_end(bx, bt);
+ evas_object_show(bt);
+
+ bt = elm_button_add(win);
+ elm_object_text_set(bt, "Button 4");
+ evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ evas_object_size_hint_weight_set(bt, 0.0, 0.0);
+ evas_object_smart_callback_add(bt, "clicked", _del_cb, bx);
+ elm_box_pack_end(bx, bt);
+ evas_object_show(bt);
+
+ bt = elm_button_add(win);
+ elm_object_text_set(bt, "Button 5");
+ evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ evas_object_size_hint_weight_set(bt, 0.0, 0.0);
+ evas_object_smart_callback_add(bt, "clicked", _del_cb, bx);
+ elm_box_pack_end(bx, bt);
+ evas_object_show(bt);
+
+ evas_object_show(win);
+}
+
+void
+test_box_horiz(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
+{
+ Evas_Object *win, *bx, *ic, *bxx, *bt;
+ char buf[PATH_MAX];
+ api_data *api = calloc(1, sizeof(api_data));
+
+ win = elm_win_util_standard_add("box-horiz", "Box Horiz");
+ elm_win_autodel_set(win, EINA_TRUE);
+ evas_object_event_callback_add(win, EVAS_CALLBACK_FREE, _cleanup_cb, api);
+
+ bxx = elm_box_add(win);
+ evas_object_size_hint_weight_set(bxx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ elm_win_resize_object_add(win, bxx);
+ evas_object_show(bxx);
+
+ bx = elm_box_add(win);
+ elm_box_horizontal_set(bx, EINA_TRUE);
+ evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ api->box = bx;
+ evas_object_show(bx);
+
+ bt = elm_button_add(win);
+ elm_object_text_set(bt, "Next API function");
+ evas_object_smart_callback_add(bt, "clicked", _api_bt_clicked, (void *) api);
+ elm_box_pack_end(bxx, bt);
+ elm_object_disabled_set(bt, api->state == API_STATE_LAST);
+ evas_object_show(bt);
+
+ elm_box_pack_end(bxx, bx);
+
+ ic = elm_icon_add(win);
+ snprintf(buf, sizeof(buf), "%s/images/icon_01.png", elm_app_data_dir_get());
+ elm_image_file_set(ic, buf, NULL);
+ elm_image_resizable_set(ic, EINA_FALSE, EINA_FALSE);
+ evas_object_size_hint_align_set(ic, 0.5, 0.5);
+ elm_box_pack_end(bx, ic);
+ evas_object_show(ic);
+
+ ic = elm_icon_add(win);
+ snprintf(buf, sizeof(buf), "%s/images/icon_02.png", elm_app_data_dir_get());
+ elm_image_file_set(ic, buf, NULL);
+ elm_image_resizable_set(ic, EINA_FALSE, EINA_FALSE);
+ evas_object_size_hint_align_set(ic, 0.5, 0.0);
+ elm_box_pack_end(bx, ic);
+ evas_object_show(ic);
+
+ ic = elm_icon_add(win);
+ snprintf(buf, sizeof(buf), "%s/images/icon_03.png", elm_app_data_dir_get());
+ elm_image_file_set(ic, buf, NULL);
+ elm_image_resizable_set(ic, EINA_FALSE, EINA_FALSE);
+ evas_object_size_hint_align_set(ic, 0.0, EVAS_HINT_EXPAND);
+ elm_box_pack_end(bx, ic);
+ evas_object_show(ic);
+
+ evas_object_show(win);
+}
+
+static Eina_Bool radio_index[ICON_MAX];
+
+static int
+_index_get(void)
+{
+ int i;
+ for (i = 0; i < ICON_MAX; i++)
+ {
+ if (!radio_index[i])
+ {
+ radio_index[i] = EINA_TRUE;
+ return i;
+ }
+
+ }
+ return -1;
+}
+
+static void
+_index_remove(int i)
+{
+ if (i >= ICON_MAX) return;
+ radio_index[i] = EINA_FALSE;
+}
+
+static void
+_index_clear()
+{
+ int i;
+ for (i = 0; i < ICON_MAX; i++)
+ radio_index[i] = EINA_FALSE;
+}
+
+static Evas_Object *
+_radio_new(Evas_Object *obj)
+{
+ Evas_Object *ic, *rd;
+ int idx;
+ char buf[PATH_MAX];
+ Evas_Object *rdg;
+
+ idx = _index_get();
+ if (idx == -1) return NULL;
+
+ ic = elm_icon_add(obj);
+ snprintf(buf, sizeof(buf), "%s/images/icon_%02d.png",
+ elm_app_data_dir_get(), idx);
+ elm_image_file_set(ic, buf, NULL);
+ evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
+
+ rd = elm_radio_add(obj);
+ elm_radio_state_value_set(rd, idx);
+ evas_object_size_hint_weight_set(rd, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(rd, EVAS_HINT_FILL, 0.5);
+ elm_object_part_content_set(rd, "icon", ic);
+
+ rdg = evas_object_data_get(obj, "radio-group");
+ if (rdg) elm_radio_group_add(rd, rdg);
+
+ evas_object_show(rd);
+ evas_object_show(ic);
+
+ return rd;
+}
+
+static void
+_pack_start_btn_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
+{
+ Evas_Object *rd;
+ if (!data) return;
+
+ rd = _radio_new(data);
+ if (!rd) return;
+ elm_box_pack_start(data, rd);
+}
+
+static void
+_pack_before_btn_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
+{
+ Evas_Object *rd, *selected_rd, *rdg;
+ if (!data) return;
+
+ rdg = evas_object_data_get(data, "radio-group");
+ if (!rdg) return;
+
+ selected_rd = elm_radio_selected_object_get(rdg);
+ if (!selected_rd || (selected_rd == rdg)) return;
+
+ rd = _radio_new(data);
+ if (!rd) return;
+ elm_box_pack_before(data, rd, selected_rd);
+}
+
+static void
+_pack_after_btn_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
+{
+ Evas_Object *rd, *selected_rd, *rdg;
+ if (!data) return;
+
+ rdg = evas_object_data_get(data, "radio-group");
+ if (!rdg) return;
+
+ selected_rd = elm_radio_selected_object_get(rdg);
+ if (!selected_rd || (selected_rd == rdg)) return;
+
+ rd = _radio_new(data);
+ if (!rd) return;
+ elm_box_pack_after(data, rd, selected_rd);
+}
+
+static void
+_pack_end_btn_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
+{
+ Evas_Object *rd;
+ if (!data) return;
+
+ rd = _radio_new(data);
+ if (!rd) return;
+ elm_box_pack_end(data, rd);
+}
+
+static void
+_unpack_btn_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
+{
+ Evas_Object *rdg, *selected_rd;
+ if (!data) return;
+
+ rdg = evas_object_data_get(data, "radio-group");
+ if (!rdg) return;
+
+ selected_rd = elm_radio_selected_object_get(rdg);
+ if (selected_rd == rdg) return;
+
+ _index_remove(elm_radio_value_get(selected_rd));
+ elm_box_unpack(data, selected_rd);
+ evas_object_del(selected_rd);
+ elm_radio_value_set(rdg, -1);
+}
+
+static void
+_unpack_all_btn_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
+{
+ Evas_Object *radio, *rdg;
+ Eina_List *rl, *l;
+ if (!data) return;
+
+ rdg = evas_object_data_get(data, "radio-group");
+ if (!rdg) return;
+
+ _index_clear();
+ rl = elm_box_children_get(data);
+ EINA_LIST_FOREACH(rl, l, radio)
+ {
+ if (radio != rdg)
+ evas_object_del(radio);
+ }
+ elm_box_unpack_all(data);
+ elm_radio_value_set(rdg, -1);
+}
+
+void
+test_box_pack(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
+{
+ Evas_Object *win, *sc, *bt;
+ Evas_Object *box, *lbox, *rbox;
+ Evas_Object *rd, *rdg = NULL;
+ int i;
+
+ win = elm_win_util_standard_add("box-pack", "Box Pack");
+ elm_win_autodel_set(win, EINA_TRUE);
+
+ box = elm_box_add(win);
+ elm_box_horizontal_set(box, EINA_TRUE);
+ evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ elm_win_resize_object_add(win, box);
+ evas_object_show(box);
+
+ // left side
+ lbox = elm_box_add(win);
+ evas_object_size_hint_weight_set(lbox, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(lbox, EVAS_HINT_FILL, EVAS_HINT_FILL);
+
+ sc = elm_scroller_add(win);
+ elm_scroller_bounce_set(sc, EINA_FALSE, EINA_TRUE);
+ evas_object_size_hint_weight_set(sc, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(sc, EVAS_HINT_FILL, EVAS_HINT_FILL);
+
+ rdg = elm_radio_add(win); /* a radio for easy group handling */
+ elm_radio_state_value_set(rdg, -1);
+ evas_object_data_set(lbox, "radio-group", rdg);
+
+ for (i = 0; i < 3; i++)
+ {
+ rd = _radio_new(lbox);
+ elm_box_pack_end(lbox, rd);
+ }
+
+ elm_object_content_set(sc, lbox);
+ evas_object_show(lbox);
+ elm_box_pack_end(box, sc);
+ evas_object_show(sc);
+
+ // right side
+ rbox = elm_box_add(win);
+ evas_object_size_hint_weight_set(rbox, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(rbox, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ evas_object_show(rbox);
+ elm_box_pack_end(box, rbox);
+
+ bt = elm_button_add(win);
+ elm_object_text_set(bt, "Pack Start");
+ evas_object_show(bt);
+ elm_box_pack_end(rbox, bt);
+ evas_object_smart_callback_add(bt, "clicked", _pack_start_btn_cb, lbox);
+
+ bt = elm_button_add(win);
+ elm_object_text_set(bt, "Pack Before");
+ evas_object_show(bt);
+ elm_box_pack_end(rbox, bt);
+ evas_object_smart_callback_add(bt, "clicked", _pack_before_btn_cb, lbox);
+
+ bt = elm_button_add(win);
+ elm_object_text_set(bt, "Pack After");
+ evas_object_show(bt);
+ elm_box_pack_end(rbox, bt);
+ evas_object_smart_callback_add(bt, "clicked", _pack_after_btn_cb, lbox);
+
+ bt = elm_button_add(win);
+ elm_object_text_set(bt, "Pack End");
+ evas_object_show(bt);
+ elm_box_pack_end(rbox, bt);
+ evas_object_smart_callback_add(bt, "clicked", _pack_end_btn_cb, lbox);
+
+ bt = elm_button_add(win);
+ elm_object_text_set(bt, "Unpack");
+ evas_object_show(bt);
+ elm_box_pack_end(rbox, bt);
+ evas_object_smart_callback_add(bt, "clicked", _unpack_btn_cb, lbox);
+
+ bt = elm_button_add(win);
+ elm_object_text_set(bt, "Unpack All");
+ evas_object_show(bt);
+ elm_box_pack_end(rbox, bt);
+ evas_object_smart_callback_add(bt, "clicked", _unpack_all_btn_cb, lbox);
+
+ evas_object_resize(win, 320, 320);
+ evas_object_show(win);
+}
+
+static void
+_cb_check_changed(void *data, Evas_Object *obj, void *event EINA_UNUSED)
+{
+ Eina_Bool homo;
+ Evas_Object *box = data;
+
+ homo = elm_check_state_get(obj);
+ elm_box_homogeneous_set(box, homo);
+}
+
+void
+test_box_homo(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
+{
+ Evas_Object *win;
+ Evas_Object *box, *o_bg;
+ Evas_Object *rd;
+ char buf[PATH_MAX];
+
+ win = elm_win_util_standard_add("box-homogeneous", "Box Homogeneous");
+ elm_win_autodel_set(win, EINA_TRUE);
+
+ box = elm_box_add(win);
+ evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ elm_win_resize_object_add(win, box);
+ evas_object_show(box);
+
+ o_bg = elm_bg_add(win);
+ snprintf(buf, sizeof(buf), "%s/images/twofish.jpg", elm_app_data_dir_get());
+ elm_bg_file_set(o_bg, buf, NULL);
+ evas_object_size_hint_weight_set(o_bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(o_bg, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ elm_box_pack_end(box, o_bg);
+
+ rd = elm_check_add(win);
+ elm_object_text_set(rd, "Homogeneous");
+ evas_object_size_hint_weight_set(rd, EVAS_HINT_EXPAND, EVAS_HINT_FILL);
+ evas_object_smart_callback_add(rd, "changed", _cb_check_changed, box);
+ elm_box_pack_end(box, rd);
+ evas_object_show(rd);
+ evas_object_show(o_bg);
+
+ evas_object_resize(win, 320, 320);
+ evas_object_show(win);
+}
+
+typedef struct
+{
+ Eina_List *transitions;
+ Evas_Object *box;
+ Evas_Object_Box_Layout last_layout;
+} Transitions_Data;
+
+static void
+_test_box_transition_change(void *data)
+{
+ Transitions_Data *tdata = data;
+ Elm_Box_Transition *layout_data;
+ Evas_Object_Box_Layout next_layout;
+
+ if (!data) return;
+ next_layout = eina_list_data_get(tdata->transitions);
+ layout_data = elm_box_transition_new(2.0, tdata->last_layout,
+ NULL, NULL, next_layout, NULL, NULL,
+ _test_box_transition_change, tdata);
+ elm_box_layout_set(tdata->box, elm_box_layout_transition, layout_data, elm_box_transition_free);
+ tdata->last_layout = next_layout;
+
+ tdata->transitions = eina_list_demote_list(tdata->transitions, tdata->transitions);
+}
+
+static void
+_win_del(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
+{
+ Transitions_Data *tdata = data;
+ if (!data) return;
+ free(tdata);
+}
+
+void
+test_box_transition(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
+{
+ Evas_Object *win, *bx, *bt;
+ Transitions_Data *tdata;
+
+ win = elm_win_util_standard_add("box-transition", "Box Transition");
+ elm_win_autodel_set(win, EINA_TRUE);
+
+ bx = elm_box_add(win);
+ evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ elm_win_resize_object_add(win, bx);
+ evas_object_show(bx);
+
+ bt = elm_button_add(win);
+ elm_object_text_set(bt, "Button 1");
+ evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ evas_object_smart_callback_add(bt, "clicked", _del_cb, bx);
+ elm_box_pack_end(bx, bt);
+ evas_object_show(bt);
+
+ bt = elm_button_add(win);
+ elm_object_text_set(bt, "Button 2");
+ evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ evas_object_smart_callback_add(bt, "clicked", _del_cb, bx);
+ elm_box_pack_end(bx, bt);
+ evas_object_show(bt);
+
+ bt = elm_button_add(win);
+ elm_object_text_set(bt, "Button 3");
+ evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ evas_object_smart_callback_add(bt, "clicked", _del_cb, bx);
+ elm_box_pack_end(bx, bt);
+ evas_object_show(bt);
+
+ tdata = calloc(1, sizeof(Transitions_Data));
+ tdata->box = bx;
+ tdata->last_layout = evas_object_box_layout_horizontal;
+ tdata->transitions = eina_list_append(tdata->transitions,
+ evas_object_box_layout_vertical);
+ tdata->transitions = eina_list_append(tdata->transitions,
+ evas_object_box_layout_horizontal);
+ tdata->transitions = eina_list_append(tdata->transitions,
+ evas_object_box_layout_stack);
+ tdata->transitions = eina_list_append(tdata->transitions,
+ evas_object_box_layout_homogeneous_vertical);
+ tdata->transitions = eina_list_append(tdata->transitions,
+ evas_object_box_layout_homogeneous_horizontal);
+ tdata->transitions = eina_list_append(tdata->transitions,
+ evas_object_box_layout_flow_vertical);
+ tdata->transitions = eina_list_append(tdata->transitions,
+ evas_object_box_layout_flow_horizontal);
+ tdata->transitions = eina_list_append(tdata->transitions,
+ evas_object_box_layout_stack);
+
+ evas_object_smart_callback_add(win, "delete,request", _win_del, tdata);
+ elm_box_layout_set(bx, evas_object_box_layout_horizontal, NULL, NULL);
+ _test_box_transition_change(tdata);
+
+ evas_object_resize(win, 300, 300);
+ evas_object_show(win);
+}
+
+typedef struct _Box_Align_Data Box_Align_Data;
+struct _Box_Align_Data
+{
+ Evas_Object *hor_box; // target box horizontal
+ Evas_Object *vert_box; // target box vertical
+ double hor; // horizontal slider
+ double vert; // vertical slider
+};
+
+static void
+_box_align_win_del_cb(void *data, Evas *e EINA_UNUSED,
+ Evas_Object *obj EINA_UNUSED,
+ void *event_info EINA_UNUSED)
+{
+ free(data);
+}
+
+static void
+_hor_slider_changed_cb(void *data, Evas_Object *obj, void *event_info EINA_UNUSED)
+{
+ Box_Align_Data *bdata = data;
+
+ bdata->hor = elm_slider_value_get(obj);
+ printf("box align: %0.2f %0.2f\n", bdata->hor, bdata->vert);
+ elm_box_align_set(bdata->hor_box, bdata->hor, bdata->vert);
+ elm_box_align_set(bdata->vert_box, bdata->hor, bdata->vert);
+}
+
+static void
+_vert_slider_changed_cb(void *data, Evas_Object *obj, void *event_info EINA_UNUSED)
+{
+ Box_Align_Data *bdata = data;
+
+ bdata->vert = elm_slider_value_get(obj);
+ printf("box align: %0.2f %0.2f\n", bdata->hor, bdata->vert);
+ elm_box_align_set(bdata->hor_box, bdata->hor, bdata->vert);
+ elm_box_align_set(bdata->vert_box, bdata->hor, bdata->vert);
+}
+
+void
+_description_add(Evas_Object *bx_out, Box_Align_Data *bdata)
+{
+ Evas_Object *fr, *bx, *lb, *sl, *tb;
+
+ // description
+ fr = elm_frame_add(bx_out);
+ evas_object_size_hint_weight_set(fr, EVAS_HINT_EXPAND, 0.0);
+ evas_object_size_hint_align_set(fr, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ elm_box_pack_end(bx_out, fr);
+ elm_object_text_set(fr, "Description");
+ evas_object_show(fr);
+
+ bx = elm_box_add(fr);
+ elm_object_content_set(fr, bx);
+ evas_object_show(bx);
+
+ lb = elm_label_add(fr);
+ elm_object_text_set(lb, "This test shows how elm_box_align_set() works.");
+ evas_object_size_hint_align_set(lb, 0.0, EVAS_HINT_FILL);
+ elm_box_pack_end(bx, lb);
+ evas_object_show(lb);
+
+ tb = elm_table_add(bx);
+ evas_object_size_hint_weight_set(tb, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(tb, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ elm_box_pack_end(bx, tb);
+ evas_object_show(tb);
+
+ lb = elm_label_add(tb);
+ elm_object_text_set(lb, " Horizontal ");
+ elm_table_pack(tb, lb, 0, 0, 1, 1);
+ evas_object_show(lb);
+
+ lb = elm_label_add(tb);
+ elm_object_text_set(lb, " Vertical ");
+ elm_table_pack(tb, lb, 0, 1, 1, 1);
+ evas_object_show(lb);
+
+ sl = elm_slider_add(fr);
+ elm_slider_unit_format_set(sl, "%1.2f");
+ elm_slider_min_max_set(sl, 0.0, 1.0);
+ elm_slider_value_set(sl, 0.5);
+ bdata->hor = 0.5;
+ evas_object_size_hint_weight_set(sl, EVAS_HINT_EXPAND, 0.0);
+ evas_object_size_hint_align_set(sl, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ elm_table_pack(tb, sl, 1, 0, 1, 1);
+ evas_object_show(sl);
+ evas_object_smart_callback_add(sl, "changed", _hor_slider_changed_cb, bdata);
+
+ sl = elm_slider_add(fr);
+ elm_slider_unit_format_set(sl, "%1.2f");
+ elm_slider_min_max_set(sl, 0.0, 1.0);
+ elm_slider_value_set(sl, 0.5);
+ bdata->vert = 0.5;
+ evas_object_size_hint_weight_set(sl, EVAS_HINT_EXPAND, 0.0);
+ evas_object_size_hint_align_set(sl, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ elm_table_pack(tb, sl, 1, 1, 1, 1);
+ evas_object_show(sl);
+ evas_object_smart_callback_add(sl, "changed", _vert_slider_changed_cb, bdata);
+}
+
+void
+_align_box_add(Evas_Object *bx_out, Box_Align_Data *bdata)
+{
+ Evas_Object *bx, *sp, *bt;
+
+ // test box - vertical
+ bdata->vert_box = bx = elm_box_add(bx_out);
+ evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(bx, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ elm_box_pack_end(bx_out, bx);
+ elm_box_align_set(bx, 0.5, 0.5);
+ evas_object_show(bx);
+
+ bt = elm_button_add(bx);
+ elm_object_text_set(bt, "Button 1");
+ evas_object_size_hint_weight_set(bt, 0.0, 0.0);
+ evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ elm_box_pack_end(bx, bt);
+ evas_object_show(bt);
+
+ bt = elm_button_add(bx);
+ elm_object_text_set(bt, "Button 2");
+ evas_object_size_hint_weight_set(bt, 0.0, 0.0);
+ evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ elm_box_pack_end(bx, bt);
+ evas_object_show(bt);
+
+ // separator
+ sp = elm_separator_add(bx_out);
+ elm_separator_horizontal_set(sp, EINA_TRUE);
+ elm_box_pack_end(bx_out, sp);
+ evas_object_show(sp);
+
+ // test box - horizontal
+ bdata->hor_box = bx = elm_box_add(bx_out);
+ evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(bx, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ elm_box_pack_end(bx_out, bx);
+ elm_box_align_set(bx, 0.5, 0.5);
+ elm_box_horizontal_set(bx, EINA_TRUE);
+ evas_object_show(bx);
+
+ bt = elm_button_add(bx);
+ elm_object_text_set(bt, "Button 1");
+ evas_object_size_hint_weight_set(bt, 0.0, 0.0);
+ evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ elm_box_pack_end(bx, bt);
+ evas_object_show(bt);
+
+ bt = elm_button_add(bx);
+ elm_object_text_set(bt, "Button 2");
+ evas_object_size_hint_weight_set(bt, 0.0, 0.0);
+ evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ elm_box_pack_end(bx, bt);
+ evas_object_show(bt);
+}
+void
+test_box_align(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
+ void *event_info EINA_UNUSED)
+{
+ Evas_Object *win, *bx_out;
+ Box_Align_Data *bdata= (Box_Align_Data *)calloc(1, sizeof(Box_Align_Data));
+
+ win = elm_win_util_standard_add("box-align", "Box Align");
+ elm_win_autodel_set(win, EINA_TRUE);
+ evas_object_event_callback_add(win, EVAS_CALLBACK_DEL,
+ _box_align_win_del_cb, bdata);
+
+ bx_out = elm_box_add(win);
+ evas_object_size_hint_weight_set(bx_out, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ elm_win_resize_object_add(win, bx_out);
+ evas_object_show(bx_out);
+
+ _description_add(bx_out, bdata);
+ _align_box_add(bx_out, bdata);
+
+ evas_object_resize(win, 300, 400);
+ evas_object_show(win);
+}
diff --git a/src/bin/elementary/test_bubble.c b/src/bin/elementary/test_bubble.c
new file mode 100644
index 0000000000..497ab2f78d
--- /dev/null
+++ b/src/bin/elementary/test_bubble.c
@@ -0,0 +1,176 @@
+#include "test.h"
+#ifdef HAVE_CONFIG_H
+# include "elementary_config.h"
+#endif
+#include <Elementary.h>
+
+#include "test_explode.h"
+
+static void
+_print_clicked(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
+{
+ printf("bubble clicked\n");
+}
+
+struct _api_data
+{
+ unsigned int state; /* What state we are testing */
+ Evas_Object *win; /* Parent Window of widgets */
+ void *box; /* Use this to get box content */
+};
+typedef struct _api_data api_data;
+
+enum _api_state
+{
+ BUBBLE_SET_CORNER_1,
+ BUBBLE_SET_CORNER_2,
+ BUBBLE_SET_ICON_CONTENT,
+ API_STATE_LAST
+};
+typedef enum _api_state api_state;
+
+static void
+set_api_state(api_data *api)
+{
+ const Eina_List *items = elm_box_children_get(api->box);
+ if (!eina_list_count(items))
+ return;
+
+ switch(api->state)
+ { /* Put all api-changes under switch */
+ case BUBBLE_SET_CORNER_1:
+ elm_bubble_pos_set(eina_list_nth(items, 0), ELM_BUBBLE_POS_BOTTOM_LEFT);
+ elm_object_text_set(elm_object_content_get(eina_list_nth(items, 0)),
+ "Corner: base (bottom-left) - with icon");
+ elm_bubble_pos_set(eina_list_nth(items, 1), ELM_BUBBLE_POS_TOP_RIGHT);
+ elm_object_text_set(elm_object_content_get(eina_list_nth(items, 1)),
+ "Corner: base (top-right) - no icon");
+ break;
+
+ case BUBBLE_SET_CORNER_2:
+ elm_bubble_pos_set(eina_list_nth(items, 0), ELM_BUBBLE_POS_TOP_RIGHT);
+ elm_object_text_set(elm_object_content_get(eina_list_nth(items, 0)),
+ "Corner: base (top-right) - with icon");
+ elm_bubble_pos_set(eina_list_nth(items, 1), ELM_BUBBLE_POS_BOTTOM_LEFT);
+ elm_object_text_set(elm_object_content_get(eina_list_nth(items, 1)),
+ "Corner: base (bottom-left) - no icon");
+ break;
+
+ case BUBBLE_SET_ICON_CONTENT:
+ {
+ char buf[PATH_MAX];
+ Evas_Object *ct, *ic = elm_icon_add(api->win);
+
+ snprintf(buf, sizeof(buf), "%s/images/logo_small.png", elm_app_data_dir_get());
+ elm_image_file_set(ic, buf, NULL);
+ elm_image_resizable_set(ic, EINA_FALSE, EINA_FALSE);
+ elm_object_content_set(eina_list_nth(items, 0), ic);
+ ct = elm_label_add(api->win);
+ elm_object_text_set(ct, "Using icon as top-bubble content");
+ elm_object_content_set(eina_list_nth(items, 1), ct);
+ evas_object_size_hint_align_set(ic, 0.5, 0.5);
+ evas_object_show(ic);
+ }
+ break;
+
+ case API_STATE_LAST:
+
+ break;
+ default:
+ return;
+ }
+}
+
+static void
+_api_bt_clicked(void *data, Evas_Object *obj, void *event_info EINA_UNUSED)
+{ /* Will add here a SWITCH command containing code to modify test-object */
+ /* in accordance a->state value. */
+ api_data *a = data;
+ char str[128];
+
+ printf("clicked event on API Button: api_state=<%d>\n", a->state);
+ set_api_state(a);
+ a->state++;
+ sprintf(str, "Next API function (%u)", a->state);
+ elm_object_text_set(obj, str);
+ elm_object_disabled_set(obj, a->state == API_STATE_LAST);
+}
+
+static void
+_cleanup_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
+{
+ free(data);
+}
+
+void
+test_bubble(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
+{
+ Evas_Object *win, *bx, *ic, *bb, *ct, *bxx, *bt;
+ char buf[PATH_MAX];
+ api_data *api = calloc(1, sizeof(api_data));
+
+ win = elm_win_util_standard_add("bubble", "Bubble");
+ explode_win_enable(win);
+ api->win = win;
+ elm_win_autodel_set(win, EINA_TRUE);
+ evas_object_event_callback_add(win, EVAS_CALLBACK_FREE, _cleanup_cb, api);
+
+ bxx = elm_box_add(win);
+ evas_object_size_hint_weight_set(bxx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ elm_win_resize_object_add(win, bxx);
+ evas_object_show(bxx);
+
+ bx = elm_box_add(win);
+ evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ api->box = bx;
+ evas_object_show(bx);
+
+ bt = elm_button_add(win);
+ elm_object_text_set(bt, "Next API function");
+ evas_object_smart_callback_add(bt, "clicked", _api_bt_clicked, (void *) api);
+ elm_box_pack_end(bxx, bt);
+ elm_object_disabled_set(bt, api->state == API_STATE_LAST);
+ evas_object_show(bt);
+
+ elm_box_pack_end(bxx, bx);
+
+ ic = elm_icon_add(win);
+ snprintf(buf, sizeof(buf), "%s/images/logo_small.png", elm_app_data_dir_get());
+ elm_image_file_set(ic, buf, NULL);
+ elm_image_resizable_set(ic, EINA_FALSE, EINA_FALSE);
+ evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_HORIZONTAL, 1, 1);
+
+ bb = elm_bubble_add(win);
+ elm_object_text_set(bb, "Message 1");
+ elm_object_part_text_set(bb, "info", "Corner: bottom_right");
+ elm_object_part_content_set(bb, "icon", ic);
+ elm_bubble_pos_set(bb, ELM_BUBBLE_POS_BOTTOM_RIGHT);
+ evas_object_smart_callback_add(bb, "clicked", _print_clicked, NULL);
+ evas_object_show(ic);
+ evas_object_size_hint_weight_set(bb, EVAS_HINT_EXPAND, 0.0);
+ evas_object_size_hint_align_set(bb, EVAS_HINT_FILL, EVAS_HINT_FILL);
+
+ ct = elm_label_add(win);
+ elm_object_text_set(ct,
+ "\"The future of the art: R or G or B?\", by Rusty");
+ elm_object_content_set(bb, ct);
+
+ elm_box_pack_end(bx, bb);
+ evas_object_show(bb);
+
+ bb = elm_bubble_add(win);
+ elm_object_text_set(bb, "Message 2");
+ elm_object_part_text_set(bb, "info", "10:32 4/11/2008");
+ evas_object_smart_callback_add(bb, "clicked", _print_clicked, NULL);
+ evas_object_size_hint_weight_set(bb, EVAS_HINT_EXPAND, 0.0);
+ evas_object_size_hint_align_set(bb, EVAS_HINT_FILL, EVAS_HINT_FILL);
+
+ ct = elm_label_add(win);
+ elm_object_text_set(ct, "Corner: base (top-left) - no icon");
+ elm_object_content_set(bb, ct);
+
+ elm_box_pack_end(bx, bb);
+ evas_object_show(bb);
+
+ evas_object_show(win);
+}
diff --git a/src/bin/elementary/test_button.c b/src/bin/elementary/test_button.c
new file mode 100644
index 0000000000..b7e4288d7c
--- /dev/null
+++ b/src/bin/elementary/test_button.c
@@ -0,0 +1,205 @@
+#ifdef HAVE_CONFIG_H
+# include "elementary_config.h"
+#endif
+#include <Elementary.h>
+
+static void
+_bt_repeated(void *data EINA_UNUSED, Evas_Object *obj, void *event_info EINA_UNUSED)
+{
+ static int count;
+ char buf[16];
+
+ snprintf(buf, sizeof(buf), "count=%d", count++);
+ if (count >= 10000)
+ count = 0;
+ elm_object_text_set(obj, buf);
+}
+
+static void
+_bt_clicked(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
+{
+ int param = (int)(uintptr_t)(data);
+
+ printf("clicked event on Button:%d\n", param);
+}
+
+#define NUM_LABEL 4
+const char *btn_label[NUM_LABEL] =
+{
+ "Label Only", "Label Only Test", "Label Only Test 2", "Short"
+};
+
+static void
+_bt_clicked_label_change_cb(void *data EINA_UNUSED, Evas_Object *obj, void *event_info EINA_UNUSED)
+{
+ static int i = 1;
+ elm_object_text_set(obj, btn_label[i]);
+ i++;
+ if (i >= NUM_LABEL) i = 0;
+}
+
+static void
+_bt_unpressed(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
+{
+ int param = (int)(uintptr_t)(data);
+
+ printf("unpressed event on Button:%d\n", param);
+}
+
+void
+test_button(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
+{
+ Evas_Object *win, *scr, *bx, *ic, *bt;
+ char buf[PATH_MAX];
+
+ win = elm_win_util_standard_add("buttons", "Buttons");
+ elm_win_autodel_set(win, EINA_TRUE);
+
+ scr = elm_scroller_add(win);
+ elm_scroller_bounce_set(scr, EINA_FALSE, EINA_TRUE);
+ elm_scroller_policy_set(scr, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_AUTO);
+ evas_object_size_hint_weight_set(scr, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ elm_win_resize_object_add(win, scr);
+ evas_object_show(scr);
+
+ bx = elm_box_add(win);
+ evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ elm_object_content_set(scr, bx);
+ evas_object_show(bx);
+
+ ic = elm_icon_add(win);
+ snprintf(buf, sizeof(buf), "%s/images/logo_small.png", elm_app_data_dir_get());
+ elm_image_file_set(ic, buf, NULL);
+ evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
+ bt = elm_button_add(win);
+ elm_object_text_set(bt, "Icon sized to button");
+ elm_object_part_content_set(bt, "icon", ic);
+ evas_object_smart_callback_add(bt, "clicked", _bt_clicked, (void *)1);
+ evas_object_smart_callback_add(bt, "unpressed", _bt_unpressed, (void *)1);
+ elm_box_pack_end(bx, bt);
+ evas_object_show(bt);
+
+ ic = elm_icon_add(bx);
+ snprintf(buf, sizeof(buf), "%s/images/logo_small.png", elm_app_data_dir_get());
+ elm_image_file_set(ic, buf, NULL);
+ elm_image_resizable_set(ic, EINA_FALSE, EINA_FALSE);
+ bt = elm_button_add(win);
+ elm_object_text_set(bt, "Icon no scale");
+ elm_object_part_content_set(bt, "icon", ic);
+ evas_object_smart_callback_add(bt, "clicked", _bt_clicked, (void *)2);
+ evas_object_smart_callback_add(bt, "unpressed", _bt_unpressed, (void *)2);
+ elm_box_pack_end(bx, bt);
+ evas_object_show(bt);
+
+ ic = elm_icon_add(win);
+ snprintf(buf, sizeof(buf), "%s/images/logo_small.png", elm_app_data_dir_get());
+ elm_image_file_set(ic, buf, NULL);
+ evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
+ bt = elm_button_add(win);
+ elm_object_text_set(bt, "Disabled Button");
+ elm_object_part_content_set(bt, "icon", ic);
+ elm_object_disabled_set(bt, EINA_TRUE);
+ evas_object_smart_callback_add(bt, "clicked", _bt_clicked, (void *)3);
+ evas_object_smart_callback_add(bt, "unpressed", _bt_unpressed, (void *)3);
+ elm_box_pack_end(bx, bt);
+ evas_object_show(bt);
+
+ ic = elm_icon_add(win);
+ snprintf(buf, sizeof(buf), "%s/images/logo_small.png", elm_app_data_dir_get());
+ elm_image_file_set(ic, buf, NULL);
+ evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
+ bt = elm_button_add(win);
+ elm_object_part_content_set(bt, "icon", ic);
+ elm_object_disabled_set(bt, EINA_TRUE);
+ evas_object_smart_callback_add(bt, "clicked", _bt_clicked, (void *)4);
+ evas_object_smart_callback_add(bt, "unpressed", _bt_unpressed, (void *)4);
+ elm_box_pack_end(bx, bt);
+ evas_object_show(bt);
+
+ bt = elm_button_add(win);
+ elm_object_text_set(bt, "Label Only");
+ evas_object_smart_callback_add(bt, "clicked",
+ _bt_clicked_label_change_cb, NULL);
+ evas_object_smart_callback_add(bt, "unpressed", _bt_unpressed, (void *)5);
+ elm_box_pack_end(bx, bt);
+ evas_object_smart_callback_add(bt, "repeated", _bt_repeated, NULL);
+ elm_button_autorepeat_set(bt, EINA_TRUE);
+ elm_button_autorepeat_initial_timeout_set(bt, 2.0);
+ elm_button_autorepeat_gap_timeout_set(bt, 0.5);
+ evas_object_show(bt);
+
+ ic = elm_icon_add(win);
+ snprintf(buf, sizeof(buf), "%s/images/logo_small.png", elm_app_data_dir_get());
+ elm_image_file_set(ic, buf, NULL);
+ elm_image_resizable_set(ic, EINA_FALSE, EINA_FALSE);
+ bt = elm_button_add(win);
+ elm_object_part_content_set(bt, "icon", ic);
+ evas_object_smart_callback_add(bt, "clicked", _bt_clicked, (void *)6);
+ evas_object_smart_callback_add(bt, "unpressed", _bt_unpressed, (void *)6);
+ elm_box_pack_end(bx, bt);
+ evas_object_show(bt);
+
+ bt = elm_button_add(win);
+ elm_object_style_set(bt, "anchor");
+ elm_object_text_set(bt, "Anchor style");
+ evas_object_smart_callback_add(bt, "clicked", _bt_clicked, (void *)7);
+ evas_object_smart_callback_add(bt, "unpressed", _bt_unpressed, (void *)7);
+ elm_box_pack_end(bx, bt);
+ evas_object_show(bt);
+
+ ic = elm_icon_add(win);
+ snprintf(buf, sizeof(buf), "%s/images/logo_small.png", elm_app_data_dir_get());
+ elm_image_file_set(ic, buf, NULL);
+ evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
+ bt = elm_button_add(win);
+ elm_object_style_set(bt, "anchor");
+ elm_object_text_set(bt, "Icon sized to button");
+ elm_object_part_content_set(bt, "icon", ic);
+ evas_object_smart_callback_add(bt, "clicked", _bt_clicked, (void *)8);
+ evas_object_smart_callback_add(bt, "unpressed", _bt_unpressed, (void *)8);
+ elm_box_pack_end(bx, bt);
+ evas_object_show(bt);
+
+ ic = elm_icon_add(bx);
+ snprintf(buf, sizeof(buf), "%s/images/logo_small.png", elm_app_data_dir_get());
+ elm_image_file_set(ic, buf, NULL);
+ elm_image_resizable_set(ic, EINA_FALSE, EINA_FALSE);
+ bt = elm_button_add(win);
+ elm_object_style_set(bt, "anchor");
+ elm_object_text_set(bt, "Icon no scale");
+ elm_object_part_content_set(bt, "icon", ic);
+ evas_object_smart_callback_add(bt, "clicked", _bt_clicked, (void *)9);
+ evas_object_smart_callback_add(bt, "unpressed", _bt_unpressed, (void *)9);
+ elm_box_pack_end(bx, bt);
+ evas_object_show(bt);
+
+ ic = elm_icon_add(win);
+ snprintf(buf, sizeof(buf), "%s/images/logo_small.png", elm_app_data_dir_get());
+ elm_image_file_set(ic, buf, NULL);
+ evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
+ bt = elm_button_add(win);
+ elm_object_style_set(bt, "anchor");
+ elm_object_part_content_set(bt, "icon", ic);
+ evas_object_smart_callback_add(bt, "clicked", _bt_clicked, (void *)10);
+ evas_object_smart_callback_add(bt, "unpressed", _bt_unpressed, (void *)10);
+ elm_box_pack_end(bx, bt);
+ evas_object_show(bt);
+
+ ic = elm_icon_add(win);
+ snprintf(buf, sizeof(buf), "%s/images/logo_small.png", elm_app_data_dir_get());
+ elm_image_file_set(ic, buf, NULL);
+ evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
+ bt = elm_button_add(win);
+ elm_object_access_info_set(bt, "This is some custom text describing this widget");
+ elm_object_style_set(bt, "anchor");
+ elm_object_text_set(bt, "Disabled");
+ elm_object_part_content_set(bt, "icon", ic);
+ elm_object_disabled_set(bt, EINA_TRUE);
+ evas_object_smart_callback_add(bt, "clicked", _bt_clicked, (void *)11);
+ evas_object_smart_callback_add(bt, "unpressed", _bt_unpressed, (void *)11);
+ elm_box_pack_end(bx, bt);
+ evas_object_show(bt);
+
+ evas_object_resize(win, 320, 480);
+ evas_object_show(win);
+}
diff --git a/src/bin/elementary/test_calendar.c b/src/bin/elementary/test_calendar.c
new file mode 100644
index 0000000000..6f3eb5685d
--- /dev/null
+++ b/src/bin/elementary/test_calendar.c
@@ -0,0 +1,375 @@
+#ifdef HAVE_CONFIG_H
+# include "elementary_config.h"
+#endif
+#include <Elementary.h>
+
+struct _api_data
+{
+ unsigned int state; /* What state we are testing */
+ void *box; /* box used in set_api_state */
+};
+typedef struct _api_data api_data;
+
+enum _api_state
+{
+ STATE_MARK_MONTHLY,
+ STATE_MARK_WEEKLY,
+ STATE_SUNDAY_HIGHLIGHT,
+ STATE_SELECT_DATE_DISABLED_WITH_MARKS,
+ STATE_SELECT_DATE_DISABLED_NO_MARKS,
+ API_STATE_LAST
+};
+typedef enum _api_state api_state;
+
+#define SEC_PER_DAY 24 * 60 * 60
+#define SEC_PER_YEAR 365 * SEC_PER_DAY
+
+static void
+set_api_state(api_data *api)
+{
+ const Eina_List *items = elm_box_children_get(api->box);
+ static Elm_Calendar_Mark *m = NULL;
+ if (!eina_list_count(items))
+ return;
+
+ switch(api->state)
+ { /* Put all api-changes under switch */
+ case STATE_MARK_MONTHLY:
+ {
+ Evas_Object *cal = eina_list_nth(items, 0);
+ time_t the_time = (SEC_PER_YEAR * 41) + (SEC_PER_DAY * 9); /* Set date to DEC 31, 2010 */
+ elm_calendar_min_max_year_set(cal, 2010, 2011);
+ m = elm_calendar_mark_add(cal, "checked", gmtime(&the_time), ELM_CALENDAR_MONTHLY);
+ elm_calendar_selected_time_set(cal, gmtime(&the_time));
+ }
+ break;
+ case STATE_MARK_WEEKLY:
+ {
+ Evas_Object *cal = eina_list_nth(items, 0);
+ time_t the_time = (SEC_PER_YEAR * 41) + (SEC_PER_DAY * 4); /* Set date to DEC 26, 2010 */
+ elm_calendar_mark_del(m);
+ m = elm_calendar_mark_add(cal, "checked", gmtime(&the_time), ELM_CALENDAR_WEEKLY);
+ elm_calendar_selected_time_set(cal, gmtime(&the_time));
+ }
+ break;
+ case STATE_SUNDAY_HIGHLIGHT:
+ {
+ Evas_Object *cal = eina_list_nth(items, 0);
+ time_t the_time = (SEC_PER_YEAR * 41) + (SEC_PER_DAY * 3); /* Set date to DEC 25, 2010 */
+ /* elm_calendar_mark_del(m); */
+ m = elm_calendar_mark_add(cal, "holiday", gmtime(&the_time), ELM_CALENDAR_WEEKLY);
+ elm_calendar_selected_time_set(cal, gmtime(&the_time));
+ }
+ break;
+ case STATE_SELECT_DATE_DISABLED_WITH_MARKS:
+ {
+ Evas_Object *cal = eina_list_nth(items, 0);
+ time_t the_time = (SEC_PER_YEAR * 41) + (SEC_PER_DAY * 10); /* Set date to JAN 01, 2011 */
+ elm_calendar_select_mode_set(cal, ELM_CALENDAR_SELECT_MODE_NONE);
+ elm_calendar_selected_time_set(cal, gmtime(&the_time));
+ }
+ break;
+ case STATE_SELECT_DATE_DISABLED_NO_MARKS:
+ {
+ Evas_Object *cal = eina_list_nth(items, 0);
+ time_t the_time = (SEC_PER_YEAR * 41) + (SEC_PER_DAY * 40); /* Set date to FEB 01, 2011 */
+ elm_calendar_marks_clear(cal);
+ elm_calendar_select_mode_set(cal, ELM_CALENDAR_SELECT_MODE_NONE);
+ elm_calendar_selected_time_set(cal, gmtime(&the_time));
+ }
+ break;
+ case API_STATE_LAST:
+ break;
+ default:
+ return;
+ }
+}
+
+static void
+_api_bt_clicked(void *data, Evas_Object *obj, void *event_info EINA_UNUSED)
+{ /* Will add here a SWITCH command containing code to modify test-object */
+ /* in accordance a->state value. */
+ api_data *a = data;
+ char str[128];
+
+ printf("clicked event on API Button: api_state=<%d>\n", a->state);
+ set_api_state(a);
+ a->state++;
+ sprintf(str, "Next API function (%u)", a->state);
+ elm_object_text_set(obj, str);
+ elm_object_disabled_set(obj, a->state == API_STATE_LAST);
+}
+
+static void
+_cleanup_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
+{
+ free(data);
+}
+
+/* A simple test, just displaying calendar in it's default state */
+void
+test_calendar(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
+{
+ Evas_Object *win, *cal, *bx, *bxx, *bt;
+ api_data *api = calloc(1, sizeof(api_data));
+
+ win = elm_win_util_standard_add("calendar", "Calendar");
+ elm_win_autodel_set(win, EINA_TRUE);
+ evas_object_event_callback_add(win, EVAS_CALLBACK_FREE, _cleanup_cb, api);
+
+ bxx = elm_box_add(win);
+ evas_object_size_hint_weight_set(bxx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ elm_win_resize_object_add(win, bxx);
+ evas_object_show(bxx);
+
+ bx = elm_box_add(win);
+ evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ api->box = bx;
+ evas_object_show(bx);
+
+ bt = elm_button_add(win);
+ elm_object_text_set(bt, "Next API function");
+ evas_object_smart_callback_add(bt, "clicked", _api_bt_clicked, (void *) api);
+ elm_box_pack_end(bxx, bt);
+ elm_object_disabled_set(bt, api->state == API_STATE_LAST);
+ evas_object_show(bt);
+
+ elm_box_pack_end(bxx, bx);
+
+ cal = elm_calendar_add(win);
+ elm_calendar_first_day_of_week_set(cal, ELM_DAY_MONDAY);
+ evas_object_size_hint_weight_set(cal, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ elm_box_pack_end(bx, cal);
+
+ time_t the_time = (SEC_PER_YEAR * 41) + (SEC_PER_DAY * 9); /* Set date to DEC 31, 2010 */
+ elm_calendar_selected_time_set(cal, gmtime(&the_time));
+ elm_calendar_min_max_year_set(cal, 2010, 2012);
+
+ evas_object_show(cal);
+
+ evas_object_show(win);
+}
+
+void
+_print_cal_info(Evas_Object *cal, Evas_Object *en)
+{
+ char info[1024];
+ double interval;
+ int year_min, year_max;
+ Eina_Bool sel_enabled;
+ const char **wds;
+ struct tm stm;
+
+ if (!elm_calendar_selected_time_get(cal, &stm))
+ return;
+
+ interval = elm_calendar_interval_get(cal);
+ elm_calendar_min_max_year_get(cal, &year_min, &year_max);
+ sel_enabled = !!(elm_calendar_select_mode_get(cal) != ELM_CALENDAR_SELECT_MODE_NONE);
+ wds = elm_calendar_weekdays_names_get(cal);
+
+ snprintf(info, sizeof(info),
+ " Day: %i, Mon: %i, Year %i, WeekDay: %i<br/>"
+ " Interval: %0.2f, Year_Min: %i, Year_Max %i, Sel Enabled : %i<br/>"
+ " Weekdays: %s, %s, %s, %s, %s, %s, %s<br/>",
+ stm.tm_mday, stm.tm_mon, stm.tm_year + 1900, stm.tm_wday,
+ interval, year_min, year_max, sel_enabled,
+ wds[0], wds[1], wds[2], wds[3], wds[4], wds[5], wds[6]);
+
+ elm_object_text_set(en, info);
+}
+
+void
+_print_cal_shown_info(Evas_Object *cal, Evas_Object *en)
+{
+ char info[1024];
+ struct tm stm;
+
+ elm_calendar_displayed_time_get(cal, &stm);
+ snprintf(info, sizeof(info),
+ " Mon: %i, Year %i",
+ stm.tm_mon, stm.tm_year + 1900);
+
+ elm_object_text_set(en, info);
+}
+
+void
+_print_cal_shown_info_cb(void *data, Evas_Object *obj, void *event_info EINA_UNUSED)
+{
+ _print_cal_shown_info(obj, data);
+}
+
+static void
+_print_cal_info_cb(void *data, Evas_Object *obj, void *event_info EINA_UNUSED)
+{
+ _print_cal_info(obj, data);
+}
+
+static char *
+_format_month_year(struct tm *stm)
+{
+ char buf[32];
+ if (!strftime(buf, sizeof(buf), "%b %y", stm)) return NULL;
+ return strdup(buf);
+}
+
+static Evas_Object *
+_calendar_create(Evas_Object *parent)
+{
+ Evas_Object *cal;
+ Elm_Calendar_Mark *mark;
+ struct tm selected_time;
+ time_t current_time;
+ const char *weekdays[] =
+ {
+ "Sunday", "Monday", "Tuesday", "Wednesday",
+ "Thursday", "Friday", "Saturday"
+ };
+
+ cal = elm_calendar_add(parent);
+ elm_calendar_weekdays_names_set(cal, weekdays); // FIXME: this causes smart cal recalc loop error
+ elm_calendar_first_day_of_week_set(cal, ELM_DAY_SATURDAY);
+ elm_calendar_interval_set(cal, 0.4);
+ elm_calendar_format_function_set(cal, _format_month_year);
+ elm_calendar_min_max_year_set(cal, 2010, 2020);
+
+ current_time = time(NULL) + 4 * SEC_PER_DAY;
+ localtime_r(&current_time, &selected_time);
+ elm_calendar_mark_add(cal, "holiday", &selected_time, ELM_CALENDAR_ANNUALLY);
+
+ current_time = time(NULL) + 1 * SEC_PER_DAY;
+ localtime_r(&current_time, &selected_time);
+ elm_calendar_mark_add(cal, "checked", &selected_time, ELM_CALENDAR_UNIQUE);
+
+ current_time = time(NULL) - 363 * SEC_PER_DAY;
+ localtime_r(&current_time, &selected_time);
+ elm_calendar_mark_add(cal, "checked", &selected_time, ELM_CALENDAR_MONTHLY);
+
+ current_time = time(NULL) - 5 * SEC_PER_DAY;
+ localtime_r(&current_time, &selected_time);
+ mark = elm_calendar_mark_add(cal, "holiday", &selected_time,
+ ELM_CALENDAR_WEEKLY);
+
+ current_time = time(NULL) + 1 * SEC_PER_DAY;
+ localtime_r(&current_time, &selected_time);
+ elm_calendar_mark_add(cal, "holiday", &selected_time, ELM_CALENDAR_WEEKLY);
+
+ elm_calendar_mark_del(mark);
+ elm_calendar_marks_draw(cal);
+
+ return cal;
+}
+
+/* A test intended to cover all the calendar api and much use cases as
+ possible */
+void
+test_calendar2(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
+{
+ Evas_Object *win, *bx, *bxh, *cal, *cal2, *cal3, *en;
+ struct tm selected_time;
+ time_t current_time;
+
+ win = elm_win_util_standard_add("calendar2", "Calendar 2");
+ elm_win_autodel_set(win, EINA_TRUE);
+
+ bx = elm_box_add(win);
+ evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ elm_win_resize_object_add(win, bx);
+ evas_object_show(bx);
+
+ bxh = elm_box_add(win);
+ elm_box_horizontal_set(bxh, EINA_TRUE);
+ evas_object_size_hint_weight_set(bxh, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(bxh, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ evas_object_show(bxh);
+ elm_box_pack_end(bx, bxh);
+
+ // calendar 1
+ cal = _calendar_create(win);
+ evas_object_size_hint_weight_set(cal, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(cal, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ evas_object_show(cal);
+ elm_box_pack_end(bx, cal);
+
+ en = elm_entry_add(win);
+ evas_object_size_hint_weight_set(en, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(en, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ evas_object_show(en);
+ elm_box_pack_end(bx, en);
+ elm_entry_editable_set(en, EINA_FALSE);
+
+ _print_cal_info(cal, en);
+ evas_object_smart_callback_add(cal, "changed", _print_cal_info_cb, en);
+
+ // calendar 2
+ cal2 = elm_calendar_add(win);
+ evas_object_size_hint_weight_set(cal2, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(cal2, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ elm_calendar_select_mode_set(cal2, ELM_CALENDAR_SELECT_MODE_NONE);
+ evas_object_show(cal2);
+ elm_box_pack_end(bxh, cal2);
+
+ // calendar 3
+ cal3 = elm_calendar_add(win);
+ evas_object_size_hint_weight_set(cal3, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(cal3, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ current_time = time(NULL) + 34 * SEC_PER_DAY;
+ localtime_r(&current_time, &selected_time);
+ elm_calendar_selected_time_set(cal3, &selected_time);
+ current_time = time(NULL) + 1 * SEC_PER_DAY;
+ localtime_r(&current_time, &selected_time);
+ elm_calendar_mark_add(cal3, "checked", &selected_time, ELM_CALENDAR_UNIQUE);
+ elm_calendar_marks_clear(cal3);
+ current_time = time(NULL);
+ localtime_r(&current_time, &selected_time);
+ elm_calendar_mark_add(cal3, "checked", &selected_time, ELM_CALENDAR_DAILY);
+ elm_calendar_mark_add(cal3, "holiday", &selected_time, ELM_CALENDAR_DAILY);
+ elm_calendar_marks_draw(cal3);
+ evas_object_show(cal3);
+ elm_box_pack_end(bxh, cal3);
+ elm_calendar_min_max_year_set(cal3, -1, -1);
+
+ evas_object_show(win);
+}
+
+void
+test_calendar3(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
+{
+ Evas_Object *win, *cal, *en, *bx;
+ struct tm selected_time;
+ time_t current_time;
+
+ win = elm_win_util_standard_add("calendar", "Calendar");
+ elm_win_autodel_set(win, EINA_TRUE);
+
+ bx = elm_box_add(win);
+ evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ elm_win_resize_object_add(win, bx);
+ evas_object_show(bx);
+
+ en = elm_entry_add(win);
+ evas_object_size_hint_weight_set(en, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(en, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ evas_object_show(en);
+ elm_box_pack_end(bx, en);
+
+ elm_entry_editable_set(en, EINA_FALSE);
+ cal = elm_calendar_add(win);
+ elm_object_style_set(cal, "double_spinners");
+ elm_calendar_first_day_of_week_set(cal, ELM_DAY_THURSDAY);
+ elm_calendar_select_mode_set(cal, ELM_CALENDAR_SELECT_MODE_ONDEMAND);
+ elm_calendar_selectable_set(cal,
+ (ELM_CALENDAR_SELECTABLE_YEAR
+ | ELM_CALENDAR_SELECTABLE_MONTH));
+ current_time = time(NULL) + 34 * SEC_PER_DAY;
+ localtime_r(&current_time, &selected_time);
+ evas_object_size_hint_weight_set(cal, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ elm_box_pack_end(bx, cal);
+
+ evas_object_show(cal);
+ elm_calendar_selected_time_set(cal, &selected_time);
+ _print_cal_shown_info(cal, en);
+ evas_object_smart_callback_add(cal, "display,changed", _print_cal_shown_info_cb, en);
+
+ evas_object_show(win);
+}
diff --git a/src/bin/elementary/test_check.c b/src/bin/elementary/test_check.c
new file mode 100644
index 0000000000..1ee3935cc0
--- /dev/null
+++ b/src/bin/elementary/test_check.c
@@ -0,0 +1,190 @@
+#ifdef HAVE_CONFIG_H
+# include "elementary_config.h"
+#endif
+#include <Elementary.h>
+
+static Eina_Bool eb;
+
+static void
+changed_cb(void *data, Evas_Object *obj, void *event_info EINA_UNUSED)
+{
+ Evas_Object *ck2 = data;
+ printf("ck %p to %i\n", obj, elm_check_state_get(obj));
+ elm_check_state_set(ck2, elm_check_state_get(obj));
+ printf("ck2 %p is now %i\n", ck2, elm_check_state_get(ck2));
+}
+
+static void
+state_changed_cb(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
+{
+ printf("State Pointer Value: %d\n", eb);
+}
+
+void
+test_check(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
+{
+ Evas_Object *win, *bx, *ic, *ck, *ck0;
+ char buf[PATH_MAX];
+
+ win = elm_win_util_standard_add("check", "Check");
+ elm_win_autodel_set(win, EINA_TRUE);
+
+ bx = elm_box_add(win);
+ evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ elm_win_resize_object_add(win, bx);
+ evas_object_show(bx);
+
+ ic = elm_icon_add(win);
+ snprintf(buf, sizeof(buf), "%s/images/logo_small.png", elm_app_data_dir_get());
+ elm_image_file_set(ic, buf, NULL);
+ evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
+ ck = elm_check_add(win);
+ elm_object_text_set(ck, "Icon sized to check");
+ elm_object_part_content_set(ck, "icon", ic);
+ elm_check_state_set(ck, EINA_TRUE);
+ elm_box_pack_end(bx, ck);
+ evas_object_show(ck);
+ evas_object_show(ic);
+
+ ck0 = ck;
+
+ ic = elm_icon_add(win);
+ snprintf(buf, sizeof(buf), "%s/images/logo_small.png", elm_app_data_dir_get());
+ elm_image_file_set(ic, buf, NULL);
+ elm_image_resizable_set(ic, EINA_FALSE, EINA_FALSE);
+ ck = elm_check_add(win);
+ elm_object_text_set(ck, "Icon not resizable");
+ elm_object_part_content_set(ck, "icon", ic);
+ elm_box_pack_end(bx, ck);
+ evas_object_show(ck);
+ evas_object_show(ic);
+
+ evas_object_smart_callback_add(ck, "changed", changed_cb, ck0);
+
+ ck = elm_check_add(win);
+ elm_object_text_set(ck, "Label Only");
+ elm_box_pack_end(bx, ck);
+ evas_object_show(ck);
+
+ ck = elm_check_add(win);
+ elm_object_text_set(ck, "Use State Pointer");
+ elm_check_state_pointer_set(ck, &eb);
+ elm_box_pack_end(bx, ck);
+ evas_object_show(ck);
+
+ ck = elm_check_add(win);
+ elm_object_text_set(ck, "Print State Pointer Value");
+ elm_box_pack_end(bx, ck);
+ evas_object_show(ck);
+ evas_object_smart_callback_add(ck, "changed", state_changed_cb, NULL);
+
+ ic = elm_icon_add(win);
+ snprintf(buf, sizeof(buf), "%s/images/logo_small.png", elm_app_data_dir_get());
+ elm_image_file_set(ic, buf, NULL);
+ evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
+ ck = elm_check_add(win);
+ elm_object_text_set(ck, "Disabled check");
+ elm_object_part_content_set(ck, "icon", ic);
+ elm_check_state_set(ck, EINA_TRUE);
+ elm_box_pack_end(bx, ck);
+ elm_object_disabled_set(ck, EINA_TRUE);
+ evas_object_show(ck);
+ evas_object_show(ic);
+
+ ck = elm_check_add(win);
+ elm_box_pack_end(bx, ck);
+ elm_object_disabled_set(ck, EINA_TRUE);
+ evas_object_show(ck);
+
+ ic = elm_icon_add(win);
+ snprintf(buf, sizeof(buf), "%s/images/logo_small.png", elm_app_data_dir_get());
+ elm_image_file_set(ic, buf, NULL);
+ elm_image_resizable_set(ic, EINA_FALSE, EINA_FALSE);
+ ck = elm_check_add(win);
+ elm_object_part_content_set(ck, "icon", ic);
+ elm_box_pack_end(bx, ck);
+ evas_object_show(ck);
+ evas_object_show(ic);
+
+ evas_object_show(win);
+}
+
+void
+test_check_toggle(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
+{
+ Evas_Object *win, *bx, *ic, *tg;
+ char buf[PATH_MAX];
+
+ win = elm_win_util_standard_add("check-toggle", "Check Toggle");
+ elm_win_autodel_set(win, EINA_TRUE);
+
+ bx = elm_box_add(win);
+ evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ elm_win_resize_object_add(win, bx);
+ evas_object_show(bx);
+
+ ic = elm_icon_add(win);
+ snprintf(buf, sizeof(buf), "%s/images/logo_small.png", elm_app_data_dir_get());
+ elm_image_file_set(ic, buf, NULL);
+ evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
+
+ tg = elm_check_add(win);
+ elm_object_style_set(tg, "toggle");
+ elm_object_text_set(tg, "Icon sized to toggle");
+ elm_object_part_content_set(tg, "icon", ic);
+ elm_check_state_set(tg, EINA_TRUE);
+ elm_object_part_text_set(tg, "on", "Yes");
+ elm_object_part_text_set(tg, "off", "No");
+ elm_box_pack_end(bx, tg);
+ evas_object_show(tg);
+ evas_object_show(ic);
+
+ ic = elm_icon_add(win);
+ snprintf(buf, sizeof(buf), "%s/images/logo_small.png", elm_app_data_dir_get());
+ elm_image_file_set(ic, buf, NULL);
+ elm_image_resizable_set(ic, EINA_FALSE, EINA_FALSE);
+
+ tg = elm_check_add(win);
+ elm_object_style_set(tg, "toggle");
+ elm_object_text_set(tg, "Icon no scale");
+ elm_object_part_content_set(tg, "icon", ic);
+ elm_box_pack_end(bx, tg);
+ evas_object_show(tg);
+ evas_object_show(ic);
+
+ ic = elm_icon_add(win);
+ snprintf(buf, sizeof(buf), "%s/images/logo_small.png", elm_app_data_dir_get());
+ elm_image_file_set(ic, buf, NULL);
+ elm_image_resizable_set(ic, EINA_FALSE, EINA_FALSE);
+
+ tg = elm_check_add(win);
+ elm_object_style_set(tg, "toggle");
+ elm_object_text_set(tg, "Disabled toggle");
+ elm_object_part_content_set(tg, "icon", ic);
+ elm_object_disabled_set(tg, EINA_TRUE);
+ elm_box_pack_end(bx, tg);
+ evas_object_show(tg);
+ evas_object_show(ic);
+
+ tg = elm_check_add(win);
+ elm_object_style_set(tg, "toggle");
+ elm_object_text_set(tg, "Label Only");
+ elm_object_part_text_set(tg, "on", "Big long fun times label");
+ elm_object_part_text_set(tg, "off", "Small long happy fun label");
+ elm_box_pack_end(bx, tg);
+ evas_object_show(tg);
+
+ ic = elm_icon_add(win);
+ snprintf(buf, sizeof(buf), "%s/images/logo_small.png", elm_app_data_dir_get());
+ elm_image_file_set(ic, buf, NULL);
+ elm_image_resizable_set(ic, EINA_FALSE, EINA_FALSE);
+
+ tg = elm_check_add(win);
+ elm_object_style_set(tg, "toggle");
+ elm_object_part_content_set(tg, "icon", ic);
+ elm_box_pack_end(bx, tg);
+ evas_object_show(tg);
+ evas_object_show(ic);
+
+ evas_object_show(win);
+}
diff --git a/src/bin/elementary/test_clock.c b/src/bin/elementary/test_clock.c
new file mode 100644
index 0000000000..fdb096faa0
--- /dev/null
+++ b/src/bin/elementary/test_clock.c
@@ -0,0 +1,363 @@
+#ifdef HAVE_CONFIG_H
+# include "elementary_config.h"
+#include "test.h"
+#endif
+#include <Elementary.h>
+
+struct _api_data
+{
+ unsigned int state; /* What state we are testing */
+ Evas_Object *box; /* Used in set_api_state */
+};
+typedef struct _api_data api_data;
+
+enum _api_state
+{
+ CLOCK_HIDE_SEC,
+ CLOCK_SHOW_AM_PM,
+ CLOCK_SHOW_SEC,
+ CLOCK_EDIT_MIN,
+ CLOCK_EDIT_HOUR,
+ CLOCK_EDIT_ALL,
+ CLOCK_HIDE_AM_PM,
+ API_STATE_LAST
+};
+typedef enum _api_state api_state;
+
+static const char* api_state_description[] = {
+ "Hide Sec",
+ "Show AM/PM",
+ "Show Sec",
+ "Edit Min",
+ "Edit Hour",
+ "Edit All",
+ "Hide AM/PM",
+ NULL
+};
+
+static void
+set_api_state(api_data *api)
+{
+ const Eina_List *items = elm_box_children_get(api->box);
+ Evas_Object *ck = eina_list_nth(items, 0);
+ if (!eina_list_count(items))
+ return;
+
+ /* use elm_box_children_get() to get list of children */
+ switch(api->state)
+ { /* Put all api-changes under switch */
+ case CLOCK_HIDE_SEC:
+ elm_clock_show_seconds_set(ck, EINA_FALSE);
+ break;
+
+ case CLOCK_SHOW_AM_PM:
+ elm_clock_show_am_pm_set(ck, EINA_TRUE);
+ break;
+
+ case CLOCK_SHOW_SEC:
+ elm_clock_show_seconds_set(ck, EINA_TRUE);
+ break;
+
+ case CLOCK_EDIT_MIN:
+ elm_clock_edit_set(ck, EINA_TRUE);
+ elm_clock_edit_mode_set(ck, ELM_CLOCK_EDIT_MIN_DECIMAL | ELM_CLOCK_EDIT_MIN_UNIT);
+ break;
+
+ case CLOCK_EDIT_HOUR:
+ elm_clock_edit_set(ck, EINA_TRUE);
+ elm_clock_edit_mode_set(ck, ELM_CLOCK_EDIT_HOUR_DECIMAL | ELM_CLOCK_EDIT_HOUR_UNIT);
+ break;
+
+ case CLOCK_EDIT_ALL:
+ elm_clock_edit_set(ck, EINA_TRUE);
+ elm_clock_edit_mode_set(ck, ELM_CLOCK_EDIT_ALL);
+ break;
+
+ case CLOCK_HIDE_AM_PM:
+ elm_clock_show_am_pm_set(ck, EINA_FALSE);
+ break;
+
+ case API_STATE_LAST:
+
+ break;
+ default:
+ return;
+ }
+}
+
+static void
+_api_bt_clicked(void *data, Evas_Object *obj, void *event_info EINA_UNUSED)
+{ /* Will add here a SWITCH command containing code to modify test-object */
+ /* in accordance a->state value. */
+ api_data *a = data;
+ char str[128];
+
+ printf("clicked event on API Button: api_state=<%s>\n", api_state_description[a->state]);
+ set_api_state(a);
+ a->state++;
+ sprintf(str, "Next API function (%u)", a->state);
+ elm_object_text_set(obj, str);
+ elm_object_disabled_set(obj, a->state == API_STATE_LAST);
+}
+
+static void
+_cleanup_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
+{
+ free(data);
+}
+
+void
+test_clock(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
+{
+ Evas_Object *win, *bx, *ck, *bt, *bxx;
+ unsigned int digedit;
+ api_data *api = calloc(1, sizeof(api_data));
+
+ win = elm_win_util_standard_add("clock", "Clock");
+ elm_win_autodel_set(win, EINA_TRUE);
+ evas_object_event_callback_add(win, EVAS_CALLBACK_FREE, _cleanup_cb, api);
+
+ bxx = elm_box_add(win);
+ evas_object_size_hint_weight_set(bxx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ elm_win_resize_object_add(win, bxx);
+ evas_object_show(bxx);
+
+ bx = elm_box_add(bxx);
+ evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ api->box = bx;
+ evas_object_show(bx);
+
+ bt = elm_button_add(bxx);
+ elm_object_text_set(bt, "Next API function");
+ evas_object_smart_callback_add(bt, "clicked", _api_bt_clicked, (void *) api);
+ elm_box_pack_end(bxx, bt);
+ elm_object_disabled_set(bt, EINA_TRUE);
+ evas_object_show(bt);
+
+ elm_box_pack_end(bxx, bx);
+
+ ck = elm_clock_add(bx);
+ elm_box_pack_end(bx, ck);
+ evas_object_show(ck);
+
+ ck = elm_clock_add(bx);
+ elm_clock_show_am_pm_set(ck, EINA_TRUE);
+ elm_box_pack_end(bx, ck);
+ elm_clock_time_set(ck, 17, 25, 0);
+ evas_object_show(ck);
+
+ ck = elm_clock_add(bx);
+ elm_clock_show_seconds_set(ck, EINA_TRUE);
+ elm_box_pack_end(bx, ck);
+ evas_object_show(ck);
+
+ ck = elm_clock_add(bx);
+ elm_clock_show_seconds_set(ck, EINA_TRUE);
+ elm_clock_show_am_pm_set(ck, EINA_TRUE);
+ elm_box_pack_end(bx, ck);
+ elm_clock_time_set(ck, 11, 59, 57);
+ evas_object_show(ck);
+
+ ck = elm_clock_add(bx);
+ elm_clock_show_seconds_set(ck, EINA_TRUE);
+ elm_clock_show_am_pm_set(ck, EINA_FALSE);
+ elm_clock_time_set(ck, 23, 59, 57);
+ elm_box_pack_end(bx, ck);
+ evas_object_show(ck);
+
+ ck = elm_clock_add(bx);
+ elm_clock_edit_set(ck, EINA_TRUE);
+ elm_clock_show_seconds_set(ck, EINA_TRUE);
+ elm_clock_show_am_pm_set(ck, EINA_TRUE);
+ elm_clock_time_set(ck, 10, 11, 12);
+ elm_box_pack_end(bx, ck);
+ evas_object_show(ck);
+
+ ck = elm_clock_add(bx);
+ elm_clock_show_seconds_set(ck, EINA_TRUE);
+ elm_clock_edit_set(ck, EINA_TRUE);
+ digedit = ELM_CLOCK_EDIT_HOUR_UNIT | ELM_CLOCK_EDIT_MIN_UNIT | ELM_CLOCK_EDIT_SEC_UNIT;
+ elm_clock_edit_mode_set(ck, digedit);
+ elm_box_pack_end(bx, ck);
+ elm_clock_time_set(ck, 0, 0, 0);
+ evas_object_show(ck);
+
+ evas_object_show(win);
+}
+
+static void
+_edit_bt_clicked(void *data, Evas_Object *obj, void *event_info EINA_UNUSED)
+{
+ Evas_Object *ck = data;
+
+ if (!elm_clock_edit_get(ck))
+ {
+ elm_object_text_set(obj, "Done");
+ elm_clock_edit_set(ck, EINA_TRUE);
+ return;
+ }
+ elm_object_text_set(obj, "Edit");
+ elm_clock_edit_set(ck, EINA_FALSE);
+}
+
+static void
+_hmode_bt_clicked(void *data, Evas_Object *obj, void *event_info EINA_UNUSED)
+{
+ Evas_Object *ck = data;
+
+ if (!elm_clock_show_am_pm_get(ck))
+ {
+ elm_object_text_set(obj, "24h");
+ elm_clock_show_am_pm_set(ck, EINA_TRUE);
+ return;
+ }
+ elm_object_text_set(obj, "12h");
+ elm_clock_show_am_pm_set(ck, EINA_FALSE);
+}
+
+static void
+_pause_resume_bt_clicked(void *data, Evas_Object *obj, void *event_info EINA_UNUSED)
+{
+ Evas_Object *ck = data;
+
+ if (!elm_clock_pause_get(ck))
+ {
+ elm_object_text_set(obj, "Resume");
+ elm_clock_pause_set(ck, EINA_TRUE);
+ return;
+ }
+ elm_object_text_set(obj, "Pause");
+ elm_clock_pause_set(ck, EINA_FALSE);
+}
+
+void
+test_clock_edit(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
+{
+ Evas_Object *win, *bx, *hbx, *ck, *bt, *bxx;
+ api_data *api = calloc(1, sizeof(api_data));
+
+ win = elm_win_util_standard_add("clock-edit", "Clock Edit");
+ elm_win_autodel_set(win, EINA_TRUE);
+ evas_object_event_callback_add(win, EVAS_CALLBACK_FREE, _cleanup_cb, api);
+
+ bxx = elm_box_add(win);
+ evas_object_size_hint_weight_set(bxx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ elm_win_resize_object_add(win, bxx);
+ evas_object_show(bxx);
+
+ bx = elm_box_add(bxx);
+ evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ api->box = bx;
+ evas_object_show(bx);
+
+ bt = elm_button_add(bxx);
+ elm_object_text_set(bt, "Next API function");
+ evas_object_smart_callback_add(bt, "clicked", _api_bt_clicked, (void *) api);
+ elm_box_pack_end(bxx, bt);
+ elm_object_disabled_set(bt, api->state == API_STATE_LAST);
+ evas_object_show(bt);
+
+ elm_box_pack_end(bxx, bx);
+
+ ck = elm_clock_add(bx);
+ elm_clock_time_set(ck, 0, 15, 3);
+ elm_clock_edit_mode_set(ck, ELM_CLOCK_EDIT_DEFAULT);
+ elm_clock_show_seconds_set(ck, EINA_TRUE);
+ elm_clock_show_am_pm_set(ck, EINA_TRUE);
+ elm_box_pack_end(bx, ck);
+ evas_object_show(ck);
+
+ hbx = elm_box_add(bx);
+ evas_object_size_hint_weight_set(hbx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ elm_box_horizontal_set(hbx, EINA_TRUE);
+ elm_box_pack_end(bx, hbx);
+ evas_object_show(hbx);
+
+ bt = elm_button_add(hbx);
+ elm_object_text_set(bt, "Edit");
+ evas_object_smart_callback_add(bt, "clicked", _edit_bt_clicked, ck);
+ elm_box_pack_end(hbx, bt);
+ evas_object_show(bt);
+
+ bt = elm_button_add(hbx);
+ elm_object_text_set(bt, "24h");
+ evas_object_smart_callback_add(bt, "clicked", _hmode_bt_clicked, ck);
+ elm_box_pack_end(hbx, bt);
+ evas_object_show(bt);
+
+ evas_object_show(win);
+}
+
+void
+test_clock_edit2(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
+{
+ Evas_Object *win, *bx, *ck, *lb;
+
+ win = elm_win_util_standard_add("clock-edit2", "Clock Edit 2");
+ elm_win_autodel_set(win, EINA_TRUE);
+
+ bx = elm_box_add(win);
+ evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ elm_win_resize_object_add(win, bx);
+ evas_object_show(bx);
+
+ lb = elm_label_add(win);
+ elm_object_text_set(lb,
+ "Check time updates for a user mouse button hold."
+ );
+ evas_object_size_hint_weight_set(lb, 0.0, 0.0);
+ evas_object_size_hint_align_set(lb, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ elm_box_pack_end(bx, lb);
+ evas_object_show(lb);
+
+ ck = elm_clock_add(win);
+ elm_clock_show_seconds_set(ck, 1);
+ elm_clock_edit_set(ck, EINA_TRUE);
+ elm_clock_first_interval_set(ck, 0.4);
+ elm_box_pack_end(bx, ck);
+ evas_object_show(ck);
+
+ ck = elm_clock_add(win);
+ elm_clock_show_seconds_set(ck, 1);
+ elm_clock_edit_set(ck, EINA_TRUE);
+ elm_clock_first_interval_set(ck, 1.2);
+ elm_box_pack_end(bx, ck);
+ evas_object_show(ck);
+
+ ck = elm_clock_add(win);
+ elm_clock_show_seconds_set(ck, 1);
+ elm_clock_edit_set(ck, EINA_TRUE);
+ elm_clock_first_interval_set(ck, 2.0);
+ elm_box_pack_end(bx, ck);
+ evas_object_show(ck);
+
+ evas_object_show(win);
+}
+
+void
+test_clock_pause(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
+{
+ Evas_Object *win, *bx, *ck, *bt;
+
+ win = elm_win_util_standard_add("clock4", "Clock4");
+ elm_win_autodel_set(win, EINA_TRUE);
+
+ bx = elm_box_add(win);
+ evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ elm_win_resize_object_add(win, bx);
+ evas_object_show(bx);
+
+ ck = elm_clock_add(win);
+ elm_clock_show_seconds_set(ck, EINA_TRUE);
+ elm_clock_time_set(ck, 0, 0, 0);
+ elm_box_pack_end(bx, ck);
+ evas_object_show(ck);
+
+ bt = elm_button_add(win);
+ elm_object_text_set(bt, "Pause");
+ evas_object_smart_callback_add(bt, "clicked", _pause_resume_bt_clicked, ck);
+ elm_box_pack_end(bx, bt);
+ evas_object_show(bt);
+
+ evas_object_show(win);
+}
diff --git a/src/bin/elementary/test_cnp.c b/src/bin/elementary/test_cnp.c
new file mode 100644
index 0000000000..35de89e93d
--- /dev/null
+++ b/src/bin/elementary/test_cnp.c
@@ -0,0 +1,135 @@
+#ifdef HAVE_CONFIG_H
+# include "elementary_config.h"
+#endif
+#include <Elementary.h>
+
+static Evas_Object *glb;
+
+static void
+_bt_copy_clicked(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
+{
+ Evas_Object *en = data;
+ const char *txt = elm_object_text_get(en);
+
+ elm_object_text_set(glb, txt);
+ elm_cnp_selection_set(elm_object_parent_widget_get(en), ELM_SEL_TYPE_CLIPBOARD,
+ ELM_SEL_FORMAT_TEXT, txt, strlen(txt));
+}
+
+static Eina_Bool
+_selection(void *data, Evas_Object *obj EINA_UNUSED, Elm_Selection_Data *ev)
+{
+ Evas_Object *en = data;
+ const char *fmt = NULL;
+
+ switch (ev->format)
+ {
+ case ELM_SEL_FORMAT_TARGETS: fmt = "TARGETS"; break;
+ case ELM_SEL_FORMAT_NONE: fmt = "NONE"; break;
+ case ELM_SEL_FORMAT_TEXT: fmt = "TEXT"; break;
+ case ELM_SEL_FORMAT_MARKUP: fmt = "MARKUP"; break;
+ case ELM_SEL_FORMAT_IMAGE: fmt = "IMAGE"; break;
+ case ELM_SEL_FORMAT_VCARD: fmt = "VCARD"; break;
+ case ELM_SEL_FORMAT_HTML: fmt = "HTML"; break;
+ }
+ fprintf(stderr, "got selection type '%s': length %zu\n", fmt, ev->len);
+
+ if (ev->format == ELM_SEL_FORMAT_TEXT)
+ {
+ char *stripstr;
+
+ stripstr = malloc(ev->len + 1);
+ strncpy(stripstr, (char *)ev->data, ev->len);
+ stripstr[ev->len] = '\0';
+ elm_entry_entry_insert(en, stripstr);
+ free(stripstr);
+ }
+
+ return EINA_TRUE;
+}
+
+static void
+_bt_paste_clicked(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
+{
+ Evas_Object *en = data;
+
+ elm_cnp_selection_get(en, ELM_SEL_TYPE_CLIPBOARD, ELM_SEL_FORMAT_TEXT,
+ _selection, en);
+}
+
+static void
+_bt_clear_clicked(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
+{
+ Evas_Object *en = data;
+
+ elm_object_text_set(glb, "");
+ elm_object_cnp_selection_clear(elm_object_parent_widget_get(en), ELM_SEL_TYPE_CLIPBOARD);
+}
+
+void
+test_cnp(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
+{
+ Evas_Object *win, *gd, *bt, *en, *lb;
+
+ win = elm_win_util_standard_add("copypaste", "CopyPaste");
+ elm_win_autodel_set(win, EINA_TRUE);
+
+ gd = elm_grid_add(win);
+ elm_grid_size_set(gd, 100, 100);
+ evas_object_size_hint_weight_set(gd, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ elm_win_resize_object_add(win, gd);
+ evas_object_show(gd);
+
+ en = elm_entry_add(win);
+ elm_entry_scrollable_set(en, EINA_TRUE);
+ elm_entry_line_wrap_set(en, ELM_WRAP_CHAR);
+ evas_object_size_hint_weight_set(en, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(en, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ elm_object_text_set(en, "Elementary provides ");
+ elm_grid_pack(gd, en, 10, 10, 60, 30);
+ evas_object_show(en);
+
+ bt = elm_button_add(win);
+ elm_object_text_set(bt, "Copy from left entry");
+ evas_object_smart_callback_add(bt, "clicked", _bt_copy_clicked, en);
+ elm_grid_pack(gd, bt, 70, 10, 22, 30);
+ evas_object_show(bt);
+
+ bt = elm_button_add(win);
+ elm_object_text_set(bt, "Clear clipboard");
+ evas_object_smart_callback_add(bt, "clicked", _bt_clear_clicked, en);
+ elm_grid_pack(gd, bt, 70, 70, 22, 20);
+ evas_object_show(bt);
+
+ en = elm_entry_add(win);
+ elm_entry_scrollable_set(en, EINA_TRUE);
+ elm_entry_line_wrap_set(en, ELM_WRAP_CHAR);
+ evas_object_size_hint_weight_set(en, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(en, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ elm_object_text_set(en, "rich copying and pasting functionality,");
+ elm_grid_pack(gd, en, 10, 40, 60, 30);
+ evas_object_show(en);
+
+ bt = elm_button_add(win);
+ elm_object_text_set(bt, "Paste to left entry");
+ evas_object_smart_callback_add(bt, "clicked", _bt_paste_clicked, en);
+ elm_grid_pack(gd, bt, 70, 40, 22, 30);
+ evas_object_show(bt);
+
+ lb = elm_label_add(win);
+ elm_object_text_set(lb, "<b>Clipboard:</b>");
+ evas_object_size_hint_weight_set(lb, 0.0, 0.0);
+ evas_object_size_hint_align_set(lb, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ elm_grid_pack(gd, lb, 10, 70, 60, 10);
+ evas_object_show(lb);
+
+ glb = elm_label_add(win);
+ elm_object_text_set(glb, "");
+ evas_object_size_hint_weight_set(glb, 0.0, 0.0);
+ evas_object_size_hint_align_set(glb, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ elm_grid_pack(gd, glb, 10, 80, 60, 10);
+ evas_object_show(glb);
+
+ evas_object_resize(win, 480, 200);
+ evas_object_show(win);
+}
diff --git a/src/bin/elementary/test_colorclass.c b/src/bin/elementary/test_colorclass.c
new file mode 100644
index 0000000000..8764065891
--- /dev/null
+++ b/src/bin/elementary/test_colorclass.c
@@ -0,0 +1,24 @@
+#ifdef HAVE_CONFIG_H
+# include "elementary_config.h"
+#endif
+#include <Elementary.h>
+
+
+void
+test_colorclass(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
+{
+ Evas_Object *win, *cc;
+
+ win = elm_win_util_standard_add("colorclass", "Color Classes");
+ elm_win_autodel_set(win, EINA_TRUE);
+
+ cc = elm_color_class_editor_add(win);
+ elm_win_resize_object_add(win, cc);
+ evas_object_size_hint_weight_set(cc, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(cc, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ evas_object_show(cc);
+
+ evas_object_show(win);
+ evas_object_size_hint_min_set(win, 400, 280);
+ evas_object_resize(win, 400, 280);
+}
diff --git a/src/bin/elementary/test_colorselector.c b/src/bin/elementary/test_colorselector.c
new file mode 100644
index 0000000000..d1a6febebd
--- /dev/null
+++ b/src/bin/elementary/test_colorselector.c
@@ -0,0 +1,212 @@
+#ifdef HAVE_CONFIG_H
+# include "elementary_config.h"
+#endif
+#include <Elementary.h>
+
+static void
+_colorselector_changed_cb(void *data, Evas_Object *obj,
+ void *event_info EINA_UNUSED)
+{
+ Evas_Object *re = data;
+ int r, g, b, a;
+
+ elm_colorselector_color_get(obj, &r, &g, &b, &a);
+ printf("Changed Color [r=%d g=%d b=%d a=%d]\n", r, g, b, a);
+ evas_color_argb_premul(a, &r, &g, &b);
+ evas_object_color_set(re, r, g, b, a);
+}
+
+static void
+_color_item_selected_cb(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
+ void *event_info)
+{
+ int r = 0, g = 0, b = 0 ,a = 0;
+ Elm_Object_Item *color_it = event_info;
+
+ elm_colorselector_palette_item_color_get(color_it, &r, &g, &b, &a);
+ printf("Selected Color Palette [r=%d g=%d b=%d a=%d]\n", r, g, b, a);
+}
+
+static void
+_color_item_longpressed_cb(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
+ void *event_info)
+{
+ int r = 0,g = 0,b = 0 ,a = 0;
+ Elm_Object_Item *color_it = event_info;
+
+ elm_colorselector_palette_item_color_get(color_it, &r, &g, &b, &a);
+ printf("Longpressed color item : %p, color = %d-%d-%d-%d\n",
+ color_it, r, g, b, a);
+}
+
+static void
+_palette_cb(void *data, Evas_Object *obj EINA_UNUSED,
+ void *event_info EINA_UNUSED)
+{
+ Evas_Object *cs = data;
+ elm_colorselector_mode_set(cs, ELM_COLORSELECTOR_PALETTE);
+}
+
+static void
+_components_cb(void *data, Evas_Object *obj EINA_UNUSED,
+ void *event_info EINA_UNUSED)
+{
+ Evas_Object *cs = data;
+ elm_colorselector_mode_set(cs, ELM_COLORSELECTOR_COMPONENTS);
+}
+
+static void
+_both_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
+{
+ Evas_Object *cs = data;
+ elm_colorselector_mode_set(cs, ELM_COLORSELECTOR_BOTH);
+}
+
+static void
+_picker_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
+{
+ Evas_Object *cs = data;
+ elm_colorselector_mode_set(cs, ELM_COLORSELECTOR_PICKER);
+}
+
+static void
+_all_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
+{
+ Evas_Object *cs = data;
+ elm_colorselector_mode_set(cs, ELM_COLORSELECTOR_ALL);
+}
+
+void
+test_colorselector(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
+ void *event_info EINA_UNUSED)
+{
+ Evas_Object *win, *bx, *bx2, *cs, *fr, *re, *bt;
+ const Eina_List *item_list, *last_item_list;
+ Elm_Object_Item *color_item;
+ int r, g, b, a;
+ Elm_Object_Item *item;
+
+ win = elm_win_util_standard_add("colorselector", "ColorSelector");
+ elm_win_autodel_set(win, EINA_TRUE);
+
+ bx = elm_box_add(win);
+ evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ elm_win_resize_object_add(win, bx);
+ evas_object_show(bx);
+
+ fr = elm_frame_add(bx);
+ evas_object_size_hint_weight_set(fr, EVAS_HINT_EXPAND, 0);
+ evas_object_size_hint_align_set(fr, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ elm_object_text_set(fr, "Color View");
+ elm_box_pack_end(bx, fr);
+ evas_object_show(fr);
+
+ re = evas_object_rectangle_add(evas_object_evas_get(win));
+ evas_object_size_hint_min_set(re, 1, ELM_SCALE_SIZE(100));
+ evas_object_show(re);
+ elm_object_content_set(fr, re);
+
+ fr = elm_frame_add(bx);
+ evas_object_size_hint_weight_set(fr, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(fr, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ elm_object_text_set(fr, "Color Selector");
+ elm_box_pack_end(bx, fr);
+ evas_object_show(fr);
+
+ cs = elm_colorselector_add(fr);
+ item = elm_colorselector_palette_color_add(cs, 0, 0, 0, 255);
+ elm_colorselector_palette_item_selected_set(item, EINA_TRUE);
+
+ elm_colorselector_palette_color_add(cs, 255, 255, 255, 255);
+ elm_colorselector_palette_color_add(cs, 255, 0, 0, 255);
+ elm_colorselector_palette_color_add(cs, 0, 255, 0, 255);
+ elm_colorselector_palette_color_add(cs, 0, 0, 255, 255);
+ elm_colorselector_palette_color_add(cs, 255, 255, 0, 255);
+ elm_colorselector_palette_color_add(cs, 0, 255, 255, 255);
+ elm_colorselector_palette_color_add(cs, 255, 0, 255, 255);
+ elm_colorselector_palette_color_add(cs, 192, 192, 192, 255);
+ elm_colorselector_palette_color_add(cs, 128, 128, 128, 255);
+ elm_colorselector_palette_color_add(cs, 128, 0, 0, 255);
+ elm_colorselector_palette_color_add(cs, 128, 128, 0, 255);
+ elm_colorselector_palette_color_add(cs, 0, 128, 0, 255);
+ elm_colorselector_palette_color_add(cs, 128, 0, 128, 255);
+ elm_colorselector_palette_color_add(cs, 0, 128, 128, 255);
+ elm_colorselector_palette_color_add(cs, 0, 100, 128, 255);
+
+ item_list = elm_colorselector_palette_items_get(cs);
+ last_item_list = eina_list_last(item_list);
+ color_item = eina_list_data_get(last_item_list);
+ elm_colorselector_palette_item_color_set(color_item, 0, 0, 128, 255);
+
+ a = 180;
+ r = 255;
+ g = 160;
+ b = 132;
+
+ elm_colorselector_color_set(cs, r, g, b, a);
+ evas_object_size_hint_weight_set(cs, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(cs, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ elm_object_content_set(fr, cs);
+ evas_object_show(cs);
+ evas_object_smart_callback_add(cs, "changed", _colorselector_changed_cb, re);
+ evas_object_smart_callback_add(cs, "color,item,selected",
+ _color_item_selected_cb, re);
+ evas_object_smart_callback_add(cs, "color,item,longpressed",
+ _color_item_longpressed_cb, re);
+
+ elm_colorselector_color_get(cs, &r, &g, &b, &a);
+ /* Fix Alpha pre multiplication by edje */
+ r = (r * a) / 255;
+ g = (g * a) / 255;
+ b = (b * a) / 255;
+ evas_object_color_set(re, r, g, b, a);
+
+ bx2 = elm_box_add(bx);
+ elm_box_horizontal_set(bx2, EINA_TRUE);
+ evas_object_size_hint_weight_set(bx2, EVAS_HINT_EXPAND, 0);
+ evas_object_size_hint_align_set(bx2, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ evas_object_show(bx2);
+ elm_box_pack_end(bx, bx2);
+
+ bt = elm_button_add(bx2);
+ evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ evas_object_smart_callback_add(bt, "clicked", _palette_cb, cs);
+ elm_object_text_set(bt, "Palette");
+ evas_object_show(bt);
+ elm_box_pack_end(bx2, bt);
+
+ bt = elm_button_add(bx2);
+ evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ evas_object_smart_callback_add(bt, "clicked", _components_cb, cs);
+ elm_object_text_set(bt, "Components");
+ evas_object_show(bt);
+ elm_box_pack_end(bx2, bt);
+
+ bt = elm_button_add(bx2);
+ evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ evas_object_smart_callback_add(bt, "clicked", _both_cb, cs);
+ elm_object_text_set(bt, "Both");
+ evas_object_show(bt);
+ elm_box_pack_end(bx2, bt);
+
+ bt = elm_button_add(bx2);
+ evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ evas_object_smart_callback_add(bt, "clicked", _picker_cb, cs);
+ elm_object_text_set(bt, "Picker");
+ evas_object_show(bt);
+ elm_box_pack_end(bx2, bt);
+
+ bt = elm_button_add(bx2);
+ evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ evas_object_smart_callback_add(bt, "clicked", _all_cb, cs);
+ elm_object_text_set(bt, "All");
+ evas_object_show(bt);
+ elm_box_pack_end(bx2, bt);
+
+ evas_object_show(win);
+}
diff --git a/src/bin/elementary/test_combobox.c b/src/bin/elementary/test_combobox.c
new file mode 100644
index 0000000000..baa6962cc3
--- /dev/null
+++ b/src/bin/elementary/test_combobox.c
@@ -0,0 +1,278 @@
+#include "test.h"
+#ifdef HAVE_CONFIG_H
+# include "elementary_config.h"
+#endif
+#include <Elementary.h>
+
+static void
+_combobox_clicked_cb(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
+ void *event_info EINA_UNUSED)
+{
+ printf("Hover button is clicked and 'clicked' callback is called.\n");
+}
+
+static void
+_combobox_item_selected_cb(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
+ void *event_info)
+{
+ const char *txt = elm_object_item_text_get(event_info);
+ printf("'item,selected' callback is called. (selected item : %s)\n", txt);
+}
+
+static void
+_combobox_dismissed_cb(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
+ void *event_info EINA_UNUSED)
+{
+ printf("'dismissed' callback is called.\n");
+}
+
+static void
+_combobox_expanded_cb(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
+ void *event_info EINA_UNUSED)
+{
+ printf("'expanded' callback is called.\n");
+}
+
+static void
+_combobox_item_pressed_cb(void *data EINA_UNUSED, Evas_Object *obj,
+ void *event_info)
+{
+ const char *txt = elm_object_item_text_get(event_info);
+ printf("'item,pressed' callback is called. (selected item : %s)\n", txt);
+ elm_object_text_set(obj, txt);
+ elm_combobox_hover_end(obj);
+ elm_entry_cursor_end_set(obj);
+}
+
+static char *
+gl_text_get(void *data, Evas_Object *obj EINA_UNUSED, const char *part EINA_UNUSED)
+{
+ char buf[256];
+ snprintf(buf, sizeof(buf), "Item # %i", (int)(uintptr_t)data);
+ return strdup(buf);
+}
+
+static char *
+gl2_text_get(void *data, Evas_Object *obj EINA_UNUSED, const char *part EINA_UNUSED)
+{
+ char buf[256];
+ snprintf(buf, sizeof(buf), "%s", (char*)data);
+ return strdup(buf);
+}
+
+static Evas_Object *gl_content_get(void *data EINA_UNUSED, Evas_Object *obj,
+ const char *part)
+{
+ char buf[PATH_MAX];
+ Evas_Object *ic = elm_icon_add(obj);
+ if (!strcmp(part, "elm.swallow.end"))
+ snprintf(buf, sizeof(buf), "%s/images/bubble.png", elm_app_data_dir_get());
+ else
+ snprintf(buf, sizeof(buf), "%s/images/logo_small.png", elm_app_data_dir_get());
+ elm_image_file_set(ic, buf, NULL);
+ evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
+ return ic;
+}
+
+static Eina_Bool gl_state_get(void *data EINA_UNUSED,
+ Evas_Object *obj EINA_UNUSED,
+ const char *part EINA_UNUSED)
+{
+ return EINA_FALSE;
+}
+
+static Eina_Bool
+gl_filter_get(void *data, Evas_Object *obj EINA_UNUSED, void *key)
+{
+ char buf[256];
+ // if the key is empty/NULL, return true for item
+ if (!strlen((char *)key)) return EINA_TRUE;
+ snprintf(buf, sizeof(buf), "Item # %i", (int)(uintptr_t)data);
+ if (strcasestr(buf, (char *)key))
+ return EINA_TRUE;
+ // Default case should return false (item fails filter hence will be hidden)
+ return EINA_FALSE;
+}
+
+static void
+_gl_filter_restart_cb(void *data EINA_UNUSED,
+ Evas_Object *obj,
+ void *event_info EINA_UNUSED)
+{
+ elm_genlist_filter_set(obj, (void *)elm_object_text_get(obj));
+}
+
+static void
+_gl2_filter_restart_cb(void *data EINA_UNUSED,
+ Evas_Object *obj,
+ void *event_info EINA_UNUSED)
+{
+ elm_genlist_filter_set(obj, (void *)elm_object_text_get(elm_multibuttonentry_entry_get(obj)));
+}
+
+static Eina_Bool
+gl2_filter_get(void *data, Evas_Object *obj EINA_UNUSED, void *key)
+{
+ char buf[256];
+ // if the key is empty/NULL, return true for item
+ if (!strlen((char *)key)) return EINA_TRUE;
+ snprintf(buf, sizeof(buf), "%s", (char*)data);
+ if (!strncmp(buf, (char *)key, strlen((char*)key)))
+ return EINA_TRUE;
+ // Default case should return false (item fails filter hence will be hidden)
+ return EINA_FALSE;
+}
+
+static void
+_gl_filter_finished_cb(void *data EINA_UNUSED,
+ Evas_Object *obj EINA_UNUSED,
+ void *event_info EINA_UNUSED)
+{
+ printf("Filter finished\n");
+}
+
+void
+test_combobox(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
+ void *event_info EINA_UNUSED)
+{
+ Evas_Object *win, *bx, *combobox;
+ Elm_Genlist_Item_Class *itc;
+ win = elm_win_util_standard_add("combobox", "Combobox");
+ elm_win_autodel_set(win, EINA_TRUE);
+
+ bx = elm_box_add(win);
+ evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ elm_win_resize_object_add(win, bx);
+ evas_object_show(bx);
+
+ itc = elm_genlist_item_class_new();
+ itc->item_style = "default";
+ itc->func.text_get = gl_text_get;
+ itc->func.content_get = gl_content_get;
+ itc->func.state_get = gl_state_get;
+ itc->func.filter_get = gl_filter_get;
+ itc->func.del = NULL;
+
+ combobox = elm_combobox_add(win);
+ evas_object_size_hint_weight_set(combobox, EVAS_HINT_EXPAND, 0);
+ evas_object_size_hint_align_set(combobox, EVAS_HINT_FILL, 0);
+ elm_object_part_text_set(combobox, "guide", "A long list");
+ for (int i = 0; i < 1000; i++)
+ elm_genlist_item_append(combobox, itc, (void *)(uintptr_t)i,
+ NULL, ELM_GENLIST_ITEM_NONE, NULL,
+ (void*)(uintptr_t)(i * 10));
+ evas_object_smart_callback_add(combobox, "clicked",
+ _combobox_clicked_cb, NULL);
+ evas_object_smart_callback_add(combobox, "dismissed",
+ _combobox_dismissed_cb, NULL);
+ evas_object_smart_callback_add(combobox, "expanded",
+ _combobox_expanded_cb, NULL);
+ evas_object_smart_callback_add(combobox, "item,selected",
+ _combobox_item_selected_cb, NULL);
+ evas_object_smart_callback_add(combobox, "item,pressed",
+ _combobox_item_pressed_cb, NULL);
+ evas_object_smart_callback_add(combobox, "filter,done",
+ _gl_filter_finished_cb, NULL);
+ evas_object_smart_callback_add(combobox, "changed",
+ _gl_filter_restart_cb, NULL);
+ elm_box_pack_end(bx, combobox);
+ evas_object_show(combobox);
+
+ combobox = elm_combobox_add(win);
+ evas_object_size_hint_weight_set(combobox, EVAS_HINT_EXPAND, 0);
+ evas_object_size_hint_align_set(combobox, EVAS_HINT_FILL, 0);
+ elm_object_text_set(combobox, "Disabled Combobox");
+ for (int i = 0; i < 1000; i++)
+ elm_genlist_item_append(combobox, itc, (void *)(uintptr_t)i,
+ NULL, ELM_GENLIST_ITEM_NONE, NULL,
+ (void*)(uintptr_t)(i * 10));
+ evas_object_smart_callback_add(combobox, "clicked",
+ _combobox_clicked_cb, NULL);
+ evas_object_smart_callback_add(combobox, "item,selected",
+ _combobox_item_selected_cb, NULL);
+ evas_object_smart_callback_add(combobox, "item,pressed",
+ _combobox_item_pressed_cb, NULL);
+ evas_object_smart_callback_add(combobox, "dismissed",
+ _combobox_dismissed_cb, NULL);
+ evas_object_smart_callback_add(combobox, "expanded",
+ _combobox_expanded_cb, NULL);
+ evas_object_smart_callback_add(combobox, "filter,done",
+ _gl_filter_finished_cb, NULL);
+ elm_object_disabled_set(combobox, EINA_TRUE);
+ elm_box_pack_end(bx, combobox);
+ evas_object_show(combobox);
+
+ evas_object_resize(win, 320, 500);
+ evas_object_show(win);
+}
+
+static void
+_combobox2_item_pressed_cb(void *data EINA_UNUSED, Evas_Object *obj,
+ void *event_info)
+{
+ const char *txt = elm_object_item_text_get(event_info);
+ printf("'item,pressed' callback is called. (selected item : %s)\n", txt);
+ if (elm_combobox_multiple_selection_get(obj))
+ elm_multibuttonentry_item_append(obj, txt, NULL, NULL);
+ else
+ elm_object_text_set(obj, txt);
+ elm_combobox_hover_end(obj);
+}
+// Combobox with multiple selection
+void
+test_combobox2(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
+ void *event_info EINA_UNUSED)
+{
+ Evas_Object *win, *combobox, *ly;
+ Elm_Genlist_Item_Class *itc;
+ char buf[128];
+ char* email_address[300] = {"augue.ut.lacus@Suspendisse.com","egestas.Aliquam.nec@Vivamusmolestiedapibus.edu","urna.et@purusNullam.co.uk","elit@Sedid.net","cursus@malesuadafringillaest.net","Lorem@Cras.org","risus@sedhendrerita.co.uk","auctor.nunc.nulla@utsemNulla.com","nunc.nulla@nonenim.org","egestas@egetipsum.co.uk","sed.tortor@tempusmauris.edu","rutrum@gravida.org","nunc@acsemut.com","lobortis.quam@eratvolutpatNulla.net","fames@ullamcorperDuisat.co.uk","pede.et.risus@necurna.edu","semper.cursus.Integer@justo.com","sem.molestie@orciPhasellusdapibus.com","quam.a@tinciduntvehicula.co.uk","ullamcorper.Duis@odioEtiam.com","enim.Sed.nulla@Etiamligulatortor.net","molestie.pharetra.nibh@velfaucibus.com","morbi@neceuismodin.com","egestas.hendrerit.neque@nequetellus.com","Etiam.gravida.molestie@purusDuis.org","metus.vitae@risus.net","tincidunt.tempus.risus@nonummyFusce.co.uk","Curabitur.ut.odio@in.com","rutrum@utnisi.ca","iaculis.nec@ultriciesdignissimlacus.ca","consectetuer.ipsum.nunc@Cumsociisnatoque.ca","non.arcu.Vivamus@ornare.com","arcu.Vestibulum@interdumligula.edu","sem.magna@urnasuscipit.ca","eu.euismod@urnaconvalliserat.net","Maecenas.mi.felis@mattisInteger.ca","magna.Suspendisse@Donecdignissimmagna.ca","cursus.Integer.mollis@fringillaeuismodenim.ca","tellus.eu@molestie.co.uk","metus.In@egestas.co.uk","Cum@nisl.com","Phasellus@atarcu.net","nec.quam.Curabitur@tortorInteger.org","condimentum.Donec@egetodioAliquam.edu","orci.luctus@magnatellus.co.uk","adipiscing@noncursusnon.co.uk","Sed.eget.lacus@Nullam.edu","felis.ullamcorper@ornare.co.uk","Nunc.quis.arcu@Proineget.edu","in@lobortis.co.uk","leo.Vivamus.nibh@seddui.com","eu.tellus.Phasellus@natoque.ca","ultrices.iaculis@Aliquam.net","purus.ac@feugiatLorem.net","tincidunt.neque@ut.net","odio.sagittis.semper@nibhdolornonummy.org","Sed@eunequepellentesque.com","elementum@sempererat.co.uk","Curae.Donec.tincidunt@neque.net","rhoncus@erat.edu","mauris.elit@Donec.ca","metus.vitae.velit@ad.edu","scelerisque.scelerisque@etmalesuadafames.net","velit.in@convallis.co.uk","ridiculus@laoreetlectusquis.org","tincidunt.orci.quis@musDonec.net","tempor@orciconsectetuereuismod.co.uk","Duis.sit@eratSednunc.com","elit.sed.consequat@nuncinterdum.edu","lorem@Pellentesqueultricies.org","ornare.placerat.orci@pretiumnequeMorbi.com","euismod.enim@primisinfaucibus.ca","a.scelerisque.sed@sapienCras.com","Aliquam@Vestibulum.net","nec@at.ca","quis.diam.luctus@atauctor.ca","nec@purusin.org","montes.nascetur.ridiculus@viverraMaecenas.co.uk","elementum@amet.edu","fringilla.cursus.purus@velarcuCurabitur.co.uk","et.rutrum@consectetuerrhoncus.edu","Aenean@maurissapiencursus.com","interdum@vehiculaaliquet.co.uk","orci.quis.lectus@facilisisfacilisis.org","et.netus.et@arcu.net","ipsum.porta.elit@sapienNunc.edu","libero.Morbi@ipsumCurabiturconsequat.ca","libero@sitamet.com","porta@penatibus.org","nec.enim.Nunc@egetmetusIn.edu","Nunc.sollicitudin.commodo@porttitorinterdum.org","Phasellus.at.augue@dolor.org","nec.ante@etlibero.com","diam@gravida.co.uk","laoreet@malesuada.co.uk","in.lobortis@blanditenim.edu","ante@ipsumnon.net","in@odio.org","Quisque.tincidunt@risus.co.uk","lacus.varius@Vestibulum.com","eu.eros.Nam@arcuNunc.org","pellentesque@Vivamuseuismodurna.org","Cum.sociis@eleifendCras.com","neque@vulputate.org","imperdiet.dictum.magna@risus.org","sagittis@enimcondimentum.edu","hendrerit@maurisMorbi.org","suscipit.nonummy@disparturientmontes.org","Vivamus.non.lorem@fermentummetusAenean.net","In.mi@maurisaliquam.com","est@massanonante.org","molestie@a.co.uk","sit@acturpis.org","diam@felisorci.edu","dolor.nonummy.ac@elitsedconsequat.co.uk","justo@Praesentinterdum.co.uk","Quisque.varius@enimMaurisquis.ca","nibh.enim.gravida@ut.ca","arcu.Vivamus@orciquis.co.uk","sociis@Sedeget.net","risus@egetvolutpatornare.com","vel.est.tempor@ipsum.net","ipsum@dolordapibusgravida.edu","sem.egestas@quamelementum.co.uk","ipsum@Duisatlacus.co.uk","facilisis.vitae@acturpisegestas.net","Nam@aliquetlobortis.net","ipsum.dolor.sit@nuncInat.net","gravida.sagittis@et.org","mauris@magnatellus.edu","sed@adipiscingenimmi.org","sed@ipsumportaelit.com","malesuada.vel.convallis@amet.net","Praesent.interdum@dictumeu.co.uk","nunc.In.at@ornare.co.uk","Phasellus.fermentum.convallis@ipsum.net","sed.libero.Proin@Aliquameratvolutpat.org","aliquet.libero@telluslorem.net","lectus.pede.ultrices@Maurisquisturpis.edu","blandit.at.nisi@ut.net","erat@convallisdolor.net","ante.Nunc.mauris@vehiculaetrutrum.ca","vel.quam@egestas.edu","non@justofaucibuslectus.co.uk","sem.ut.dolor@odioNaminterdum.org","et.ipsum@malesuada.net","non@Nulladignissim.com","ullamcorper.nisl@iaculisodio.com","neque.sed@necurna.ca","in.cursus.et@fermentumvelmauris.co.uk","magna.sed@eteuismodet.co.uk","a@Crasvehicula.com","tortor.Nunc.commodo@velmauris.net","dignissim.pharetra@Aeneaneuismodmauris.org","egestas.urna.justo@acorci.org","iaculis.enim.sit@maurisIntegersem.com","malesuada@imperdietnec.com","erat.volutpat.Nulla@ipsum.org","Aliquam@IntegerurnaVivamus.co.uk","Nunc.sollicitudin@ipsumCurabitur.net","nibh.enim@quam.co.uk","pede@quismassa.com","vel.nisl@fringillacursuspurus.co.uk","vel@auctorvelitAliquam.org","auctor.quis.tristique@fringillamilacinia.org","nisl.elementum@amagna.com","facilisis@feugiattelluslorem.co.uk","eleifend.Cras@Vestibulumante.net","Integer.eu.lacus@ipsumCurabiturconsequat.com","Donec.porttitor@Etiamvestibulummassa.ca","montes@auctorquistristique.net","Nunc.ullamcorper.velit@Vivamusnon.co.uk","dictum.cursus@sed.org","Aliquam.erat.volutpat@nonummyut.org","ac.mattis@ligulaNullamenim.net","id.sapien.Cras@Proin.ca","Phasellus.dolor@fermentumfermentum.edu","in@odio.edu","non.luctus@pedeNuncsed.com","per.conubia@euismodacfermentum.com","luctus.aliquet@venenatisvelfaucibus.ca","nulla.Cras@purusaccumsaninterdum.ca","aliquet.vel.vulputate@pedesagittis.edu","rutrum@pedeultrices.co.uk","Nullam.lobortis@hendrerit.ca","nonummy.ac.feugiat@Sedmalesuadaaugue.edu","nibh@ipsum.com","in.faucibus.orci@vehicula.com","odio.vel.est@in.edu","amet.ornare.lectus@Suspendisse.co.uk","Maecenas.malesuada.fringilla@at.co.uk","Aliquam@aceleifendvitae.org","Nullam.feugiat.placerat@massaQuisque.ca","urna@tempor.org","magnis.dis.parturient@arcuCurabitur.edu","erat.vel@In.ca","rutrum@Integervitae.ca","metus.In@odio.co.uk","nec.imperdiet@tellus.ca","dui.semper.et@at.org","sit.amet@quisarcu.org","ante@Donecsollicitudinadipiscing.edu","turpis.egestas.Aliquam@egestasnunc.edu","posuere@quismassaMauris.co.uk","Nulla.dignissim@nibhAliquamornare.com","facilisis.vitae.orci@estmaurisrhoncus.net","vitae.aliquet.nec@nostraper.co.uk","lorem@enimsitamet.co.uk","pellentesque@acipsum.org","pede.et.risus@nonvestibulum.org","sed@Nuncsollicitudin.com","erat@Maurisvestibulum.org","scelerisque@tortorNunc.org","metus@idsapien.org","dignissim@Duis.ca","Duis.at.lacus@egestaslaciniaSed.com","auctor.velit@dapibus.co.uk","Curae.Phasellus.ornare@eudolor.net","arcu@metusfacilisis.ca","laoreet@dictummagna.net","tristique.neque@auctorvitaealiquet.ca","nunc.interdum.feugiat@primisinfaucibus.edu","elit.pede.malesuada@quam.net","semper.et.lacinia@ornareliberoat.ca","magna.Praesent.interdum@elit.net","consequat@loremDonec.ca","Vivamus@nisiMauris.edu","feugiat.tellus@sociisnatoquepenatibus.co.uk","scelerisque.mollis.Phasellus@facilisis.edu","rhoncus.Proin@enimEtiam.com","amet.consectetuer.adipiscing@lacusNullatincidunt.edu","aliquet.lobortis.nisi@leo.com","magna@purus.org","a@etmalesuadafames.com","Nunc.commodo@vulputatenisisem.net","et.rutrum.non@imperdieteratnonummy.com","consectetuer@mauris.net","iaculis.lacus@Proinvelarcu.ca","tincidunt.Donec.vitae@habitant.net","et.ultrices@nequesed.org","Lorem.ipsum@nonante.edu","Vestibulum.ut@sed.co.uk","fermentum.arcu@Duis.com","Morbi.quis.urna@vulputate.org","Sed.eget@liberolacusvarius.net","amet.lorem@tincidunt.co.uk","morbi@Classaptenttaciti.com","nisl.Quisque.fringilla@ut.ca","Aenean.egestas.hendrerit@eleifendnec.co.uk","elit@odio.net","sodales.Mauris.blandit@fermentumfermentumarcu.com","massa.non@Nuncsollicitudin.com","quam@sit.co.uk","consectetuer@quispedePraesent.co.uk","erat.eget@aliquetPhasellusfermentum.ca","libero@convalliserat.net","dui@arcu.ca","Curabitur@ascelerisquesed.org","amet@sed.com","in.aliquet.lobortis@acipsum.net","Donec.non@feugiatnec.com","Suspendisse.dui.Fusce@musProin.com","congue@loremauctor.co.uk","magna@Morbi.com","sit@dolor.edu","Praesent.eu.nulla@parturientmontes.com","eu.dui.Cum@arcuvelquam.org","leo.elementum@aliquet.edu","aliquam@urna.org","congue@nonummy.ca","urna.Nullam@atauctor.ca","natoque.penatibus@id.co.uk","aliquam.arcu@risusQuisque.com","ultrices.iaculis@liberoet.com","mollis.Integer.tincidunt@auctorvelit.org","sit@mus.org","est.mollis@orci.net","gravida@eunullaat.co.uk","varius.ultrices@Intinciduntcongue.org","Duis.cursus@nuncnulla.org","eu.turpis@Cumsociis.com","metus.In@sapiencursusin.org","a.feugiat.tellus@velitjusto.co.uk","nibh.lacinia.orci@mifelis.org","tincidunt.neque.vitae@Sed.ca","convallis.est.vitae@Donec.org","mauris@semelit.co.uk","Nam.interdum@Morbiquis.ca","vel.arcu.Curabitur@ullamcorperDuisat.net","dolor@mauris.com","Suspendisse@ipsum.org","Vivamus@dui.edu","condimentum.eget.volutpat@lobortisultrices.ca","commodo@et.edu","ut.ipsum@MorbimetusVivamus.co.uk","ut@feugiatnecdiam.org","Nam@ultrices.co.uk","orci.Donec@turpis.org","semper.tellus@venenatislacus.com","elit.elit@arcuimperdietullamcorper.edu"};
+ win = elm_win_util_standard_add("combobox", "Combobox");
+ elm_win_autodel_set(win, EINA_TRUE);
+
+ ly = elm_layout_add(win);
+ snprintf(buf, sizeof(buf), "%s/objects/combobox_multiple.edj", elm_app_data_dir_get());
+ elm_layout_file_set(ly, buf, "combobox_multiple_test");
+ evas_object_size_hint_weight_set(ly, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ elm_win_resize_object_add(win, ly);
+ evas_object_show(ly);
+
+ itc = elm_genlist_item_class_new();
+ itc->item_style = "default";
+ itc->func.text_get = gl2_text_get;
+ itc->func.content_get = gl_content_get;
+ itc->func.state_get = gl_state_get;
+ itc->func.filter_get = gl2_filter_get;
+ itc->func.del = NULL;
+
+ combobox = elm_combobox_add(win);
+ evas_object_size_hint_weight_set(combobox, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(combobox, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ elm_object_text_set(combobox, "To:");
+ elm_object_part_text_set(combobox, "guide", "Tap to add recipient");
+ elm_combobox_multiple_selection_set(combobox, EINA_TRUE);
+ for (int i = 0; i < 300; i++)
+ elm_genlist_item_append(combobox, itc, (void *)email_address[i],
+ NULL, ELM_GENLIST_ITEM_NONE, NULL,
+ (void*)(uintptr_t)(i * 10));
+
+ evas_object_smart_callback_add(combobox, "clicked",
+ _combobox_clicked_cb, NULL);
+ evas_object_smart_callback_add(combobox, "item,selected",
+ _combobox_item_selected_cb, NULL);
+ evas_object_smart_callback_add(combobox, "dismissed",
+ _combobox_dismissed_cb, NULL);
+ evas_object_smart_callback_add(combobox, "expanded",
+ _combobox_expanded_cb, NULL);
+ evas_object_smart_callback_add(combobox, "item,pressed",
+ _combobox2_item_pressed_cb, NULL);
+ evas_object_smart_callback_add(combobox, "filter,done",
+ _gl_filter_finished_cb, NULL);
+ evas_object_smart_callback_add(combobox, "changed",
+ _gl2_filter_restart_cb, NULL);
+ elm_object_part_content_set(ly, "combobox", combobox);
+ evas_object_show(combobox);
+
+ evas_object_resize(win, 640, 600);
+ evas_object_show(win);
+}
diff --git a/src/bin/elementary/test_config.c b/src/bin/elementary/test_config.c
new file mode 100644
index 0000000000..bf032a73ec
--- /dev/null
+++ b/src/bin/elementary/test_config.c
@@ -0,0 +1,534 @@
+#ifdef HAVE_CONFIG_H
+# include "elementary_config.h"
+#endif
+#include <Elementary.h>
+
+#ifdef MAX_PROFILES
+# undef MAX_PROFILES
+#endif
+
+#define MAX_PROFILES 20
+
+#ifdef LOG
+# undef LOG
+#endif
+
+#define LOG(m) \
+ do { \
+ lb = elm_label_add(win); \
+ elm_object_text_set(lb, m); \
+ evas_object_size_hint_weight_set(lb, 0.0, 0.0); \
+ evas_object_size_hint_align_set(lb, EVAS_HINT_FILL, EVAS_HINT_FILL); \
+ evas_object_show(lb); \
+ } while(0)
+
+typedef struct _Prof_Data Prof_Data;
+typedef struct _App_Data App_Data;
+
+struct _Prof_Data
+{
+ Evas_Object *rdg;
+ Eina_List *cks;
+ const char *profile;
+ const char *available_profiles[MAX_PROFILES];
+ int count;
+};
+
+struct _App_Data
+{
+ Evas_Object *win;
+ Eina_List *profiles;
+ Prof_Data curr;
+ Prof_Data new;
+};
+
+void test_config(void *data, Evas_Object *obj, void *event_info);
+
+static void
+_profile_clear(Prof_Data *pd)
+{
+ if (pd->profile)
+ eina_stringshare_del(pd->profile);
+ pd->profile = NULL;
+}
+
+static void
+_profiles_clear(Prof_Data *pd)
+{
+ int i;
+ for (i = 0; i < MAX_PROFILES; i++)
+ {
+ if (pd->available_profiles[i])
+ eina_stringshare_del(pd->available_profiles[i]);
+ pd->available_profiles[i] = NULL;
+ }
+}
+
+static void
+_profile_update(Evas_Object *win)
+{
+ Evas_Object *lb = evas_object_data_get(win, "lb");
+ char **profiles = NULL;
+ const char *profile;
+ unsigned int i, n = 0;
+ char buf[PATH_MAX];
+
+ profile = elm_win_profile_get(win);
+ snprintf(buf, sizeof(buf),
+ "Profile: <b>%s</b><br/>"
+ "Available profiles: <b>",
+ profile);
+
+ elm_win_available_profiles_get(win, &profiles, &n);
+ if ((profiles) && (n > 0))
+ {
+ for (i = 0; i < n; i++)
+ {
+ if (i >= 1) strncat(buf, ", ", 2);
+ strncat(buf, profiles[i], strlen(profiles[i]) + 1);
+ }
+ strncat(buf, "</b>", 4);
+ }
+ elm_object_text_set(lb, buf);
+}
+
+static void
+_bt_profile_set(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
+{
+ App_Data *ad = evas_object_data_get((Evas_Object *)data, "ad");
+ Evas_Object *rd = elm_radio_selected_object_get(ad->curr.rdg);
+ const char *profile = elm_object_text_get(rd);
+ if (strcmp(profile, "Nothing") != 0)
+ elm_win_profile_set(ad->win, elm_object_text_get(rd));
+ else
+ elm_win_profile_set(ad->win, NULL);
+ _profile_update(ad->win);
+}
+
+static void
+_bt_available_profiles_set(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
+{
+ App_Data *ad = evas_object_data_get((Evas_Object *)data, "ad");
+ Eina_List *l = NULL;
+ const char *str;
+ Evas_Object *o;
+ int i = 0;
+
+ _profiles_clear(&ad->curr);
+
+ EINA_LIST_FOREACH(ad->curr.cks, l, o)
+ {
+ if (elm_check_state_get(o))
+ {
+ str = evas_object_data_get(o, "profile");
+ if (str)
+ {
+ ad->curr.available_profiles[i] = eina_stringshare_add(str);
+ i++;
+ }
+ }
+ }
+ ad->curr.count = i;
+
+ elm_win_available_profiles_set(ad->win,
+ ad->curr.available_profiles,
+ ad->curr.count);
+ _profile_update(ad->win);
+}
+
+static void
+_bt_win_add(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
+{
+ App_Data *ad = evas_object_data_get((Evas_Object *)data, "ad");
+ Evas_Object *rd = elm_radio_selected_object_get(ad->new.rdg);
+ const char *profile = elm_object_text_get(rd);
+ const char *str;
+ Eina_List *l = NULL;
+ Evas_Object *o;
+ int i = 0;
+
+ _profile_clear(&ad->new);
+ _profiles_clear(&ad->new);
+
+ if (strcmp(profile, "Nothing") != 0)
+ ad->new.profile = (char *)eina_stringshare_add(profile);
+
+ EINA_LIST_FOREACH(ad->new.cks, l, o)
+ {
+ if (elm_check_state_get(o))
+ {
+ str = evas_object_data_get(o, "profile");
+ if (str)
+ {
+ ad->new.available_profiles[i] = eina_stringshare_add(str);
+ i++;
+ }
+ }
+ }
+ ad->new.count = i;
+
+ test_config(&(ad->new), NULL, NULL);
+}
+
+static void
+_win_profile_changed_cb(void *data EINA_UNUSED, Evas_Object *obj, void *event EINA_UNUSED)
+{
+ _profile_update(obj);
+}
+
+static void
+_win_del_cb(void *data EINA_UNUSED, Evas_Object *obj, void *event_info EINA_UNUSED)
+{
+ App_Data *ad = evas_object_data_get(obj, "ad");
+ Evas_Object *o;
+ char *str;
+
+ elm_config_profile_list_free(ad->profiles);
+ ad->profiles = NULL;
+
+ EINA_LIST_FREE(ad->curr.cks, o)
+ {
+ str = evas_object_data_del(o, "profile");
+ if (str) eina_stringshare_del(str);
+ }
+
+ EINA_LIST_FREE(ad->new.cks, o)
+ {
+ str = evas_object_data_del(o, "profile");
+ if (str) eina_stringshare_del(str);
+ }
+
+ _profile_clear(&ad->curr);
+ _profiles_clear(&ad->curr);
+ _profile_clear(&ad->new);
+ _profiles_clear(&ad->new);
+
+ free(ad);
+}
+
+static Evas_Object *
+_radio_add(Evas_Object *win, Evas_Object *bx)
+{
+ App_Data *ad = evas_object_data_get(win, "ad");
+ Evas_Object *bx2, *rd, *rdg = NULL;
+ Eina_List *l = NULL;
+ const char *str;
+ int i = 0;
+
+ bx2 = elm_box_add(win);
+ evas_object_size_hint_weight_set(bx2, EVAS_HINT_EXPAND, 0.0);
+ evas_object_size_hint_align_set(bx2, EVAS_HINT_FILL, 0.0);
+ elm_box_align_set(bx2, 0.0, 0.5);
+ elm_box_horizontal_set(bx2, EINA_TRUE);
+ elm_box_pack_end(bx, bx2);
+ evas_object_show(bx2);
+
+ rdg = rd = elm_radio_add(win);
+ elm_radio_state_value_set(rd, i);
+ elm_radio_group_add(rd, rdg);
+ elm_object_text_set(rd, "Nothing");
+ evas_object_size_hint_weight_set(rd, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ elm_box_pack_end(bx2, rd);
+ evas_object_show(rd);
+ i++;
+
+ EINA_LIST_FOREACH(ad->profiles, l, str)
+ {
+ rd = elm_radio_add(win);
+ elm_radio_state_value_set(rd, i);
+ elm_radio_group_add(rd, rdg);
+ elm_object_text_set(rd, str);
+ evas_object_size_hint_weight_set(rd, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ elm_box_pack_end(bx2, rd);
+ evas_object_show(rd);
+ i++;
+ }
+
+ return rdg;
+}
+
+static Eina_List *
+_check_add(Evas_Object *win, Evas_Object *bx)
+{
+ App_Data *ad = evas_object_data_get(win, "ad");
+ Evas_Object *bx2, *ck;
+ Eina_List *l = NULL, *ll = NULL;
+ const char *str;
+
+ bx2 = elm_box_add(win);
+ evas_object_size_hint_weight_set(bx2, EVAS_HINT_EXPAND, 0.0);
+ evas_object_size_hint_align_set(bx2, EVAS_HINT_FILL, 0.0);
+ elm_box_align_set(bx2, 0.0, 0.5);
+ elm_box_horizontal_set(bx2, EINA_TRUE);
+ elm_box_pack_end(bx, bx2);
+ evas_object_show(bx2);
+
+ EINA_LIST_FOREACH(ad->profiles, l, str)
+ {
+ ck = elm_check_add(win);
+ elm_object_text_set(ck, str);
+ evas_object_data_set(ck, "profile", eina_stringshare_add(str));
+ evas_object_size_hint_weight_set(ck, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ elm_box_pack_end(bx2, ck);
+ evas_object_show(ck);
+
+ ll = eina_list_append(ll, ck);
+ }
+
+ return ll;
+}
+
+static Evas_Object *
+_inlined_add(Evas_Object *parent)
+{
+ Evas_Object *win, *bg, *bx, *lb;
+
+ win = elm_win_add(parent, "inlined", ELM_WIN_INLINED_IMAGE);
+ if (!win) return NULL;
+
+ bg = elm_bg_add(win);
+ elm_bg_color_set(bg, 110, 210, 120);
+ evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ elm_win_resize_object_add(win, bg);
+ evas_object_show(bg);
+
+ bx = elm_box_add(win);
+ evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, 0.0);
+ evas_object_size_hint_align_set(bx, EVAS_HINT_FILL, 0.0);
+ evas_object_show(bx);
+
+ LOG("ELM_WIN_INLINED_IMAGE");
+ elm_box_pack_end(bx, lb);
+
+ LOG("Profile: <b>N/A</b>");
+ elm_box_pack_end(bx, lb);
+ evas_object_data_set(win, "lb", lb);
+
+ evas_object_move(win, 10, 100);
+ evas_object_resize(win, 150, 70);
+ evas_object_move(elm_win_inlined_image_object_get(win), 10, 100);
+ evas_object_resize(elm_win_inlined_image_object_get(win), 150, 70);
+
+ evas_object_smart_callback_add(win, "profile,changed", _win_profile_changed_cb, NULL);
+ evas_object_show(win);
+
+ return win;
+}
+
+static Evas_Object *
+_socket_add(const char *name)
+{
+ Evas_Object *win, *bg, *bx, *lb;
+
+ win = elm_win_add(NULL, "socket image", ELM_WIN_SOCKET_IMAGE);
+ if (!win) return NULL;
+
+ if (elm_win_socket_listen(win, name, 0, EINA_FALSE))
+ {
+ elm_win_autodel_set(win, EINA_TRUE);
+
+ bg = elm_bg_add(win);
+ elm_bg_color_set(bg, 80, 110, 205);
+ evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ elm_win_resize_object_add(win, bg);
+ evas_object_show(bg);
+
+ bx = elm_box_add(win);
+ evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, 0.0);
+ evas_object_size_hint_align_set(bx, EVAS_HINT_FILL, 0.0);
+ evas_object_show(bx);
+
+ LOG("ELM_WIN_SOCKET_IMAGE");
+ elm_box_pack_end(bx, lb);
+
+ LOG("Profile: <b>N/A</b>");
+ elm_box_pack_end(bx, lb);
+ evas_object_data_set(win, "lb", lb);
+
+ _inlined_add(win);
+
+ evas_object_move(win, 0, 0);
+ evas_object_resize(win, 150, 200);
+
+ evas_object_smart_callback_add(win, "profile,changed", _win_profile_changed_cb, NULL);
+ evas_object_show(win);
+ }
+ else
+ {
+ evas_object_del(win);
+ win = NULL;
+ }
+
+ return win;
+}
+
+static Evas_Object *
+_plug_add(Evas_Object *win, Evas_Object *bx, const char *name)
+{
+ Evas_Object *plug, *ly;
+ Eina_Bool res = EINA_FALSE;
+ char buf[PATH_MAX];
+
+ plug = elm_plug_add(win);
+ if (plug) res = elm_plug_connect(plug, name, 0, EINA_FALSE);
+
+ if (res)
+ {
+ ly = elm_layout_add(win);
+ snprintf(buf, sizeof(buf), "%s/objects/test.edj", elm_app_data_dir_get());
+ elm_layout_file_set(ly, buf, "win_config");
+ evas_object_size_hint_weight_set(ly, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_fill_set(ly, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ evas_object_show(ly);
+
+ evas_object_size_hint_weight_set(plug, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ elm_box_pack_end(bx, ly);
+ elm_object_part_content_set(ly, "swallow", plug);
+ evas_object_show(plug);
+ }
+ else
+ {
+ if (plug) evas_object_del(plug);
+ plug = NULL;
+ }
+
+ return plug;
+}
+
+#ifdef FRAME
+# undef FRAME
+#endif
+
+#define FRAME(t) \
+ do { \
+ fr = elm_frame_add(bx); \
+ elm_object_text_set(fr, t); \
+ evas_object_size_hint_weight_set(fr, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); \
+ evas_object_size_hint_fill_set(fr, EVAS_HINT_FILL, EVAS_HINT_FILL); \
+ elm_box_pack_end(bx, fr); \
+ evas_object_show(fr); \
+ bx2 = elm_box_add(win); \
+ evas_object_size_hint_weight_set(bx2, EVAS_HINT_EXPAND, 0.0); \
+ evas_object_size_hint_align_set(bx2, EVAS_HINT_FILL, 0.0); \
+ elm_box_align_set(bx2, 0.0, 0.5); \
+ elm_object_content_set(fr, bx2); \
+ evas_object_show(bx2); \
+ } while(0)
+
+void
+test_config(void *data, Evas_Object *obj, void *event_info EINA_UNUSED)
+{
+ App_Data *ad;
+ Prof_Data *pd = (Prof_Data *)data;
+ Evas_Object *win, *sc, *bx, *fr, *bx2, *lb, *bt;
+ Ecore_Evas *ee;
+ const char *siname = "_TestConfigSocketImage_";
+ char buf[PATH_MAX];
+
+ if (!(ad = calloc(1, sizeof(App_Data)))) return;
+
+ win = elm_win_util_standard_add("config", "Configuration");
+ elm_win_autodel_set(win, EINA_TRUE);
+ evas_object_data_set(win, "ad", ad);
+ ad->win = win;
+ ad->profiles = elm_config_profile_list_get();
+
+ sc = elm_scroller_add(win);
+ elm_scroller_bounce_set(sc, EINA_FALSE, EINA_TRUE);
+ evas_object_size_hint_weight_set(sc, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ elm_win_resize_object_add(win, sc);
+
+ bx = elm_box_add(win);
+ evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, 0.0);
+ evas_object_size_hint_align_set(bx, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ elm_object_content_set(sc, bx);
+
+ FRAME("Current window profile");
+ ee = ecore_evas_ecore_evas_get(evas_object_evas_get(win));
+ snprintf(buf, sizeof(buf),
+ "Virtual desktop window profile support: <b>%s</b>",
+ ecore_evas_window_profile_supported_get(ee) ? "Yes" : "No");
+ LOG(buf);
+ elm_box_pack_end(bx2, lb);
+
+ LOG("Profile: <b>N/A</b><br/>Available profiles:");
+ elm_box_pack_end(bx2, lb);
+ evas_object_data_set(win, "lb", lb);
+
+ LOG("<br/>Window profile");
+ elm_box_pack_end(bx2, lb);
+ ad->curr.rdg = _radio_add(win, bx2);
+
+ bt = elm_button_add(win);
+ elm_object_text_set(bt, "Set");
+ evas_object_smart_callback_add(bt, "clicked", _bt_profile_set, win);
+ elm_box_pack_end(bx2, bt);
+ evas_object_show(bt);
+
+ LOG("Window available profiles");
+ elm_box_pack_end(bx2, lb);
+ ad->curr.cks = _check_add(win, bx2);
+
+ bt = elm_button_add(win);
+ elm_object_text_set(bt, "Set");
+ evas_object_smart_callback_add(bt, "clicked", _bt_available_profiles_set, win);
+ elm_box_pack_end(bx2, bt);
+ evas_object_show(bt);
+
+ FRAME("Socket");
+ if (_socket_add(siname))
+ {
+ LOG("Starting socket image.");
+ elm_box_pack_end(bx2, lb);
+ }
+ else
+ {
+ LOG("Failed to create socket.<br/>"
+ "Please check whether another test configuration window is<br/>"
+ "already running and providing socket image.");
+ elm_box_pack_end(bx2, lb);
+ }
+
+ FRAME("Plug");
+ if (!_plug_add(win, bx2, siname))
+ {
+ LOG("Failed to connect to server.");
+ elm_box_pack_end(bx2, lb);
+ }
+
+ FRAME("Create new window with profile");
+ LOG("Window profile");
+ elm_box_pack_end(bx2, lb);
+ ad->new.rdg = _radio_add(win, bx2);
+
+ LOG("Window available profiles");
+ elm_box_pack_end(bx2, lb);
+ ad->new.cks = _check_add(win, bx2);
+
+ bt = elm_button_add(win);
+ elm_object_text_set(bt, "Create");
+ evas_object_smart_callback_add(bt, "clicked", _bt_win_add, win);
+ elm_box_pack_end(bx2, bt);
+ evas_object_show(bt);
+
+ evas_object_smart_callback_add(win, "profile,changed", _win_profile_changed_cb, NULL);
+ evas_object_smart_callback_add(win, "delete,request", _win_del_cb, NULL);
+
+ if (pd && !obj) //obj is NULL when called by _bt_win_add but not when user clicks this test
+ {
+ if (pd->available_profiles[0])
+ elm_win_available_profiles_set(win,
+ pd->available_profiles,
+ pd->count);
+ if (pd->profile)
+ elm_win_profile_set(win, pd->profile);
+
+ _profile_update(win);
+ }
+
+ evas_object_show(bx);
+ evas_object_show(sc);
+
+ evas_object_resize(win, 400, 500);
+ evas_object_show(win);
+}
diff --git a/src/bin/elementary/test_conform.c b/src/bin/elementary/test_conform.c
new file mode 100644
index 0000000000..f850b1c6e9
--- /dev/null
+++ b/src/bin/elementary/test_conform.c
@@ -0,0 +1,195 @@
+#ifdef HAVE_CONFIG_H
+# include "elementary_config.h"
+#endif
+#include <Elementary.h>
+
+void
+test_conformant(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event EINA_UNUSED)
+{
+ Evas_Object *win, *conform, *btn, *bx, *en;
+
+ win = elm_win_util_standard_add("conformant", "Conformant");
+ elm_win_autodel_set(win, EINA_TRUE);
+ elm_win_conformant_set(win, EINA_TRUE);
+
+ conform = elm_conformant_add(win);
+ evas_object_size_hint_weight_set(conform, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ elm_win_resize_object_add(win, conform);
+ evas_object_show(conform);
+
+ bx = elm_box_add(win);
+ evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(bx, EVAS_HINT_FILL, EVAS_HINT_FILL);
+
+ en = elm_entry_add(win);
+ elm_entry_scrollable_set(en, EINA_TRUE);
+ elm_entry_single_line_set(en, EINA_TRUE);
+ elm_scroller_bounce_set(en, EINA_TRUE, EINA_FALSE);
+ elm_object_text_set(en, "This is the top entry here");
+ evas_object_size_hint_weight_set(en, EVAS_HINT_EXPAND, 0.0);
+ evas_object_size_hint_align_set(en, EVAS_HINT_FILL, 0.5);
+ evas_object_show(en);
+ elm_box_pack_end(bx, en);
+
+ btn = elm_button_add(win);
+ elm_object_text_set(btn, "Test Conformant");
+ evas_object_size_hint_weight_set(btn, EVAS_HINT_EXPAND, 0.0);
+ evas_object_size_hint_align_set(btn, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ elm_box_pack_end(bx, btn);
+ evas_object_show(btn);
+
+ en = elm_entry_add(win);
+ elm_entry_scrollable_set(en, EINA_TRUE);
+ elm_entry_single_line_set(en, EINA_TRUE);
+ elm_scroller_bounce_set(en, EINA_TRUE, EINA_FALSE);
+ elm_object_text_set(en, "This is the middle entry here");
+ evas_object_size_hint_weight_set(en, EVAS_HINT_EXPAND, 0.0);
+ evas_object_size_hint_align_set(en, EVAS_HINT_FILL, 0.5);
+ evas_object_show(en);
+ elm_box_pack_end(bx, en);
+
+ btn = elm_button_add(win);
+ elm_object_text_set(btn, "Test Conformant");
+ evas_object_size_hint_weight_set(btn, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(btn, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ elm_box_pack_end(bx, btn);
+ evas_object_show(btn);
+
+ en = elm_entry_add(win);
+ elm_entry_scrollable_set(en, EINA_TRUE);
+ elm_scroller_bounce_set(en, EINA_FALSE, EINA_TRUE);
+ elm_object_text_set(en,
+ "This is a multi-line entry at the bottom<br/>"
+ "This can contain more than 1 line of text and be "
+ "scrolled around to allow for entering of lots of "
+ "content. It is also to test to see that autoscroll "
+ "moves to the right part of a larger multi-line "
+ "text entry that is inside of a scroller than can be "
+ "scrolled around, thus changing the expected position "
+ "as well as cursor changes updating auto-scroll when "
+ "it is enabled.");
+ evas_object_size_hint_weight_set(en, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(en, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ evas_object_show(en);
+ elm_box_pack_end(bx, en);
+
+ elm_object_content_set(conform, bx);
+ evas_object_show(bx);
+
+ evas_object_resize(win, 240, 240);
+ evas_object_show(win);
+}
+
+static void
+popobj(void *data, Evas_Object *obj EINA_UNUSED, void *event EINA_UNUSED)
+{
+ elm_naviframe_item_pop(data);
+}
+
+void
+test_conformant2(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event EINA_UNUSED)
+{
+ Evas_Object *win, *conform, *btn, *bx, *en, *pg;
+
+ win = elm_win_util_standard_add("conformant2", "Conformant 2");
+ elm_win_autodel_set(win, EINA_TRUE);
+ elm_win_conformant_set(win, EINA_TRUE);
+
+ bx = elm_box_add(win);
+ evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ elm_win_resize_object_add(win, bx);
+ evas_object_show(bx);
+
+ en = elm_entry_add(win);
+ elm_entry_scrollable_set(en, EINA_TRUE);
+ elm_entry_single_line_set(en, EINA_TRUE);
+ elm_scroller_bounce_set(en, EINA_TRUE, EINA_FALSE);
+ elm_object_text_set(en, "This is the top entry here");
+ evas_object_size_hint_weight_set(en, EVAS_HINT_EXPAND, 0.0);
+ evas_object_size_hint_align_set(en, EVAS_HINT_FILL, 0.5);
+ elm_box_pack_end(bx, en);
+ evas_object_show(en);
+
+ btn = elm_button_add(win);
+ elm_object_focus_allow_set(btn, EINA_FALSE);
+ elm_object_text_set(btn, "Delete Below");
+ evas_object_size_hint_weight_set(btn, EVAS_HINT_EXPAND, 0.0);
+ evas_object_size_hint_align_set(btn, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ elm_box_pack_end(bx, btn);
+ evas_object_show(btn);
+
+ pg = elm_naviframe_add(win);
+ evas_object_size_hint_weight_set(pg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(pg, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ elm_box_pack_end(bx, pg);
+ evas_object_show(pg);
+
+ evas_object_smart_callback_add(btn, "clicked", popobj, pg);
+
+ conform = elm_conformant_add(win);
+ evas_object_size_hint_weight_set(conform, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(conform, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ elm_naviframe_item_simple_push(pg, conform);
+ evas_object_show(conform);
+
+ bx = elm_box_add(win);
+ evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(bx, EVAS_HINT_FILL, EVAS_HINT_FILL);
+
+ en = elm_entry_add(win);
+ elm_entry_scrollable_set(en, EINA_TRUE);
+ elm_scroller_bounce_set(en, EINA_FALSE, EINA_TRUE);
+ elm_object_text_set(en, "This entry and button below get deleted.");
+ evas_object_size_hint_weight_set(en, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(en, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ evas_object_show(en);
+ elm_box_pack_end(bx, en);
+
+ btn = elm_button_add(win);
+ elm_object_focus_allow_set(btn, EINA_FALSE);
+ elm_object_text_set(btn, "Delete this bottom bit 1");
+ evas_object_size_hint_weight_set(btn, EVAS_HINT_EXPAND, 0.0);
+ evas_object_size_hint_align_set(btn, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ elm_box_pack_end(bx, btn);
+ evas_object_show(btn);
+
+ evas_object_smart_callback_add(btn, "clicked", popobj, pg);
+
+ elm_object_content_set(conform, bx);
+ evas_object_show(bx);
+
+ conform = elm_conformant_add(win);
+ evas_object_size_hint_weight_set(conform, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(conform, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ elm_naviframe_item_simple_push(pg, conform);
+ evas_object_show(conform);
+
+ bx = elm_box_add(win);
+ evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(bx, EVAS_HINT_FILL, EVAS_HINT_FILL);
+
+ en = elm_entry_add(win);
+ elm_entry_scrollable_set(en, EINA_TRUE);
+ elm_scroller_bounce_set(en, EINA_FALSE, EINA_TRUE);
+ elm_object_text_set(en, "This entry and button below get deleted.");
+ evas_object_size_hint_weight_set(en, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(en, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ evas_object_show(en);
+ elm_box_pack_end(bx, en);
+
+ btn = elm_button_add(win);
+ elm_object_focus_allow_set(btn, EINA_FALSE);
+ elm_object_text_set(btn, "Delete this bottom bit 2");
+ evas_object_size_hint_weight_set(btn, EVAS_HINT_EXPAND, 0.0);
+ evas_object_size_hint_align_set(btn, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ elm_box_pack_end(bx, btn);
+ evas_object_show(btn);
+
+ evas_object_smart_callback_add(btn, "clicked", popobj, pg);
+
+ elm_object_content_set(conform, bx);
+ evas_object_show(bx);
+
+ evas_object_resize(win, 240, 480);
+ evas_object_show(win);
+}
diff --git a/src/bin/elementary/test_conform_indicator.c b/src/bin/elementary/test_conform_indicator.c
new file mode 100644
index 0000000000..d7c13b9e7b
--- /dev/null
+++ b/src/bin/elementary/test_conform_indicator.c
@@ -0,0 +1,384 @@
+#ifdef HAVE_CONFIG_H
+# include "elementary_config.h"
+#endif
+#include <Elementary.h>
+
+static int vis = 0;
+static int rotate_with_resize = 0;
+static Evas_Object *win_port = NULL;
+static Evas_Object *win_land = NULL;
+
+static void
+_rot_0(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
+{
+ Evas_Object *win = data;
+ if (rotate_with_resize)
+ elm_win_rotation_with_resize_set(win, 0);
+ else
+ elm_win_rotation_set(win, 0);
+}
+
+static void
+_rot_90(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
+{
+ Evas_Object *win = data;
+ if (rotate_with_resize)
+ elm_win_rotation_with_resize_set(win, 90);
+ else
+ elm_win_rotation_set(win, 90);
+}
+
+static void
+_rot_180(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
+{
+ Evas_Object *win = data;
+ if (rotate_with_resize)
+ elm_win_rotation_with_resize_set(win, 180);
+ else
+ elm_win_rotation_set(win, 180);
+}
+
+static void
+_rot_270(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
+{
+ Evas_Object *win = data;
+ if (rotate_with_resize)
+ elm_win_rotation_with_resize_set(win, 270);
+ else
+ elm_win_rotation_set(win, 270);
+}
+
+static void
+_visible_change_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
+{
+ Evas_Object *win = data;
+
+ printf("visible change before = %d\n", vis);
+ if (vis == 0)
+ {
+ elm_win_indicator_mode_set(win, ELM_WIN_INDICATOR_SHOW);
+ vis = 1;
+ }
+ else
+ {
+ elm_win_indicator_mode_set(win, ELM_WIN_INDICATOR_HIDE);
+ vis = 0;
+ }
+
+ /*Add App code here*/
+ printf("visible change after = %d\n", vis);
+}
+
+static void
+_launch_conformant_indicator_window_btn_cb(void *data EINA_UNUSED,
+ Evas_Object *obj EINA_UNUSED,
+ void *event_info EINA_UNUSED)
+{
+ Evas_Object *win, *conform, *bt, *bx;
+ Evas_Object *plug_port = NULL, *plug_land = NULL;
+
+ win = elm_win_util_standard_add("conformant-indicator",
+ "Conformant Indicator");
+ elm_win_autodel_set(win, EINA_TRUE);
+ elm_win_conformant_set(win, EINA_TRUE);
+
+ //Create conformant
+ conform = elm_conformant_add(win);
+ evas_object_size_hint_weight_set(conform, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ elm_win_resize_object_add(win, conform);
+ evas_object_show(conform);
+
+ bx = elm_box_add(conform);
+ elm_object_content_set(conform, bx);
+ evas_object_show(bx);
+
+ bt = elm_button_add(bx);
+ elm_object_text_set(bt, "Rot 0");
+ evas_object_smart_callback_add(bt, "clicked", _rot_0, win);
+ evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
+ evas_object_size_hint_fill_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ elm_box_pack_end(bx, bt);
+ evas_object_show(bt);
+
+ bt = elm_button_add(bx);
+ elm_object_text_set(bt, "Rot 90");
+ evas_object_smart_callback_add(bt, "clicked", _rot_90, win);
+ evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
+ evas_object_size_hint_fill_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ elm_box_pack_end(bx, bt);
+ evas_object_show(bt);
+
+ bt = elm_button_add(bx);
+ elm_object_text_set(bt, "Rot 180");
+ evas_object_smart_callback_add(bt, "clicked", _rot_180, win);
+ evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
+ evas_object_size_hint_fill_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ elm_box_pack_end(bx, bt);
+ evas_object_show(bt);
+
+ bt = elm_button_add(bx);
+ elm_object_text_set(bt, "Rot 270");
+ evas_object_smart_callback_add(bt, "clicked", _rot_270, win);
+ evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
+ evas_object_size_hint_fill_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ elm_box_pack_end(bx, bt);
+ evas_object_show(bt);
+
+ /* portrait plug */
+ plug_port = elm_plug_add(bx);
+ if (!plug_port)
+ {
+ printf("fail to create plug to server [elm_indicator_portrait]\n");
+ evas_object_del(win);
+ return;
+ }
+
+ if (!elm_plug_connect(plug_port, "elm_indicator_portrait", 0, EINA_FALSE))
+ {
+ printf("fail to connect to server [elm_indicator_portraits]\n");
+ evas_object_del(win);
+ return;
+ }
+ evas_object_size_hint_weight_set(plug_port, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(plug_port, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ evas_object_show(plug_port);
+ elm_box_pack_end(bx, plug_port);
+
+ /* landscape plug */
+ plug_land = elm_plug_add(bx);
+ if (!plug_land)
+ {
+ printf("fail to create plug to server [elm_indicator_landscape]\n");
+ evas_object_del(win);
+ return;
+ }
+ if (!elm_plug_connect(plug_land, "elm_indicator_landscape", 0, EINA_FALSE))
+ {
+ printf("fail to connect to server [elm_indicator_landscape]\n");
+ evas_object_del(win);
+ return;
+ }
+ evas_object_size_hint_weight_set(plug_land, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(plug_land, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ evas_object_show(plug_land);
+ elm_box_pack_end(bx, plug_land);
+
+ bt = elm_button_add(bx);
+ elm_object_text_set(bt, "Show/Hide");
+ evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0);
+ evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ elm_box_pack_end(bx, bt);
+ evas_object_show(bt);
+ evas_object_smart_callback_add(bt, "clicked", _visible_change_cb, win);
+
+ evas_object_resize(win, 400, 600);
+ evas_object_show(win);
+}
+
+static void
+_mouse_down_cb(void *data, Evas *evas EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info)
+{
+ Evas_Event_Mouse_Down *ev = event_info;
+ Evas_Object *sub_obj = data;
+
+ printf("\nAPP mouse down [%d]x[%d] obj=%p type=%s\n", ev->canvas.x, ev->canvas.y,sub_obj,evas_object_type_get(sub_obj));
+
+ evas_object_move(sub_obj, ev->canvas.x, ev->canvas.y);
+}
+
+static void
+_mouse_move_cb(void *data, Evas *evas EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info)
+{
+ Evas_Event_Mouse_Move *ev = event_info;
+ Evas_Object *sub_obj = data;
+ if (!ev->buttons) return;
+
+ printf("APP mouse move [%d]x[%d] obj=%p type=%s\n", ev->cur.canvas.x, ev->cur.canvas.y,sub_obj,evas_object_type_get(sub_obj));
+ evas_object_move(sub_obj, ev->cur.canvas.x, ev->cur.canvas.y);
+}
+
+static void
+_fill_portrait(Evas_Object *win)
+{
+ Evas_Object *bg, *btn;
+
+ bg = elm_bg_add(win);
+ evas_object_resize(bg, 720, 60);
+ elm_bg_color_set(bg, 221, 187, 187);
+ evas_object_show(bg);
+
+ btn = elm_button_add(win);
+ if (!btn)
+ {
+ printf("fail to elm_button_add() \n");
+ return;
+ }
+
+ elm_object_text_set(btn, "portrait");
+
+ evas_object_resize(btn, 200, 50);
+ evas_object_move(btn, 260, 0);
+ evas_object_show(btn);
+
+ // This checks whether the indicator gets mouse event from application correctly
+ evas_object_event_callback_add(bg, EVAS_CALLBACK_MOUSE_DOWN, _mouse_down_cb, btn);
+ evas_object_event_callback_add(bg, EVAS_CALLBACK_MOUSE_MOVE, _mouse_move_cb, btn);
+}
+
+static void
+_fill_landscape(Evas_Object *win)
+{
+ Evas_Object *bg, *btn;
+
+ bg = elm_bg_add(win);
+ evas_object_resize(bg, 1280, 60);
+ elm_bg_color_set(bg, 207, 255, 255);
+ evas_object_show(bg);
+
+ btn = elm_button_add(win);
+ if (!btn)
+ {
+ printf("fail to elm_button_add() \n");
+ return;
+ }
+
+ elm_object_text_set(btn, "landscape");
+
+ evas_object_resize(btn, 200, 50);
+ evas_object_move(btn, 580, 0);
+ evas_object_show(btn);
+
+ // This checks whether the indicator gets mouse event from application correctly
+ evas_object_event_callback_add(bg, EVAS_CALLBACK_MOUSE_DOWN, _mouse_down_cb, btn);
+ evas_object_event_callback_add(bg, EVAS_CALLBACK_MOUSE_MOVE, _mouse_move_cb, btn);
+}
+
+static Evas_Object *
+_create_portrait(void)
+{
+ const char *port_indi_name;
+
+ win_port = elm_win_add(NULL, "portrait_indicator", ELM_WIN_SOCKET_IMAGE);
+ if (!win_port)
+ {
+ printf("fail to create a portrait indicator window\n");
+ return NULL;
+ }
+ elm_win_autodel_set(win_port, EINA_TRUE);
+
+ port_indi_name = elm_config_indicator_service_get(0);
+ if (!port_indi_name)
+ {
+ printf("indicator has no portrait service name: use default name\n");
+ port_indi_name = "elm_indicator_portrait";
+ }
+
+ if (!elm_win_socket_listen(win_port, port_indi_name, 0, EINA_FALSE))
+ {
+ printf("failed to listen portrait window socket.\n");
+ evas_object_del(win_port);
+ return NULL;
+ }
+
+ elm_win_title_set(win_port, "win sock test:port");
+ elm_win_borderless_set(win_port, EINA_TRUE);
+
+ evas_object_move(win_port, 0, 0);
+ evas_object_resize(win_port, 720, 60);
+
+ _fill_portrait(win_port);
+
+ return win_port;
+}
+
+static Evas_Object *
+_create_landscape(void)
+{
+ const char *land_indi_name;
+
+ win_land = elm_win_add(NULL, "win_socket_test:land", ELM_WIN_SOCKET_IMAGE);
+ if (!win_land)
+ {
+ printf("fail to create a landscape indicator window\n");
+ return NULL;
+ }
+ elm_win_autodel_set(win_land, EINA_TRUE);
+
+ land_indi_name = elm_config_indicator_service_get(90);
+ if (!land_indi_name)
+ {
+ printf("indicator has no landscape service name: use default name\n");
+ land_indi_name = "elm_indicator_landscape";
+ }
+
+ if (!elm_win_socket_listen(win_land, land_indi_name, 0, 0))
+ {
+ printf("fail to listen landscape window socket.\n");
+ evas_object_del(win_land);
+ return NULL;
+ }
+
+ elm_win_title_set(win_land, "win sock test:land");
+ elm_win_borderless_set(win_land, EINA_TRUE);
+
+ evas_object_move(win_land, 0, 0);
+ evas_object_resize(win_land, 1280, 60);
+
+ _fill_landscape(win_land);
+
+ return win_land;
+}
+
+static void
+_indicator_service_start_btn_cb(void *data, Evas_Object *obj EINA_UNUSED,
+ void *event EINA_UNUSED)
+{
+ elm_object_disabled_set(data, EINA_TRUE);
+
+ win_port = _create_portrait();
+ if (!win_port) return;
+
+ win_land = _create_landscape();
+ if (!win_land) return;
+
+ evas_object_show(win_port);
+ evas_object_show(win_land);
+
+}
+
+void
+test_conformant_indicator(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
+ void *event EINA_UNUSED)
+{
+ Evas_Object *win, *btn, *bx;
+
+ win = elm_win_util_standard_add("conformant-indicator-service",
+ "Conformant Indicator Service");
+ elm_win_autodel_set(win, EINA_TRUE);
+
+ bx = elm_box_add(win);
+ evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ elm_win_resize_object_add(win, bx);
+ evas_object_show(bx);
+
+ btn = elm_button_add(win);
+ elm_object_text_set(btn, "Start Indicator Service");
+ evas_object_size_hint_weight_set(btn, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(btn, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ elm_box_pack_end(bx, btn);
+ evas_object_show(btn);
+ evas_object_smart_callback_add(btn, "clicked",
+ _indicator_service_start_btn_cb, btn);
+
+ btn = elm_button_add(win);
+ elm_object_text_set(btn, "Launch Conformant Indicator Window");
+ evas_object_size_hint_weight_set(btn, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(btn, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ elm_box_pack_end(bx, btn);
+ evas_object_show(btn);
+ evas_object_smart_callback_add(btn, "clicked",
+ _launch_conformant_indicator_window_btn_cb, NULL);
+
+ evas_object_resize(win, 200, 200);
+ evas_object_show(win);
+}
diff --git a/src/bin/elementary/test_ctxpopup.c b/src/bin/elementary/test_ctxpopup.c
new file mode 100644
index 0000000000..27e5376a2a
--- /dev/null
+++ b/src/bin/elementary/test_ctxpopup.c
@@ -0,0 +1,433 @@
+#ifdef HAVE_CONFIG_H
+# include "elementary_config.h"
+#endif
+#include <Elementary.h>
+
+static int list_mouse_down = 0;
+
+static void
+_dismissed(void *data EINA_UNUSED, Evas_Object *obj, void *event_info EINA_UNUSED)
+{
+ evas_object_del(obj);
+}
+
+static void
+_print_current_dir(Evas_Object *obj)
+{
+ Elm_Ctxpopup_Direction dir;
+ dir = elm_ctxpopup_direction_get(obj);
+
+ switch(dir)
+ {
+ case ELM_CTXPOPUP_DIRECTION_LEFT:
+ printf("ctxpopup direction: left!\n");
+ break;
+ case ELM_CTXPOPUP_DIRECTION_RIGHT:
+ printf("ctxpopup direction: right!\n");
+ break;
+ case ELM_CTXPOPUP_DIRECTION_UP:
+ printf("ctxpopup direction: up!\n");
+ break;
+ case ELM_CTXPOPUP_DIRECTION_DOWN:
+ printf("ctxpopup direction: down!\n");
+ break;
+ case ELM_CTXPOPUP_DIRECTION_UNKNOWN:
+ printf("ctxpopup direction: unknow!\n");
+ break;
+ }
+ printf(" [%s : %d] auto_hide_mode=%d\n", __func__, __LINE__, elm_ctxpopup_auto_hide_disabled_get(obj));
+}
+
+static void
+_btn_clicked_cb(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
+ void *event_info EINA_UNUSED)
+{
+ printf("Button Clicked\n");
+}
+
+static void
+_ctxpopup_item_cb(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info)
+{
+ printf("ctxpopup item selected: %s\n",
+ elm_object_item_text_get(event_info));
+}
+
+static Elm_Object_Item *
+_ctxpopup_item_new(Evas_Object *obj, const char *label, const char *icon)
+{
+ Evas_Object *ic = NULL;
+ Elm_Object_Item *it = NULL;
+
+ if (!obj) return NULL;
+
+ if (icon)
+ {
+ ic = elm_icon_add(obj);
+ elm_icon_standard_set(ic, icon);
+ elm_image_resizable_set(ic, EINA_FALSE, EINA_FALSE);
+ }
+
+ it = elm_ctxpopup_item_append(obj, label, ic, _ctxpopup_item_cb, NULL);
+ return it;
+}
+
+static void
+_geometry_update(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info)
+{
+ Evas_Coord_Rectangle *geom = event_info;
+ printf("ctxpopup geometry(%d %d %d %d)\n", geom->x, geom->y, geom->w, geom->h);
+}
+
+static void
+_list_item_cb(void *data EINA_UNUSED, Evas_Object *obj, void *event_info EINA_UNUSED)
+{
+ Evas_Object *ctxpopup;
+ Elm_Object_Item *it = NULL;
+ Evas_Coord x,y;
+
+ if (list_mouse_down > 0) return;
+
+ ctxpopup = elm_ctxpopup_add(obj);
+ evas_object_smart_callback_add(ctxpopup, "dismissed", _dismissed, NULL);
+ evas_object_smart_callback_add(ctxpopup, "geometry,update", _geometry_update, NULL);
+
+ _ctxpopup_item_new(ctxpopup, "Go to home folder", "home");
+ _ctxpopup_item_new(ctxpopup, "Save file", "file");
+ _ctxpopup_item_new(ctxpopup, "Delete file", "delete");
+ it = _ctxpopup_item_new(ctxpopup, "Navigate to folder", "folder");
+ elm_object_item_disabled_set(it, EINA_TRUE);
+ _ctxpopup_item_new(ctxpopup, "Edit entry", "edit");
+ it = _ctxpopup_item_new(ctxpopup, "Set date and time", "clock");
+ elm_object_item_disabled_set(it, EINA_TRUE);
+
+ evas_pointer_canvas_xy_get(evas_object_evas_get(obj), &x, &y);
+ evas_object_size_hint_max_set(ctxpopup, 240, 240);
+ evas_object_move(ctxpopup, x, y);
+ evas_object_show(ctxpopup);
+ _print_current_dir(ctxpopup);
+}
+
+static void
+_list_item_cb2(void *data EINA_UNUSED, Evas_Object *obj, void *event_info EINA_UNUSED)
+{
+ Evas_Object *ctxpopup;
+ Elm_Object_Item *it = NULL;
+ Evas_Coord x,y;
+
+ if (list_mouse_down > 0) return;
+
+ ctxpopup = elm_ctxpopup_add(obj);
+ evas_object_smart_callback_add(ctxpopup, "dismissed", _dismissed, NULL);
+ evas_object_smart_callback_add(ctxpopup, "geometry,update", _geometry_update, NULL);
+
+ _ctxpopup_item_new(ctxpopup, NULL, "home");
+ _ctxpopup_item_new(ctxpopup, NULL, "file");
+ _ctxpopup_item_new(ctxpopup, NULL, "delete");
+ _ctxpopup_item_new(ctxpopup, NULL, "folder");
+ it = _ctxpopup_item_new(ctxpopup, NULL, "edit");
+ elm_object_item_disabled_set(it, EINA_TRUE);
+ _ctxpopup_item_new(ctxpopup, NULL, "clock");
+
+ evas_pointer_canvas_xy_get(evas_object_evas_get(obj), &x, &y);
+ evas_object_size_hint_max_set(ctxpopup, 240, 240);
+ evas_object_move(ctxpopup, x, y);
+ evas_object_show(ctxpopup);
+ _print_current_dir(ctxpopup);
+}
+
+static void
+_list_item_cb3(void *data EINA_UNUSED, Evas_Object *obj, void *event_info EINA_UNUSED)
+{
+ Evas_Object *ctxpopup;
+ Elm_Object_Item *it = NULL;
+ Evas_Coord x,y;
+
+ if (list_mouse_down > 0) return;
+
+ ctxpopup = elm_ctxpopup_add(obj);
+ evas_object_smart_callback_add(ctxpopup, "dismissed", _dismissed, NULL);
+ evas_object_smart_callback_add(ctxpopup, "geometry,update", _geometry_update, NULL);
+
+ _ctxpopup_item_new(ctxpopup, "Eina", NULL);
+ _ctxpopup_item_new(ctxpopup, "Eet", NULL);
+ _ctxpopup_item_new(ctxpopup, "Evas", NULL);
+ it = _ctxpopup_item_new(ctxpopup, "Ecore", NULL);
+ elm_object_item_disabled_set(it, EINA_TRUE);
+ _ctxpopup_item_new(ctxpopup, "Embryo", NULL);
+ _ctxpopup_item_new(ctxpopup, "Edje", NULL);
+
+ evas_pointer_canvas_xy_get(evas_object_evas_get(obj), &x, &y);
+ evas_object_move(ctxpopup, x, y);
+ evas_object_show(ctxpopup);
+ _print_current_dir(ctxpopup);
+}
+
+static void
+_list_item_cb4(void *data EINA_UNUSED, Evas_Object *obj, void *event_info EINA_UNUSED)
+{
+ Evas_Object *ctxpopup;
+ Evas_Coord x,y;
+
+ if (list_mouse_down > 0) return;
+
+ ctxpopup = elm_ctxpopup_add(obj);
+ evas_object_smart_callback_add(ctxpopup, "dismissed", _dismissed, NULL);
+ evas_object_smart_callback_add(ctxpopup, "geometry,update", _geometry_update, NULL);
+
+ elm_ctxpopup_horizontal_set(ctxpopup, EINA_TRUE);
+
+ _ctxpopup_item_new(ctxpopup, NULL, "home");
+ _ctxpopup_item_new(ctxpopup, NULL, "file");
+ _ctxpopup_item_new(ctxpopup, NULL, "delete");
+ _ctxpopup_item_new(ctxpopup, NULL, "folder");
+ _ctxpopup_item_new(ctxpopup, NULL, "edit");
+ _ctxpopup_item_new(ctxpopup, NULL, "clock");
+
+ evas_pointer_canvas_xy_get(evas_object_evas_get(obj), &x, &y);
+ evas_object_size_hint_max_set(ctxpopup, 240, 240);
+ evas_object_move(ctxpopup, x, y);
+ evas_object_show(ctxpopup);
+ _print_current_dir(ctxpopup);
+}
+
+static void
+_list_item_cb5(void *data EINA_UNUSED, Evas_Object *obj, void *event_info EINA_UNUSED)
+{
+ Evas_Object *ctxpopup, *btn, *sc, *bx;
+ Evas_Coord x,y;
+
+ if (list_mouse_down > 0) return;
+
+ bx = elm_box_add(obj);
+ evas_object_size_hint_min_set(bx, 150, 150);
+
+ sc = elm_scroller_add(bx);
+ elm_scroller_bounce_set(sc, EINA_FALSE, EINA_TRUE);
+ evas_object_size_hint_fill_set(sc, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ evas_object_size_hint_weight_set(sc, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_show(sc);
+
+ btn = elm_button_add(sc);
+ elm_object_text_set(btn, "Enlightenment");
+ evas_object_size_hint_min_set(btn, 140, 140);
+
+ elm_object_content_set(sc, btn);
+
+ elm_box_pack_end(bx, sc);
+
+ ctxpopup = elm_ctxpopup_add(obj);
+ evas_object_smart_callback_add(ctxpopup, "dismissed", _dismissed, NULL);
+ evas_object_smart_callback_add(ctxpopup, "geometry,update", _geometry_update, NULL);
+
+ elm_object_content_set(ctxpopup, bx);
+
+ evas_pointer_canvas_xy_get(evas_object_evas_get(obj), &x, &y);
+ evas_object_move(ctxpopup, x, y);
+ evas_object_show(ctxpopup);
+ _print_current_dir(ctxpopup);
+
+ evas_object_smart_callback_add(btn, "clicked", _btn_clicked_cb, ctxpopup);
+}
+
+static void
+_ctxpopup_del_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
+ void *event_info EINA_UNUSED)
+{
+ evas_object_del(data);
+}
+
+static void
+_restack_btn_clicked_cb(void *data, Evas_Object *obj,
+ void *event_info EINA_UNUSED)
+{
+ Evas_Object *im, *ctxpopup = data;
+ char buf[PATH_MAX];
+
+ printf("Restack button clicked\n");
+
+ im = evas_object_image_filled_add(evas_object_evas_get(obj));
+ snprintf(buf, sizeof(buf), "%s/images/%s",
+ elm_app_data_dir_get(), "twofish.jpg");
+ evas_object_image_file_set(im, buf, NULL);
+ evas_object_move(im, 40, 40);
+ evas_object_resize(im, 320, 320);
+ evas_object_show(im);
+
+ evas_object_raise(ctxpopup);
+ evas_object_event_callback_add(ctxpopup, EVAS_CALLBACK_DEL,
+ _ctxpopup_del_cb, im);
+}
+
+static void
+_list_item_cb6(void *data EINA_UNUSED, Evas_Object *obj, void *event_info EINA_UNUSED)
+{
+ Evas_Object *ctxpopup, *btn, *sc, *bx;
+ Evas_Coord x,y;
+
+ if (list_mouse_down > 0) return;
+
+ bx = elm_box_add(obj);
+ evas_object_size_hint_min_set(bx, 200, 150);
+
+ sc = elm_scroller_add(bx);
+ elm_scroller_bounce_set(sc, EINA_FALSE, EINA_TRUE);
+ evas_object_size_hint_fill_set(sc, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ evas_object_size_hint_weight_set(sc, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_show(sc);
+
+ btn = elm_button_add(sc);
+ elm_object_text_set(btn, "Ctxpop will be on the top of layer");
+ evas_object_size_hint_min_set(btn, 190, 140);
+
+ elm_object_content_set(sc, btn);
+
+ elm_box_pack_end(bx, sc);
+
+ ctxpopup = elm_ctxpopup_add(obj);
+ evas_object_smart_callback_add(ctxpopup, "dismissed", _dismissed, NULL);
+ evas_object_smart_callback_add(ctxpopup, "geometry,update", _geometry_update, NULL);
+
+ elm_object_content_set(ctxpopup, bx);
+
+ evas_pointer_canvas_xy_get(evas_object_evas_get(obj), &x, &y);
+ evas_object_move(ctxpopup, x, y);
+ evas_object_show(ctxpopup);
+ _print_current_dir(ctxpopup);
+
+ evas_object_smart_callback_add(btn, "clicked",
+ _restack_btn_clicked_cb, ctxpopup);
+}
+
+static void
+_ctxpopup_item_disable_cb(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info)
+{
+ printf("ctxpopup item selected: %s\n",
+ elm_object_item_text_get(event_info));
+
+ elm_object_item_disabled_set(event_info, EINA_TRUE);
+}
+
+static void
+_ctxpopup_item_delete_cb(void *data EINA_UNUSED, Evas_Object *obj, void *event_info)
+{
+ printf("ctxpopup item selected: %s\n",
+ elm_object_item_text_get(event_info));
+
+ evas_object_del(obj);
+}
+
+static void
+_list_item_cb7(void *data EINA_UNUSED, Evas_Object *obj, void *event_info EINA_UNUSED)
+{
+ Evas_Object *ctxpopup;
+ Evas_Coord x,y;
+
+ if (list_mouse_down > 0) return;
+ ctxpopup = elm_ctxpopup_add(obj);
+ evas_object_smart_callback_add(ctxpopup, "dismissed", _dismissed, NULL);
+ evas_object_smart_callback_add(ctxpopup, "geometry,update", _geometry_update, NULL);
+
+ elm_ctxpopup_item_append(ctxpopup, "Disable this item", NULL, _ctxpopup_item_disable_cb, ctxpopup);
+ elm_ctxpopup_item_append(ctxpopup, "Delete this ctxpopup", NULL, _ctxpopup_item_delete_cb, ctxpopup);
+ elm_ctxpopup_item_append(ctxpopup, "Another item", NULL, _ctxpopup_item_cb, NULL);
+
+ evas_pointer_canvas_xy_get(evas_object_evas_get(obj), &x, &y);
+ evas_object_size_hint_max_set(ctxpopup, 240, 240);
+ evas_object_move(ctxpopup, x, y);
+ evas_object_show(ctxpopup);
+ _print_current_dir(ctxpopup);
+}
+
+static void
+_list_item_cb8(void *data EINA_UNUSED, Evas_Object *obj, void *event_info EINA_UNUSED)
+{
+ Evas_Object *ctxpopup;
+ Elm_Object_Item *it = NULL;
+ Evas_Coord x,y;
+
+ if (list_mouse_down > 0) return;
+
+ ctxpopup = elm_ctxpopup_add(obj);
+ evas_object_smart_callback_add(ctxpopup, "dismissed", _dismissed, NULL);
+ evas_object_smart_callback_add(ctxpopup, "geometry,update", _geometry_update, NULL);
+
+ elm_ctxpopup_auto_hide_disabled_set(ctxpopup, EINA_TRUE);
+
+ _ctxpopup_item_new(ctxpopup, "Go to home folder", "home");
+ _ctxpopup_item_new(ctxpopup, "Save file", "file");
+ _ctxpopup_item_new(ctxpopup, "Delete file", "delete");
+ it = _ctxpopup_item_new(ctxpopup, "Navigate to folder", "folder");
+ elm_object_item_disabled_set(it, EINA_TRUE);
+ _ctxpopup_item_new(ctxpopup, "Edit entry", "edit");
+
+ evas_pointer_canvas_xy_get(evas_object_evas_get(obj), &x, &y);
+ evas_object_move(ctxpopup, x, y);
+ evas_object_show(ctxpopup);
+ _print_current_dir(ctxpopup);
+}
+
+static void
+_list_clicked(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info)
+{
+ elm_list_item_selected_set(event_info, EINA_FALSE);
+}
+
+static void
+_list_mouse_down(void *data EINA_UNUSED, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
+{
+ list_mouse_down++;
+}
+
+static void
+_list_mouse_up(void *data EINA_UNUSED, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
+{
+ list_mouse_down--;
+}
+
+static void
+_win_del(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
+{
+ list_mouse_down = 0;
+}
+
+void
+test_ctxpopup(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
+{
+ Evas_Object *win, *list;
+
+ win = elm_win_util_standard_add("contextual-popup", "Contextual Popup");
+ evas_object_smart_callback_add(win, "delete,request", _win_del, NULL);
+ elm_win_autodel_set(win, EINA_TRUE);
+
+ list = elm_list_add(win);
+ evas_object_event_callback_add(list, EVAS_CALLBACK_MOUSE_DOWN,
+ _list_mouse_down, NULL);
+ evas_object_event_callback_add(list, EVAS_CALLBACK_MOUSE_UP,
+ _list_mouse_up, NULL);
+ evas_object_size_hint_weight_set(list, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ elm_win_resize_object_add(win, list);
+ elm_list_mode_set(list, ELM_LIST_COMPRESS);
+ evas_object_smart_callback_add(list, "selected", _list_clicked, NULL);
+
+ elm_list_item_append(list, "Ctxpopup with icons and labels", NULL, NULL,
+ _list_item_cb, NULL);
+ elm_list_item_append(list, "Ctxpopup with icons only", NULL, NULL,
+ _list_item_cb2, NULL);
+ elm_list_item_append(list, "Ctxpopup with labels only", NULL, NULL,
+ _list_item_cb3, NULL);
+ elm_list_item_append(list, "Ctxpopup at horizontal mode", NULL, NULL,
+ _list_item_cb4, NULL);
+ elm_list_item_append(list, "Ctxpopup with user content", NULL, NULL,
+ _list_item_cb5, NULL);
+ elm_list_item_append(list, "Ctxpopup with restacking", NULL, NULL,
+ _list_item_cb6, NULL);
+ elm_list_item_append(list, "Ctxpopup with callback function", NULL, NULL,
+ _list_item_cb7, NULL);
+ elm_list_item_append(list, "Ctxpopup with auto hide disabled mode", NULL, NULL,
+ _list_item_cb8, NULL);
+ evas_object_show(list);
+ elm_list_go(list);
+
+ evas_object_resize(win, 400, 400);
+ evas_object_show(win);
+}
diff --git a/src/bin/elementary/test_cursor.c b/src/bin/elementary/test_cursor.c
new file mode 100644
index 0000000000..1e6401abb9
--- /dev/null
+++ b/src/bin/elementary/test_cursor.c
@@ -0,0 +1,473 @@
+#include <Elementary_Cursor.h>
+#ifdef HAVE_CONFIG_H
+# include "elementary_config.h"
+#endif
+#include <Elementary.h>
+
+// XXX: show all type of cursors in the elementary_test. this needs to be the first test
+
+typedef struct _Testitem
+{
+ Elm_Object_Item *item;
+ const char *path;
+ int mode;
+ int onoff;
+} Testitem;
+
+static Elm_Gengrid_Item_Class gic;
+static Eina_Bool cursor_setted = EINA_FALSE;
+
+char *
+grd_lbl_get(void *data, Evas_Object *obj EINA_UNUSED, const char *part EINA_UNUSED)
+{
+ const Testitem *ti = data;
+ char buf[256];
+ snprintf(buf, sizeof(buf), "Photo %s", ti->path);
+ return strdup(buf);
+}
+
+Evas_Object *
+grd_content_get(void *data, Evas_Object *obj, const char *part)
+{
+ const Testitem *ti = data;
+ if (!strcmp(part, "elm.swallow.icon"))
+ {
+ Evas_Object *icon = elm_bg_add(obj);
+ elm_bg_file_set(icon, ti->path, NULL);
+ evas_object_size_hint_aspect_set(icon, EVAS_ASPECT_CONTROL_VERTICAL,
+ 1, 1);
+ evas_object_show(icon);
+ return icon;
+ }
+ return NULL;
+}
+
+static Elm_Genlist_Item_Class itct;
+
+static void
+glt_exp(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info)
+{
+ Elm_Object_Item *glit = event_info;
+ Evas_Object *gl = elm_object_item_widget_get(glit);
+ int val = (int)(uintptr_t) elm_object_item_data_get(glit);
+ Elm_Object_Item *glit1, *glit2, *glit3;
+
+ val *= 10;
+ glit1 = elm_genlist_item_append(gl, &itct, (void *)(uintptr_t) (val + 1), glit,
+ ELM_GENLIST_ITEM_NONE, NULL, NULL);
+ glit2 = elm_genlist_item_append(gl, &itct, (void *)(uintptr_t) (val + 2), glit,
+ ELM_GENLIST_ITEM_NONE, NULL, NULL);
+ glit3 = elm_genlist_item_append(gl, &itct, (void *)(uintptr_t) (val + 3), glit,
+ ELM_GENLIST_ITEM_TREE, NULL, NULL);
+
+ elm_genlist_item_cursor_set(glit1, ELM_CURSOR_HAND2);
+ elm_genlist_item_cursor_set(glit2, ELM_CURSOR_HAND2);
+ elm_genlist_item_cursor_set(glit3, ELM_CURSOR_HAND1);
+
+}
+
+static void
+glt_con(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info)
+{
+ Elm_Object_Item *glit = event_info;
+ elm_genlist_item_subitems_clear(glit);
+}
+
+static void
+glt_exp_req(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info)
+{
+ Elm_Object_Item *glit = event_info;
+ elm_genlist_item_expanded_set(glit, EINA_TRUE);
+}
+
+static void
+glt_con_req(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info)
+{
+ Elm_Object_Item *glit = event_info;
+ elm_genlist_item_expanded_set(glit, EINA_FALSE);
+}
+
+char *
+glt_text_get(void *data, Evas_Object *obj EINA_UNUSED, const char *part EINA_UNUSED)
+{
+ char buf[256];
+ snprintf(buf, sizeof(buf), "Item mode %i", (int)(uintptr_t)data);
+ return strdup(buf);
+}
+
+static void
+bt_clicked(void *data EINA_UNUSED, Evas_Object *obj, void *event_info EINA_UNUSED)
+{
+ if (cursor_setted)
+ {
+ elm_object_cursor_unset(obj);
+ cursor_setted = EINA_FALSE;
+ elm_object_text_set(obj, "Cursor set on click");
+ }
+ else
+ {
+ elm_object_cursor_set(obj, ELM_CURSOR_HAND1);
+ cursor_setted = EINA_TRUE;
+ elm_object_text_set(obj, "Cursor unset on click");
+ }
+}
+
+void
+test_cursor(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
+{
+ Evas_Object *win, *bg, *bx, *bt, *list, *entry, *ck;
+ Elm_Object_Item *lit;
+
+ win = elm_win_add(NULL, "cursor", ELM_WIN_BASIC);
+ elm_win_title_set(win, "Cursor");
+ elm_win_autodel_set(win, EINA_TRUE);
+
+ bg = elm_bg_add(win);
+ evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ elm_win_resize_object_add(win, bg);
+ evas_object_show(bg);
+ elm_object_cursor_set(bg, ELM_CURSOR_CIRCLE);
+
+ bx = elm_box_add(win);
+ evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ elm_win_resize_object_add(win, bx);
+ evas_object_show(bx);
+
+ ck = elm_clock_add(win);
+ elm_object_cursor_set(ck, ELM_CURSOR_CLOCK);
+ elm_box_pack_end(bx, ck);
+ evas_object_show(ck);
+
+ bt = elm_button_add(win);
+ elm_object_cursor_set(bt, ELM_CURSOR_COFFEE_MUG);
+ elm_object_text_set(bt, "Coffee Mug");
+ elm_box_pack_end(bx, bt);
+ evas_object_show(bt);
+
+ bt = elm_button_add(win);
+ elm_object_cursor_set(bt, ELM_CURSOR_CLOCK);
+ elm_object_text_set(bt, "Cursor unset");
+ elm_object_cursor_unset(bt);
+ elm_box_pack_end(bx, bt);
+ evas_object_show(bt);
+
+ bt = elm_button_add(win);
+ elm_object_text_set(bt, "Cursor set on click");
+ evas_object_smart_callback_add(bt, "clicked", bt_clicked, NULL);
+ elm_box_pack_end(bx, bt);
+ evas_object_show(bt);
+
+ list = elm_list_add(win);
+ elm_box_pack_end(bx, list);
+ evas_object_size_hint_weight_set(list, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_fill_set(list, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ elm_object_cursor_set(list, ELM_CURSOR_WATCH);
+ lit = elm_list_item_append(list, "watch over list | hand1", NULL, NULL, NULL,
+ NULL);
+ elm_object_item_cursor_set(lit, ELM_CURSOR_HAND1);
+ lit = elm_list_item_append(list, "watch over list | hand2", NULL, NULL, NULL,
+ NULL);
+ elm_object_item_cursor_set(lit, ELM_CURSOR_HAND2);
+ elm_list_go(list);
+ evas_object_show(list);
+
+ entry = elm_entry_add(win);
+ elm_entry_scrollable_set(entry, EINA_TRUE);
+ elm_object_text_set(entry, "Xterm cursor");
+ elm_entry_single_line_set(entry, EINA_TRUE);
+ evas_object_size_hint_weight_set(entry, EVAS_HINT_EXPAND, 0);
+ evas_object_size_hint_fill_set(entry, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ elm_box_pack_end(bx, entry);
+ evas_object_show(entry);
+ elm_object_cursor_set(entry, ELM_CURSOR_XTERM);
+
+ evas_object_resize(win, 320, 480);
+ evas_object_show(win);
+}
+
+void
+test_cursor2(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
+{
+ Evas_Object *win, *bx, *o, *grid, *gl;
+ Elm_Object_Item *glit1, *glit2, *glit3;
+ Elm_Object_Item *tb_it;
+ Elm_Object_Item *lit;
+ char buf[PATH_MAX];
+ static Testitem ti[144];
+ int i, n;
+ const char *img[9] =
+ {
+ "panel_01.jpg",
+ "plant_01.jpg",
+ "rock_01.jpg",
+ "rock_02.jpg",
+ "sky_01.jpg",
+ "sky_02.jpg",
+ "sky_03.jpg",
+ "sky_04.jpg",
+ "wood_01.jpg",
+ };
+
+ win = elm_win_util_standard_add("cursor2", "Cursor 2");
+ elm_win_autodel_set(win, EINA_TRUE);
+
+ bx = elm_box_add(win);
+ evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ elm_win_resize_object_add(win, bx);
+ evas_object_show(bx);
+
+ o = elm_toolbar_add(win);
+ elm_toolbar_homogeneous_set(o, EINA_FALSE);
+ evas_object_size_hint_weight_set(o, 0.0, 0.0);
+ evas_object_size_hint_align_set(o, EVAS_HINT_FILL, 0.0);
+ tb_it = elm_toolbar_item_append(o, NULL, "Bogosity", NULL, NULL);
+ elm_object_item_cursor_set(tb_it, ELM_CURSOR_BOGOSITY);
+ tb_it = elm_toolbar_item_append(o, NULL, "Unset", NULL, NULL);
+ elm_object_item_cursor_set(tb_it, ELM_CURSOR_BOGOSITY);
+ elm_object_item_cursor_unset(tb_it);
+ tb_it = elm_toolbar_item_append(o, NULL, "Xterm", NULL, NULL);
+ elm_object_item_cursor_set(tb_it, ELM_CURSOR_XTERM);
+ elm_box_pack_end(bx, o);
+ evas_object_show(o);
+
+ o = elm_list_add(win);
+ elm_box_pack_end(bx, o);
+ evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_fill_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ lit = elm_list_item_append(o, "cursor bogosity", NULL, NULL, NULL, NULL);
+ elm_object_item_cursor_set(lit, ELM_CURSOR_BOGOSITY);
+ lit = elm_list_item_append(o, "cursor unset", NULL, NULL, NULL, NULL);
+ elm_object_item_cursor_set(lit, ELM_CURSOR_BOGOSITY);
+ elm_object_item_cursor_unset(lit);
+ lit = elm_list_item_append(o, "cursor xterm", NULL, NULL, NULL, NULL);
+ elm_object_item_cursor_set(lit, ELM_CURSOR_XTERM);
+ elm_list_go(o);
+ evas_object_show(o);
+
+ gl = elm_genlist_add(win);
+ evas_object_size_hint_align_set(gl, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ evas_object_size_hint_weight_set(gl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_show(gl);
+
+ itct.item_style = "default";
+ itct.func.text_get = glt_text_get;
+
+ glit1 = elm_genlist_item_append(gl, &itct, (void *) 1, NULL,
+ ELM_GENLIST_ITEM_TREE, NULL, NULL);
+ glit2 = elm_genlist_item_append(gl, &itct, (void *) 2, NULL,
+ ELM_GENLIST_ITEM_TREE, NULL, NULL);
+ glit3 = elm_genlist_item_append(gl, &itct, (void *) 3, NULL,
+ ELM_GENLIST_ITEM_NONE, NULL, NULL);
+
+ elm_genlist_item_cursor_set(glit1, ELM_CURSOR_HAND1);
+ elm_genlist_item_cursor_set(glit2, ELM_CURSOR_HAND1);
+ elm_genlist_item_cursor_set(glit3, ELM_CURSOR_CROSS);
+
+ evas_object_smart_callback_add(gl, "expand,request", glt_exp_req, gl);
+ evas_object_smart_callback_add(gl, "contract,request", glt_con_req, gl);
+ evas_object_smart_callback_add(gl, "expanded", glt_exp, gl);
+ evas_object_smart_callback_add(gl, "contracted", glt_con, gl);
+
+ elm_box_pack_end(bx, gl);
+
+ grid = elm_gengrid_add(win);
+ elm_gengrid_item_size_set(grid, 130, 130);
+ elm_gengrid_horizontal_set(grid, EINA_FALSE);
+ elm_gengrid_multi_select_set(grid, EINA_TRUE);
+ evas_object_size_hint_weight_set(grid, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_fill_set(grid, EVAS_HINT_FILL, EVAS_HINT_FILL);
+
+ gic.item_style = "default";
+ gic.func.text_get = grd_lbl_get;
+ gic.func.content_get = grd_content_get;
+
+ n = 0;
+ for (i = 0; i < 3 * 3; i++)
+ {
+ snprintf(buf, sizeof(buf), "%s/images/%s", elm_app_data_dir_get(), img[n]);
+ n = (n + 1) % 9;
+ ti[i].mode = i;
+ ti[i].path = eina_stringshare_add(buf);
+ ti[i].item = elm_gengrid_item_append(grid, &gic, &(ti[i]), NULL, NULL);
+ if (n % 2)
+ elm_gengrid_item_cursor_set(ti[i].item, ELM_CURSOR_HAND1);
+ else
+ elm_gengrid_item_cursor_set(ti[i].item, ELM_CURSOR_CLOCK);
+ if (!(i % 5))
+ elm_gengrid_item_selected_set(ti[i].item, EINA_TRUE);
+ }
+ elm_box_pack_end(bx, grid);
+ evas_object_show(grid);
+
+ evas_object_resize(win, 320, 480);
+ evas_object_show(win);
+}
+
+void
+test_cursor3(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
+{
+ Evas_Object *win, *bx, *o;
+ Elm_Object_Item *lit;
+ char buf[PATH_MAX];
+
+ win = elm_win_util_standard_add("cursor3", "Cursor 3");
+ elm_win_autodel_set(win, EINA_TRUE);
+
+ snprintf(buf, sizeof(buf), "%s/objects/cursors.edj", elm_app_data_dir_get());
+ elm_theme_extension_add(NULL, buf);
+
+ bx = elm_box_add(win);
+ evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ elm_win_resize_object_add(win, bx);
+ evas_object_show(bx);
+
+ o = elm_button_add(win);
+ evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, 0);
+ evas_object_size_hint_fill_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ elm_object_cursor_set(o, ELM_CURSOR_HAND1);
+ elm_object_cursor_theme_search_enabled_set(o, EINA_TRUE);
+ elm_object_text_set(o, "hand1");
+ elm_box_pack_end(bx, o);
+ evas_object_show(o);
+
+ o = elm_button_add(win);
+ elm_object_cursor_set(o, ELM_CURSOR_HAND2);
+ elm_object_text_set(o, "hand2 x");
+ elm_box_pack_end(bx, o);
+ evas_object_show(o);
+
+ o = elm_button_add(win);
+ elm_object_cursor_set(o, ELM_CURSOR_HAND2);
+ elm_object_cursor_theme_search_enabled_set(o, EINA_TRUE);
+ elm_object_text_set(o, "hand2");
+ elm_box_pack_end(bx, o);
+ evas_object_show(o);
+
+ o = elm_button_add(win);
+ elm_object_cursor_set(o, "hand3");
+ elm_object_cursor_theme_search_enabled_set(o, EINA_TRUE);
+ elm_object_text_set(o, "hand3");
+ elm_box_pack_end(bx, o);
+ evas_object_show(o);
+
+ o = elm_button_add(win);
+ elm_object_cursor_set(o, "hand3");
+ elm_object_cursor_theme_search_enabled_set(o, EINA_TRUE);
+ elm_object_cursor_style_set(o, "transparent");
+ elm_object_text_set(o, "hand3 transparent");
+ elm_box_pack_end(bx, o);
+ evas_object_show(o);
+
+ o = elm_button_add(win);
+ elm_object_cursor_set(o, "hand3");
+ elm_object_cursor_theme_search_enabled_set(o, EINA_TRUE);
+ elm_object_cursor_unset(o);
+ elm_object_text_set(o, "unset");
+ elm_box_pack_end(bx, o);
+ evas_object_show(o);
+
+ o = elm_button_add(win);
+ elm_object_cursor_set(o, "hand4");
+ elm_object_text_set(o, "not existent");
+ elm_box_pack_end(bx, o);
+ evas_object_show(o);
+
+ elm_config_cursor_engine_only_set(EINA_FALSE);
+ o = elm_button_add(win);
+ elm_object_cursor_set(o, "hand2");
+ elm_object_text_set(o, "hand 2 engine only config false");
+ elm_box_pack_end(bx, o);
+ evas_object_show(o);
+
+ elm_config_cursor_engine_only_set(EINA_TRUE);
+ o = elm_button_add(win);
+ elm_object_cursor_set(o, "hand2");
+ elm_object_text_set(o, "hand 2 engine only config true");
+ elm_box_pack_end(bx, o);
+ evas_object_show(o);
+
+ o = elm_list_add(win);
+ elm_box_pack_end(bx, o);
+ evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_fill_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ lit = elm_list_item_append(o, "cursor hand2 x", NULL, NULL, NULL, NULL);
+ elm_object_item_cursor_set(lit, ELM_CURSOR_HAND2);
+ lit = elm_list_item_append(o, "cursor hand2", NULL, NULL, NULL, NULL);
+ elm_object_item_cursor_set(lit, ELM_CURSOR_HAND2);
+ elm_object_item_cursor_engine_only_set(lit, EINA_FALSE);
+ lit = elm_list_item_append(o, "cursor hand3", NULL, NULL, NULL, NULL);
+ elm_object_item_cursor_set(lit, "hand3");
+ elm_object_item_cursor_engine_only_set(lit, EINA_FALSE);
+ lit = elm_list_item_append(o, "cursor hand3 transparent", NULL, NULL,
+ NULL, NULL);
+ elm_object_item_cursor_set(lit, "hand3");
+ elm_object_item_cursor_style_set(lit, "transparent");
+ elm_object_item_cursor_engine_only_set(lit, EINA_FALSE);
+ elm_list_go(o);
+ evas_object_show(o);
+
+ evas_object_resize(win, 320, 480);
+ evas_object_show(win);
+}
+
+void
+test_cursor4(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
+{
+ Evas_Object *win, *bx, *ly, *bt;
+ char buf[PATH_MAX];
+
+ win = elm_win_util_standard_add("cursor layout", "Cursor Layout");
+ elm_win_autodel_set(win, EINA_TRUE);
+
+ snprintf(buf, sizeof(buf), "%s/objects/cursors.edj", elm_app_data_dir_get());
+
+ bx = elm_box_add(win);
+ evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ elm_win_resize_object_add(win, bx);
+ evas_object_show(bx);
+
+ ly = elm_layout_add(win);
+ elm_layout_file_set(ly, buf, "test/layout/events");
+ evas_object_size_hint_weight_set(ly, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(ly, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ elm_object_cursor_set(ly, ELM_CURSOR_HAND1);
+ elm_box_pack_end(bx, ly);
+ evas_object_show(ly);
+
+ ly = elm_layout_add(win);
+ elm_layout_file_set(ly, buf, "test/layout/noevents");
+ evas_object_size_hint_weight_set(ly, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(ly, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ elm_object_cursor_set(ly, ELM_CURSOR_XTERM);
+ elm_layout_part_cursor_set(ly, "top-left", ELM_CURSOR_CROSS);
+ elm_layout_part_cursor_set(ly, "bottom-left", ELM_CURSOR_PIRATE);
+ elm_box_pack_end(bx, ly);
+ evas_object_show(ly);
+
+ ly = elm_layout_add(win);
+ elm_layout_file_set(ly, buf, "test/layout/parts2");
+ evas_object_size_hint_weight_set(ly, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(ly, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ elm_layout_part_cursor_set(ly, "top-left", ELM_CURSOR_CROSS);
+ elm_layout_part_cursor_set(ly, "bottom-left", ELM_CURSOR_PIRATE);
+ elm_box_pack_end(bx, ly);
+ evas_object_show(ly);
+
+ ly = elm_layout_add(win);
+ evas_object_size_hint_weight_set(ly, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(ly, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ elm_layout_file_set(ly, buf, "test/layout/swallow");
+ bt = elm_button_add(win);
+ elm_object_text_set(bt, "Cursor over obj");
+ elm_object_part_content_set(ly, "swallow1", bt);
+ elm_object_cursor_set(bt, ELM_CURSOR_PIRATE);
+ bt = elm_button_add(win);
+ elm_object_text_set(bt, "Cursor over part");
+ elm_object_part_content_set(ly, "swallow2", bt);
+ elm_layout_part_cursor_set(ly, "swallow2", ELM_CURSOR_PIRATE);
+ elm_box_pack_end(bx, ly);
+ evas_object_show(ly);
+
+ evas_object_resize(win, 320, 480);
+ evas_object_show(win);
+}
diff --git a/src/bin/elementary/test_datetime.c b/src/bin/elementary/test_datetime.c
new file mode 100644
index 0000000000..8a8a199eff
--- /dev/null
+++ b/src/bin/elementary/test_datetime.c
@@ -0,0 +1,107 @@
+#ifdef HAVE_CONFIG_H
+#include "elementary_config.h"
+#endif
+#include <Elementary.h>
+
+/* A simple test, just displaying datetime in its default format */
+
+Evas_Object *dt1, *dt2, *dt3;
+
+static void
+_changed_cb(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
+{
+ printf("Datetime value is changed\n");
+}
+
+static void
+_bt_clicked(void *data EINA_UNUSED, Evas_Object *obj, void *event_info EINA_UNUSED)
+{
+ time_t t;
+ struct tm new_time;
+
+ t = time(NULL);
+ localtime_r(&t, &new_time);
+
+ new_time.tm_year = 85;
+ new_time.tm_mon = 9;
+ new_time.tm_mday = 26;
+ new_time.tm_hour = 9;
+ new_time.tm_min = 0;
+ elm_datetime_field_visible_set(dt1, ELM_DATETIME_HOUR, EINA_TRUE);
+ elm_datetime_field_visible_set(dt1, ELM_DATETIME_MINUTE, EINA_TRUE);
+ elm_datetime_value_set(dt1, &new_time);
+ elm_object_disabled_set(dt1, EINA_TRUE);
+
+ elm_object_disabled_set(obj, EINA_TRUE);
+ evas_object_del(dt2);
+ evas_object_del(dt3);
+ dt2 = dt3 = NULL;
+}
+
+void
+test_datetime(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
+{
+ Evas_Object *win, *bx, *bt;
+ time_t t;
+ struct tm time1;
+
+ win = elm_win_util_standard_add("datetime", "DateTime");
+ elm_win_autodel_set(win, EINA_TRUE);
+
+ bx = elm_box_add(win);
+ evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ elm_win_resize_object_add(win, bx);
+ elm_box_horizontal_set(bx, EINA_FALSE);
+ evas_object_show(bx);
+ evas_object_size_hint_min_set(bx, 360, 240);
+
+ dt1 = elm_datetime_add(bx);
+ evas_object_size_hint_weight_set(dt1, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(dt1, EVAS_HINT_FILL, 0.5);
+ elm_datetime_field_visible_set(dt1, ELM_DATETIME_HOUR, EINA_FALSE);
+ elm_datetime_field_visible_set(dt1, ELM_DATETIME_MINUTE, EINA_FALSE);
+ elm_datetime_field_visible_set(dt1, ELM_DATETIME_AMPM, EINA_FALSE);
+ elm_box_pack_end(bx, dt1);
+ evas_object_show(dt1);
+
+ dt2 = elm_datetime_add(bx);
+ evas_object_size_hint_weight_set(dt2, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(dt2, EVAS_HINT_FILL, 0.5);
+ elm_datetime_field_visible_set(dt2, ELM_DATETIME_YEAR, EINA_FALSE);
+ elm_datetime_field_visible_set(dt2, ELM_DATETIME_MONTH, EINA_FALSE);
+ elm_datetime_field_visible_set(dt2, ELM_DATETIME_DATE, EINA_FALSE);
+ elm_box_pack_end(bx, dt2);
+ elm_object_disabled_set(dt2, EINA_TRUE);
+ evas_object_show(dt2);
+
+ dt3 = elm_datetime_add(bx);
+ evas_object_size_hint_weight_set(dt3, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(dt3, EVAS_HINT_FILL, 0.5);
+
+ // get the current local time
+ t = time(NULL);
+ localtime_r(&t, &time1);
+ // set the max year as 2030 and the remaining fields are equal to current time values
+ time1.tm_year = 130;
+ elm_datetime_value_max_set(dt3, &time1);
+ // set the min time limit as "1980 January 10th 02:30 PM"
+ time1.tm_year = 80;
+ time1.tm_mon = 4;
+ time1.tm_mday = 10;
+ time1.tm_hour = 14;
+ time1.tm_min = 30;
+ elm_datetime_value_min_set(dt3, &time1);
+ // minutes can be input only in between 15 and 45
+ elm_datetime_field_limit_set(dt3, ELM_DATETIME_MINUTE, 15, 45);
+ evas_object_smart_callback_add(dt3, "changed", _changed_cb, NULL);
+ elm_box_pack_end(bx, dt3);
+ evas_object_show(dt3);
+
+ bt = elm_button_add(win);
+ elm_object_text_set(bt, "Back to the future...");
+ evas_object_smart_callback_add(bt, "clicked", _bt_clicked, NULL);
+ elm_box_pack_end(bx, bt);
+ evas_object_show(bt);
+
+ evas_object_show(win);
+}
diff --git a/src/bin/elementary/test_dayselector.c b/src/bin/elementary/test_dayselector.c
new file mode 100644
index 0000000000..16259e32fa
--- /dev/null
+++ b/src/bin/elementary/test_dayselector.c
@@ -0,0 +1,125 @@
+#ifdef HAVE_CONFIG_H
+#include "elementary_config.h"
+#endif
+#include <Elementary.h>
+
+static void _changed_cb(void* data EINA_UNUSED, Evas_Object* obj, void* event_info)
+{
+ char buf[256];
+ Elm_Dayselector_Day day = (Elm_Dayselector_Day) event_info;
+ Eina_Bool checked = elm_dayselector_day_selected_get(obj, day);
+
+ switch(day)
+ {
+ case ELM_DAYSELECTOR_SUN:
+ snprintf(buf, sizeof(buf), "%s", "Sun");
+ break;
+ case ELM_DAYSELECTOR_MON:
+ snprintf(buf, sizeof(buf), "%s", "Mon");
+ break;
+ case ELM_DAYSELECTOR_TUE:
+ snprintf(buf, sizeof(buf), "%s", "Tue");
+ break;
+ case ELM_DAYSELECTOR_WED:
+ snprintf(buf, sizeof(buf), "%s", "Wed");
+ break;
+ case ELM_DAYSELECTOR_THU:
+ snprintf(buf, sizeof(buf), "%s", "Thu");
+ break;
+ case ELM_DAYSELECTOR_FRI:
+ snprintf(buf, sizeof(buf), "%s", "Fri");
+ break;
+ case ELM_DAYSELECTOR_SAT:
+ snprintf(buf, sizeof(buf), "%s", "Sat");
+ break;
+ default:
+ snprintf(buf, sizeof(buf), "%s", "???");
+ break;
+ }
+ fprintf(stderr, "%s = %d\n", buf, checked);
+}
+
+void
+test_dayselector(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
+{
+ Evas_Object *win, *bx, *dayselector, *monday;
+ Eina_List *weekdays_list;
+ const char *weekday;
+ const char *weekdays[] = {"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"};
+ const char *weekdays2[] = {"S", "M", "T", "W", "T", "F", "S"};
+
+ win = elm_win_util_standard_add("dayselector", "Day Selector");
+ elm_win_autodel_set(win, EINA_TRUE);
+
+ bx = elm_box_add(win);
+ evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ elm_win_resize_object_add(win, bx);
+ evas_object_show(bx);
+
+ // Default
+ dayselector = elm_dayselector_add(bx);
+ evas_object_size_hint_weight_set(dayselector, EVAS_HINT_EXPAND,
+ EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(dayselector, EVAS_HINT_FILL, 0.5);
+ elm_box_pack_end(bx, dayselector);
+ evas_object_show(dayselector);
+ evas_object_smart_callback_add(dayselector, "dayselector,changed",
+ _changed_cb, NULL);
+
+ //Sunday first
+ dayselector = elm_dayselector_add(bx);
+ evas_object_size_hint_weight_set(dayselector, EVAS_HINT_EXPAND,
+ EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(dayselector, EVAS_HINT_FILL, 0.5);
+ elm_box_pack_end(bx, dayselector);
+ evas_object_show(dayselector);
+ evas_object_smart_callback_add(dayselector, "dayselector,changed",
+ _changed_cb, NULL);
+ elm_dayselector_weekdays_names_set(dayselector, weekdays);
+ elm_dayselector_week_start_set(dayselector, ELM_DAYSELECTOR_SUN);
+
+ //Special Style
+ dayselector = elm_dayselector_add(bx);
+ evas_object_size_hint_weight_set(dayselector, EVAS_HINT_EXPAND,
+ EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(dayselector, EVAS_HINT_FILL, 0.5);
+ elm_dayselector_week_start_set(dayselector, ELM_DAYSELECTOR_MON);
+ elm_box_pack_end(bx, dayselector);
+ evas_object_show(dayselector);
+ evas_object_smart_callback_add(dayselector, "dayselector,changed",
+ _changed_cb, NULL);
+ monday = elm_object_part_content_get(dayselector, "day0");
+ elm_object_signal_emit(monday, "elm,type,weekend,style1", "");
+
+ //Setting weekday name
+ dayselector = elm_dayselector_add(bx);
+ evas_object_size_hint_weight_set(dayselector, EVAS_HINT_EXPAND,
+ EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(dayselector, EVAS_HINT_FILL, 0.5);
+ elm_dayselector_weekdays_names_set(dayselector, weekdays2);
+ elm_box_pack_end(bx, dayselector);
+ evas_object_show(dayselector);
+ evas_object_smart_callback_add(dayselector, "dayselector,changed",
+ _changed_cb, NULL);
+
+ weekdays_list = elm_dayselector_weekdays_names_get(dayselector);
+
+ fprintf(stderr, "User set weekday names to: ");
+ EINA_LIST_FREE(weekdays_list, weekday)
+ {
+ fprintf(stderr, "%s\n", weekday);
+ eina_stringshare_del(weekday);
+ }
+
+ //Disabled
+ dayselector = elm_dayselector_add(bx);
+ evas_object_size_hint_weight_set(dayselector, EVAS_HINT_EXPAND,
+ EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(dayselector, EVAS_HINT_FILL, 0.5);
+ elm_box_pack_end(bx, dayselector);
+ evas_object_show(dayselector);
+ elm_object_disabled_set(dayselector, EINA_TRUE);
+
+ evas_object_resize(win, 350, 150);
+ evas_object_show(win);
+}
diff --git a/src/bin/elementary/test_disable.c b/src/bin/elementary/test_disable.c
new file mode 100644
index 0000000000..3d5c6a8f90
--- /dev/null
+++ b/src/bin/elementary/test_disable.c
@@ -0,0 +1,207 @@
+#ifdef HAVE_CONFIG_H
+# include "elementary_config.h"
+#endif
+#include <Elementary.h>
+
+static void
+_disable_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
+{
+ Eina_Bool status = EINA_FALSE;
+ status = elm_object_disabled_get(data);
+ elm_object_disabled_set(data, !status);
+}
+
+void
+test_box_disable(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
+{
+ Evas_Object *win, *bx, *bt, *bx_out, *fr, *lb;
+ Evas_Object *btn[4];
+
+ win = elm_win_util_standard_add("box-enable/disable", "Box Enable/Disable");
+ elm_win_autodel_set(win, EINA_TRUE);
+
+ bx_out = elm_box_add(win);
+ evas_object_size_hint_weight_set(bx_out, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ elm_win_resize_object_add(win, bx_out);
+ evas_object_show(bx_out);
+
+ fr = elm_frame_add(bx_out);
+ evas_object_size_hint_weight_set(fr, EVAS_HINT_EXPAND, 0.0);
+ evas_object_size_hint_align_set(fr, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ elm_box_pack_end(bx_out, fr);
+ elm_object_text_set(fr, "Description");
+ evas_object_show(fr);
+
+ bx = elm_box_add(fr);
+ elm_object_content_set(fr, bx);
+ evas_object_show(bx);
+
+ lb = elm_label_add(bx);
+ elm_object_text_set(lb, "This test shows how enable/disable of Container widget works");
+ evas_object_size_hint_align_set(lb, 0.0, EVAS_HINT_FILL);
+ elm_box_pack_end(bx, lb);
+ evas_object_show(lb);
+
+ btn[0] = elm_button_add(bx);
+ elm_object_text_set(btn[0], "Disable/Enable Box");
+ evas_object_size_hint_weight_set(btn[0], EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(btn[0], EVAS_HINT_FILL, EVAS_HINT_FILL);
+ elm_box_pack_end(bx, btn[0]);
+ evas_object_show(btn[0]);
+
+ btn[1] = elm_button_add(bx);
+ elm_object_text_set(btn[1], "Disable/Enable Button 1");
+ evas_object_size_hint_weight_set(btn[1], EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(btn[1], EVAS_HINT_FILL, EVAS_HINT_FILL);
+ elm_box_pack_end(bx, btn[1]);
+ evas_object_show(btn[1]);
+
+ btn[2] = elm_button_add(bx);
+ elm_object_text_set(btn[2], "Disable/Enable Button 2");
+ evas_object_size_hint_weight_set(btn[2], EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(btn[2], EVAS_HINT_FILL, EVAS_HINT_FILL);
+ elm_box_pack_end(bx, btn[2]);
+ evas_object_show(btn[2]);
+
+ btn[3] = elm_button_add(bx);
+ elm_object_text_set(btn[3], "Disable/Enable Button 3");
+ evas_object_size_hint_weight_set(btn[3], EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(btn[3], EVAS_HINT_FILL, EVAS_HINT_FILL);
+ elm_box_pack_end(bx, btn[3]);
+ evas_object_show(btn[3]);
+
+ bx = elm_box_add(bx_out);
+ evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(bx, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ elm_box_pack_end(bx_out, bx);
+ evas_object_show(bx);
+ evas_object_smart_callback_add(btn[0], "clicked", _disable_cb, bx);
+
+ bt = elm_button_add(win);
+ elm_object_text_set(bt, "Button 1");
+ evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ elm_box_pack_end(bx, bt);
+ evas_object_show(bt);
+ evas_object_smart_callback_add(btn[1], "clicked", _disable_cb, bt);
+
+ bt = elm_button_add(win);
+ elm_object_text_set(bt, "Button 2");
+ evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ elm_box_pack_end(bx, bt);
+ evas_object_show(bt);
+ evas_object_smart_callback_add(btn[2], "clicked", _disable_cb, bt);
+
+ bt = elm_button_add(win);
+ elm_object_text_set(bt, "Button 3");
+ evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ elm_box_pack_end(bx, bt);
+ evas_object_show(bt);
+ evas_object_smart_callback_add(btn[3], "clicked", _disable_cb, bt);
+
+ evas_object_resize(win, 300, 300);
+ evas_object_show(win);
+}
+
+void
+test_layout_disable(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
+{
+ Evas_Object *win, *box, *ly, *bt;
+ Evas_Object *fr, *btn[4], *bx, *lb;
+ char buf[PATH_MAX];
+
+ win = elm_win_util_standard_add("layout", "Layout");
+ elm_win_autodel_set(win, EINA_TRUE);
+
+ box = elm_box_add(win);
+ evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ elm_win_resize_object_add(win, box);
+ evas_object_show(box);
+
+ fr = elm_frame_add(box);
+ evas_object_size_hint_weight_set(fr, EVAS_HINT_EXPAND, 0.0);
+ evas_object_size_hint_align_set(fr, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ elm_box_pack_end(box, fr);
+ elm_object_text_set(fr, "Description");
+ evas_object_show(fr);
+
+ bx = elm_box_add(fr);
+ elm_object_content_set(fr, bx);
+ evas_object_show(bx);
+
+ lb = elm_label_add(bx);
+ elm_object_text_set(lb, "This test shows how enable/disable of Container widget works");
+ evas_object_size_hint_align_set(lb, 0.0, EVAS_HINT_FILL);
+ elm_box_pack_end(bx, lb);
+ evas_object_show(lb);
+
+ btn[0] = elm_button_add(bx);
+ elm_object_text_set(btn[0], "Disable/Enable Layout");
+ evas_object_size_hint_weight_set(btn[0], EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(btn[0], EVAS_HINT_FILL, EVAS_HINT_FILL);
+ elm_box_pack_end(bx, btn[0]);
+ evas_object_show(btn[0]);
+
+ btn[1] = elm_button_add(bx);
+ elm_object_text_set(btn[1], "Disable/Enable Button 1");
+ evas_object_size_hint_weight_set(btn[1], EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(btn[1], EVAS_HINT_FILL, EVAS_HINT_FILL);
+ elm_box_pack_end(bx, btn[1]);
+ evas_object_show(btn[1]);
+
+ btn[2] = elm_button_add(bx);
+ elm_object_text_set(btn[2], "Disable/Enable Button 2");
+ evas_object_size_hint_weight_set(btn[2], EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(btn[2], EVAS_HINT_FILL, EVAS_HINT_FILL);
+ elm_box_pack_end(bx, btn[2]);
+ evas_object_show(btn[2]);
+
+ btn[3] = elm_button_add(bx);
+ elm_object_text_set(btn[3], "Disable/Enable Button 3");
+ evas_object_size_hint_weight_set(btn[3], EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(btn[3], EVAS_HINT_FILL, EVAS_HINT_FILL);
+ elm_box_pack_end(bx, btn[3]);
+ evas_object_show(btn[3]);
+
+ ly = elm_layout_add(win);
+
+ if (!elm_layout_theme_set(
+ ly, "layout", "application", "titlebar"))
+ fprintf(stderr, "Failed to set layout");
+
+ elm_object_part_text_set(ly, "elm.text", "Layout Disable/Enable Test");
+ evas_object_size_hint_weight_set(ly, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(ly, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ elm_box_pack_end(box, ly);
+ evas_object_show(ly);
+
+ ly = elm_layout_add(win);
+ snprintf(buf, sizeof(buf), "%s/objects/test.edj", elm_app_data_dir_get());
+ elm_layout_file_set(ly, buf, "layout");
+ evas_object_size_hint_weight_set(ly, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ elm_box_pack_end(box, ly);
+ evas_object_show(ly);
+ evas_object_smart_callback_add(btn[0], "clicked", _disable_cb, ly);
+
+ bt = elm_button_add(win);
+ elm_object_text_set(bt, "Button 1");
+ elm_object_part_content_set(ly, "element1", bt);
+ evas_object_show(bt);
+ evas_object_smart_callback_add(btn[1], "clicked", _disable_cb, bt);
+
+ bt = elm_button_add(win);
+ elm_object_text_set(bt, "Button 2");
+ elm_object_part_content_set(ly, "element2", bt);
+ evas_object_show(bt);
+ evas_object_smart_callback_add(btn[2], "clicked", _disable_cb, bt);
+
+ bt = elm_button_add(win);
+ elm_object_text_set(bt, "Button 3");
+ elm_object_part_content_set(ly, "element3", bt);
+ evas_object_show(bt);
+ evas_object_smart_callback_add(btn[3], "clicked", _disable_cb, bt);
+
+ evas_object_show(win);
+}
diff --git a/src/bin/elementary/test_diskselector.c b/src/bin/elementary/test_diskselector.c
new file mode 100644
index 0000000000..a6e14f7609
--- /dev/null
+++ b/src/bin/elementary/test_diskselector.c
@@ -0,0 +1,355 @@
+#include "test.h"
+#include <Elementary_Cursor.h>
+#ifdef HAVE_CONFIG_H
+# include "elementary_config.h"
+#endif
+#include <Elementary.h>
+
+struct _api_data
+{
+ unsigned int state; /* What state we are testing */
+ void *box; /* Use this to get box content */
+};
+typedef struct _api_data api_data;
+
+enum _api_state
+{
+ SCROLLER_POLICY_SET_ON,
+ SCROLLER_POLICY_SET_OFF,
+ BOUNCE_SET,
+ ITEM_LABEL_SET,
+ TOOLTIP_TEXT_SET,
+ ITEM_TOOLTIP_UNSET,
+ ITEM_CURSOR_SET,
+ ITEM_CURSOR_UNSET,
+ ITEM_ICON_SET,
+ SELECTED_SET,
+ ITEM_PREV_GET,
+ ITEM_DEL_NOT_SELECTED,
+ ITEM_DEL, /* delete when selected */
+ CLEAR,
+ API_STATE_LAST
+};
+typedef enum _api_state api_state;
+
+static void
+set_api_state(api_data *api)
+{
+ const Eina_List *disks = elm_box_children_get(api->box);
+ if (!eina_list_count(disks))
+ return;
+
+ switch(api->state)
+ { /* Put all api-changes under switch */
+ case SCROLLER_POLICY_SET_ON: /* 0 */
+ { /* Get first disk */
+ Evas_Object *disk = eina_list_nth(disks, 0);
+ elm_scroller_policy_set(disk, ELM_SCROLLER_POLICY_ON, ELM_SCROLLER_POLICY_ON);
+ }
+ break;
+
+ case SCROLLER_POLICY_SET_OFF: /* 1 */
+ { /* Get first disk */
+ Evas_Object *disk = eina_list_nth(disks, 0);
+ elm_scroller_policy_set(disk, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_OFF);
+ }
+ break;
+
+ case BOUNCE_SET: /* 2 */
+ { /* Get second disk, cancel bounce */
+ Evas_Object *disk = eina_list_nth(disks, 1);
+ elm_scroller_bounce_set(disk, EINA_FALSE, EINA_FALSE);
+ }
+ break;
+
+ case ITEM_LABEL_SET: /* 3 */
+ elm_object_item_text_set(elm_diskselector_selected_item_get(eina_list_nth(disks, 0)), "Label from API");
+ break;
+
+ case TOOLTIP_TEXT_SET: /* 4 */
+ elm_object_item_tooltip_text_set(elm_diskselector_selected_item_get(eina_list_nth(disks, 0)), "Tooltip from API");
+ break;
+
+ case ITEM_TOOLTIP_UNSET: /* 5 */
+ elm_object_item_tooltip_unset(elm_diskselector_selected_item_get(eina_list_nth(disks, 0)));
+ break;
+
+ case ITEM_CURSOR_SET: /* 6 */
+ elm_object_item_cursor_set(elm_diskselector_selected_item_get(eina_list_nth(disks, 0)), ELM_CURSOR_HAND2);
+ break;
+
+ case ITEM_CURSOR_UNSET: /* 7 */
+ elm_object_item_cursor_unset(elm_diskselector_selected_item_get(eina_list_nth(disks, 0)));
+ break;
+
+ case ITEM_ICON_SET: /* 8 */
+ { /* Set icon of selected item in first disk */
+ char buf[PATH_MAX];
+ Evas_Object *ic = elm_icon_add(elm_object_parent_widget_get(eina_list_nth(disks, 0)));
+ snprintf(buf, sizeof(buf), "%s/images/logo_small.png", elm_app_data_dir_get());
+ elm_image_file_set(ic, buf, NULL);
+ elm_object_item_part_content_set(elm_diskselector_selected_item_get(eina_list_nth(disks, 0)), NULL, ic);
+ evas_object_show(ic);
+ }
+ break;
+
+ case SELECTED_SET: /* 9 */
+ { /* Select NEXT item of third disk */
+ elm_diskselector_item_selected_set(elm_diskselector_last_item_get(eina_list_nth(disks, 1)), EINA_TRUE);
+ elm_diskselector_item_selected_set(elm_diskselector_item_next_get(elm_diskselector_selected_item_get(eina_list_nth(disks, 2))), EINA_TRUE);
+ }
+ break;
+
+ case ITEM_PREV_GET: /* 10 */
+ { /* Select PREV item of third disk */
+ elm_diskselector_item_selected_set(elm_diskselector_item_prev_get(elm_diskselector_selected_item_get(eina_list_nth(disks, 2))), EINA_TRUE);
+ }
+ break;
+
+ case ITEM_DEL_NOT_SELECTED: /* 11 */
+ { /* Remove selected item of third disk */
+ elm_object_item_del(elm_diskselector_item_prev_get(elm_diskselector_selected_item_get(eina_list_nth(disks, 2))));
+ }
+ break;
+
+ case ITEM_DEL: /* 12 */
+ { /* Remove selected item of first disk */
+ elm_object_item_del(elm_diskselector_selected_item_get(eina_list_nth(disks, 1)));
+ }
+ break;
+
+ case CLEAR: /* 13 */
+ elm_diskselector_clear(eina_list_nth(disks, 0));
+ break;
+
+ default:
+ return;
+ }
+}
+
+static void
+_api_bt_clicked(void *data, Evas_Object *obj, void *event_info EINA_UNUSED)
+{ /* Will add here a SWITCH command containing code to modify test-object */
+ /* in accordance a->state value. */
+ api_data *a = data;
+ char str[128];
+
+ printf("clicked event on API Button: api_state=<%d>\n", a->state);
+ set_api_state(a);
+ a->state++;
+ sprintf(str, "Next API function (%u)", a->state);
+ elm_object_text_set(obj, str);
+ elm_object_disabled_set(obj, a->state == API_STATE_LAST);
+}
+
+static void
+_disk_sel(void *data EINA_UNUSED, Evas_Object * obj EINA_UNUSED, void *event_info)
+{
+ Elm_Object_Item *ds_it = event_info;
+ printf("Equinox: %s\n", elm_object_item_text_get(ds_it));
+}
+
+static void
+_disk_next(void *data EINA_UNUSED, Evas_Object * obj EINA_UNUSED, void *event_info)
+{
+ Elm_Object_Item *next_ds_it, *prev_ds_it, *ds_it = event_info;
+ prev_ds_it = elm_diskselector_item_prev_get(ds_it);
+ next_ds_it = elm_diskselector_item_next_get(ds_it);
+ printf("Prev: %s, Next: %s\n", elm_object_item_text_get(prev_ds_it),
+ elm_object_item_text_get(next_ds_it));
+}
+
+static void
+_print_disk_info_cb(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info)
+{
+ Elm_Object_Item *ds_it = event_info;
+ printf("Selected label: %s\n", elm_object_item_text_get(ds_it));
+}
+
+static void
+_item_clicked_cb(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info)
+{
+ Elm_Object_Item *ds_it = event_info;
+ printf("Clicked label: %s\n", elm_object_item_text_get(ds_it));
+}
+
+static Evas_Object *
+_disk_create(Evas_Object *parent, Eina_Bool rnd)
+{
+ Elm_Object_Item *ds_it;
+ Evas_Object *di;
+
+ di = elm_diskselector_add(parent);
+
+ elm_diskselector_item_append(di, "January", NULL, NULL, NULL);
+ elm_diskselector_item_append(di, "February", NULL, _disk_next, NULL);
+ elm_diskselector_item_append(di, "March", NULL, _disk_sel, NULL);
+ elm_diskselector_item_append(di, "April", NULL, NULL, NULL);
+ elm_diskselector_item_append(di, "May", NULL, NULL, NULL);
+ elm_diskselector_item_append(di, "June", NULL, NULL, NULL);
+ elm_diskselector_item_append(di, "July", NULL, NULL, NULL);
+ ds_it = elm_diskselector_item_append(di, "August", NULL, NULL, NULL);
+ elm_diskselector_item_append(di, "September", NULL, _disk_sel, NULL);
+ elm_diskselector_item_append(di, "October", NULL, NULL, NULL);
+ elm_diskselector_item_append(di, "November", NULL, NULL, NULL);
+ elm_diskselector_item_append(di, "December", NULL, NULL, NULL);
+
+ elm_diskselector_item_selected_set(ds_it, EINA_TRUE);
+ elm_diskselector_round_enabled_set(di, rnd);
+
+ return di;
+}
+
+static void
+_cleanup_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
+{
+ free(data);
+}
+
+void
+test_diskselector(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
+{
+ Evas_Object *win, *bx, *disk, *ic, *bxx, *bt;
+ Elm_Object_Item *ds_it;
+ char buf[PATH_MAX];
+ api_data *api = calloc(1, sizeof(api_data));
+ int idx = 0;
+
+ char *month_list[] = {
+ "Jan", "Feb", "Mar",
+ "Apr", "May", "Jun",
+ "Jul", "Aug", "Sep",
+ "Oct", "Nov", "Dec"
+ };
+ char date[3];
+
+ win = elm_win_util_standard_add("diskselector", "Disk Selector");
+ elm_win_autodel_set(win, EINA_TRUE);
+ evas_object_event_callback_add(win, EVAS_CALLBACK_FREE, _cleanup_cb, api);
+
+ bxx = elm_box_add(win);
+ evas_object_size_hint_weight_set(bxx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ elm_win_resize_object_add(win, bxx