From: Jinkun Jang Date: Fri, 15 Mar 2013 16:19:30 +0000 (+0900) Subject: merge with master X-Git-Tag: 2.1b_release~132 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b2c4660e984480f8073183c3f20e80eecd37d9fb;p=framework%2Fuifw%2Felementary.git merge with master --- diff --git a/ChangeLog b/ChangeLog index bff16e5..0375289 100644 --- a/ChangeLog +++ b/ChangeLog @@ -675,6 +675,10 @@ * Add elm_toolbar_item_show/bring_in. It show or bring a specific item, when the toolbar can be scrolled. +2012-11-21 Michael Bouchaud (yoz) + + * update the min size hint on elm_label after a text set + 2012-11-22 ChunEon Park (Hermet) * Lets remove contents regardless of the preseve_on_set if naviframe is @@ -688,6 +692,10 @@ * Fixed entry to enable have_selection only when a text is actually selected. +2012-11-22 Michael Bouchaud (yoz) + + * fix elm_flip to show only one face at a time + 2012-11-23 ChunEon Park (Hermet) * Free the text parts of the naviframe item when item is deleted. @@ -705,6 +713,19 @@ * emit the signals for content_set/unset text_set/unset one time! +2012-12-04 Cedric Bail + + * Fix uninitialized data path in elm_flip. + * Fix uninitialized data path in elm_gesture_layer. + +2012-12-06 Cedric Bail + + * Fix possible segv in elm_quicklaunch infrastructure. + +2012-12-10 Cedric Bail + + * Make sure private data is not NULL in elm_interface_scrollable. + 2012-12-12 ChunEon Park (Hermet) * Update mapbuf forcely whenever it's states are changed. @@ -729,6 +750,14 @@ * Let image update right now if the image preloading is disabled. +2012-12-21 Stefan Schmidt + + * Fix small memory leak in elm_map error path. + +2012-12-29 Mike Blumenkrantz + + * Tooltips now correctly set NETWM tooltip window type + 2013-01-13 Daniel Juyung Seo (SeoZ) * Added "highlighted" and "unhighlighted" signals to list, genlist, and gengrid. @@ -740,3 +769,45 @@ 2013-01-26 ChanWook Jung (jchanwook@gmail.com) * Expand elm_transit tween_mode and add twee_mode_factor_set(),get() APIs + +2013-01-29 ChunEon Park (Hermet) + + * Fix a elm_transit crash issue when user delete all target objects in the effect end callback. + +2013-01-29 Jaehwan Kim + + * Fix the scroll position is calculated by the size of pan object, not the size of scroller. + +2013-02-05 ChunEon Park (Hermet) + + * Index supports "language,changed" smart callback. + +2013-03-04 WooHyun Jung + + * Focus highlight should not be showed on (0, 0). + +2013-03-04 Junki Cho + + * Improved gengrid item append performance. + +2013-03-05 Jiyoun Park + + * Fix elm_conform didn't set size hint when keypad on. + +2013-03-05 Jaehwan Kim + + * Add edje_object_message_signal_process before edje_object_size_min_restricted_calc. + If the min size is changed by edje signal in edc, the the function should be called before the calculation. + +2013-03-05 Jiyoun Park + + * Fix elm_conform didn't change indicator mode when create. + +2013-03-06 ChunEon Park (Hermet) + + * Add elm_object_item_signal_callback_add(), elm_object_item_signal_callback_del(). + +2013-03-07 Jaehwan Kim + + * Add the config ELM_THUMBSCROLL_HOLD_THRESHOLD. + This is the number of pixels the range which can be scrolled, while the scroller is holed. diff --git a/NEWS b/NEWS index 06b6306..2026c76 100644 --- a/NEWS +++ b/NEWS @@ -1,4 +1,6 @@ -Changes since Elementary 1.7.0: +Elementary 1.7.99 + +Changes since elementary 1.7.98: ------------------------- Additions: @@ -15,6 +17,22 @@ Additions: * Add virtualkeypad, clipboard state change signals from conformant. * Add elm_toolbar_item_show/bring_in. * Add "highlighted" and "unhighlighted" callbacks to list, genlist, and gengrid. + * Add elm_index smart callback - "language,changed". + * Add smart callback signals of a scroller. "vbar,drag", "vbar,press", "vbar,unpress", "hbar,drag", "hbar,press", "hbar,unpress". + * Add elm_glview, elm_gengrid smart callback - "language,changed". + * Add APIs - elm_object_item_domain_translatable_part_text_set(), elm_object_item_translatable_part_text_get(). + * Add APIs - elm_object_domain_translatable_part_text_set(), elm_object_translatable_part_text_get(). + * Add APIs - elm_object_orientation_mode_disabled_set(), elm_object_orientation_mode_disabled_get(). + * Add the reorder effect in toolbar. + * Added new APIs elm_transit_tween_mode_facator_set()/get() + * Support widget orientation mode in order to widgets have multiple styles for each window degree. + * Add elm_drop_target_add() elm_drop_target_del() and elm_drag_start() + * Add the option about sending signals in content_pos_set. + * Add omit feature to elm_index. + * Add elm_transit_smooth_set(), elm_transit_smooth_get() + * Add edje_object_message_signal_process before edje_object_size_min_restricted_calc. + * Add elm_object_item_signal_callback_add(), elm_object_item_signal_callback_del(). + * Add the config ELM_THUMBSCROLL_HOLD_THRESHOLD. Improvements: @@ -33,26 +51,9 @@ Improvements: * Elm_Transit image animation effects supports elm_image object type. * Expand elm_transit_tween_mode ELM_TRANSIT_TWEEN_MODE_DIVISOR_INTERP, ELM_TRANSIT_TWEEN_MODE_BOUNCE, ELM_TRANSIT_TWEEN_MODE_SPRING * Added new APIs elm_transit_tween_mode_facator_set()/get() -Fixes: - * Now elm_datetime_field_limit_set() can set year limits wihtout problems. - * Fix re-order animation when it doesn't end correctly. - * Fix popup to apply the same style to the notify sub-widget. - * Fix Ctxpopup direction if unknown priority used. - * Fix diskselector when bounce off and round enabled. - * Fix bubble info field set. - * Escape theme filename correctly. - * Fix diskselector selection of middle item. - * Fix multibuttonentry list corruption. - * Fix copy&paste error in elm_flip. - * Fix possible invalid memory access in elm_access. - * Fix diskselector bug with more than 4 items. - * Fix conform widget to be part of focus chain. - * Fix genlist reorder mode item not being resized on genlist resize. - * Fix on_focus_region() issue. - * Fixed gengrid wrong_calc_job parameter. - * Fix elm_transit image animation that last few frames are skipped. - * FIx elm_transit to accept proxy object. +Fixes : + * Fix glview crash even if the object is failed allocating. * Fix the elm_flip to accept proxy object. * Fix wrong parameter for thumbnail error in elm_icon. @@ -72,6 +73,9 @@ Fixes: * Fix the naviframe to not have crash even if user deletes the naviframe in the transition finished cb. * Fix Don't elm_transit image animation use the image preloading to avoid image flickering. * Fix the image to show the image right now if the image preloading is disabled. + * Fix a elm_transit crash issue when user delete all target objects in the effect end callback. + * Fix small memory leak in elm_map error path + * Focus highlight should not be shown on (0, 0). Removals: @@ -79,6 +83,78 @@ Removals: to deprecation. Thus, people using that (unstable) API will have to adapt themselves. + +Elementary 1.7.5 + +Changes since Elementary 1.7.4: +------------------------- + +Fixes: + * Fix bug where genlist would delete items added during selection callback if a clear was queued + * Tooltips now correctly set NETWM tooltip window type + * Fix the scroll position is calculated by the size of pan object, not the size of scroller. + + +Elementary 1.7.4 + +Changes since elementary 1.7.3: +------------------------- + +Fixes: + + * Make sure data is not NULL in elm_interface_scrollable. + + +Elementary 1.7.3 + +Changes since elementary 1.7.2: +------------------------- + +Fixes: + + * Fix uninitialized data path in elm_flip. + * Fix uninitialized data path in elm_gesture_layer. + * Fix possible segv in elm_quicklaunch infrastructure. + + +Elementary 1.7.2 + +Changes since elementary 1.7.1: +------------------------- + +Fixes: + + * Fix promote and demote in genlist when the object isn't yet fully builded + * Fix the elm_flip to accept proxy object. + * Fix wrong parameter for thumbnail error in elm_icon. + * Fix update the min size hint on elm_label after a text set + * Fix flip widget who show the two face at same time + + +Changes since elementary 1.7.0: +------------------------- + +Fixes: + + * Now elm_datetime_field_limit_set() can set year limits wihtout problems. + * Fix re-order animation when it doesn't end correctly. + * Fix popup to apply the same style to the notify sub-widget. + * Fix Ctxpopup direction if unknown priority used. + * Fix diskselector when bounce off and round enabled. + * Fix bubble info field set. + * Escape theme filename correctly. + * Fix diskselector selection of middle item. + * Fix multibuttonentry list corruption. + * Fix copy&paste error in elm_flip. + * Fix possible invalid memory access in elm_access. + * Fix diskselector bug with more than 4 items. + * Fix conform widget to be part of focus chain. + * Fix genlist reorder mode item not being resized on genlist resize. + * Fix on_focus_region() issue. + * Fixed gengrid wrong_calc_job parameter. + * Fix elm_transit image animation that last few frames are skipped. + * FIx elm_transit to accept proxy object. + Changes since Elementary 1.0.0: ------------------------- diff --git a/config/default/base.src b/config/default/base.src index d56350c..5deec8e 100644 --- a/config/default/base.src +++ b/config/default/base.src @@ -4,6 +4,7 @@ group "Elm_Config" struct { value "vsync" uchar: 0; value "thumbscroll_enable" uchar: 1; value "thumbscroll_threshold" int: 24; + value "thumbscroll_hold_threshold" int: 24; value "thumbscroll_momentum_threshold" double: 100.0; value "thumbscroll_friction" double: 1.0; value "thumbscroll_bounce_friction" double: 0.5; diff --git a/config/mobile/base.src b/config/mobile/base.src index a0ebfe8..cc963fc 100644 --- a/config/mobile/base.src +++ b/config/mobile/base.src @@ -4,6 +4,7 @@ group "Elm_Config" struct { value "vsync" uchar: 1; value "thumbscroll_enable" uchar: 1; value "thumbscroll_threshold" int: 24; + value "thumbscroll_hold_threshold" int: 100; value "thumbscroll_momentum_threshold" double: 100.0; value "thumbscroll_friction" double: 1.0; value "thumbscroll_bounce_friction" double: 0.5; @@ -44,11 +45,11 @@ group "Elm_Config" struct { value "effect_enable" uchar: 1; value "password_show_last" uchar: 1; value "password_show_last_timeout" double: 2.0; - value "glayer_zoom_finger_enable" uchar: 0; + value "glayer_zoom_finger_enable" uchar: 1; value "glayer_zoom_finger_factor" double: 1.0; value "glayer_zoom_wheel_factor" double: 0.05; value "glayer_zoom_distance_tolerance" double: 1.0; - value "glayer_rotate_finger_enable" uchar: 0; + value "glayer_rotate_finger_enable" uchar: 1; value "glayer_rotate_angular_tolerance" double: 0.034906585; value "glayer_line_min_length" double: 1.0; value "glayer_line_distance_tolerance" double: 3.0; diff --git a/config/standard/base.src b/config/standard/base.src index ffe606a..9da0314 100644 --- a/config/standard/base.src +++ b/config/standard/base.src @@ -4,6 +4,7 @@ group "Elm_Config" struct { value "vsync" uchar: 0; value "thumbscroll_enable" uchar: 0; value "thumbscroll_threshold" int: 4; + value "thumbscroll_hold_threshold" int: 4; value "thumbscroll_momentum_threshold" double: 100.0; value "thumbscroll_friction" double: 1.0; value "thumbscroll_bounce_friction" double: 0.5; diff --git a/configure.ac b/configure.ac index 59189d4..9c1b591 100644 --- a/configure.ac +++ b/configure.ac @@ -754,6 +754,14 @@ extern char **environ; AC_DEFINE(HAVE_ENVIRON, 1, [extern environ exists]) ]) +AC_TRY_LINK([ +#include +], [ +clearenv(); +], [ + AC_DEFINE(HAVE_CLEARENV, 1, [extern environ exists]) +]) + AC_OUTPUT([ Makefile elementary.spec diff --git a/packaging/elementary.spec b/packaging/elementary.spec old mode 100644 new mode 100755 index 2c519e5..f066fbe --- a/packaging/elementary.spec +++ b/packaging/elementary.spec @@ -1,7 +1,7 @@ #sbs-git:slp/pkgs/e/elementary elementary 1.0.0+svn.70492slp2+build11 Name: elementary Summary: EFL toolkit for small touchscreens -Version: 1.7.1+svn.77535+build01r05 +Version: 1.7.1+svn.77535slp2+build73r01 Release: 1 Group: System/Libraries License: LGPLv2.1 diff --git a/src/bin/config.c b/src/bin/config.c index f8e0427..5daca3a 100644 --- a/src/bin/config.c +++ b/src/bin/config.c @@ -297,6 +297,31 @@ tst_change(void *data __UNUSED__, } static void +tsht_round(void *data __UNUSED__, + Evas_Object *obj, + void *event_info __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 __UNUSED__, + Evas_Object *obj, + void *event_info __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 __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__) @@ -947,7 +972,7 @@ _font_overlay_change(void *data __UNUSED__, static void _config_display_update(Evas_Object *win) { - int flush_interval, font_c, image_c, edje_file_c, edje_col_c, ts_threshould; + 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_friction, ts_border_friction, ts_sensitivity_friction, page_friction, bring_in_friction, zoom_friction; const char *curr_theme, *curr_engine; @@ -969,6 +994,7 @@ _config_display_update(Evas_Object *win) 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_friction = elm_config_scroll_thumbscroll_friction_get(); ts_border_friction = elm_config_scroll_thumbscroll_border_friction_get(); @@ -1003,6 +1029,9 @@ _config_display_update(Evas_Object *win) "thumbscroll_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, @@ -2617,6 +2646,26 @@ _status_config_scrolling(Evas_Object *win, evas_object_smart_callback_add(sl, "changed", tst_round, NULL); evas_object_smart_callback_add(sl, "delay,changed", tst_change, NULL); + LABEL_FRAME_ADD("Thumb scroll hold threshold"); + + sl = elm_slider_add(win); + elm_object_tooltip_text_set(sl, "This is the number of pixels the range
" + "which can be scrolled, while the scroller
" + "is holed"); + evas_object_data_set(win, "thumbscroll_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_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); + LABEL_FRAME_ADD("Thumb scroll momentum threshold"); sl = elm_slider_add(win); diff --git a/src/bin/quicklaunch.c b/src/bin/quicklaunch.c index f412d5e..e84612b 100644 --- a/src/bin/quicklaunch.c +++ b/src/bin/quicklaunch.c @@ -114,7 +114,7 @@ handle_run(int fd, unsigned long bytes) argc = ((unsigned long *)(buf))[0]; envnum = ((unsigned long *)(buf))[1]; - + if (argc <= 0) { CRITICAL("no executable specified"); @@ -126,7 +126,7 @@ handle_run(int fd, unsigned long bytes) 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); diff --git a/src/bin/test.c b/src/bin/test.c index c5e10b3..36a0003 100644 --- a/src/bin/test.c +++ b/src/bin/test.c @@ -398,6 +398,9 @@ my_win_main(char *autorun, Eina_Bool test_win_only) 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:"); diff --git a/src/bin/test_win_socket.c b/src/bin/test_win_socket.c index 223bb57..dbeb03b 100644 --- a/src/bin/test_win_socket.c +++ b/src/bin/test_win_socket.c @@ -55,8 +55,8 @@ fill(Evas_Object *win, Eina_Bool do_bg) ic = elm_icon_add(win); snprintf(buf, sizeof(buf), "%s/images/logo_small.png", elm_app_data_dir_get()); - elm_icon_file_set(ic, buf, NULL); - elm_icon_resizable_set(ic, 0, 0); + elm_image_file_set(ic, buf, NULL); + elm_image_resizable_set(ic, 0, 0); evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_HORIZONTAL, 1, 1); bb = elm_bubble_add(win); @@ -80,7 +80,7 @@ fill(Evas_Object *win, Eina_Bool do_bg) ic = elm_icon_add(win); snprintf(buf, sizeof(buf), "%s/images/logo_small.png", elm_app_data_dir_get()); - elm_icon_file_set(ic, buf, NULL); + elm_image_file_set(ic, buf, NULL); evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1); bb = elm_bubble_add(win); @@ -114,8 +114,8 @@ fill(Evas_Object *win, Eina_Bool do_bg) ic = elm_icon_add(win); snprintf(buf, sizeof(buf), "%s/images/logo_small.png", elm_app_data_dir_get()); - elm_icon_file_set(ic, buf, NULL); - elm_icon_resizable_set(ic, 0, 0); + elm_image_file_set(ic, buf, NULL); + elm_image_resizable_set(ic, 0, 0); evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_HORIZONTAL, 1, 1); bb = elm_bubble_add(win); diff --git a/src/lib/elc_ctxpopup.c b/src/lib/elc_ctxpopup.c index 38e1e8b..20bab36 100644 --- a/src/lib/elc_ctxpopup.c +++ b/src/lib/elc_ctxpopup.c @@ -13,11 +13,16 @@ static const Evas_Smart_Cb_Description _smart_callbacks[] = { EVAS_SMART_SUBCLASS_NEW (ELM_CTXPOPUP_SMART_NAME, _elm_ctxpopup, Elm_Ctxpopup_Smart_Class, Elm_Layout_Smart_Class, elm_layout_smart_class_get, _smart_callbacks); + static Eina_Bool _elm_ctxpopup_smart_focus_next(const Evas_Object *obj, Elm_Focus_Direction dir, Evas_Object **next) { + Eina_List *items = NULL; + Eina_List *elist = NULL; + Elm_Ctxpopup_Item *it; + ELM_CTXPOPUP_DATA_GET(obj, sd); if (!sd) @@ -29,7 +34,11 @@ _elm_ctxpopup_smart_focus_next(const Evas_Object *obj, elm_widget_focus_next_get(sd->box, dir, next); } - return EINA_TRUE; + EINA_LIST_FOREACH(sd->items, elist, it) + items = eina_list_append(items, it->base.access_obj); + + return elm_widget_focus_list_next_get + (obj, items, eina_list_data_get, dir, next); } static Eina_Bool @@ -158,6 +167,79 @@ _item_select_cb(void *data, Evas_Object *obj __UNUSED__, item->func((void*)item->base.data, WIDGET(item), data); } +static char * +_access_info_cb(void *data, Evas_Object *obj __UNUSED__) +{ + Elm_Ctxpopup_Item *it = (Elm_Ctxpopup_Item *)data; + const char *txt = NULL; + Evas_Object *icon = NULL; + Eina_Strbuf *buf = NULL; + char *str = NULL; + + if (!it) return NULL; + + if ((!txt) && (!icon)) + { + txt = it->label; + icon = it->icon; + } + else if (!txt) txt = it->label; + else if (!icon) icon = it->icon; + + if (txt && icon) + { + buf = eina_strbuf_new(); + eina_strbuf_append(buf, E_("icon ")); + eina_strbuf_append(buf, txt); + str = eina_strbuf_string_steal(buf); + eina_strbuf_free(buf); + return str; + } + else if ((!txt) && icon) return strdup(E_("icon")); + else if (txt && (!icon)) return strdup(txt); + + return NULL; +} + +static char * +_access_state_cb(void *data, Evas_Object *obj __UNUSED__) +{ + Elm_Ctxpopup_Item *it = (Elm_Ctxpopup_Item *)data; + if (!it) return NULL; + + if (it->base.disabled) + return strdup(E_("State: Disabled")); + + return NULL; +} + +static void +_access_activate_cb(void *data __UNUSED__, + Evas_Object *part_obj __UNUSED__, + Elm_Object_Item *item) +{ + _item_select_cb(item, NULL, NULL, NULL); +} + +static void +_access_widget_item_register(Elm_Ctxpopup_Item *it, Eina_Bool is_access) +{ + Elm_Access_Info *ai; + + if (!is_access) _elm_access_widget_item_unregister((Elm_Widget_Item *)it); + else + { + _elm_access_widget_item_register((Elm_Widget_Item *)it); + + ai = _elm_access_object_get(it->base.access_obj); + + _elm_access_callback_set(ai, ELM_ACCESS_INFO, _access_info_cb, it); + _elm_access_callback_set(ai, ELM_ACCESS_STATE, _access_state_cb, it); + _elm_access_text_set(ai, ELM_ACCESS_TYPE, E_("Contextual Popup")); + _elm_access_activate_callback_set(ai, _access_activate_cb, it); + } +} + static void _item_new(Elm_Ctxpopup_Item *item, char *group_name) @@ -173,6 +255,9 @@ _item_new(Elm_Ctxpopup_Item *item, _item_select_cb, item); evas_object_size_hint_align_set(VIEW(item), EVAS_HINT_FILL, EVAS_HINT_FILL); evas_object_show(VIEW(item)); + + /* access */ + if (_elm_config->access_mode) _access_widget_item_register(item, EINA_TRUE); } static void @@ -301,6 +386,8 @@ _base_geometry_calc(Evas_Object *obj, //Limit to Max Size evas_object_size_hint_max_get(obj, &max_size.x, &max_size.y); + if ((max_size.x == -1) || (max_size.y == -1)) + edje_object_size_max_get(sd->layout, &max_size.x, &max_size.y); if ((max_size.y > 0) && (base_size.y > max_size.y)) base_size.y = max_size.y; @@ -310,6 +397,8 @@ _base_geometry_calc(Evas_Object *obj, //Limit to Min Size evas_object_size_hint_min_get(obj, &min_size.x, &min_size.y); + if ((min_size.x == 0) || (min_size.y == 0)) + edje_object_size_min_get(sd->layout, &min_size.x, &min_size.y); if ((min_size.y > 0) && (base_size.y < min_size.y)) base_size.y = min_size.y; @@ -453,6 +542,7 @@ _arrow_update(Evas_Object *obj, Evas_Coord_Rectangle arrow_size; Evas_Coord x, y; double drag; + Evas_Coord_Rectangle shadow_left_top, shadow_right_bottom, arrow_padding; ELM_CTXPOPUP_DATA_GET(obj, sd); @@ -460,6 +550,12 @@ _arrow_update(Evas_Object *obj, evas_object_geometry_get (sd->arrow, NULL, NULL, &arrow_size.w, &arrow_size.h); + /* tizen only : since ctxpopup of tizen has shadow, start and end padding of arrow, it should be put together when updating arrow + * so there are some differences between open source and tizen */ + edje_object_part_geometry_get(ELM_WIDGET_DATA(sd)->resize_obj, "frame_shadow_left_top_padding", NULL, NULL, &shadow_left_top.w, &shadow_left_top.h); + edje_object_part_geometry_get(ELM_WIDGET_DATA(sd)->resize_obj, "frame_shadow_right_bottom_padding", NULL, NULL, &shadow_right_bottom.w, &shadow_right_bottom.h); + edje_object_part_geometry_get(ELM_WIDGET_DATA(sd)->resize_obj, "ctxpopup_frame_left_top", NULL, NULL, &arrow_padding.w, &arrow_padding.h); + /* arrow is not being kept as sub-object on purpose, here. the * design of the widget does not help with the contrary */ @@ -474,13 +570,13 @@ _arrow_update(Evas_Object *obj, if (base_size.h > 0) { - if (y < ((arrow_size.h * 0.5) + base_size.y)) + if (y <= ((arrow_size.h * 0.5) + base_size.y + shadow_left_top.h + arrow_padding.h)) y = 0; - else if (y > base_size.y + base_size.h - (arrow_size.h * 0.5)) - y = base_size.h - arrow_size.h; + else if (y >= (base_size.y + base_size.h - ((arrow_size.h * 0.5) + shadow_right_bottom.h + arrow_padding.h))) + y = base_size.h - (arrow_size.h + shadow_right_bottom.h + shadow_left_top.h + (arrow_padding.h * 2)); else - y = y - base_size.y - (arrow_size.h * 0.5); - drag = (double)(y) / (double)(base_size.h - arrow_size.h); + y = y - base_size.y - ((arrow_size.h * 0.5) + shadow_left_top.h + arrow_padding.h); + drag = (double)(y) / (double)(base_size.h - (arrow_size.h + shadow_right_bottom.h + shadow_left_top.h + (arrow_padding.h * 2))); edje_object_part_drag_value_set (ELM_WIDGET_DATA(sd)->resize_obj, (elm_widget_mirrored_get(obj) ? "elm.swallow.arrow_right" : @@ -497,13 +593,13 @@ _arrow_update(Evas_Object *obj, if (base_size.h > 0) { - if (y < ((arrow_size.h * 0.5) + base_size.y)) + if (y <= ((arrow_size.h * 0.5) + base_size.y + shadow_left_top.h + arrow_padding.h)) y = 0; - else if (y > (base_size.y + base_size.h - (arrow_size.h * 0.5))) - y = base_size.h - arrow_size.h; + else if (y >= (base_size.y + base_size.h - ((arrow_size.h * 0.5) + shadow_right_bottom.h + arrow_padding.h))) + y = base_size.h - (arrow_size.h + shadow_right_bottom.h + shadow_left_top.h + (arrow_padding.h * 2)); else - y = y - base_size.y - (arrow_size.h * 0.5); - drag = (double)(y) / (double)(base_size.h - arrow_size.h); + y = y - base_size.y - ((arrow_size.h * 0.5) + shadow_left_top.h + arrow_padding.h); + drag = (double)(y) / (double)(base_size.h - (arrow_size.h + shadow_right_bottom.h + shadow_left_top.h + (arrow_padding.h * 2))); edje_object_part_drag_value_set (ELM_WIDGET_DATA(sd)->resize_obj, (elm_widget_mirrored_get(obj) ? "elm.swallow.arrow_left" : @@ -519,16 +615,16 @@ _arrow_update(Evas_Object *obj, if (base_size.w > 0) { - if (x < ((arrow_size.w * 0.5) + base_size.x)) + if (x <= ((arrow_size.w * 0.5) + base_size.x + shadow_left_top.w + arrow_padding.w)) x = 0; - else if (x > (base_size.x + base_size.w - (arrow_size.w * 0.5))) - x = base_size.w - arrow_size.w; + else if (x >= (base_size.x + base_size.w - ((arrow_size.w * 0.5) + shadow_right_bottom.w + arrow_padding.w))) + x = base_size.w - (arrow_size.w + shadow_right_bottom.w + shadow_left_top.w + (arrow_padding.w * 2)); else - x = x - base_size.x - (arrow_size.w * 0.5); - drag = (double)(x) / (double)(base_size.w - arrow_size.w); + x = x - base_size.x - ((arrow_size.w * 0.5) + shadow_left_top.w + arrow_padding.w); + drag = (double)(x) / (double)(base_size.w - (arrow_size.w + shadow_right_bottom.w + shadow_left_top.w + (arrow_padding.w * 2))); edje_object_part_drag_value_set - (ELM_WIDGET_DATA(sd)->resize_obj, "elm.swallow.arrow_up", drag, - 1); + (ELM_WIDGET_DATA(sd)->resize_obj, "elm.swallow.arrow_up", + drag, 1); } break; @@ -540,12 +636,13 @@ _arrow_update(Evas_Object *obj, if (base_size.w > 0) { - if (x < ((arrow_size.w * 0.5) + base_size.x)) + if (x <= ((arrow_size.w * 0.5) + base_size.x + shadow_left_top.w + arrow_padding.w)) x = 0; - else if (x > (base_size.x + base_size.w - (arrow_size.w * 0.5))) - x = base_size.w - arrow_size.w; - else x = x - base_size.x - (arrow_size.w * 0.5); - drag = (double)(x) / (double)(base_size.w - arrow_size.w); + else if (x >= (base_size.x + base_size.w - ((arrow_size.w * 0.5) + shadow_right_bottom.w + arrow_padding.w))) + x = base_size.w - (arrow_size.w + shadow_right_bottom.w + shadow_left_top.w + (arrow_padding.w * 2)); + else + x = x - base_size.x - ((arrow_size.w * 0.5) + shadow_left_top.w + arrow_padding.w); + drag = (double)(x) / (double)(base_size.w - (arrow_size.w + shadow_right_bottom.w + shadow_left_top.w + (arrow_padding.w * 2))); edje_object_part_drag_value_set (ELM_WIDGET_DATA(sd)->resize_obj, "elm.swallow.arrow_down", drag, 0); @@ -571,23 +668,21 @@ _show_signals_emit(Evas_Object *obj, switch (dir) { case ELM_CTXPOPUP_DIRECTION_UP: - elm_layout_signal_emit(obj, "elm,state,show,up", "elm"); + edje_object_signal_emit(sd->layout, "elm,state,show,up", "elm"); break; case ELM_CTXPOPUP_DIRECTION_LEFT: - elm_layout_signal_emit(obj, - (elm_widget_mirrored_get(obj) ? "elm,state,show,right" : + edje_object_signal_emit(sd->layout, (elm_widget_mirrored_get(obj) ? "elm,state,show,right" : "elm,state,show,left"), "elm"); break; case ELM_CTXPOPUP_DIRECTION_RIGHT: - elm_layout_signal_emit(obj, - (elm_widget_mirrored_get(obj) ? "elm,state,show,left" : + edje_object_signal_emit(sd->layout, (elm_widget_mirrored_get(obj) ? "elm,state,show,left" : "elm,state,show,right"), "elm"); break; case ELM_CTXPOPUP_DIRECTION_DOWN: - elm_layout_signal_emit(obj, "elm,state,show,down", "elm"); + edje_object_signal_emit(sd->layout, "elm,state,show,down", "elm"); break; default: @@ -595,7 +690,7 @@ _show_signals_emit(Evas_Object *obj, } edje_object_signal_emit(sd->bg, "elm,state,show", "elm"); - elm_layout_signal_emit(obj, "elm,state,show", "elm"); +// elm_layout_signal_emit(obj, "elm,state,show", "elm"); } static void @@ -609,23 +704,21 @@ _hide_signals_emit(Evas_Object *obj, switch (dir) { case ELM_CTXPOPUP_DIRECTION_UP: - elm_layout_signal_emit(obj, "elm,state,hide,up", "elm"); + edje_object_signal_emit(sd->layout, "elm,state,hide,up", "elm"); break; case ELM_CTXPOPUP_DIRECTION_LEFT: - elm_layout_signal_emit(obj, - (elm_widget_mirrored_get(obj) ? "elm,state,hide,right" : + edje_object_signal_emit(sd->layout, (elm_widget_mirrored_get(obj) ? "elm,state,hide,right" : "elm,state,hide,left"), "elm"); break; case ELM_CTXPOPUP_DIRECTION_RIGHT: - elm_layout_signal_emit(obj, - (elm_widget_mirrored_get(obj) ? "elm,state,hide,left" : + edje_object_signal_emit(sd->layout, (elm_widget_mirrored_get(obj) ? "elm,state,hide,left" : "elm,state,hide,right"), "elm"); break; case ELM_CTXPOPUP_DIRECTION_DOWN: - elm_layout_signal_emit(obj, "elm,state,hide,down", "elm"); + edje_object_signal_emit(sd->layout, "elm,state,hide,down", "elm"); break; default: @@ -735,7 +828,7 @@ _elm_ctxpopup_smart_sizing_eval(Evas_Object *obj) } if (!sd->arrow) return; /* simple way to flag "under deletion" */ - + if ((!sd->content) && (sd->scr)) { evas_object_size_hint_min_set(sd->box, box_size.x, box_size.y); @@ -760,9 +853,12 @@ _elm_ctxpopup_smart_sizing_eval(Evas_Object *obj) evas_object_smart_calculate(sd->scr); } - evas_object_move(ELM_WIDGET_DATA(sd)->resize_obj, rect.x, rect.y); + evas_object_size_hint_min_set(ELM_WIDGET_DATA(sd)->resize_obj, rect.w, rect.h); evas_object_resize(ELM_WIDGET_DATA(sd)->resize_obj, rect.w, rect.h); + evas_object_move(sd->layout, rect.x, rect.y); + evas_object_resize(sd->layout, rect.w, rect.h); + _show_signals_emit(obj, sd->dir); } @@ -854,6 +950,8 @@ _elm_ctxpopup_smart_theme(Evas_Object *obj) (obj, sd->bg, "ctxpopup", "bg", elm_widget_style_get(obj)); elm_widget_theme_object_set (obj, sd->arrow, "ctxpopup", "arrow", elm_widget_style_get(obj)); + elm_widget_theme_object_set + (obj, sd->layout, "ctxpopup", "layout", elm_widget_style_get(obj)); //Items EINA_LIST_FOREACH(sd->items, elist, item) @@ -1123,6 +1221,7 @@ _on_show(void *data __UNUSED__, evas_object_show(sd->bg); evas_object_show(sd->arrow); + evas_object_show(sd->layout); edje_object_signal_emit(sd->bg, "elm,state,show", "elm"); elm_layout_signal_emit(obj, "elm,state,show", "elm"); @@ -1162,6 +1261,7 @@ _on_hide(void *data __UNUSED__, evas_object_hide(sd->bg); evas_object_hide(sd->arrow); + evas_object_hide(sd->layout); _scroller_size_reset(sd); @@ -1231,8 +1331,8 @@ _ctxpopup_restack_cb(void *data __UNUSED__, void *event_info __UNUSED__) { ELM_CTXPOPUP_DATA_GET(obj, sd); - - evas_object_layer_set(sd->bg, evas_object_layer_get(obj)); + evas_object_stack_below(sd->bg, obj); + evas_object_stack_below(sd->layout, obj); } static void @@ -1298,6 +1398,7 @@ static void _elm_ctxpopup_smart_add(Evas_Object *obj) { EVAS_SMART_DATA_ALLOC(obj, Elm_Ctxpopup_Smart_Data); + ELM_CTXPOPUP_DATA_GET(obj, sd); ELM_WIDGET_CLASS(_elm_ctxpopup_parent_sc)->base.add(obj); @@ -1347,6 +1448,15 @@ _elm_ctxpopup_smart_add(Evas_Object *obj) ELM_CONTAINER_CLASS(_elm_ctxpopup_parent_sc)->content_set (obj, "elm.swallow.content", priv->box); + priv->layout = edje_object_add(evas_object_evas_get(obj)); + elm_widget_theme_object_set(obj, priv->layout, "ctxpopup", "layout", "default"); + + edje_object_signal_callback_add + (priv->layout, "elm,action,hide,finished", "", _hide_finished_cb, obj); + edje_object_part_swallow(priv->layout, "swallow", ELM_WIDGET_DATA(sd)->resize_obj); + evas_object_size_hint_weight_set + (priv->layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_event_callback_add(obj, EVAS_CALLBACK_SHOW, _on_show, NULL); evas_object_event_callback_add(obj, EVAS_CALLBACK_HIDE, _on_hide, NULL); evas_object_event_callback_add(obj, EVAS_CALLBACK_MOVE, _on_move, NULL); @@ -1370,6 +1480,9 @@ _elm_ctxpopup_smart_del(Evas_Object *obj) evas_object_del(sd->bg); sd->bg = NULL; + evas_object_del(sd->layout); + sd->layout = NULL; + ELM_WIDGET_CLASS(_elm_ctxpopup_parent_sc)->base.del(obj); } @@ -1382,6 +1495,19 @@ _elm_ctxpopup_smart_parent_set(Evas_Object *obj, } static void +_elm_ctxpopup_smart_access(Evas_Object *obj, Eina_Bool is_access) +{ + Eina_List *elist = NULL; + Elm_Ctxpopup_Item *it; + + ELM_CTXPOPUP_CHECK(obj); + ELM_CTXPOPUP_DATA_GET(obj, sd); + + EINA_LIST_FOREACH(sd->items, elist, it) + _access_widget_item_register(it, is_access); +} + +static void _elm_ctxpopup_smart_set_user(Elm_Ctxpopup_Smart_Class *sc) { ELM_WIDGET_CLASS(sc)->base.add = _elm_ctxpopup_smart_add; @@ -1400,6 +1526,8 @@ _elm_ctxpopup_smart_set_user(Elm_Ctxpopup_Smart_Class *sc) ELM_CONTAINER_CLASS(sc)->content_unset = _elm_ctxpopup_smart_content_unset; ELM_LAYOUT_CLASS(sc)->sizing_eval = _elm_ctxpopup_smart_sizing_eval; + + ELM_WIDGET_CLASS(sc)->access = _elm_ctxpopup_smart_access; } EAPI const Elm_Ctxpopup_Smart_Class * @@ -1433,6 +1561,11 @@ elm_ctxpopup_add(Evas_Object *parent) if (!elm_widget_sub_object_add(parent, obj)) ERR("could not add %p as sub object of %p", obj, parent); + /* access: parent could be any object such as elm_list which does + not know elc_ctxpopup as its child object in the focus_next(); */ + ELM_WIDGET_DATA_GET(obj, sd); + sd->highlight_root = EINA_TRUE; + return obj; } @@ -1527,7 +1660,7 @@ elm_ctxpopup_horizontal_set(Evas_Object *obj, else edje_object_signal_emit(VIEW(item), "elm,state,separator", "elm"); - _item_disable_hook(item); + _item_disable_hook((Elm_Object_Item *)item); } sd->dir = ELM_CTXPOPUP_DIRECTION_UNKNOWN; diff --git a/src/lib/elc_multibuttonentry.c b/src/lib/elc_multibuttonentry.c index 7dfbfd9..df20701 100644 --- a/src/lib/elc_multibuttonentry.c +++ b/src/lib/elc_multibuttonentry.c @@ -2,6 +2,13 @@ #include "elm_priv.h" #include "elm_widget_multibuttonentry.h" +//#define _VI_EFFECT 0 + +#ifdef _VI_EFFECT +#define TRANSIT_DURATION 0.167 +#define ANIMATE_FRAME 10 +#endif + EAPI const char ELM_MULTIBUTTONENTRY_SMART_NAME[] = "elm_multibuttonentry"; //widget signals @@ -15,6 +22,7 @@ static const char SIG_UNFOCUSED[] = "unfocused"; static const char SIG_EXPANDED[] = "expanded"; static const char SIG_CONTRACTED[] = "contracted"; static const char SIG_EXPAND_STATE_CHANGED[] = "expand,state,changed"; +static const char SIG_LONGPRESSED[] = "longpressed"; static const Evas_Smart_Cb_Description _smart_callbacks[] = { {SIG_ITEM_SELECTED, ""}, @@ -27,6 +35,7 @@ static const Evas_Smart_Cb_Description _smart_callbacks[] = { {SIG_EXPANDED, ""}, {SIG_CONTRACTED, ""}, {SIG_EXPAND_STATE_CHANGED, ""}, + {SIG_LONGPRESSED, ""}, {NULL, NULL} }; @@ -36,6 +45,79 @@ EVAS_SMART_SUBCLASS_NEW elm_layout_smart_class_get, _smart_callbacks); static Eina_Bool +_elm_multibuttonentry_smart_focus_next(const Evas_Object *obj, + Elm_Focus_Direction dir, + Evas_Object **next) +{ + Eina_List *items = NULL; + Eina_List *elist = NULL; + Elm_Multibuttonentry_Item *it; + + ELM_MULTIBUTTONENTRY_DATA_GET(obj, sd); + + if (!sd) + return EINA_FALSE; + + if (!elm_widget_focus_next_get(sd->box, dir, next)) + { + elm_widget_focused_object_clear(sd->box); + elm_widget_focus_next_get(sd->box, dir, next); + } + + EINA_LIST_FOREACH(sd->items, elist, it) + items = eina_list_append(items, it->base.access_obj); + + return elm_widget_focus_list_next_get + (obj, items, eina_list_data_get, dir, next); +} + +static char * +_access_label_info_cb(void *data, Evas_Object *obj __UNUSED__) +{ + Evas_Object *mbe = (Evas_Object *)data; + const char *txt = NULL; + + ELM_MULTIBUTTONENTRY_DATA_GET(mbe, sd); + + if (!mbe) return NULL; + + if (!txt) + { + txt = elm_object_part_text_get(sd->label, "mbe.label"); + return strdup(txt); + } + else return strdup(txt); + + return NULL; +} + +static char * +_access_shrink_info_cb(void *data, Evas_Object *obj __UNUSED__) +{ + Evas_Object *mbe = (Evas_Object *)data; + const char *txt = NULL; + Eina_Strbuf *buf = NULL; + char *str = NULL; + + ELM_MULTIBUTTONENTRY_DATA_GET(mbe, sd); + + if (!mbe) return NULL; + + if (!txt) txt = elm_object_text_get(sd->end); + if (txt) + { + buf = eina_strbuf_new(); + eina_strbuf_append(buf, E_("And ")); + eina_strbuf_append(buf, txt); + eina_strbuf_append(buf, E_(" more")); + str = eina_strbuf_string_steal(buf); + eina_strbuf_free(buf); + return str; + } + return NULL; +} + +static Eina_Bool _guide_packed(Evas_Object *obj) { Eina_List *children; @@ -91,7 +173,11 @@ _guide_set(Evas_Object *obj, { sd->guide = elm_layout_add(obj); elm_layout_theme_set - (sd->guide, "multibuttonentry", "guide", elm_widget_style_get(obj)); + (sd->guide, "multibuttonentry", "guidetext", elm_widget_style_get(obj)); + evas_object_size_hint_weight_set + (sd->guide, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set + (sd->guide, EVAS_HINT_FILL, EVAS_HINT_FILL); } elm_object_text_set(sd->guide, text); @@ -122,7 +208,7 @@ _label_set(Evas_Object *obj, elm_layout_theme_set (sd->label, "multibuttonentry", "label", elm_widget_style_get(obj)); } - elm_object_text_set(sd->label, text); + elm_object_part_text_set(sd->label, "mbe.label", text); if (strlen(text) && !_label_packed(obj)) { @@ -134,9 +220,388 @@ _label_set(Evas_Object *obj, elm_box_unpack(sd->box, sd->label); evas_object_hide(sd->label); } + + // ACCESS + if (_elm_config->access_mode) + { + _elm_access_object_register(obj, ELM_WIDGET_DATA(sd)->resize_obj); + _elm_access_callback_set(_elm_access_object_get(obj), ELM_ACCESS_INFO, _access_label_info_cb, obj); + } +} + +#ifdef _VI_EFFECT +static void +_box_layout_pre_calculate(Evas_Object *obj, + Elm_Multibuttonentry_Item *except_it, + Evas_Coord *minh_wo_entry, + Evas_Coord *minh) +{ + Evas_Coord mnw, mnh, x, w, hpad = 0, vpad = 0; + Evas_Coord linew = 0, lineh = 0; + int line_num; + Eina_List *l; + Elm_Multibuttonentry_Item *it; + + ELM_MULTIBUTTONENTRY_DATA_GET(obj, sd); + + evas_object_geometry_get(sd->box, &x, NULL, &w, NULL); + elm_box_padding_get(sd->box, &hpad, &vpad); + + line_num = 1; + + if (sd->label && _label_packed(obj)) + { + evas_object_size_hint_min_get(sd->label, &mnw, &mnh); + + linew = mnw; + linew += hpad; + lineh = mnh; + } + + EINA_LIST_FOREACH(sd->items, l, it) + { + if (it == except_it) continue; + + evas_object_size_hint_min_get(VIEW(it), &mnw, &mnh); + + linew += mnw; + if (lineh < mnh) lineh = mnh; + + if (linew > w) + { + linew = mnw; + line_num++; + } + + + linew += hpad; + } + + if (minh_wo_entry) + *minh_wo_entry = lineh * line_num + (line_num - 1) * vpad; + + if (sd->editable) + { + // get entry size after text is reset + elm_object_text_set(sd->entry, ""); + elm_layout_sizing_eval(sd->entry); + evas_object_size_hint_min_get(sd->entry, &mnw, &mnh); + + linew += mnw; + if (lineh < mnh) lineh = mnh; + + if (linew > w) line_num++; + } + + if (minh) + *minh = lineh * line_num + (line_num - 1) * vpad; +} + +static void +_on_item_expanding_transit_del(void *data, + Elm_Transit *transit __UNUSED__) +{ + Elm_Multibuttonentry_Item *it = data; + + evas_object_data_set(VIEW(it), "transit", NULL); + evas_object_smart_callback_call(WIDGET(it), SIG_ITEM_ADDED, it); +} + +static Eina_Bool +_rect_expanding_animate(void *data) +{ + Evas_Coord w, h, eh; + Evas_Object *rect; + Elm_Multibuttonentry_Item *it = data; + + ELM_MULTIBUTTONENTRY_DATA_GET(WIDGET(it), sd); + + rect = (Evas_Object *)evas_object_data_get(VIEW(it), "effect_rect"); + if (!rect) return ECORE_CALLBACK_CANCEL; + + evas_object_geometry_get(sd->entry, NULL, NULL, NULL, &eh); + evas_object_size_hint_min_get(rect, &w, &h); + + if (h >= eh) + { + Eina_List *children; + Elm_Multibuttonentry_Item *last_it; + + evas_object_del(rect); + evas_object_data_set(VIEW(it), "effect_rect", NULL); + + // if last item is unpacked, add it + children = elm_box_children_get(sd->box); + last_it = eina_list_data_get(eina_list_last(sd->items)); + if (VIEW(last_it) != eina_list_data_get(eina_list_last(children))) + { + elm_box_pack_end(sd->box, VIEW(last_it)); + evas_object_show(VIEW(last_it)); + } + eina_list_free(children); + + if (sd->editable) + { + elm_box_pack_end(sd->box, sd->entry); + evas_object_show(sd->entry); + if (elm_object_focus_get(WIDGET(it))) + elm_object_focus_set(sd->entry, EINA_TRUE); + } + + return ECORE_CALLBACK_CANCEL; + } + else + evas_object_size_hint_min_set(rect, w, h + eh / ANIMATE_FRAME); + + return ECORE_CALLBACK_RENEW; +} + +static void +_item_adding_effect_add(Evas_Object *obj, + Elm_Multibuttonentry_Item *it) +{ + Elm_Transit *trans; + Evas_Coord minh_wo_entry, minh; + Eina_Bool floating = EINA_FALSE;; + + ELM_MULTIBUTTONENTRY_DATA_GET(obj, sd); + + _box_layout_pre_calculate(obj, NULL, &minh_wo_entry, &minh); + + // if box will be expanded, add resizing effect + if (sd->boxh < minh) + { + Evas_Coord bx, by, bw, bh; + Evas_Object *rect; + Ecore_Animator *anim; + + evas_object_geometry_get(sd->box, &bx, &by, &bw, &bh); + + // if box will be expanded with item and entry + if (minh_wo_entry == minh) + { + Elm_Multibuttonentry_Item *last_it; + + last_it = eina_list_data_get(eina_list_last(sd->items)); + if (it == last_it) + { + Evas_Coord iw, ih, vpad; + + evas_object_size_hint_min_get(VIEW(it), &iw, &ih); + elm_box_padding_get(sd->box, NULL, &vpad); + + evas_object_move(VIEW(it), bx, by + bh + vpad); + evas_object_resize(VIEW(it), iw, ih); + evas_object_show(VIEW(it)); + + floating = EINA_TRUE; + } + else + { + elm_box_unpack(sd->box, VIEW(last_it)); + evas_object_hide(VIEW(last_it)); + } + } + + if (sd->editable) + { + if (elm_object_focus_get(sd->entry)) + elm_object_focus_set(sd->entry, EINA_FALSE); + elm_box_unpack(sd->box, sd->entry); + evas_object_hide(sd->entry); + elm_entry_input_panel_show(sd->entry); + } + + rect = evas_object_rectangle_add(evas_object_evas_get(obj)); + evas_object_color_set(rect, 0, 0, 0, 0); + evas_object_size_hint_min_set(rect, bw, 0); + evas_object_data_set(VIEW(it), "effect_rect", rect); + elm_box_pack_end(sd->box, rect); + evas_object_show(rect); + + anim = ecore_animator_add(_rect_expanding_animate, it); + evas_object_data_set(rect, "animator", anim); + } + + if (!floating) + { + Eina_List *cur; + cur = eina_list_data_find_list(sd->items, it); + if (cur == sd->items) + { + if (sd->label && _label_packed(obj)) + elm_box_pack_after(sd->box, VIEW(it), sd->label); + else + elm_box_pack_start(sd->box, VIEW(it)); + } + else + { + Elm_Multibuttonentry_Item *prev_it; + prev_it = eina_list_data_get(eina_list_prev(cur)); + elm_box_pack_after(sd->box, VIEW(it), VIEW(prev_it)); + } + evas_object_show(VIEW(it)); + } + + trans = elm_transit_add(); + elm_transit_object_add(trans, VIEW(it)); + elm_transit_effect_zoom_add(trans, 0.9, 1.0); + elm_transit_effect_color_add(trans, 0, 0, 0, 0, 255, 255, 255, 255); + elm_transit_del_cb_set(trans, _on_item_expanding_transit_del, it); + elm_transit_duration_set(trans, TRANSIT_DURATION); + evas_object_data_set(VIEW(it), "transit", trans); + elm_transit_go(trans); +} + +static void +_on_item_contracting_transit_del(void *data, + Elm_Transit *transit __UNUSED__) +{ + Evas_Object *rect; + Elm_Multibuttonentry_Item *it = data; + + ELM_MULTIBUTTONENTRY_DATA_GET(WIDGET(it), sd); + + evas_object_data_set(VIEW(it), "transit", NULL); + + rect = (Evas_Object *)evas_object_data_get(VIEW(it), "effect_rect"); + if (rect) + { + evas_object_hide(VIEW(it)); + return; + } + + // delete item and set focus to entry + if (sd->editable && elm_object_focus_get(WIDGET(it))) + elm_object_focus_set(sd->entry, EINA_TRUE); + + elm_object_item_del((Elm_Object_Item *)it); +} + +static Eina_Bool +_rect_contracting_animate(void *data) +{ + Evas_Coord w, h, eh; + Evas_Object *rect; + Elm_Multibuttonentry_Item *it = data; + + ELM_MULTIBUTTONENTRY_DATA_GET(WIDGET(it), sd); + + rect = (Evas_Object *)evas_object_data_get(VIEW(it), "effect_rect"); + if (!rect) return ECORE_CALLBACK_CANCEL; + + evas_object_geometry_get(sd->entry, NULL, NULL, NULL, &eh); + evas_object_size_hint_min_get(rect, &w, &h); + + if (h <= 0) + { + Elm_Transit *trans; + Elm_Multibuttonentry_Item *last_it; + + evas_object_del(rect); + evas_object_data_set(VIEW(it), "effect_rect", NULL); + + // if last item is unpacked, add it + last_it = eina_list_data_get(eina_list_last(sd->items)); + if (it != last_it) + { + if (!evas_object_visible_get(VIEW(last_it))) + { + elm_box_pack_end(sd->box, VIEW(last_it)); + evas_object_show(VIEW(last_it)); + } + } + + if (sd->editable) + { + elm_box_pack_end(sd->box, sd->entry); + evas_object_show(sd->entry); + if (elm_object_focus_get(WIDGET(it))) + elm_object_focus_set(sd->entry, EINA_TRUE); + } + + // delete the button + trans = (Elm_Transit *)evas_object_data_get(VIEW(it), "transit"); + if (!trans) + _on_item_contracting_transit_del(it, NULL); + + return ECORE_CALLBACK_CANCEL; + } + else + evas_object_size_hint_min_set(rect, w, h - eh / ANIMATE_FRAME); + + return ECORE_CALLBACK_RENEW; } static void +_item_deleting_effect_add(Evas_Object *obj, + Elm_Multibuttonentry_Item *it) +{ + Elm_Transit *trans; + Evas_Coord minh; + + ELM_MULTIBUTTONENTRY_DATA_GET(obj, sd); + + _box_layout_pre_calculate(obj, it, NULL, &minh); + + // if box will be contracted, add resizing effect + if (sd->boxh > minh) + { + Evas_Coord bx, bw, ix, eh; + Ecore_Animator *anim; + Evas_Object *rect; + Elm_Multibuttonentry_Item *last_it; + + last_it = eina_list_data_get(eina_list_last(sd->items)); + evas_object_geometry_get(sd->box, &bx, NULL, &bw, NULL); + evas_object_geometry_get(VIEW(last_it), &ix, NULL, NULL, NULL); + + // if box will be contracted with item and entry + if (ix == bx) + { + if (it == last_it) + elm_box_unpack(sd->box, VIEW(it)); + else + { + elm_box_unpack(sd->box, VIEW(last_it)); + evas_object_hide(VIEW(last_it)); + } + } + + if (sd->editable) + { + if (elm_object_focus_get(sd->entry)) + elm_object_focus_set(sd->entry, EINA_FALSE); + elm_box_unpack(sd->box, sd->entry); + evas_object_hide(sd->entry); + elm_entry_input_panel_show(sd->entry); + } + + rect = evas_object_rectangle_add(evas_object_evas_get(obj)); + evas_object_color_set(rect, 0, 0, 0, 0); + evas_object_geometry_get(sd->entry, NULL, NULL, NULL, &eh); + evas_object_size_hint_min_set(rect, bw, eh); + evas_object_data_set(VIEW(it), "effect_rect", rect); + elm_box_pack_end(sd->box, rect); + evas_object_show(rect); + + anim = ecore_animator_add(_rect_contracting_animate, it); + evas_object_data_set(rect, "animator", anim); + } + + trans = elm_transit_add(); + elm_transit_object_add(trans, VIEW(it)); + elm_transit_effect_zoom_add(trans, 1.0, 0.9); + elm_transit_effect_color_add(trans, 255, 255, 255, 255, 0, 0, 0, 0); + elm_transit_del_cb_set(trans, _on_item_contracting_transit_del, it); + elm_transit_duration_set(trans, TRANSIT_DURATION); + evas_object_data_set(VIEW(it), "transit", trans); + elm_transit_go(trans); + +} +#endif + +static void _layout_expand(Evas_Object *obj) { int count, items_count, i; @@ -150,10 +615,10 @@ _layout_expand(Evas_Object *obj) children = elm_box_children_get(sd->box); count = eina_list_count(children); - if (sd->number) + if (sd->end) { - evas_object_del(sd->number); - sd->number = NULL; + evas_object_del(sd->end); + sd->end = NULL; count--; } if (sd->label && _label_packed(obj)) count--; @@ -186,6 +651,11 @@ _layout_shrink(Evas_Object *obj, Eina_List *l, *children; Evas_Object *child; Elm_Multibuttonentry_Item *it; +#ifdef _VI_EFFECT + Elm_Transit *trans; + Evas_Object *rect; + Ecore_Animator *anim; +#endif ELM_MULTIBUTTONENTRY_DATA_GET(obj, sd); @@ -217,38 +687,92 @@ _layout_shrink(Evas_Object *obj, linew += hpad; } - if(!count) return; + if (!count) return; items_count = eina_list_count(sd->items); if (count < items_count) { + const char *str = NULL; char buf[16]; - if (!sd->number) + str = elm_layout_data_get(obj, "closed_button_type"); + if (!sd->end) + { + sd->end = elm_layout_add(obj); + if (str && !strcmp(str, "image")) + elm_layout_theme_set(sd->end, "multibuttonentry", + "closedbutton", elm_widget_style_get(obj)); + else + elm_layout_theme_set(sd->end, "multibuttonentry", + "number", elm_widget_style_get(obj)); + } + if (!str || strcmp(str, "image")) { - sd->number = elm_layout_add(obj); - elm_layout_theme_set - (sd->number, "multibuttonentry", "number", - elm_widget_style_get(obj)); + snprintf(buf, sizeof(buf), "+%d", items_count - count); + elm_object_text_set(sd->end, buf); + + // ACCESS + if (_elm_config->access_mode && sd->end) + { + _elm_access_object_register(obj, ELM_WIDGET_DATA(sd)->resize_obj); + _elm_access_callback_set(_elm_access_object_get(obj), ELM_ACCESS_INFO, _access_shrink_info_cb, obj); + } } - snprintf(buf, sizeof(buf), "+%d", items_count - count); - elm_object_text_set(sd->number, buf); - evas_object_smart_calculate(sd->number); - evas_object_size_hint_min_get(sd->number, &mnw, NULL); + evas_object_smart_calculate(sd->end); + evas_object_size_hint_min_get(sd->end, &mnw, NULL); linew += mnw; if (linew > w) { count--; - snprintf(buf, sizeof(buf), "+%d", items_count - count); - elm_object_text_set(sd->number, buf); + if (!str || strcmp(str, "image")) + { + snprintf(buf, sizeof(buf), "+%d", items_count - count); + elm_object_text_set(sd->end, buf); + + // ACCESS + if (_elm_config->access_mode && sd->end) + { + _elm_access_object_register(obj, ELM_WIDGET_DATA(sd)->resize_obj); + _elm_access_callback_set(_elm_access_object_get(obj), ELM_ACCESS_INFO, _access_shrink_info_cb, obj); + } + } } if (!force) { +#ifdef _VI_EFFECT + // reset last inserted item's effect_rect + it = eina_list_nth(sd->items, count - 1); + rect = (Evas_Object *)evas_object_data_get(VIEW(it), "effect_rect"); + if (rect) + { + anim = (Ecore_Animator*)evas_object_data_get(rect, "animator"); + if (anim) ecore_animator_del(anim); + + evas_object_del(rect); + evas_object_data_set(VIEW(it), "effect_rect", NULL); + } +#endif + for (i = count; i < items_count; i++) { it = eina_list_nth(sd->items, i); +#ifdef _VI_EFFECT + // reset all effects + trans = (Elm_Transit *)evas_object_data_get(VIEW(it), "transit"); + if (trans) elm_transit_del(trans); + + rect = (Evas_Object *)evas_object_data_get(VIEW(it), "effect_rect"); + if (rect) + { + anim = (Ecore_Animator*)evas_object_data_get(rect, "animator"); + if (anim) ecore_animator_del(anim); + + evas_object_del(rect); + evas_object_data_set(VIEW(it), "effect_rect", NULL); + } +#endif elm_box_unpack(sd->box, VIEW(it)); evas_object_hide(VIEW(it)); } @@ -263,6 +787,38 @@ _layout_shrink(Evas_Object *obj, { // if it is called from item_append_xxx, item_del functions, // all items are unpacked and packed again +#ifdef _VI_EFFECT + // reset last inserted item's effect_rect + it = eina_list_nth(sd->items, count - 1); + rect = (Evas_Object *)evas_object_data_get(VIEW(it), "effect_rect"); + if (rect) + { + anim = (Ecore_Animator*)evas_object_data_get(rect, "animator"); + if (anim) ecore_animator_del(anim); + + evas_object_del(rect); + evas_object_data_set(VIEW(it), "effect_rect", NULL); + } + + for (i = count; i < items_count; i++) + { + it = eina_list_nth(sd->items, i); + // reset all effects + trans = (Elm_Transit *)evas_object_data_get(VIEW(it), "transit"); + if (trans) elm_transit_del(trans); + + rect = (Evas_Object *)evas_object_data_get(VIEW(it), "effect_rect"); + if (rect) + { + anim = (Ecore_Animator*)evas_object_data_get(rect, "animator"); + if (anim) ecore_animator_del(anim); + + evas_object_del(rect); + evas_object_data_set(VIEW(it), "effect_rect", NULL); + } + } +#endif + children = elm_box_children_get(sd->box); EINA_LIST_FREE(children, child) { @@ -281,8 +837,8 @@ _layout_shrink(Evas_Object *obj, } } - elm_box_pack_end(sd->box, sd->number); - evas_object_show(sd->number); + elm_box_pack_end(sd->box, sd->end); + evas_object_show(sd->end); sd->expanded_state = EINA_FALSE; } @@ -290,6 +846,27 @@ _layout_shrink(Evas_Object *obj, { if (!force) { +#ifdef _VI_EFFECT + // reset last inserted item's effect_rect + it = eina_list_nth(sd->items, count - 1); + rect = (Evas_Object *)evas_object_data_get(VIEW(it), "effect_rect"); + if (rect) + { + anim = (Ecore_Animator*)evas_object_data_get(rect, "animator"); + if (anim) ecore_animator_del(anim); + + evas_object_del(rect); + evas_object_data_set(VIEW(it), "effect_rect", NULL); + + if (sd->editable) + { + elm_box_pack_end(sd->box, sd->entry); + evas_object_show(sd->entry); + if (elm_object_focus_get(WIDGET(it))) + elm_object_focus_set(sd->entry, EINA_TRUE); + } + } +#endif if (sd->editable) { evas_object_size_hint_min_get(sd->entry, &mnw, NULL); @@ -304,14 +881,28 @@ _layout_shrink(Evas_Object *obj, } else { - if (sd->number) + if (sd->end) { - evas_object_del(sd->number); - sd->number = NULL; + evas_object_del(sd->end); + sd->end = NULL; } // if it is called from item_append_xxx, item_del functions, // all items are unpacked and packed again +#ifdef _VI_EFFECT + // reset last inserted item's effect_rect + it = eina_list_nth(sd->items, count - 1); + rect = (Evas_Object *)evas_object_data_get(VIEW(it), "effect_rect"); + if (rect) + { + anim = (Ecore_Animator*)evas_object_data_get(rect, "animator"); + if (anim) ecore_animator_del(anim); + + evas_object_del(rect); + evas_object_data_set(VIEW(it), "effect_rect", NULL); + } +#endif + children = elm_box_children_get(sd->box); EINA_LIST_FREE(children, child) { @@ -336,7 +927,7 @@ _layout_shrink(Evas_Object *obj, evas_object_size_hint_min_get(sd->entry, &mnw, NULL); linew += mnw; if (linew > w) - sd->expanded_state = EINA_FALSE; + sd->expanded_state = EINA_FALSE; else { elm_box_pack_end(sd->box, sd->entry); @@ -347,13 +938,13 @@ _layout_shrink(Evas_Object *obj, } if (!sd->expanded_state && !force) - evas_object_smart_callback_call(obj, SIG_EXPAND_STATE_CHANGED, NULL); + evas_object_smart_callback_call(obj, SIG_EXPAND_STATE_CHANGED, NULL); } static Eina_Bool _box_min_size_calculate(Evas_Object *box, - Evas_Object_Box_Data *priv, - int *line_height) + Evas_Object_Box_Data *priv, + int *line_height) { Evas_Coord mnw, mnh, w, minw, minh = 0, linew = 0, lineh = 0; int line_num; @@ -369,6 +960,12 @@ _box_min_size_calculate(Evas_Object *box, { evas_object_size_hint_min_get(opt->obj, &mnw, &mnh); +#ifdef _VI_EFFECT + if (mnw == w && + !strcmp(evas_object_type_get(opt->obj), "rectangle")) + break; +#endif + linew += mnw; if (lineh < mnh) lineh = mnh; @@ -379,11 +976,21 @@ _box_min_size_calculate(Evas_Object *box, } if (l != eina_list_last(priv->children)) - linew += priv->pad.h; + linew += priv->pad.h; } minh = lineh * line_num + (line_num - 1) * priv->pad.v; +#ifdef _VI_EFFECT + // if last item is effect_rect + if (opt && opt->obj && mnw == w && + !strcmp(evas_object_type_get(opt->obj), "rectangle")) + { + minh += priv->pad.v; + minh += mnh; + } +#endif + evas_object_size_hint_min_set(box, minw, minh); *line_height = lineh; @@ -401,7 +1008,6 @@ _box_layout(Evas_Object *o, Eina_List *l; Evas_Object *obj; Evas_Object_Box_Option *opt; - ELM_MULTIBUTTONENTRY_DATA_GET(data, sd); if (!_box_min_size_calculate(o, priv, &lineh)) return; @@ -458,7 +1064,7 @@ _box_layout(Evas_Object *o, if (fh) oh = hh; linew += ww; - if (linew > w) + if (linew > w && l != priv->children) { xx = x; yy += hh; @@ -471,21 +1077,11 @@ _box_layout(Evas_Object *o, ((!rtl) ? (xx) : (x + (w - (xx - x) - ww))) + (Evas_Coord)(((double)(ww - ow)) * ax), yy + (Evas_Coord)(((double)(hh - oh)) * ay)); - evas_object_resize(obj, ow, oh); + evas_object_resize(obj, ow, oh); xx += ww; xx += priv->pad.h; } - - // when expanded_set is called before box layout is calculated, - // it should be called again - if (!elm_object_focus_get(data) && sd->expanded != sd->expanded_state) - { - if (sd->expanded) - _layout_expand(data); - else - _layout_shrink(data, EINA_FALSE); - } } static void @@ -501,15 +1097,15 @@ _on_box_resize(void *data, evas_object_geometry_get(obj, NULL, NULL, &w, &h); if (sd->boxh < h) - evas_object_smart_callback_call(data, SIG_EXPANDED, NULL); + evas_object_smart_callback_call(data, SIG_EXPANDED, NULL); else if (sd->boxh > h) - evas_object_smart_callback_call(data, SIG_CONTRACTED, NULL); + evas_object_smart_callback_call(data, SIG_CONTRACTED, NULL); // on rotation, items should be packed again in the shrinked layout if (sd->boxw && sd->boxw != w) { if (!elm_object_focus_get(data) && !sd->expanded) - _layout_shrink(data, EINA_TRUE); + _layout_shrink(data, EINA_TRUE); } sd->boxh = h; @@ -545,7 +1141,7 @@ _on_item_clicked(void *data, // handles input panel because it can be hidden by user if (sd->editable) - elm_entry_input_panel_show(sd->entry); + elm_entry_input_panel_show(sd->entry); evas_object_smart_callback_call(WIDGET(it), SIG_ITEM_CLICKED, it); } @@ -576,21 +1172,68 @@ _on_item_focus(void *data, if (evas_object_focus_get(obj)) { if (elm_object_focus_get(sd->entry)) - elm_object_focus_set(sd->entry, EINA_FALSE); + elm_object_focus_set(sd->entry, EINA_FALSE); sd->selected_item = (Elm_Object_Item *)it; - elm_layout_signal_emit(VIEW(it), "elm,state,bg,focus", "elm"); + elm_layout_signal_emit(VIEW(it), "focused", ""); if (sd->editable) - elm_entry_input_panel_show(sd->entry); + elm_entry_input_panel_show(sd->entry); } else { sd->selected_item = NULL; - elm_layout_signal_emit(VIEW(it), "elm,state,bg,unfocus", "elm"); + elm_layout_signal_emit(VIEW(it), "default", ""); if (sd->editable) - elm_entry_input_panel_hide(sd->entry); + elm_entry_input_panel_hide(sd->entry); + } +} + +static Eina_Bool +_long_press_cb(void *data) +{ + Elm_Multibuttonentry_Item *it = data; + + ELM_MULTIBUTTONENTRY_DATA_GET(WIDGET(it), sd); + + sd->longpress_timer = NULL; + sd->long_pressed = EINA_TRUE; + + evas_object_smart_callback_call(WIDGET(it), SIG_LONGPRESSED, it); + + return ECORE_CALLBACK_CANCEL; +} + +static void +_mouse_down_cb(Elm_Multibuttonentry_Item *it, + Evas *evas __UNUSED__, + Evas_Object *obj __UNUSED__, + Evas_Event_Mouse_Down *ev) +{ + ELM_MULTIBUTTONENTRY_DATA_GET(WIDGET(it), sd); + + if (ev->button != 1) return; + + sd->long_pressed = EINA_FALSE; + + if (sd->longpress_timer) ecore_timer_del(sd->longpress_timer); + sd->longpress_timer = ecore_timer_add + (_elm_config->longpress_timeout, _long_press_cb, it); +} + +static void +_mouse_up_cb(Elm_Multibuttonentry_Item *it, + Evas *evas __UNUSED__, + Evas_Object *obj __UNUSED__, + Evas_Event_Mouse_Down *ev) +{ + ELM_MULTIBUTTONENTRY_DATA_GET(WIDGET(it), sd); + + if (sd->longpress_timer) + { + ecore_timer_del(sd->longpress_timer); + sd->longpress_timer = NULL; } } @@ -599,19 +1242,19 @@ _item_text_set_hook(Elm_Object_Item *it, const char *part, const char *text) { - if (part && strcmp(part, "elm.text")) return; + if (part && strcmp(part, "elm.btn.text")) return; if (!text) return; - elm_object_text_set(VIEW(it), text); + elm_object_part_text_set(VIEW(it), "elm.btn.text", text); } static const char * _item_text_get_hook(const Elm_Object_Item *it, const char *part) { - if (part && strcmp(part, "elm.text")) return NULL; + if (part && strcmp(part, "elm.btn.text")) return NULL; - return elm_object_text_get(VIEW(it)); + return elm_object_part_text_get(VIEW(it), "elm.btn.text"); } static Eina_Bool @@ -622,7 +1265,38 @@ _item_del_pre_hook(Elm_Object_Item *it) sd->items = eina_list_remove(sd->items, it); if (!elm_object_focus_get(WIDGET(it)) && !sd->expanded) - _layout_shrink(WIDGET(it), EINA_TRUE); + _layout_shrink(WIDGET(it), EINA_TRUE); + +#ifdef _VI_EFFECT + Elm_Transit *trans; + Evas_Object *rect; + + trans = (Elm_Transit *)evas_object_data_get(VIEW(it), "transit"); + if (trans) + { + elm_transit_del_cb_set(trans, NULL, NULL); + elm_transit_del(trans); + } + + rect = (Evas_Object *)evas_object_data_get(VIEW(it), "effect_rect"); + if (rect) + { + Ecore_Animator *anim; + anim = (Ecore_Animator*)evas_object_data_get(rect, "animator"); + if (anim) ecore_animator_del(anim); + + evas_object_del(rect); + evas_object_data_set(VIEW(it), "effect_rect", NULL); + + if (sd->editable) + { + elm_box_pack_end(sd->box, sd->entry); + evas_object_show(sd->entry); + if (elm_object_focus_get(WIDGET(it))) + elm_object_focus_set(sd->entry, EINA_TRUE); + } + } +#endif if (!sd->items && !elm_object_focus_get(WIDGET(it)) && sd->guide && !_guide_packed(WIDGET(it))) @@ -642,6 +1316,68 @@ _item_del_pre_hook(Elm_Object_Item *it) return EINA_TRUE; } +static char * +_access_info_cb(void *data, Evas_Object *obj __UNUSED__) +{ + Elm_Multibuttonentry_Item *it = (Elm_Multibuttonentry_Item *)data; + const char *txt = NULL; + Eina_Strbuf *buf = NULL; + char *str = NULL; + + if (!it) return NULL; + + if (!txt)txt = elm_object_item_text_get(it); + if (txt) + { + buf = eina_strbuf_new(); + eina_strbuf_append(buf, E_(" double tap to edit")); + eina_strbuf_prepend(buf, txt); + str = eina_strbuf_string_steal(buf); + eina_strbuf_free(buf); + return str; + } + + return NULL; +} + +static char * +_access_state_cb(void *data, Evas_Object *obj __UNUSED__) +{ + Elm_Multibuttonentry_Item *it = (Elm_Multibuttonentry_Item *)data; + if (!it) return NULL; + + if (it->base.disabled) + return strdup(E_("State: Disabled")); + + return NULL; +} + +static void +_access_activate_cb(void *data __UNUSED__, + Evas_Object *part_obj __UNUSED__, + Elm_Object_Item *item) +{ + _on_item_selected(item, NULL, NULL, NULL); +} + +static void +_access_widget_item_register(Elm_Multibuttonentry_Item *it, Eina_Bool is_access) +{ + Elm_Access_Info *ai; + + if (!is_access) _elm_access_widget_item_unregister((Elm_Widget_Item *)it); + else + { + _elm_access_widget_item_register((Elm_Widget_Item *)it); + + ai = _elm_access_object_get(it->base.access_obj); + + _elm_access_callback_set(ai, ELM_ACCESS_INFO, _access_info_cb, it); + _elm_access_callback_set(ai, ELM_ACCESS_STATE, _access_state_cb, it); + _elm_access_activate_callback_set(ai, _access_activate_cb, it); + } +} + static Elm_Multibuttonentry_Item * _item_new(Evas_Object *obj, const char *text, @@ -652,14 +1388,14 @@ _item_new(Evas_Object *obj, Elm_Multibuttonentry_Item_Filter *ft; Eina_List *l; const char *str; - Evas_Coord w, maxw = 0; + Evas_Coord minw, minh, maxw = 0; ELM_MULTIBUTTONENTRY_DATA_GET(obj, sd); EINA_LIST_FOREACH(sd->filters, l, ft) { if (!ft->func(obj, text, data, ft->data)) - return NULL; + return NULL; } it = elm_widget_item_new(obj, Elm_Multibuttonentry_Item); @@ -667,7 +1403,7 @@ _item_new(Evas_Object *obj, VIEW(it) = elm_layout_add(obj); elm_layout_theme_set - (VIEW(it), "multibuttonentry", "button", elm_widget_style_get(obj)); + (VIEW(it), "multibuttonentry", "btn", elm_widget_style_get(obj)); elm_layout_signal_callback_add (VIEW(it), "elm,action,clicked", "", _on_item_clicked, it); elm_layout_signal_callback_add @@ -678,20 +1414,26 @@ _item_new(Evas_Object *obj, evas_object_event_callback_add (elm_layout_edje_get(VIEW(it)), EVAS_CALLBACK_FOCUS_OUT, _on_item_focus, it); - elm_object_text_set(VIEW(it), text); + evas_object_event_callback_add + (elm_layout_edje_get(VIEW(it)), + EVAS_CALLBACK_MOUSE_DOWN, (Evas_Object_Event_Cb)_mouse_down_cb, it); + evas_object_event_callback_add + (elm_layout_edje_get(VIEW(it)), + EVAS_CALLBACK_MOUSE_UP, (Evas_Object_Event_Cb)_mouse_up_cb, it); + elm_object_part_text_set(VIEW(it), "elm.btn.text", text); it->func = func; it->base.data = data; // adjust item size if item is longer than maximum size evas_object_smart_calculate(VIEW(it)); - evas_object_size_hint_min_get(VIEW(it), &w, NULL); - str = elm_layout_data_get(VIEW(it), "max_size"); + evas_object_size_hint_min_get(VIEW(it), &minw, &minh); + str = elm_layout_data_get(VIEW(it), "button_max_size"); if (str) maxw = atoi(str); maxw = maxw * elm_widget_scale_get(obj) * elm_config_scale_get(); - if (w > maxw) + if (minw > maxw) { - elm_layout_signal_emit(VIEW(it), "elm,state,text,ellipsis", "elm"); + elm_layout_signal_emit(VIEW(it), "elm,state,text,ellipsis", ""); elm_layout_sizing_eval(VIEW(it)); } @@ -701,6 +1443,9 @@ _item_new(Evas_Object *obj, sd->item_be_selected = EINA_TRUE; + // ACCESS + if (_elm_config->access_mode) _access_widget_item_register(it, EINA_TRUE); + return it; } @@ -722,13 +1467,17 @@ _on_entry_unfocused(void *data, if (!it) return; sd->items = eina_list_append(sd->items, it); +#ifdef _VI_EFFECT + _item_adding_effect_add(data, it); +#else elm_box_pack_before(sd->box, VIEW(it), obj); evas_object_show(VIEW(it)); evas_object_smart_callback_call(data, SIG_ITEM_ADDED, it); +#endif elm_object_text_set(obj, ""); } - free(str); + free(str); } // handles semicolon, comma (before inserting them to the entry) @@ -742,7 +1491,13 @@ _entry_filter(void *data, ELM_MULTIBUTTONENTRY_DATA_GET(data, sd); if (!*text || !strlen(*text)) return; - if (strcmp(*text, ";") && strcmp(*text, ",")) return; + + // cancels item_be_selected when text inserting is started + if (strcmp(*text, ";") && strcmp(*text, ",")) + { + sd->item_be_selected = EINA_FALSE; + return; + } str = elm_entry_markup_to_utf8(elm_object_text_get(entry)); if (strlen(str)) @@ -753,9 +1508,13 @@ _entry_filter(void *data, if (!it) return; sd->items = eina_list_append(sd->items, it); +#ifdef _VI_EFFECT + _item_adding_effect_add(data, it); +#else elm_box_pack_before(sd->box, VIEW(it), entry); evas_object_show(VIEW(it)); evas_object_smart_callback_call(data, SIG_ITEM_ADDED, it); +#endif elm_object_text_set(entry, ""); } @@ -777,7 +1536,7 @@ _on_entry_key_up(void *data, ELM_MULTIBUTTONENTRY_DATA_GET(data, sd); - // cancels item_be_selected when text inserting is started + // cancels item_be_selected when text inserting is started if (strcmp(ev->keyname, "KP_Enter") && strcmp(ev->keyname, "Return") && strcmp(ev->keyname, "BackSpace") && strcmp(ev->keyname, "Delete") && strcmp(ev->keyname, "semicolon") && strcmp(ev->keyname, "comma")) @@ -797,9 +1556,13 @@ _on_entry_key_up(void *data, if (!it) return; sd->items = eina_list_append(sd->items, it); +#ifdef _VI_EFFECT + _item_adding_effect_add(data, it); +#else elm_box_pack_before(sd->box, VIEW(it), obj); evas_object_show(VIEW(it)); evas_object_smart_callback_call(data, SIG_ITEM_ADDED, it); +#endif elm_object_text_set(obj, ""); } @@ -808,12 +1571,12 @@ _on_entry_key_up(void *data, } // handles delete key -// it can be pressed when button is selected, so it is handled on layout_key_up) +// it can be pressed when button is selected, so it is handled on layout_key_up static void _on_layout_key_up(void *data __UNUSED__, - Evas *e __UNUSED__, - Evas_Object *obj, - void *event_info) + Evas *e __UNUSED__, + Evas_Object *obj, + void *event_info) { char *str; Evas_Event_Key_Up *ev = (Evas_Event_Key_Up *)event_info; @@ -821,7 +1584,7 @@ _on_layout_key_up(void *data __UNUSED__, ELM_MULTIBUTTONENTRY_DATA_GET(obj, sd); if (strcmp(ev->keyname, "BackSpace") && strcmp(ev->keyname, "Delete")) - return; + return; str = elm_entry_markup_to_utf8(elm_object_text_get(sd->entry)); if (strlen(str)) @@ -835,22 +1598,34 @@ _on_layout_key_up(void *data __UNUSED__, if (!sd->selected_item) { - if (sd->item_be_selected) + if (sd->item_be_selected) // 2nd delete { Elm_Multibuttonentry_Item *it; it = eina_list_data_get(eina_list_last(sd->items)); evas_object_focus_set(elm_layout_edje_get(VIEW(it)), EINA_TRUE); } - else - sd->item_be_selected = EINA_TRUE; + else // 1st delete + sd->item_be_selected = EINA_TRUE; } - else + else // 3rd delete { +#ifdef _VI_EFFECT + Elm_Transit *trans; + Evas_Object *rect; + + trans = (Elm_Transit *)evas_object_data_get(VIEW(sd->selected_item), "transit"); + rect = (Evas_Object *)evas_object_data_get(VIEW(sd->selected_item), "effect_rect"); + + if (!trans && !rect) + _item_deleting_effect_add + (obj, (Elm_Multibuttonentry_Item *)sd->selected_item); +#else elm_object_item_del(sd->selected_item); if (sd->editable) - elm_object_focus_set(sd->entry, EINA_TRUE); + elm_object_focus_set(sd->entry, EINA_TRUE); +#endif } } @@ -889,11 +1664,11 @@ _elm_multibuttonentry_smart_on_focus(Evas_Object *obj) } // when object gets focused, it should be expanded layout else if (!sd->expanded) - _layout_expand(obj); + _layout_expand(obj); if (sd->editable) { - elm_layout_signal_emit(obj, "elm,state,event,allow", "elm"); + elm_layout_signal_emit(obj, "elm,state,event,allow", ""); elm_object_focus_set(sd->entry, EINA_TRUE); } @@ -912,17 +1687,16 @@ _elm_multibuttonentry_smart_on_focus(Evas_Object *obj) elm_box_pack_end(sd->box, sd->guide); evas_object_show(sd->guide); } - // if shrinked mode was set, it goes back to shrinked layout + // if shrinked mode was set, it goes back to shrinked layout else if (!sd->expanded) - _layout_shrink(obj, EINA_FALSE); + _layout_shrink(obj, EINA_FALSE); if (sd->editable) - elm_layout_signal_emit(obj, "elm,state,event,block", "elm"); - + elm_layout_signal_emit(obj, "elm,state,event,block", ""); if (sd->selected_item) - evas_object_focus_set - (elm_layout_edje_get(VIEW(sd->selected_item)), EINA_FALSE); + evas_object_focus_set + (elm_layout_edje_get(VIEW(sd->selected_item)), EINA_FALSE); evas_object_smart_callback_call(obj, SIG_UNFOCUSED, NULL); } @@ -955,12 +1729,27 @@ _elm_multibuttonentry_smart_text_get(const Evas_Object *obj, ELM_MULTIBUTTONENTRY_DATA_GET(obj, sd); if (!part || !strcmp(part, "label")) - return elm_object_text_get(sd->label); + return elm_object_part_text_get(sd->label, "mbe.label"); else if (!strcmp(part, "guide")) - return elm_object_text_get(sd->guide); + return elm_object_text_get(sd->guide); else return _elm_multibuttonentry_parent_sc->text_get(obj, part); } +static void +_elm_multibuttonentry_smart_sizing_eval(Evas_Object *obj) +{ + Evas_Coord minw = -1, minh = -1, maxw = -1, maxh = -1; + + ELM_MULTIBUTTONENTRY_DATA_GET(obj, sd); + + elm_coords_finger_size_adjust(1, &minw, 1, &minh); + edje_object_size_min_restricted_calc + (ELM_WIDGET_DATA(sd)->resize_obj, &minw, &minh, minw, minh); + elm_coords_finger_size_adjust(1, &minw, 1, &minh); + evas_object_size_hint_min_set(obj, minw, minh); + evas_object_size_hint_max_set(obj, maxw, maxh); +} + static Eina_Bool _elm_multibuttonentry_smart_theme(Evas_Object *obj) { @@ -986,12 +1775,12 @@ _elm_multibuttonentry_smart_theme(Evas_Object *obj) elm_layout_theme_set (sd->label, "multibuttonentry", "label", elm_widget_style_get(obj)); elm_layout_theme_set - (sd->guide, "multibuttonentry", "guide", elm_widget_style_get(obj)); + (sd->guide, "multibuttonentry", "guidetext", elm_widget_style_get(obj)); elm_layout_theme_set - (sd->number, "multibuttonentry", "number", elm_widget_style_get(obj)); + (sd->end, "multibuttonentry", "number", elm_widget_style_get(obj)); EINA_LIST_FOREACH(sd->items, l, it) elm_layout_theme_set - (VIEW(it), "multibuttonentry", "button", elm_widget_style_get(obj)); + (VIEW(it), "multibuttonentry", "btn", elm_widget_style_get(obj)); elm_layout_sizing_eval(obj); @@ -1008,11 +1797,11 @@ _elm_multibuttonentry_smart_add(Evas_Object *obj) ELM_WIDGET_CLASS(_elm_multibuttonentry_parent_sc)->base.add(obj); elm_layout_theme_set - (obj, "multibuttonentry", "base", elm_widget_style_get(obj)); + (obj, "multibuttonentry", "base", elm_widget_style_get(obj)); elm_layout_signal_callback_add (obj, "elm,action,clicked", "", _on_layout_clicked, NULL); evas_object_event_callback_add - (obj, EVAS_CALLBACK_KEY_UP, _on_layout_key_up, NULL); + (obj, EVAS_CALLBACK_KEY_UP, _on_layout_key_up, NULL); priv->box = elm_box_add(obj); str = elm_layout_data_get(obj, "horizontal_pad"); @@ -1023,8 +1812,8 @@ _elm_multibuttonentry_smart_add(Evas_Object *obj) (priv->box, hpad * elm_widget_scale_get(obj) * elm_config_scale_get(), vpad * elm_widget_scale_get(obj) * elm_config_scale_get()); - elm_box_layout_set(priv->box, _box_layout, obj, NULL); - elm_layout_content_set(obj, "elm.swallow.box", priv->box); + elm_box_layout_set(priv->box, _box_layout, NULL, NULL); + elm_layout_content_set(obj, "box.swallow", priv->box); evas_object_event_callback_add (priv->box, EVAS_CALLBACK_RESIZE, _on_box_resize, obj); @@ -1053,9 +1842,9 @@ _elm_multibuttonentry_smart_add(Evas_Object *obj) // ACCESS _elm_access_object_register(obj, ELM_WIDGET_DATA(priv)->resize_obj); _elm_access_text_set - (_elm_access_object_get(obj), ELM_ACCESS_TYPE, E_("multi button entry")); + (_elm_access_object_get(obj), ELM_ACCESS_TYPE, E_("multi button entry")); _elm_access_callback_set - (_elm_access_object_get(obj), ELM_ACCESS_INFO, _access_info_cb, NULL); + (_elm_access_object_get(obj), ELM_ACCESS_INFO, _access_info_cb, NULL); #endif } @@ -1067,22 +1856,63 @@ _elm_multibuttonentry_smart_del(Evas_Object *obj) ELM_MULTIBUTTONENTRY_DATA_GET(obj, sd); +#ifdef _VI_EFFECT + EINA_LIST_FREE(sd->items, it) + { + Elm_Transit *trans; + Evas_Object *rect; + + trans = (Elm_Transit *)evas_object_data_get(VIEW(it), "transit"); + if (trans) + { + elm_transit_del_cb_set(trans, NULL, NULL); + elm_transit_del(trans); + } + + rect = (Evas_Object *)evas_object_data_get(VIEW(it), "effect_rect"); + if (rect) + { + Ecore_Animator *anim; + anim = (Ecore_Animator*)evas_object_data_get(rect, "animator"); + if (anim) ecore_animator_del(anim); + + evas_object_del(rect); + evas_object_data_set(VIEW(it), "effect_rect", NULL); + } + elm_widget_item_free(it); + } +#else EINA_LIST_FREE(sd->items, it) elm_widget_item_free(it); +#endif EINA_LIST_FREE(sd->filters, ft) free(ft); - if (sd->number) evas_object_del(sd->number); + if (sd->end) evas_object_del(sd->end); if (sd->guide) evas_object_del(sd->guide); if (sd->label) evas_object_del(sd->label); if (sd->entry) evas_object_del(sd->entry); if (sd->box) evas_object_del(sd->box); + if (sd->longpress_timer) ecore_timer_del(sd->longpress_timer); ELM_WIDGET_CLASS(_elm_multibuttonentry_parent_sc)->base.del(obj); } static void +_elm_multibuttonentry_smart_access(Evas_Object *obj, Eina_Bool is_access) +{ + Eina_List *elist = NULL; + Elm_Multibuttonentry_Item *it; + + ELM_MULTIBUTTONENTRY_CHECK(obj); + ELM_MULTIBUTTONENTRY_DATA_GET(obj, sd); + + EINA_LIST_FOREACH(sd->items, elist, it) + _access_widget_item_register(it, is_access); +} + +static void _elm_multibuttonentry_smart_set_user(Elm_Multibuttonentry_Smart_Class *sc) { ELM_WIDGET_CLASS(sc)->base.add = _elm_multibuttonentry_smart_add; @@ -1098,11 +1928,13 @@ _elm_multibuttonentry_smart_set_user(Elm_Multibuttonentry_Smart_Class *sc) ELM_LAYOUT_CLASS(sc)->text_set = _elm_multibuttonentry_smart_text_set; ELM_LAYOUT_CLASS(sc)->text_get = _elm_multibuttonentry_smart_text_get; + ELM_LAYOUT_CLASS(sc)->sizing_eval = _elm_multibuttonentry_smart_sizing_eval; + // ACCESS -// if (_elm_config->access_mode != ELM_ACCESS_MODE_OFF) -// ELM_WIDGET_CLASS(sc)->focus_next = _elm_multibuttonentry_smart_focus_next; + if (_elm_config->access_mode) + ELM_WIDGET_CLASS(sc)->focus_next = _elm_multibuttonentry_smart_focus_next; -// ELM_WIDGET_CLASS(sc)->access = _elm_multibuttonentry_smart_access; + ELM_WIDGET_CLASS(sc)->access = _elm_multibuttonentry_smart_access; } EAPI const Elm_Multibuttonentry_Smart_Class * @@ -1134,7 +1966,7 @@ elm_multibuttonentry_add(Evas_Object *parent) if (!obj) return NULL; if (!elm_widget_sub_object_add(parent, obj)) - ERR("could not add %p as sub object of %p", obj, parent); + ERR("could not add %p as sub object of %p", obj, parent); return obj; } @@ -1162,9 +1994,9 @@ elm_multibuttonentry_expanded_set(Evas_Object *obj, if (elm_object_focus_get(obj)) return; if (sd->expanded) - _layout_expand(obj); + _layout_expand(obj); else - _layout_shrink(obj, EINA_FALSE); + _layout_shrink(obj, EINA_FALSE); } EAPI Eina_Bool @@ -1196,7 +2028,7 @@ elm_multibuttonentry_editable_set(Evas_Object *obj, } if (!elm_object_focus_get(obj)) - elm_layout_signal_emit(obj, "elm,state,event,block", "elm"); + elm_layout_signal_emit(obj, "elm,state,event,block", ""); } else { @@ -1207,7 +2039,7 @@ elm_multibuttonentry_editable_set(Evas_Object *obj, } if (!elm_object_focus_get(obj)) - elm_layout_signal_emit(obj, "elm,state,event,allow", "elm"); + elm_layout_signal_emit(obj, "elm,state,event,allow", ""); } } @@ -1251,18 +2083,41 @@ elm_multibuttonentry_item_prepend(Evas_Object *obj, sd->items = eina_list_prepend(sd->items, it); - if (!elm_object_focus_get(obj) && !sd->expanded) - _layout_shrink(obj, EINA_TRUE); + if (!elm_object_focus_get(obj) && !sd->expanded && sd->boxw) + { +#ifdef _VI_EFFECT + _item_adding_effect_add(obj, it); +#endif + _layout_shrink(obj, EINA_TRUE); + } else { +#ifdef _VI_EFFECT + if (sd->boxh && sd->boxw) + _item_adding_effect_add(obj, it); + else + { + if (sd->label && _label_packed(obj)) + elm_box_pack_after(sd->box, VIEW(it), sd->label); + else + elm_box_pack_start(sd->box, VIEW(it)); + evas_object_show(VIEW(it)); + } +#else if (sd->label && _label_packed(obj)) - elm_box_pack_after(sd->box, VIEW(it), sd->label); + elm_box_pack_after(sd->box, VIEW(it), sd->label); else - elm_box_pack_start(sd->box, VIEW(it)); + elm_box_pack_start(sd->box, VIEW(it)); evas_object_show(VIEW(it)); +#endif } +#ifdef _VI_EFFECT + if (!sd->boxh || !sd->boxw) + evas_object_smart_callback_call(obj, SIG_ITEM_ADDED, it); +#else evas_object_smart_callback_call(obj, SIG_ITEM_ADDED, it); +#endif return (Elm_Object_Item *)it; } @@ -1298,18 +2153,41 @@ elm_multibuttonentry_item_append(Evas_Object *obj, sd->items = eina_list_append(sd->items, it); - if (!elm_object_focus_get(obj) && !sd->expanded) - _layout_shrink(obj, EINA_TRUE); + if (!elm_object_focus_get(obj) && !sd->expanded && sd->boxw) + { +#ifdef _VI_EFFECT + _item_adding_effect_add(obj, it); +#endif + _layout_shrink(obj, EINA_TRUE); + } else { +#ifdef _VI_EFFECT + if (sd->boxh && sd->boxw) + _item_adding_effect_add(obj, it); + else + { + if (sd->editable) + elm_box_pack_before(sd->box, VIEW(it), sd->entry); + else + elm_box_pack_end(sd->box, VIEW(it)); + evas_object_show(VIEW(it)); + } +#else if (sd->editable) - elm_box_pack_before(sd->box, VIEW(it), sd->entry); + elm_box_pack_before(sd->box, VIEW(it), sd->entry); else - elm_box_pack_end(sd->box, VIEW(it)); + elm_box_pack_end(sd->box, VIEW(it)); evas_object_show(VIEW(it)); +#endif } +#ifdef _VI_EFFECT + if (!sd->boxh || !sd->boxw) + evas_object_smart_callback_call(obj, SIG_ITEM_ADDED, it); +#else evas_object_smart_callback_call(obj, SIG_ITEM_ADDED, it); +#endif return (Elm_Object_Item *)it; } @@ -1334,15 +2212,35 @@ elm_multibuttonentry_item_insert_before(Evas_Object *obj, sd->items = eina_list_prepend_relative(sd->items, it, before); - if (!elm_object_focus_get(obj) && !sd->expanded) - _layout_shrink(obj, EINA_TRUE); + if (!elm_object_focus_get(obj) && !sd->expanded && sd->boxw) + { +#ifdef _VI_EFFECT + _item_adding_effect_add(obj, it); +#endif + _layout_shrink(obj, EINA_TRUE); + } else { +#ifdef _VI_EFFECT + if (sd->boxh && sd->boxw) + _item_adding_effect_add(obj, it); + else + { + elm_box_pack_before(sd->box, VIEW(it), VIEW(before)); + evas_object_show(VIEW(it)); + } +#else elm_box_pack_before(sd->box, VIEW(it), VIEW(before)); evas_object_show(VIEW(it)); +#endif } +#ifdef _VI_EFFECT + if (!sd->boxh || !sd->boxw) + evas_object_smart_callback_call(obj, SIG_ITEM_ADDED, it); +#else evas_object_smart_callback_call(obj, SIG_ITEM_ADDED, it); +#endif return (Elm_Object_Item *)it; } @@ -1367,15 +2265,35 @@ elm_multibuttonentry_item_insert_after(Evas_Object *obj, sd->items = eina_list_append_relative(sd->items, it, after); - if (!elm_object_focus_get(obj) && !sd->expanded) - _layout_shrink(obj, EINA_TRUE); + if (!elm_object_focus_get(obj) && !sd->expanded && sd->boxw) + { +#ifdef _VI_EFFECT + _item_adding_effect_add(obj, it); +#endif + _layout_shrink(obj, EINA_TRUE); + } else { +#ifdef _VI_EFFECT + if (sd->boxw && sd->boxh) + _item_adding_effect_add(obj, it); + else + { + elm_box_pack_after(sd->box, VIEW(it), VIEW(after)); + evas_object_show(VIEW(it)); + } +#else elm_box_pack_after(sd->box, VIEW(it), VIEW(after)); evas_object_show(VIEW(it)); +#endif } +#ifdef _VI_EFFECT + if (!sd->boxh || !sd->boxw) + evas_object_smart_callback_call(obj, SIG_ITEM_ADDED, it); +#else evas_object_smart_callback_call(obj, SIG_ITEM_ADDED, it); +#endif return (Elm_Object_Item *)it; } @@ -1389,6 +2307,14 @@ elm_multibuttonentry_items_get(const Evas_Object *obj) return sd->items; } +EAPI Evas_Object * +elm_multibuttonentry_item_object_get(const Elm_Object_Item *it) +{ + ELM_MULTIBUTTONENTRY_ITEM_CHECK_OR_RETURN(it); + + return VIEW(it); +} + EAPI Elm_Object_Item * elm_multibuttonentry_first_item_get(const Evas_Object *obj) { @@ -1434,7 +2360,7 @@ elm_multibuttonentry_item_selected_set(Elm_Object_Item *it, evas_object_focus_set(elm_layout_edje_get(VIEW(it)), EINA_FALSE); if (sd->editable) - elm_object_focus_set(sd->entry, EINA_TRUE); + elm_object_focus_set(sd->entry, EINA_TRUE); } } @@ -1447,7 +2373,7 @@ elm_multibuttonentry_item_selected_get(const Elm_Object_Item *it) if (!elm_object_focus_get(WIDGET(it))) return EINA_FALSE; if (it == sd->selected_item) - return EINA_TRUE; + return EINA_TRUE; return EINA_FALSE; } @@ -1460,17 +2386,53 @@ elm_multibuttonentry_clear(Evas_Object *obj) ELM_MULTIBUTTONENTRY_CHECK(obj); ELM_MULTIBUTTONENTRY_DATA_GET(obj, sd); +#ifdef _VI_EFFECT + EINA_LIST_FREE(sd->items, it) + { + Elm_Transit *trans; + Evas_Object *rect; + + trans = (Elm_Transit *)evas_object_data_get(VIEW(it), "transit"); + if (trans) + { + elm_transit_del_cb_set(trans, NULL, NULL); + elm_transit_del(trans); + } + + rect = (Evas_Object *)evas_object_data_get(VIEW(it), "effect_rect"); + if (rect) + { + Ecore_Animator *anim; + + anim = (Ecore_Animator*)evas_object_data_get(rect, "animator"); + if (anim) ecore_animator_del(anim); + + evas_object_del(rect); + evas_object_data_set(VIEW(it), "effect_rect", NULL); + + if (sd->editable) + { + elm_box_pack_end(sd->box, sd->entry); + evas_object_show(sd->entry); + if (elm_object_focus_get(WIDGET(it))) + elm_object_focus_set(sd->entry, EINA_TRUE); + } + } + elm_widget_item_free(it); + } +#else EINA_LIST_FREE(sd->items, it) elm_widget_item_free(it); +#endif sd->items = NULL; sd->item_be_selected = EINA_FALSE; sd->expanded_state = EINA_TRUE; - if (sd->number) + if (sd->end) { - evas_object_del(sd->number); - sd->number = NULL; + evas_object_del(sd->end); + sd->end = NULL; } if (!sd->items && !elm_object_focus_get(obj) && diff --git a/src/lib/elc_multibuttonentry.h b/src/lib/elc_multibuttonentry.h index 1cd158c..07fb69e 100644 --- a/src/lib/elc_multibuttonentry.h +++ b/src/lib/elc_multibuttonentry.h @@ -38,6 +38,7 @@ * - @c "contracted" - when multi-button entry is contracted. * - @c "expand,state,changed" - when shrink mode state of * multi-button entry is changed. + * - @c "longpressed" - when multi-button entry is pressed for a long time. * * Default text parts of the multi-button entry widget that you can use are: * @li "default" - A label of the multi-button entry @@ -192,6 +193,18 @@ EAPI Elm_Object_Item *elm_multibuttonentry_item_insert_after(Evas_Object *obj, E EAPI const Eina_List *elm_multibuttonentry_items_get(const Evas_Object *obj); /** + * Gets the base object of the item. + * + * @param it The multibuttonentry item + * @return The base object associated with @p item + * + * Base object is the @c Evas_Object that represents that item. + * + * @ingroup List + */ +EAPI Evas_Object *elm_multibuttonentry_item_object_get(const Elm_Object_Item *it); + +/** * Get the first item in the multibuttonentry * * @param obj The multibuttonentry object diff --git a/src/lib/elc_naviframe.c b/src/lib/elc_naviframe.c index e16a662..3a50661 100644 --- a/src/lib/elc_naviframe.c +++ b/src/lib/elc_naviframe.c @@ -8,6 +8,9 @@ static const char CONTENT_PART[] = "elm.swallow.content"; static const char PREV_BTN_PART[] = "elm.swallow.prev_btn"; static const char NEXT_BTN_PART[] = "elm.swallow.next_btn"; static const char ICON_PART[] = "elm.swallow.icon"; +static const char TITLE_PART[] = "elm.text.title"; +static const char SUBTITLE_PART[] = "elm.text.subtitle"; +static const char TITLE_ACCESS_PART[] = "access.title"; static const char SIG_TRANSITION_FINISHED[] = "transition,finished"; static const char SIG_TITLE_CLICKED[] = "title,clicked"; @@ -21,6 +24,8 @@ EVAS_SMART_SUBCLASS_NEW (ELM_NAVIFRAME_SMART_NAME, _elm_naviframe, Elm_Naviframe_Smart_Class, Elm_Layout_Smart_Class, elm_layout_smart_class_get, _smart_callbacks); +static const char SIG_CLICKED[] = "clicked"; + static void _item_content_del_cb(void *data, Evas *e __UNUSED__, @@ -30,7 +35,7 @@ _item_content_del_cb(void *data, Elm_Naviframe_Item *it = data; it->content = NULL; - edje_object_signal_emit(VIEW(it), "elm,state,content,hide", "elm"); + elm_object_signal_emit(VIEW(it), "elm,state,content,hide", "elm"); } static void @@ -42,7 +47,7 @@ _item_title_prev_btn_del_cb(void *data, Elm_Naviframe_Item *it = data; it->title_prev_btn = NULL; - edje_object_signal_emit(VIEW(it), "elm,state,prev_btn,hide", "elm"); + elm_object_signal_emit(VIEW(it), "elm,state,prev_btn,hide", "elm"); } static void @@ -54,7 +59,7 @@ _item_title_next_btn_del_cb(void *data, Elm_Naviframe_Item *it = data; it->title_next_btn = NULL; - edje_object_signal_emit(VIEW(it), "elm,state,next_btn,hide", "elm"); + elm_object_signal_emit(VIEW(it), "elm,state,next_btn,hide", "elm"); } static void @@ -66,7 +71,7 @@ _item_title_icon_del_cb(void *data, Elm_Naviframe_Item *it = data; it->title_icon = NULL; - edje_object_signal_emit(VIEW(it), "elm,state,icon,hide", "elm"); + elm_object_signal_emit(VIEW(it), "elm,state,icon,hide", "elm"); } static void @@ -79,7 +84,7 @@ _title_content_del(void *data, Elm_Naviframe_Content_Item_Pair *pair = data; Elm_Naviframe_Item *it = pair->it; snprintf(buf, sizeof(buf), "elm,state,%s,hide", pair->part); - edje_object_signal_emit(VIEW(it), buf, "elm"); + elm_object_signal_emit(VIEW(it), buf, "elm"); it->content_list = eina_inlist_remove(it->content_list, EINA_INLIST_GET(pair)); eina_stringshare_del(pair->part); @@ -99,10 +104,6 @@ _item_free(Elm_Naviframe_Item *it) eina_stringshare_del(it->title_label); eina_stringshare_del(it->subtitle_label); - if (it->title_prev_btn) evas_object_del(it->title_prev_btn); - if (it->title_next_btn) evas_object_del(it->title_next_btn); - if (it->title_icon) evas_object_del(it->title_icon); - EINA_INLIST_FOREACH_SAFE(it->content_list, l, content_pair) { if (content_pair->content) @@ -127,12 +128,10 @@ _item_free(Elm_Naviframe_Item *it) { /* so that elm does not delete the contents with the item's * view after the del_pre_hook */ - edje_object_part_unswallow(VIEW(it), it->content); + elm_object_part_content_unset(VIEW(it), CONTENT_PART); evas_object_event_callback_del (it->content, EVAS_CALLBACK_DEL, _item_content_del_cb); } - else - evas_object_del(it->content); } } @@ -143,26 +142,26 @@ _item_content_signals_emit(Elm_Naviframe_Item *it) char buf[1024]; //content if (it->content) - edje_object_signal_emit(VIEW(it), "elm,state,content,show", "elm"); + elm_object_signal_emit(VIEW(it), "elm,state,content,show", "elm"); else - edje_object_signal_emit(VIEW(it), "elm,state,content,hide", "elm"); + elm_object_signal_emit(VIEW(it), "elm,state,content,hide", "elm"); //prev button if (it->title_prev_btn) - edje_object_signal_emit(VIEW(it), "elm,state,prev_btn,show", "elm"); + elm_object_signal_emit(VIEW(it), "elm,state,prev_btn,show", "elm"); else - edje_object_signal_emit(VIEW(it), "elm,state,prev_btn,hide", "elm"); + elm_object_signal_emit(VIEW(it), "elm,state,prev_btn,hide", "elm"); //next button if (it->title_next_btn) - edje_object_signal_emit(VIEW(it), "elm,state,next_btn,show", "elm"); + elm_object_signal_emit(VIEW(it), "elm,state,next_btn,show", "elm"); else - edje_object_signal_emit(VIEW(it), "elm,state,next_btn,hide", "elm"); + elm_object_signal_emit(VIEW(it), "elm,state,next_btn,hide", "elm"); if (it->title_icon) - edje_object_signal_emit(VIEW(it), "elm,state,icon,show", "elm"); + elm_object_signal_emit(VIEW(it), "elm,state,icon,show", "elm"); else - edje_object_signal_emit(VIEW(it), "elm,state,icon,hide", "elm"); + elm_object_signal_emit(VIEW(it), "elm,state,icon,hide", "elm"); EINA_INLIST_FOREACH(it->content_list, content_pair) { @@ -170,7 +169,7 @@ _item_content_signals_emit(Elm_Naviframe_Item *it) snprintf(buf, sizeof(buf), "elm,state,%s,show", content_pair->part); else snprintf(buf, sizeof(buf), "elm,state,%s,hide", content_pair->part); - edje_object_signal_emit(VIEW(it), buf, "elm"); + elm_object_signal_emit(VIEW(it), buf, "elm"); } } @@ -181,22 +180,22 @@ _item_text_signals_emit(Elm_Naviframe_Item *it) char buf[1024]; if ((it->title_label) && (it->title_label[0])) - edje_object_signal_emit(VIEW(it), "elm,state,title_label,show", "elm"); + elm_object_signal_emit(VIEW(it), "elm,state,title_label,show", "elm"); else - edje_object_signal_emit(VIEW(it), "elm,state,title_label,hide", "elm"); + elm_object_signal_emit(VIEW(it), "elm,state,title_label,hide", "elm"); if ((it->subtitle_label) && (it->subtitle_label[0])) - edje_object_signal_emit(VIEW(it), "elm,state,subtitle,show", "elm"); + elm_object_signal_emit(VIEW(it), "elm,state,subtitle,show", "elm"); else - edje_object_signal_emit(VIEW(it), "elm,state,subtitle,hide", "elm"); + elm_object_signal_emit(VIEW(it), "elm,state,subtitle,hide", "elm"); EINA_INLIST_FOREACH(it->text_list, text_pair) { - if (edje_object_part_text_get(VIEW(it), text_pair->part)) + if (elm_object_part_text_get(VIEW(it), text_pair->part)) snprintf(buf, sizeof(buf), "elm,state,%s,show", text_pair->part); else snprintf(buf, sizeof(buf), "elm,state,%s,hide", text_pair->part); - edje_object_signal_emit(VIEW(it), buf, "elm"); + elm_object_signal_emit(VIEW(it), buf, "elm"); } } @@ -205,9 +204,8 @@ _access_object_get(Elm_Naviframe_Item *it, const char* part) { Evas_Object *po, *ao; - if (!edje_object_part_text_get(VIEW(it), part)) return NULL; - - po = (Evas_Object *)edje_object_part_object_get(VIEW(it), part); + po = (Evas_Object *)edje_object_part_object_get + (elm_layout_edje_get(VIEW(it)), part); ao = evas_object_data_get(po, "_part_access_obj"); return ao; @@ -224,7 +222,7 @@ _access_focus_set(Elm_Naviframe_Item *it) return; } - ao =_access_object_get(it, "elm.text.title"); + ao =_access_object_get(it, TITLE_ACCESS_PART); if (ao) elm_object_focus_set(ao, EINA_TRUE); else if ((it->title_icon) && (elm_widget_can_focus_get(it->title_icon) || @@ -260,8 +258,8 @@ _item_style_set(Elm_Naviframe_Item *it, eina_stringshare_replace(&it->style, item_style); } - elm_widget_theme_object_set - (WIDGET(it), VIEW(it), "naviframe", buf, elm_widget_style_get(WIDGET(it))); + elm_layout_theme_set(VIEW(it), "naviframe", buf, + elm_widget_style_get(WIDGET(it))); if (sd->freeze_events) evas_object_freeze_events_set(VIEW(it), EINA_FALSE); @@ -274,27 +272,34 @@ _item_title_visible_update(Elm_Naviframe_Item *nit) if (_elm_config->access_mode) _access_focus_set(nit); if (nit->title_visible) - edje_object_signal_emit(VIEW(nit), "elm,state,title,show", "elm"); + elm_object_signal_emit(VIEW(nit), "elm,state,title,show", "elm"); else - edje_object_signal_emit(VIEW(nit), "elm,state,title,hide", "elm"); - edje_object_message_signal_process(VIEW(nit)); + elm_object_signal_emit(VIEW(nit), "elm,state,title,hide", "elm"); } static Eina_Bool _elm_naviframe_smart_theme(Evas_Object *obj) { Elm_Naviframe_Item *it; + const char *style, *sstyle; ELM_NAVIFRAME_DATA_GET(obj, sd); - if (!ELM_WIDGET_CLASS(_elm_naviframe_parent_sc)->theme(obj)) - return EINA_FALSE; + style = elm_widget_style_get(obj); EINA_INLIST_FOREACH(sd->stack, it) { - _item_style_set(it, it->style); - _item_signals_emit(it); - _item_title_visible_update(it); + /* FIXME: Need to merge with opensource later. smart_theme() is called + multiple timese since the elm_widget.c is inefficient. If the + elm_widget is merged with the latest opensouce, it's ok to sync with + opensource here also */ + sstyle = elm_widget_style_get(VIEW(it)); + if ((style && sstyle) && strcmp(style, sstyle)) + { + _item_style_set(it, it->style); + _item_signals_emit(it); + _item_title_visible_update(it); + } } elm_layout_sizing_eval(obj); @@ -302,54 +307,63 @@ _elm_naviframe_smart_theme(Evas_Object *obj) return EINA_TRUE; } +static char * +_access_info_cb(void *data, Evas_Object *obj __UNUSED__) +{ + Evas_Object *layout; + Eina_Strbuf *buf; + const char *info; + char *ret; + + layout = (Evas_Object *)data; + info = elm_object_part_text_get(layout, TITLE_PART); + if (!info) return NULL; + + buf = eina_strbuf_new(); + eina_strbuf_append(buf, info); + + info = elm_object_part_text_get(layout, SUBTITLE_PART); + if (!info) goto end; + + eina_strbuf_append_printf(buf, ", %s", info); + +end: + ret = eina_strbuf_string_steal(buf); + eina_strbuf_free(buf); + return ret; +} + static void _access_obj_process(Elm_Naviframe_Item *it, Eina_Bool is_access) { - Evas_Object *ao; - Elm_Naviframe_Text_Item_Pair *pair; + Evas_Object *ao, *eo; if (is_access) { - if (!_access_object_get(it, "elm.text.title")) + if (!_access_object_get(it, TITLE_ACCESS_PART)) { - ao =_elm_access_edje_object_part_object_register - (WIDGET(it), VIEW(it), "elm.text.title"); + eo = elm_layout_edje_get(VIEW(it)); + ao =_elm_access_edje_object_part_object_register(WIDGET(it), eo, + TITLE_ACCESS_PART); _elm_access_text_set(_elm_access_object_get(ao), ELM_ACCESS_TYPE, E_("title")); - } + _elm_access_callback_set(_elm_access_object_get(ao), + ELM_ACCESS_INFO, _access_info_cb, VIEW(it)); - if (!_access_object_get(it, "elm.text.subtitle")) - { - ao =_elm_access_edje_object_part_object_register - (WIDGET(it), VIEW(it), "elm.text.subtitle"); - _elm_access_text_set(_elm_access_object_get(ao), - ELM_ACCESS_TYPE, E_("sub title")); - } - - EINA_INLIST_FOREACH(it->text_list, pair) - { - if (!_access_object_get(it, pair->part)) - { - ao = _elm_access_edje_object_part_object_register - (WIDGET(it), VIEW(it), pair->part); - _elm_access_text_set(_elm_access_object_get(ao), - ELM_ACCESS_TYPE, E_(pair->part)); - } - } + /* to access title access object, any idea? */ + ((Elm_Widget_Item *)it)->access_obj = ao; + } } else { if (it->title_label) _elm_access_edje_object_part_object_unregister - (WIDGET(it), VIEW(it), "elm.text.title"); - - if (it->subtitle_label) - _elm_access_edje_object_part_object_unregister - (WIDGET(it), VIEW(it), "elm.text.subtitle"); + (WIDGET(it), elm_layout_edje_get(VIEW(it)), TITLE_ACCESS_PART); - EINA_INLIST_FOREACH(it->text_list, pair) - _elm_access_edje_object_part_object_unregister - (WIDGET(it), VIEW(it), pair->part); + /* to access title access object, any idea? */ + ao = ((Elm_Widget_Item *)it)->access_obj; + if (!ao) return; + evas_object_del(ao); } } @@ -363,31 +377,28 @@ _item_text_set_hook(Elm_Object_Item *it, char buf[1024]; if ((!part) || (!strcmp(part, "default")) || - (!strcmp(part, "elm.text.title"))) + (!strcmp(part, TITLE_PART))) { eina_stringshare_replace(&nit->title_label, label); - snprintf(buf, sizeof(buf), "elm.text.title"); if (label) - edje_object_signal_emit(VIEW(it), "elm,state,title_label,show", "elm"); + elm_object_signal_emit(VIEW(it), "elm,state,title_label,show", "elm"); else - edje_object_signal_emit(VIEW(it), "elm,state,title_label,hide", "elm"); - edje_object_part_text_set(VIEW(it), buf, label); + elm_object_signal_emit(VIEW(it), "elm,state,title_label,hide", "elm"); + elm_object_part_text_set(VIEW(it), TITLE_PART, label); } else if (!strcmp("subtitle", part)) { eina_stringshare_replace(&nit->subtitle_label, label); - snprintf(buf, sizeof(buf), "elm.text.subtitle"); if (label) - edje_object_signal_emit(VIEW(it), "elm,state,subtitle,show", "elm"); + elm_object_signal_emit(VIEW(it), "elm,state,subtitle,show", "elm"); else - edje_object_signal_emit(VIEW(it), "elm,state,subtitle,hide", "elm"); - edje_object_part_text_set(VIEW(it), buf, label); + elm_object_signal_emit(VIEW(it), "elm,state,subtitle,hide", "elm"); + elm_object_part_text_set(VIEW(it), SUBTITLE_PART, label); } else { - snprintf(buf, sizeof(buf), "%s", part); EINA_INLIST_FOREACH(nit->text_list, pair) - if (!strcmp(buf, pair->part)) break; + if (!strcmp(part, pair->part)) break; if (!pair) { @@ -398,7 +409,7 @@ _item_text_set_hook(Elm_Object_Item *it, WIDGET(it)); return; } - eina_stringshare_replace(&pair->part, buf); + eina_stringshare_replace(&pair->part, part); nit->text_list = eina_inlist_append(nit->text_list, EINA_INLIST_GET(pair)); } @@ -406,8 +417,8 @@ _item_text_set_hook(Elm_Object_Item *it, snprintf(buf, sizeof(buf), "elm,state,%s,show", part); else snprintf(buf, sizeof(buf), "elm,state,%s,hide", part); - edje_object_signal_emit(VIEW(it), buf, "elm"); - edje_object_part_text_set(VIEW(it), part, label); + elm_object_signal_emit(VIEW(it), buf, "elm"); + elm_object_part_text_set(VIEW(it), part, label); } /* access */ @@ -424,13 +435,13 @@ _item_text_get_hook(const Elm_Object_Item *it, char buf[1024]; if (!part || !strcmp(part, "default")) - snprintf(buf, sizeof(buf), "elm.text.title"); + snprintf(buf, sizeof(buf), TITLE_PART); else if (!strcmp("subtitle", part)) - snprintf(buf, sizeof(buf), "elm.text.subtitle"); + snprintf(buf, sizeof(buf), SUBTITLE_PART); else snprintf(buf, sizeof(buf), "%s", part); - return edje_object_part_text_get(VIEW(it), buf); + return elm_object_part_text_get(VIEW(it), buf); } static Eina_Bool @@ -442,9 +453,6 @@ _item_del_pre_hook(Elm_Object_Item *it) nit = (Elm_Naviframe_Item *)it; ELM_NAVIFRAME_DATA_GET(WIDGET(nit), sd); - if (it == sd->compress_it) - sd->compress_it = NULL; - if (nit->animator) ecore_animator_del(nit->animator); top = (it == elm_naviframe_top_item_get(WIDGET(nit))); @@ -477,8 +485,7 @@ _item_del_pre_hook(Elm_Object_Item *it) evas_object_show(VIEW(prev_it)); evas_object_raise(VIEW(prev_it)); - edje_object_signal_emit(VIEW(prev_it), "elm,state,visible", "elm"); - edje_object_message_signal_process(VIEW(prev_it)); + elm_object_signal_emit(VIEW(prev_it), "elm,state,visible", "elm"); } end: @@ -499,12 +506,11 @@ _item_content_set(Elm_Naviframe_Item *it, if (!content) return; - edje_object_part_swallow(VIEW(it), CONTENT_PART, content); - edje_object_signal_emit(VIEW(it), "elm,state,content,show", "elm"); + elm_object_part_content_set(VIEW(it), CONTENT_PART, content); + elm_object_signal_emit(VIEW(it), "elm,state,content,show", "elm"); evas_object_event_callback_add (content, EVAS_CALLBACK_DEL, _item_content_del_cb, it); - elm_widget_sub_object_add(WIDGET(it), content); } static void @@ -516,8 +522,8 @@ _item_title_prev_btn_set(Elm_Naviframe_Item *it, it->title_prev_btn = btn; if (!btn) return; - edje_object_part_swallow(VIEW(it), PREV_BTN_PART, btn); - edje_object_signal_emit(VIEW(it), "elm,state,prev_btn,show", "elm"); + elm_object_part_content_set(VIEW(it), PREV_BTN_PART, btn); + elm_object_signal_emit(VIEW(it), "elm,state,prev_btn,show", "elm"); evas_object_event_callback_add (btn, EVAS_CALLBACK_DEL, _item_title_prev_btn_del_cb, it); } @@ -531,8 +537,8 @@ _item_title_next_btn_set(Elm_Naviframe_Item *it, it->title_next_btn = btn; if (!btn) return; - edje_object_part_swallow(VIEW(it), NEXT_BTN_PART, btn); - edje_object_signal_emit(VIEW(it), "elm,state,next_btn,show", "elm"); + elm_object_part_content_set(VIEW(it), NEXT_BTN_PART, btn); + elm_object_signal_emit(VIEW(it), "elm,state,next_btn,show", "elm"); evas_object_event_callback_add (btn, EVAS_CALLBACK_DEL, _item_title_next_btn_del_cb, it); @@ -547,8 +553,8 @@ _item_title_icon_set(Elm_Naviframe_Item *it, it->title_icon = icon; if (!icon) return; - edje_object_part_swallow(VIEW(it), ICON_PART, icon); - edje_object_signal_emit(VIEW(it), "elm,state,icon,show", "elm"); + elm_object_part_content_set(VIEW(it), ICON_PART, icon); + elm_object_signal_emit(VIEW(it), "elm,state,icon,show", "elm"); evas_object_event_callback_add (icon, EVAS_CALLBACK_DEL, _item_title_icon_del_cb, it); @@ -561,12 +567,12 @@ _item_content_unset(Elm_Naviframe_Item *it) if (!content) return NULL; - edje_object_part_unswallow(VIEW(it), content); - edje_object_signal_emit(VIEW(it), "elm,state,content,hide", "elm"); + elm_object_part_content_unset(VIEW(it), CONTENT_PART); + elm_object_signal_emit(VIEW(it), "elm,state,content,hide", "elm"); evas_object_event_callback_del (content, EVAS_CALLBACK_DEL, _item_content_del_cb); - elm_widget_sub_object_del(WIDGET(it), content); + it->content = NULL; return content; } @@ -578,8 +584,8 @@ _item_title_prev_btn_unset(Elm_Naviframe_Item *it) if (!content) return NULL; - edje_object_part_unswallow(VIEW(it), it->title_prev_btn); - edje_object_signal_emit(VIEW(it), "elm,state,prev_btn,hide", "elm"); + elm_object_part_content_unset(VIEW(it), PREV_BTN_PART); + elm_object_signal_emit(VIEW(it), "elm,state,prev_btn,hide", "elm"); evas_object_event_callback_del (content, EVAS_CALLBACK_DEL, _item_title_prev_btn_del_cb); @@ -595,8 +601,8 @@ _item_title_next_btn_unset(Elm_Naviframe_Item *it) if (!content) return NULL; - edje_object_part_unswallow(VIEW(it), it->title_next_btn); - edje_object_signal_emit(VIEW(it), "elm,state,next_btn,hide", "elm"); + elm_object_part_content_unset(VIEW(it), NEXT_BTN_PART); + elm_object_signal_emit(VIEW(it), "elm,state,next_btn,hide", "elm"); evas_object_event_callback_del (content, EVAS_CALLBACK_DEL, _item_title_next_btn_del_cb); @@ -612,8 +618,8 @@ _item_title_icon_unset(Elm_Naviframe_Item *it) if (!content) return NULL; - edje_object_part_unswallow(VIEW(it), it->title_icon); - edje_object_signal_emit(VIEW(it), "elm,state,icon,hide", "elm"); + elm_object_part_content_unset(VIEW(it), ICON_PART); + elm_object_signal_emit(VIEW(it), "elm,state,icon,hide", "elm"); evas_object_event_callback_del (content, EVAS_CALLBACK_DEL, _item_title_icon_del_cb); @@ -650,14 +656,11 @@ _title_content_set(Elm_Naviframe_Item *it, if (pair) { if (pair->content == content) return; - if (content) edje_object_part_swallow(VIEW(it), part, content); if (pair->content) - { - evas_object_event_callback_del(pair->content, - EVAS_CALLBACK_DEL, - _title_content_del); - evas_object_del(pair->content); - } + evas_object_event_callback_del(pair->content, + EVAS_CALLBACK_DEL, + _title_content_del); + if (content) elm_object_part_content_set(VIEW(it), part, content); } else { @@ -691,15 +694,19 @@ _title_content_set(Elm_Naviframe_Item *it, eina_stringshare_replace(&pair->part, part); it->content_list = eina_inlist_append(it->content_list, EINA_INLIST_GET(pair)); - edje_object_part_swallow(VIEW(it), part, content); + elm_object_part_content_set(VIEW(it), part, content); snprintf(buf, sizeof(buf), "elm,state,%s,show", part); - edje_object_signal_emit(VIEW(it), buf, "elm"); + elm_object_signal_emit(VIEW(it), buf, "elm"); } pair->content = content; evas_object_event_callback_add(content, EVAS_CALLBACK_DEL, _title_content_del, pair); + + /* access */ + if (_elm_config->access_mode) + _access_obj_process(it, EINA_TRUE); } static void @@ -745,7 +752,7 @@ _item_content_get_hook(const Elm_Object_Item *it, return nit->title_icon; //common parts - return edje_object_part_swallow_get(VIEW(nit), part); + return elm_object_part_content_get(VIEW(nit), part); } static Evas_Object * @@ -770,9 +777,9 @@ _title_content_unset(Elm_Naviframe_Item *it, const char *part) if (!content) return NULL; - edje_object_part_unswallow(VIEW(it), content); + elm_object_part_content_unset(VIEW(it), part); snprintf(buf, sizeof(buf), "elm,state,%s,hide", part); - edje_object_signal_emit(VIEW(it), buf, "elm"); + elm_object_signal_emit(VIEW(it), buf, "elm"); evas_object_event_callback_del(content, EVAS_CALLBACK_DEL, _title_content_del); @@ -810,7 +817,7 @@ _item_signal_emit_hook(Elm_Object_Item *it, const char *emission, const char *source) { - edje_object_signal_emit(VIEW(it), emission, source); + elm_object_signal_emit(VIEW(it), emission, source); } static void @@ -829,7 +836,8 @@ _elm_naviframe_smart_sizing_eval(Evas_Object *obj) { evas_object_move(VIEW(it), x, y); evas_object_resize(VIEW(it), w, h); - edje_object_size_min_calc(VIEW(it), &it->minw, &it->minh); + edje_object_size_min_calc(elm_layout_edje_get(VIEW(it)), + &it->minw, &it->minh); if (it->minw > minw) minw = it->minw; if (it->minh > minh) minh = it->minh; } @@ -847,7 +855,7 @@ _on_item_back_btn_clicked(void *data, multiple times on some heavy environment. This callback del will prevent those scenario and guarantee only one clicked for it's own page. */ - evas_object_smart_callback_del(obj, "clicked", _on_item_back_btn_clicked); + evas_object_smart_callback_del(obj, SIG_CLICKED, _on_item_back_btn_clicked); elm_naviframe_item_pop(data); } @@ -861,7 +869,7 @@ _back_btn_new(Evas_Object *obj, const char *title_label) if (!btn) return NULL; evas_object_smart_callback_add - (btn, "clicked", _on_item_back_btn_clicked, obj); + (btn, SIG_CLICKED, _on_item_back_btn_clicked, obj); snprintf (buf, sizeof(buf), "naviframe/back_btn/%s", elm_widget_style_get(obj)); elm_object_style_set(btn, buf); @@ -881,17 +889,37 @@ _back_btn_new(Evas_Object *obj, const char *title_label) * set an icon. */ ed = elm_layout_edje_get(btn); - if (edje_object_part_exists(ed, "elm.swallow.content")) + if (edje_object_part_exists(ed, CONTENT_PART)) { Evas_Object *ico = elm_icon_add(btn); elm_icon_standard_set(ico, "arrow_left"); - elm_layout_content_set(btn, "elm.swallow.content", ico); + elm_layout_content_set(btn, CONTENT_PART, ico); } return btn; } static void +_elm_naviframe_smart_signal_callback_add(Evas_Object *obj, + const char *emission, + const char *source, + Edje_Signal_Cb func_cb, + void *data) +{ + ELM_NAVIFRAME_DATA_GET(obj, sd); + Elm_Object_Item *it; + + if (!sd->stack) return; + + _elm_naviframe_parent_sc->callback_add(obj, emission, source, func_cb, data); + + it = elm_naviframe_top_item_get(obj); + if (!it) return EINA_FALSE; + + elm_object_signal_callback_add(VIEW(it), emission, source, func_cb, data); +} + +static void _elm_naviframe_smart_signal(Evas_Object *obj, const char *emission, const char *source) @@ -1036,8 +1064,7 @@ _on_item_show_finished(void *data, ELM_NAVIFRAME_DATA_GET(WIDGET(it), sd); - edje_object_signal_emit(VIEW(it), "elm,state,visible", "elm"); - edje_object_message_signal_process(VIEW(it)); + elm_object_signal_emit(VIEW(it), "elm,state,visible", "elm"); elm_widget_tree_unfocusable_set(it->content, it->content_unfocusable); @@ -1056,6 +1083,22 @@ _on_item_size_hints_changed(void *data, elm_layout_sizing_eval(data); } +static void +_item_dispmode_set(Elm_Naviframe_Item *it, Evas_Display_Mode dispmode) +{ + if (it->dispmode == dispmode) return; + switch (dispmode) + { + case EVAS_DISPLAY_MODE_COMPRESS: + elm_object_signal_emit(VIEW(it), "display,mode,compress", ""); + break; + default: + elm_object_signal_emit(VIEW(it), "display,mode,default", ""); + break; + } + it->dispmode = dispmode; +} + static Elm_Naviframe_Item * _item_new(Evas_Object *obj, const Elm_Naviframe_Item *prev_it, @@ -1085,25 +1128,26 @@ _item_new(Evas_Object *obj, elm_widget_item_signal_emit_hook_set(it, _item_signal_emit_hook); //item base layout - VIEW(it) = edje_object_add(evas_object_evas_get(obj)); + VIEW(it) = elm_layout_add(obj); evas_object_smart_member_add(VIEW(it), obj); evas_object_event_callback_add (VIEW(it), EVAS_CALLBACK_CHANGED_SIZE_HINTS, _on_item_size_hints_changed, obj); - edje_object_signal_callback_add + + elm_object_signal_callback_add (VIEW(it), "elm,action,show,finished", "", _on_item_show_finished, it); - edje_object_signal_callback_add + elm_object_signal_callback_add (VIEW(it), "elm,action,pushed,finished", "", _on_item_push_finished, it); - edje_object_signal_callback_add + elm_object_signal_callback_add (VIEW(it), "elm,action,popped,finished", "", _on_item_pop_finished, it); - edje_object_signal_callback_add + elm_object_signal_callback_add (VIEW(it), "elm,action,title,clicked", "", _on_item_title_clicked, it); _item_style_set(it, item_style); if (title_label) - _item_text_set_hook((Elm_Object_Item *)it, "elm.text.title", title_label); + _item_text_set_hook((Elm_Object_Item *)it, TITLE_PART, title_label); //title buttons if ((!prev_btn) && sd->auto_pushed && prev_it) @@ -1113,12 +1157,26 @@ _item_new(Evas_Object *obj, } if (prev_btn) - _item_content_set_hook((Elm_Object_Item *)it, PREV_BTN_PART, prev_btn); + { + _item_content_set_hook((Elm_Object_Item *)it, PREV_BTN_PART, prev_btn); + + if (!elm_layout_text_get(prev_btn, NULL)) + _elm_access_text_set + (_elm_access_object_get(prev_btn), ELM_ACCESS_INFO, E_("Back")); + } if (next_btn) - _item_content_set_hook((Elm_Object_Item *)it, NEXT_BTN_PART, next_btn); + { + _item_content_set_hook((Elm_Object_Item *)it, NEXT_BTN_PART, next_btn); + + if (!elm_layout_text_get(next_btn, NULL)) + _elm_access_text_set + (_elm_access_object_get(next_btn), ELM_ACCESS_INFO, E_("Next")); + } _item_content_set(it, content); + _item_dispmode_set(it, sd->dispmode); + it->title_visible = EINA_TRUE; return it; @@ -1128,28 +1186,18 @@ static void _on_obj_size_hints_changed(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__) { - Elm_Object_Item *it; + Elm_Naviframe_Item *it; Evas_Display_Mode dispmode; ELM_NAVIFRAME_DATA_GET(obj, sd); - it = elm_naviframe_top_item_get(obj); - if (!it) return; - dispmode = evas_object_size_hint_display_mode_get(obj); + if (sd->dispmode == dispmode) return; + sd->dispmode = dispmode; - switch (dispmode) - { - case EVAS_DISPLAY_MODE_COMPRESS: - edje_object_signal_emit(VIEW(it), "display,mode,compress", ""); - sd->compress_it = it; - break; - default: - if (sd->compress_it) - edje_object_signal_emit(VIEW(sd->compress_it), "display,mode,default", ""); - break; - } + EINA_INLIST_FOREACH(sd->stack, it) + _item_dispmode_set(it, dispmode); } static Eina_Bool @@ -1162,7 +1210,6 @@ _elm_naviframe_smart_focus_next(const Evas_Object *obj, Eina_List *l = NULL; Elm_Naviframe_Item *top_it; Elm_Naviframe_Content_Item_Pair *content_pair = NULL; - Elm_Naviframe_Text_Item_Pair *text_pair = NULL; void *(*list_data_get)(const Eina_List *list); top_it = (Elm_Naviframe_Item *)elm_naviframe_top_item_get(obj); @@ -1178,18 +1225,8 @@ _elm_naviframe_smart_focus_next(const Evas_Object *obj, /* access */ if (_elm_config->access_mode) { - ao = _access_object_get(top_it, "elm.text.title"); - if (ao) l = eina_list_append(l, ao); - - ao = _access_object_get(top_it, "elm.text.subtitle"); + ao = _access_object_get(top_it, TITLE_ACCESS_PART); if (ao) l = eina_list_append(l, ao); - - - EINA_INLIST_FOREACH(top_it->text_list, text_pair) - { - ao = _access_object_get(top_it, text_pair->part); - if (ao) l = eina_list_append(l, ao); - } } /* icon would be able to have an widget. ex: segment control */ @@ -1206,9 +1243,9 @@ _elm_naviframe_smart_focus_next(const Evas_Object *obj, l = eina_list_append(l, top_it->content); EINA_INLIST_FOREACH(top_it->content_list, content_pair) { - if (edje_object_part_swallow_get(VIEW(top_it), content_pair->part)) - l = eina_list_append(l, edje_object_part_swallow_get(VIEW(top_it), - content_pair->part)); + if (elm_object_part_content_get(VIEW(top_it), content_pair->part)) + l = eina_list_append(l, elm_object_part_content_get(VIEW(top_it), + content_pair->part)); } l = eina_list_append(l, VIEW(top_it)); @@ -1231,7 +1268,7 @@ _elm_naviframe_smart_add(Evas_Object *obj) evas_object_event_callback_add(obj, EVAS_CALLBACK_CHANGED_SIZE_HINTS, _on_obj_size_hints_changed, obj); - elm_widget_can_focus_set(obj, EINA_FALSE); + elm_widget_can_focus_set(obj, EINA_TRUE); } static Eina_Bool @@ -1245,16 +1282,17 @@ _pop_transition_cb(void *data) prev_it = (Elm_Naviframe_Item *) elm_naviframe_top_item_get(WIDGET(it)); if (prev_it) { - edje_object_signal_emit(VIEW(prev_it), "elm,state,prev,popped,deferred", "elm"); + elm_object_signal_emit(VIEW(prev_it), "elm,state,prev,popped,deferred", + "elm"); //FIXME: Remove the below line once edje_object_message_signal_process is fixed. //This API crashes when in the midst of this API processing if edje object passed here is deleted. - //edje_object_message_signal_process(VIEW(prev_it)); + //edje_object_message_signal_process(elm_layout_edje_get(VIEW(prev_it))); } - edje_object_signal_emit(VIEW(it), "elm,state,cur,popped,deferred", "elm"); + elm_object_signal_emit(VIEW(it), "elm,state,cur,popped,deferred", "elm"); //FIXME: Remove the below line once edje_object_message_signal_process is fixed. //This API crashes when in the midst of this API processing if edje object passed here is deleted. - //edje_object_message_signal_process(VIEW(it)); + //edje_object_message_signal_process(elm_layout_edje_get(VIEW(it))); return ECORE_CALLBACK_CANCEL; } @@ -1263,7 +1301,6 @@ static void _elm_naviframe_smart_del(Evas_Object *obj) { Elm_Naviframe_Item *it; - Eina_List *l; ELM_NAVIFRAME_DATA_GET(obj, sd); @@ -1276,7 +1313,7 @@ _elm_naviframe_smart_del(Evas_Object *obj) } //All popping items which are not called yet by animator. - EINA_LIST_FOREACH(sd->popping, l, it) + EINA_LIST_FREE(sd->popping, it) { if (it->animator) ecore_animator_del(it->animator); elm_widget_item_del(it); @@ -1300,6 +1337,30 @@ _elm_naviframe_smart_access(Evas_Object *obj, Eina_Bool is_access) _access_obj_process(it, is_access); } +static Eina_Bool +_elm_naviframe_smart_event(Evas_Object *obj, + Evas_Object *src __UNUSED__, + Evas_Callback_Type type, + void *event_info) +{ + Elm_Naviframe_Item *it; + Evas_Event_Key_Down *ev = event_info; + + if (elm_widget_disabled_get(obj)) return EINA_FALSE; + if (type != EVAS_CALLBACK_KEY_DOWN) return EINA_FALSE; + if (strcmp(ev->keyname, "BackSpace")) return EINA_FALSE; + + it = elm_naviframe_top_item_get(obj); + if (!it) return EINA_FALSE; + + if (it->title_prev_btn) + evas_object_smart_callback_call(it->title_prev_btn, SIG_CLICKED, NULL); + + ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD; + + return EINA_TRUE; +} + static void _elm_naviframe_smart_set_user(Elm_Naviframe_Smart_Class *sc) { @@ -1309,12 +1370,14 @@ _elm_naviframe_smart_set_user(Elm_Naviframe_Smart_Class *sc) ELM_WIDGET_CLASS(sc)->theme = _elm_naviframe_smart_theme; ELM_WIDGET_CLASS(sc)->focus_next = _elm_naviframe_smart_focus_next; ELM_WIDGET_CLASS(sc)->access = _elm_naviframe_smart_access; + ELM_WIDGET_CLASS(sc)->event = _elm_naviframe_smart_event; ELM_CONTAINER_CLASS(sc)->content_set = _elm_naviframe_smart_content_set; ELM_CONTAINER_CLASS(sc)->content_get = _elm_naviframe_smart_content_get; ELM_CONTAINER_CLASS(sc)->content_unset = _elm_naviframe_smart_content_unset; ELM_LAYOUT_CLASS(sc)->signal = _elm_naviframe_smart_signal; + ELM_LAYOUT_CLASS(sc)->callback_add = _elm_naviframe_smart_signal_callback_add; ELM_LAYOUT_CLASS(sc)->text_set = _elm_naviframe_smart_text_set; ELM_LAYOUT_CLASS(sc)->text_get = _elm_naviframe_smart_text_get; ELM_LAYOUT_CLASS(sc)->sizing_eval = _elm_naviframe_smart_sizing_eval; @@ -1333,12 +1396,12 @@ _push_transition_cb(void *data) { prev_it = EINA_INLIST_CONTAINER_GET(sd->stack->last->prev, Elm_Naviframe_Item); - edje_object_signal_emit(VIEW(prev_it), "elm,state,cur,pushed,deferred", + elm_object_signal_emit(VIEW(prev_it), "elm,state,cur,pushed,deferred", "elm"); - edje_object_message_signal_process(VIEW(prev_it)); + edje_object_message_signal_process(elm_layout_edje_get(VIEW(prev_it))); } - edje_object_signal_emit(VIEW(it), "elm,state,new,pushed,deferred", "elm"); - edje_object_message_signal_process(VIEW(it)); + elm_object_signal_emit(VIEW(it), "elm,state,new,pushed,deferred", "elm"); + edje_object_message_signal_process(elm_layout_edje_get(VIEW(it))); return ECORE_CALLBACK_CANCEL; } @@ -1412,11 +1475,11 @@ elm_naviframe_item_push(Evas_Object *obj, evas_object_freeze_events_set(VIEW(prev_it), EINA_TRUE); } - edje_object_signal_emit(VIEW(prev_it), "elm,state,cur,pushed", "elm"); - edje_object_signal_emit(VIEW(it), "elm,state,new,pushed", "elm"); + elm_object_signal_emit(VIEW(prev_it), "elm,state,cur,pushed", "elm"); + elm_object_signal_emit(VIEW(it), "elm,state,new,pushed", "elm"); + edje_object_message_signal_process(elm_layout_edje_get(VIEW(prev_it))); + edje_object_message_signal_process(elm_layout_edje_get(VIEW(it))); - /* animate previous */ - edje_object_message_signal_process(VIEW(prev_it)); if (prev_it->content) { prev_it->content_unfocusable = @@ -1424,8 +1487,6 @@ elm_naviframe_item_push(Evas_Object *obj, elm_widget_tree_unfocusable_set(prev_it->content, EINA_TRUE); } - /* animate new one */ - edje_object_message_signal_process(VIEW(it)); it->animator = ecore_animator_add(_push_transition_cb, it); } @@ -1526,6 +1587,8 @@ elm_naviframe_item_pop(Evas_Object *obj) it = (Elm_Naviframe_Item *)elm_naviframe_top_item_get(obj); if (!it) return NULL; + if (it->pop_cb) it->pop_cb(it->pop_data, (Elm_Object_Item *)it); + if (sd->preserve) content = it->content; @@ -1560,12 +1623,12 @@ elm_naviframe_item_pop(Evas_Object *obj) if (_elm_config->access_mode) _access_focus_set(prev_it); /* these 2 signals MUST take place simultaneously */ - edje_object_signal_emit(VIEW(it), "elm,state,cur,popped", "elm"); + elm_object_signal_emit(VIEW(it), "elm,state,cur,popped", "elm"); evas_object_show(VIEW(prev_it)); - edje_object_signal_emit(VIEW(prev_it), "elm,state,prev,popped", "elm"); + elm_object_signal_emit(VIEW(prev_it), "elm,state,prev,popped", "elm"); - edje_object_message_signal_process(VIEW(it)); - edje_object_message_signal_process(VIEW(prev_it)); + edje_object_message_signal_process(elm_layout_edje_get(VIEW(it))); + edje_object_message_signal_process(elm_layout_edje_get(VIEW(prev_it))); if (it->animator) ecore_animator_del(it->animator); it->animator = ecore_animator_add(_pop_transition_cb, it); @@ -1653,15 +1716,15 @@ elm_naviframe_item_promote(Elm_Object_Item *it) evas_object_freeze_events_set(VIEW(prev_it), EINA_TRUE); } - edje_object_signal_emit(VIEW(prev_it), "elm,state,cur,pushed", "elm"); + elm_object_signal_emit(VIEW(prev_it), "elm,state,cur,pushed", "elm"); evas_object_show(VIEW(nit)); evas_object_raise(VIEW(nit)); - edje_object_signal_emit(VIEW(nit), "elm,state,new,pushed", "elm"); + elm_object_signal_emit(VIEW(nit), "elm,state,new,pushed", "elm"); - edje_object_message_signal_process(VIEW(prev_it)); - edje_object_message_signal_process(VIEW(nit)); + edje_object_message_signal_process(elm_layout_edje_get(VIEW(prev_it))); + edje_object_message_signal_process(elm_layout_edje_get(VIEW(nit))); if (nit->animator) ecore_animator_del(nit->animator); nit->animator = ecore_animator_add(_push_transition_cb, nit); @@ -1783,6 +1846,17 @@ elm_naviframe_item_title_visible_get(const Elm_Object_Item *it) } EAPI void +elm_naviframe_item_pop_cb_set(Elm_Object_Item *it, Elm_Naviframe_Item_Pop_Cb func, void *data) +{ + Elm_Naviframe_Item *nit = (Elm_Naviframe_Item *)it; + + ELM_NAVIFRAME_ITEM_CHECK_OR_RETURN(it); + + nit->pop_cb = func; + nit->pop_data = data; +} + +EAPI void elm_naviframe_prev_btn_auto_pushed_set(Evas_Object *obj, Eina_Bool auto_pushed) { diff --git a/src/lib/elc_naviframe.h b/src/lib/elc_naviframe.h index 3f59328..11d21d6 100644 --- a/src/lib/elc_naviframe.h +++ b/src/lib/elc_naviframe.h @@ -25,7 +25,7 @@ * This widget inherits from the @ref Layout one, so that all the * functions acting on it also work for naviframe objects. * - * Becase this widget is a layout, one places content on those areas + * Because this widget is a layout, one places content on those areas * by using elm_layout_content_set() on the right swallow part names * expected for each, which are: * @li @c "default" - The main content of the current page @@ -50,7 +50,7 @@ * - @c "basic" - views are switched sliding horizontally, one after * the other * - @c "overlap" - like the previous one, but the previous view stays - * at its place and is ovelapped by the new + * at its place and is overlapped by the new * * * This widget emits the following signals, besides the ones sent from @@ -74,6 +74,18 @@ */ /** + * @typedef Elm_Naviframe_Item_Pop_Cb + * + * Pop callback called when @c it is going to be popped. @c data is user + * specific data. + * + * @see elm_naviframe_item_pop_cb_set() + * + * @since 1.8 + */ +typedef void (*Elm_Naviframe_Item_Pop_Cb)(void *data, Elm_Object_Item *it); + +/** * @addtogroup Naviframe * @{ */ @@ -195,6 +207,7 @@ EAPI Elm_Object_Item *elm_naviframe_item_insert_after(Evas_Object *obj, Elm_Obje * stack will become visible. * * @see also elm_naviframe_content_preserve_on_pop_get() + * @see also elm_naviframe_item_pop_cb_set() * * @ingroup Naviframe */ @@ -322,6 +335,22 @@ EAPI void elm_naviframe_item_title_visible_set(Elm_Object_Item *it, EAPI Eina_Bool elm_naviframe_item_title_visible_get(const Elm_Object_Item *it); /** + * @brief Set a function to be called when @c it of the naviframe is going to be + * popped. + * + * @param it The item to set the callback on + * @param func the callback function. + * + * @warning Don't set "clicked" callback to the prev button additionally if the + * function does a exact same logic with this @c func. When hardware back key is + * pressed then both callbacks will be called. + * + * @since 1.8 + * @ingroup Naviframe + */ +EAPI void elm_naviframe_item_pop_cb_set(Elm_Object_Item *it, Elm_Naviframe_Item_Pop_Cb func, void *data); + +/** * @brief Set creating prev button automatically or not * * @param obj The naviframe object diff --git a/src/lib/elc_popup.c b/src/lib/elc_popup.c index e261afc..95b1187 100644 --- a/src/lib/elc_popup.c +++ b/src/lib/elc_popup.c @@ -8,6 +8,9 @@ EAPI const char ELM_POPUP_SMART_NAME[] = "elm_popup"; static void _button_remove(Evas_Object *, int, Eina_Bool); +static const char ACCESS_TITLE_PART[] = "access.title"; +static const char ACCESS_BODY_PART[] = "access.body"; + static const char SIG_BLOCK_CLICKED[] = "block,clicked"; static const char SIG_TIMEOUT[] = "timeout"; static const Evas_Smart_Cb_Description _smart_callbacks[] = { @@ -55,6 +58,18 @@ _timeout_cb(void *data, evas_object_smart_callback_call(data, SIG_TIMEOUT, NULL); } +static Evas_Object * +_access_object_get(const Evas_Object *obj, const char* part) +{ + Evas_Object *po, *ao; + ELM_POPUP_DATA_GET(obj, sd); + + po = (Evas_Object *)edje_object_part_object_get(ELM_WIDGET_DATA(sd)->resize_obj, part); + ao = evas_object_data_get(po, "_part_access_obj"); + + return ao; +} + static void _on_show(void *data __UNUSED__, Evas *e __UNUSED__, @@ -71,12 +86,6 @@ _on_show(void *data __UNUSED__, /* yeah, ugly, but again, this widget needs a rewrite */ elm_object_content_set(sd->notify, obj); - // XXX: ACCESS - if (_elm_config->access_mode == ELM_ACCESS_MODE_ON) - { - evas_object_focus_set(sd->title_access_obj, EINA_TRUE); - _elm_access_highlight_set(sd->title_access_obj); - } elm_object_focus_set(obj, EINA_TRUE); } @@ -91,6 +100,9 @@ _on_hide(void *data __UNUSED__, evas_object_hide(sd->notify); elm_object_content_unset(sd->notify); + +/* FIXME:elm_object_content_unset(notify) deletes callback to revert focus status. */ + elm_object_focus_set(obj, EINA_FALSE); } static void @@ -212,6 +224,51 @@ _mirrored_set(Evas_Object *obj, edje_object_mirrored_set(VIEW(item), rtl); } +static void +_access_obj_process(Evas_Object *obj, Eina_Bool is_access) +{ + Evas_Object *ao; + + ELM_POPUP_DATA_GET(obj, sd); + + if (is_access) + { + if (sd->title_text) + { + ao = _elm_access_edje_object_part_object_register + (obj, ELM_WIDGET_DATA(sd)->resize_obj, ACCESS_TITLE_PART); + _elm_access_text_set(_elm_access_object_get(ao), + ELM_ACCESS_TYPE, E_("Popup Title")); + _elm_access_text_set(_elm_access_object_get(ao), + ELM_ACCESS_INFO, sd->title_text); + } + + if (sd->text_content_obj) + { + ao = _elm_access_edje_object_part_object_register + (obj, ELM_WIDGET_DATA(sd)->resize_obj, ACCESS_BODY_PART); + _elm_access_text_set(_elm_access_object_get(ao), + ELM_ACCESS_TYPE, E_("Popup Body Text")); + _elm_access_text_set(_elm_access_object_get(ao), + ELM_ACCESS_INFO, elm_object_text_get(sd->text_content_obj)); + } + } + else + { + if (sd->title_text) + { + _elm_access_edje_object_part_object_unregister + (obj, ELM_WIDGET_DATA(sd)->resize_obj, ACCESS_TITLE_PART); + } + + if (sd->text_content_obj) + { + _elm_access_edje_object_part_object_unregister + (obj, ELM_WIDGET_DATA(sd)->resize_obj, ACCESS_BODY_PART); + } + } +} + static Eina_Bool _elm_popup_smart_theme(Evas_Object *obj) { @@ -283,6 +340,9 @@ _elm_popup_smart_theme(Evas_Object *obj) edje_object_message_signal_process(ELM_WIDGET_DATA(sd)->resize_obj); elm_layout_sizing_eval(obj); + /* access */ + if (_elm_config->access_mode) _access_obj_process(obj, EINA_TRUE); + return EINA_TRUE; } @@ -739,6 +799,69 @@ _item_signal_emit_hook(Elm_Object_Item *it, } static void +_access_activate_cb(void *data __UNUSED__, + Evas_Object *part_obj __UNUSED__, + Elm_Object_Item *item) +{ + _item_select_cb(item, NULL, NULL, NULL); +} + +static char * +_access_state_cb(void *data, Evas_Object *obj __UNUSED__) +{ + Elm_Popup_Item *it = (Elm_Popup_Item *)data; + if (!it) return NULL; + + if (it->base.disabled) + return strdup(E_("State: Disabled")); + + return NULL; +} + +static char * +_access_info_cb(void *data, Evas_Object *obj __UNUSED__) +{ + Elm_Popup_Item *it = (Elm_Popup_Item *)data; + const char *txt = NULL; + Evas_Object *icon = NULL; + Eina_Strbuf *buf = NULL; + char *str = NULL; + + if (!it) return NULL; + + txt = it->label; + icon = it->icon; + + if (txt && icon) + { + buf = eina_strbuf_new(); + eina_strbuf_append(buf, E_("icon ")); + eina_strbuf_append(buf, txt); + str = eina_strbuf_string_steal(buf); + eina_strbuf_free(buf); + return str; + } + else if ((!txt) && icon) return strdup(E_("icon")); + else if (txt && (!icon)) return strdup(txt); + + return NULL; +} + +static void +_access_widget_item_register(Elm_Popup_Item *it) +{ + Elm_Access_Info *ao; + + _elm_access_widget_item_register((Elm_Widget_Item *)it); + ao = _elm_access_object_get(it->base.access_obj); + _elm_access_callback_set(ao, ELM_ACCESS_INFO, _access_info_cb, it); + _elm_access_callback_set(ao, ELM_ACCESS_STATE, _access_state_cb, it); + _elm_access_text_set(ao, ELM_ACCESS_TYPE, E_("Popup_list")); + _elm_access_activate_callback_set(ao, _access_activate_cb, it); + +} + +static void _item_new(Elm_Popup_Item *item) { ELM_POPUP_DATA_GET(WIDGET(item), sd); @@ -760,6 +883,10 @@ _item_new(Elm_Popup_Item *item) (VIEW(item), "elm,action,click", "", _item_select_cb, item); evas_object_size_hint_align_set (VIEW(item), EVAS_HINT_FILL, EVAS_HINT_FILL); + + /* access */ + if (_elm_config->access_mode) _access_widget_item_register(item); + evas_object_show(VIEW(item)); } @@ -767,6 +894,7 @@ static Eina_Bool _title_text_set(Evas_Object *obj, const char *text) { + Evas_Object *ao; Eina_Bool title_visibility_old, title_visibility_current; ELM_POPUP_DATA_GET(obj, sd); @@ -780,15 +908,18 @@ _title_text_set(Evas_Object *obj, edje_object_part_text_escaped_set (ELM_WIDGET_DATA(sd)->resize_obj, "elm.text.title", text); - // XXX: ACCESS - if (_elm_config->access_mode == ELM_ACCESS_MODE_ON) + /* access */ + if (_elm_config->access_mode) { - sd->title_access_obj = _elm_access_edje_object_part_object_register - (ELM_WIDGET_DATA(sd)->resize_obj, ELM_WIDGET_DATA(sd)->resize_obj, - "elm.text.title"); - _elm_access_text_set(_elm_access_object_get(sd->title_access_obj), - ELM_ACCESS_TYPE, E_("popup title")); - elm_widget_sub_object_add(obj, sd->title_access_obj); + ao = _access_object_get(obj, ACCESS_TITLE_PART); + if (!ao) + { + ao = _elm_access_edje_object_part_object_register + (obj, ELM_WIDGET_DATA(sd)->resize_obj, ACCESS_TITLE_PART); + _elm_access_text_set(_elm_access_object_get(ao), + ELM_ACCESS_TYPE, E_("Popup Title")); + } + _elm_access_text_set(_elm_access_object_get(ao), ELM_ACCESS_INFO, text); } if (sd->title_text) @@ -811,7 +942,7 @@ static Eina_Bool _content_text_set(Evas_Object *obj, const char *text) { - Evas_Object *prev_content; + Evas_Object *prev_content, *ao; char buf[128]; ELM_POPUP_DATA_GET(obj, sd); @@ -849,10 +980,22 @@ _content_text_set(Evas_Object *obj, elm_layout_content_set (sd->content_area, "elm.swallow.content", sd->text_content_obj); - // XXX: ACCESS - _elm_access_text_set - (_elm_access_object_get(sd->text_content_obj), - ELM_ACCESS_TYPE, E_("popup label")); + /* access */ + if (_elm_config->access_mode) + { + /* unregister label, ACCESS_BODY_PART will register */ + elm_access_object_unregister(sd->text_content_obj); + + ao = _access_object_get(obj, ACCESS_BODY_PART); + if (!ao) + { + ao = _elm_access_edje_object_part_object_register + (obj, ELM_WIDGET_DATA(sd)->resize_obj, ACCESS_BODY_PART); + _elm_access_text_set(_elm_access_object_get(ao), + ELM_ACCESS_TYPE, E_("Popup Body Text")); + } + _elm_access_text_set(_elm_access_object_get(ao), ELM_ACCESS_INFO, text); + } end: elm_layout_sizing_eval(obj); @@ -1197,24 +1340,33 @@ _elm_popup_smart_focus_next(const Evas_Object *obj, Elm_Focus_Direction dir, Evas_Object **next) { + Evas_Object *ao; + Eina_List *items = NULL; + ELM_POPUP_DATA_GET(obj, sd); - if (!elm_widget_focus_next_get(sd->content_area, dir, next) && - !elm_widget_focus_next_get(sd->action_area, dir, next) - ) + /* access */ + if (_elm_config->access_mode) { - // XXX: ACCESS - if (_elm_config->access_mode == ELM_ACCESS_MODE_ON) + if (sd->title_text) { - *next = sd->title_access_obj; - return EINA_TRUE; + ao = _access_object_get(obj, ACCESS_TITLE_PART); + items = eina_list_append(items, ao); } - elm_widget_focused_object_clear((Evas_Object *)obj); - if (!elm_widget_focus_next_get(sd->content_area, dir, next)) - return elm_widget_focus_next_get(sd->action_area, dir, next); - return EINA_TRUE; + + ao = _access_object_get(obj, ACCESS_BODY_PART); + if (ao) items = eina_list_append(items, ao); } + /* content area */ + if (sd->content) items = eina_list_append(items, sd->content_area); + + /* action area */ + if (sd->button_count) items = eina_list_append(items, sd->action_area); + + elm_widget_focus_list_next_get + (obj, items, eina_list_data_get, dir, next); + return EINA_TRUE; } @@ -1225,10 +1377,34 @@ _elm_popup_smart_focus_direction(const Evas_Object *obj, Evas_Object **direction, double *weight) { + Evas_Object *ao; + Eina_List *items = NULL; + ELM_POPUP_DATA_GET(obj, sd); - return elm_widget_focus_direction_get - (sd->notify, base, degree, direction, weight); + /* access */ + if (_elm_config->access_mode) + { + if (sd->title_text) + { + ao = _access_object_get(obj, ACCESS_TITLE_PART); + items = eina_list_append(items, ao); + } + + ao = _access_object_get(obj, ACCESS_BODY_PART); + if (ao) items = eina_list_append(items, ao); + } + + /* content area */ + if (sd->content) items = eina_list_append(items, sd->content_area); + + /* action area */ + if (sd->button_count) items = eina_list_append(items, sd->action_area); + + elm_widget_focus_list_direction_get + (obj, base, items, eina_list_data_get, degree, direction, weight); + + return EINA_TRUE; } static void @@ -1238,13 +1414,13 @@ _elm_popup_smart_add(Evas_Object *obj) ELM_WIDGET_CLASS(_elm_popup_parent_sc)->base.add(obj); - elm_layout_theme_set(obj, "popup", "base", elm_widget_style_get(obj)); - evas_object_size_hint_weight_set (ELM_WIDGET_DATA(priv)->resize_obj, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_size_hint_align_set (ELM_WIDGET_DATA(priv)->resize_obj, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_layout_theme_set(obj, "popup", "base", elm_widget_style_get(obj)); + priv->notify = elm_notify_add(obj); elm_notify_orient_set(priv->notify, ELM_NOTIFY_ORIENT_CENTER); elm_notify_allow_events_set(priv->notify, EINA_FALSE); @@ -1306,14 +1482,75 @@ _elm_popup_smart_parent_set(Evas_Object *obj, } static void +_elm_popup_smart_access(Evas_Object *obj, Eina_Bool is_access) +{ + _access_obj_process(obj, is_access); +} + +static Eina_Bool +_elm_popup_smart_event(Evas_Object *obj, + Evas_Object *src __UNUSED__, + Evas_Callback_Type type, + void *event_info) +{ + Evas_Event_Key_Down *ev = event_info; + + if (elm_widget_disabled_get(obj)) return EINA_FALSE; + if (type != EVAS_CALLBACK_KEY_DOWN) return EINA_FALSE; + if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return EINA_FALSE; + + if (!strcmp(ev->keyname, "Tab")) + { + if (evas_key_modifier_is_set(ev->modifiers, "Shift")) + elm_widget_focus_cycle(obj, ELM_FOCUS_PREVIOUS); + else + elm_widget_focus_cycle(obj, ELM_FOCUS_NEXT); + + goto success; + } + else if ((!strcmp(ev->keyname, "Left")) || + ((!strcmp(ev->keyname, "KP_Left")) && (!ev->string))) + { + elm_widget_focus_direction_go(obj, 270.0); + goto success; + } + else if ((!strcmp(ev->keyname, "Right")) || + ((!strcmp(ev->keyname, "KP_Right")) && (!ev->string))) + { + elm_widget_focus_direction_go(obj, 90.0); + goto success; + } + else if ((!strcmp(ev->keyname, "Up")) || + ((!strcmp(ev->keyname, "KP_Up")) && (!ev->string))) + { + elm_widget_focus_direction_go(obj, 0.0); + goto success; + } + else if ((!strcmp(ev->keyname, "Down")) || + ((!strcmp(ev->keyname, "KP_Down")) && (!ev->string))) + { + elm_widget_focus_direction_go(obj, 180.0); + goto success; + } + + return EINA_FALSE; + +success: + ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD; + return EINA_TRUE; +} + +static void _elm_popup_smart_set_user(Elm_Popup_Smart_Class *sc) { ELM_WIDGET_CLASS(sc)->base.add = _elm_popup_smart_add; ELM_WIDGET_CLASS(sc)->base.del = _elm_popup_smart_del; ELM_WIDGET_CLASS(sc)->parent_set = _elm_popup_smart_parent_set; + ELM_WIDGET_CLASS(sc)->event = _elm_popup_smart_event; ELM_WIDGET_CLASS(sc)->theme = _elm_popup_smart_theme; ELM_WIDGET_CLASS(sc)->focus_next = _elm_popup_smart_focus_next; + ELM_WIDGET_CLASS(sc)->access = _elm_popup_smart_access; ELM_WIDGET_CLASS(sc)->focus_direction = _elm_popup_smart_focus_direction; ELM_WIDGET_CLASS(sc)->sub_object_del = _elm_popup_smart_sub_object_del; @@ -1357,6 +1594,11 @@ elm_popup_add(Evas_Object *parent) if (!elm_widget_sub_object_add(parent, obj)) ERR("could not add %p as sub object of %p", obj, parent); + /* access: parent could be any object such as elm_list which does + not know elc_popup as its child object in the focus_next(); */ + ELM_WIDGET_DATA_GET(obj, sd); + sd->highlight_root = EINA_TRUE; + return obj; } diff --git a/src/lib/elm_access.c b/src/lib/elm_access.c index 68ea977..038fee0 100644 --- a/src/lib/elm_access.c +++ b/src/lib/elm_access.c @@ -7,6 +7,9 @@ ELM_INTERNAL_SMART_SUBCLASS_NEW (ACCESS_SMART_NAME, _elm_access, Elm_Widget_Smart_Class, Elm_Widget_Smart_Class, elm_widget_smart_class_get, NULL); +static Eina_Bool mouse_event_enable = EINA_TRUE; +static Eina_Bool read_mode = EINA_FALSE; + static Evas_Object * _elm_access_add(Evas_Object *parent); static void @@ -89,6 +92,21 @@ _access_init(void) mapi = m->api; } +static void +_access_shutdown(void) +{ + Elm_Module *m; + if (initted == 0) return; + if (!(m = _elm_module_find_as("access/api"))) return; + + m->shutdown_func(m); + + initted = 0; + + free(mapi); + mapi = NULL; +} + static Elm_Access_Item * _access_add_set(Elm_Access_Info *ac, int type) { @@ -115,11 +133,33 @@ _access_add_set(Elm_Access_Info *ac, int type) return ai; } +static Evas_Object * +_access_highlight_object_get(Evas_Object *obj) +{ + Evas_Object *o, *ho; + + o = evas_object_name_find(evas_object_evas_get(obj), "_elm_access_disp"); + if (!o) return NULL; + + ho = evas_object_data_get(o, "_elm_access_target"); + + return ho; +} + static Eina_Bool _access_obj_over_timeout_cb(void *data) { - Elm_Access_Info *ac = evas_object_data_get(data, "_elm_access"); + Elm_Access_Info *ac; + Evas_Object *ho; + + if (!data) return EINA_FALSE; + + ho = _access_highlight_object_get(data); + if (ho == data) return EINA_FALSE; + + ac = evas_object_data_get(data, "_elm_access"); if (!ac) return EINA_FALSE; + if (_elm_config->access_mode != ELM_ACCESS_MODE_OFF) { if (ac->on_highlight) ac->on_highlight(ac->on_highlight_data); @@ -138,7 +178,10 @@ _access_obj_over_timeout_cb(void *data) static void _access_obj_mouse_in_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) { - Elm_Access_Info *ac = evas_object_data_get(data, "_elm_access"); + Elm_Access_Info *ac; + if (!mouse_event_enable) return; + + ac = evas_object_data_get(data, "_elm_access"); if (!ac) return; if (ac->delay_timer) @@ -153,8 +196,12 @@ _access_obj_mouse_in_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSE static void _access_obj_mouse_out_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) { - Elm_Access_Info *ac = evas_object_data_get(data, "_elm_access"); + Elm_Access_Info *ac; + if (!mouse_event_enable) return; + + ac = evas_object_data_get(data, "_elm_access"); if (!ac) return; + _elm_access_object_unhilight(data); if (ac->delay_timer) { @@ -239,19 +286,87 @@ _access_obj_hilight_resize_cb(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Ob evas_object_resize(o, w, h); } -static Evas_Object * -_access_highlight_object_get(Evas_Object *obj) +void +_elm_access_mouse_event_enabled_set(Eina_Bool enabled) { - Evas_Object *o, *ho; + enabled = !!enabled; + if (mouse_event_enable == enabled) return; + mouse_event_enable = enabled; +} - o = evas_object_name_find(evas_object_evas_get(obj), "_elm_access_disp"); - if (!o) return NULL; +void +_elm_access_read_mode_set(Eina_Bool enabled) +{ + enabled = !!enabled; + if (read_mode == enabled) return; + read_mode = enabled; +} - ho = evas_object_data_get(o, "_elm_access_target"); +Eina_Bool +_elm_access_read_mode_get() +{ + return read_mode; +} - return ho; +void +_elm_access_shutdown() +{ + _access_shutdown(); +} + +static void +_access_order_del_cb(void *data, + Evas *e __UNUSED__, + Evas_Object *obj, + void *event_info __UNUSED__) +{ + Elm_Widget_Item *item = data; + + item->access_order = eina_list_remove(item->access_order, obj); } +void +_elm_access_widget_item_access_order_set(Elm_Widget_Item *item, + Eina_List *objs) +{ + Eina_List *l; + Evas_Object *o; + + if (!item) return; + + _elm_access_widget_item_access_order_unset(item); + + EINA_LIST_FOREACH(objs, l, o) + { + evas_object_event_callback_add(o, EVAS_CALLBACK_DEL, + _access_order_del_cb, item); + } + + item->access_order = objs; +} + +const Eina_List * +_elm_access_widget_item_access_order_get(const Elm_Widget_Item *item) +{ + if (!item) return NULL; + return item->access_order; +} + +void +_elm_access_widget_item_access_order_unset(Elm_Widget_Item *item) +{ + Eina_List *l, *l_next; + Evas_Object *o; + + if (!item) return; + + EINA_LIST_FOREACH_SAFE(item->access_order, l, l_next, o) + { + evas_object_event_callback_del_full + (o, EVAS_CALLBACK_DEL, _access_order_del_cb, item); + item->access_order = eina_list_remove_list(item->access_order, l); + } +} //-------------------------------------------------------------------------// EAPI void _elm_access_highlight_set(Evas_Object* obj) @@ -289,7 +404,7 @@ _elm_access_text_set(Elm_Access_Info *ac, int type, const char *text) } EAPI void -_elm_access_callback_set(Elm_Access_Info *ac, int type, Elm_Access_Content_Cb func, const void *data) +_elm_access_callback_set(Elm_Access_Info *ac, int type, Elm_Access_Info_Cb func, const void *data) { Elm_Access_Item *ai = _access_add_set(ac, type); if (!ai) return; @@ -321,42 +436,47 @@ EAPI void _elm_access_highlight_object_activate(Evas_Object *obj, Elm_Activate act) { Evas_Object *highlight; - Elm_Access_Info *ac; highlight = _access_highlight_object_get(obj); if (!highlight) return; - if (elm_widget_is(highlight)) - { - elm_widget_activate(highlight, act); - return; - } + _elm_access_read_mode_set(EINA_FALSE); - ac = evas_object_data_get(highlight, "_elm_access"); - if (!ac) return; + if (!elm_object_focus_get(highlight)) + elm_object_focus_set(highlight, EINA_TRUE); - if (ac->activate) - ac->activate(ac->activate_data, highlight, - (Elm_Object_Item *)ac->widget_item); + elm_widget_activate(highlight, act); + return; } EAPI void _elm_access_highlight_cycle(Evas_Object *obj, Elm_Focus_Direction dir) { - Evas_Object *highlight, *focused; - - highlight = _access_highlight_object_get(obj); - focused = elm_widget_focused_object_get(obj); + Evas_Object *ho; + ho = _access_highlight_object_get(obj); + if (!ho) return; - if (highlight && (highlight != focused)) - elm_object_focus_set(highlight, EINA_TRUE); + /* find highlight root */ + do + { + ELM_WIDGET_DATA_GET(ho, sd); + if (sd->highlight_root) + { + /* change highlight root */ + obj = ho; + break; + } + ho = elm_widget_parent_get(ho); + } + while (ho); - /* use focus cycle to read next, previous object */ + _elm_access_read_mode_set(EINA_TRUE); elm_widget_focus_cycle(obj, dir); + _elm_access_read_mode_set(EINA_FALSE); } EAPI char * -_elm_access_text_get(const Elm_Access_Info *ac, int type, Evas_Object *obj) +_elm_access_text_get(const Elm_Access_Info *ac, int type, const Evas_Object *obj) { Elm_Access_Item *ai; Eina_List *l; @@ -366,7 +486,7 @@ _elm_access_text_get(const Elm_Access_Info *ac, int type, Evas_Object *obj) { if (ai->type == type) { - if (ai->func) return ai->func((void *)(ai->data), obj); + if (ai->func) return ai->func((void *)(ai->data), (Evas_Object *)obj); else if (ai->data) return strdup(ai->data); return NULL; } @@ -375,10 +495,12 @@ _elm_access_text_get(const Elm_Access_Info *ac, int type, Evas_Object *obj) } EAPI void -_elm_access_read(Elm_Access_Info *ac, int type, Evas_Object *obj) +_elm_access_read(Elm_Access_Info *ac, int type, const Evas_Object *obj) { char *txt = _elm_access_text_get(ac, type, obj); + if (txt && strlen(txt) == 0) return; /* Tizen only: TTS engine does not work properly */ + _access_init(); if (mapi) { @@ -394,11 +516,7 @@ _elm_access_read(Elm_Access_Info *ac, int type, Evas_Object *obj) } else { - if (txt) - { - if (mapi->out_read) mapi->out_read(txt); - if (mapi->out_read) mapi->out_read(".\n"); - } + if (txt && mapi->out_read) mapi->out_read(txt); } } if (txt) free(txt); @@ -407,6 +525,10 @@ _elm_access_read(Elm_Access_Info *ac, int type, Evas_Object *obj) EAPI void _elm_access_say(const char *txt) { + if (!_elm_config->access_mode) return; + + if (txt && strlen(txt) == 0) return; /* Tizen only: TTS engine does not work properly */ + _access_init(); if (mapi) { @@ -431,7 +553,7 @@ _elm_access_object_get(const Evas_Object *obj) EAPI void _elm_access_object_hilight(Evas_Object *obj) { - Evas_Object *o, *parent_obj; + Evas_Object *o; Evas_Coord x, y, w, h; o = evas_object_name_find(evas_object_evas_get(obj), "_elm_access_disp"); @@ -447,6 +569,8 @@ _elm_access_object_hilight(Evas_Object *obj) if (ptarget) { evas_object_data_del(o, "_elm_access_target"); + elm_widget_parent_highlight_set(ptarget, EINA_FALSE); + evas_object_event_callback_del_full(ptarget, EVAS_CALLBACK_DEL, _access_obj_hilight_del_cb, NULL); evas_object_event_callback_del_full(ptarget, EVAS_CALLBACK_HIDE, @@ -458,12 +582,9 @@ _elm_access_object_hilight(Evas_Object *obj) } } evas_object_data_set(o, "_elm_access_target", obj); + elm_widget_parent_highlight_set(obj, EINA_TRUE); - parent_obj = obj; - if (!elm_widget_is(obj)) - parent_obj = evas_object_data_get(obj, "_elm_access_parent"); - - elm_widget_theme_object_set(parent_obj, o, "access", "base", "default"); + elm_widget_theme_object_set(obj, o, "access", "base", "default"); evas_object_event_callback_add(obj, EVAS_CALLBACK_DEL, _access_obj_hilight_del_cb, NULL); @@ -499,6 +620,7 @@ _elm_access_object_unhilight(Evas_Object *obj) evas_object_event_callback_del_full(ptarget, EVAS_CALLBACK_RESIZE, _access_obj_hilight_resize_cb, NULL); evas_object_del(o); + elm_widget_parent_highlight_set(ptarget, EINA_FALSE); } } @@ -530,25 +652,74 @@ _content_move(void *data, Evas *e __UNUSED__, Evas_Object *obj, evas_object_move(accessobj, x, y); } -static char * -_part_access_info_cb(void *data, Evas_Object *obj) +static Evas_Object * +_access_object_register(Evas_Object *obj, Evas_Object *parent) { - Evas_Object *eobj = data; - if (!eobj) return NULL; + Evas_Object *ao; + Elm_Access_Info *ac; + Evas_Coord x, y, w, h; - const char *part = evas_object_data_get(obj, "_elm_access_part"); - const char *txt = edje_object_part_text_get(eobj, part); - if (txt) return strdup(txt); - return NULL; + if (!obj) return NULL; + + /* create access object */ + ao = _elm_access_add(parent); + if (!ao) return NULL; + + evas_object_event_callback_add(obj, EVAS_CALLBACK_RESIZE, + _content_resize, ao); + evas_object_event_callback_add(obj, EVAS_CALLBACK_MOVE, + _content_move, ao); + + evas_object_geometry_get(obj, &x, &y, &w, &h); + evas_object_move(ao, x, y); + evas_object_resize(ao, w, h); + evas_object_show(ao); + + /* register access object */ + _elm_access_object_register(ao, obj); + + /* set access object */ + evas_object_data_set(obj, "_part_access_obj", ao); + + /* set owner part object */ + ac = evas_object_data_get(ao, "_elm_access"); + ac->part_object = obj; + + return ao; } static void -_access_obj_del(void *data __UNUSED__, Evas *e __UNUSED__, - Evas_Object *obj, void *event_info __UNUSED__) +_access_object_unregister(Evas_Object *obj) { - char *part = evas_object_data_get(obj, "_elm_access_part"); - evas_object_data_del(obj, "_elm_access_part"); - if (part) free(part); + Elm_Access_Info *ac; + Evas_Object *ao; + + if (!obj) return; + + ao = evas_object_data_get(obj, "_part_access_obj"); + + if (ao) + { + evas_object_data_del(obj, "_part_access_obj"); + + /* delete callbacks */ + evas_object_event_callback_del_full(obj, EVAS_CALLBACK_RESIZE, + _content_resize, ao); + evas_object_event_callback_del_full(obj, EVAS_CALLBACK_MOVE, + _content_move, ao); + + /* unregister access object */ + _elm_access_object_unregister(ao, obj); + + evas_object_del(ao); + } + else + { + /* button, check, label etc. */ + ac = evas_object_data_get(obj, "_elm_access"); + if (ac && ac->hoverobj) + _elm_access_object_unregister(obj, ac->hoverobj); + } } EAPI Evas_Object * @@ -556,81 +727,33 @@ _elm_access_edje_object_part_object_register(Evas_Object* obj, const Evas_Object *eobj, const char* part) { - Evas_Object *ao; - Evas_Object *po = (Evas_Object *)edje_object_part_object_get(eobj, part); - Evas_Coord x, y, w, h; - Elm_Access_Info *ac; + Evas_Object *ao, *po; + po = (Evas_Object *)edje_object_part_object_get(eobj, part); if (!obj || !po) return NULL; - // check previous access object + /* check previous access object */ ao = evas_object_data_get(po, "_part_access_obj"); if (ao) _elm_access_edje_object_part_object_unregister(obj, eobj, part); - // create access object - ao = _elm_access_add(obj); - if (!ao) return NULL; - - evas_object_event_callback_add(po, EVAS_CALLBACK_RESIZE, - _content_resize, ao); - evas_object_event_callback_add(po, EVAS_CALLBACK_MOVE, - _content_move, ao); - - evas_object_geometry_get(po, &x, &y, &w, &h); - evas_object_move(ao, x, y); - evas_object_resize(ao, w, h); - evas_object_show(ao); - - // register access object - _elm_access_object_register(ao, po); - _elm_access_text_set(_elm_access_object_get(ao), - ELM_ACCESS_TYPE, evas_object_type_get(po)); - evas_object_data_set(ao, "_elm_access_part", strdup(part)); - evas_object_event_callback_add(ao, EVAS_CALLBACK_DEL, - _access_obj_del, NULL); - _elm_access_callback_set(_elm_access_object_get(ao), - ELM_ACCESS_INFO, - _part_access_info_cb, eobj); - - // set access object - evas_object_data_set(po, "_part_access_obj", ao); - - /* set owner part object */ - ac = evas_object_data_get(ao, "_elm_access"); - ac->part_object = po; + ao = _access_object_register(po, obj); return ao; } +//FIXME: unused obj should be removed from here and each widget. EAPI void -_elm_access_edje_object_part_object_unregister(Evas_Object* obj, +_elm_access_edje_object_part_object_unregister(Evas_Object* obj __UNUSED__, const Evas_Object *eobj, const char* part) { - Evas_Object *ao; - Evas_Object *po = (Evas_Object *)edje_object_part_object_get(eobj, part); - - if (!obj || !po) return; + Evas_Object *po; - ao = evas_object_data_get(po, "_part_access_obj"); - if (!ao) return; + po = (Evas_Object *)edje_object_part_object_get(eobj, part); + if (!po) return; - evas_object_data_del(po, "_part_access_obj"); - - // delete callbacks - evas_object_event_callback_del_full(po, EVAS_CALLBACK_RESIZE, - _content_resize, ao); - evas_object_event_callback_del_full(po, EVAS_CALLBACK_MOVE, - _content_move, ao); - - evas_object_event_callback_del_full(po, EVAS_CALLBACK_MOUSE_IN, - _access_obj_mouse_in_cb, ao); - evas_object_event_callback_del_full(po, EVAS_CALLBACK_MOUSE_OUT, - _access_obj_mouse_out_cb, ao); - evas_object_event_callback_del_full(po, EVAS_CALLBACK_DEL, - _access_obj_del_cb, ao); - evas_object_del(ao); + _access_object_unregister(po); } EAPI void @@ -653,6 +776,7 @@ _elm_access_object_hilight_disable(Evas *e) _access_obj_hilight_resize_cb, NULL); } evas_object_del(o); + elm_widget_parent_highlight_set(ptarget, EINA_FALSE); } EAPI void @@ -668,6 +792,8 @@ _elm_access_object_register(Evas_Object *obj, Evas_Object *hoverobj) _access_obj_del_cb, obj); ac = calloc(1, sizeof(Elm_Access_Info)); evas_object_data_set(obj, "_elm_access", ac); + + ac->hoverobj = hoverobj; } EAPI void @@ -698,7 +824,7 @@ _elm_access_widget_item_register(Elm_Widget_Item *item) Evas_Coord x, y, w, h; Elm_Access_Info *ac; - if (!item) return; + ELM_WIDGET_ITEM_CHECK_OR_RETURN(item); /* check previous access object */ if (item->access_obj) @@ -734,7 +860,9 @@ _elm_access_widget_item_unregister(Elm_Widget_Item *item) { Evas_Object *ho; - if (!item || !item->access_obj) return; + ELM_WIDGET_ITEM_CHECK_OR_RETURN(item); + + if (!item->access_obj) return; ho = item->view; evas_object_event_callback_del_full(ho, EVAS_CALLBACK_RESIZE, @@ -785,71 +913,46 @@ _elm_access_add(Evas_Object *parent) return obj; } -EAPI void -elm_access_text_set(Evas_Object *obj, int type, const char *text) +EAPI Evas_Object * +elm_access_object_register(Evas_Object *obj, Evas_Object *parent) { - _elm_access_text_set(_elm_access_object_get(obj), type, text); + return _access_object_register(obj, parent); } -EAPI char * -elm_access_text_get(Evas_Object *obj, int type) +EAPI void +elm_access_object_unregister(Evas_Object *obj) { - return _elm_access_text_get(_elm_access_object_get(obj), type, obj); + _access_object_unregister(obj); } -EAPI void -elm_access_object_register(Evas_Object *parent, Evas_Object *target) +EAPI Evas_Object * +elm_access_object_get(const Evas_Object *obj) { - Elm_Access_Info *ai; - - if (!parent || !target) return; - - evas_object_event_callback_add(target, EVAS_CALLBACK_MOUSE_IN, - _access_obj_mouse_in_cb, target); - evas_object_event_callback_add(target, EVAS_CALLBACK_MOUSE_OUT, - _access_obj_mouse_out_cb, target); - evas_object_event_callback_add(target, EVAS_CALLBACK_DEL, - _access_obj_del_cb, target); - ai = calloc(1, sizeof(Elm_Access_Info)); - evas_object_data_set(target, "_elm_access", ai); - - //TODO: evas_object_data_del(); parent should take care of children. - evas_object_data_set(target, "_elm_access_parent", parent); + return evas_object_data_get(obj, "_part_access_obj"); } EAPI void -elm_access_object_unregister(Evas_Object *obj) +elm_access_info_set(Evas_Object *obj, int type, const char *text) { - Elm_Access_Info *ac; - - evas_object_event_callback_del_full(obj, EVAS_CALLBACK_MOUSE_IN, - _access_obj_mouse_in_cb, obj); - evas_object_event_callback_del_full(obj, EVAS_CALLBACK_MOUSE_OUT, - _access_obj_mouse_out_cb, obj); - evas_object_event_callback_del_full(obj, EVAS_CALLBACK_DEL, - _access_obj_del_cb, obj); - - ac = evas_object_data_get(obj, "_elm_access"); - evas_object_data_del(obj, "_elm_access"); - if (ac) - { - _elm_access_clear(ac); - free(ac); - } + _elm_access_text_set(_elm_access_object_get(obj), type, text); +} - evas_object_data_del(obj, "_elm_access_parent"); +EAPI char * +elm_access_info_get(const Evas_Object *obj, int type) +{ + return _elm_access_text_get(_elm_access_object_get(obj), type, obj); } EAPI void -elm_access_content_cb_set(Evas_Object *obj, int type, - Elm_Access_Content_Cb func, const void *data) +elm_access_info_cb_set(Evas_Object *obj, int type, + Elm_Access_Info_Cb func, const void *data) { _elm_access_callback_set(_elm_access_object_get(obj), type, func, data); } EAPI void elm_access_activate_cb_set(Evas_Object *obj, - Elm_Access_Activate_Cb func, void *data) + Elm_Access_Activate_Cb func, void *data) { Elm_Access_Info *ac; @@ -861,6 +964,20 @@ elm_access_activate_cb_set(Evas_Object *obj, } EAPI void +elm_access_say(const char *text) +{ + if (!text) return; + + _elm_access_say(text); +} + +EAPI void +elm_access_highlight_set(Evas_Object* obj) +{ + _access_obj_over_timeout_cb(obj); +} + +EAPI void elm_access_external_info_set(Evas_Object *obj, const char *text) { _elm_access_text_set @@ -873,5 +990,5 @@ elm_access_external_info_get(const Evas_Object *obj) Elm_Access_Info *ac; ac = _elm_access_object_get(obj); - return _elm_access_text_get(ac, ELM_ACCESS_CONTEXT_INFO, (Evas_Object *)obj); + return _elm_access_text_get(ac, ELM_ACCESS_CONTEXT_INFO, obj); } diff --git a/src/lib/elm_access.h b/src/lib/elm_access.h index b4978b4..bad553e 100644 --- a/src/lib/elm_access.h +++ b/src/lib/elm_access.h @@ -14,29 +14,41 @@ * then read state out */ #define ELM_ACCESS_CONTEXT_INFO 3 /* to give contextual information */ -typedef char *(*Elm_Access_Content_Cb)(void *data, Evas_Object *obj); +typedef char *(*Elm_Access_Info_Cb)(void *data, Evas_Object *obj); typedef void (*Elm_Access_Activate_Cb)(void *data, Evas_Object *part_obj, Elm_Object_Item *item); /** * @brief Register evas object as an accessible object. * @since 1.8 * - * @param parent Accessibility parent object. this should be one of widget. - * @param target Evas object to register as an accessible object. + * @param obj The evas object to register as an accessible object. + * @param parent The elementary object which is used for creating + * accessible object. * * @ingroup Access */ -EAPI void elm_access_object_register(Evas_Object *parent, Evas_Object *target); +EAPI Evas_Object *elm_access_object_register(Evas_Object *obj, Evas_Object *parent); /** * @brief Unregister accessible object. * @since 1.8 * - * @param obj Accessible object. + * @param obj The Evas object to unregister accessible object. * * @ingroup Access */ -EAPI void elm_access_object_unregister(Evas_Object *target); +EAPI void elm_access_object_unregister(Evas_Object *obj); + +/** + * @brief Get an accessible object of the evas object. + * @since 1.8 + * + * @param obj The evas object. + * @return Accessible object of the evas object or NULL for any error + * + * @ingroup Access + */ +EAPI Evas_Object *elm_access_object_get(const Evas_Object *obj); /** * @brief Set text to give information for specific type. @@ -46,10 +58,10 @@ EAPI void elm_access_object_unregister(Evas_Object *target); * @param type The type of content that will be read * @param text The text information that will be read * - * @see elm_access_content_cb_set + * @see elm_access_info_cb_set * @ingroup Access */ -EAPI void elm_access_text_set(Evas_Object *obj, int type, const char *text); +EAPI void elm_access_info_set(Evas_Object *obj, int type, const char *text); /** * @brief Set text to give information for specific type. @@ -58,10 +70,10 @@ EAPI void elm_access_text_set(Evas_Object *obj, int type, const char *text); * @param obj Accessible object. * @param type The type of content that will be read * - * @see elm_access_content_cb_set + * @see elm_access_info_cb_set * @ingroup Access */ -EAPI char * elm_access_text_get(Evas_Object *obj, int type); +EAPI char *elm_access_info_get(const Evas_Object *obj, int type); /** * @brief Set content callback to give information for specific type. @@ -78,11 +90,11 @@ EAPI char * elm_access_text_get(Evas_Object *obj, int type); * In the case of button widget, the content of ELM_ACCESS_TYPE would be * "button". The label of button such as "ok", "cancel" is for ELM_ACCESS_INFO. * If the button is disabled, content of ELM_ACCESS_STATE would be "disabled". - * And if there is contextual information, ELM_ACCESS_CONTEXT_INFO is used. + * And if there is contextual information, use ELM_ACCESS_CONTEXT_INFO. * * @ingroup Access */ -EAPI void elm_access_content_cb_set(Evas_Object *obj, int type, Elm_Access_Content_Cb func, const void *data); +EAPI void elm_access_info_cb_set(Evas_Object *obj, int type, Elm_Access_Info_Cb func, const void *data); /** * @brief Set activate callback to activate highlight object. @@ -96,6 +108,31 @@ EAPI void elm_access_content_cb_set(Evas_Object *obj, int type, Elm_Access_Conte */ EAPI void elm_access_activate_cb_set(Evas_Object *obj, Elm_Access_Activate_Cb func, void *data); +/** + * @brief Read out text information directly. + * @since 1.8 + * + * @param text The text information that will be read + * + * This function will not free the @p text internally. + * + * @ingroup Access + */ +EAPI void elm_access_say(const char *text); + +/** + * @brief Give the highlight to the object directly. + * @since 1.8 + * + * @param obj The object that will have the highlight and its information be read. + * + * The object should be an elementary object or an access object. + * + * @see elm_access_object_get + * @ingroup Access + */ +EAPI void elm_access_highlight_set(Evas_Object* obj); + //TODO: remvoe below - use elm_access_text_set(); or elm_access_cb_set(); EINA_DEPRECATED EAPI void elm_access_external_info_set(Evas_Object *obj, const char *text); -EINA_DEPRECATED EAPI char * elm_access_external_info_get(const Evas_Object *obj); +EINA_DEPRECATED EAPI char *elm_access_external_info_get(const Evas_Object *obj); diff --git a/src/lib/elm_button.c b/src/lib/elm_button.c index e4706af..71e831e 100644 --- a/src/lib/elm_button.c +++ b/src/lib/elm_button.c @@ -78,8 +78,12 @@ _elm_button_smart_activate(Evas_Object *obj, Elm_Activate act) { if (act != ELM_ACTIVATE_DEFAULT) return EINA_FALSE; - evas_object_smart_callback_call(obj, SIG_CLICKED, NULL); - elm_layout_signal_emit(obj, "elm,anim,activate", "elm"); + if (!elm_widget_disabled_get(obj) && + !evas_object_freeze_events_get(obj)) + { + evas_object_smart_callback_call(obj, SIG_CLICKED, NULL); + elm_layout_signal_emit(obj, "elm,anim,activate", "elm"); + } return EINA_TRUE; } diff --git a/src/lib/elm_check.c b/src/lib/elm_check.c index 96371f0..9feeba1 100644 --- a/src/lib/elm_check.c +++ b/src/lib/elm_check.c @@ -2,6 +2,8 @@ #include "elm_priv.h" #include "elm_widget_check.h" +#define _TIZEN_ + EAPI const char ELM_CHECK_SMART_NAME[] = "elm_check"; static const Elm_Layout_Part_Alias_Description _content_aliases[] = @@ -259,6 +261,28 @@ _on_check_toggle(void *data, _activate(data); } +#ifdef _TIZEN_ +static void _check_drag_start(void *data, + Evas_Object *o __UNUSED__, + const char *emission __UNUSED__, + const char *source __UNUSED__) +{ + Evas_Object *obj = data; + + elm_widget_scroll_freeze_push(obj); +} + +static void _check_drag_stop(void *data, + Evas_Object *o __UNUSED__, + const char *emission __UNUSED__, + const char *source __UNUSED__) +{ + Evas_Object *obj = data; + + elm_widget_scroll_freeze_pop(obj); +} +#endif + static void _elm_check_smart_add(Evas_Object *obj) { @@ -276,6 +300,15 @@ _elm_check_smart_add(Evas_Object *obj) (ELM_WIDGET_DATA(priv)->resize_obj, "elm,action,check,toggle", "", _on_check_toggle, obj); + #ifdef _TIZEN_ + edje_object_signal_callback_add + (ELM_WIDGET_DATA(priv)->resize_obj, "elm,action,check,drag,start", "", + _check_drag_start, obj); + edje_object_signal_callback_add + (ELM_WIDGET_DATA(priv)->resize_obj, "elm,action,check,drag,stop", "", + _check_drag_stop, obj); + #endif + _elm_access_object_register(obj, ELM_WIDGET_DATA(priv)->resize_obj); _elm_access_text_set (_elm_access_object_get(obj), ELM_ACCESS_TYPE, E_("Check")); @@ -290,11 +323,27 @@ _elm_check_smart_add(Evas_Object *obj) elm_layout_sizing_eval(obj); } +#ifdef _TIZEN_ +static void +_elm_check_smart_del(Evas_Object *obj) +{ + + if (0 != elm_widget_scroll_freeze_get(obj)) + elm_widget_scroll_freeze_pop(obj); + + ELM_WIDGET_CLASS(_elm_check_parent_sc)->base.del(obj); +} +#endif + static void _elm_check_smart_set_user(Elm_Check_Smart_Class *sc) { ELM_WIDGET_CLASS(sc)->base.add = _elm_check_smart_add; + #ifdef _TIZEN_ + ELM_WIDGET_CLASS(sc)->base.del = _elm_check_smart_del; + #endif + ELM_WIDGET_CLASS(sc)->theme = _elm_check_smart_theme; ELM_WIDGET_CLASS(sc)->event = _elm_check_smart_event; ELM_WIDGET_CLASS(sc)->sub_object_del = _elm_check_smart_sub_object_del; @@ -397,3 +446,5 @@ elm_check_state_pointer_set(Evas_Object *obj, else sd->statep = NULL; } + +#undef _TIZEN_ diff --git a/src/lib/elm_cnp.c b/src/lib/elm_cnp.c index bfdaf11..8223d3a 100644 --- a/src/lib/elm_cnp.c +++ b/src/lib/elm_cnp.c @@ -162,7 +162,7 @@ static Eina_Bool _x11_text_converter (char *target, void *data, i static Eina_Bool _x11_general_converter (char *target, void *data, int size, void **data_ret, int *size_ret, Ecore_X_Atom *ttype, int *typesize); static Eina_Bool _x11_image_converter (char *target, void *data, int size, void **data_ret, int *size_ret, Ecore_X_Atom *ttype, int *typesize); static Eina_Bool _x11_vcard_send (char *target, void *data, int size, void **data_ret, int *size_ret, Ecore_X_Atom *ttype, int *typesize); -static Eina_Bool _x11_is_uri_type_data (X11_Cnp_Selection *sel __UNUSED__, Ecore_X_Event_Selection_Notify *notify); +//TIZEN ONLY : static Eina_Bool _x11_is_uri_type_data (X11_Cnp_Selection *sel __UNUSED__, Ecore_X_Event_Selection_Notify *notify); static int _x11_response_handler_targets (X11_Cnp_Selection *sel, Ecore_X_Event_Selection_Notify *); static int _x11_notify_handler_targets (X11_Cnp_Selection *sel, Ecore_X_Event_Selection_Notify *notify); static int _x11_notify_handler_text (X11_Cnp_Selection *sel, Ecore_X_Event_Selection_Notify *notify); diff --git a/src/lib/elm_config.c b/src/lib/elm_config.c index 4256296..59f0aa1 100644 --- a/src/lib/elm_config.c +++ b/src/lib/elm_config.c @@ -328,6 +328,7 @@ _desc_init(void) ELM_CONFIG_VAL(D, T, vsync, T_UCHAR); ELM_CONFIG_VAL(D, T, thumbscroll_enable, T_UCHAR); ELM_CONFIG_VAL(D, T, thumbscroll_threshold, T_INT); + ELM_CONFIG_VAL(D, T, thumbscroll_hold_threshold, T_INT); ELM_CONFIG_VAL(D, T, thumbscroll_momentum_threshold, T_DOUBLE); ELM_CONFIG_VAL(D, T, thumbscroll_friction, T_DOUBLE); ELM_CONFIG_VAL(D, T, thumbscroll_bounce_friction, T_DOUBLE); @@ -554,6 +555,8 @@ void _elm_config_access_set(Eina_Bool is_access) if (_elm_config->access_mode == is_access) return; _elm_config->access_mode = is_access; _elm_win_access(is_access); + + if (!is_access) _elm_access_shutdown(); } Eina_Bool _elm_config_selection_unfocused_clear_get(void) @@ -1022,6 +1025,7 @@ _config_load(void) _elm_config->vsync = 0; _elm_config->thumbscroll_enable = EINA_TRUE; _elm_config->thumbscroll_threshold = 24; + _elm_config->thumbscroll_hold_threshold = 24; _elm_config->thumbscroll_momentum_threshold = 100.0; _elm_config->thumbscroll_friction = 1.0; _elm_config->thumbscroll_bounce_friction = 0.5; @@ -1410,6 +1414,8 @@ _env_get(void) if (s) _elm_config->thumbscroll_enable = !!atoi(s); s = getenv("ELM_THUMBSCROLL_THRESHOLD"); if (s) _elm_config->thumbscroll_threshold = atoi(s); + s = getenv("ELM_THUMBSCROLL_HOLD_THRESHOLD"); + if (s) _elm_config->thumbscroll_hold_threshold = atoi(s); // FIXME: floatformat locale issues here 1.0 vs 1,0 - should just be 1.0 s = getenv("ELM_THUMBSCROLL_MOMENTUM_THRESHOLD"); if (s) _elm_config->thumbscroll_momentum_threshold = _elm_atof(s); @@ -2074,6 +2080,18 @@ elm_config_scroll_thumbscroll_threshold_set(unsigned int threshold) _elm_config->thumbscroll_threshold = threshold; } +EAPI unsigned int +elm_config_scroll_thumbscroll_hold_threshold_get(void) +{ + return _elm_config->thumbscroll_hold_threshold; +} + +EAPI void +elm_config_scroll_thumbscroll_hold_threshold_set(unsigned int threshold) +{ + _elm_config->thumbscroll_hold_threshold = threshold; +} + EAPI double elm_config_scroll_thumbscroll_momentum_threshold_get(void) { diff --git a/src/lib/elm_config.h b/src/lib/elm_config.h index 49c4089..2caf9e3 100644 --- a/src/lib/elm_config.h +++ b/src/lib/elm_config.h @@ -316,6 +316,27 @@ EAPI unsigned int elm_config_scroll_thumbscroll_threshold_get(void); EAPI void elm_config_scroll_thumbscroll_threshold_set(unsigned int threshold); /** + * Get the number of pixels the range which can be scrolled, + * while the scroller is holded. + * + * @return the thumb scroll hold threshold + * + * @ingroup Scrolling + */ +EAPI unsigned int elm_config_scroll_thumbscroll_hold_threshold_get(void); + +/** + * Set the number of pixels the range which can be scrolled, + * while the scroller is holded. + * + * @param threshold the thumb scroll hold threshold + * + * @see elm_config_thumbscroll_hold_threshold_get() + * @ingroup Scrolling + */ +EAPI void elm_config_scroll_thumbscroll_hold_threshold_set(unsigned int threshold); + +/** * Get the minimum speed of mouse cursor movement which will trigger * list self scrolling animation after a mouse up event * (pixels/second). diff --git a/src/lib/elm_conform.c b/src/lib/elm_conform.c index d90cd56..0014ff0 100644 --- a/src/lib/elm_conform.c +++ b/src/lib/elm_conform.c @@ -125,9 +125,9 @@ _conformant_part_sizing_eval(Evas_Object *obj, #ifdef HAVE_ELEMENTARY_X Ecore_X_Window zone = 0; Evas_Object *top; + Ecore_X_Window xwin; #endif int sx = -1, sy = -1, sw = -1, sh = -1; - Ecore_X_Window xwin; ELM_CONFORMANT_DATA_GET(obj, sd); @@ -166,13 +166,23 @@ _conformant_part_sizing_eval(Evas_Object *obj, { #ifdef HAVE_ELEMENTARY_X //No information of the keyboard geometry, reset the geometry. - if (!ecore_x_e_illume_keyboard_geometry_get - (zone, &sx, &sy, &sw, &sh)) - sx = sy = sw = sh = 0; +#ifdef __linux__ + DBG("[KEYPAD]:pid=%d, xwin=0x%x, zone=0x%x: no env value and check window property.", getpid(), xwin, zone); +#endif + if (!ecore_x_e_illume_keyboard_geometry_get(xwin, &sx, &sy, &sw, &sh)) + { + DBG("[KEYPAD]:no window property, check zone property."); + if (!ecore_x_e_illume_keyboard_geometry_get(zone, &sx, &sy, &sw, &sh)) + { + DBG("[KEYPAD]:no zone property, reset value."); + sx = sy = sw = sh = 0; + } + } #else ; #endif } + DBG("[KEYPAD]: size(%d,%d, %dx%d).", sx, sy, sw, sh); _conformant_part_size_hints_set (obj, sd->virtualkeypad, sx, sy, sw, sh); } @@ -421,10 +431,46 @@ _access_obj_process(Evas_Object *obj, Eina_Bool is_access) } } +static const char PLUG_KEY[] = "__Plug_Ecore_Evas"; +// procotol version - change this as needed +#define MSG_DOMAIN_CONTROL_INDICATOR 0x10001 +#define MSG_ID_INDICATOR_REPEAT_EVENT 0x10002 +#define MSG_ID_INDICATOR_ROTATION 0x10003 +#define MSG_ID_INDICATOR_OPACITY 0X1004 +#define MSG_ID_INDICATOR_TYPE 0X1005 + +static void +_plug_msg_handle(Ecore_Evas *ee, int msg_domain, int msg_id, void *data, int size) +{ + Evas_Object *conformant; + + if (!data) return; + DBG("Receive msg from plug ee=%p msg_domain=%x msg_id=%x size=%d", ee, msg_domain, msg_id, size); + //get plug object form ee + conformant = (Evas_Object *)ecore_evas_data_get(ee, CONFORMANT_KEY); + ELM_CONFORMANT_DATA_GET(conformant, sd); + if (msg_domain == MSG_DOMAIN_CONTROL_INDICATOR) + { + if (msg_id == MSG_ID_INDICATOR_REPEAT_EVENT) + { + int *repeat = data; + DBG("Receive repeat event change message:(%d)", *repeat); + } + if (msg_id == MSG_ID_INDICATOR_TYPE) + { + Elm_Win_Indicator_Type_Mode *indi_t_mode = data; + Evas_Object *win = elm_widget_top_get(conformant); + DBG("Receive indicator type change message:(%d)", *indi_t_mode); + elm_win_indicator_type_set(win, *indi_t_mode); + } + } +} + static Evas_Object * _create_portrait_indicator(Evas_Object *obj) { Evas_Object *port_indicator = NULL; + Ecore_Evas *indicator_ee = NULL; const char *port_indicator_serv_name; ELM_CONFORMANT_DATA_GET(obj, sd); @@ -449,6 +495,15 @@ _create_portrait_indicator(Evas_Object *obj) return NULL; } + //callback to deal with extn socket message + indicator_ee = ecore_evas_object_ecore_evas_get(elm_plug_image_object_get(port_indicator)); + DBG("This is portrait indicator's ee=%p.", indicator_ee); + ecore_evas_callback_msg_handle_set(indicator_ee, _plug_msg_handle); + ecore_evas_data_set(indicator_ee, CONFORMANT_KEY, obj); + + DBG("The rotation value of portrait indicator was changed:(%d)", sd->rot); + ecore_evas_msg_parent_send(indicator_ee, MSG_DOMAIN_CONTROL_INDICATOR, MSG_ID_INDICATOR_ROTATION, &(sd->rot), sizeof(int)); + elm_widget_sub_object_add(obj, port_indicator); evas_object_smart_callback_add(port_indicator, "image.deleted", _port_indicator_disconnected, obj); @@ -464,6 +519,7 @@ _create_portrait_indicator(Evas_Object *obj) static Evas_Object * _create_landscape_indicator(Evas_Object *obj) { + Ecore_Evas *indicator_ee = NULL; Evas_Object *land_indicator = NULL; const char *land_indicator_serv_name; @@ -489,6 +545,14 @@ _create_landscape_indicator(Evas_Object *obj) return NULL; } + //callback to deal with extn socket message + indicator_ee = ecore_evas_object_ecore_evas_get(elm_plug_image_object_get(land_indicator)); + ecore_evas_data_set(indicator_ee, CONFORMANT_KEY, obj); + DBG("This is landscape indicator's ee=%p.", indicator_ee); + ecore_evas_callback_msg_handle_set(indicator_ee, _plug_msg_handle); + DBG("The rotation value of landscape indicator was changed:(%d)", sd->rot); + ecore_evas_msg_parent_send(indicator_ee, MSG_DOMAIN_CONTROL_INDICATOR, MSG_ID_INDICATOR_ROTATION, &(sd->rot), sizeof(int)); + elm_widget_sub_object_add(obj, land_indicator); evas_object_smart_callback_add(land_indicator, "image.deleted",_land_indicator_disconnected, obj); @@ -562,6 +626,21 @@ _indicator_opacity_set(Evas_Object *conformant, Elm_Win_Indicator_Opacity_Mode i ELM_CONFORMANT_DATA_GET(conformant, sd); sd->ind_o_mode = ind_o_mode; //TODO: opacity change + //send indicator information + if (sd->landscape_indicator) + { + Ecore_Evas *indicator_ee = NULL; + DBG("The opacity mode of landscape indicator was changed:(%d)", ind_o_mode); + indicator_ee = ecore_evas_object_ecore_evas_get(elm_plug_image_object_get(sd->landscape_indicator)); + ecore_evas_msg_parent_send(indicator_ee, MSG_DOMAIN_CONTROL_INDICATOR, MSG_ID_INDICATOR_OPACITY, &(sd->ind_o_mode), sizeof(Elm_Win_Indicator_Opacity_Mode)); + } + if (sd->portrait_indicator) + { + Ecore_Evas *indicator_ee = NULL; + DBG("The opacity mode of portrait indicator was changed:(%d)", ind_o_mode); + indicator_ee = ecore_evas_object_ecore_evas_get(elm_plug_image_object_get(sd->portrait_indicator)); + ecore_evas_msg_parent_send(indicator_ee, MSG_DOMAIN_CONTROL_INDICATOR, MSG_ID_INDICATOR_OPACITY, &(sd->ind_o_mode), sizeof(Elm_Win_Indicator_Opacity_Mode)); + } } static void @@ -579,14 +658,10 @@ _on_indicator_mode_changed(void *data, indmode = elm_win_indicator_mode_get(win); ind_o_mode = elm_win_indicator_opacity_get(win); - if (indmode == sd->indmode) - { - if (ind_o_mode == sd->ind_o_mode) return; - else _indicator_opacity_set(conformant, ind_o_mode); - } - else + if (indmode != sd->indmode) _indicator_mode_set(conformant, indmode); - + if (ind_o_mode != sd->ind_o_mode) + _indicator_opacity_set(conformant, ind_o_mode); } static void @@ -606,6 +681,21 @@ _on_rotation_changed(void *data, if (rot == sd->rot) return; sd->rot = rot; + //send indicator information + if (sd->landscape_indicator) + { + Ecore_Evas *indicator_ee = NULL; + DBG("The rotation value of landscape indicator was changed:(%d)", rot); + indicator_ee = ecore_evas_object_ecore_evas_get(elm_plug_image_object_get(sd->landscape_indicator)); + ecore_evas_msg_parent_send(indicator_ee, MSG_DOMAIN_CONTROL_INDICATOR, MSG_ID_INDICATOR_ROTATION, &(sd->rot), sizeof(int)); + } + if (sd->portrait_indicator) + { + Ecore_Evas *indicator_ee = NULL; + DBG("The rotation value of portrait indicator was changed:(%d)", rot); + indicator_ee = ecore_evas_object_ecore_evas_get(elm_plug_image_object_get(sd->portrait_indicator)); + ecore_evas_msg_parent_send(indicator_ee, MSG_DOMAIN_CONTROL_INDICATOR, MSG_ID_INDICATOR_ROTATION, &(sd->rot), sizeof(int)); + } old_indi = elm_layout_content_unset(conformant, INDICATOR_PART); /* this means ELM_WIN_INDICATOR_SHOW never be set.we don't need to change indicator type*/ if (!old_indi) return; @@ -809,15 +899,22 @@ _virtualkeypad_state_change(Evas_Object *obj, Ecore_X_Event_Window_Property *ev) Ecore_X_Window zone = ecore_x_e_illume_zone_get(ev->win); Ecore_X_Virtual_Keyboard_State state = - ecore_x_e_virtual_keyboard_state_get(zone); + ecore_x_e_virtual_keyboard_state_get(ev->win); + + DBG("[KEYPAD]:window's state win=0x%x, state=%d.", ev->win, state); + if (state == ECORE_X_VIRTUAL_KEYBOARD_STATE_UNKNOWN) + { + state = ecore_x_e_virtual_keyboard_state_get(zone); + DBG("[KEYPAD]:zone's state zone=0x%x, state=%d.", zone, state); + } if (sd->vkb_state == state) return; sd->vkb_state = state; if (state == ECORE_X_VIRTUAL_KEYBOARD_STATE_OFF) { - evas_object_size_hint_min_set(sd->virtualkeypad, -1, 0); - evas_object_size_hint_max_set(sd->virtualkeypad, -1, 0); + DBG("[KEYPAD]:ECORE_X_VIRTUAL_KEYBOARD_STATE_OFF"); + _conformant_part_sizing_eval(obj, ELM_CONFORMANT_VIRTUAL_KEYPAD_PART); // Tizen Only - SIP regions for virtual keypad and clipboard are the same in Tizen if (sd->clipboard_state == ECORE_X_ILLUME_CLIPBOARD_STATE_OFF) elm_widget_display_mode_set(obj, EVAS_DISPLAY_MODE_NONE); @@ -825,6 +922,8 @@ _virtualkeypad_state_change(Evas_Object *obj, Ecore_X_Event_Window_Property *ev) } else if (state == ECORE_X_VIRTUAL_KEYBOARD_STATE_ON) { + DBG("[KEYPAD]:ECORE_X_VIRTUAL_KEYBOARD_STATE_ON"); + _conformant_part_sizing_eval(obj, ELM_CONFORMANT_VIRTUAL_KEYPAD_PART); elm_widget_display_mode_set(obj, EVAS_DISPLAY_MODE_COMPRESS); _autoscroll_objects_update(obj); evas_object_smart_callback_call(obj, SIG_VIRTUALKEYPAD_STATE_ON, NULL); @@ -838,7 +937,15 @@ _clipboard_state_change(Evas_Object *obj, Ecore_X_Event_Window_Property *ev) Ecore_X_Window zone = ecore_x_e_illume_zone_get(ev->win); Ecore_X_Illume_Clipboard_State state = - ecore_x_e_illume_clipboard_state_get(zone); + ecore_x_e_illume_clipboard_state_get(ev->win); + + DBG("[CLIPBOARD]:window's state win=0x%x, state=%d.", ev->win, state); + + if (state == ECORE_X_ILLUME_CLIPBOARD_STATE_UNKNOWN) + { + state = ecore_x_e_illume_clipboard_state_get(ev->win); + DBG("[CLIPBOARD]:zone's state zone=0x%x, state=%d.", zone, state); + } if (sd->clipboard_state == state) return; sd->clipboard_state = state; @@ -867,8 +974,15 @@ _on_prop_change(void *data, { Ecore_X_Event_Window_Property *ev = event; + int pid = 0; + +#ifdef __linux__ + pid = (int)getpid(); +#endif + if (ev->atom == ECORE_X_ATOM_E_ILLUME_ZONE) { + DBG("pid=%d, win=0x%x, ECORE_X_ATOM_E_ILLUME_ZONE.\n", pid, ev->win); Conformant_Part_Type part_type; part_type = (ELM_CONFORMANT_INDICATOR_PART | @@ -879,17 +993,35 @@ _on_prop_change(void *data, _conformant_part_sizing_eval(data, part_type); } else if (ev->atom == ECORE_X_ATOM_E_ILLUME_INDICATOR_GEOMETRY) - _conformant_part_sizing_eval(data, ELM_CONFORMANT_INDICATOR_PART); + { + DBG("pid=%d, win=0x%x, ECORE_X_ATOM_E_ILLUME_INDICATOR_GEOMETRY.", pid, ev->win); + _conformant_part_sizing_eval(data, ELM_CONFORMANT_INDICATOR_PART); + } else if (ev->atom == ECORE_X_ATOM_E_ILLUME_SOFTKEY_GEOMETRY) - _conformant_part_sizing_eval(data, ELM_CONFORMANT_SOFTKEY_PART); + { + DBG("pid=%d, win=0x%x, ECORE_X_ATOM_E_ILLUME_SOFTKEY_GEOMETRY.", pid, ev->win); + _conformant_part_sizing_eval(data, ELM_CONFORMANT_SOFTKEY_PART); + } else if (ev->atom == ECORE_X_ATOM_E_ILLUME_KEYBOARD_GEOMETRY) - _conformant_part_sizing_eval(data, ELM_CONFORMANT_VIRTUAL_KEYPAD_PART); + { + DBG("[KEYPAD]:pid=%d, win=0x%x, ECORE_X_ATOM_E_ILLUME_KEYBOARD_GEOMETRY.", pid, ev->win); + _conformant_part_sizing_eval(data, ELM_CONFORMANT_VIRTUAL_KEYPAD_PART); + } else if (ev->atom == ECORE_X_ATOM_E_ILLUME_CLIPBOARD_GEOMETRY) - _conformant_part_sizing_eval(data, ELM_CONFORMANT_CLIPBOARD_PART); + { + DBG("pid=%d, win=0x%x, ECORE_X_ATOM_E_ILLUME_CLIPBOARD_GEOMETRY.", pid, ev->win); + _conformant_part_sizing_eval(data, ELM_CONFORMANT_CLIPBOARD_PART); + } else if (ev->atom == ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_STATE) - _virtualkeypad_state_change(data, ev); + { + DBG("[KEYPAD]:pid=%d, win=0x%x, ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_STATE.", pid, ev->win); + _virtualkeypad_state_change(data, ev); + } else if (ev->atom == ECORE_X_ATOM_E_ILLUME_CLIPBOARD_STATE) - _clipboard_state_change(data, ev); + { + DBG("pid=%d, win=0x%x, ECORE_X_ATOM_E_ILLUME_CLIPBOARD_STATE.", pid, ev->win); + _clipboard_state_change(data, ev); + } return ECORE_CALLBACK_PASS_ON; } diff --git a/src/lib/elm_datetime.c b/src/lib/elm_datetime.c index 55c4a8a..4c88c83 100644 --- a/src/lib/elm_datetime.c +++ b/src/lib/elm_datetime.c @@ -493,7 +493,7 @@ _elm_datetime_smart_theme(Evas_Object *obj) elm_layout_signal_emit(obj, buf, "elm"); snprintf - (buf, sizeof(buf), EDC_PART_SEPARATOR_STR, field->location); + (buf, sizeof(buf), EDC_PART_SEPARATOR_STR, (field->location + 1)); elm_layout_text_set(obj, buf, field->separator); dt_mod->field_value_display(sd->mod_data, field->item_obj); diff --git a/src/lib/elm_entry.c b/src/lib/elm_entry.c index 2c85513..f5b5c6a 100644 --- a/src/lib/elm_entry.c +++ b/src/lib/elm_entry.c @@ -190,7 +190,7 @@ _cbhm_msg_send(Evas_Object *obj, char *msg) } static Eina_Bool -_xclient_msg_cb(void *data, int type, void *event) +_xclient_msg_cb(void *data, int type __UNUSED__, void *event) { #ifdef HAVE_ELEMENTARY_X Evas_Object *obj = (Evas_Object *)data; @@ -315,9 +315,11 @@ _magnifier_create(void *data) sd->mgf_bg = edje_object_add(evas_object_evas_get(data)); if (sd->mgf_type == _ENTRY_MAGNIFIER_FIXEDSIZE) - _elm_theme_object_set(data, sd->mgf_bg, "entry", "magnifier", "fixed-size"); + _elm_theme_object_set(data, sd->mgf_bg, "entry", "magnifier", + "fixed-size"); else if (sd->mgf_type == _ENTRY_MAGNIFIER_FILLWIDTH) - _elm_theme_object_set(data, sd->mgf_bg, "entry", "magnifier", "fill-width"); + _elm_theme_object_set(data, sd->mgf_bg, "entry", "magnifier", + "fill-width"); else return; @@ -1027,6 +1029,10 @@ _elm_entry_smart_theme(Evas_Object *obj) evas_event_freeze(evas_object_evas_get(obj)); + // TIZEN ONLY(130129) : Currently, for freezing cursor movement only. + edje_object_part_text_freeze(sd->entry_edje, "elm.text"); + // + edje_object_mirrored_set (ELM_WIDGET_DATA(sd)->resize_obj, elm_widget_mirrored_get(obj)); @@ -1036,7 +1042,11 @@ _elm_entry_smart_theme(Evas_Object *obj) _mirrored_set(obj, elm_widget_mirrored_get(obj)); - t = eina_stringshare_add(elm_object_text_get(obj)); + // TIZEN ONLY(130225) : when password mode, elm_object_text_get returns utf8 string. + if (sd->password) + t = eina_stringshare_add(elm_entry_utf8_to_markup(elm_object_text_get(obj))); + else + t = eina_stringshare_add(elm_object_text_get(obj)); elm_widget_theme_object_set (obj, sd->entry_edje, "entry", _elm_entry_theme_group_get(obj), @@ -1099,6 +1109,10 @@ _elm_entry_smart_theme(Evas_Object *obj) evas_event_thaw(evas_object_evas_get(obj)); evas_event_thaw_eval(evas_object_evas_get(obj)); + // TIZEN ONLY(130129) : Currently, for freezing cursor movement only. + edje_object_part_text_thaw(sd->entry_edje, "elm.text"); + // + evas_object_smart_callback_call(obj, SIG_THEME_CHANGED, NULL); return EINA_TRUE; @@ -2780,7 +2794,7 @@ _event_selection_clear(void *data __UNUSED__, formats |= ELM_SEL_FORMAT_IMAGE; elm_cnp_selection_get(data, ELM_SEL_TYPE_SECONDARY, formats, NULL, NULL); - return ECORE_CALLBACK_DONE; + return ECORE_CALLBACK_DONE; } /////////// #endif @@ -3342,7 +3356,7 @@ _access_info_cb(void *data __UNUSED__, Evas_Object *obj) txt = elm_widget_access_info_get(obj); - if (!txt) txt = elm_entry_entry_get(obj); + if (!txt) txt = _elm_util_mkup_to_text(elm_entry_entry_get(obj)); if (txt) return strdup(txt); return NULL; @@ -3352,10 +3366,11 @@ static char * _access_state_cb(void *data __UNUSED__, Evas_Object *obj) { Eina_Strbuf *buf; - char *txt; + char *ret; ELM_ENTRY_DATA_GET(obj, sd); + ret = NULL; buf = eina_strbuf_new(); if (elm_widget_disabled_get(obj)) @@ -3375,11 +3390,13 @@ _access_state_cb(void *data __UNUSED__, Evas_Object *obj) else eina_strbuf_append(buf, ", Password"); } - txt = strdup(eina_strbuf_string_get(buf)); - eina_strbuf_free(buf); - if (txt) return txt; + if (!eina_strbuf_length_get(buf)) goto buf_free; - return NULL; + ret = eina_strbuf_string_steal(buf); + +buf_free: + eina_strbuf_free(buf); + return ret; } static void diff --git a/src/lib/elm_flip.c b/src/lib/elm_flip.c index 096304b..26e7a16 100644 --- a/src/lib/elm_flip.c +++ b/src/lib/elm_flip.c @@ -670,6 +670,8 @@ _state_update(Elm_Flip_Smart_Data *sd) { Vertex3 vo[4]; + memset(vo, 0, sizeof (vo)); + if (b > 0) nn = num + sd->slices_h - row - 1; else nn = num + row; @@ -876,10 +878,7 @@ _flip_show_hide(Evas_Object *obj) } else { - if (sd->front.content) - evas_object_show(sd->front.clip); - else - evas_object_hide(sd->front.clip); + evas_object_hide(sd->front.clip); if (sd->back.content) evas_object_show(sd->back.clip); else diff --git a/src/lib/elm_gen_common.h b/src/lib/elm_gen_common.h index f376956..e14433c 100644 --- a/src/lib/elm_gen_common.h +++ b/src/lib/elm_gen_common.h @@ -68,4 +68,49 @@ struct Elm_Gen_Item Eina_Bool flipped : 1; /**< a flag that shows the flip status of the item. */ }; +typedef enum +{ + ELM_GEN_ITEM_FX_TYPE_SAME, + ELM_GEN_ITEM_FX_TYPE_ADD, + ELM_GEN_ITEM_FX_TYPE_DEL, +} Elm_Gen_Item_Fx_Type; + +typedef struct _Proxy_Item Proxy_Item; +struct _Proxy_Item +{ + int num; + Elm_Gen_Item *it; + Evas_Object *proxy; + Evas_Coord x, y, w, h; +}; + +typedef struct _Elm_Gen_FX_Item Elm_Gen_FX_Item; +struct _Elm_Gen_FX_Item +{ + int num; + Elm_Gen_Item *it; + Evas_Object *proxy; + Elm_Gen_Item_Fx_Type type; + Elm_Transit *trans; + + struct + { + Evas_Coord x, y, w, h; + } from; + + struct + { + Evas_Coord x, y, w, h; + } to; + + Eina_Bool update : 1; +}; + +typedef enum +{ + ELM_GEN_PINCH_ZOOM_NONE = 0, + ELM_GEN_PINCH_ZOOM_CONTRACT = 1, + ELM_GEN_PINCH_ZOOM_EXPAND = 2 +} Elm_Gen_Pinch_Zoom_Mode; + #endif diff --git a/src/lib/elm_gengrid.c b/src/lib/elm_gengrid.c index 2e11d03..bef3260 100644 --- a/src/lib/elm_gengrid.c +++ b/src/lib/elm_gengrid.c @@ -13,6 +13,7 @@ #define PRELOAD 1 #define REORDER_EFFECT_TIME 0.5 +#define FX_MOVE_TIME 0.5 EAPI const char ELM_GENGRID_SMART_NAME[] = "elm_gengrid"; EAPI const char ELM_GENGRID_PAN_SMART_NAME[] = "elm_gengrid_pan"; @@ -90,6 +91,11 @@ ELM_INTERNAL_SMART_SUBCLASS_NEW (ELM_GENGRID_PAN_SMART_NAME, _elm_gengrid_pan, Elm_Gengrid_Pan_Smart_Class, Elm_Pan_Smart_Class, elm_pan_smart_class_get, NULL); +#if GENGRID_FX_SUPPORT +static Eina_Bool _elm_gengrid_fx_capture(Evas_Object *obj, int level); +static void _elm_gengrid_fx_play(Evas_Object *obj); +#endif + static void _elm_gengrid_pan_smart_pos_max_get(const Evas_Object *obj, Evas_Coord *x, @@ -104,7 +110,8 @@ _item_show_region(void *data) { Elm_Gengrid_Smart_Data *sd = data; Evas_Coord cvw, cvh, it_xpos = 0, it_ypos = 0, col = 0, row = 0, minx = 0, miny = 0; - Elm_Gen_Item *it, *group_item = NULL; + Evas_Coord vw = 0, vh = 0; + Elm_Gen_Item *it; evas_object_geometry_get(sd->pan_obj, NULL, NULL, &cvw, &cvh); @@ -151,18 +158,18 @@ _item_show_region(void *data) it->y = y; } + sd->s_iface->content_viewport_size_get(WIDGET(it), &vw, &vh); + if (sd->show_region) { sd->s_iface->content_region_show(WIDGET(it), - it_xpos, it_ypos, sd->item_width, - sd->item_height); + it_xpos, it_ypos, vw, vh); sd->show_region = EINA_FALSE; } if (sd->bring_in) { sd->s_iface->region_bring_in(WIDGET(it), - it_xpos, it_ypos, sd->item_width, - sd->item_height); + it_xpos, it_ypos, vw, vh); sd->bring_in = EINA_FALSE; } } @@ -172,7 +179,7 @@ static void _calc_job(void *data) { Elm_Gengrid_Smart_Data *sd = data; - Evas_Coord minw = 0, minh = 0, nmax = 0, cvw, cvh, it_xpos = 0, it_ypos = 0, col = 0, row = 0, minx = 0, miny = 0; + Evas_Coord minw = 0, minh = 0, nmax = 0, cvw, cvh; Elm_Gen_Item *it, *group_item = NULL; int count_group = 0; long count = 0; @@ -520,7 +527,15 @@ _elm_gengrid_item_unrealize(Elm_Gen_Item *it, if (!it->realized) return; if (GG_IT(it)->wsd->reorder_it == it) return; - +#if GENGRID_FX_SUPPORT + if ((GG_IT(it)->has_proxy_it) && (!GG_IT(it)->wsd->gengrid_clearing)) + { + if (!eina_list_data_find(GG_IT(it)->wsd->pending_unrealized_items, it)) + GG_IT(it)->wsd->pending_unrealized_items = + eina_list_append(GG_IT(it)->wsd->pending_unrealized_items, it); + return; + } +#endif evas_event_freeze(evas_object_evas_get(WIDGET(it))); if (!calc) evas_object_smart_callback_call(WIDGET(it), SIG_UNREALIZED, it); @@ -761,6 +776,9 @@ _item_realize(Elm_Gen_Item *it) evas_object_size_hint_min_set(it->spacer, 2 * elm_config_scale_get(), 1); edje_object_part_swallow(VIEW(it), "elm.swallow.pad", it->spacer); + /* access */ + if (_elm_config->access_mode) _access_widget_item_register(it); + if (it->itc->func.text_get) { const Eina_List *l; @@ -878,10 +896,6 @@ _item_realize(Elm_Gen_Item *it) it->realized = EINA_TRUE; it->want_unrealize = EINA_FALSE; - - // ACCESS - if (_elm_config->access_mode == ELM_ACCESS_MODE_ON) - _access_widget_item_register(it); } static Eina_Bool @@ -1258,6 +1272,13 @@ _item_place(Elm_Gen_Item *it, } if (!it->group) { + +#if GENGRID_FX_SUPPORT + GG_IT(it)->scrl_x = x; + GG_IT(it)->scrl_y = y; + GG_IT(it)->w = iw; + GG_IT(it)->h = ih; +#endif evas_object_move(VIEW(it), x, y); evas_object_resize(VIEW(it), iw, ih); } @@ -1319,6 +1340,10 @@ _elm_gengrid_pan_smart_calculate(Evas_Object *obj) ELM_GENGRID_PAN_DATA_GET(obj, psd); +#if GENGRID_FX_SUPPORT + if (psd->wsd->fx_playing) return; +#endif + if (!psd->wsd->nmax) return; psd->wsd->reorder_item_changed = EINA_FALSE; @@ -1388,6 +1413,15 @@ _elm_gengrid_pan_smart_calculate(Evas_Object *obj) (ELM_WIDGET_DATA(psd->wsd)->obj, SIG_CHANGED, NULL); if ((psd->wsd->show_region || psd->wsd->bring_in)) _item_show_region(psd->wsd); + +#if GENGRID_FX_SUPPORT + psd->wsd->rendered = EINA_TRUE; + if (psd->wsd->fx_mode) + { + if (_elm_gengrid_fx_capture(ELM_WIDGET_DATA(psd->wsd)->obj, 1)) + _elm_gengrid_fx_play(ELM_WIDGET_DATA(psd->wsd)->obj); + } +#endif } static void @@ -1878,7 +1912,7 @@ _elm_gengrid_smart_event(Evas_Object *obj, else return EINA_FALSE; ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD; - sd->s_iface->content_pos_set(obj, x, y); + sd->s_iface->content_pos_set(obj, x, y, EINA_TRUE); return EINA_TRUE; } @@ -1981,11 +2015,13 @@ _elm_gengrid_item_del_not_serious(Elm_Gen_Item *it) } static void -_elm_gengrid_item_del_serious(Elm_Gen_Item *it) +_elm_gengrid_item_del_common(Elm_Gen_Item *it) { _elm_gengrid_item_del_not_serious(it); + GG_IT(it)->wsd->items = eina_inlist_remove - (GG_IT(it)->wsd->items, EINA_INLIST_GET(it)); + (GG_IT(it)->wsd->items, EINA_INLIST_GET(it)); + if (it->tooltip.del_cb) it->tooltip.del_cb((void *)it->tooltip.data, WIDGET(it), it); GG_IT(it)->wsd->walking -= it->walking; @@ -1996,7 +2032,7 @@ _elm_gengrid_item_del_serious(Elm_Gen_Item *it) } if (it->group) GG_IT(it)->wsd->group_items = - eina_list_remove(GG_IT(it)->wsd->group_items, it); + eina_list_remove(GG_IT(it)->wsd->group_items, it); if (GG_IT(it)->wsd->state) { @@ -2005,12 +2041,22 @@ _elm_gengrid_item_del_serious(Elm_Gen_Item *it) } if (GG_IT(it)->wsd->calc_job) ecore_job_del(GG_IT(it)->wsd->calc_job); GG_IT(it)->wsd->calc_job = - ecore_job_add(GG_IT(it)->wsd->calc_cb, GG_IT(it)->wsd); + ecore_job_add(GG_IT(it)->wsd->calc_cb, GG_IT(it)->wsd); if (GG_IT(it)->wsd->last_selected_item == (Elm_Object_Item *)it) GG_IT(it)->wsd->last_selected_item = NULL; GG_IT(it)->wsd->item_count--; +} +static void +_elm_gengrid_item_del_serious(Elm_Gen_Item *it) +{ +#if GENGRID_FX_SUPPORT + if ((!GG_IT(it)->wsd->fx_mode) || (GG_IT(it)->wsd->gengrid_clearing)) +#endif + { + _elm_gengrid_item_del_common(it); + } free(it->item); it->item = NULL; } @@ -2021,6 +2067,9 @@ _item_del(Elm_Gen_Item *it) Evas_Object *obj = WIDGET(it); evas_event_freeze(evas_object_evas_get(obj)); +#if GENGRID_FX_SUPPORT + GG_IT(it)->has_proxy_it = EINA_FALSE; +#endif GG_IT(it)->wsd->selected = eina_list_remove(GG_IT(it)->wsd->selected, it); if (it->realized) _elm_gengrid_item_unrealize(it, EINA_FALSE); _elm_gengrid_item_del_serious(it); @@ -2129,18 +2178,46 @@ _item_disable_hook(Elm_Object_Item *item) } } +#if GENGRID_FX_SUPPORT static void +_item_del_pre_fx_process(Elm_Gen_Item *it) +{ + Evas_Object *obj = WIDGET(it); + + _elm_gengrid_fx_capture(ELM_WIDGET_DATA(GG_IT(it)->wsd)->obj, 0); + if (!eina_list_data_find(GG_IT(it)->wsd->pending_del_items, it)) + GG_IT(it)->wsd->pending_del_items = eina_list_append(GG_IT(it)->wsd->pending_del_items, it); + + evas_event_freeze(evas_object_evas_get(obj)); + GG_IT(it)->wsd->selected = eina_list_remove(GG_IT(it)->wsd->selected, it); + + _elm_gengrid_item_del_common(it); + evas_event_thaw(evas_object_evas_get(obj)); + evas_event_thaw_eval(evas_object_evas_get(obj)); +} +#endif + +//static void +static Eina_Bool _item_del_pre_hook(Elm_Object_Item *item) { Elm_Gen_Item *it = (Elm_Gen_Item *)item; +#if GENGRID_FX_SUPPORT + if ((GG_IT(it)->wsd->fx_mode) && (!GG_IT(it)->wsd->gengrid_clearing)) + { + _item_del_pre_fx_process(it); + return EINA_FALSE; + } +#endif if ((it->relcount > 0) || (it->walking > 0)) { _elm_gengrid_item_del_not_serious(it); - return; + return EINA_TRUE; } _item_del(it); + return EINA_TRUE; } static Evas_Object * @@ -2188,11 +2265,46 @@ _elm_gengrid_clear(Evas_Object *obj, return; } evas_event_freeze(evas_object_evas_get(ELM_WIDGET_DATA(sd)->obj)); + +#if GENGRID_FX_SUPPORT + Elm_Gen_FX_Item *fi; + Proxy_Item *pi; + Elm_Gen_Item *it; + + EINA_LIST_FREE(sd->capture_before_items, pi) + { + if (pi->proxy) evas_object_del(pi->proxy); + free(pi); + } + EINA_LIST_FREE(sd->capture_after_items, pi) + { + if (pi->proxy) evas_object_del(pi->proxy); + free(pi); + } + EINA_LIST_FREE(sd->fx_items, fi) + { + if (fi->trans) elm_transit_del(fi->trans); + free(fi); + } + EINA_LIST_FREE (sd->pending_unrealized_items, it) + _elm_gengrid_item_unrealize(it, EINA_FALSE); + EINA_LIST_FREE (sd->pending_del_items, it) + { + _item_del(it); + _elm_widget_item_free((Elm_Widget_Item *)it); + } + sd->gengrid_clearing = EINA_TRUE; + sd->fx_playing = EINA_FALSE; + sd->fx_first_captured = EINA_FALSE; + sd->rendered = EINA_FALSE; + if (sd->alpha_bg) evas_object_del(sd->alpha_bg); +#endif + for (l = sd->items, next = l ? l->next : NULL; l; l = next, next = next ? next->next : NULL) { - Elm_Gen_Item *it = ELM_GEN_ITEM_FROM_INLIST(l); + it = ELM_GEN_ITEM_FROM_INLIST(l); if (it->generation < sd->generation) { @@ -2225,6 +2337,10 @@ _elm_gengrid_clear(Evas_Object *obj, evas_object_smart_callback_call(sd->pan_obj, "changed", NULL); } sd->s_iface->content_region_show(obj, 0, 0, 0, 0); + +#if GENGRID_FX_SUPPORT + sd->gengrid_clearing = EINA_FALSE; +#endif evas_event_thaw(evas_object_evas_get(ELM_WIDGET_DATA(sd)->obj)); evas_event_thaw_eval(evas_object_evas_get(ELM_WIDGET_DATA(sd)->obj)); } @@ -2321,6 +2437,12 @@ _elm_gengrid_item_new(Elm_Gengrid_Smart_Data *sd, it->unsel_cb = (Ecore_Cb)_item_unselect; it->unrealize_cb = (Ecore_Cb)_item_unrealize_cb; +#if GENGRID_FX_SUPPORT + it->item->num = sd->item_count; + if (sd->fx_mode) + _elm_gengrid_fx_capture(ELM_WIDGET_DATA(sd)->obj, 0); +#endif + return it; } @@ -2383,6 +2505,14 @@ _elm_gengrid_smart_add(Evas_Object *obj) priv->align_y = 0.5; priv->highlight = EINA_TRUE; +#if GENGRID_FX_SUPPORT + priv->fx_mode = EINA_FALSE; + priv->rendered = EINA_FALSE; + priv->fx_first_captured = EINA_FALSE; + priv->fx_playing = EINA_FALSE; + priv->gengrid_clearing = EINA_FALSE; +#endif + priv->pan_obj = evas_object_smart_add (evas_object_evas_get(obj), _elm_gengrid_pan_smart_class_new()); pan_data = evas_object_smart_data_get(priv->pan_obj); @@ -3385,11 +3515,10 @@ elm_gengrid_item_prev_get(const Elm_Object_Item *item) EAPI void elm_gengrid_item_show(Elm_Object_Item *item, - Elm_Gengrid_Item_Scrollto_Type type) + Elm_Gengrid_Item_Scrollto_Type type __UNUSED__) { Elm_Gen_Item *it = (Elm_Gen_Item *)item; Elm_Gengrid_Smart_Data *sd; - Evas_Coord minx = 0, miny = 0, x = 0, y = 0; ELM_GENGRID_ITEM_CHECK_OR_RETURN(it); sd = GG_IT(it)->wsd; @@ -3405,10 +3534,9 @@ elm_gengrid_item_show(Elm_Object_Item *item, EAPI void elm_gengrid_item_bring_in(Elm_Object_Item *item, - Elm_Gengrid_Item_Scrollto_Type type) + Elm_Gengrid_Item_Scrollto_Type type __UNUSED__) { Elm_Gengrid_Smart_Data *sd; - Evas_Coord minx = 0, miny = 0, x = 0, y = 0; Elm_Gen_Item *it = (Elm_Gen_Item *)item; ELM_GENGRID_ITEM_CHECK_OR_RETURN(it); @@ -3583,3 +3711,362 @@ elm_gengrid_item_select_mode_get(const Elm_Object_Item *item) return it->select_mode; } + +#if GENGRID_FX_SUPPORT +EAPI void +elm_gengrid_fx_mode_set(Evas_Object *obj, Eina_Bool mode) +{ + ELM_GENGRID_CHECK(obj); + ELM_GENGRID_DATA_GET(obj, sd); + + sd->fx_mode = mode; +} + +EAPI Eina_Bool +elm_gengrid_fx_mode_get(const Evas_Object *obj) +{ + ELM_GENGRID_CHECK(obj) EINA_FALSE; + ELM_GENGRID_DATA_GET(obj, sd); + + return sd->fx_mode; +} + +static Proxy_Item * +_elm_gengrid_proxy_item_new(const Elm_Object_Item *item) +{ + Elm_Gen_Item *it = (Elm_Gen_Item *)item; + if ((!it) || (!it->item)) return EINA_FALSE; + int w, h; + + Proxy_Item *pi = NULL; + pi = calloc(1, sizeof(Proxy_Item)); + if (!pi) return NULL; + + pi->proxy = evas_object_image_filled_add + (evas_object_evas_get(ELM_WIDGET_DATA(GG_IT(it)->wsd)->obj)); + if (!pi->proxy) return EINA_FALSE; + evas_object_clip_set(pi->proxy, evas_object_clip_get(GG_IT(it)->wsd->pan_obj)); + + evas_object_image_source_set(pi->proxy, VIEW(it)); + + GG_IT(it)->has_proxy_it = EINA_TRUE; + pi->it = it; + pi->num = it->item->num; + pi->x = it->item->scrl_x; + pi->y = it->item->scrl_y; + pi->w = it->item->w; + pi->h = it->item->h; + + evas_object_geometry_get(VIEW(it), NULL, NULL, &w, &h); + + if (w <= 0 || h <= 0) + { + evas_object_size_hint_min_get(VIEW(it), &w, &h); + evas_object_size_hint_min_set(pi->proxy, w, h); + } + else evas_object_resize(pi->proxy, w, h); + + return pi; +} + +static Eina_Bool +_elm_gengrid_fx_capture(Evas_Object *obj, int level) +{ + ELM_GENGRID_DATA_GET(obj, sd); + + Elm_Gen_Item *it; + Proxy_Item *pi; + Evas_Coord ox, oy, ow, oh; + + if ((!sd->rendered) || (sd->fx_playing)) return EINA_FALSE; + if ((!level) && (sd->fx_first_captured)) return EINA_FALSE; + if ((level) && (!sd->fx_first_captured)) return EINA_FALSE; + + evas_object_geometry_get(sd->pan_obj, &ox, &oy, &ow, &oh); + + if (!level) + { + sd->fx_first_captured = EINA_TRUE; + EINA_LIST_FREE(sd->capture_before_items, pi) + { + if (pi->proxy) evas_object_del(pi->proxy); + free(pi); + } + } + else + { + EINA_LIST_FREE(sd->capture_after_items, pi) + { + if (pi->proxy) evas_object_del(pi->proxy); + free(pi); + } + } + EINA_INLIST_FOREACH(sd->items, it) + { + if (it->realized) + { + pi = _elm_gengrid_proxy_item_new((Elm_Object_Item *)it); + if (!pi) continue; + if (!level) + sd->capture_before_items = eina_list_append(sd->capture_before_items, pi); + else + sd->capture_after_items = eina_list_append(sd->capture_after_items, pi); + } + } + return EINA_TRUE; +} + +static Elm_Gen_FX_Item * +_elm_gengrid_fx_item_find(const Elm_Object_Item *item) +{ + Elm_Gen_Item *it = (Elm_Gen_Item *)item; + if (!it) return EINA_FALSE; + + Elm_Gengrid_Smart_Data *sd = GG_IT(it)->wsd; + if (!sd) return NULL; + + Elm_Gen_FX_Item *fi = NULL; + Eina_List *l; + + EINA_LIST_FOREACH(sd->fx_items, l, fi) + { + if (fi->it == it) return fi; + } + return NULL; +} + +static Elm_Gen_FX_Item * +_elm_gengrid_fx_item_new(const Proxy_Item *pi) +{ + if ((!pi) || (!pi->it)) return NULL; + + Elm_Gen_FX_Item *fi = NULL; + fi = calloc(1, sizeof(Elm_Gen_FX_Item)); + if (!fi) return NULL; + + fi->it = pi->it; + GG_IT(fi->it)->fi = fi; + fi->proxy = pi->proxy; + fi->num = pi->num; + fi->from.x = fi->to.x = pi->x; + fi->from.y = fi->to.y = pi->y; + fi->from.w = fi->to.w = pi->w; + fi->from.h = fi->to.h = pi->h; + fi->update = EINA_FALSE; + + return fi; +} + +EAPI void +_elm_gengrid_fx_items_make(Evas_Object *obj) +{ + ELM_GENGRID_CHECK(obj); + ELM_GENGRID_DATA_GET(obj, sd); + + Elm_Gen_FX_Item *fi; + Proxy_Item *pi; + Eina_List *l; + Evas_Coord ox, oy, ow, oh; + + evas_object_geometry_get(sd->pan_obj, &ox, &oy, &ow, &oh); + + EINA_LIST_FOREACH(sd->capture_before_items, l, pi) + { + fi = _elm_gengrid_fx_item_new(pi); + if (fi) sd->fx_items = eina_list_append(sd->fx_items, fi); + } + + EINA_LIST_FOREACH(sd->capture_after_items, l, pi) + { + fi = _elm_gengrid_fx_item_find((Elm_Object_Item *)pi->it); + + if (fi) + { + fi->type = ELM_GEN_ITEM_FX_TYPE_SAME; + fi->update = EINA_TRUE; + fi->to.x = pi->x; + fi->to.y = pi->y; + fi->to.w = pi->w; + fi->to.h = pi->h; + } + else + { + fi = _elm_gengrid_fx_item_new(pi); + if (fi) + { + fi->type = ELM_GEN_ITEM_FX_TYPE_ADD; + fi->update = EINA_TRUE; + sd->fx_items = eina_list_append(sd->fx_items, fi); + } + } + } + + EINA_LIST_FOREACH(sd->fx_items, l, fi) + { + if (!fi->update) + { + fi->type = ELM_GEN_ITEM_FX_TYPE_DEL; + fi->update = EINA_TRUE; + } + } +} + +static void +_item_fx_op(Elm_Transit_Effect *data, Elm_Transit *transit __UNUSED__, double progress __UNUSED__) +{ + Elm_Gen_FX_Item *fi = data; + Elm_Gengrid_Smart_Data *sd = GG_IT(fi->it)->wsd; + if (fi->from.y == fi->to.y) evas_object_raise(fi->proxy); + evas_object_raise(sd->alpha_bg); + return; +} + + +static void +_item_fx_done(Elm_Transit_Effect *data, Elm_Transit *transit __UNUSED__) +{ + Elm_Gen_FX_Item *fx_done_it = data; + Elm_Gengrid_Smart_Data *sd = GG_IT(fx_done_it->it)->wsd; + + if ((!fx_done_it) || (!fx_done_it->it) || (!sd)) return; + + evas_object_image_source_visible_set(fx_done_it->proxy, EINA_TRUE); + evas_object_lower(fx_done_it->proxy); + + evas_object_move(VIEW(fx_done_it->it), fx_done_it->to.x, fx_done_it->to.y); + GG_IT(fx_done_it->it)->has_proxy_it = EINA_FALSE; + + evas_object_clip_unset(fx_done_it->proxy); +} + +static void +_item_fx_del_cb(void *data, Elm_Transit *transit __UNUSED__) +{ + Elm_Gen_FX_Item *fx_done_it = data; + Elm_Gen_Item *it = NULL; + Elm_Gengrid_Smart_Data *sd = GG_IT(fx_done_it->it)->wsd; + + if ((!fx_done_it) || (!fx_done_it->it) || (!sd)) return; + + sd->fx_items = eina_list_remove(sd->fx_items, fx_done_it); + free(fx_done_it); + + if (!eina_list_count(sd->fx_items)) + { + EINA_LIST_FREE (sd->pending_unrealized_items, it) + { + GG_IT(it)->has_proxy_it = EINA_FALSE; + _elm_gengrid_item_unrealize(it, EINA_FALSE); + } + + EINA_LIST_FREE (sd->pending_del_items, it) + { + _item_del(it); + _elm_widget_item_free((Elm_Widget_Item *)it); + } + + sd->fx_playing = EINA_FALSE; + sd->fx_first_captured = EINA_FALSE; + evas_object_hide(sd->alpha_bg); + + sd->pan_changed = EINA_TRUE; + evas_object_smart_changed(sd->pan_obj); + } +} + +static Evas_Object * +_tray_alpha_bg_create(const Evas_Object *obj) +{ + Evas_Object *bg = NULL; + Evas_Coord ox, oy, ow, oh; + + ELM_GENGRID_CHECK(obj) NULL; + ELM_GENGRID_DATA_GET(obj, sd); + + evas_object_geometry_get(sd->pan_obj, &ox, &oy, &ow, &oh); + bg = evas_object_rectangle_add + (evas_object_evas_get(ELM_WIDGET_DATA(sd)->obj)); + evas_object_color_set(bg, 0, 0, 0, 0); + evas_object_resize(bg, ow, oh); + evas_object_move(bg, ox, oy); + + return bg; +} + +static void +_elm_gengrid_fx_play(Evas_Object *obj) +{ + ELM_GENGRID_CHECK(obj); + ELM_GENGRID_DATA_GET(obj, sd); + + Evas_Coord ox, oy, ow, oh, cvx, cvy, cvw, cvh; + Elm_Gen_FX_Item *fi; + Eina_List *l; + + if (!sd->fx_mode) return; + + EINA_LIST_FREE(sd->fx_items, fi) + { + if (fi->trans) elm_transit_del(fi->trans); + free(fi); + } + + _elm_gengrid_fx_items_make(obj); + if (!eina_list_count(sd->fx_items)) return; + sd->fx_playing = EINA_TRUE; + + if (!sd->alpha_bg) sd->alpha_bg = _tray_alpha_bg_create(obj); + evas_object_show(sd->alpha_bg); + + evas_object_geometry_get(sd->pan_obj, &ox, &oy, &ow, &oh); + evas_output_viewport_get(evas_object_evas_get(obj), &cvx, &cvy, &cvw, &cvh); + + EINA_LIST_FOREACH(sd->fx_items, l, fi) + { + if (!fi->proxy) continue; + + if ((fi->from.y <= oy) || (fi->from.y + fi->from.h >= oy + oh)) + { + evas_object_move(VIEW(fi->it), fi->to.x, fi->to.y); + } + else if ((fi->to.y <= oy) || (fi->to.y + fi->to.h >= oy + oh)) + { + evas_object_move(VIEW(fi->it), fi->from.x, fi->from.y); + } + + evas_object_resize(fi->proxy, fi->to.w, fi->to.h); + evas_object_show(fi->proxy); + + fi->trans = elm_transit_add(); + elm_transit_object_add(fi->trans, fi->proxy); + + evas_object_image_source_visible_set(fi->proxy, EINA_FALSE); + elm_transit_tween_mode_set(fi->trans, ELM_TRANSIT_TWEEN_MODE_DECELERATE); + + if (fi->type == ELM_GEN_ITEM_FX_TYPE_SAME) + { + evas_object_raise(fi->proxy); + elm_transit_effect_translation_add(fi->trans, fi->from.x, fi->from.y, fi->to.x, fi->to.y); + } + + else if (fi->type == ELM_GEN_ITEM_FX_TYPE_ADD) + { + elm_transit_effect_translation_add(fi->trans, fi->from.x, fi->from.y, fi->to.x, fi->to.y); + elm_transit_effect_color_add(fi->trans, 0, 0, 0, 0, 255, 255, 255, 255); + elm_transit_effect_zoom_add(fi->trans, 0.5, 1.0); + } + else if (fi->type == ELM_GEN_ITEM_FX_TYPE_DEL) + { + elm_transit_effect_translation_add(fi->trans, fi->from.x, fi->from.y, fi->to.x, fi->to.y); + elm_transit_effect_color_add(fi->trans, 255, 255, 255, 255, 0, 0, 0, 0); + elm_transit_effect_zoom_add(fi->trans, 1.0, 0.5); + } + elm_transit_effect_add(fi->trans, _item_fx_op, fi, _item_fx_done); + elm_transit_del_cb_set(fi->trans, _item_fx_del_cb, fi); + + elm_transit_duration_set(fi->trans, FX_MOVE_TIME); + elm_transit_objects_final_state_keep_set(fi->trans, EINA_FALSE); + elm_transit_go(fi->trans); + } +} +#endif diff --git a/src/lib/elm_genlist.c b/src/lib/elm_genlist.c index a267eac..b471ef1 100644 --- a/src/lib/elm_genlist.c +++ b/src/lib/elm_genlist.c @@ -4,11 +4,13 @@ #include "elm_priv.h" #include "elm_widget_genlist.h" +#define GROUP_ITEMS_FEATURE 0 // internally allocated #define CLASS_ALLOCATED 0x3a70f11f #define MAX_ITEMS_PER_BLOCK 32 #define REORDER_EFFECT_TIME 0.1 +#define FX_MOVE_TIME 0.5 EAPI const char ELM_GENLIST_SMART_NAME[] = "elm_genlist"; EAPI const char ELM_GENLIST_PAN_SMART_NAME[] = "elm_genlist_pan"; @@ -19,6 +21,9 @@ EAPI const char ELM_GENLIST_PAN_SMART_NAME[] = "elm_genlist_pan"; #define GL_IT(_it) (_it->item) +#define IS_ROOT_PARENT_IT(_it) \ + ((_it->group) || (GL_IT(_it)->items && GL_IT(_it)->expanded_depth == 0)) \ + static const Evas_Smart_Interface *_smart_interfaces[] = { (Evas_Smart_Interface *)&ELM_SCROLLABLE_IFACE, NULL @@ -49,6 +54,12 @@ static const char SIG_EDGE_TOP[] = "edge,top"; static const char SIG_EDGE_BOTTOM[] = "edge,bottom"; static const char SIG_EDGE_LEFT[] = "edge,left"; static const char SIG_EDGE_RIGHT[] = "edge,right"; +static const char SIG_VBAR_DRAG[] = "vbar,drag"; +static const char SIG_VBAR_PRESS[] = "vbar,press"; +static const char SIG_VBAR_UNPRESS[] = "vbar,unpress"; +static const char SIG_HBAR_DRAG[] = "hbar,drag"; +static const char SIG_HBAR_PRESS[] = "hbar,press"; +static const char SIG_HBAR_UNPRESS[] = "hbar,unpress"; static const char SIG_MULTI_SWIPE_LEFT[] = "multi,swipe,left"; static const char SIG_MULTI_SWIPE_RIGHT[] = "multi,swipe,right"; static const char SIG_MULTI_SWIPE_UP[] = "multi,swipe,up"; @@ -90,6 +101,12 @@ static const Evas_Smart_Cb_Description _smart_callbacks[] = { {SIG_EDGE_BOTTOM, ""}, {SIG_EDGE_LEFT, ""}, {SIG_EDGE_RIGHT, ""}, + {SIG_VBAR_DRAG, ""}, + {SIG_VBAR_PRESS, ""}, + {SIG_VBAR_UNPRESS, ""}, + {SIG_HBAR_DRAG, ""}, + {SIG_HBAR_PRESS, ""}, + {SIG_HBAR_UNPRESS, ""}, {SIG_MULTI_SWIPE_LEFT, ""}, {SIG_MULTI_SWIPE_RIGHT, ""}, {SIG_MULTI_SWIPE_UP, ""}, @@ -130,6 +147,18 @@ static void _contract_signal_cb(void *data, Evas_Object *obj __UNUSED__, con static void _elm_genlist_item_state_update(Elm_Gen_Item *it, Item_Cache *ic); static void _decorate_item_unrealize(Elm_Gen_Item *it); static void _decorate_all_item_unrealize(Elm_Gen_Item *it); +static void _decorate_item_set(Elm_Gen_Item *it); + +#if GENLIST_FX_SUPPORT +static Eina_Bool _elm_genlist_fx_capture(Evas_Object *obj, int level); +static void _elm_genlist_fx_play(Evas_Object *obj); +static void _elm_genlist_fx_clear(Evas_Object *obj); +static void _elm_genlist_proxy_item_del(const Elm_Object_Item *item); +#endif + +#if GENLIST_PINCH_ZOOM_SUPPORT +EAPI Eina_Bool elm_genlist_pinch_zoom_mode_set(Evas_Object *obj, Elm_Gen_Pinch_Zoom_Mode mode); +#endif static void _item_cache_all_free(Elm_Genlist_Smart_Data *sd) @@ -268,6 +297,11 @@ _item_cache_pop(Elm_Gen_Item *it) VIEW(it) = ic->base_view; it->spacer = ic->spacer; +#if 1 // FIXME: different from upstream + // Because of item cache, set state as default after cache item + // is popped. + edje_object_signal_emit(VIEW(it),"elm,state,default", "elm"); +#endif edje_object_signal_callback_add (VIEW(it), "elm,action,expand,toggle", "elm", _expand_toggle_signal_cb, it); @@ -348,6 +382,16 @@ _elm_genlist_pan_smart_pos_max_get(const Evas_Object *obj, if (oh < 0) oh = 0; if (x) *x = ow; if (y) *y = oh; + +#if GENLIST_PINCH_ZOOM_SUPPORT + if (psd->wsd->pinch_zoom_mode == ELM_GEN_PINCH_ZOOM_CONTRACT) + { + evas_object_geometry_get(obj, NULL, NULL, &ow, &oh); + if (psd->wsd->pinch_zoom_h > oh) + *y = psd->wsd->pinch_zoom_h - oh; + else *y = 0; + } +#endif } static void @@ -517,6 +561,16 @@ _item_unrealize(Elm_Gen_Item *it, if (!it->realized) return; if (GL_IT(it)->wsd->reorder_it == it) return; + +#if GENLIST_FX_SUPPORT + if ((GL_IT(it)->has_proxy_it) && (!GL_IT(it)->wsd->genlist_clearing)) + { + if (!eina_list_data_find(GL_IT(it)->wsd->pending_unrealized_items, it)) + GL_IT(it)->wsd->pending_unrealized_items = + eina_list_append(GL_IT(it)->wsd->pending_unrealized_items, it); + return; + } +#endif #if GENLIST_ENTRY_SUPPORT if (it->item->unrealize_disabled) { @@ -581,6 +635,7 @@ _item_unrealize(Elm_Gen_Item *it, it->item->unrealize_disabled = EINA_FALSE; #endif it->want_unrealize = EINA_FALSE; + //evas_event_thaw(evas_object_evas_get(WIDGET(it))); //evas_event_thaw_eval(evas_object_evas_get(WIDGET(it))); } @@ -736,7 +791,7 @@ _calc_job(void *data) it_y = sd->anchor_y; sd->s_iface->content_pos_set (ELM_WIDGET_DATA(sd)->obj, sd->pan_x, it->item->block->y - + it->y + it_y); + + it->y + it_y, EINA_TRUE); sd->anchor_item = it; sd->anchor_y = it_y; } @@ -839,42 +894,6 @@ _elm_genlist_smart_sizing_eval(Evas_Object *obj) } static void -_item_contract_emit(Elm_Gen_Item *it) -{ - Elm_Gen_Item *it2; - Eina_List *l; - - edje_object_signal_emit(VIEW(it), "elm,state,contract_flip", ""); - it->item->tree_effect_finished = EINA_FALSE; - - EINA_LIST_FOREACH(it->item->items, l, it2) - if (it2) _item_contract_emit(it2); -} - -static int -_item_tree_effect_before(Elm_Gen_Item *it) -{ - Elm_Gen_Item *it2; - Eina_List *l; - - EINA_LIST_FOREACH(it->item->items, l, it2) - { - if (it2->parent && (it == it2->parent)) - { - if (!it2->realized) - it2->item->tree_effect_hide_me = EINA_TRUE; - if (GL_IT(it)->wsd->move_effect_mode == - ELM_GENLIST_TREE_EFFECT_EXPAND) - edje_object_signal_emit(VIEW(it2), "elm,state,hide", ""); - else if (GL_IT(it)->wsd->move_effect_mode == - ELM_GENLIST_TREE_EFFECT_CONTRACT) - _item_contract_emit(it2); - } - } - return ECORE_CALLBACK_CANCEL; -} - -static void _item_position(Elm_Gen_Item *it, Evas_Object *view, Evas_Coord it_x, @@ -892,64 +911,7 @@ _item_position(Elm_Gen_Item *it, } static void -_item_tree_effect(Elm_Genlist_Smart_Data *sd, - int y) -{ - Elm_Gen_Item *it = NULL, *expanded_next_it; - - expanded_next_it = sd->expanded_next_item; - - if (sd->move_effect_mode == ELM_GENLIST_TREE_EFFECT_EXPAND) - { - it = (Elm_Gen_Item *)elm_genlist_item_prev_get - ((Elm_Object_Item *)expanded_next_it); - while (it) - { - if (it->item->expanded_depth <= - expanded_next_it->item->expanded_depth) break; - if (it->item->scrl_y && - (it->item->scrl_y <= expanded_next_it->item->old_scrl_y + y) - && (it->item->expanded_depth > - expanded_next_it->item->expanded_depth)) - { - if (!it->item->tree_effect_finished) - { - edje_object_signal_emit(VIEW(it), "flip_item", ""); - _item_position - (it, VIEW(it), it->item->scrl_x, it->item->scrl_y); - it->item->tree_effect_finished = EINA_TRUE; - } - } - it = (Elm_Gen_Item *)elm_genlist_item_prev_get - ((Elm_Object_Item *)it); - } - } - else if (sd->move_effect_mode == ELM_GENLIST_TREE_EFFECT_CONTRACT) - { - it = (Elm_Gen_Item *)elm_genlist_item_prev_get - ((Elm_Object_Item *)expanded_next_it); - while (it) - { - if ((it->item->scrl_y > expanded_next_it->item->old_scrl_y + y) && - (it->item->expanded_depth > - expanded_next_it->item->expanded_depth)) - { - if (!it->item->tree_effect_finished) - { - edje_object_signal_emit(VIEW(it), "elm,state,hide", ""); - it->item->tree_effect_finished = EINA_TRUE; - } - } - else - break; - it = (Elm_Gen_Item *)elm_genlist_item_prev_get - ((Elm_Object_Item *)it); - } - } -} - -static void -_item_sub_items_clear(Elm_Gen_Item *it) +_item_subitems_clear(Elm_Gen_Item *it) { Eina_List *l, *ll; Elm_Object_Item *it2; @@ -963,6 +925,9 @@ _item_auto_scroll(Elm_Genlist_Smart_Data *sd) { Elm_Gen_Item *tmp_item = NULL; +#if GENLIST_FX_SUPPORT + if (sd->fx_first_captured) return; +#endif if ((sd->expanded_item) && (sd->auto_scroll_enabled)) { tmp_item = eina_list_data_get @@ -982,41 +947,6 @@ _item_auto_scroll(Elm_Genlist_Smart_Data *sd) } static void -_item_tree_effect_finish(Elm_Genlist_Smart_Data *sd) -{ - Elm_Gen_Item *it = NULL; - const Eina_List *l; - - if (sd->tree_effect_animator) - { - if (sd->move_effect_mode == ELM_GENLIST_TREE_EFFECT_CONTRACT) - _item_sub_items_clear(sd->expanded_item); - - EINA_LIST_FOREACH(sd->expanded_item->item->items, l, it) - { - it->item->tree_effect_finished = EINA_TRUE; - it->item->old_scrl_y = it->item->scrl_y; - if (GL_IT(it)->wsd->move_effect_mode == - ELM_GENLIST_TREE_EFFECT_EXPAND) - edje_object_signal_emit(VIEW(it), "elm,state,show", ""); - } - } - - _item_auto_scroll(sd); - evas_object_lower(sd->alpha_bg); - evas_object_hide(sd->alpha_bg); - sd->move_effect_mode = ELM_GENLIST_TREE_EFFECT_NONE; - if (sd->move_items) sd->move_items = eina_list_free(sd->move_items); - - evas_object_smart_callback_call(sd->pan_obj, "changed", NULL); - evas_object_smart_callback_call - (ELM_WIDGET_DATA(sd)->obj, SIG_TREE_EFFECT_FINISHED, NULL); - evas_object_smart_changed(sd->pan_obj); - - sd->tree_effect_animator = NULL; -} - -static void _elm_genlist_item_odd_even_update(Elm_Gen_Item *it) { if (!it->item->nostacking) @@ -1076,9 +1006,9 @@ _elm_genlist_item_state_update(Elm_Gen_Item *it, { if (it->deco_all_view) edje_object_signal_emit - (it->deco_all_view, "elm,state,selected", "elm"); + (it->deco_all_view, "elm,state,selected", "elm,nosound"); edje_object_signal_emit - (VIEW(it), "elm,state,selected", "elm"); + (VIEW(it), "elm,state,selected", "elm,nosound"); evas_object_smart_callback_call(WIDGET(it), SIG_HIGHLIGHTED, it); } } @@ -1105,9 +1035,9 @@ _elm_genlist_item_state_update(Elm_Gen_Item *it, { if (it->deco_all_view) edje_object_signal_emit - (it->deco_all_view, "elm,state,selected", "elm"); + (it->deco_all_view, "elm,state,selected", "elm,nosound"); edje_object_signal_emit - (VIEW(it), "elm,state,selected", "elm"); + (VIEW(it), "elm,state,selected", "elm,nosound"); evas_object_smart_callback_call(WIDGET(it), SIG_HIGHLIGHTED, it); } if (elm_widget_item_disabled_get(it)) @@ -1374,6 +1304,15 @@ _decorate_all_item_realize(Elm_Gen_Item *it, _elm_genlist_item_odd_even_update(it); _elm_genlist_item_state_update(it, NULL); +#if 1 // FIXME: difference from upstream + if (GL_IT(it)->wsd->reorder_mode) + { + edje_object_signal_emit + (VIEW(it), "elm,state,reorder,mode_unset", "elm"); + edje_object_signal_emit + (it->deco_all_view, "elm,state,reorder,mode_set", "elm"); + } +#endif if (effect_on) { edje_object_signal_emit @@ -1388,19 +1327,6 @@ _decorate_all_item_realize(Elm_Gen_Item *it, edje_object_signal_emit (VIEW(it), "elm,state,decorate,enabled", "elm"); } -#if 1 // FIXME: difference from upstream - if (GL_IT(it)->wsd->reorder_mode) - { - edje_object_signal_emit - (VIEW(it), "elm,state,reorder,mode_unset", "elm"); - edje_object_signal_emit - (it->deco_all_view, "elm,state,reorder,mode_set", "elm"); - } - else - edje_object_signal_emit - (it->deco_all_view, "elm,state,reorder,mode_unset", "elm"); -#endif - _item_mouse_callbacks_del(it, VIEW(it)); _item_mouse_callbacks_add(it, it->deco_all_view); @@ -1565,9 +1491,14 @@ _item_content_realize(Elm_Gen_Item *it, static char * _access_info_cb(void *data, Evas_Object *obj __UNUSED__) { + char *ret; + Eina_Strbuf *buf; + Elm_Gen_Item *it = (Elm_Gen_Item *)data; ELM_GENLIST_ITEM_CHECK_OR_RETURN(it, NULL); + buf = eina_strbuf_new(); + if (it->itc->func.text_get) { const Eina_List *l; @@ -1580,11 +1511,21 @@ _access_info_cb(void *data, Evas_Object *obj __UNUSED__) { char *s = it->itc->func.text_get ((void *)it->base.data, WIDGET(it), key); - return s; + + s = _elm_util_mkup_to_text(s); + + if (s) + { + if (eina_strbuf_length_get(buf) > 0) eina_strbuf_append(buf, ", "); + eina_strbuf_append(buf, s); + free(s); + } } } - return NULL; + ret = eina_strbuf_string_steal(buf); + eina_strbuf_free(buf); + return ret; } static char * @@ -1628,7 +1569,6 @@ _access_widget_item_register(Elm_Gen_Item *it) ai = _elm_access_object_get(it->base.access_obj); - _elm_access_text_set(ai, ELM_ACCESS_TYPE, E_("Genlist Item")); _elm_access_callback_set(ai, ELM_ACCESS_INFO, _access_info_cb, it); _elm_access_callback_set(ai, ELM_ACCESS_STATE, _access_state_cb, it); _elm_access_on_highlight_hook_set(ai, _access_on_highlight_cb, it); @@ -1658,7 +1598,6 @@ _item_realize(Elm_Gen_Item *it, it->item->order_num_in = in; if (it->item->nocache_once | it->item->nocache || - GL_IT(it)->wsd->tree_effect_enabled || it->item->type == ELM_GENLIST_ITEM_TREE || it->parent || !_item_cache_pop(it)) { @@ -1688,7 +1627,7 @@ _item_realize(Elm_Gen_Item *it, elm_widget_style_get(WIDGET(it))); if (it->item->expanded_depth > 0) - edje_object_signal_emit(VIEW(it), "bg_color_change", ""); + edje_object_signal_emit(VIEW(it), "bg_color_change", "elm"); stacking_even = edje_object_data_get(VIEW(it), "stacking_even"); if (!stacking_even) stacking_even = "above"; @@ -1711,9 +1650,8 @@ _item_realize(Elm_Gen_Item *it, _item_mouse_callbacks_add(it, VIEW(it)); } - // ACCESS - if (_elm_config->access_mode == ELM_ACCESS_MODE_ON) - _access_widget_item_register(it); + /* access */ + if (_elm_config->access_mode) _access_widget_item_register(it); _item_order_update(EINA_INLIST_GET(it), in); #if 1 // FIXME: difference from upstream @@ -1784,6 +1722,9 @@ _item_realize(Elm_Gen_Item *it, { edje_object_signal_emit (VIEW(it), "elm,state,flip,enabled", "elm"); + // This is needed before contents are swallowed + edje_object_message_signal_process(VIEW(it)); + if (!(it->item->flip_contents)) it->item->flip_contents = elm_widget_stringlist_get (edje_object_data_get(VIEW(it), "flips")); @@ -1792,6 +1733,10 @@ _item_realize(Elm_Gen_Item *it, &it->item->flip_content_objs); } + /* access: unregister item which have no text and content */ + if (_elm_config->access_mode && !it->texts && !it->contents) + _elm_access_widget_item_unregister((Elm_Widget_Item *)it); + #if 0 // FIXME: difference from upstream if (!it->item->mincalcd || ((GL_IT(it)->wsd->mode == ELM_LIST_COMPRESS) && (it->item->w != it->item->minw))) @@ -1841,16 +1786,7 @@ _item_realize(Elm_Gen_Item *it, it->want_unrealize = EINA_FALSE; if (!calc || it->item->unrealize_disabled) - { - if (it->item->tree_effect_hide_me) - { - if (GL_IT(it)->wsd->move_effect_mode - != ELM_GENLIST_TREE_EFFECT_NONE) - edje_object_signal_emit(VIEW(it), "elm,state,hide", ""); - it->item->tree_effect_hide_me = EINA_FALSE; - } - evas_object_smart_callback_call(WIDGET(it), SIG_REALIZED, it); - } + evas_object_smart_callback_call(WIDGET(it), SIG_REALIZED, it); if ((!calc) && (GL_IT(it)->wsd->decorate_all_mode) && (it->item->type != ELM_GENLIST_ITEM_GROUP)) @@ -1862,166 +1798,64 @@ _item_realize(Elm_Gen_Item *it, edje_object_message_signal_process(it->deco_all_view); } } + if ((!calc) && (it->decorate_it_set) && + (it->item->type != ELM_GENLIST_ITEM_GROUP)) + { + if (it->itc->decorate_item_style) + { + if (!it->item->deco_it_view) + _decorate_item_set(it); + edje_object_message_signal_process(it->item->deco_it_view); + } + } edje_object_message_signal_process(VIEW(it)); } -static Eina_Bool -_tree_effect_animator_cb(void *data) +#if GENLIST_PINCH_ZOOM_SUPPORT +static void +_pinch_items_recalc(void *data) { - int in = 0; - const Eina_List *l; - int y = 0, dy = 0, dh = 0; - double effect_duration = 0.3, t; Elm_Genlist_Smart_Data *sd = data; - Eina_Bool end = EINA_FALSE, vis = EINA_TRUE; - Evas_Coord ox, oy, ow, oh, cvx, cvy, cvw, cvh; - Elm_Gen_Item *it = NULL, *it2, *expanded_next_it; - - t = ((0.0 > (t = ecore_time_get() - sd->start_time)) ? 0.0 : t); - evas_object_geometry_get(sd->pan_obj, &ox, &oy, &ow, &oh); - evas_output_viewport_get - (evas_object_evas_get(sd->pan_obj), &cvx, &cvy, &cvw, &cvh); - if (t > effect_duration) end = EINA_TRUE; + Item_Block *itb; + Eina_List *l; + Elm_Gen_Item *it; - // Below while statement is needed, when the genlist is resized. - it2 = sd->expanded_item; - while (it2 && vis) - { - evas_object_move(VIEW(it2), it2->item->scrl_x, it2->item->scrl_y); - vis = (ELM_RECTS_INTERSECT(it2->item->scrl_x, it2->item->scrl_y, - it2->item->w, it2->item->h, cvx, cvy, cvw, - cvh)); - it2 = - (Elm_Gen_Item *)elm_genlist_item_prev_get((Elm_Object_Item *)it2); - } + Evas_Coord tot_y = 0, ox, oy; + evas_object_geometry_get(sd->pan_obj, &ox, &oy, NULL, NULL); - if (sd->expanded_next_item) + EINA_INLIST_FOREACH(sd->blocks, itb) { - expanded_next_it = sd->expanded_next_item; - - /* move items */ - EINA_LIST_FOREACH(sd->move_items, l, it) + EINA_LIST_FOREACH(itb->items, l, it) { - if (sd->move_effect_mode == ELM_GENLIST_TREE_EFFECT_EXPAND) - { - expanded_next_it->item->old_scrl_y = - sd->expanded_item->item->old_scrl_y - + sd->expanded_item->item->h; - if (expanded_next_it->item->scrl_y <= - expanded_next_it->item->old_scrl_y) /* did not - * calculate - * next item - * position */ - expanded_next_it->item->scrl_y = cvy + cvh; - - dy = ((expanded_next_it->item->scrl_y >= (cvy + cvh)) ? - cvy + cvh : expanded_next_it->item->scrl_y) - - expanded_next_it->item->old_scrl_y; - } - else if (sd->move_effect_mode == ELM_GENLIST_TREE_EFFECT_CONTRACT) + + if (IS_ROOT_PARENT_IT(it)) { - if (expanded_next_it->item->scrl_y > - expanded_next_it->item->old_scrl_y) /* did not - * calculate - * next item - * position */ - expanded_next_it->item->old_scrl_y = cvy + cvh; - - if (expanded_next_it->item->old_scrl_y > (cvy + cvh)) - { - dy = (sd->expanded_item->item->scrl_y + - sd->expanded_item->item->h) - cvy + cvh; - expanded_next_it->item->old_scrl_y = cvy + cvh; - } - else + if (sd->pinch_zoom_mode == ELM_GEN_PINCH_ZOOM_CONTRACT) { - dy = (sd->expanded_item->item->scrl_y + - sd->expanded_item->item->h) - - expanded_next_it->item->old_scrl_y; + if (!it->realized) _item_realize(it, 0, EINA_FALSE); + it->item->scrl_y = oy + tot_y - sd->pan_y; + evas_object_resize(VIEW(it), sd->minw, it->item->h); + evas_object_move(VIEW(it), it->item->scrl_x, it->item->scrl_y); + evas_object_show(VIEW(it)); + evas_object_raise(VIEW(it)); + tot_y += it->item->h; + sd->pinch_zoom_h = tot_y; } - } - - if (t <= effect_duration) - { - y = ((1 - (1 - (t / effect_duration)) * - (1 - (t / effect_duration))) * dy); - } - else - { - end = EINA_TRUE; - y = dy; - } - - if (!it->realized && !it->item->queued) - _item_realize(it, in, 0); - in++; - - if (it != expanded_next_it) - { - it->item->old_scrl_y = - expanded_next_it->item->old_scrl_y + - expanded_next_it->item->h + dh; - - dh += it->item->h; - } - - if ((it->item->old_scrl_y + y) < (cvy + cvh)) - _item_position(it, VIEW(it), it->item->scrl_x, - it->item->old_scrl_y + y); - } - /* tree effect */ - _item_tree_effect(sd, y); - } - else - { - int expanded_item_num = 0; - int num = 0; - - if (sd->expanded_item) - it = (Elm_Gen_Item *)elm_genlist_item_next_get - ((Elm_Object_Item *)sd->expanded_item); - - it2 = it; - while (it2) - { - expanded_item_num++; - it2 = (Elm_Gen_Item *)elm_genlist_item_next_get - ((Elm_Object_Item *)it2); - } - while (it) - { - num++; - if (sd->expanded_item->item->expanded_depth >= - it->item->expanded_depth) break; - if (sd->move_effect_mode == ELM_GENLIST_TREE_EFFECT_EXPAND) - { - if (!it->item->tree_effect_finished) + else if (sd->pinch_zoom_mode == ELM_GEN_PINCH_ZOOM_EXPAND) { - if (t >= (((num - 1) * effect_duration) / - expanded_item_num)) - { - edje_object_signal_emit(VIEW(it), "flip_item", ""); - _item_position(it, VIEW(it), it->item->scrl_x, - it->item->scrl_y); - it->item->tree_effect_finished = EINA_TRUE; - } + evas_object_resize(VIEW(it), sd->minw, it->item->h); + it->item->scrl_y = oy + it->item->pan_scrl_y - sd->pan_y; + evas_object_move(VIEW(it), it->item->scrl_x, it->item->scrl_y); } + } - it = (Elm_Gen_Item *)elm_genlist_item_next_get - ((Elm_Object_Item *)it); } } - - if (end) - { - _item_tree_effect_finish(sd); - return ECORE_CALLBACK_CANCEL; - } - - return ECORE_CALLBACK_RENEW; } +#endif +#if GROUP_ITEMS_FEATURE static void _group_items_recalc(void *data) { @@ -2049,6 +1883,7 @@ _group_items_recalc(void *data) //evas_event_thaw(evas_object_evas_get(ELM_WIDGET_DATA(sd)->obj)); //evas_event_thaw_eval(evas_object_evas_get(ELM_WIDGET_DATA(sd)->obj)); } +#endif static Eina_Bool _reorder_move_animator_cb(void *data) @@ -2215,7 +2050,7 @@ _item_block_position(Item_Block *itb, it->item->move_effect_enabled = EINA_TRUE; GL_IT(it)->wsd->reorder_move_animator = ecore_animator_add( - _reorder_move_animator_cb, it); + _reorder_move_animator_cb, it); } } if (!it->item->move_effect_enabled) @@ -2223,34 +2058,40 @@ _item_block_position(Item_Block *itb, if ((GL_IT(it)->wsd->decorate_all_mode) && (it->itc->decorate_all_item_style)) _decorate_all_item_position - (it, it->item->scrl_x, it->item->scrl_y); + (it, it->item->scrl_x, it->item->scrl_y); else { - if (!GL_IT(it)->wsd->tree_effect_enabled || - (GL_IT(it)->wsd->move_effect_mode == - ELM_GENLIST_TREE_EFFECT_NONE) || - ((GL_IT(it)->wsd->move_effect_mode != - ELM_GENLIST_TREE_EFFECT_NONE) && - (it->item->old_scrl_y == - it->item->scrl_y))) - { - if (it->item->deco_it_view) - _item_position - (it, it->item->deco_it_view, - it->item->scrl_x, - it->item->scrl_y); - else - _item_position - (it, VIEW(it), it->item->scrl_x, - it->item->scrl_y); - } + if (it->item->deco_it_view) + _item_position + (it, it->item->deco_it_view, + it->item->scrl_x, + it->item->scrl_y); + else + _item_position + (it, VIEW(it), it->item->scrl_x, + it->item->scrl_y); } it->item->old_scrl_y = it->item->scrl_y; +#if GENLIST_PINCH_ZOOM_SUPPORT + if ((GL_IT(it)->wsd->pinch_zoom_mode == ELM_GEN_PINCH_ZOOM_CONTRACT) + && (!IS_ROOT_PARENT_IT(it))) + { + if (it->deco_all_view) evas_object_hide(it->deco_all_view); + else evas_object_hide(VIEW(it)); + } +#endif + } } else { - if (!GL_IT(it)->wsd->tree_effect_animator) + if ((GL_IT(it)->wsd->pinch_zoom_mode == ELM_GEN_PINCH_ZOOM_CONTRACT) + && (!IS_ROOT_PARENT_IT(it))) + { + if (it->deco_all_view) evas_object_hide(it->deco_all_view); + else evas_object_hide(VIEW(it)); + } + else _item_unrealize(it, EINA_FALSE); } } @@ -2386,6 +2227,9 @@ _elm_genlist_pan_smart_calculate(Evas_Object *obj) //evas_event_freeze(evas_object_evas_get(obj)); +#if GENLIST_FX_SUPPORT + if (psd->wsd->fx_playing) return; +#endif if (psd->wsd->pan_changed) { _calc_job(psd->wsd); @@ -2395,23 +2239,13 @@ _elm_genlist_pan_smart_calculate(Evas_Object *obj) evas_object_geometry_get(obj, &ox, &oy, &ow, &oh); evas_output_viewport_get(evas_object_evas_get(obj), &cvx, &cvy, &cvw, &cvh); EINA_LIST_FOREACH(psd->wsd->group_items, l, git) - { - git->item->want_realize = EINA_FALSE; - } - - if (psd->wsd->tree_effect_enabled && - (psd->wsd->move_effect_mode != ELM_GENLIST_TREE_EFFECT_NONE)) - { - if (!psd->wsd->tree_effect_animator) - { - _item_tree_effect_before(psd->wsd->expanded_item); - evas_object_raise(psd->wsd->alpha_bg); - evas_object_show(psd->wsd->alpha_bg); - psd->wsd->start_time = ecore_time_get(); - psd->wsd->tree_effect_animator = - ecore_animator_add(_tree_effect_animator_cb, psd->wsd); - } - } + { +#if GROUP_ITEMS_FEATURE + git->item->want_realize = EINA_FALSE; +#else + _item_unrealize(git, EINA_TRUE); +#endif + } EINA_INLIST_FOREACH(psd->wsd->blocks, itb) { @@ -2439,8 +2273,11 @@ _elm_genlist_pan_smart_calculate(Evas_Object *obj) } in += itb->count; } -#if 0 // FIXME: difference from upstream - // Disable shift movement of group items. +#if GENLIST_PINCH_ZOOM_SUPPORT + if (psd->wsd->pinch_zoom_mode) _pinch_items_recalc(psd->wsd); +#endif + +#if GROUP_ITEMS_FEATURE if ((!psd->wsd->reorder_it) || (psd->wsd->reorder_pan_move)) _group_items_recalc(psd->wsd); #endif @@ -2454,9 +2291,6 @@ _elm_genlist_pan_smart_calculate(Evas_Object *obj) psd->wsd->reorder_old_pan_y = psd->wsd->pan_y; psd->wsd->start_time = ecore_loop_time_get(); } - - if (!psd->wsd->tree_effect_enabled || - (psd->wsd->move_effect_mode == ELM_GENLIST_TREE_EFFECT_NONE)) _item_auto_scroll(psd->wsd); psd->wsd->s_iface->content_pos_get(ELM_WIDGET_DATA(psd->wsd)->obj, &vx, &vy); @@ -2473,6 +2307,19 @@ _elm_genlist_pan_smart_calculate(Evas_Object *obj) #if GENLIST_ENTRY_SUPPORT if (psd->wsd->size_changed) _changed_job(psd->wsd); #endif + +#if GENLIST_FX_SUPPORT + psd->wsd->rendered = EINA_TRUE; + if ((psd->wsd->fx_mode) && (!psd->wsd->queue)) + { + if (_elm_genlist_fx_capture(ELM_WIDGET_DATA(psd->wsd)->obj, 1)) + _elm_genlist_fx_play(ELM_WIDGET_DATA(psd->wsd)->obj); + } +#endif +#if GENLIST_PINCH_ZOOM_SUPPORT + if (psd->wsd->pinch_zoom_mode == ELM_GEN_PINCH_ZOOM_EXPAND) + psd->wsd->pinch_zoom_mode = ELM_GEN_PINCH_ZOOM_NONE; +#endif //evas_event_thaw(evas_object_evas_get(obj)); //evas_event_thaw_eval(evas_object_evas_get(obj)); } @@ -2732,7 +2579,7 @@ _elm_genlist_smart_event(Evas_Object *obj, if (y < 0) y = 0; if (y > pan_max_y) y = pan_max_y; - sd->s_iface->content_pos_set(obj, x, y); + sd->s_iface->content_pos_set(obj, x, y, EINA_TRUE); return EINA_TRUE; } @@ -2827,6 +2674,13 @@ _elm_genlist_smart_focus_next(const Evas_Object *obj, if (ELM_RECTS_INTERSECT (x + (w / 2), y + (h / 2), 0, 0, sx, sy, sw, sh)) items = eina_list_append(items, it->base.access_obj); + + if (!it->base.access_order) continue; + + Eina_List *subl; + Evas_Object *subo; + EINA_LIST_FOREACH(it->base.access_order, subl, subo) + items = eina_list_append(items, subo); } } } @@ -2929,6 +2783,9 @@ _item_highlight(Elm_Gen_Item *it) return; if (!sd->highlight || it->highlighted) return; +#if GENLIST_PINCH_ZOOM_SUPPORT + if (sd->pinch_zoom_mode) return; +#endif selectraise = edje_object_data_get(VIEW(it), "selectraise"); if ((selectraise) && (!strcmp(selectraise, "on"))) @@ -2996,6 +2853,15 @@ _item_select(Elm_Gen_Item *it) (it->select_mode == ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY)) return; +#if GENLIST_PINCH_ZOOM_SUPPORT + if (IS_ROOT_PARENT_IT(it) && (sd->pinch_zoom_mode == ELM_GEN_PINCH_ZOOM_CONTRACT)) + { + elm_genlist_pinch_zoom_mode_set(obj, ELM_GEN_PINCH_ZOOM_EXPAND); + elm_genlist_item_show((Elm_Object_Item *)it, ELM_GENLIST_ITEM_SCROLLTO_TOP); + return; + } +#endif + #if 0 // FIXME: difference from upstream if ((GL_IT(it)->wsd->last_selected_item) && @@ -3160,6 +3026,9 @@ _item_block_del(Elm_Gen_Item *it) if (GL_IT(it)->wsd->calc_job) ecore_job_del(GL_IT(it)->wsd->calc_job); GL_IT(it)->wsd->calc_job = NULL; } +#if GENLIST_FX_SUPPORT + it->item->block = NULL; +#endif } static void @@ -3169,6 +3038,16 @@ _decorate_all_item_unrealize(Elm_Gen_Item *it) if ((!it) || (!it->item->decorate_all_item_realized)) return; +#if GENLIST_FX_SUPPORT + if ((GL_IT(it)->has_proxy_it) && (!GL_IT(it)->wsd->genlist_clearing)) + { + if (!eina_list_data_find(GL_IT(it)->wsd->pending_unrealized_decorate_all_items, it)) + GL_IT(it)->wsd->pending_unrealized_decorate_all_items = + eina_list_append(GL_IT(it)->wsd->pending_unrealized_decorate_all_items, it); + return; + } +#endif + edje_object_part_unswallow(it->deco_all_view, VIEW(it)); evas_object_smart_member_add(VIEW(it), GL_IT(it)->wsd->pan_obj); elm_widget_sub_object_add(WIDGET(it), VIEW(it)); @@ -3176,9 +3055,17 @@ _decorate_all_item_unrealize(Elm_Gen_Item *it) _elm_genlist_item_state_update(it, NULL); edje_object_signal_emit - (it->deco_all_view, "elm,state,decorate,disabled,effect", "elm"); + (it->deco_all_view, "elm,state,decorate,disabled", "elm"); edje_object_signal_emit - (VIEW(it), "elm,state,decorate,disabled", "elm"); + (VIEW(it), "elm,state,decorate,disabled", "elm"); + if (it->item->wsd->reorder_mode) + { + edje_object_signal_emit + (VIEW(it), "elm,state,reorder,mode_set", "elm"); + edje_object_signal_emit + (it->deco_all_view, "elm,state,reorder,mode_unset", "elm"); + } + edje_object_message_signal_process(VIEW(it)); edje_object_message_signal_process(it->deco_all_view); @@ -3200,42 +3087,15 @@ _decorate_all_item_unrealize(Elm_Gen_Item *it) } static void -_item_subitems_clear(Elm_Gen_Item *it) -{ - Elm_Genlist_Smart_Data *sd = GL_IT(it)->wsd; - - if (!sd->tree_effect_enabled || !sd->move_effect_mode) - _item_sub_items_clear(it); - else - { - if (!sd->tree_effect_animator) - { - sd->expanded_item = it; - _item_tree_effect_before(it); - evas_object_raise(sd->alpha_bg); - evas_object_show(sd->alpha_bg); - sd->start_time = ecore_time_get(); - sd->tree_effect_animator = - ecore_animator_add(_tree_effect_animator_cb, sd); - } - else - _item_sub_items_clear(it); - } -} - -static void -_item_free(Elm_Gen_Item *it) +_item_free_common(Elm_Gen_Item *it) { Elm_Genlist_Smart_Data *sd = GL_IT(it)->wsd; - elm_widget_item_pre_notify_del(it); if (it->itc->func.del) - it->itc->func.del((void *)it->base.data, WIDGET(it)); + it->itc->func.del((void *)it->base.data, WIDGET(it)); if (it->tooltip.del_cb) it->tooltip.del_cb((void *)it->tooltip.data, WIDGET(it), it); - if (it->item->block) _item_block_del(it); - if (it->parent) it->parent->item->items = eina_list_remove(it->parent->item->items, it); @@ -3244,21 +3104,18 @@ _item_free(Elm_Gen_Item *it) // FIXME: relative will be better to be fixed. it is too harsh. if (it->item->rel) - it->item->rel->item->rel_revs = - eina_list_remove(it->item->rel->item->rel_revs, it); + it->item->rel->item->rel_revs = + eina_list_remove(it->item->rel->item->rel_revs, it); if (it->item->rel_revs) { Elm_Gen_Item *tmp; EINA_LIST_FREE(it->item->rel_revs, tmp) tmp->item->rel = NULL; } _item_subitems_clear(it); + #if GENLIST_ENTRY_SUPPORT it->item->unrealize_disabled = EINA_FALSE; #endif - _item_unrealize(it, EINA_FALSE); - elm_genlist_item_class_unref((Elm_Genlist_Item_Class *)it->itc); - if (it->item->swipe_timer) ecore_timer_del(it->item->swipe_timer); - free(it->item); if (it->selected) sd->selected = eina_list_remove(sd->selected, it); if (sd->show_item == it) sd->show_item = NULL; @@ -3267,40 +3124,63 @@ _item_free(Elm_Gen_Item *it) sd->anchor_item = ELM_GEN_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->next); if (!sd->anchor_item) sd->anchor_item = - ELM_GEN_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->prev); - } - if (sd->expanded_item == it) - { - if (sd->tree_effect_animator) - { - _item_tree_effect_finish(sd); - ecore_animator_del(sd->tree_effect_animator); - sd->tree_effect_animator = NULL; - } - sd->expanded_item = NULL; - sd->move_effect_mode = ELM_GENLIST_TREE_EFFECT_NONE; + ELM_GEN_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->prev); } + if (sd->expanded_item == it) sd->expanded_item = NULL; if (sd->expanded_next_item == it) sd->expanded_next_item = NULL; - if (sd->move_items) - sd->move_items = eina_list_remove(sd->move_items, it); if (sd->state) eina_inlist_sorted_state_free(sd->state); if (sd->last_selected_item == (Elm_Object_Item *)it) - sd->last_selected_item = NULL; + sd->last_selected_item = NULL; if (it->long_timer) { ecore_timer_del(it->long_timer); it->long_timer = NULL; } + if (it->item->swipe_timer) ecore_timer_del(it->item->swipe_timer); sd->items = eina_inlist_remove(sd->items, EINA_INLIST_GET(it)); sd->item_count--; +} - if (sd->calc_job) ecore_job_del(sd->calc_job); +static void +_item_free(Elm_Gen_Item *it) +{ + Elm_Genlist_Smart_Data *sd = GL_IT(it)->wsd; + +#if GENLIST_FX_SUPPORT + if (sd->fx_mode) GL_IT(it)->has_proxy_it = EINA_FALSE; + _elm_genlist_proxy_item_del((Elm_Object_Item *)it); + if ((!sd->fx_mode) || (sd->genlist_clearing)) +#endif + { + _item_free_common(it); + } + _item_unrealize(it, EINA_FALSE); + elm_genlist_item_class_unref((Elm_Genlist_Item_Class *)it->itc); + free(it->item); + + if (sd->calc_job) ecore_job_del(sd->calc_job); sd->calc_job = ecore_job_add(_calc_job, sd); } +#if GENLIST_FX_SUPPORT +static void +_item_del_pre_fx_process(Elm_Gen_Item *it) +{ + Elm_Genlist_Smart_Data *sd = GL_IT(it)->wsd; + + sd->fx_items_deleted = EINA_TRUE; + _elm_genlist_fx_capture(ELM_WIDGET_DATA(sd)->obj, 0); + if (!eina_list_data_find(sd->pending_del_items, it)) + sd->pending_del_items = eina_list_append(sd->pending_del_items, it); + + _item_free_common(it); + +} +#endif + static void _item_mouse_move_cb(void *data, Evas *evas __UNUSED__, @@ -3613,11 +3493,26 @@ _multi_touch_gesture_eval(void *data) (WIDGET(it), SIG_MULTI_SWIPE_UP, it); else if (abs(GL_IT(it)->wsd->cur_y - GL_IT(it)->wsd->cur_my) > abs(GL_IT(it)->wsd->prev_y - GL_IT(it)->wsd->prev_my)) - evas_object_smart_callback_call - (WIDGET(it), SIG_MULTI_PINCH_OUT, it); + { + evas_object_smart_callback_call + (WIDGET(it), SIG_MULTI_PINCH_OUT, it); +#if GENLIST_PINCH_ZOOM_SUPPORT + if (IS_ROOT_PARENT_IT(it) && (GL_IT(it)->wsd->pinch_zoom_mode == ELM_GEN_PINCH_ZOOM_CONTRACT)) + { + elm_genlist_pinch_zoom_mode_set(ELM_WIDGET_DATA(GL_IT(it)->wsd)->obj, ELM_GEN_PINCH_ZOOM_EXPAND); + elm_genlist_item_show((Elm_Object_Item *)it, ELM_GENLIST_ITEM_SCROLLTO_TOP); + } +#endif + } else - evas_object_smart_callback_call - (WIDGET(it), SIG_MULTI_PINCH_IN, it); + { + evas_object_smart_callback_call + (WIDGET(it), SIG_MULTI_PINCH_IN, it); +#if GENLIST_PINCH_ZOOM_SUPPORT + elm_genlist_pinch_zoom_mode_set(ELM_WIDGET_DATA(GL_IT(it)->wsd)->obj, + ELM_GEN_PINCH_ZOOM_CONTRACT); +#endif + } } } @@ -4172,6 +4067,10 @@ _idle_process(void *data, { return ECORE_CALLBACK_CANCEL; } +#if GENLIST_FX_SUPPORT + if (sd->fx_first_captured) + _elm_genlist_fx_clear(ELM_WIDGET_DATA(sd)->obj); +#endif return ECORE_CALLBACK_RENEW; } @@ -4595,6 +4494,10 @@ _item_block_recalc(Item_Block *itb, in++; it->x = 0; it->y = y; +#if GENLIST_PINCH_ZOOM_SUPPORT + if (IS_ROOT_PARENT_IT(it)) + it->item->pan_scrl_y = itb->y + it->y; +#endif y += it->item->h; } if (changed) itb->sd->pan_changed = changed; @@ -4732,6 +4635,48 @@ _edge_bottom_cb(Evas_Object *obj, } static void +_vbar_drag_cb(Evas_Object *obj, + void *data __UNUSED__) +{ + evas_object_smart_callback_call(obj, SIG_VBAR_DRAG, NULL); +} + +static void +_vbar_press_cb(Evas_Object *obj, + void *data __UNUSED__) +{ + evas_object_smart_callback_call(obj, SIG_VBAR_PRESS, NULL); +} + +static void +_vbar_unpress_cb(Evas_Object *obj, + void *data __UNUSED__) +{ + evas_object_smart_callback_call(obj, SIG_VBAR_UNPRESS, NULL); +} + +static void +_hbar_drag_cb(Evas_Object *obj, + void *data __UNUSED__) +{ + evas_object_smart_callback_call(obj, SIG_HBAR_DRAG, NULL); +} + +static void +_hbar_press_cb(Evas_Object *obj, + void *data __UNUSED__) +{ + evas_object_smart_callback_call(obj, SIG_HBAR_PRESS, NULL); +} + +static void +_hbar_unpress_cb(Evas_Object *obj, + void *data __UNUSED__) +{ + evas_object_smart_callback_call(obj, SIG_HBAR_UNPRESS, NULL); +} + +static void _decorate_item_realize(Elm_Gen_Item *it) { char buf[1024]; @@ -4957,6 +4902,12 @@ _elm_genlist_smart_add(Evas_Object *obj) priv->s_iface->edge_right_cb_set(obj, _edge_right_cb); priv->s_iface->edge_top_cb_set(obj, _edge_top_cb); priv->s_iface->edge_bottom_cb_set(obj, _edge_bottom_cb); + priv->s_iface->vbar_drag_cb_set(obj, _vbar_drag_cb); + priv->s_iface->vbar_press_cb_set(obj, _vbar_press_cb); + priv->s_iface->vbar_unpress_cb_set(obj, _vbar_unpress_cb); + priv->s_iface->hbar_drag_cb_set(obj, _hbar_drag_cb); + priv->s_iface->hbar_press_cb_set(obj, _hbar_press_cb); + priv->s_iface->hbar_unpress_cb_set(obj, _hbar_unpress_cb); priv->mode = ELM_LIST_SCROLL; priv->max_items_per_block = MAX_ITEMS_PER_BLOCK; @@ -4964,6 +4915,15 @@ _elm_genlist_smart_add(Evas_Object *obj) priv->longpress_timeout = _elm_config->longpress_timeout; priv->highlight = EINA_TRUE; +#if GENLIST_FX_SUPPORT + priv->fx_mode = EINA_FALSE; + priv->rendered = EINA_FALSE; + priv->fx_first_captured = EINA_FALSE; + priv->fx_playing = EINA_FALSE; + priv->fx_items_deleted = EINA_FALSE; + priv->genlist_clearing = EINA_FALSE; +#endif + priv->pan_obj = evas_object_smart_add (evas_object_evas_get(obj), _elm_genlist_pan_smart_class_new()); pan_data = evas_object_smart_data_get(priv->pan_obj); @@ -5003,7 +4963,6 @@ _elm_genlist_smart_del(Evas_Object *obj) if (sd->multi_timer) ecore_timer_del(sd->multi_timer); if (sd->decorate_it_type) eina_stringshare_del(sd->decorate_it_type); if (sd->scr_hold_timer) ecore_timer_del(sd->scr_hold_timer); - if (sd->tree_effect_animator) ecore_animator_del(sd->tree_effect_animator); evas_object_del(sd->pan_obj); ELM_WIDGET_CLASS(_elm_genlist_parent_sc)->base.del(obj); @@ -5153,7 +5112,14 @@ static Evas_Object * _item_content_get_hook(Elm_Gen_Item *it, const char *part) { - return edje_object_part_swallow_get(VIEW(it), part); + Evas_Object *ret = NULL; + if (it->deco_all_view) + ret = edje_object_part_swallow_get(it->deco_all_view, part); + else if (it->decorate_it_set) + ret = edje_object_part_swallow_get(it->item->deco_it_view, part); + if (!ret) + ret = edje_object_part_swallow_get(VIEW(it), part); + return ret; } static const char * @@ -5161,7 +5127,14 @@ _item_text_get_hook(Elm_Gen_Item *it, const char *part) { if (!it->itc->func.text_get) return NULL; - return edje_object_part_text_get(VIEW(it), part); + const char *ret = NULL; + if (it->deco_all_view) + ret = edje_object_part_text_get(it->deco_all_view, part); + else if (it->decorate_it_set) + ret = edje_object_part_text_get(it->item->deco_it_view, part); + if (!ret) + ret = edje_object_part_text_get(VIEW(it), part); + return ret; } static void @@ -5199,6 +5172,14 @@ static Eina_Bool _item_del_pre_hook(Elm_Object_Item *item) { Elm_Gen_Item *it = (Elm_Gen_Item *)item; + +#if GENLIST_FX_SUPPORT + if ((GL_IT(it)->wsd->fx_mode) && (!GL_IT(it)->wsd->genlist_clearing)) + { + _item_del_pre_fx_process(it); + return EINA_FALSE; + } +#endif _item_free(it); return EINA_TRUE; } @@ -5271,6 +5252,14 @@ _elm_genlist_item_new(Elm_Genlist_Smart_Data *sd, GL_IT(it)->expanded_depth = depth; sd->item_count++; +#if GENLIST_FX_SUPPORT + it->item->num = sd->item_count; + if (sd->fx_mode) + { + sd->fx_items_deleted = EINA_FALSE; + _elm_genlist_fx_capture(ELM_WIDGET_DATA(sd)->obj, 0); + } +#endif return it; } @@ -5581,11 +5570,62 @@ elm_genlist_item_sorted_insert(Evas_Object *obj, return (Elm_Object_Item *)it; } +static void +_elm_genlist_fx_clear(Evas_Object *obj) +{ + ELM_GENLIST_DATA_GET(obj, sd); + + Elm_Gen_FX_Item *fi; + Proxy_Item *pi; + Elm_Gen_Item *it; + + EINA_LIST_FREE(sd->capture_before_items, pi) + { + if ((pi->it) && (GL_IT(pi->it))) GL_IT(pi->it)->has_proxy_it = EINA_FALSE; + if (pi->proxy) evas_object_smart_member_del(pi->proxy); + if (pi->proxy) evas_object_del(pi->proxy); + free(pi); + } + EINA_LIST_FREE(sd->capture_after_items, pi) + { + if ((pi->it) && (GL_IT(pi->it))) GL_IT(pi->it)->has_proxy_it = EINA_FALSE; + if (pi->proxy) evas_object_smart_member_del(pi->proxy); + if (pi->proxy) evas_object_del(pi->proxy); + free(pi); + } + + EINA_LIST_FREE(sd->fx_items, fi) + { + if (fi->trans) elm_transit_del(fi->trans); + free(fi); + } + + EINA_LIST_FREE (sd->pending_unrealized_items, it) + _item_unrealize(it, EINA_FALSE); + + EINA_LIST_FREE (sd->pending_unrealized_decorate_all_items, it) + _decorate_all_item_unrealize(it); + + EINA_LIST_FREE (sd->pending_del_items, it) + { + _item_free(it); + _elm_widget_item_free((Elm_Widget_Item *)it); + } + if (sd->alpha_bg) evas_object_del(sd->alpha_bg); + sd->alpha_bg = NULL; + + sd->genlist_clearing = EINA_TRUE; + sd->fx_playing = EINA_FALSE; + sd->fx_first_captured = EINA_FALSE; + sd->fx_items_deleted = EINA_FALSE; +} + EAPI void elm_genlist_clear(Evas_Object *obj) { ELM_GENLIST_CHECK(obj); ELM_GENLIST_DATA_GET(obj, sd); + Elm_Gen_Item *it; if (sd->state) { @@ -5593,14 +5633,27 @@ elm_genlist_clear(Evas_Object *obj) sd->state = NULL; } +#if GENLIST_FX_SUPPORT + if (sd->fx_mode) + { + _elm_genlist_fx_clear(obj); + sd->genlist_clearing = EINA_TRUE; + sd->rendered = EINA_FALSE; + } +#endif +#if GENLIST_PINCH_ZOOM_SUPPORT + sd->pinch_zoom_h = 0; + sd->realized_top_item = NULL; + sd->pinch_zoom_mode = ELM_GEN_PINCH_ZOOM_NONE; +#endif + //evas_event_freeze(evas_object_evas_get(ELM_WIDGET_DATA(sd)->obj)); // Do not use EINA_INLIST_FOREACH or EINA_INLIST_FOREACH_SAFE // because sd->items can be modified inside elm_widget_item_del() while (sd->items) { - Elm_Gen_Item *it = - EINA_INLIST_CONTAINER_GET(sd->items->last, Elm_Gen_Item); + it = EINA_INLIST_CONTAINER_GET(sd->items->last, Elm_Gen_Item); elm_widget_item_del(it); } sd->items = NULL; @@ -5612,11 +5665,6 @@ elm_genlist_clear(Evas_Object *obj) sd->selected = NULL; sd->anchor_item = NULL; - if (sd->tree_effect_animator) - { - ecore_animator_del(sd->tree_effect_animator); - sd->tree_effect_animator = NULL; - } if (sd->multi_timer) { ecore_timer_del(sd->multi_timer); @@ -5666,6 +5714,10 @@ elm_genlist_clear(Evas_Object *obj) } elm_layout_sizing_eval(ELM_WIDGET_DATA(sd)->obj); sd->s_iface->content_region_show(obj, 0, 0, 0, 0); + +#if GENLIST_FX_SUPPORT + sd->genlist_clearing = EINA_FALSE; +#endif //evas_event_thaw(evas_object_evas_get(ELM_WIDGET_DATA(sd)->obj)); //evas_event_thaw_eval(evas_object_evas_get(ELM_WIDGET_DATA(sd)->obj)); } @@ -5917,44 +5969,6 @@ _elm_genlist_expanded_next_item_get(Elm_Gen_Item *it) return it2; } -static void -_elm_genlist_move_items_set(Elm_Gen_Item *it) -{ - Eina_List *l, *ll; - Elm_Gen_Item *it2 = NULL; - Evas_Coord ox, oy, ow, oh, dh = 0; - - GL_IT(it)->wsd->expanded_next_item = - _elm_genlist_expanded_next_item_get(it); - - if (it->item->expanded) - { - GL_IT(it)->wsd->move_items = elm_genlist_realized_items_get - (ELM_WIDGET_DATA(GL_IT(it)->wsd)->obj); - - EINA_LIST_FOREACH_SAFE(GL_IT(it)->wsd->move_items, l, ll, it2) - { - if (it2 == GL_IT(it)->wsd->expanded_next_item) break; - GL_IT(it)->wsd->move_items = - eina_list_remove(GL_IT(it)->wsd->move_items, it2); - } - } - else - { - evas_object_geometry_get(GL_IT(it)->wsd->pan_obj, &ox, &oy, &ow, &oh); - it2 = GL_IT(it)->wsd->expanded_next_item; - - while (it2 && (dh < oy + oh)) - { - dh += it2->item->h; - GL_IT(it)->wsd->move_items = - eina_list_append(GL_IT(it)->wsd->move_items, it2); - it2 = (Elm_Gen_Item *) - elm_genlist_item_next_get((Elm_Object_Item *)it2); - } - } -} - static Evas_Object * _tray_alpha_bg_create(const Evas_Object *obj) { @@ -5987,14 +6001,11 @@ elm_genlist_item_expanded_set(Elm_Object_Item *item, if (it->item->type != ELM_GENLIST_ITEM_TREE) return; it->item->expanded = expanded; GL_IT(it)->wsd->expanded_item = it; - _elm_genlist_move_items_set(it); - - if (GL_IT(it)->wsd->tree_effect_enabled && !GL_IT(it)->wsd->alpha_bg) - GL_IT(it)->wsd->alpha_bg = _tray_alpha_bg_create(WIDGET(it)); + GL_IT(it)->wsd->expanded_next_item = + _elm_genlist_expanded_next_item_get(it); if (it->item->expanded) { - GL_IT(it)->wsd->move_effect_mode = ELM_GENLIST_TREE_EFFECT_EXPAND; if (it->realized) edje_object_signal_emit(VIEW(it), "elm,state,expanded", "elm"); evas_object_smart_callback_call(WIDGET(it), SIG_EXPANDED, it); @@ -6002,7 +6013,6 @@ elm_genlist_item_expanded_set(Elm_Object_Item *item, } else { - GL_IT(it)->wsd->move_effect_mode = ELM_GENLIST_TREE_EFFECT_CONTRACT; if (it->realized) edje_object_signal_emit(VIEW(it), "elm,state,contracted", "elm"); evas_object_smart_callback_call(WIDGET(it), SIG_CONTRACTED, it); @@ -6159,6 +6169,12 @@ elm_genlist_item_update(Elm_Object_Item *item) #if GENLIST_ENTRY_SUPPORT it->item->unrealize_disabled = EINA_FALSE; #endif + +#if GENLIST_FX_SUPPORT + if (GL_IT(it)->wsd->fx_first_captured) + _elm_genlist_fx_clear(ELM_WIDGET_DATA(GL_IT(it)->wsd)->obj); +#endif + if (GL_IT(it)->wsd->update_job) ecore_job_del(GL_IT(it)->wsd->update_job); GL_IT(it)->wsd->update_job = ecore_job_add(_update_job, GL_IT(it)->wsd); } @@ -6701,13 +6717,6 @@ elm_genlist_decorate_mode_set(Evas_Object *obj, // and user can check whether deocrate_all_mode is enabeld. sd->decorate_all_mode = decorated; - if (sd->tree_effect_animator) - { - ecore_animator_del(sd->tree_effect_animator); - sd->tree_effect_animator = NULL; - } - sd->move_effect_mode = ELM_GENLIST_TREE_EFFECT_NONE; - list = elm_genlist_realized_items_get(obj); if (!sd->decorate_all_mode) { @@ -6729,6 +6738,11 @@ elm_genlist_decorate_mode_set(Evas_Object *obj, } } } +#if GENLIST_FX_SUPPORT + if (sd->fx_first_captured) + _elm_genlist_fx_clear(ELM_WIDGET_DATA(sd)->obj); + +#endif if (sd->calc_job) ecore_job_del(sd->calc_job); sd->calc_job = ecore_job_add(_calc_job, sd); } @@ -6744,6 +6758,7 @@ elm_genlist_reorder_mode_set(Evas_Object *obj, ELM_GENLIST_CHECK(obj); ELM_GENLIST_DATA_GET(obj, sd); + if (sd->reorder_mode == !!reorder_mode) return; sd->reorder_mode = !!reorder_mode; #if 1 // FIXME: difference from upstream list = elm_genlist_realized_items_get(obj); @@ -6974,24 +6989,21 @@ elm_genlist_item_select_mode_get(const Elm_Object_Item *item) return it->select_mode; } +// will be deprecated EAPI void elm_genlist_tree_effect_enabled_set(Evas_Object *obj __UNUSED__, Eina_Bool enabled __UNUSED__) { ELM_GENLIST_CHECK(obj); - //ELM_GENLIST_DATA_GET(obj, sd); - - // FIXME: this is disabed temporarily because of tree animation bug - //sd->tree_effect_enabled = !!enabled; } +// will be deprecated EAPI Eina_Bool -elm_genlist_tree_effect_enabled_get(const Evas_Object *obj) +elm_genlist_tree_effect_enabled_get(const Evas_Object *obj __UNUSED__) { ELM_GENLIST_CHECK(obj) EINA_FALSE; - ELM_GENLIST_DATA_GET(obj, sd); - return sd->tree_effect_enabled; + return EINA_FALSE; } EAPI Elm_Object_Item * @@ -7014,3 +7026,633 @@ elm_genlist_nth_item_get(const Evas_Object *obj, unsigned int nth) return (Elm_Object_Item *)it; } +#if GENLIST_FX_SUPPORT +EAPI void +elm_genlist_fx_mode_set(Evas_Object *obj, Eina_Bool mode) +{ + ELM_GENLIST_CHECK(obj); + ELM_GENLIST_DATA_GET(obj, sd); + + sd->fx_mode = mode; +} + +EAPI Eina_Bool +elm_genlist_fx_mode_get(const Evas_Object *obj) +{ + ELM_GENLIST_CHECK(obj) EINA_FALSE; + ELM_GENLIST_DATA_GET(obj, sd); + + return sd->fx_mode; +} + +static void +_elm_genlist_proxy_item_del(const Elm_Object_Item *item) +{ + Elm_Gen_Item *it = (Elm_Gen_Item *)item; + if ((!it) || (!it->item)) return EINA_FALSE; + + Elm_Genlist_Smart_Data *sd = GL_IT(it)->wsd; + Proxy_Item *pi; + Eina_List *l; + + EINA_LIST_FOREACH(sd->capture_before_items, l, pi) + if (pi->it == it) pi->it = NULL; + + EINA_LIST_FOREACH(sd->capture_after_items, l, pi) + if (pi->it == it) pi->it = NULL; +} + +static Proxy_Item * +_elm_genlist_proxy_item_new(const Elm_Object_Item *item) +{ + Elm_Gen_Item *it = (Elm_Gen_Item *)item; + if ((!it) || (!it->item)) return EINA_FALSE; + int w, h; + + Proxy_Item *pi = NULL; + pi = calloc(1, sizeof(Proxy_Item)); + if (!pi) return NULL; + + pi->proxy = evas_object_image_filled_add + (evas_object_evas_get(ELM_WIDGET_DATA(GL_IT(it)->wsd)->obj)); + if (!pi->proxy) return EINA_FALSE; + evas_object_clip_set(pi->proxy, evas_object_clip_get(GL_IT(it)->wsd->pan_obj)); + evas_object_smart_member_add(pi->proxy, GL_IT(it)->wsd->pan_obj); + evas_object_hide(pi->proxy); + + if ((GL_IT(it)->wsd->decorate_all_mode) && (it->deco_all_view)) + evas_object_image_source_set(pi->proxy, it->deco_all_view); + else + evas_object_image_source_set(pi->proxy, VIEW(it)); + + GL_IT(it)->has_proxy_it = EINA_TRUE; + pi->it = it; + pi->num = it->item->num; + pi->x = it->item->scrl_x; + pi->y = it->item->scrl_y; + pi->w = it->item->w; + pi->h = it->item->h; + + evas_object_geometry_get(VIEW(it), NULL, NULL, &w, &h); + + if (w <= 0 || h <= 0) + { + evas_object_size_hint_min_get(VIEW(it), &w, &h); + evas_object_size_hint_min_set(pi->proxy, w, h); + } + else evas_object_resize(pi->proxy, w, h); + + return pi; +} + +static Eina_Bool +_elm_genlist_fx_capture(Evas_Object *obj, int level) +{ + ELM_GENLIST_DATA_GET(obj, sd); + + Item_Block *itb; + Eina_List *l; + Eina_Bool done = EINA_FALSE; + Elm_Gen_Item *it; + Proxy_Item *pi; + Evas_Coord ox, oy, ow, oh; + + if ((!sd->rendered) || (sd->fx_playing)) return EINA_FALSE; + if ((!level) && (sd->fx_first_captured)) return EINA_FALSE; + if ((level) && (!sd->fx_first_captured)) return EINA_FALSE; + + evas_object_geometry_get(sd->pan_obj, &ox, &oy, &ow, &oh); + + if (!level) + { + sd->fx_first_captured = EINA_TRUE; + EINA_LIST_FREE(sd->capture_before_items, pi) + { + if ((pi->it) && (GL_IT(pi->it))) GL_IT(pi->it)->has_proxy_it = EINA_FALSE; + if (pi->proxy) evas_object_smart_member_del(pi->proxy); + if (pi->proxy) evas_object_del(pi->proxy); + free(pi); + } + } + else + { + EINA_LIST_FREE(sd->capture_after_items, pi) + { + if ((pi->it) && (GL_IT(pi->it))) GL_IT(pi->it)->has_proxy_it = EINA_FALSE; + if (pi->proxy) evas_object_smart_member_del(pi->proxy); + if (pi->proxy) evas_object_del(pi->proxy); + free(pi); + } + + EINA_INLIST_FOREACH(sd->blocks, itb) + { + if (itb->realized) + { + EINA_LIST_FOREACH(itb->items, l, it) + { + if (it->realized && it->item->scrl_y >= oy) + { + sd->realized_top_item = it; + break; + } + } + } + if (sd->realized_top_item) break; + } + } + +#if GENLIST_PINCH_ZOOM_SUPPORT + if (sd->pinch_zoom_mode) + { + EINA_INLIST_FOREACH(sd->blocks, itb) + { + EINA_LIST_FOREACH(itb->items, l, it) + { + + if (IS_ROOT_PARENT_IT(it) && it->realized + && (GL_IT(it)->scrl_y + GL_IT(it)->h >= oy && GL_IT(it)->scrl_y <= oy + oh)) + { + pi = _elm_genlist_proxy_item_new((Elm_Object_Item *)it); + if (!level) sd->capture_before_items = eina_list_append(sd->capture_before_items, pi); + else sd->capture_after_items = eina_list_append(sd->capture_after_items, pi); + } + } + } + if ((sd->pinch_zoom_mode == ELM_GEN_PINCH_ZOOM_CONTRACT) && (level)) return EINA_TRUE; + if ((sd->pinch_zoom_mode == ELM_GEN_PINCH_ZOOM_EXPAND) && (!level)) return EINA_TRUE; + } +#endif + + EINA_INLIST_FOREACH(sd->blocks, itb) + { + if (itb->realized) + { + done = EINA_TRUE; + EINA_LIST_FOREACH(itb->items, l, it) + { +#if GENLIST_PINCH_ZOOM_SUPPORT + if ((sd->pinch_zoom_mode) && (IS_ROOT_PARENT_IT(it))) continue; +#endif + if (it->realized) + { + pi = _elm_genlist_proxy_item_new((Elm_Object_Item *)it); + if (!pi) continue; + if (!level) + sd->capture_before_items = eina_list_append(sd->capture_before_items, pi); + else + sd->capture_after_items = eina_list_append(sd->capture_after_items, pi); + } + } + } + else if (done) break; + } + return EINA_TRUE; +} + +static Elm_Gen_FX_Item * +_elm_genlist_fx_item_find(const Elm_Object_Item *item) +{ + Elm_Gen_Item *it = (Elm_Gen_Item *)item; + if (!it) return EINA_FALSE; + + Elm_Genlist_Smart_Data *sd = GL_IT(it)->wsd; + if (!sd) return NULL; + + Elm_Gen_FX_Item *fi = NULL; + Eina_List *l; + + EINA_LIST_FOREACH(sd->fx_items, l, fi) + { + if (fi->it == it) return fi; + } + return NULL; +} + +static Elm_Gen_FX_Item * +_elm_genlist_fx_item_new(const Proxy_Item *pi) +{ + if ((!pi) || (!pi->it)) return NULL; + + Elm_Gen_FX_Item *fi = NULL; + fi = calloc(1, sizeof(Elm_Gen_FX_Item)); + if (!fi) return NULL; + + fi->it = pi->it; + GL_IT(fi->it)->fi = fi; + fi->proxy = pi->proxy; + fi->num = pi->num; + fi->from.x = fi->to.x = pi->x; + fi->from.y = fi->to.y = pi->y; + fi->from.w = fi->to.w = pi->w; + fi->from.h = fi->to.h = pi->h; + fi->update = EINA_FALSE; + + return fi; +} + +static Elm_Object_Item * +_elm_genlist_fx_item_prev_get(const Elm_Object_Item *item) +{ + Elm_Gen_Item *it; + it = (Elm_Gen_Item *)item; + if ((!it) || (IS_ROOT_PARENT_IT(it))) return NULL; + + while (it) + { + it = ELM_GEN_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->prev); + if (it) break; + } + + return (Elm_Object_Item *)it; +} + +EAPI Eina_Bool +_elm_genlist_fx_items_make(Evas_Object *obj) +{ + ELM_GENLIST_CHECK(obj) EINA_FALSE; + ELM_GENLIST_DATA_GET(obj, sd); + + Elm_Gen_FX_Item *fi; + Proxy_Item *pi; + Eina_List *l; + Elm_Gen_Item *prev = NULL; + Evas_Coord ox, oy, ow, oh, mv_dist, max_mv_dist = 0; + + evas_object_geometry_get(sd->pan_obj, &ox, &oy, &ow, &oh); + + EINA_LIST_FOREACH(sd->capture_before_items, l, pi) + { + fi = _elm_genlist_fx_item_new(pi); + if (fi) sd->fx_items = eina_list_append(sd->fx_items, fi); + } + + EINA_LIST_FOREACH(sd->capture_after_items, l, pi) + { + fi = _elm_genlist_fx_item_find((Elm_Object_Item *)pi->it); + + if (fi) // pi exists in both before and after capture items + { + fi->type = ELM_GEN_ITEM_FX_TYPE_SAME; + fi->update = EINA_TRUE; + fi->to.x = pi->x; + fi->to.y = pi->y; + fi->to.w = pi->w; + fi->to.h = pi->h; + + // find the max distance between before and after capture items + mv_dist = abs(fi->to.y - fi->from.y); + if (max_mv_dist < mv_dist) max_mv_dist = mv_dist; + } + else // pi only exists in after capture items + { + fi = _elm_genlist_fx_item_new(pi); + if (fi) + { + fi->type = ELM_GEN_ITEM_FX_TYPE_ADD; + fi->update = EINA_TRUE; + sd->fx_items = eina_list_append(sd->fx_items, fi); + } + } + } + + EINA_LIST_FOREACH(sd->fx_items, l, fi) + { + // find deleted items + if (!fi->update) // pi only exists in before capture items + { + fi->type = ELM_GEN_ITEM_FX_TYPE_DEL; + fi->update = EINA_TRUE; + + prev = (Elm_Gen_Item *)_elm_genlist_fx_item_prev_get((Elm_Object_Item *)fi->it); + if ((prev) && (GL_IT(prev)->fi)) + { + fi->to.y = GL_IT(prev)->fi->to.y + GL_IT(prev)->fi->to.h; + } + } + else if (fi->type == ELM_GEN_ITEM_FX_TYPE_ADD) + { + prev = (Elm_Gen_Item *)_elm_genlist_fx_item_prev_get((Elm_Object_Item *)fi->it); + if ((prev) && (prev->realized) && (GL_IT(prev)->fi)) + { + fi->from.y = GL_IT(prev)->fi->from.y + GL_IT(prev)->fi->from.h; + } + else + { + if (sd->realized_top_item) + { + + if (fi->num <= sd->realized_top_item->item->num) + fi->from.y -= max_mv_dist; + else + fi->from.y += max_mv_dist; + } + } + } + } + + EINA_LIST_FOREACH(sd->fx_items, l, fi) + { + if (IS_ROOT_PARENT_IT(fi->it)) + { +#if GENLIST_PINCH_ZOOM_SUPPORT + if (sd->pinch_zoom_mode == ELM_GEN_PINCH_ZOOM_CONTRACT) + { + fi->from.y = oy + GL_IT(fi->it)->pan_scrl_y - sd->pinch_pan_y; + } +#endif + if (fi->type == ELM_GEN_ITEM_FX_TYPE_DEL) + { + if (sd->realized_top_item) + { + + if (fi->num <= sd->realized_top_item->item->num) + fi->to.y = oy - fi->from.h; + else + fi->to.y = oy + oh; + } + } + } + } + + return EINA_TRUE; +} + +static Elm_Gen_FX_Item * +_fx_cover_item_get(const Elm_Gen_FX_Item *fi) +{ + Elm_Gen_FX_Item *cover_fi; + Eina_List *l; + if (!fi) return NULL; + + Elm_Genlist_Smart_Data *sd = GL_IT(fi->it)->wsd; + Evas_Coord ox, oy, ow, oh; + evas_object_geometry_get(sd->pan_obj, &ox, &oy, &ow, &oh); + + EINA_LIST_FOREACH(sd->fx_items, l, cover_fi) + { + if (fi == cover_fi) continue; + if (sd->fx_items_deleted) + { + if ((cover_fi->from.y >= oy+oh || cover_fi->from.y > fi->to.y) && (cover_fi->from.y - cover_fi->to.y > 0)) + return cover_fi; + } + else + { + if ((cover_fi->to.y > fi->to.y) && (cover_fi->from.y - cover_fi->to.y < 0)) + return cover_fi; + } + } + return NULL; +} + +static void +_item_fx_op(Elm_Transit_Effect *data, Elm_Transit *transit __UNUSED__, double progress __UNUSED__) +{ + Elm_Gen_FX_Item *fi = data, *cover_it; + Elm_Genlist_Smart_Data *sd = GL_IT(fi->it)->wsd; + Evas_Coord fi_ox, fi_oy, cover_it_ox, cover_it_oy, ox, oy, ow, oh; + + evas_object_show(VIEW(fi->it)); + evas_object_geometry_get(sd->pan_obj, &ox, &oy, &ow, &oh); + evas_object_geometry_get(fi->proxy, &fi_ox, &fi_oy, NULL, NULL); + evas_object_move(fi->proxy, ox, fi_oy); + evas_object_show(fi->proxy); +#if GENLIST_PINCH_ZOOM_SUPPORT + if ((sd->pinch_zoom_mode) && (IS_ROOT_PARENT_IT(fi->it))) evas_object_raise(fi->proxy); +#endif + + if ((!sd->expanded_next_item) || (sd->expanded_next_item == fi->it)) goto raise_event_block; + if (fi->type == ELM_GEN_ITEM_FX_TYPE_SAME) goto raise_event_block; + + // find the closest item that cover current item when deleting + cover_it = _fx_cover_item_get(fi); + if (cover_it) + { + evas_object_geometry_get(cover_it->proxy, &cover_it_ox, &cover_it_oy, NULL, NULL); + + if (sd->fx_items_deleted) + { + if (cover_it_oy + && (fi_oy + fi->to.h >= cover_it_oy + cover_it->to.h ) && (fi->from.y < cover_it->from.y)) + evas_object_hide(fi->proxy); + } + else if (cover_it_oy && (fi_oy >= cover_it_oy)) + evas_object_hide(fi->proxy); + else + evas_object_show(fi->proxy); + } + +raise_event_block: + evas_object_raise(sd->alpha_bg); + + return; +} + + +static void +_item_fx_done(Elm_Transit_Effect *data, Elm_Transit *transit __UNUSED__) +{ + Elm_Gen_FX_Item *fx_done_it = data; + Elm_Genlist_Smart_Data *sd = GL_IT(fx_done_it->it)->wsd; + + if ((!fx_done_it) || (!fx_done_it->it) || (!sd)) return; + + evas_object_image_source_visible_set(fx_done_it->proxy, EINA_TRUE); + evas_object_lower(fx_done_it->proxy); + + if ((sd->decorate_all_mode) && (fx_done_it->it->deco_all_view)) + evas_object_move(fx_done_it->it->deco_all_view, fx_done_it->to.x, fx_done_it->to.y); + else + evas_object_move(VIEW(fx_done_it->it), fx_done_it->to.x, fx_done_it->to.y); + GL_IT(fx_done_it->it)->has_proxy_it = EINA_FALSE; + + evas_object_clip_unset(fx_done_it->proxy); +} + +static void +_item_fx_del_cb(void *data, Elm_Transit *transit __UNUSED__) +{ + Elm_Gen_FX_Item *fx_done_it = data; + Elm_Gen_Item *it = NULL; + Proxy_Item *pi = NULL; + Eina_List *l; + Elm_Genlist_Smart_Data *sd = GL_IT(fx_done_it->it)->wsd; + + if ((!fx_done_it) || (!fx_done_it->it) || (!sd)) return; + + sd->fx_items = eina_list_remove(sd->fx_items, fx_done_it); + GL_IT(fx_done_it->it)->fi = NULL; + free(fx_done_it); + + if (!eina_list_count(sd->fx_items)) + { + EINA_LIST_FREE (sd->pending_unrealized_items, it) + { + if (GL_IT(it)) GL_IT(it)->has_proxy_it = EINA_FALSE; +#if GENLIST_PINCH_ZOOM_SUPPORT + if ((sd->pinch_zoom_mode) && (IS_ROOT_PARENT_IT(it))) continue; +#endif + _item_unrealize(it, EINA_FALSE); + } + EINA_LIST_FREE (sd->pending_unrealized_decorate_all_items, it) + { + if (GL_IT(it)) GL_IT(it)->has_proxy_it = EINA_FALSE; +#if GENLIST_PINCH_ZOOM_SUPPORT + if ((sd->pinch_zoom_mode) && (IS_ROOT_PARENT_IT(it))) continue; +#endif + _decorate_all_item_unrealize(it); + } + + EINA_LIST_FREE (sd->pending_del_items, it) + { + _item_free(it); + _elm_widget_item_free((Elm_Widget_Item *)it); + } + + EINA_LIST_FOREACH(sd->capture_before_items, l, pi) + evas_object_hide(pi->proxy); + EINA_LIST_FOREACH(sd->capture_after_items, l, pi) + evas_object_hide(pi->proxy); + + sd->fx_playing = EINA_FALSE; + sd->fx_first_captured = EINA_FALSE; + evas_object_hide(sd->alpha_bg); + + sd->realized_top_item = NULL; + sd->pan_changed = EINA_TRUE; + evas_object_smart_changed(sd->pan_obj); + } +} + +static void +_elm_genlist_fx_play(Evas_Object *obj) +{ + ELM_GENLIST_CHECK(obj); + ELM_GENLIST_DATA_GET(obj, sd); + + Evas_Coord ox, oy, ow, oh, cvx, cvy, cvw, cvh; + Elm_Gen_FX_Item *fi; + Eina_List *l; + + if (!sd->fx_mode) return; + + EINA_LIST_FREE(sd->fx_items, fi) + { + if (fi->trans) elm_transit_del(fi->trans); + free(fi); + } + _item_cache_all_free(sd); + + _elm_genlist_fx_items_make(obj); + if (!eina_list_count(sd->fx_items) || (sd->queue)) + { + _elm_genlist_fx_clear(obj); + return; + } + + sd->fx_playing = EINA_TRUE; + + if (!sd->alpha_bg) sd->alpha_bg = _tray_alpha_bg_create(obj); + evas_object_show(sd->alpha_bg); + + evas_object_geometry_get(sd->pan_obj, &ox, &oy, &ow, &oh); + evas_output_viewport_get(evas_object_evas_get(obj), &cvx, &cvy, &cvw, &cvh); + + EINA_LIST_FOREACH(sd->fx_items, l, fi) + { + if (!fi->proxy) continue; + + if ((fi->from.y <= oy) || (fi->from.y + fi->from.h >= oy + oh)) + { + if ((sd->decorate_all_mode) && (fi->it->deco_all_view)) + evas_object_move(fi->it->deco_all_view, cvx, fi->to.y); + else + evas_object_move(VIEW(fi->it), cvx, fi->to.y); + } + else if ((fi->to.y <= oy) || (fi->to.y + fi->to.h >= oy + oh)) + { + if ((sd->decorate_all_mode) && (fi->it->deco_all_view)) + evas_object_move(fi->it->deco_all_view, cvx, fi->from.y); + else + evas_object_move(VIEW(fi->it), cvx, fi->from.y); + } + + evas_object_resize(fi->proxy, ow, fi->to.h); + evas_object_show(fi->proxy); + + fi->trans = elm_transit_add(); + elm_transit_object_add(fi->trans, fi->proxy); + + evas_object_image_source_visible_set(fi->proxy, EINA_FALSE); + elm_transit_tween_mode_set(fi->trans, ELM_TRANSIT_TWEEN_MODE_DECELERATE); + + if (fi->type == ELM_GEN_ITEM_FX_TYPE_SAME) + { + evas_object_raise(fi->proxy); + elm_transit_effect_translation_add(fi->trans, fi->from.x, fi->from.y, fi->to.x, fi->to.y); + } + + else if (fi->type == ELM_GEN_ITEM_FX_TYPE_ADD) + { + elm_transit_effect_translation_add(fi->trans, fi->from.x, fi->from.y, fi->to.x, fi->to.y); + elm_transit_effect_color_add(fi->trans, 0, 0, 0, 0, 255, 255, 255, 255); + } + else if (fi->type == ELM_GEN_ITEM_FX_TYPE_DEL) + { + elm_transit_effect_translation_add(fi->trans, fi->from.x, fi->from.y, fi->to.x, fi->to.y); + elm_transit_effect_color_add(fi->trans, 255, 255, 255, 255, 0, 0, 0, 0); + } + elm_transit_effect_add(fi->trans, _item_fx_op, fi, _item_fx_done); + elm_transit_del_cb_set(fi->trans, _item_fx_del_cb, fi); + + elm_transit_duration_set(fi->trans, FX_MOVE_TIME); + elm_transit_objects_final_state_keep_set(fi->trans, EINA_FALSE); + elm_transit_go(fi->trans); + } +} +#endif + +#if GENLIST_PINCH_ZOOM_SUPPORT +EAPI Eina_Bool +elm_genlist_pinch_zoom_mode_set(Evas_Object *obj, Elm_Gen_Pinch_Zoom_Mode mode) +{ + ELM_GENLIST_DATA_GET(obj, sd); + + Item_Block *itb; + Eina_List *l; + Elm_Gen_Item *it; + Eina_Bool done = EINA_FALSE; + + if ((sd->queue) || (!sd->rendered) || (sd->queue_idle_enterer)) return EINA_FALSE; + + EINA_INLIST_FOREACH(sd->blocks, itb) + { + EINA_LIST_FOREACH(itb->items, l, it) + { + + if (IS_ROOT_PARENT_IT(it)) + { + done = EINA_TRUE; + break; + } + } + if (done) break; + } + if (!done) return EINA_FALSE; + + sd->pinch_zoom_mode = mode; + + _item_cache_all_free(sd); + _elm_genlist_fx_capture(obj, 0); + + sd->pinch_pan_y = sd->pan_y; + + if (sd->pinch_zoom_mode == ELM_GEN_PINCH_ZOOM_CONTRACT) + sd->s_iface->content_region_show(obj, 0,0,0,0); + + sd->pan_changed = EINA_TRUE; + evas_object_smart_changed(sd->pan_obj); + + return EINA_TRUE; +} +#endif diff --git a/src/lib/elm_gesture_layer.c b/src/lib/elm_gesture_layer.c index 616ad89..930085f 100644 --- a/src/lib/elm_gesture_layer.c +++ b/src/lib/elm_gesture_layer.c @@ -3424,6 +3424,10 @@ _rotate_test(Evas_Object *obj, Evas_Callback_Type event_type, Elm_Gesture_Type g_type) { + Evas_Event_Flags ev_flag = EVAS_EVENT_FLAG_NONE; + Gesture_Info *gesture; + Rotate_Type *st = NULL; + if (!_elm_config->glayer_rotate_finger_enable) return; @@ -3434,20 +3438,18 @@ _rotate_test(Evas_Object *obj, if (!sd->gesture[g_type]) return; - Gesture_Info *gesture = sd->gesture[g_type]; - Rotate_Type *st; - if (gesture) + gesture = sd->gesture[g_type]; + + if (!gesture) return ; + + st = gesture->data; + if (!st) /* Allocated once on first time */ { - st = gesture->data; - if (!st) /* Allocated once on first time */ - { - st = calloc(1, sizeof(Rotate_Type)); - gesture->data = st; - _rotate_test_reset(gesture); - } + st = calloc(1, sizeof(Rotate_Type)); + gesture->data = st; + _rotate_test_reset(gesture); } - Evas_Event_Flags ev_flag = EVAS_EVENT_FLAG_NONE; switch (event_type) { case EVAS_CALLBACK_MOUSE_MOVE: diff --git a/src/lib/elm_icon.c b/src/lib/elm_icon.c index 7ccf3d9..3ae774b 100644 --- a/src/lib/elm_icon.c +++ b/src/lib/elm_icon.c @@ -218,7 +218,7 @@ _icon_thumb_error(Ethumb_Client *client, ERR("could not generate thumbnail for %s (key: %s)", sd->thumb.file.path, sd->thumb.file.key); - evas_object_smart_callback_call(data, SIG_THUMB_ERROR, NULL); + evas_object_smart_callback_call(ELM_WIDGET_DATA(sd)->obj, SIG_THUMB_ERROR, NULL); _icon_thumb_cleanup(client); } diff --git a/src/lib/elm_index.c b/src/lib/elm_index.c index 4db3292..c32c2e3 100644 --- a/src/lib/elm_index.c +++ b/src/lib/elm_index.c @@ -5,17 +5,22 @@ EAPI const char ELM_INDEX_SMART_NAME[] = "elm_index"; +#define INDEX_DELAY_CHANGE_TIME 0.2 + static const char SIG_CHANGED[] = "changed"; static const char SIG_DELAY_CHANGED[] = "delay,changed"; static const char SIG_SELECTED[] = "selected"; static const char SIG_LEVEL_UP[] = "level,up"; static const char SIG_LEVEL_DOWN[] = "level,down"; +static const char SIG_LANG_CHANGED[] = "language,changed"; + static const Evas_Smart_Cb_Description _smart_callbacks[] = { {SIG_CHANGED, ""}, {SIG_DELAY_CHANGED, ""}, {SIG_SELECTED, ""}, {SIG_LEVEL_UP, ""}, {SIG_LEVEL_DOWN, ""}, + {SIG_LANG_CHANGED, ""}, {NULL, NULL} }; @@ -23,17 +28,25 @@ EVAS_SMART_SUBCLASS_NEW (ELM_INDEX_SMART_NAME, _elm_index, Elm_Index_Smart_Class, Elm_Layout_Smart_Class, elm_layout_smart_class_get, _smart_callbacks); +static Eina_Bool +_elm_index_smart_translate(Evas_Object *obj) +{ + evas_object_smart_callback_call(obj, SIG_LANG_CHANGED, NULL); + return EINA_TRUE; +} + static void _item_free(Elm_Index_Item *it) { ELM_INDEX_DATA_GET(WIDGET(it), sd); sd->items = eina_list_remove(sd->items, it); - if (it->letter) - { - eina_stringshare_del(it->letter); - it->letter = NULL; - } + + if (it->omitted) + it->omitted = eina_list_free(it->omitted); + + if (it->letter) + eina_stringshare_del(it->letter); } static void @@ -86,6 +99,14 @@ _access_info_cb(void *data, Evas_Object *obj __UNUSED__) } static void +_access_widget_item_activate_cb(void *data __UNUSED__, + Evas_Object *part_obj __UNUSED__, + Elm_Object_Item *it) +{ + evas_object_smart_callback_call(WIDGET(it), SIG_SELECTED, it); +} + +static void _access_widget_item_register(Elm_Index_Item *it) { Elm_Access_Info *ai; @@ -96,19 +117,21 @@ _access_widget_item_register(Elm_Index_Item *it) _elm_access_text_set(ai, ELM_ACCESS_TYPE, E_("Index Item")); _elm_access_callback_set(ai, ELM_ACCESS_INFO, _access_info_cb, it); + _elm_access_activate_callback_set + (ai, _access_widget_item_activate_cb, NULL); } static void _omit_calc(void *data, int num_of_items, int max_num_of_items) { Elm_Index_Smart_Data *sd = data; - int max_group_num, num_of_extra_items, i, g, size, sum; + int max_group_num, num_of_extra_items, i, g, size, sum, *group_pos, *omit_info; Elm_Index_Omit *o; - Elm_Index_Item *it, *it2; + Elm_Index_Item *it; Eina_List *l; EINA_LIST_FREE(sd->omit, o) - free(o); + free(o); EINA_LIST_FOREACH(sd->items, l, it) { @@ -117,13 +140,13 @@ _omit_calc(void *data, int num_of_items, int max_num_of_items) if (it->head) it->head = NULL; } - if (max_num_of_items < 3 || num_of_items <= max_num_of_items) return; + if ((max_num_of_items < 3) || (num_of_items <= max_num_of_items)) return; max_group_num = (max_num_of_items - 1) / 2; num_of_extra_items = num_of_items - max_num_of_items; - int group_pos[max_group_num]; - int omit_info[max_num_of_items]; + group_pos = (int *)malloc(sizeof(int) * max_group_num); + omit_info = (int *)malloc(sizeof(int) * max_num_of_items); if (num_of_extra_items >= max_group_num) { @@ -149,7 +172,6 @@ _omit_calc(void *data, int num_of_items, int max_num_of_items) for (i = 0; i < num_of_extra_items; i++) omit_info[group_pos[i % max_group_num]]++; - g = 0; sum = 0; for (i = 0; i < max_num_of_items; i++) { @@ -159,10 +181,12 @@ _omit_calc(void *data, int num_of_items, int max_num_of_items) o->offset = sum; o->count = omit_info[i]; sd->omit = eina_list_append(sd->omit, o); - g++; } sum += omit_info[i]; } + + free(group_pos); + free(omit_info); } // FIXME: always have index filled @@ -174,10 +198,10 @@ _index_box_auto_fill(Evas_Object *obj, int i = 0, max_num_of_items = 0, num_of_items = 0, g = 0, skip = 0; Eina_List *l; Eina_Bool rtl; - Elm_Index_Item *it, *head; - Evas_Coord mw, mh, ih, vh; + Elm_Index_Item *it, *head = NULL; + Evas_Coord mw, mh, ih; + Evas_Object *o; Elm_Index_Omit *om; - Evas_Object *o_odd, *o_even; ELM_INDEX_DATA_GET(obj, sd); @@ -187,26 +211,17 @@ _index_box_auto_fill(Evas_Object *obj, rtl = elm_widget_mirrored_get(obj); - o_odd = edje_object_add(evas_object_evas_get(obj)); - o_even = edje_object_add(evas_object_evas_get(obj)); - - if (!sd->horizontal) + if (sd->omit_enabled) { + o = edje_object_add(evas_object_evas_get(obj)); elm_widget_theme_object_set - (obj, o_odd, "index", "item_odd/vertical", - elm_widget_style_get(obj)); - elm_widget_theme_object_set - (obj, o_even, "index", "item/vertical", + (obj, o, "index", "item/vertical", elm_widget_style_get(obj)); - edje_object_size_min_restricted_calc(o_odd, NULL, &mh, 0, 0); - edje_object_size_min_restricted_calc(o_even, NULL, &vh, 0, 0); - if (vh > mh) mh = vh; + edje_object_size_min_restricted_calc(o, NULL, &mh, 0, 0); EINA_LIST_FOREACH(sd->items, l, it) - { - if (it->level == level) num_of_items++; - } + if (it->level == level) num_of_items++; if (mh != 0) max_num_of_items = ih / mh; @@ -217,12 +232,11 @@ _index_box_auto_fill(Evas_Object *obj, om = eina_list_nth(sd->omit, g); EINA_LIST_FOREACH(sd->items, l, it) { - Evas_Object *o; const char *stacking; if (it->level != level) continue; - if (om && i == om->offset) + if ((om) && (i == om->offset)) { skip = om->count; skip--; @@ -294,11 +308,15 @@ _index_box_auto_fill(Evas_Object *obj, i++; // ACCESS - if ((it->level == 0) && - (_elm_config->access_mode == ELM_ACCESS_MODE_ON)) + if ((it->level == 0) && (_elm_config->access_mode)) _access_widget_item_register(it); } + // TIZEN ONLY adjust the last item's theme according to winset gui + it = eina_list_nth(sd->items, i - 1); + edje_object_signal_emit(VIEW(it), "elm,last,item", "elm"); + // TIZEN ONLY + evas_object_smart_calculate(box); sd->level_active[level] = 1; } @@ -316,7 +334,6 @@ static Eina_Bool _elm_index_smart_theme(Evas_Object *obj) { Evas_Coord minw = 0, minh = 0; - Eina_List *l; Elm_Index_Item *it; ELM_INDEX_DATA_GET(obj, sd); @@ -384,10 +401,13 @@ _elm_index_smart_theme(Evas_Object *obj) } else elm_layout_signal_emit(obj, "elm,state,inactive", "elm"); - EINA_LIST_FOREACH(sd->items, l, it) + it = (Elm_Index_Item *)elm_index_selected_item_get(obj, sd->level); + if (it) { - if (it->selected) - edje_object_signal_emit(VIEW(it), "elm,state,active", "elm"); + if (it->head) + edje_object_signal_emit(VIEW(it->head), "elm,state,active", "elm"); + else + edje_object_signal_emit(VIEW(it), "elm,state,active", "elm"); } return EINA_TRUE; @@ -454,7 +474,7 @@ _item_find(Evas_Object *obj, } static Eina_Bool -_delay_change(void *data) +_delay_change_cb(void *data) { Elm_Object_Item *item; @@ -538,7 +558,7 @@ _sel_eval(Evas_Object *obj, dist = 0x7fffffff; dh = h / size; if (dh == 0) - printf("too many index items to omit\n"); // omit mode not possible + printf("too many index items to omit\n"); //FIXME else { for (j = 0; j < size; j++) @@ -591,39 +611,23 @@ _sel_eval(Evas_Object *obj, it = it_closest; - if (!(it_last && it_last->head && it_last->head == it_closest)) + if (!((it_last) && (it_last->head) && (it_last->head == it_closest))) { edje_object_signal_emit(VIEW(it), "elm,state,active", "elm"); selectraise = edje_object_data_get(VIEW(it), "selectraise"); if ((selectraise) && (!strcmp(selectraise, "on"))) evas_object_raise(VIEW(it)); } - // ACCESS - if (_elm_config->access_mode == ELM_ACCESS_MODE_ON) - { - char *ret; - Eina_Strbuf *buf; - buf = eina_strbuf_new(); - - if (om_closest) - eina_strbuf_append_printf(buf, "index item %s clicked", om_closest->letter); - else - eina_strbuf_append_printf(buf, "index item %s clicked", it->letter); - ret = eina_strbuf_string_steal(buf); - eina_strbuf_free(buf); - - _elm_access_highlight_set(it->base.access_obj); - _elm_access_say(ret); - } if (om_closest) evas_object_smart_callback_call - (obj, SIG_CHANGED, (void *)om_closest); + (obj, SIG_CHANGED, om_closest); else evas_object_smart_callback_call - (obj, SIG_CHANGED, (void *)it); + (obj, SIG_CHANGED, it); if (sd->delay) ecore_timer_del(sd->delay); - sd->delay = ecore_timer_add(0.2, _delay_change, obj); + sd->delay = ecore_timer_add(sd->delay_change_time, + _delay_change_cb, obj); } } if (it_closest) @@ -686,7 +690,6 @@ _on_mouse_down(void *data, if (!sd->autohide_disabled) { _index_box_clear(data, sd->bx[1], 1); - _index_box_auto_fill(data, sd->bx[0], 0); elm_layout_signal_emit(data, "elm,state,active", "elm"); } _sel_eval(data, ev->canvas.x, ev->canvas.y); @@ -778,102 +781,56 @@ _on_mouse_move(void *data, } static void -_on_mouse_in_access(void *data, - Evas *e __UNUSED__, - Evas_Object *o __UNUSED__, - void *event_info __UNUSED__) -{ - ELM_INDEX_DATA_GET(data, sd); - - if (sd->down) return; - - if (!sd->autohide_disabled) - { - _index_box_clear(data, sd->bx[1], 1); - _index_box_auto_fill(data, sd->bx[0], 0); - elm_layout_signal_emit(data, "elm,state,active", "elm"); - } -} - -static void -_on_mouse_move_access(void *data, - Evas *e __UNUSED__, - Evas_Object *o __UNUSED__, - void *event_info) -{ - - Evas_Event_Mouse_Down *ev = event_info; - Elm_Index_Item *it, *it_closest; - Eina_List *l; - Evas_Coord dist = 0; - Evas_Coord x, y, w, h, xx, yy; - - ELM_INDEX_DATA_GET(data, sd); - - it_closest = NULL; - dist = 0x7fffffff; - - EINA_LIST_FOREACH(sd->items, l, it) - { - evas_object_geometry_get(VIEW(it), &x, &y, &w, &h); - xx = x + (w / 2); - yy = y + (h / 2); - x = ev->canvas.x - xx; - y = ev->canvas.y - yy; - x = (x * x) + (y * y); - if ((x < dist) || (!it_closest)) - { - it_closest = it; - dist = x; - } - } - - if (it_closest) - _elm_access_highlight_set(it_closest->base.access_obj); -} - -static void -_on_mouse_out_access(void *data, - Evas *e __UNUSED__, - Evas_Object *o __UNUSED__, - void *event_info __UNUSED__) +_access_activate_cb(void *data, + Evas_Object *part_obj __UNUSED__, + Elm_Object_Item *item __UNUSED__) { + Elm_Index_Item *it; ELM_INDEX_DATA_GET(data, sd); - if (!sd->autohide_disabled) - elm_layout_signal_emit(data, "elm,state,inactive", "elm"); + it = eina_list_nth(sd->items, 0); + _elm_access_highlight_set(it->base.access_obj); + sd->index_focus = EINA_TRUE; } static void _access_index_register(Evas_Object *obj) { Evas_Object *ao; + Elm_Access_Info *ai; elm_widget_can_focus_set(obj, EINA_TRUE); + ao = _elm_access_edje_object_part_object_register (obj, elm_layout_edje_get(obj), "access"); + ai = _elm_access_object_get(ao); + _elm_access_text_set - (_elm_access_object_get(ao), ELM_ACCESS_TYPE, E_("Index")); + (ai, ELM_ACCESS_TYPE, E_("Index")); + _elm_access_activate_callback_set + (ai, _access_activate_cb, obj); } static void -_index_resize_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +_index_resize_cb(void *data, + Evas *e __UNUSED__, + Evas_Object *obj __UNUSED__, + void *event_info __UNUSED__) { ELM_INDEX_DATA_GET_OR_RETURN(data, sd); - if (sd->horizontal) return; + if (!sd->omit_enabled) return; - Eina_List *l; Elm_Index_Item *it; _index_box_clear(data, sd->bx[0], 0); _index_box_auto_fill(data, sd->bx[0], 0); - if (sd->autohide_disabled) - elm_layout_signal_emit(data, "elm,state,active", "elm"); - - EINA_LIST_FOREACH(sd->items, l, it) + it = (Elm_Index_Item *)elm_index_selected_item_get(obj, sd->level); + if (it) { - if (it->selected) + if (it->head) + edje_object_signal_emit(VIEW(it->head), "elm,state,active", "elm"); + else edje_object_signal_emit(VIEW(it), "elm,state,active", "elm"); } } @@ -888,10 +845,6 @@ _elm_index_smart_add(Evas_Object *obj) ELM_WIDGET_CLASS(_elm_index_parent_sc)->base.add(obj); - priv->indicator_disabled = EINA_FALSE; - priv->horizontal = EINA_FALSE; - priv->autohide_disabled = EINA_FALSE; - elm_layout_theme_set (obj, "index", "base/vertical", elm_widget_style_get(obj)); @@ -915,18 +868,6 @@ _elm_index_smart_add(Evas_Object *obj) evas_object_event_callback_add (o, EVAS_CALLBACK_MOUSE_MOVE, _on_mouse_move, obj); - - // ACCESS - if (_elm_config->access_mode == ELM_ACCESS_MODE_ON) - { - evas_object_event_callback_add - (o, EVAS_CALLBACK_MOUSE_IN, _on_mouse_in_access, obj); - evas_object_event_callback_add - (o, EVAS_CALLBACK_MOUSE_MOVE, _on_mouse_move_access, obj); - evas_object_event_callback_add - (o, EVAS_CALLBACK_MOUSE_OUT, _on_mouse_out_access, obj); - } - if (edje_object_part_exists (ELM_WIDGET_DATA(priv)->resize_obj, "elm.swallow.event.1")) { @@ -944,6 +885,9 @@ _elm_index_smart_add(Evas_Object *obj) elm_layout_content_set(obj, "elm.swallow.index.0", priv->bx[0]); evas_object_show(priv->bx[0]); + priv->delay_change_time = INDEX_DELAY_CHANGE_TIME; + priv->omit_enabled = 1; + if (edje_object_part_exists (ELM_WIDGET_DATA(priv)->resize_obj, "elm.swallow.index.1")) { @@ -957,11 +901,15 @@ _elm_index_smart_add(Evas_Object *obj) _mirrored_set(obj, elm_widget_mirrored_get(obj)); elm_layout_sizing_eval(obj); - elm_widget_can_focus_set(obj, EINA_FALSE); // check!! + elm_widget_can_focus_set(obj, EINA_FALSE); // ACCESS - if (_elm_config->access_mode == ELM_ACCESS_MODE_ON) - _access_index_register(obj); + if (_elm_config->access_mode) + { + elm_index_autohide_disabled_set(obj, EINA_TRUE); + elm_layout_signal_emit(obj, "elm,access,state,active", "elm"); + _access_index_register(obj); + } } static void @@ -980,7 +928,7 @@ _elm_index_smart_del(Evas_Object *obj) } EINA_LIST_FREE(sd->omit, o) - free(o); + free(o); if (sd->delay) ecore_timer_del(sd->delay); @@ -997,6 +945,7 @@ _elm_index_smart_focus_next(const Evas_Object *obj, Elm_Index_Item *it; Evas_Object *ao; Evas_Object *po; + Eina_Bool ret; ELM_INDEX_CHECK(obj) EINA_FALSE; ELM_INDEX_DATA_GET(obj, sd); @@ -1009,19 +958,34 @@ _elm_index_smart_focus_next(const Evas_Object *obj, ao = evas_object_data_get(po, "_part_access_obj"); items = eina_list_append(items, ao); - EINA_LIST_FOREACH(sd->items, l, it) + if (sd->index_focus) { - if (it->level != 0) continue; - items = eina_list_append(items, it->base.access_obj); + EINA_LIST_FOREACH(sd->items, l, it) + { + if (it->level != 0) continue; + items = eina_list_append(items, it->base.access_obj); + } } - Eina_Bool ret; ret = elm_widget_focus_list_next_get (obj, items, eina_list_data_get, dir, next); - // to hide index item, if there is nothing to focus on autohide disalbe mode - if ((!sd->autohide_disabled) && (!ret)) - elm_layout_signal_emit((Evas_Object *)obj, "elm,state,inactive", "elm"); + if (!ret) + { + sd->index_focus = EINA_FALSE; + + Evas_Object *it_access_obj = eina_list_nth(items, eina_list_count(items) - 1); + + items = eina_list_free(items); + items = eina_list_append(items, it_access_obj); + items = eina_list_append(items, ao); + + ret = elm_widget_focus_list_next_get(obj, items, eina_list_data_get, dir, next); + + // to hide index item, if there is nothing to focus on autohide disalbe mode + if (!sd->autohide_disabled) + elm_layout_signal_emit((Evas_Object *)obj, "elm,state,inactive", "elm"); + } return ret; } @@ -1043,28 +1007,18 @@ _access_obj_process(Evas_Object *obj, Eina_Bool is_access) if (is_access) { + elm_index_autohide_disabled_set(obj, EINA_TRUE); + elm_layout_signal_emit(obj, "elm,access,state,active", "elm"); _access_index_register(obj); - - evas_object_event_callback_add - (sd->event[0], EVAS_CALLBACK_MOUSE_IN, _on_mouse_in_access, obj); - evas_object_event_callback_add - (sd->event[0], EVAS_CALLBACK_MOUSE_MOVE, _on_mouse_move_access, obj); - evas_object_event_callback_add - (sd->event[0], EVAS_CALLBACK_MOUSE_OUT, _on_mouse_out_access, obj); } else { // opposition of _access_index_register(); + elm_index_autohide_disabled_set(obj, EINA_FALSE); + elm_layout_signal_emit(obj, "elm,access,state,inactive", "elm"); elm_widget_can_focus_set(obj, EINA_FALSE); _elm_access_edje_object_part_object_unregister (obj, elm_layout_edje_get(obj), "access"); - - evas_object_event_callback_del_full - (sd->event[0], EVAS_CALLBACK_MOUSE_IN, _on_mouse_in_access, obj); - evas_object_event_callback_del_full - (sd->event[0], EVAS_CALLBACK_MOUSE_MOVE, _on_mouse_move_access, obj); - evas_object_event_callback_del_full - (sd->event[0], EVAS_CALLBACK_MOUSE_OUT, _on_mouse_out_access, obj); } } @@ -1089,6 +1043,7 @@ _elm_index_smart_set_user(Elm_Index_Smart_Class *sc) ELM_WIDGET_CLASS(sc)->base.del = _elm_index_smart_del; ELM_WIDGET_CLASS(sc)->theme = _elm_index_smart_theme; + ELM_WIDGET_CLASS(sc)->translate = _elm_index_smart_translate; /* not a 'focus chain manager' */ ELM_WIDGET_CLASS(sc)->focus_next = NULL; @@ -1096,7 +1051,7 @@ _elm_index_smart_set_user(Elm_Index_Smart_Class *sc) ELM_LAYOUT_CLASS(sc)->sizing_eval = _elm_index_smart_sizing_eval; - if (_elm_config->access_mode == ELM_ACCESS_MODE_ON) + if (_elm_config->access_mode) ELM_WIDGET_CLASS(sc)->focus_next = _elm_index_smart_focus_next; ELM_WIDGET_CLASS(sc)->access = _access_hook; @@ -1150,7 +1105,6 @@ elm_index_autohide_disabled_set(Evas_Object *obj, if (sd->autohide_disabled) { _index_box_clear(obj, sd->bx[1], 1); - _index_box_auto_fill(obj, sd->bx[0], 0); elm_layout_signal_emit(obj, "elm,state,active", "elm"); } else @@ -1188,24 +1142,55 @@ elm_index_item_level_get(const Evas_Object *obj) return sd->level; } +//FIXME: Should update indicator based on the autohidden status & indicator visiblility EAPI void elm_index_item_selected_set(Elm_Object_Item *it, Eina_Bool selected) { - Evas_Coord x, y, w, h; + Elm_Index_Item *it_sel, *it_last; + Evas_Object *obj = WIDGET(it); ELM_INDEX_ITEM_CHECK_OR_RETURN(it); + ELM_INDEX_DATA_GET(obj, sd); - //FIXME: Should be update indicator based on the autohidden status - //& indicator visiblility + selected = !!selected; + it_sel = (Elm_Index_Item *)it; + if (it_sel->selected == selected) return; if (selected) { - evas_object_geometry_get(VIEW(it), &x, &y, &w, &h); - _sel_eval(WIDGET(it), x + (w / 2), y + (h / 2)); - edje_object_signal_emit(VIEW(it), "elm,state,active", "elm"); + it_last = (Elm_Index_Item *)elm_index_selected_item_get(obj, sd->level); + + if (it_last) + { + it_last->selected = 0; + if (it_last->head) + edje_object_signal_emit(VIEW(it_last->head), "elm,state,inactive", "elm"); + else + edje_object_signal_emit(VIEW(it_last), "elm,state,inactive", "elm"); + } + it_sel->selected = 1; + if (it_sel->head) + edje_object_signal_emit(VIEW(it_sel->head), "elm,state,active", "elm"); + else + edje_object_signal_emit(VIEW(it_sel), "elm,state,active", "elm"); + + evas_object_smart_callback_call + (obj, SIG_CHANGED, it); + evas_object_smart_callback_call + (obj, SIG_SELECTED, it); + if (sd->delay) ecore_timer_del(sd->delay); + sd->delay = ecore_timer_add(sd->delay_change_time, + _delay_change_cb, obj); + } + else + { + it_sel->selected = 0; + if (it_sel->head) + edje_object_signal_emit(VIEW(it_sel->head), "elm,state,inactive", "elm"); + else + edje_object_signal_emit(VIEW(it_sel), "elm,state,inactive", "elm"); } - else _sel_eval(WIDGET(it), -99999, -9999); } EAPI Elm_Object_Item * @@ -1407,8 +1392,13 @@ elm_index_level_go(Evas_Object *obj, ELM_INDEX_CHECK(obj); ELM_INDEX_DATA_GET(obj, sd); + _index_box_clear(obj, sd->bx[0], 0); _index_box_auto_fill(obj, sd->bx[0], 0); - if (sd->level == 1) _index_box_auto_fill(obj, sd->bx[1], 1); + if (sd->level == 1) + { + _index_box_clear(obj, sd->bx[1], 1); + _index_box_auto_fill(obj, sd->bx[1], 1); + } } EAPI void @@ -1456,6 +1446,8 @@ elm_index_horizontal_set(Evas_Object *obj, if (horizontal == sd->horizontal) return; sd->horizontal = horizontal; + if (horizontal) + sd->omit_enabled = EINA_FALSE; _elm_index_smart_theme(obj); } @@ -1467,3 +1459,52 @@ elm_index_horizontal_get(const Evas_Object *obj) return sd->horizontal; } + +EAPI void +elm_index_delay_change_time_set(Evas_Object *obj, double delay_change_time) +{ + ELM_INDEX_CHECK(obj); + ELM_INDEX_DATA_GET(obj, sd); + + sd->delay_change_time = delay_change_time; +} + +EAPI double +elm_index_delay_change_time_get(const Evas_Object *obj) +{ + ELM_INDEX_CHECK(obj) 0.0; + ELM_INDEX_DATA_GET(obj, sd); + + return sd->delay_change_time; +} + +EAPI void +elm_index_omit_enabled_set(Evas_Object *obj, + Eina_Bool enabled) +{ + ELM_INDEX_CHECK(obj); + ELM_INDEX_DATA_GET(obj, sd); + + if (sd->horizontal) return; + + enabled = !!enabled; + if (sd->omit_enabled == enabled) return; + sd->omit_enabled = enabled; + + _index_box_clear(obj, sd->bx[0], 0); + _index_box_auto_fill(obj, sd->bx[0], 0); + if (sd->level == 1) + { + _index_box_clear(obj, sd->bx[1], 1); + _index_box_auto_fill(obj, sd->bx[1], 1); + } +} + +EAPI Eina_Bool +elm_index_omit_enabled_get(const Evas_Object *obj) +{ + ELM_INDEX_CHECK(obj) EINA_FALSE; + ELM_INDEX_DATA_GET(obj, sd); + + return sd->omit_enabled; +} diff --git a/src/lib/elm_index.h b/src/lib/elm_index.h index f3f58f3..d19b477 100644 --- a/src/lib/elm_index.h +++ b/src/lib/elm_index.h @@ -41,6 +41,7 @@ * level to the second level * - @c "level,down" - when the user moves a finger from the second * level to the first level + * - @c "language,changed" - the program's language changed * * The @c "delay,changed" event is so that it'll wait a small time * before actually reporting those events and, moreover, just the @@ -297,10 +298,16 @@ EAPI Elm_Object_Item *elm_index_item_find(Evas_Object *obj, const void *dat EAPI void elm_index_item_clear(Evas_Object *obj); /** - * Go to a given items level on a index widget + * Flush the changes made to the index items so they work correctly + * + * This flushes any changes made to items indicating the object is ready to + * go. You should call this before any changes you expect to work. This + * is similar to elm_list_go(). * * @param obj The index object - * @param level The index level (one of @c 0 or @c 1) + * @param level The index level (one of @c 0 or @c 1) where changes were made + * + * @warning If not called, it won't display the index properly. * * @ingroup Index */ @@ -376,5 +383,55 @@ EAPI void elm_index_horizontal_set(Evas_Object *obj, Eina_B EAPI Eina_Bool elm_index_horizontal_get(const Evas_Object *obj); /** + * Set a delay change time for index object. + * + * @param obj The index object. + * @param delay_change_time The delay change time to set. + * + * @note delay time is 0.2 sec by default. + * + * @see elm_index_delay_change_time_get + * + * @ingroup Index + */ +EAPI void elm_index_delay_change_time_set(Evas_Object *obj, double delay_change_time); + +/** + * Get a delay change time for index object. + * + * @param obj The index object. + * @return delay change time in seconds + * + * @see elm_index_delay_change_time_set + * + * @ingroup Index + */ +EAPI double elm_index_delay_change_time_get(const Evas_Object *obj); + +/** + * Enable or disable omit feature for a given index widget. + * + * @param obj The index object + * @param enabled @c EINA_TRUE to enable omit feature, @c EINA_FALSE to disable + * + * @see elm_index_omit_enabled_get() + * + * @ingroup Index + */ +EAPI void elm_index_omit_enabled_set(Evas_Object *obj, Eina_Bool enabled); + +/** + * Get whether omit feature is enabled or not for a given index widget. + * + * @param obj The index object + * @return @c EINA_TRUE, if omit feature is enabled, @c EINA_FALSE otherwise + * + * @see elm_index_omit_enabled_set() for more details + * + * @ingroup Index + */ +EAPI Eina_Bool elm_index_omit_enabled_get(const Evas_Object *obj); + +/** * @} */ diff --git a/src/lib/elm_interface_scrollable.c b/src/lib/elm_interface_scrollable.c index 2edc646..0365eed 100644 --- a/src/lib/elm_interface_scrollable.c +++ b/src/lib/elm_interface_scrollable.c @@ -4,25 +4,22 @@ static const char PAN_SMART_NAME[] = "elm_pan"; -#define ELM_PAN_DATA_GET(o, sd) \ - Elm_Pan_Smart_Data * sd = evas_object_smart_data_get(o) - -#define ELM_PAN_DATA_GET_OR_RETURN(o, ptr) \ - ELM_PAN_DATA_GET(o, ptr); \ - if (!ptr) \ - { \ - CRITICAL("No smart data for object %p (%s)", \ - o, evas_object_type_get(o)); \ - return; \ +#define ELM_PAN_DATA_GET_OR_RETURN(o, ptr) \ + Elm_Pan_Smart_Data *ptr = evas_object_smart_data_get(o); \ + if (!ptr) \ + { \ + CRITICAL("No smart data for object %p (%s)", \ + o, evas_object_type_get(o)); \ + return; \ } -#define ELM_PAN_DATA_GET_OR_RETURN_VAL(o, ptr, val) \ - ELM_PAN_DATA_GET(o, ptr); \ - if (!ptr) \ - { \ - CRITICAL("No smart data for object %p (%s)", \ - o, evas_object_type_get(o)); \ - return val; \ +#define ELM_PAN_DATA_GET_OR_RETURN_VAL(o, ptr, val) \ + Elm_Pan_Smart_Data *ptr = evas_object_smart_data_get(o); \ + if (!ptr) \ + { \ + CRITICAL("No smart data for object %p (%s)", \ + o, evas_object_type_get(o)); \ + return val; \ } static const char SIG_CHANGED[] = "changed"; @@ -116,7 +113,7 @@ _elm_pan_smart_move(Evas_Object *obj, Evas_Coord x, Evas_Coord y) { - ELM_PAN_DATA_GET(obj, psd); + ELM_PAN_DATA_GET_OR_RETURN(obj, psd); /* we don't want the clipped smart object version here */ @@ -131,7 +128,7 @@ _elm_pan_smart_resize(Evas_Object *obj, Evas_Coord w, Evas_Coord h) { - ELM_PAN_DATA_GET(obj, psd); + ELM_PAN_DATA_GET_OR_RETURN(obj, psd); psd->w = w; psd->h = h; @@ -143,7 +140,7 @@ _elm_pan_smart_resize(Evas_Object *obj, static void _elm_pan_smart_show(Evas_Object *obj) { - ELM_PAN_DATA_GET(obj, psd); + ELM_PAN_DATA_GET_OR_RETURN(obj, psd); _elm_pan_parent_sc->show(obj); @@ -154,7 +151,7 @@ _elm_pan_smart_show(Evas_Object *obj) static void _elm_pan_smart_hide(Evas_Object *obj) { - ELM_PAN_DATA_GET(obj, psd); + ELM_PAN_DATA_GET_OR_RETURN(obj, psd); _elm_pan_parent_sc->hide(obj); @@ -167,7 +164,7 @@ _elm_pan_pos_set(Evas_Object *obj, Evas_Coord x, Evas_Coord y) { - ELM_PAN_DATA_GET(obj, psd); + ELM_PAN_DATA_GET_OR_RETURN(obj, psd); if ((x == psd->px) && (y == psd->py)) return; psd->px = x; @@ -182,7 +179,7 @@ _elm_pan_pos_get(const Evas_Object *obj, Evas_Coord *x, Evas_Coord *y) { - ELM_PAN_DATA_GET(obj, psd); + ELM_PAN_DATA_GET_OR_RETURN(obj, psd); if (x) *x = psd->px; if (y) *y = psd->py; @@ -193,7 +190,7 @@ _elm_pan_pos_max_get(const Evas_Object *obj, Evas_Coord *x, Evas_Coord *y) { - ELM_PAN_DATA_GET(obj, psd); + ELM_PAN_DATA_GET_OR_RETURN(obj, psd); if (x) { @@ -223,7 +220,7 @@ _elm_pan_content_size_get(const Evas_Object *obj, Evas_Coord *w, Evas_Coord *h) { - ELM_PAN_DATA_GET(obj, psd); + ELM_PAN_DATA_GET_OR_RETURN(obj, psd); if (w) *w = psd->content_w; if (h) *h = psd->content_h; @@ -234,7 +231,7 @@ _elm_pan_gravity_set(Evas_Object *obj, double x, double y) { - ELM_PAN_DATA_GET(obj, psd); + ELM_PAN_DATA_GET_OR_RETURN(obj, psd); psd->gravity_x = x; psd->gravity_y = y; @@ -249,7 +246,7 @@ _elm_pan_gravity_get(const Evas_Object *obj, double *x, double *y) { - ELM_PAN_DATA_GET(obj, psd); + ELM_PAN_DATA_GET_OR_RETURN(obj, psd); if (x) *x = psd->gravity_x; if (y) *y = psd->gravity_y; @@ -321,7 +318,7 @@ _elm_pan_content_set(Evas_Object *obj, { Evas_Coord w, h; - ELM_PAN_DATA_GET(obj, psd); + ELM_PAN_DATA_GET_OR_RETURN(obj, psd); if (content == psd->content) return; if (psd->content) @@ -362,26 +359,24 @@ end: static const char SCROLL_SMART_NAME[] = "elm_scroll"; -#define ELM_SCROLL_IFACE_DATA_GET(o, sid) \ - Elm_Scrollable_Smart_Interface_Data * sid = \ - evas_object_smart_interface_data_get(o, &(ELM_SCROLLABLE_IFACE.base)) - -#define ELM_SCROLL_IFACE_DATA_GET_OR_RETURN(o, ptr) \ - ELM_SCROLL_IFACE_DATA_GET(o, ptr); \ - if (!ptr) \ - { \ - CRITICAL("No interface data for object %p (%s)", \ - o, evas_object_type_get(o)); \ - return; \ +#define ELM_SCROLL_IFACE_DATA_GET_OR_RETURN(o, ptr) \ + Elm_Scrollable_Smart_Interface_Data *ptr = \ + evas_object_smart_interface_data_get(o, &(ELM_SCROLLABLE_IFACE.base)); \ + if (!ptr) \ + { \ + CRITICAL("No interface data for object %p (%s)", \ + o, evas_object_type_get(o)); \ + return; \ } -#define ELM_SCROLL_IFACE_DATA_GET_OR_RETURN_VAL(o, ptr, val) \ - ELM_SCROLL_IFACE_DATA_GET(o, ptr); \ - if (!ptr) \ - { \ - CRITICAL("No interface data for object %p (%s)", \ - o, evas_object_type_get(o)); \ - return val; \ +#define ELM_SCROLL_IFACE_DATA_GET_OR_RETURN_VAL(o, ptr, val) \ + Elm_Scrollable_Smart_Interface_Data *ptr = \ + evas_object_smart_interface_data_get(o, &(ELM_SCROLLABLE_IFACE.base)); \ + if (!ptr) \ + { \ + CRITICAL("No interface data for object %p (%s)", \ + o, evas_object_type_get(o)); \ + return val; \ } static void _elm_scroll_scroll_bar_size_adjust( @@ -392,7 +387,8 @@ static void _elm_scroll_content_pos_get(const Evas_Object *, Evas_Coord *); static void _elm_scroll_content_pos_set(Evas_Object *, Evas_Coord, - Evas_Coord); + Evas_Coord, + Eina_Bool); #define LEFT 0 #define RIGHT 1 @@ -408,7 +404,7 @@ _elm_direction_arrows_eval(Elm_Scrollable_Smart_Interface_Data *sid) Evas_Coord x = 0, y = 0, mx = 0, my = 0, minx = 0, miny = 0; if (!sid->edje_obj || !sid->pan_obj) return; - ELM_PAN_DATA_GET(sid->pan_obj, psd); + ELM_PAN_DATA_GET_OR_RETURN(sid->pan_obj, psd); psd->api->pos_max_get(sid->pan_obj, &mx, &my); psd->api->pos_min_get(sid->pan_obj, &minx, &miny); @@ -653,7 +649,7 @@ _elm_scroll_scroll_bar_size_adjust(Elm_Scrollable_Smart_Interface_Data *sid) { if (!sid->pan_obj || !sid->edje_obj) return; - ELM_PAN_DATA_GET(sid->pan_obj, psd); + ELM_PAN_DATA_GET_OR_RETURN(sid->pan_obj, psd); if ((sid->content) || (sid->extern_pan)) { @@ -752,7 +748,7 @@ _elm_scroll_scroll_bar_read_and_update( if (!sid->edje_obj || !sid->pan_obj) return; - ELM_PAN_DATA_GET(sid->pan_obj, psd); + ELM_PAN_DATA_GET_OR_RETURN(sid->pan_obj, psd); if ((sid->down.dragged) || (sid->down.bounce_x_animator) || (sid->down.bounce_y_animator) || (sid->down.momentum_animator) @@ -803,6 +799,44 @@ _elm_scroll_anim_stop(Elm_Scrollable_Smart_Interface_Data *sid) } static void +_elm_scroll_vbar_drag_cb(void *data, + Evas_Object *obj __UNUSED__, + const char *emission __UNUSED__, + const char *source __UNUSED__) +{ + Elm_Scrollable_Smart_Interface_Data *sid = data; + + if (sid->cb_func.vbar_drag) + sid->cb_func.vbar_drag(sid->obj, NULL); + + _elm_scroll_scroll_bar_read_and_update(sid); +} + +static void +_elm_scroll_vbar_press_cb(void *data, + Evas_Object *obj __UNUSED__, + const char *emission __UNUSED__, + const char *source __UNUSED__) +{ + Elm_Scrollable_Smart_Interface_Data *sid = data; + + if (sid->cb_func.vbar_press) + sid->cb_func.vbar_press(sid->obj, NULL); +} + +static void +_elm_scroll_vbar_unpress_cb(void *data, + Evas_Object *obj __UNUSED__, + const char *emission __UNUSED__, + const char *source __UNUSED__) +{ + Elm_Scrollable_Smart_Interface_Data *sid = data; + + if (sid->cb_func.vbar_unpress) + sid->cb_func.vbar_unpress(sid->obj, NULL); +} + +static void _elm_scroll_edje_drag_v_start_cb(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, @@ -840,6 +874,44 @@ _elm_scroll_edje_drag_v_cb(void *data, } static void +_elm_scroll_hbar_drag_cb(void *data, + Evas_Object *obj __UNUSED__, + const char *emission __UNUSED__, + const char *source __UNUSED__) +{ + Elm_Scrollable_Smart_Interface_Data *sid = data; + + if (sid->cb_func.hbar_drag) + sid->cb_func.hbar_drag(sid->obj, NULL); + + _elm_scroll_scroll_bar_read_and_update(sid); +} + +static void +_elm_scroll_hbar_press_cb(void *data, + Evas_Object *obj __UNUSED__, + const char *emission __UNUSED__, + const char *source __UNUSED__) +{ + Elm_Scrollable_Smart_Interface_Data *sid = data; + + if (sid->cb_func.hbar_press) + sid->cb_func.hbar_press(sid->obj, NULL); +} + +static void +_elm_scroll_hbar_unpress_cb(void *data, + Evas_Object *obj __UNUSED__, + const char *emission __UNUSED__, + const char *source __UNUSED__) +{ + Elm_Scrollable_Smart_Interface_Data *sid = data; + + if (sid->cb_func.hbar_unpress) + sid->cb_func.hbar_unpress(sid->obj, NULL); +} + +static void _elm_scroll_edje_drag_h_start_cb(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, @@ -932,7 +1004,7 @@ _elm_scroll_x_mirrored_get(const Evas_Object *obj, if (!sid->pan_obj) return 0; - ELM_PAN_DATA_GET(sid->pan_obj, psd); + ELM_PAN_DATA_GET_OR_RETURN_VAL(sid->pan_obj, psd, 0); _elm_scroll_content_viewport_size_get(obj, &w, NULL); psd->api->content_size_get(sid->pan_obj, &cw, &ch); @@ -952,7 +1024,7 @@ _elm_scroll_wanted_coordinates_update(Elm_Scrollable_Smart_Interface_Data *sid, if (!sid->pan_obj) return; - ELM_PAN_DATA_GET(sid->pan_obj, psd); + ELM_PAN_DATA_GET_OR_RETURN(sid->pan_obj, psd); psd->api->content_size_get(sid->pan_obj, &cw, &ch); @@ -1034,7 +1106,7 @@ _elm_scroll_bounce_x_animator(void *data) } x = sid->down.b2x + (int)((double)(dx - odx) * r); if (!sid->down.cancelled) - _elm_scroll_content_pos_set(sid->obj, x, y); + _elm_scroll_content_pos_set(sid->obj, x, y, EINA_TRUE); if (dt >= 1.0) { if (sid->down.momentum_animator) @@ -1090,7 +1162,7 @@ _elm_scroll_bounce_y_animator(void *data) } y = sid->down.b2y + (int)((double)(dy - ody) * r); if (!sid->down.cancelled) - _elm_scroll_content_pos_set(sid->obj, x, y); + _elm_scroll_content_pos_set(sid->obj, x, y, EINA_TRUE); if (dt >= 1.0) { if (sid->down.momentum_animator) @@ -1118,7 +1190,7 @@ _elm_scroll_bounce_eval(Elm_Scrollable_Smart_Interface_Data *sid) if (!sid->pan_obj) return; - ELM_PAN_DATA_GET(sid->pan_obj, psd); + ELM_PAN_DATA_GET_OR_RETURN(sid->pan_obj, psd); if (sid->freeze) return; if ((!sid->bouncemex) && (!sid->bouncemey)) return; @@ -1207,7 +1279,7 @@ _elm_scroll_content_pos_get(const Evas_Object *obj, if (!sid->pan_obj) return; - ELM_PAN_DATA_GET(sid->pan_obj, psd); + ELM_PAN_DATA_GET_OR_RETURN(sid->pan_obj, psd); psd->api->pos_get(sid->pan_obj, x, y); } @@ -1215,9 +1287,10 @@ _elm_scroll_content_pos_get(const Evas_Object *obj, static void _elm_scroll_content_pos_set(Evas_Object *obj, Evas_Coord x, - Evas_Coord y) + Evas_Coord y, + Eina_Bool sig) { - Evas_Coord mx = 0, my = 0, px = 0, py = 0, minx = 0, miny = 0; + Evas_Coord mx = 0, my = 0, px = 0, py = 0, spx = 0, spy = 0, minx = 0, miny = 0; Evas_Coord cw =0, ch = 0, ww = 0, wh = 0; //// TIZEN ONLY double vx, vy; @@ -1225,7 +1298,7 @@ _elm_scroll_content_pos_set(Evas_Object *obj, if (!sid->edje_obj || !sid->pan_obj) return; - ELM_PAN_DATA_GET(sid->pan_obj, psd); + ELM_PAN_DATA_GET_OR_RETURN(sid->pan_obj, psd); // FIXME: allow for bounce outside of range psd->api->pos_max_get(sid->pan_obj, &mx, &my); @@ -1233,24 +1306,6 @@ _elm_scroll_content_pos_set(Evas_Object *obj, psd->api->content_size_get(sid->pan_obj, &cw, &ch); //// TIZEN ONLY _elm_scroll_content_viewport_size_get(obj, &ww, &wh); //// TIZEN ONLY - if (mx > 0) vx = (double)(x - minx) / (double)mx; - else vx = 0.0; - - if (vx < 0.0) vx = 0.0; - else if (vx > 1.0) - vx = 1.0; - - if (my > 0) vy = (double)(y - miny) / (double)my; - else vy = 0.0; - - if (vy < 0.0) vy = 0.0; - else if (vy > 1.0) - vy = 1.0; - - edje_object_part_drag_value_set - (sid->edje_obj, "elm.dragable.vbar", 0.0, vy); - edje_object_part_drag_value_set - (sid->edje_obj, "elm.dragable.hbar", vx, 0.0); psd->api->pos_get(sid->pan_obj, &px, &py); //// TIZEN ONLY if (cw > ww) @@ -1288,7 +1343,28 @@ _elm_scroll_content_pos_set(Evas_Object *obj, } psd->api->pos_set(sid->pan_obj, x, y); - if ((px != x) || (py != y)) + psd->api->pos_get(sid->pan_obj, &spx, &spy); + + if (mx > 0) vx = (double)(spx - minx) / (double)mx; + else vx = 0.0; + + if (vx < 0.0) vx = 0.0; + else if (vx > 1.0) + vx = 1.0; + + if (my > 0) vy = (double)(spy - miny) / (double)my; + else vy = 0.0; + + if (vy < 0.0) vy = 0.0; + else if (vy > 1.0) + vy = 1.0; + + edje_object_part_drag_value_set + (sid->edje_obj, "elm.dragable.vbar", 0.0, vy); + edje_object_part_drag_value_set + (sid->edje_obj, "elm.dragable.hbar", vx, 0.0); + + if (sig && ((px != x) || (py != y))) edje_object_signal_emit(sid->edje_obj, "elm,action,scroll", "elm"); if (!sid->down.bounce_x_animator) { @@ -1318,37 +1394,40 @@ _elm_scroll_content_pos_set(Evas_Object *obj, if (sid->cb_func.scroll) sid->cb_func.scroll(obj, NULL); } - if (x != px) - { - if (x == minx) - { - if (sid->cb_func.edge_left) - sid->cb_func.edge_left(obj, NULL); - edje_object_signal_emit(sid->edje_obj, "elm,edge,left", "elm"); - } - if (x == (mx + minx)) - { - if (sid->cb_func.edge_right) - sid->cb_func.edge_right(obj, NULL); - edje_object_signal_emit(sid->edje_obj, "elm,edge,right", "elm"); - } - } - if (y != py) + if (sig) { - if (y == miny) + if (x != px) { - if (sid->cb_func.edge_top) - sid->cb_func.edge_top(obj, NULL); - edje_object_signal_emit(sid->edje_obj, "elm,edge,top", "elm"); + if (x == minx) + { + if (sid->cb_func.edge_left) + sid->cb_func.edge_left(obj, NULL); + edje_object_signal_emit(sid->edje_obj, "elm,edge,left", "elm"); + } + if (x == (mx + minx)) + { + if (sid->cb_func.edge_right) + sid->cb_func.edge_right(obj, NULL); + edje_object_signal_emit(sid->edje_obj, "elm,edge,right", "elm"); + } } - if (y == my + miny) + if (y != py) { - if (sid->cb_func.edge_bottom) - sid->cb_func.edge_bottom(obj, NULL); - edje_object_signal_emit(sid->edje_obj, "elm,edge,bottom", "elm"); + if (y == miny) + { + if (sid->cb_func.edge_top) + sid->cb_func.edge_top(obj, NULL); + edje_object_signal_emit(sid->edje_obj, "elm,edge,top", "elm"); + } + if (y == my + miny) + { + if (sid->cb_func.edge_bottom) + sid->cb_func.edge_bottom(obj, NULL); + edje_object_signal_emit(sid->edje_obj, "elm,edge,bottom", "elm"); + } } } - + _elm_direction_arrows_eval(sid); } @@ -1375,7 +1454,7 @@ _elm_scroll_mirrored_set(Evas_Object *obj, else wx = sid->wx; - _elm_scroll_content_pos_set(sid->obj, wx, sid->wy); + _elm_scroll_content_pos_set(sid->obj, wx, sid->wy, EINA_FALSE); } /* returns TRUE when we need to move the scroller, FALSE otherwise. @@ -1394,7 +1473,7 @@ _elm_scroll_content_region_show_internal(Evas_Object *obj, if (!sid->pan_obj) return EINA_FALSE; - ELM_PAN_DATA_GET(sid->pan_obj, psd); + ELM_PAN_DATA_GET_OR_RETURN_VAL(sid->pan_obj, psd, EINA_FALSE); psd->api->pos_max_get(sid->pan_obj, &mx, &my); psd->api->pos_min_get(sid->pan_obj, &minx, &miny); @@ -1491,7 +1570,7 @@ _elm_scroll_content_region_set(Evas_Object *obj, if (_elm_scroll_content_region_show_internal(obj, &x, &y, w, h)) { - _elm_scroll_content_pos_set(obj, x, y); + _elm_scroll_content_pos_set(obj, x, y, EINA_FALSE); sid->down.sx = x; sid->down.sy = y; sid->down.x = sid->down.history[0].x; @@ -1516,7 +1595,7 @@ _elm_scroll_content_region_show(Evas_Object *obj, sid->wh = h; if (_elm_scroll_content_region_show_internal(obj, &x, &y, w, h)) { - _elm_scroll_content_pos_set(obj, x, y); + _elm_scroll_content_pos_set(obj, x, y, EINA_TRUE); sid->down.sx = x; sid->down.sy = y; sid->down.x = sid->down.history[0].x; @@ -1570,7 +1649,7 @@ _elm_scroll_wheel_event_cb(void *data, int direction = 0; sid = data; - ELM_PAN_DATA_GET(sid->pan_obj, psd); + ELM_PAN_DATA_GET_OR_RETURN(sid->pan_obj, psd); ev = event_info; direction = ev->direction; if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return; @@ -1581,7 +1660,7 @@ _elm_scroll_wheel_event_cb(void *data, (evas_key_modifier_is_set(ev->modifiers, "Super"))) return; else if (evas_key_modifier_is_set(ev->modifiers, "Shift")) - direction = 1; + direction = !direction; _elm_scroll_content_pos_get(sid->obj, &x, &y); if ((sid->down.bounce_x_animator) || (sid->down.bounce_y_animator) || (sid->scrollto.x.animator) || (sid->scrollto.y.animator)) @@ -1634,7 +1713,7 @@ _elm_scroll_wheel_event_cb(void *data, if ((!sid->hold) && (!sid->freeze)) { _elm_scroll_wanted_coordinates_update(sid, x, y); - _elm_scroll_content_pos_set(sid->obj, x, y); + _elm_scroll_content_pos_set(sid->obj, x, y, EINA_TRUE); } } @@ -1674,7 +1753,7 @@ _elm_scroll_momentum_animator(void *data) if (!sid->pan_obj) return ECORE_CALLBACK_CANCEL; - ELM_PAN_DATA_GET(sid->pan_obj, psd); + ELM_PAN_DATA_GET_OR_RETURN_VAL(sid->pan_obj, psd, ECORE_CALLBACK_CANCEL); t = ecore_loop_time_get(); dt = t - sid->down.anim_start; @@ -1704,7 +1783,7 @@ _elm_scroll_momentum_animator(void *data) sid->down.by = sid->down.by0 - dy + sid->down.b0y; y = py; } - _elm_scroll_content_pos_set(sid->obj, x, y); + _elm_scroll_content_pos_set(sid->obj, x, y, EINA_TRUE); _elm_scroll_wanted_coordinates_update(sid, x, y); psd->api->pos_max_get(sid->pan_obj, &maxx, &maxy); psd->api->pos_min_get(sid->pan_obj, &minx, &miny); @@ -1749,7 +1828,7 @@ _elm_scroll_page_x_get(Elm_Scrollable_Smart_Interface_Data *sid, if (!sid->pan_obj) return 0; - ELM_PAN_DATA_GET(sid->pan_obj, psd); + ELM_PAN_DATA_GET_OR_RETURN_VAL(sid->pan_obj, psd, 0); _elm_scroll_content_pos_get(sid->obj, &x, &y); _elm_scroll_content_viewport_size_get(sid->obj, &w, &h); @@ -1780,7 +1859,7 @@ _elm_scroll_page_y_get(Elm_Scrollable_Smart_Interface_Data *sid, if (!sid->pan_obj) return 0; - ELM_PAN_DATA_GET(sid->pan_obj, psd); + ELM_PAN_DATA_GET_OR_RETURN_VAL(sid->pan_obj, psd, 0); _elm_scroll_content_pos_get(sid->obj, &x, &y); _elm_scroll_content_viewport_size_get(sid->obj, &w, &h); @@ -1812,7 +1891,7 @@ _elm_scroll_scroll_to_x_animator(void *data) if (!sid->pan_obj) return ECORE_CALLBACK_CANCEL; - ELM_PAN_DATA_GET(sid->pan_obj, psd); + ELM_PAN_DATA_GET_OR_RETURN_VAL(sid->pan_obj, psd, ECORE_CALLBACK_CANCEL); t = ecore_loop_time_get(); tt = (t - sid->scrollto.x.t_start) / @@ -1825,7 +1904,7 @@ _elm_scroll_scroll_to_x_animator(void *data) if (t >= sid->scrollto.x.t_end) { px = sid->scrollto.x.end; - _elm_scroll_content_pos_set(sid->obj, px, py); + _elm_scroll_content_pos_set(sid->obj, px, py, EINA_TRUE); sid->down.sx = px; sid->down.x = sid->down.history[0].x; _elm_scroll_wanted_coordinates_update(sid, px, py); @@ -1834,7 +1913,7 @@ _elm_scroll_scroll_to_x_animator(void *data) _elm_scroll_anim_stop(sid); return ECORE_CALLBACK_CANCEL; } - _elm_scroll_content_pos_set(sid->obj, px, py); + _elm_scroll_content_pos_set(sid->obj, px, py, EINA_TRUE); _elm_scroll_wanted_coordinates_update(sid, px, py); return ECORE_CALLBACK_RENEW; } @@ -1848,7 +1927,7 @@ _elm_scroll_scroll_to_y_animator(void *data) if (!sid->pan_obj) return EINA_FALSE; - ELM_PAN_DATA_GET(sid->pan_obj, psd); + ELM_PAN_DATA_GET_OR_RETURN_VAL(sid->pan_obj, psd, EINA_FALSE); t = ecore_loop_time_get(); tt = (t - sid->scrollto.y.t_start) / @@ -1861,7 +1940,7 @@ _elm_scroll_scroll_to_y_animator(void *data) if (t >= sid->scrollto.y.t_end) { py = sid->scrollto.y.end; - _elm_scroll_content_pos_set(sid->obj, px, py); + _elm_scroll_content_pos_set(sid->obj, px, py, EINA_TRUE); sid->down.sy = py; sid->down.y = sid->down.history[0].y; _elm_scroll_wanted_coordinates_update(sid, px, py); @@ -1870,7 +1949,7 @@ _elm_scroll_scroll_to_y_animator(void *data) _elm_scroll_anim_stop(sid); return ECORE_CALLBACK_CANCEL; } - _elm_scroll_content_pos_set(sid->obj, px, py); + _elm_scroll_content_pos_set(sid->obj, px, py, EINA_TRUE); _elm_scroll_wanted_coordinates_update(sid, px, py); return ECORE_CALLBACK_RENEW; @@ -1886,7 +1965,7 @@ _elm_scroll_scroll_to_y(Elm_Scrollable_Smart_Interface_Data *sid, if (!sid->pan_obj) return; - ELM_PAN_DATA_GET(sid->pan_obj, psd); + ELM_PAN_DATA_GET_OR_RETURN(sid->pan_obj, psd); if (sid->freeze) return; if (t_in <= 0.0) @@ -1931,7 +2010,7 @@ _elm_scroll_scroll_to_x(Elm_Scrollable_Smart_Interface_Data *sid, if (!sid->pan_obj) return; - ELM_PAN_DATA_GET(sid->pan_obj, psd); + ELM_PAN_DATA_GET_OR_RETURN(sid->pan_obj, psd); if (sid->freeze) return; if (t_in <= 0.0) @@ -1978,6 +2057,8 @@ _elm_scroll_mouse_up_event_cb(void *data, if (!sid->pan_obj) return; + ELM_PAN_DATA_GET_OR_RETURN(sid->pan_obj, psd); + ev = event_info; sid->down.hold_parent = EINA_FALSE; sid->down.dx = 0; @@ -2167,7 +2248,7 @@ _elm_scroll_mouse_up_event_cb(void *data, sid->down.dragged = EINA_FALSE; sid->down.now = EINA_FALSE; _elm_scroll_content_pos_get(sid->obj, &x, &y); - _elm_scroll_content_pos_set(sid->obj, x, y); + _elm_scroll_content_pos_set(sid->obj, x, y, EINA_TRUE); _elm_scroll_wanted_coordinates_update(sid, x, y); if (sid->content_info.resized) @@ -2295,7 +2376,7 @@ _elm_scroll_can_scroll(Elm_Scrollable_Smart_Interface_Data *sid, if (!sid->pan_obj) return EINA_FALSE; - ELM_PAN_DATA_GET(sid->pan_obj, psd); + ELM_PAN_DATA_GET_OR_RETURN_VAL(sid->pan_obj, psd, EINA_FALSE); psd->api->pos_max_get(sid->pan_obj, &mx, &my); psd->api->pos_min_get(sid->pan_obj, &minx, &miny); @@ -2399,7 +2480,7 @@ _elm_scroll_down_coord_eval(Elm_Scrollable_Smart_Interface_Data *sid, if (!sid->pan_obj) return; - ELM_PAN_DATA_GET(sid->pan_obj, psd); + ELM_PAN_DATA_GET_OR_RETURN(sid->pan_obj, psd); if (sid->down.dir_x) *x = sid->down.sx - (*x - sid->down.x); else *x = sid->down.sx; @@ -2457,7 +2538,7 @@ _elm_scroll_hold_animator(void *data) oy = fy; } - _elm_scroll_content_pos_set(sid->obj, ox, oy); + _elm_scroll_content_pos_set(sid->obj, ox, oy, EINA_TRUE); return ECORE_CALLBACK_RENEW; } @@ -2476,9 +2557,9 @@ _elm_scroll_on_hold_animator(void *data) { td = t - sid->down.onhold_tlast; vx = sid->down.onhold_vx * td * - (double)_elm_config->thumbscroll_threshold * 2.0; + (double)_elm_config->thumbscroll_hold_threshold * 2.0; vy = sid->down.onhold_vy * td * - (double)_elm_config->thumbscroll_threshold * 2.0; + (double)_elm_config->thumbscroll_hold_threshold * 2.0; _elm_scroll_content_pos_get(sid->obj, &ox, &oy); x = ox; y = oy; @@ -2505,7 +2586,7 @@ _elm_scroll_on_hold_animator(void *data) } } - _elm_scroll_content_pos_set(sid->obj, x, y); + _elm_scroll_content_pos_set(sid->obj, x, y, EINA_TRUE); } sid->down.onhold_tlast = t; @@ -2524,7 +2605,7 @@ _elm_scroll_mouse_move_event_cb(void *data, if (!sid->pan_obj) return; - ELM_PAN_DATA_GET(sid->pan_obj, psd); + ELM_PAN_DATA_GET_OR_RETURN(sid->pan_obj, psd); ev = event_info; if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) @@ -2669,26 +2750,27 @@ _elm_scroll_mouse_move_event_cb(void *data, } } { - Evas_Coord minx, miny; + Evas_Coord minx, miny, mx, my; psd->api->pos_min_get(sid->pan_obj, &minx, &miny); + psd->api->pos_max_get(sid->pan_obj, &mx, &my); if (y < miny) y += (miny - y) * _elm_config->thumbscroll_border_friction; - else if (sid->content_info.h <= sid->h) + else if (my <= 0) y += (sid->down.sy - y) * _elm_config->thumbscroll_border_friction; - else if ((sid->content_info.h - sid->h + miny) < y) - y += (sid->content_info.h - sid->h + miny - y) * + else if ((my + miny) < y) + y += (my + miny - y) * _elm_config->thumbscroll_border_friction; if (x < minx) x += (minx - x) * _elm_config->thumbscroll_border_friction; - else if (sid->content_info.w <= sid->w) + else if (mx <= 0) x += (sid->down.sx - x) * _elm_config->thumbscroll_border_friction; - else if ((sid->content_info.w - sid->w + minx) < x) - x += (sid->content_info.w - sid->w + minx - x) * + else if ((mx + minx) < x) + x += (mx + minx - x) * _elm_config->thumbscroll_border_friction; } @@ -2718,37 +2800,37 @@ _elm_scroll_mouse_move_event_cb(void *data, x = ev->cur.canvas.x - sid->x; y = ev->cur.canvas.y - sid->y; - if (x < _elm_config->thumbscroll_threshold) + if (x < _elm_config->thumbscroll_hold_threshold) { - if (_elm_config->thumbscroll_threshold > 0.0) - vx = -(double)(_elm_config->thumbscroll_threshold - x) - / _elm_config->thumbscroll_threshold; + if (_elm_config->thumbscroll_hold_threshold > 0.0) + vx = -(double)(_elm_config->thumbscroll_hold_threshold - x) + / _elm_config->thumbscroll_hold_threshold; else vx = -1.0; } - else if (x > (sid->w - _elm_config->thumbscroll_threshold)) + else if (x > (sid->w - _elm_config->thumbscroll_hold_threshold)) { - if (_elm_config->thumbscroll_threshold > 0.0) - vx = (double)(_elm_config->thumbscroll_threshold - + if (_elm_config->thumbscroll_hold_threshold > 0.0) + vx = (double)(_elm_config->thumbscroll_hold_threshold - (sid->w - x)) / - _elm_config->thumbscroll_threshold; + _elm_config->thumbscroll_hold_threshold; else vx = 1.0; } - if (y < _elm_config->thumbscroll_threshold) + if (y < _elm_config->thumbscroll_hold_threshold) { - if (_elm_config->thumbscroll_threshold > 0.0) - vy = -(double)(_elm_config->thumbscroll_threshold - y) - / _elm_config->thumbscroll_threshold; + if (_elm_config->thumbscroll_hold_threshold > 0.0) + vy = -(double)(_elm_config->thumbscroll_hold_threshold - y) + / _elm_config->thumbscroll_hold_threshold; else vy = -1.0; } - else if (y > (sid->h - _elm_config->thumbscroll_threshold)) + else if (y > (sid->h - _elm_config->thumbscroll_hold_threshold)) { - if (_elm_config->thumbscroll_threshold > 0.0) - vy = (double)(_elm_config->thumbscroll_threshold - + if (_elm_config->thumbscroll_hold_threshold > 0.0) + vy = (double)(_elm_config->thumbscroll_hold_threshold - (sid->h - y)) / - _elm_config->thumbscroll_threshold; + _elm_config->thumbscroll_hold_threshold; else vy = 1.0; } @@ -2848,7 +2930,7 @@ _scroll_edje_object_attach(Evas_Object *obj) (sid->edje_obj, EVAS_CALLBACK_MOVE, _on_edje_move, sid); edje_object_signal_callback_add - (sid->edje_obj, "drag", "elm.dragable.vbar", _elm_scroll_edje_drag_v_cb, + (sid->edje_obj, "drag", "elm.dragable.vbar", _elm_scroll_vbar_drag_cb, sid); edje_object_signal_callback_add (sid->edje_obj, "drag,set", "elm.dragable.vbar", @@ -2866,7 +2948,13 @@ _scroll_edje_object_attach(Evas_Object *obj) (sid->edje_obj, "drag,page", "elm.dragable.vbar", _elm_scroll_edje_drag_v_cb, sid); edje_object_signal_callback_add - (sid->edje_obj, "drag", "elm.dragable.hbar", _elm_scroll_edje_drag_h_cb, + (sid->edje_obj, "elm,vbar,press", "elm", + _elm_scroll_vbar_press_cb, sid); + edje_object_signal_callback_add + (sid->edje_obj, "elm,vbar,unpress", "elm", + _elm_scroll_vbar_unpress_cb, sid); + edje_object_signal_callback_add + (sid->edje_obj, "drag", "elm.dragable.hbar", _elm_scroll_hbar_drag_cb, sid); edje_object_signal_callback_add (sid->edje_obj, "drag,set", "elm.dragable.hbar", @@ -2883,6 +2971,12 @@ _scroll_edje_object_attach(Evas_Object *obj) edje_object_signal_callback_add (sid->edje_obj, "drag,page", "elm.dragable.hbar", _elm_scroll_edje_drag_h_cb, sid); + edje_object_signal_callback_add + (sid->edje_obj, "elm,hbar,press", "elm", + _elm_scroll_hbar_press_cb, sid); + edje_object_signal_callback_add + (sid->edje_obj, "elm,hbar,unpress", "elm", + _elm_scroll_hbar_unpress_cb, sid); } static void @@ -2915,7 +3009,7 @@ _scroll_edje_object_detach(Evas_Object *obj) (sid->edje_obj, EVAS_CALLBACK_MOVE, _on_edje_move, sid); edje_object_signal_callback_del_full - (sid->edje_obj, "drag", "elm.dragable.vbar", _elm_scroll_edje_drag_v_cb, + (sid->edje_obj, "drag", "elm.dragable.vbar", _elm_scroll_vbar_drag_cb, sid); edje_object_signal_callback_del_full (sid->edje_obj, "drag,set", "elm.dragable.vbar", @@ -2933,7 +3027,13 @@ _scroll_edje_object_detach(Evas_Object *obj) (sid->edje_obj, "drag,page", "elm.dragable.vbar", _elm_scroll_edje_drag_v_cb, sid); edje_object_signal_callback_del_full - (sid->edje_obj, "drag", "elm.dragable.hbar", _elm_scroll_edje_drag_h_cb, + (sid->edje_obj, "elm,vbar,press", "elm", + _elm_scroll_vbar_press_cb, sid); + edje_object_signal_callback_del_full + (sid->edje_obj, "elm,vbar,unpress", "elm", + _elm_scroll_vbar_unpress_cb, sid); + edje_object_signal_callback_del_full + (sid->edje_obj, "drag", "elm.dragable.hbar", _elm_scroll_hbar_drag_cb, sid); edje_object_signal_callback_del_full (sid->edje_obj, "drag,set", "elm.dragable.hbar", @@ -2950,6 +3050,12 @@ _scroll_edje_object_detach(Evas_Object *obj) edje_object_signal_callback_del_full (sid->edje_obj, "drag,page", "elm.dragable.hbar", _elm_scroll_edje_drag_h_cb, sid); + edje_object_signal_callback_del_full + (sid->edje_obj, "elm,hbar,press", "elm", + _elm_scroll_hbar_press_cb, sid); + edje_object_signal_callback_del_full + (sid->edje_obj, "elm,hbar,unpress", "elm", + _elm_scroll_hbar_unpress_cb, sid); } static void @@ -3039,7 +3145,7 @@ _elm_scroll_scroll_bar_reset(Elm_Scrollable_Smart_Interface_Data *sid) } if (sid->pan_obj) { - ELM_PAN_DATA_GET(sid->pan_obj, psd); + ELM_PAN_DATA_GET_OR_RETURN(sid->pan_obj, psd); psd->api->pos_min_get(sid->pan_obj, &minx, &miny); psd->api->pos_get(sid->pan_obj, &px, &py); @@ -3061,7 +3167,7 @@ _elm_scroll_pan_changed_cb(void *data, if (!sid->pan_obj) return; - ELM_PAN_DATA_GET(sid->pan_obj, psd); + ELM_PAN_DATA_GET_OR_RETURN(sid->pan_obj, psd); psd->api->content_size_get(sid->pan_obj, &w, &h); if ((w != sid->content_info.w) || (h != sid->content_info.h)) @@ -3124,7 +3230,7 @@ _elm_scroll_content_set(Evas_Object *obj, edje_object_part_swallow(sid->edje_obj, "elm.swallow.content", o); } - ELM_PAN_DATA_GET(sid->pan_obj, psd); + ELM_PAN_DATA_GET_OR_RETURN(sid->pan_obj, psd); evas_object_event_callback_add (content, EVAS_CALLBACK_DEL, _elm_scroll_content_del_cb, sid); @@ -3277,6 +3383,66 @@ _elm_scroll_edge_bottom_cb_set(Evas_Object *obj, } static void +_elm_scroll_vbar_drag_cb_set(Evas_Object *obj, + void (*vbar_drag_cb)(Evas_Object *obj, + void *data)) +{ + ELM_SCROLL_IFACE_DATA_GET_OR_RETURN(obj, sid); + + sid->cb_func.vbar_drag = vbar_drag_cb; +} + +static void +_elm_scroll_vbar_press_cb_set(Evas_Object *obj, + void (*vbar_press_cb)(Evas_Object *obj, + void *data)) +{ + ELM_SCROLL_IFACE_DATA_GET_OR_RETURN(obj, sid); + + sid->cb_func.vbar_press = vbar_press_cb; +} + +static void +_elm_scroll_vbar_unpress_cb_set(Evas_Object *obj, + void (*vbar_unpress_cb)(Evas_Object *obj, + void *data)) +{ + ELM_SCROLL_IFACE_DATA_GET_OR_RETURN(obj, sid); + + sid->cb_func.vbar_unpress = vbar_unpress_cb; +} + +static void +_elm_scroll_hbar_drag_cb_set(Evas_Object *obj, + void (*hbar_drag_cb)(Evas_Object *obj, + void *data)) +{ + ELM_SCROLL_IFACE_DATA_GET_OR_RETURN(obj, sid); + + sid->cb_func.hbar_drag = hbar_drag_cb; +} + +static void +_elm_scroll_hbar_press_cb_set(Evas_Object *obj, + void (*hbar_press_cb)(Evas_Object *obj, + void *data)) +{ + ELM_SCROLL_IFACE_DATA_GET_OR_RETURN(obj, sid); + + sid->cb_func.hbar_press = hbar_press_cb; +} + +static void +_elm_scroll_hbar_unpress_cb_set(Evas_Object *obj, + void (*hbar_unpress_cb)(Evas_Object *obj, + void *data)) +{ + ELM_SCROLL_IFACE_DATA_GET_OR_RETURN(obj, sid); + + sid->cb_func.hbar_unpress = hbar_unpress_cb; +} + +static void _elm_scroll_content_min_limit_cb_set(Evas_Object *obj, void (*c_min_limit_cb)(Evas_Object *obj, Eina_Bool w, @@ -3609,7 +3775,7 @@ _elm_scroll_last_page_get(const Evas_Object *obj, if (!sid->pan_obj) return; - ELM_PAN_DATA_GET(sid->pan_obj, psd); + ELM_PAN_DATA_GET_OR_RETURN(sid->pan_obj, psd); psd->api->content_size_get(sid->pan_obj, &cw, &ch); if (pagenumber_h) @@ -3643,7 +3809,7 @@ _elm_scroll_page_show(Evas_Object *obj, if (pagenumber_h >= 0) x = sid->pagesize_h * pagenumber_h; if (pagenumber_v >= 0) y = sid->pagesize_v * pagenumber_v; if (_elm_scroll_content_region_show_internal(obj, &x, &y, w, h)) - _elm_scroll_content_pos_set(obj, x, y); + _elm_scroll_content_pos_set(obj, x, y, EINA_TRUE); } static void @@ -3692,7 +3858,7 @@ _elm_scroll_gravity_set(Evas_Object *obj, if (!sid->pan_obj) return; - ELM_PAN_DATA_GET(sid->pan_obj, psd); + ELM_PAN_DATA_GET_OR_RETURN(sid->pan_obj, psd); psd->api->gravity_set(sid->pan_obj, x, y); } @@ -3706,7 +3872,7 @@ _elm_scroll_gravity_get(const Evas_Object *obj, if (!sid->pan_obj) return; - ELM_PAN_DATA_GET(sid->pan_obj, psd); + ELM_PAN_DATA_GET_OR_RETURN(sid->pan_obj, psd); psd->api->gravity_get(sid->pan_obj, x, y); } @@ -3790,6 +3956,12 @@ EAPI const Elm_Scrollable_Smart_Interface ELM_SCROLLABLE_IFACE = _elm_scroll_edge_right_cb_set, _elm_scroll_edge_top_cb_set, _elm_scroll_edge_bottom_cb_set, + _elm_scroll_vbar_drag_cb_set, + _elm_scroll_vbar_press_cb_set, + _elm_scroll_vbar_unpress_cb_set, + _elm_scroll_hbar_drag_cb_set, + _elm_scroll_hbar_press_cb_set, + _elm_scroll_hbar_unpress_cb_set, _elm_scroll_content_min_limit_cb_set, _elm_scroll_content_pos_set, _elm_scroll_content_pos_get, diff --git a/src/lib/elm_interface_scrollable.h b/src/lib/elm_interface_scrollable.h index 3a54cef..e87c9d1 100644 --- a/src/lib/elm_interface_scrollable.h +++ b/src/lib/elm_interface_scrollable.h @@ -269,6 +269,18 @@ struct _Elm_Scrollable_Smart_Interface_Data void *data); void (*edge_bottom)(Evas_Object *obj, void *data); + void (*vbar_drag)(Evas_Object *obj, + void *data); + void (*vbar_press)(Evas_Object *obj, + void *data); + void (*vbar_unpress)(Evas_Object *obj, + void *data); + void (*hbar_drag)(Evas_Object *obj, + void *data); + void (*hbar_press)(Evas_Object *obj, + void *data); + void (*hbar_unpress)(Evas_Object *obj, + void *data); void (*content_min_limit)(Evas_Object *obj, Eina_Bool w, Eina_Bool h); @@ -350,6 +362,24 @@ struct _Elm_Scrollable_Smart_Interface void (*edge_bottom_cb_set)(Evas_Object *obj, void (*e_bottom_cb)(Evas_Object *obj, void *data)); + void (*vbar_drag_cb_set)(Evas_Object *obj, + void (*v_drag_cb)(Evas_Object *obj, + void *data)); + void (*vbar_press_cb_set)(Evas_Object *obj, + void (*v_press_cb)(Evas_Object *obj, + void *data)); + void (*vbar_unpress_cb_set)(Evas_Object *obj, + void (*v_unpress_cb)(Evas_Object *obj, + void *data)); + void (*hbar_drag_cb_set)(Evas_Object *obj, + void (*h_drag_cb)(Evas_Object *obj, + void *data)); + void (*hbar_press_cb_set)(Evas_Object *obj, + void (*h_press_cb)(Evas_Object *obj, + void *data)); + void (*hbar_unpress_cb_set)(Evas_Object *obj, + void (*h_unpress_cb)(Evas_Object *obj, + void *data)); void (*content_min_limit_cb_set)(Evas_Object *obj, void (*c_limit_cb)(Evas_Object *obj, @@ -360,7 +390,8 @@ struct _Elm_Scrollable_Smart_Interface * immediately */ void (*content_pos_set)(Evas_Object *obj, Evas_Coord x, - Evas_Coord y); + Evas_Coord y, + Eina_Bool sig); void (*content_pos_get)(const Evas_Object *obj, Evas_Coord *x, Evas_Coord *y); diff --git a/src/lib/elm_label.c b/src/lib/elm_label.c index e3e5599..57235d8 100644 --- a/src/lib/elm_label.c +++ b/src/lib/elm_label.c @@ -323,7 +323,14 @@ _elm_label_smart_text_set(Evas_Object *obj, if (!label) label = ""; _label_format_set(ELM_WIDGET_DATA(sd)->resize_obj, sd->format); - return _elm_label_parent_sc->text_set(obj, item, label); + if (_elm_label_parent_sc->text_set(obj, item, label)) + { + sd->lastw = 0; + _elm_label_smart_sizing_eval(obj); + return EINA_TRUE; + } + + return EINA_FALSE; } static Eina_Bool @@ -339,7 +346,7 @@ _access_info_cb(void *data __UNUSED__, Evas_Object *obj) { const char *txt = elm_widget_access_info_get(obj); - if (!txt) txt = elm_layout_text_get(obj, NULL); + if (!txt) txt = _elm_util_mkup_to_text(elm_layout_text_get(obj, NULL)); if (txt) return strdup(txt); return NULL; @@ -377,11 +384,8 @@ _elm_label_smart_add(Evas_Object *obj) edje_object_signal_callback_add(ELM_WIDGET_DATA(priv)->resize_obj, "elm,state,slide,end", "", _on_slide_end, obj); - - elm_widget_can_focus_set(obj, EINA_FALSE); - - elm_layout_theme_set(obj, "label", "base", elm_widget_style_get(obj)); - elm_layout_text_set(obj, NULL, "
"); + /* access */ + elm_widget_can_focus_set(obj, _elm_config->access_mode); _elm_access_object_register(obj, ELM_WIDGET_DATA(priv)->resize_obj); _elm_access_text_set @@ -389,6 +393,8 @@ _elm_label_smart_add(Evas_Object *obj) _elm_access_callback_set (_elm_access_object_get(obj), ELM_ACCESS_INFO, _access_info_cb, NULL); + elm_layout_theme_set(obj, "label", "base", elm_widget_style_get(obj)); + elm_layout_text_set(obj, NULL, "
"); elm_layout_sizing_eval(obj); } diff --git a/src/lib/elm_list.c b/src/lib/elm_list.c index fe0b771..af782cc 100644 --- a/src/lib/elm_list.c +++ b/src/lib/elm_list.c @@ -347,7 +347,7 @@ _elm_list_smart_event(Evas_Object *obj, else return EINA_FALSE; ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD; - sd->s_iface->content_pos_set(obj, x, y); + sd->s_iface->content_pos_set(obj, x, y, EINA_TRUE); return EINA_TRUE; } @@ -1429,7 +1429,6 @@ _access_widget_item_register(Elm_List_Item *it, Eina_Bool is_access) ai = _elm_access_object_get(it->base.access_obj); - _elm_access_text_set(ai, ELM_ACCESS_TYPE, E_("List Item")); _elm_access_callback_set(ai, ELM_ACCESS_INFO, _access_info_cb, it); _elm_access_callback_set(ai, ELM_ACCESS_STATE, _access_state_cb, it); _elm_access_on_highlight_hook_set(ai, _access_on_highlight_cb, it); diff --git a/src/lib/elm_main.c b/src/lib/elm_main.c index b0b2f3f..36a968d 100644 --- a/src/lib/elm_main.c +++ b/src/lib/elm_main.c @@ -610,11 +610,15 @@ static int (*qr_main)(int argc, char **argv) = NULL; EAPI Eina_Bool -elm_quicklaunch_prepare(int argc __UNUSED__, - char **argv) +elm_quicklaunch_prepare(int argc, + char **argv) { #ifdef HAVE_FORK - char *exe = elm_quicklaunch_exe_path_get(argv[0]); + char *exe; + + if (argc <= 0 || argv == NULL) return EINA_FALSE; + + exe = elm_quicklaunch_exe_path_get(argv[0]); if (!exe) { ERR("requested quicklaunch binary '%s' does not exist\n", argv[0]); @@ -1406,11 +1410,67 @@ elm_object_name_find(const Evas_Object *obj, const char *name, int recurse) } EAPI void +elm_object_orientation_mode_disabled_set(Evas_Object *obj, Eina_Bool disabled) +{ + elm_widget_orientation_mode_disabled_set(obj, disabled); +} + +EAPI Eina_Bool +elm_object_orientation_mode_disabled_get(const Evas_Object *obj) +{ + return elm_widget_orientation_mode_disabled_get(obj); +} + +EAPI void elm_object_item_access_info_set(Elm_Object_Item *it, const char *txt) { _elm_widget_item_access_info_set((Elm_Widget_Item *)it, txt); } +EAPI Evas_Object * +elm_object_item_access_register(Elm_Object_Item *item) +{ + Elm_Widget_Item *it; + + it = (Elm_Widget_Item *)item; + + _elm_access_widget_item_register(it); + + if (it) return it->access_obj; + return NULL; +} + +EAPI void +elm_object_item_access_unregister(Elm_Object_Item *item) +{ + _elm_access_widget_item_unregister((Elm_Widget_Item *)item); +} + +EAPI Evas_Object * +elm_object_item_access_object_get(const Elm_Object_Item *item) +{ + if (!item) return NULL; + return ((Elm_Widget_Item *)item)->access_obj; +} + +EAPI void +elm_object_item_access_order_set(Elm_Object_Item *item, Eina_List *objs) +{ + _elm_access_widget_item_access_order_set((Elm_Widget_Item *)item, objs); +} + +EAPI const Eina_List * +elm_object_item_access_order_get(const Elm_Object_Item *item) +{ + return _elm_access_widget_item_access_order_get((Elm_Widget_Item *)item); +} + +EAPI void +elm_object_item_access_order_unset(Elm_Object_Item *item) +{ + _elm_access_widget_item_access_order_unset((Elm_Widget_Item *)item); +} + EAPI void * elm_object_item_data_get(const Elm_Object_Item *it) { diff --git a/src/lib/elm_map.c b/src/lib/elm_map.c index cc7aa6c..7134003 100644 --- a/src/lib/elm_map.c +++ b/src/lib/elm_map.c @@ -1365,7 +1365,10 @@ _overlay_default_show(Overlay_Default *ovl) if (!strcmp(ovl->wsd->engine->name, INTERNAL_ENGINE_NAME)) _obj_place(disp, x - (w / 2), y - (h / 2), w, h); else - _obj_place(disp, ovl->x - (w / 2), ovl->y - (h / 2), w, h); + { + evas_object_geometry_get(ovl->wsd->layout, &x, &y, NULL, NULL); + _obj_place(disp, (x + ovl->x) - (w / 2), (y + ovl->y) - (h / 2), w, h); + } } static void @@ -2744,18 +2747,18 @@ _kml_parse(Elm_Map_Route *r) sz = ftell(f); if (sz > 0) { - char *buf; - - fseek(f, 0, SEEK_SET); - buf = malloc(sz); + char *buf = malloc(sz + 1); if (buf) { + memset(buf, 0, sz + 1); + rewind(f); if (fread(buf, 1, sz, f)) { eina_simple_xml_parse (buf, sz, EINA_TRUE, _xml_route_dump_cb, &dump); } - free(buf); + else + free(buf); } } fclose(f); @@ -2835,12 +2838,11 @@ _name_parse(Elm_Map_Name *n) sz = ftell(f); if (sz > 0) { - char *buf; - - fseek(f, 0, SEEK_SET); - buf = malloc(sz); + char *buf = malloc(sz + 1); if (buf) { + memset(buf, 0, sz + 1); + rewind(f); if (fread(buf, 1, sz, f)) { eina_simple_xml_parse @@ -2877,12 +2879,11 @@ _name_list_parse(Elm_Map_Name_List *nl) sz = ftell(f); if (sz > 0) { - char *buf; - - fseek(f, 0, SEEK_SET); - buf = malloc(sz); + char *buf = malloc(sz + 1); if (buf) { + memset(buf, 0, sz + 1); + rewind(f); if (fread(buf, 1, sz, f)) { eina_simple_xml_parse @@ -3213,7 +3214,6 @@ _pinch_rotate_end_cb(void *data, return EVAS_EVENT_FLAG_NONE; } - static Evas_Event_Flags _pinch_momentum_start_cb(void *data, void *ei) @@ -3230,6 +3230,13 @@ _pinch_momentum_start_cb(void *data, sd->pinch_pan.y = mi->y1; _overlay_place(sd); } + // FIXME: Because n line move has some bouncing bug, + // perpect is calculated here + if (sd->pinch_pan.perspect >= 90) + sd->pinch_pan.perspect = 90; + else if (sd->pinch_pan.perspect <= 0) + sd->pinch_pan.perspect = 0; + sd->pinch_pan.perspect_y = mi->y1; return EVAS_EVENT_FLAG_NONE; } @@ -3251,6 +3258,10 @@ _pinch_momentum_move_cb(void *data, sd->pinch_pan.y = mi->y2; _overlay_place(sd); } + // FIXME: Because n line move has some bouncing bug, + // perpect is calculated here + sd->pinch_pan.perspect += (mi->y2 - sd->pinch_pan.perspect_y); + sd->pinch_pan.perspect_y = mi->y2; return EVAS_EVENT_FLAG_NONE; } @@ -3276,6 +3287,43 @@ _pinch_momentum_end_cb(void *data, return EVAS_EVENT_FLAG_NONE; } +static Evas_Event_Flags +_pinch_n_lines_move_cb(void *data, + void *ei) +{ + Elm_Map_Smart_Data *sd = data; + EINA_SAFETY_ON_NULL_RETURN_VAL(sd, EVAS_EVENT_FLAG_NONE); + Elm_Gesture_Line_Info *li = ei; + + if (strcmp(sd->engine->name, INTERNAL_ENGINE_NAME) && + (li->momentum.n == 2) && + (((170 <= li->angle) && (li->angle <=190)) || + (350 <= li->angle) || (li->angle <=10))) + { + sd->engine->perpective(ELM_WIDGET_DATA(sd)->obj, sd->pinch_pan.perspect, 0); + } + + return EVAS_EVENT_FLAG_NONE; +} + +static Evas_Event_Flags +_pinch_n_lines_end_cb(void *data, + void *ei) +{ + Elm_Map_Smart_Data *sd = data; + EINA_SAFETY_ON_NULL_RETURN_VAL(sd, EVAS_EVENT_FLAG_NONE); + Elm_Gesture_Line_Info *li = ei; + + if (strcmp(sd->engine->name, INTERNAL_ENGINE_NAME) && + (li->momentum.n == 2) && + (((170 <= li->angle) && (li->angle <=190)) || + (350 <= li->angle) || (li->angle <=10))) + { + sd->engine->perpective(ELM_WIDGET_DATA(sd)->obj, sd->pinch_pan.perspect, 0); + } + + return EVAS_EVENT_FLAG_NONE; +} static void _elm_map_pan_smart_pos_set(Evas_Object *obj, Evas_Coord x, @@ -3466,8 +3514,8 @@ _map_pan_del(Evas_Object *obj) if (sd->scr_timer) { - sd->scr_timer = NULL; ecore_timer_del(sd->scr_timer); + sd->scr_timer = NULL; } if (sd->zoom_animator) { @@ -3974,7 +4022,7 @@ _elm_map_smart_event(Evas_Object *obj, else return EINA_FALSE; ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD; - sd->s_iface->content_pos_set(obj, x, y); + sd->s_iface->content_pos_set(obj, x, y, EINA_TRUE); return EINA_TRUE; } @@ -4404,6 +4452,12 @@ _elm_map_smart_add(Evas_Object *obj) elm_gesture_layer_cb_set (priv->g_layer, ELM_GESTURE_MOMENTUM, ELM_GESTURE_STATE_END, _pinch_momentum_end_cb, priv); + elm_gesture_layer_cb_set + (priv->g_layer, ELM_GESTURE_N_LINES, ELM_GESTURE_STATE_MOVE, + _pinch_n_lines_move_cb, priv); + elm_gesture_layer_cb_set + (priv->g_layer, ELM_GESTURE_N_LINES, ELM_GESTURE_STATE_END, + _pinch_n_lines_end_cb, priv); priv->mode = ELM_MAP_ZOOM_MODE_MANUAL; priv->zoom_min = priv->engine->zoom_min; diff --git a/src/lib/elm_notify.c b/src/lib/elm_notify.c index 46e71f7..a2e9ef4 100644 --- a/src/lib/elm_notify.c +++ b/src/lib/elm_notify.c @@ -230,13 +230,13 @@ _timer_cb(void *data) ELM_NOTIFY_DATA_GET(obj, sd); + sd->timer = NULL; if (!evas_object_visible_get(obj)) goto end; evas_object_hide(obj); evas_object_smart_callback_call(obj, SIG_TIMEOUT, NULL); end: - sd->timer = NULL; return ECORE_CALLBACK_CANCEL; } diff --git a/src/lib/elm_object.h b/src/lib/elm_object.h index 9445ce6..17f207b 100644 --- a/src/lib/elm_object.h +++ b/src/lib/elm_object.h @@ -383,3 +383,38 @@ EAPI void elm_object_event_callback_add(Evas_Object *obj, Elm_Event_Cb f * @ingroup General */ EAPI void *elm_object_event_callback_del(Evas_Object *obj, Elm_Event_Cb func, const void *data); + +/** + * Disable the orientation mode of a given widget. + * + * Orientation Mode is used for widgets to change it's styles or to send signals + * whenever it's window degree is changed. If the orientation mode is enabled + * and the widget has different looks and styles for the window degree(0, 90, + * 180, 270), it will apply a style that is readied for the current degree, + * otherwise, it will send signals to it's own edje to change it's states if + * the style doesn't be readied. + * + * @param obj The Elementary object to operate on orientation mode. + * @param disabled The state to put in in: @c EINA_TRUE for disabled, + * @c EINA_FALSE for enabled. + * + * @since 1.8 + * + * @ingroup General + */ +EAPI void elm_object_orientation_mode_disabled_set(Evas_Object *obj, Eina_Bool disabled); + +/** + * Get the orientation mode of a given widget. + * + * @param obj The Elementary widget to query for its orientation mode. + * @return @c EINA_TRUE, if the orientation mode is disabled, @c EINA_FALSE + * if the orientation mode is enabled (or on errors) + * @see elm_object_orientation_mode_disabled_set() + * + * @since 1.8 + * + * @ingroup General + */ +EAPI Eina_Bool elm_object_orientation_mode_disabled_get(const Evas_Object *obj); + diff --git a/src/lib/elm_object_item.h b/src/lib/elm_object_item.h index 1bf8596..43491d1 100644 --- a/src/lib/elm_object_item.h +++ b/src/lib/elm_object_item.h @@ -109,6 +109,70 @@ EAPI const char *elm_object_item_part_text_get(const Elm_Object EAPI void elm_object_item_access_info_set(Elm_Object_Item *it, const char *txt); /** + * @brief Register object item as an accessible object. + * @since 1.8 + * + * @param item The elementary object item + * @return Accessible object of the object item or NULL for any error + * + * @ingroup General + */ +EAPI Evas_Object *elm_object_item_access_register(Elm_Object_Item *item); + +/** + * @brief Unregister accessible object of the object item. + * @since 1.8 + * + * @param item The elementary object item + * + * @ingroup General + */ +EAPI void elm_object_item_access_unregister(Elm_Object_Item *item); + +/** + * @brief Get an accessible object of the object item. + * @since 1.8 + * + * @param item The elementary object item + * @return Accessible object of the object item or NULL for any error + * + * @ingroup General + */ +EAPI Evas_Object *elm_object_item_access_object_get(const Elm_Object_Item *item); + +/** + * @brief Set highlight order + * @since 1.8 + * + * @param item The container object item + * @param objs Order of objects to pass highlight + * + * @ingroup General + */ +EAPI void elm_object_item_access_order_set(Elm_Object_Item *item, Eina_List *objs); + +/** + * @brief Get highlight order + * @since 1.8 + * + * @param item The container object item + * @return Order of objects to pass highlight + * + * @ingroup General + */ +EAPI const Eina_List *elm_object_item_access_order_get(const Elm_Object_Item *item); + +/** + * @brief Unset highlight order + * @since 1.8 + * + * @param item The container object item + * + * @ingroup General + */ +EAPI void elm_object_item_access_order_unset(Elm_Object_Item *item); + +/** * Get the data associated with an object item * @param it The Elementary object item * @return The data associated with @p it diff --git a/src/lib/elm_photocam.c b/src/lib/elm_photocam.c index 45c3c52..10dca74 100644 --- a/src/lib/elm_photocam.c +++ b/src/lib/elm_photocam.c @@ -1001,7 +1001,7 @@ _elm_photocam_smart_event(Evas_Object *obj, else return EINA_FALSE; ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD; - sd->s_iface->content_pos_set(obj, x, y); + sd->s_iface->content_pos_set(obj, x, y, EINA_TRUE); return EINA_TRUE; } diff --git a/src/lib/elm_priv.h b/src/lib/elm_priv.h index 0920872..448bf5e 100644 --- a/src/lib/elm_priv.h +++ b/src/lib/elm_priv.h @@ -159,6 +159,7 @@ struct _Elm_Config unsigned char vsync; unsigned char thumbscroll_enable; int thumbscroll_threshold; + int thumbscroll_hold_threshold; double thumbscroll_momentum_threshold; double thumbscroll_friction; double thumbscroll_bounce_friction; @@ -291,7 +292,7 @@ Eina_Bool _elm_theme_object_set(Evas_Object *parent, Eina_Bool _elm_theme_object_icon_set(Evas_Object *o, const char *group, const char *style); -Eina_Bool _elm_theme_set(Elm_Theme *th, +Eina_Bool _elm_theme_set(Elm_Theme *th, Evas_Object *o, const char *clas, const char *group, diff --git a/src/lib/elm_radio.c b/src/lib/elm_radio.c index 738c51d..d307084 100644 --- a/src/lib/elm_radio.c +++ b/src/lib/elm_radio.c @@ -282,7 +282,7 @@ _elm_radio_smart_del(Evas_Object *obj) ELM_WIDGET_CLASS(_elm_radio_parent_sc)->base.del(obj); } -static void +static Eina_Bool _elm_radio_smart_activate(Evas_Object *obj, Elm_Activate act) { if (act != ELM_ACTIVATE_DEFAULT) return EINA_FALSE; diff --git a/src/lib/elm_scroller.c b/src/lib/elm_scroller.c index 62f24da..b8252a1 100644 --- a/src/lib/elm_scroller.c +++ b/src/lib/elm_scroller.c @@ -12,6 +12,12 @@ static const char SIG_EDGE_LEFT[] = "edge,left"; static const char SIG_EDGE_RIGHT[] = "edge,right"; static const char SIG_EDGE_TOP[] = "edge,top"; static const char SIG_EDGE_BOTTOM[] = "edge,bottom"; +static const char SIG_VBAR_DRAG[] = "vbar,drag"; +static const char SIG_VBAR_PRESS[] = "vbar,press"; +static const char SIG_VBAR_UNPRESS[] = "vbar,unpress"; +static const char SIG_HBAR_DRAG[] = "hbar,drag"; +static const char SIG_HBAR_PRESS[] = "hbar,press"; +static const char SIG_HBAR_UNPRESS[] = "hbar,unpress"; static const Evas_Smart_Cb_Description _smart_callbacks[] = { {SIG_SCROLL, ""}, @@ -23,6 +29,12 @@ static const Evas_Smart_Cb_Description _smart_callbacks[] = {SIG_EDGE_RIGHT, ""}, {SIG_EDGE_TOP, ""}, {SIG_EDGE_BOTTOM, ""}, + {SIG_VBAR_DRAG, ""}, + {SIG_VBAR_PRESS, ""}, + {SIG_VBAR_UNPRESS, ""}, + {SIG_HBAR_DRAG, ""}, + {SIG_HBAR_PRESS, ""}, + {SIG_HBAR_UNPRESS, ""}, {NULL, NULL} }; @@ -230,7 +242,7 @@ _elm_scroller_smart_event(Evas_Object *obj, else return EINA_FALSE; ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD; - sd->s_iface->content_pos_set(obj, x, y); + sd->s_iface->content_pos_set(obj, x, y, EINA_TRUE); return EINA_TRUE; } @@ -283,7 +295,7 @@ _elm_scroller_smart_activate(Evas_Object *obj, Elm_Activate act) x += page_x; } - sd->s_iface->content_pos_set(obj, x, y); + sd->s_iface->content_pos_set(obj, x, y, EINA_TRUE); return EINA_TRUE; } @@ -378,6 +390,16 @@ _elm_scroller_smart_focus_next(const Evas_Object *obj, cur = sd->content; + /* access */ + if (_elm_config->access_mode) + { + if ((elm_widget_can_focus_get(cur)) || + (elm_widget_child_can_focus_get(cur))) + return elm_widget_focus_next_get(cur, dir, next); + + return EINA_FALSE; + } + /* Try focus cycle in subitem */ if (elm_widget_focus_get(obj)) { @@ -470,6 +492,48 @@ _edge_bottom_cb(Evas_Object *obj, } static void +_vbar_drag_cb(Evas_Object *obj, + void *data __UNUSED__) +{ + evas_object_smart_callback_call(obj, SIG_VBAR_DRAG, NULL); +} + +static void +_vbar_press_cb(Evas_Object *obj, + void *data __UNUSED__) +{ + evas_object_smart_callback_call(obj, SIG_VBAR_PRESS, NULL); +} + +static void +_vbar_unpress_cb(Evas_Object *obj, + void *data __UNUSED__) +{ + evas_object_smart_callback_call(obj, SIG_VBAR_UNPRESS, NULL); +} + +static void +_hbar_drag_cb(Evas_Object *obj, + void *data __UNUSED__) +{ + evas_object_smart_callback_call(obj, SIG_HBAR_DRAG, NULL); +} + +static void +_hbar_press_cb(Evas_Object *obj, + void *data __UNUSED__) +{ + evas_object_smart_callback_call(obj, SIG_HBAR_PRESS, NULL); +} + +static void +_hbar_unpress_cb(Evas_Object *obj, + void *data __UNUSED__) +{ + evas_object_smart_callback_call(obj, SIG_HBAR_UNPRESS, NULL); +} + +static void _scroll_cb(Evas_Object *obj, void *data __UNUSED__) { @@ -619,6 +683,12 @@ _elm_scroller_smart_add(Evas_Object *obj) priv->s_iface->edge_right_cb_set(obj, _edge_right_cb); priv->s_iface->edge_top_cb_set(obj, _edge_top_cb); priv->s_iface->edge_bottom_cb_set(obj, _edge_bottom_cb); + priv->s_iface->vbar_drag_cb_set(obj, _vbar_drag_cb); + priv->s_iface->vbar_press_cb_set(obj, _vbar_press_cb); + priv->s_iface->vbar_unpress_cb_set(obj, _vbar_unpress_cb); + priv->s_iface->hbar_drag_cb_set(obj, _hbar_drag_cb); + priv->s_iface->hbar_press_cb_set(obj, _hbar_press_cb); + priv->s_iface->hbar_unpress_cb_set(obj, _hbar_unpress_cb); priv->s_iface->scroll_cb_set(obj, _scroll_cb); priv->s_iface->animate_start_cb_set(obj, _scroll_anim_start_cb); priv->s_iface->animate_stop_cb_set(obj, _scroll_anim_stop_cb); diff --git a/src/lib/elm_slider.c b/src/lib/elm_slider.c index 0db1c34..010874e 100644 --- a/src/lib/elm_slider.c +++ b/src/lib/elm_slider.c @@ -49,6 +49,9 @@ _val_fetch(Evas_Object *obj) { Eina_Bool rtl; double posx = 0.0, posy = 0.0, pos = 0.0, val; + char text[1024] = {0,}; + Eina_Strbuf *buf = NULL; + char *str = NULL; ELM_SLIDER_DATA_GET(obj, sd); @@ -70,6 +73,32 @@ _val_fetch(Evas_Object *obj) evas_object_smart_callback_call(obj, SIG_CHANGED, NULL); if (sd->delay) ecore_timer_del(sd->delay); sd->delay = ecore_timer_add(0.2, _delay_change, obj); + + if (_elm_config->access_mode != ELM_ACCESS_MODE_OFF) + { + buf = eina_strbuf_new(); + if (sd->indicator_format_func) + { + str = sd->indicator_format_func(sd->val); + eina_strbuf_append(buf, str); + if (sd->indicator_format_free) sd->indicator_format_free(str); + eina_strbuf_append(buf, E_(" of ")); + str = sd->indicator_format_func(sd->val_max); + eina_strbuf_append(buf, str); + if (sd->indicator_format_free) sd->indicator_format_free(str); + } + else if (sd->indicator) + { + snprintf(text, sizeof(text), sd->indicator, sd->val); + eina_strbuf_append(buf, text); + eina_strbuf_append(buf, E_(" of ")); + snprintf(text, sizeof(text), sd->indicator, sd->val_max); + eina_strbuf_append(buf, text); + } + + _elm_access_say(eina_strbuf_string_get(buf)); + eina_strbuf_free(buf); + } } } diff --git a/src/lib/elm_theme.c b/src/lib/elm_theme.c index 4170418..81f7416 100644 --- a/src/lib/elm_theme.c +++ b/src/lib/elm_theme.c @@ -223,7 +223,7 @@ _elm_theme_reload(void *data __UNUSED__, Evas_Object *obj, evas_object_event_callback_add(elm, EVAS_CALLBACK_DEL, _elm_theme_idler_clean, NULL); evas_object_data_set(elm, "elm-theme-reload-idler", ecore_idler_add(_elm_theme_reload_idler, elm)); } -} +} Eina_Bool _elm_theme_object_set(Evas_Object *parent, Evas_Object *o, const char *clas, const char *group, const char *style) @@ -232,13 +232,16 @@ _elm_theme_object_set(Evas_Object *parent, Evas_Object *o, const char *clas, con void *test; if (parent) th = elm_widget_theme_get(parent); + if (!_elm_theme_set(th, o, clas, group, style)) return EINA_FALSE; + test = evas_object_data_get(o, "edje,theme,watcher"); if (!test) { - edje_object_signal_callback_add(o, "edje,change,file", "edje", _elm_theme_reload, NULL); + edje_object_signal_callback_add(o, "edje,change,file", "edje", + _elm_theme_reload, NULL); evas_object_data_set(o, "edje,theme,watcher", (void*) -1); } - return _elm_theme_set(th, o, clas, group, style); + return EINA_TRUE; } /* only issued by elm_icon.c */ @@ -257,28 +260,29 @@ _elm_theme_set(Elm_Theme *th, Evas_Object *o, const char *clas, const char *grou { const char *file; char buf2[1024]; - Eina_Bool ok; if ((!clas) || (!group) || (!style)) return EINA_FALSE; if (!th) th = &(theme_default); + snprintf(buf2, sizeof(buf2), "elm/%s/%s/%s", clas, group, style); file = _elm_theme_group_file_find(th, buf2); if (file) { - ok = edje_object_file_set(o, file, buf2); - if (ok) return EINA_TRUE; + if (edje_object_file_set(o, file, buf2)) + return EINA_TRUE; else DBG("could not set theme group '%s' from file '%s': %s", buf2, file, edje_load_error_str(edje_object_load_error_get(o))); } + snprintf(buf2, sizeof(buf2), "elm/%s/%s/default", clas, group); file = _elm_theme_group_file_find(th, buf2); if (!file) return EINA_FALSE; - ok = edje_object_file_set(o, file, buf2); - if (!ok) - DBG("could not set theme group '%s' from file '%s': %s", - buf2, file, edje_load_error_str(edje_object_load_error_get(o))); - return ok; + if (edje_object_file_set(o, file, buf2)) return EINA_TRUE; + DBG("could not set theme group '%s' from file '%s': %s", + buf2, file, edje_load_error_str(edje_object_load_error_get(o))); + + return EINA_FALSE; } Eina_Bool diff --git a/src/lib/elm_toolbar.c b/src/lib/elm_toolbar.c index d35ef65..42ba565 100644 --- a/src/lib/elm_toolbar.c +++ b/src/lib/elm_toolbar.c @@ -63,7 +63,7 @@ _items_visibility_fix(Elm_Toolbar_Smart_Data *sd, if (it->separator) { prev = ELM_TOOLBAR_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->prev); - it->prio.priority = prev->prio.priority; + if (prev) it->prio.priority = prev->prio.priority; } } @@ -493,13 +493,13 @@ _resize_job(void *data) if (sd->vertical) { - if (h >= vh) _items_size_fit(obj, &h, vh); + if (h > vh) _items_size_fit(obj, &h, vh); if (sd->item_count - sd->separator_count > 0) sd->s_iface->paging_set(obj, 0.0, 0.0, 0, (h / (sd->item_count - sd->separator_count))); } else { - if (w >= vw) _items_size_fit(obj, &w, vw); + if (w > vw) _items_size_fit(obj, &w, vw); if (sd->item_count - sd->separator_count > 0) sd->s_iface->paging_set(obj, 0.0, 0.0, (w / (sd->item_count - sd->separator_count)), 0); } @@ -900,6 +900,9 @@ _item_theme_hook(Evas_Object *obj, if (!it->separator && !it->object) elm_coords_finger_size_adjust(1, &mw, 1, &mh); + // If the min size is changed by edje signal in edc, + //the below function should be called before the calculation. + edje_object_message_signal_process(view); edje_object_size_min_restricted_calc(view, &mw, &mh, mw, mh); if (!it->separator && !it->object) elm_coords_finger_size_adjust(1, &mw, 1, &mh); @@ -955,25 +958,25 @@ _sizing_eval(Evas_Object *obj) sd->s_iface->content_viewport_size_get(obj, &vw, &vh); if (sd->shrink_mode == ELM_TOOLBAR_SHRINK_NONE) - { - minw = minw_bx + (w - vw); - minh = minh_bx + (h - vh); - } + { + minw = minw_bx + (w - vw); + minh = minh_bx + (h - vh); + } else if (sd->shrink_mode == ELM_TOOLBAR_SHRINK_EXPAND) - { - if (sd->vertical) - { - minw = minw_bx + (w - vw); - if (minh_bx < vh) minh_bx = vh; - else _items_size_fit(obj, &minh_bx, vh); - } - else - { - minh = minh_bx + (h - vh); - if (minw_bx < vw) minw_bx = vw; - else _items_size_fit(obj, &minw_bx, vw); - } - } + { + if (sd->vertical) + { + minw = minw_bx + (w - vw); + if (minh_bx <= vh) minh_bx = vh; + else _items_size_fit(obj, &minh_bx, vh); + } + else + { + minh = minh_bx + (h - vh); + if (minw_bx <= vw) minw_bx = vw; + else _items_size_fit(obj, &minw_bx, vw); + } + } else { if (sd->vertical) @@ -1056,6 +1059,9 @@ _elm_toolbar_item_label_update(Elm_Toolbar_Item *item) edje_object_signal_emit(VIEW(item), "elm,state,text,hidden", "elm"); elm_coords_finger_size_adjust(1, &mw, 1, &mh); + // If the min size is changed by edje signal in edc, + //the below function should be called before the calculation. + edje_object_message_signal_process(VIEW(item)); edje_object_size_min_restricted_calc(VIEW(item), &mw, &mh, mw, mh); elm_coords_finger_size_adjust(1, &mw, 1, &mh); if (sd->shrink_mode != ELM_TOOLBAR_SHRINK_EXPAND) @@ -1295,93 +1301,283 @@ _select_cb(void *data, } static void -_items_change(Evas_Object *obj) +_item_move_cb(void *data, + Evas *e __UNUSED__, + Evas_Object *obj __UNUSED__, + void *event_info __UNUSED__) +{ + Elm_Toolbar_Item *item = data; + + item->on_move = EINA_FALSE; + + evas_object_event_callback_del_full + (VIEW(item), EVAS_CALLBACK_MOVE, _item_move_cb, data); +} + +static void +_items_change(Elm_Toolbar_Item *reorder_from, Elm_Toolbar_Item *reorder_to) { Elm_Toolbar_Item *prev = NULL, *next = NULL; int tmp; - ELM_TOOLBAR_DATA_GET(obj, sd); + ELM_TOOLBAR_DATA_GET(WIDGET(reorder_from), sd); + if (reorder_from == reorder_to) return; - if ((sd->reorder_from) && (sd->reorder_to) && - (!sd->reorder_from->separator) && (!sd->reorder_to->separator)) + if ((reorder_from) && (reorder_to) && + (!reorder_from->separator) && (!reorder_to->separator)) { prev = ELM_TOOLBAR_ITEM_FROM_INLIST - (EINA_INLIST_GET(sd->reorder_from)->prev); - if (prev == sd->reorder_to) - prev = sd->reorder_from; + (EINA_INLIST_GET(reorder_from)->prev); + if (prev == reorder_to) + prev = reorder_from; if (!prev) next = ELM_TOOLBAR_ITEM_FROM_INLIST - (EINA_INLIST_GET(sd->reorder_from)->next); - if (next == sd->reorder_to) + (EINA_INLIST_GET(reorder_from)->next); + if (next == reorder_to) next = NULL; sd->items = eina_inlist_remove - (sd->items, EINA_INLIST_GET(sd->reorder_from)); + (sd->items, EINA_INLIST_GET(reorder_from)); sd->items = eina_inlist_append_relative - (sd->items, EINA_INLIST_GET(sd->reorder_from), - EINA_INLIST_GET(sd->reorder_to)); + (sd->items, EINA_INLIST_GET(reorder_from), + EINA_INLIST_GET(reorder_to)); sd->items = eina_inlist_remove - (sd->items, EINA_INLIST_GET(sd->reorder_to)); + (sd->items, EINA_INLIST_GET(reorder_to)); if (prev) sd->items = eina_inlist_append_relative - (sd->items, EINA_INLIST_GET(sd->reorder_to), + (sd->items, EINA_INLIST_GET(reorder_to), EINA_INLIST_GET(prev)); else if (next) sd->items = eina_inlist_prepend_relative - (sd->items, EINA_INLIST_GET(sd->reorder_to), + (sd->items, EINA_INLIST_GET(reorder_to), EINA_INLIST_GET(next)); else sd->items = eina_inlist_prepend - (sd->items, EINA_INLIST_GET(sd->reorder_to)); + (sd->items, EINA_INLIST_GET(reorder_to)); + + evas_object_box_remove(sd->bx, VIEW(reorder_from)); + evas_object_box_insert_after(sd->bx, VIEW(reorder_from), + VIEW(reorder_to)); + evas_object_box_remove(sd->bx, VIEW(reorder_to)); + if (prev) + evas_object_box_insert_after(sd->bx, VIEW(reorder_to), + VIEW(prev)); + else if (next) + evas_object_box_insert_before(sd->bx, VIEW(reorder_to), + VIEW(next)); + else + evas_object_box_prepend(sd->bx, VIEW(reorder_to)); + + tmp = reorder_from->prio.priority; + reorder_from->prio.priority = reorder_to->prio.priority; + reorder_to->prio.priority = tmp; + + reorder_from->on_move = EINA_TRUE; + reorder_to->on_move = EINA_TRUE; + + evas_object_event_callback_add + (VIEW(reorder_from), EVAS_CALLBACK_MOVE, + _item_move_cb, reorder_from); + evas_object_event_callback_add + (VIEW(reorder_to), EVAS_CALLBACK_MOVE, + _item_move_cb, reorder_to); + } + + _resize_cb(WIDGET(reorder_from), NULL, NULL, NULL); +} - if (sd->shrink_mode == ELM_TOOLBAR_SHRINK_NONE || - sd->shrink_mode == ELM_TOOLBAR_SHRINK_SCROLL) +static void +_transit_del_cb(void *data, Elm_Transit *transit __UNUSED__) +{ + Elm_Toolbar_Item *it, *item = data; + ELM_TOOLBAR_DATA_GET(WIDGET(item), sd); + + if (item->reorder_to) + { + if (item->reorder_to == sd->reorder_empty) + sd->reorder_empty = item; + else if (item == sd->reorder_empty) + sd->reorder_empty = item->reorder_to; + + _items_change(item->reorder_to, item); + + EINA_INLIST_FOREACH(sd->items, it) { - evas_object_box_remove(sd->bx, VIEW(sd->reorder_from)); - evas_object_box_insert_after(sd->bx, VIEW(sd->reorder_from), - VIEW(sd->reorder_to)); - evas_object_box_remove(sd->bx, VIEW(sd->reorder_to)); - if (prev) - evas_object_box_insert_after(sd->bx, VIEW(sd->reorder_to), - VIEW(prev)); - else if (next) - evas_object_box_insert_before(sd->bx, VIEW(sd->reorder_to), - VIEW(next)); - else - evas_object_box_prepend(sd->bx, VIEW(sd->reorder_to)); + if (it != item) + { + if (it->reorder_to == item) + it->reorder_to = item->reorder_to; + else if (it->reorder_to == item->reorder_to) + it->reorder_to = item; + } } + } + if (item->proxy) + { + evas_object_image_source_visible_set(elm_image_object_get(item->proxy), EINA_TRUE); + evas_object_del(item->proxy); + item->proxy = NULL; + } + item->trans = NULL; - tmp = sd->reorder_from->prio.priority; - sd->reorder_from->prio.priority = sd->reorder_to->prio.priority; - sd->reorder_to->prio.priority = tmp; + if (item->reorder_to) + { + EINA_INLIST_FOREACH(sd->items, it) + if (it->trans) break; + + if (!it) sd->reorder_empty = sd->reorder_item; } + item->reorder_to = NULL; +} - _resize_cb(obj, NULL, NULL, NULL); +static void +_item_transition_start +(Elm_Toolbar_Item *it, Evas_Coord x, Evas_Coord y, Evas_Coord w, Evas_Coord h) +{ + Evas_Coord tx, ty; + Evas_Object *obj = WIDGET(it); + ELM_TOOLBAR_DATA_GET(obj, sd); + + it->proxy = elm_image_add(obj); + elm_image_aspect_fixed_set(it->proxy, EINA_FALSE); + evas_object_image_source_set(elm_image_object_get(it->proxy), VIEW(it)); + evas_object_image_source_visible_set(elm_image_object_get(it->proxy), EINA_FALSE); + + it->trans = elm_transit_add(); + elm_transit_object_add(it->trans, it->proxy); + evas_object_geometry_get(VIEW(sd->reorder_empty), &tx, &ty, NULL, NULL); + evas_object_move(it->proxy, x, y); + evas_object_resize(it->proxy, w, h); + evas_object_show(it->proxy); + + elm_transit_effect_translation_add(it->trans, 0, 0, tx - x, 0); + elm_transit_duration_set(it->trans, 0.3); + elm_transit_del_cb_set(it->trans, _transit_del_cb, it); + elm_transit_go(it->trans); + + it->reorder_to = sd->reorder_empty; } static void -_mouse_move_reorder(Elm_Toolbar_Item *it, +_animate_missed_items(Elm_Toolbar_Item *prev, Elm_Toolbar_Item *next) +{ + ELM_TOOLBAR_DATA_GET(WIDGET(prev), sd); + Elm_Toolbar_Item *it, *it2; + Eina_List *list, *l; + Evas_Object *o; + Eina_Bool reverse = EINA_FALSE; + Evas_Coord fx, fy, fw, fh; + + list = evas_object_box_children_get(sd->bx); + + EINA_LIST_FOREACH(list, l, o) + { + if (o == VIEW(prev)) + break; + else if (o == VIEW(next)) + reverse = EINA_TRUE; + } + + if (!reverse) + l = eina_list_next(l); + else + l = eina_list_prev(l); + + while (VIEW(next) != eina_list_data_get(l)) + { + EINA_INLIST_FOREACH(sd->items, it) + { + if (VIEW(it) == eina_list_data_get(l)) + { + if (!it->trans && it != sd->reorder_item) + { + evas_object_geometry_get(VIEW(sd->reorder_empty), &fx, &fy, &fw, &fh); + _item_transition_start(it, fx, fy, fw, fh); + sd->reorder_empty = it; + } + EINA_INLIST_FOREACH(sd->items, it2) + { + if (it == it2->reorder_to) break; + } + if (it2) + { + it2->reorder_to = NULL; + evas_object_geometry_get(it2->proxy, &fx, &fy, &fw, &fh); + if (it2->trans) elm_transit_del(it2->trans); + _item_transition_start(it2, fx, fy, fw, fh); + sd->reorder_empty = it; + } + } + } + if (!reverse) + l = eina_list_next(l); + else + l = eina_list_prev(l); + } +} + +static void +_mouse_move_reorder(Elm_Toolbar_Item *item, Evas *evas __UNUSED__, Evas_Object *obj __UNUSED__, Evas_Event_Mouse_Move *ev) { - Evas_Coord w, h; + Evas_Coord x, y, w, h; + Evas_Coord fx, fy, fw, fh; + Elm_Toolbar_Item *it, *it2; - evas_object_geometry_get(VIEW(it), NULL, NULL, &w, &h); - evas_object_move - (VIEW(it), ev->cur.canvas.x - (w / 2), ev->cur.canvas.y - (h / 2)); - evas_object_show(VIEW(it)); + ELM_TOOLBAR_DATA_GET(WIDGET(item), sd); + + evas_object_geometry_get(VIEW(item), &x, &y, &w, &h); + if (sd->vertical) + evas_object_move(item->proxy, x, ev->cur.canvas.y - (h / 2)); + else + evas_object_move(item->proxy, ev->cur.canvas.x - (w / 2), y); + evas_object_show(item->proxy); + + if (sd->reorder_empty->on_move) return; + + evas_object_geometry_get(sd->VIEW(reorder_empty), &x, &y, &w, &h); + if (ev->cur.canvas.x < x || ev->cur.canvas.x > x + w) + { + EINA_INLIST_FOREACH(sd->items, it) + { + if (it->on_move) continue; + evas_object_geometry_get(VIEW(it), &x, &y, &w, &h); + if (ev->cur.canvas.x > x && ev->cur.canvas.x < x + w) break; + } + if (it && (it != sd->reorder_empty)) + { + _animate_missed_items(sd->reorder_empty, it); + if (!it->trans && it != item) + { + evas_object_geometry_get(VIEW(it), &fx, &fy, &fw, &fh); + _item_transition_start(it, fx, fy, fw, fh); + sd->reorder_empty = it; + } + EINA_INLIST_FOREACH(sd->items, it2) + { + if (it == it2->reorder_to) break; + } + if (it2) + { + it2->reorder_to = NULL; + evas_object_geometry_get(it2->proxy, &fx, &fy, &fw, &fh); + if (it2->trans) elm_transit_del(it2->trans); + _item_transition_start(it2, fx, fy, fw, fh); + sd->reorder_empty = it; + } + } + } } static void _mouse_up_reorder(Elm_Toolbar_Item *it, Evas *evas __UNUSED__, Evas_Object *obj, - Evas_Event_Mouse_Up *ev) + Evas_Event_Mouse_Up *ev __UNUSED__) { - Evas_Coord x, y, w, h; - ELM_TOOLBAR_DATA_GET(WIDGET(it), sd); evas_object_event_callback_del_full @@ -1399,19 +1595,13 @@ _mouse_up_reorder(Elm_Toolbar_Item *it, evas_object_event_callback_del_full (sd->more, EVAS_CALLBACK_MOUSE_UP, (Evas_Object_Event_Cb)_mouse_up_reorder, it); - elm_widget_item_del(it); - EINA_INLIST_FOREACH(sd->items, it) + if (it->proxy) { - evas_object_geometry_get(VIEW(it), &x, &y, &w, &h); - if ((x < ev->canvas.x) && (ev->canvas.x < x + w) && - (y < ev->canvas.y) && (ev->canvas.y < y + h)) - { - sd->reorder_to = it; - _items_change(WIDGET(it)); - } + evas_object_image_source_visible_set(elm_image_object_get(it->proxy), EINA_TRUE); + evas_object_del(it->proxy); + it->proxy = NULL; } - sd->s_iface->hold_set(obj, EINA_FALSE); } @@ -1419,93 +1609,51 @@ static void _item_reorder_start(Elm_Toolbar_Item *item) { Evas_Object *obj = WIDGET(item); - Evas_Object *icon_obj; Evas_Coord x, y, w, h; - Elm_Toolbar_Item *it; ELM_TOOLBAR_DATA_GET(obj, sd); - sd->reorder_from = item; + sd->reorder_empty = sd->reorder_item = item; - icon_obj = elm_icon_add(obj); - elm_icon_order_lookup_set(icon_obj, sd->lookup_order); - - if (!icon_obj) return; - it = elm_widget_item_new(obj, Elm_Toolbar_Item); - if (!it) - { - evas_object_del(icon_obj); - return; - } - - it->label = eina_stringshare_add(item->label); - VIEW(it) = edje_object_add(evas_object_evas_get(obj)); - - if (_item_icon_set(icon_obj, "toolbar/", item->icon_str)) - { - it->icon = icon_obj; - it->icon_str = eina_stringshare_add(item->icon_str); - } - else - { - it->icon = NULL; - it->icon_str = NULL; - evas_object_del(icon_obj); - } - - elm_widget_theme_object_set(obj, VIEW(it), "toolbar", "item", - elm_widget_style_get(obj)); - if (it->icon) - { - int ms = 0; - - ms = ((double)sd->icon_size * elm_config_scale_get()); - evas_object_size_hint_min_set(it->icon, ms, ms); - evas_object_size_hint_max_set(it->icon, ms, ms); - edje_object_part_swallow(VIEW(it), "elm.swallow.icon", it->icon); - edje_object_signal_emit(VIEW(it), "elm,state,icon,visible", "elm"); - evas_object_show(it->icon); - elm_widget_sub_object_add(obj, it->icon); - } - if (it->label) - { - edje_object_part_text_escaped_set(VIEW(it), "elm.text", it->label); - edje_object_signal_emit(VIEW(it), "elm,state,text,visible", "elm"); - } - - edje_object_signal_emit(VIEW(it), "elm,state,moving", "elm"); + item->proxy = elm_image_add(obj); + elm_image_aspect_fixed_set(item->proxy, EINA_FALSE); + evas_object_image_source_set(elm_image_object_get(item->proxy), VIEW(item)); + evas_object_image_source_visible_set(elm_image_object_get(item->proxy), EINA_FALSE); + evas_object_layer_set(item->proxy, 100); + edje_object_signal_emit(VIEW(item), "elm,state,moving", "elm"); evas_object_event_callback_add (obj, EVAS_CALLBACK_MOUSE_MOVE, - (Evas_Object_Event_Cb)_mouse_move_reorder, it); + (Evas_Object_Event_Cb)_mouse_move_reorder, item); evas_object_event_callback_add (sd->more, EVAS_CALLBACK_MOUSE_MOVE, - (Evas_Object_Event_Cb)_mouse_move_reorder, it); + (Evas_Object_Event_Cb)_mouse_move_reorder, item); evas_object_event_callback_add - (VIEW(it), EVAS_CALLBACK_MOUSE_MOVE, - (Evas_Object_Event_Cb)_mouse_move_reorder, it); + (item->proxy, EVAS_CALLBACK_MOUSE_MOVE, + (Evas_Object_Event_Cb)_mouse_move_reorder, item); evas_object_event_callback_add (obj, EVAS_CALLBACK_MOUSE_UP, - (Evas_Object_Event_Cb)_mouse_up_reorder, it); + (Evas_Object_Event_Cb)_mouse_up_reorder, item); evas_object_event_callback_add (sd->more, EVAS_CALLBACK_MOUSE_UP, - (Evas_Object_Event_Cb)_mouse_up_reorder, it); + (Evas_Object_Event_Cb)_mouse_up_reorder, item); evas_object_geometry_get(VIEW(item), &x, &y, &w, &h); - evas_object_resize(VIEW(it), w, h); - evas_object_move(VIEW(it), x, y); - evas_object_show(VIEW(it)); + evas_object_resize(item->proxy, w, h); + evas_object_move(item->proxy, x, y); + evas_object_show(item->proxy); - sd->s_iface->hold_set(WIDGET(it), EINA_TRUE); + sd->s_iface->hold_set(WIDGET(item), EINA_TRUE); } static Eina_Bool -_long_press(Elm_Toolbar_Item *it) +_long_press_cb(void *data) { + Elm_Toolbar_Item *it = data; ELM_TOOLBAR_DATA_GET(WIDGET(it), sd); sd->long_timer = NULL; @@ -1568,7 +1716,7 @@ _mouse_down_cb(Elm_Toolbar_Item *it, (sd->long_timer, _elm_config->longpress_timeout); else sd->long_timer = ecore_timer_add - (_elm_config->longpress_timeout, (Ecore_Task_Cb)_long_press, it); + (_elm_config->longpress_timeout, _long_press_cb, it); evas_object_event_callback_add(VIEW(it), EVAS_CALLBACK_MOUSE_MOVE, (Evas_Object_Event_Cb)_mouse_move_cb, it); @@ -1661,7 +1809,7 @@ _access_state_cb(void *data, Evas_Object *obj __UNUSED__) static Eina_Bool _item_del_pre_hook(Elm_Object_Item *it) { - Elm_Toolbar_Item *item, *next; + Elm_Toolbar_Item *item, *next = NULL; Evas_Object *obj; item = (Elm_Toolbar_Item *)it; @@ -1702,12 +1850,7 @@ _access_activate_cb(void *data __UNUSED__, if (elm_widget_item_disabled_get(it)) return; - if (it->selected) - { - _elm_access_say(E_("Unselected")); - _item_unselect(it); - } - else + if (!it->selected) { _elm_access_say(E_("Selected")); _item_select(it); @@ -1822,6 +1965,9 @@ _item_new(Evas_Object *obj, mw = mh = -1; if (!it->separator && !it->object) elm_coords_finger_size_adjust(1, &mw, 1, &mh); + // If the min size is changed by edje signal in edc, + //the below function should be called before the calculation. + edje_object_message_signal_process(VIEW(it)); edje_object_size_min_restricted_calc(VIEW(it), &mw, &mh, mw, mh); if (!it->separator && !it->object) elm_coords_finger_size_adjust(1, &mw, 1, &mh); @@ -1877,6 +2023,9 @@ _elm_toolbar_item_icon_update(Elm_Toolbar_Item *item) edje_object_signal_emit(VIEW(item), "elm,state,icon,hidden", "elm"); evas_object_hide(old_icon); elm_coords_finger_size_adjust(1, &mw, 1, &mh); + // If the min size is changed by edje signal in edc, + //the below function should be called before the calculation. + edje_object_message_signal_process(VIEW(item)); edje_object_size_min_restricted_calc(VIEW(item), &mw, &mh, mw, mh); elm_coords_finger_size_adjust(1, &mw, 1, &mh); if (sd->shrink_mode != ELM_TOOLBAR_SHRINK_EXPAND) diff --git a/src/lib/elm_transit.c b/src/lib/elm_transit.c index 8527414..d4d43b8 100644 --- a/src/lib/elm_transit.c +++ b/src/lib/elm_transit.c @@ -59,6 +59,7 @@ struct _Elm_Transit Eina_Bool deleted : 1; Eina_Bool state_keep : 1; Eina_Bool finished : 1; + Eina_Bool smooth : 1; }; struct _Elm_Transit_Effect_Module @@ -172,7 +173,7 @@ _transit_obj_remove_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *e free(obj_data); } _remove_obj_from_list(transit, obj); - if (!transit->objs) elm_transit_del(transit); + if (!transit->objs && !transit->deleted) elm_transit_del(transit); } static void @@ -250,6 +251,8 @@ _transit_del(Elm_Transit *transit) Elm_Transit *chain_transit; Eina_List *elist, *elist_next; + transit->deleted = EINA_TRUE; + if (transit->animator) ecore_animator_del(transit->animator); @@ -265,8 +268,6 @@ _transit_del(Elm_Transit *transit) while (transit->objs) _transit_obj_remove(transit, eina_list_data_get(transit->objs)); - transit->deleted = EINA_TRUE; - if (transit->del_data.func) transit->del_data.func(transit->del_data.arg, transit); @@ -472,6 +473,7 @@ elm_transit_add(void) transit->v1 = 1.0; transit->v2 = 0.0; + transit->smooth = EINA_TRUE; return transit; } @@ -481,8 +483,9 @@ elm_transit_del(Elm_Transit *transit) { ELM_TRANSIT_CHECK_OR_RETURN(transit); - if (transit->walking) transit->deleted = EINA_TRUE; - else _transit_del(transit); + transit->deleted = EINA_TRUE; + if (transit->walking) return; + _transit_del(transit); } EAPI void @@ -579,6 +582,20 @@ elm_transit_objects_get(const Elm_Transit *transit) } EAPI void +elm_transit_smooth_set(Elm_Transit *transit, Eina_Bool smooth) +{ + ELM_TRANSIT_CHECK_OR_RETURN(transit); + transit->smooth = !!smooth; +} + +EAPI Eina_Bool +elm_transit_smooth_get(const Elm_Transit *transit) +{ + ELM_TRANSIT_CHECK_OR_RETURN(transit, EINA_FALSE); + return transit->smooth; +} + +EAPI void elm_transit_event_enabled_set(Elm_Transit *transit, Eina_Bool enabled) { ELM_TRANSIT_CHECK_OR_RETURN(transit); @@ -1068,6 +1085,7 @@ _transit_effect_zoom_op(Elm_Transit_Effect *effect, Elm_Transit *transit , doubl _recover_image_uv(obj, map, EINA_FALSE, EINA_FALSE); evas_map_util_3d_perspective(map, x + (w / 2), y + (h / 2), 0, _TRANSIT_FOCAL); + if (!transit->smooth) evas_map_smooth_set(map, EINA_FALSE); evas_object_map_set(obj, map); evas_object_map_enable_set(obj, EINA_TRUE); } @@ -1224,6 +1242,7 @@ _transit_effect_flip_op(Elm_Transit_Effect *effect, Elm_Transit *transit, double evas_map_util_3d_perspective(map, x + half_w, y + half_h, 0, _TRANSIT_FOCAL); evas_object_map_enable_set(front, EINA_TRUE); evas_object_map_enable_set(back, EINA_TRUE); + if (!transit->smooth) evas_map_smooth_set(map, EINA_FALSE); evas_object_map_set(obj, map); } evas_map_free(map); @@ -1530,6 +1549,7 @@ _transit_effect_resizable_flip_op(Elm_Transit_Effect *effect, Elm_Transit *trans _TRANSIT_FOCAL); evas_object_map_enable_set(resizable_flip_node->front, EINA_TRUE); evas_object_map_enable_set(resizable_flip_node->back, EINA_TRUE); + if (!transit->smooth) evas_map_smooth_set(map, EINA_FALSE); evas_object_map_set(obj, map); } evas_map_free(map); @@ -1752,7 +1772,7 @@ _transit_effect_wipe_op(Elm_Transit_Effect *effect, Elm_Transit *transit, double _elm_fx_wipe_show(map, wipe->dir, _x, _y, _w, _h, (float)progress); else _elm_fx_wipe_hide(map, wipe->dir, _x, _y, _w, _h, (float)progress); - + if (!transit->smooth) evas_map_smooth_set(map, EINA_FALSE); evas_object_map_enable_set(obj, EINA_TRUE); evas_object_map_set(obj, map); } @@ -2272,6 +2292,7 @@ _transit_effect_rotation_op(Elm_Transit_Effect *effect, Elm_Transit *transit, do half_h = (float)h * 0.5; evas_map_util_rotate(map, degree, x + half_w, y + half_h); + if (!transit->smooth) evas_map_smooth_set(map, EINA_FALSE); evas_object_map_enable_set(obj, EINA_TRUE); evas_object_map_set(obj, map); } diff --git a/src/lib/elm_transit.h b/src/lib/elm_transit.h index 90feb8a..cb0f8c9 100644 --- a/src/lib/elm_transit.h +++ b/src/lib/elm_transit.h @@ -631,6 +631,38 @@ EAPI void elm_transit_chain_transit_del(Elm_Transit *transit, EAPI Eina_List *elm_transit_chain_transits_get(const Elm_Transit *transit); /** + * Set the smooth effect for a transit. + * + * @param obj The transit object + * @param enabled enable or disable smooth map rendering + * + * This sets smoothing for transit map rendering. If the object added in a + * transit is a type that has its own smoothing settings, then both the smooth + * settings for this object and the map must be turned off. By default smooth + * maps are enabled. + * + * @see evas_map_smooth_set() + * @since 1.8 + * + * @ingroup Transit + */ +EAPI void elm_transit_smooth_set(Elm_Transit *transit, Eina_Bool smooth); + +/** + * Get the smooth scaling for transit map rendering + * + * This gets smooth scaling for transit map rendering. + * + * @param obj The transit object + * @return @c EINA_TRUE if the smooth is enabled, @c EINA_FALSE otherwise. + * + * @see elm_transit_smooth_set() + * @since 1.8 + * + */ +Eina_Bool elm_transit_smooth_get(const Elm_Transit *transit); + +/** * Add the Resizing Effect to Elm_Transit. * * @note This API is one of the facades. It creates resizing effect context diff --git a/src/lib/elm_widget.c b/src/lib/elm_widget.c index 4e6945a..fcb9ff6 100644 --- a/src/lib/elm_widget.c +++ b/src/lib/elm_widget.c @@ -13,6 +13,9 @@ static const char ELM_WIDGET_SMART_NAME[] = "elm_widget"; if (!sd) \ return +#define ELM_WIDGET_FOCUS_GET(obj) \ + ((_elm_access_read_mode_get()) ? (elm_widget_highlight_get(obj)) : \ + (elm_widget_focus_get(obj))) typedef struct _Elm_Event_Cb_Data Elm_Event_Cb_Data; typedef struct _Elm_Translate_String_Data Elm_Translate_String_Data; @@ -244,6 +247,7 @@ _elm_widget_sub_object_add_func(Evas_Object *obj, return EINA_FALSE; } sdc->parent_obj = obj; + sdc->orient_mode = sd->orient_mode; _elm_widget_top_win_focused_set(sobj, sd->top_win_focused); /* update child focusable-ness on self and parents, now that a @@ -1831,7 +1835,15 @@ elm_widget_focus_cycle(Evas_Object *obj, return; elm_widget_focus_next_get(obj, dir, &target); if (target) - elm_widget_focus_steal(target); + { + /* access */ + if (_elm_config->access_mode && _elm_access_read_mode_get()) + { + _elm_access_highlight_set(target); + _elm_widget_focus_region_show(target); + } + else elm_widget_focus_steal(target); + } } /** @@ -2359,9 +2371,15 @@ elm_widget_focus_next_get(const Evas_Object *obj, if (!elm_widget_can_focus_get(obj)) return EINA_FALSE; + /* focusable object but does not have access info */ + if (_elm_config->access_mode) + { + if (!_elm_access_object_get(obj)) return EINA_FALSE; + } + /* Return */ *next = (Evas_Object *)obj; - return !elm_widget_focus_get(obj); + return !ELM_WIDGET_FOCUS_GET(obj); } /** @@ -2416,12 +2434,12 @@ elm_widget_focus_list_next_get(const Evas_Object *obj, const Eina_List *l = items; /* Recovery last focused sub item */ - if (elm_widget_focus_get(obj)) + if (ELM_WIDGET_FOCUS_GET(obj)) { for (; l; l = list_next(l)) { Evas_Object *cur = list_data_get(l); - if (elm_widget_focus_get(cur)) break; + if (ELM_WIDGET_FOCUS_GET(cur)) break; } /* Focused object, but no focused sub item */ @@ -2475,6 +2493,28 @@ elm_widget_focus_list_next_get(const Evas_Object *obj, return EINA_FALSE; } +EAPI Eina_Bool +elm_widget_highlight_get(const Evas_Object *obj) +{ + API_ENTRY return EINA_FALSE; + return sd->highlighted; +} + +EAPI void +elm_widget_parent_highlight_set(Evas_Object *obj, + Eina_Bool highlighted) +{ + API_ENTRY return; + + highlighted = !!highlighted; + + Evas_Object *o = elm_widget_parent_get(obj); + + if (o) elm_widget_parent_highlight_set(o, highlighted); + + sd->highlighted = highlighted; +} + EAPI void elm_widget_signal_emit(Evas_Object *obj, const char *emission, @@ -2616,6 +2656,10 @@ elm_widget_focused_object_clear(Evas_Object *obj) if (!sd->api) return; if (!sd->focused) return; + + // FIXME: evas_object_ref/unref is temporary code to fix logical issue. + // After Eo is applied to elementary, remove these. + evas_object_ref(obj); if (sd->resize_obj && elm_widget_focus_get(sd->resize_obj)) elm_widget_focused_object_clear(sd->resize_obj); else @@ -2633,6 +2677,7 @@ elm_widget_focused_object_clear(Evas_Object *obj) } sd->focused = EINA_FALSE; sd->api->on_focus(obj); + evas_object_unref(obj); } EAPI void @@ -3353,7 +3398,20 @@ elm_widget_theme_object_set(Evas_Object *obj, const char *wstyle) { API_ENTRY return EINA_FALSE; - return _elm_theme_object_set(obj, edj, wname, welement, wstyle); + char buf[128]; + int ret; + + if (!_elm_theme_object_set(obj, edj, wname, welement, wstyle)) + return EINA_FALSE; + + if (sd->orient_mode != -1) + { + + snprintf(buf, sizeof(buf), "elm,state,orient,%d", ret); + elm_widget_signal_emit(obj, buf, "elm"); + + } + return EINA_TRUE; } EAPI Eina_Bool @@ -3458,6 +3516,62 @@ elm_widget_name_find(const Evas_Object *obj, return _widget_name_find(obj, name, recurse); } +EAPI void +elm_widget_orientation_mode_disabled_set(Evas_Object *obj, Eina_Bool disabled) +{ + int orient_mode = -1; + + API_ENTRY return; + + if (disabled && (sd->orient_mode == -1)) return; + if (!disabled && (sd->orient_mode != -1)) return; + + if (!disabled) + { + //Get current orient mode from it's parent otherwise, 0. + sd->orient_mode = 0; + ELM_WIDGET_DATA_GET(sd->parent_obj, sd_parent); + if (!sd_parent) orient_mode = 0; + else orient_mode = sd_parent->orient_mode; + } + elm_widget_orientation_set(obj, orient_mode); +} + +EAPI Eina_Bool +elm_widget_orientation_mode_disabled_get(const Evas_Object *obj) +{ + Eina_Bool ret; + + API_ENTRY return EINA_FALSE; + + if (sd->orient_mode == -1) ret = EINA_TRUE; + else ret = EINA_FALSE; + return ret; +} + +EAPI void +elm_widget_orientation_set(Evas_Object *obj, int rotation) +{ + Evas_Object *child; + Eina_List *l; + + API_ENTRY return; + + if ((sd->orient_mode == rotation) || (sd->orient_mode == -1)) return; + + sd->orient_mode = rotation; + + EINA_LIST_FOREACH (sd->subobjs, l, child) + elm_widget_orientation_set(child, rotation); + + if (rotation != -1) + { + char buf[128]; + snprintf(buf, sizeof(buf), "elm,state,orient,%d", sd->orient_mode); + elm_widget_signal_emit(obj, buf, "elm"); + } +} + /** * @internal * diff --git a/src/lib/elm_widget.h b/src/lib/elm_widget.h index 55a5e73..a93c620 100644 --- a/src/lib/elm_widget.h +++ b/src/lib/elm_widget.h @@ -500,6 +500,7 @@ typedef struct _Elm_Widget_Smart_Data Evas_Object *obj); int frozen; + int orient_mode; /* -1 is disabled */ Eina_Bool drag_x_locked : 1; Eina_Bool drag_y_locked : 1; @@ -518,6 +519,8 @@ typedef struct _Elm_Widget_Smart_Data * default */ Eina_Bool still_in : 1; Eina_Bool can_access : 1; + Eina_Bool highlighted : 1; + Eina_Bool highlight_root : 1; } Elm_Widget_Smart_Data; /** @@ -554,7 +557,7 @@ struct _Elm_Access_Item { int type; const void *data; - Elm_Access_Content_Cb func; + Elm_Access_Info_Cb func; }; struct _Elm_Access_Info @@ -575,11 +578,22 @@ struct _Elm_Access_Info Evas_Object *part_object; }; +void _elm_access_shutdown(); +void _elm_access_mouse_event_enabled_set(Eina_Bool enabled); +/* elm_widget_focus_list_next_get();, elm_widget_focus_next_get(); + and elm_widget_focus_cycle(); use _elm_access_read_mode to use + focus chain */ +void _elm_access_read_mode_set(Eina_Bool enabled); +Eina_Bool _elm_access_read_mode_get(); +void _elm_access_widget_item_access_order_set(Elm_Widget_Item *item, Eina_List *objs); +const Eina_List *_elm_access_widget_item_access_order_get(const Elm_Widget_Item *item); +void _elm_access_widget_item_access_order_unset(Elm_Widget_Item *item); + EAPI void _elm_access_clear(Elm_Access_Info *ac); EAPI void _elm_access_text_set(Elm_Access_Info *ac, int type, const char *text); -EAPI void _elm_access_callback_set(Elm_Access_Info *ac, int type, Elm_Access_Content_Cb func, const void *data); -EAPI char *_elm_access_text_get(const Elm_Access_Info *ac, int type, Evas_Object *obj); /* this is ok it actually returns a strduped string - it's meant to! */ -EAPI void _elm_access_read(Elm_Access_Info *ac, int type, Evas_Object *obj); +EAPI void _elm_access_callback_set(Elm_Access_Info *ac, int type, Elm_Access_Info_Cb func, const void *data); +EAPI char *_elm_access_text_get(const Elm_Access_Info *ac, int type, const Evas_Object *obj); /* this is ok it actually returns a strduped string - it's meant to! */ +EAPI void _elm_access_read(Elm_Access_Info *ac, int type, const Evas_Object *obj); EAPI void _elm_access_say(const char *txt); EAPI Elm_Access_Info *_elm_access_object_get(const Evas_Object *obj); EAPI void _elm_access_object_hilight(Evas_Object *obj); @@ -629,6 +643,7 @@ struct _Elm_Widget_Item Elm_Widget_Disable_Cb disable_func; Evas_Object *access_obj; const char *access_info; + Eina_List *access_order; Eina_Bool disabled : 1; Eina_Bool on_deletion : 1; @@ -703,6 +718,8 @@ EAPI Evas_Display_Mode elm_widget_display_mode_get(const Evas_Object *obj); EAPI void elm_widget_display_mode_set(Evas_Object *obj, Evas_Display_Mode dispmode); EAPI const Elm_Widget_Smart_Class *elm_widget_smart_class_get(void); +EAPI Eina_Bool elm_widget_highlight_get(const Evas_Object *obj); +EAPI void elm_widget_parent_highlight_set(Evas_Object *obj, Eina_Bool highlighted); /** * @internal * @@ -771,6 +788,9 @@ EAPI Evas_Object *elm_widget_content_part_get(const Evas_Object *obj, const EAPI Evas_Object *elm_widget_content_part_unset(Evas_Object *obj, const char *part); EAPI void elm_widget_access_info_set(Evas_Object *obj, const char *txt); EAPI const char *elm_widget_access_info_get(const Evas_Object *obj); +EAPI void elm_widget_orientation_set(Evas_Object *obj, int rotation); +EAPI void elm_widget_orientation_mode_disabled_set(Evas_Object *obj, Eina_Bool disabled); +EAPI Eina_Bool elm_widget_orientation_mode_disabled_get(const Evas_Object *obj); EAPI Elm_Widget_Item *_elm_widget_item_new(Evas_Object *parent, size_t alloc_size); EAPI void _elm_widget_item_free(Elm_Widget_Item *item); EAPI Evas_Object *_elm_widget_item_widget_get(const Elm_Widget_Item *item); diff --git a/src/lib/elm_widget_ctxpopup.h b/src/lib/elm_widget_ctxpopup.h index 1e78a52..c407dea 100644 --- a/src/lib/elm_widget_ctxpopup.h +++ b/src/lib/elm_widget_ctxpopup.h @@ -137,6 +137,7 @@ struct _Elm_Ctxpopup_Smart_Data Evas_Object *parent; Evas_Object *box; + Evas_Object *layout; Evas_Object *arrow; Evas_Object *scr; Evas_Object *bg; diff --git a/src/lib/elm_widget_gengrid.h b/src/lib/elm_widget_gengrid.h index dc0b64b..191601d 100644 --- a/src/lib/elm_widget_gengrid.h +++ b/src/lib/elm_widget_gengrid.h @@ -5,6 +5,8 @@ #include "elm_interface_scrollable.h" #include "elm_widget_layout.h" +#define GENGRID_FX_SUPPORT 1 + /** * @addtogroup Widget * @{ @@ -176,6 +178,14 @@ struct _Elm_Gengrid_Smart_Data long items_lost; double align_x, align_y; +#if GENGRID_FX_SUPPORT + Evas_Object *alpha_bg; + Eina_List *fx_items; + Eina_List *capture_before_items, *capture_after_items; + Eina_List *pending_del_items, *pending_unrealized_items; + Elm_Gen_Item *realized_top_item; +#endif + Eina_Bool reorder_item_changed : 1; Eina_Bool move_effect_enabled : 1; @@ -210,6 +220,15 @@ struct _Elm_Gengrid_Smart_Data * selection */ Eina_Bool show_region : 1; Eina_Bool bring_in : 1; + +#if GENGRID_FX_SUPPORT + Eina_Bool fx_mode : 1; + Eina_Bool fx_first_captured : 1; + Eina_Bool fx_playing : 1; + Eina_Bool rendered : 1; + Eina_Bool fx_items_deleted : 1; + Eina_Bool gengrid_clearing : 1; +#endif }; struct Elm_Gen_Item_Type @@ -222,7 +241,12 @@ struct Elm_Gen_Item_Type Evas_Coord gx, gy, ox, oy, tx, ty, rx, ry; unsigned int moving_effect_start_time; int prev_group; - +#if GENGRID_FX_SUPPORT + Evas_Coord scrl_x, scrl_y, w, h; + Elm_Gen_FX_Item *fi; + int num; + Eina_Bool has_proxy_it : 1; +#endif Eina_Bool group_realized : 1; Eina_Bool moving : 1; }; diff --git a/src/lib/elm_widget_genlist.h b/src/lib/elm_widget_genlist.h index ca12aa1..887799e 100644 --- a/src/lib/elm_widget_genlist.h +++ b/src/lib/elm_widget_genlist.h @@ -7,6 +7,8 @@ // FIXME: Difference from upstream #define GENLIST_ENTRY_SUPPORT 1 +#define GENLIST_FX_SUPPORT 1 +#define GENLIST_PINCH_ZOOM_SUPPORT 1 /** * @addtogroup Widget @@ -125,13 +127,6 @@ typedef struct _Elm_Genlist_Smart_Class */ typedef struct _Elm_Genlist_Smart_Data Elm_Genlist_Smart_Data; -typedef enum -{ - ELM_GENLIST_TREE_EFFECT_NONE = 0, - ELM_GENLIST_TREE_EFFECT_EXPAND = 1, - ELM_GENLIST_TREE_EFFECT_CONTRACT = 2 -} Elm_Genlist_Item_Move_Effect_Mode; - struct _Elm_Genlist_Smart_Data { Elm_Layout_Smart_Data base; /* base widget smart data as @@ -227,13 +222,17 @@ struct _Elm_Genlist_Smart_Data * event when tree * effect is not * finished */ - Eina_List *move_items; /* items move for - * tree effect */ Elm_Gen_Item *expanded_next_item; - Ecore_Animator *tree_effect_animator; - Elm_Genlist_Item_Move_Effect_Mode move_effect_mode; + int reorder_fast; + +#if GENLIST_FX_SUPPORT + Eina_List *fx_items; + Eina_List *capture_before_items, *capture_after_items; + Eina_List *pending_del_items, *pending_unrealized_items; + Eina_List *pending_unrealized_decorate_all_items; + Elm_Gen_Item *realized_top_item; +#endif - Eina_Bool tree_effect_enabled : 1; Eina_Bool auto_scroll_enabled : 1; Eina_Bool decorate_all_mode : 1; Eina_Bool height_for_width : 1; @@ -279,10 +278,22 @@ struct _Elm_Genlist_Smart_Data * selection */ Eina_Bool swipe : 1; - int reorder_fast; #if GENLIST_ENTRY_SUPPORT Eina_Bool size_changed : 1; #endif + +#if GENLIST_FX_SUPPORT + Eina_Bool fx_mode : 1; + Eina_Bool fx_first_captured : 1; + Eina_Bool fx_playing : 1; + Eina_Bool rendered : 1; + Eina_Bool fx_items_deleted : 1; + Eina_Bool genlist_clearing : 1; +#endif +#if GENLIST_PINCH_ZOOM_SUPPORT + Elm_Gen_Pinch_Zoom_Mode pinch_zoom_mode; + Evas_Coord pinch_pan_y, pinch_zoom_h; +#endif }; typedef struct _Item_Block Item_Block; @@ -310,14 +321,18 @@ struct Elm_Gen_Item_Type Elm_Gen_Item *rel; Eina_List *rel_revs; // FIXME: find better way not to use this Evas_Object *deco_it_view; +#if GENLIST_FX_SUPPORT + Elm_Gen_FX_Item *fi; + int num; +#endif +#if GENLIST_PINCH_ZOOM_SUPPORT + Evas_Coord pan_scrl_y; +#endif int expanded_depth; int order_num_in; Eina_Bool decorate_all_item_realized : 1; - Eina_Bool tree_effect_finished : 1; /* tree effect */ Eina_Bool move_effect_enabled : 1; - Eina_Bool tree_effect_hide_me : 1; /* item hide for - * tree effect */ Eina_Bool stacking_even : 1; Eina_Bool want_realize : 1; @@ -333,6 +348,9 @@ struct Elm_Gen_Item_Type Eina_Bool show_me : 1; /* if item is realized once, it is not unrealized & realized again. */ Eina_Bool unrealize_disabled: 1; +#if GENLIST_FX_SUPPORT + Eina_Bool has_proxy_it : 1; +#endif }; struct _Item_Block diff --git a/src/lib/elm_widget_index.h b/src/lib/elm_widget_index.h index d9d0cba..6250555 100644 --- a/src/lib/elm_widget_index.h +++ b/src/lib/elm_widget_index.h @@ -128,17 +128,20 @@ struct _Elm_Index_Smart_Data Eina_List *items; /* 1 list. N levels, but only 2 * for now and # of items will be * small */ + Eina_List *omit; + int level; Evas_Coord dx, dy; Ecore_Timer *delay; + double delay_change_time; Eina_Bool level_active[2]; Eina_Bool down : 1; Eina_Bool horizontal : 1; Eina_Bool autohide_disabled : 1; Eina_Bool indicator_disabled : 1; - - Eina_List *omit; + Eina_Bool omit_enabled : 1; + Eina_Bool index_focus : 1; }; typedef struct _Elm_Index_Item Elm_Index_Item; @@ -150,10 +153,10 @@ struct _Elm_Index_Item int level; Evas_Smart_Cb func; - Eina_Bool selected : 1; - Eina_List *omitted; - Elm_Index_Item *head; + Elm_Index_Item *head; + + Eina_Bool selected : 1; }; typedef struct _Elm_Index_Omit Elm_Index_Omit; diff --git a/src/lib/elm_widget_map.h b/src/lib/elm_widget_map.h index d80df45..7f40e57 100644 --- a/src/lib/elm_widget_map.h +++ b/src/lib/elm_widget_map.h @@ -648,6 +648,8 @@ struct _Elm_Map_Smart_Data { unsigned int st; int x, y; + double perspect; + double perspect_y; } pinch_pan; Eina_List *routes; diff --git a/src/lib/elm_widget_multibuttonentry.h b/src/lib/elm_widget_multibuttonentry.h index e8ca571..7294410 100644 --- a/src/lib/elm_widget_multibuttonentry.h +++ b/src/lib/elm_widget_multibuttonentry.h @@ -141,7 +141,7 @@ typedef struct _Elm_Multibuttonentry_Smart_Data Evas_Object *entry; Evas_Object *label; Evas_Object *guide; - Evas_Object *number; + Evas_Object *end; Evas_Coord boxh; Evas_Coord boxw; @@ -154,6 +154,9 @@ typedef struct _Elm_Multibuttonentry_Smart_Data Eina_Bool editable : 1; Eina_Bool expanded : 1; Eina_Bool expanded_state : 1; + Eina_Bool long_pressed : 1; + + Ecore_Timer *longpress_timer; } Elm_Multibuttonentry_Smart_Data; /** diff --git a/src/lib/elm_widget_naviframe.h b/src/lib/elm_widget_naviframe.h index 4b753e7..9e85773 100644 --- a/src/lib/elm_widget_naviframe.h +++ b/src/lib/elm_widget_naviframe.h @@ -126,7 +126,6 @@ struct _Elm_Naviframe_Smart_Data Eina_List *popping; Evas_Object *dummy_edje; Evas_Display_Mode dispmode; - Elm_Object_Item *compress_it; Eina_Bool preserve : 1; Eina_Bool on_deletion : 1; @@ -147,6 +146,9 @@ struct _Elm_Naviframe_Item Evas_Object *title_next_btn; Evas_Object *title_icon; Ecore_Animator *animator; + Evas_Display_Mode dispmode; + Elm_Naviframe_Item_Pop_Cb pop_cb; + void *pop_data; const char *style; const char *title_label; const char *subtitle_label; diff --git a/src/lib/elm_widget_popup.h b/src/lib/elm_widget_popup.h index 42096bc..71ad2fa 100644 --- a/src/lib/elm_widget_popup.h +++ b/src/lib/elm_widget_popup.h @@ -129,7 +129,6 @@ struct _Elm_Popup_Smart_Data Evas_Object *notify; Evas_Object *title_icon; - Evas_Object *title_access_obj; Evas_Object *content_area; Evas_Object *text_content_obj; Evas_Object *action_area; diff --git a/src/lib/elm_widget_toolbar.h b/src/lib/elm_widget_toolbar.h index 893719b..34e4024 100644 --- a/src/lib/elm_widget_toolbar.h +++ b/src/lib/elm_widget_toolbar.h @@ -134,7 +134,7 @@ struct _Elm_Toolbar_Smart_Data Evas_Object *menu_parent; Eina_Inlist *items; Elm_Toolbar_Item *more_item, *selected_item; - Elm_Toolbar_Item *reorder_from, *reorder_to; + Elm_Toolbar_Item *reorder_empty, *reorder_item; Elm_Toolbar_Shrink_Mode shrink_mode; Elm_Icon_Lookup_Order lookup_order; int theme_icon_size, priv_icon_size, @@ -166,7 +166,10 @@ struct _Elm_Toolbar_Item Evas_Object *object; Evas_Object *o_menu; Evas_Object *in_box; + Evas_Object *proxy; Evas_Smart_Cb func; + Elm_Transit *trans; + Elm_Toolbar_Item *reorder_to; struct { int priority; @@ -179,6 +182,7 @@ struct _Elm_Toolbar_Item Eina_Bool separator : 1; Eina_Bool selected : 1; Eina_Bool menu : 1; + Eina_Bool on_move : 1; }; struct _Elm_Toolbar_Item_State diff --git a/src/lib/elm_win.c b/src/lib/elm_win.c old mode 100644 new mode 100755 index 9fc6f73..bc03612 --- a/src/lib/elm_win.c +++ b/src/lib/elm_win.c @@ -43,6 +43,7 @@ static const Elm_Win_Trap *trap = NULL; #define ENGINE_GET() (_elm_preferred_engine ? _elm_preferred_engine : (_elm_config->engine ? _elm_config->engine : "")) #define ENGINE_COMPARE(name) (!strcmp(ENGINE_GET(), name)) +#define EE_ENGINE_COMPARE(ee, name) (!strcmp(ecore_evas_engine_name_get(ee), name)) typedef struct _Elm_Win_Smart_Data Elm_Win_Smart_Data; @@ -81,6 +82,7 @@ struct _Elm_Win_Smart_Data Elm_Win_Keyboard_Mode kbdmode; Elm_Win_Indicator_Mode indmode; Elm_Win_Indicator_Opacity_Mode ind_o_mode; + Elm_Win_Indicator_Type_Mode ind_t_mode; struct { const char *info; @@ -207,26 +209,6 @@ static Eina_Bool _elm_win_auto_throttled = EINA_FALSE; static Ecore_Job *_elm_win_state_eval_job = NULL; static void -_elm_win_obj_intercept_move(void *data, Evas_Object *obj, Evas_Coord x, Evas_Coord y) -{ - Elm_Win_Smart_Data *sd = data; - - if (sd->img_obj) - { - if ((x != sd->screen.x) || (y != sd->screen.y)) - { - sd->screen.x = x; - sd->screen.y = y; - evas_object_smart_callback_call(obj, SIG_MOVED, NULL); - } - } - else - { - evas_object_move(obj, x, y); - } -} - -static void _elm_win_obj_intercept_show(void *data, Evas_Object *obj) { Elm_Win_Smart_Data *sd = data; @@ -580,7 +562,7 @@ _elm_win_obj_intercept_layer_set(void *data, Evas_Object *obj __UNUSED__, int l) TRAP(sd, layer_set, l); } - static void +static void _ecore_evas_move_(void *data, Evas_Object *obj __UNUSED__, int a, int b) { printf("[%s][%d] a=%d, b=%d\n", __FUNCTION__, __LINE__, a, b); @@ -588,7 +570,6 @@ _ecore_evas_move_(void *data, Evas_Object *obj __UNUSED__, int a, int b) TRAP(sd, move, a, b); } - /* Event Callbacks */ static void @@ -722,18 +703,18 @@ _elm_win_focus_highlight_anim_setup(Elm_Win_Smart_Data *sd, evas_object_geometry_get(ELM_WIDGET_DATA(sd)->obj, NULL, NULL, &w, &h); evas_object_geometry_get(target, &tx, &ty, &tw, &th); evas_object_geometry_get(previous, &px, &py, &pw, &ph); - evas_object_move(obj, 0, 0); + evas_object_move(obj, tx, ty); evas_object_resize(obj, tw, th); evas_object_clip_unset(obj); m = alloca(sizeof(*m) + (sizeof(int) * 8)); m->count = 8; - m->val[0] = px; - m->val[1] = py; + m->val[0] = px - tx; + m->val[1] = py - ty; m->val[2] = pw; m->val[3] = ph; - m->val[4] = tx; - m->val[5] = ty; + m->val[4] = 0; + m->val[5] = 0; m->val[6] = tw; m->val[7] = th; edje_object_message_send(obj, EDJE_MESSAGE_INT_SET, 1, m); @@ -895,6 +876,9 @@ _elm_win_focus_out(Ecore_Evas *ee) edje_object_signal_emit(sd->frame_obj, "elm,action,unfocus", "elm"); } + /* access */ + _elm_access_object_hilight_disable(evas_object_evas_get(obj)); + /* do nothing */ /* if (sd->img_obj) */ /* { */ @@ -1418,9 +1402,81 @@ _elm_win_on_img_obj_del(void *data, } static void +_elm_win_resize_objects_eval(Evas_Object *obj) +{ + const Eina_List *l; + const Evas_Object *child; + + ELM_WIN_DATA_GET(obj, sd); + Evas_Coord w, h, minw = -1, minh = -1, maxw = -1, maxh = -1; + int xx = 1, xy = 1; + double wx, wy; + + EINA_LIST_FOREACH(sd->resize_objs, l, child) + { + evas_object_size_hint_weight_get(child, &wx, &wy); + if (wx == 0.0) xx = 0; + if (wy == 0.0) xy = 0; + + evas_object_size_hint_min_get(child, &w, &h); + if (w < 1) w = 1; + if (h < 1) h = 1; + if (w > minw) minw = w; + if (h > minh) minh = h; + + evas_object_size_hint_max_get(child, &w, &h); + if (w < 1) w = -1; + if (h < 1) h = -1; + if (maxw == -1) maxw = w; + else if ((w > 0) && (w < maxw)) + maxw = w; + if (maxh == -1) maxh = h; + else if ((h > 0) && (h < maxh)) + maxh = h; + } + if (!xx) maxw = minw; + else maxw = 32767; + if (!xy) maxh = minh; + else maxh = 32767; + evas_object_size_hint_min_set(obj, minw, minh); + evas_object_size_hint_max_set(obj, maxw, maxh); + evas_object_geometry_get(obj, NULL, NULL, &w, &h); + if (w < minw) w = minw; + if (h < minh) h = minh; + if ((maxw >= 0) && (w > maxw)) w = maxw; + if ((maxh >= 0) && (h > maxh)) h = maxh; + evas_object_resize(obj, w, h); +} + +static void +_elm_win_on_resize_obj_del(void *data, + Evas *e __UNUSED__, + Evas_Object *obj __UNUSED__, + void *event_info __UNUSED__) +{ + ELM_WIN_DATA_GET(data, sd); + + sd->resize_objs = eina_list_remove(sd->resize_objs, obj); + + _elm_win_resize_objects_eval(data); +} + +static void +_elm_win_on_resize_obj_changed_size_hints(void *data, + Evas *e __UNUSED__, + Evas_Object *obj __UNUSED__, + void *event_info __UNUSED__) +{ + _elm_win_resize_objects_eval(data); +} + +static void _elm_win_smart_del(Evas_Object *obj) { const char *str; + const Eina_List *l; + const Evas_Object *child; + ELM_WIN_DATA_GET(obj, sd); /* NB: child deletion handled by parent's smart del */ @@ -1435,6 +1491,15 @@ _elm_win_smart_del(Evas_Object *obj) sd->parent = NULL; } + EINA_LIST_FOREACH(sd->resize_objs, l, child) + { + evas_object_event_callback_del_full + (child, EVAS_CALLBACK_CHANGED_SIZE_HINTS, + _elm_win_on_resize_obj_changed_size_hints, obj); + evas_object_event_callback_del_full + (child, EVAS_CALLBACK_DEL, _elm_win_on_resize_obj_del, obj); + } + if (sd->autodel_clear) *(sd->autodel_clear) = -1; _elm_win_list = eina_list_remove(_elm_win_list, obj); @@ -1607,31 +1672,31 @@ _elm_ee_xwin_get(const Ecore_Evas *ee) Ecore_X_Window xwin = 0; if (!ee) return 0; - if (ENGINE_COMPARE(ELM_SOFTWARE_X11)) + if (EE_ENGINE_COMPARE(ee, ELM_SOFTWARE_X11)) { if (ee) xwin = ecore_evas_software_x11_window_get(ee); } - else if (ENGINE_COMPARE(ELM_SOFTWARE_FB) || - ENGINE_COMPARE(ELM_SOFTWARE_16_WINCE) || - ENGINE_COMPARE(ELM_SOFTWARE_SDL) || - ENGINE_COMPARE(ELM_SOFTWARE_16_SDL) || - ENGINE_COMPARE(ELM_OPENGL_SDL) || - ENGINE_COMPARE(ELM_OPENGL_COCOA)) + else if (EE_ENGINE_COMPARE(ee, ELM_SOFTWARE_FB) || + EE_ENGINE_COMPARE(ee, ELM_SOFTWARE_16_WINCE) || + EE_ENGINE_COMPARE(ee, ELM_SOFTWARE_SDL) || + EE_ENGINE_COMPARE(ee, ELM_SOFTWARE_16_SDL) || + EE_ENGINE_COMPARE(ee, ELM_OPENGL_SDL) || + EE_ENGINE_COMPARE(ee, ELM_OPENGL_COCOA)) { } - else if (ENGINE_COMPARE(ELM_SOFTWARE_16_X11)) + else if (EE_ENGINE_COMPARE(ee, ELM_SOFTWARE_16_X11)) { if (ee) xwin = ecore_evas_software_x11_16_window_get(ee); } - else if (ENGINE_COMPARE(ELM_SOFTWARE_8_X11)) + else if (EE_ENGINE_COMPARE(ee, ELM_SOFTWARE_8_X11)) { if (ee) xwin = ecore_evas_software_x11_8_window_get(ee); } - else if (ENGINE_COMPARE(ELM_OPENGL_X11)) + else if (EE_ENGINE_COMPARE(ee, ELM_OPENGL_X11)) { if (ee) xwin = ecore_evas_gl_x11_window_get(ee); } - else if (ENGINE_COMPARE(ELM_SOFTWARE_WIN32)) + else if (EE_ENGINE_COMPARE(ee, ELM_SOFTWARE_WIN32)) { if (ee) xwin = (long)ecore_evas_win32_window_get(ee); } @@ -1799,74 +1864,6 @@ _elm_win_xwin_update(Elm_Win_Smart_Data *sd) #endif -static void -_elm_win_resize_objects_eval(Evas_Object *obj) -{ - const Eina_List *l; - const Evas_Object *child; - - ELM_WIN_DATA_GET(obj, sd); - Evas_Coord w, h, minw = -1, minh = -1, maxw = -1, maxh = -1; - int xx = 1, xy = 1; - double wx, wy; - - EINA_LIST_FOREACH(sd->resize_objs, l, child) - { - evas_object_size_hint_weight_get(child, &wx, &wy); - if (wx == 0.0) xx = 0; - if (wy == 0.0) xy = 0; - - evas_object_size_hint_min_get(child, &w, &h); - if (w < 1) w = 1; - if (h < 1) h = 1; - if (w > minw) minw = w; - if (h > minh) minh = h; - - evas_object_size_hint_max_get(child, &w, &h); - if (w < 1) w = -1; - if (h < 1) h = -1; - if (maxw == -1) maxw = w; - else if ((w > 0) && (w < maxw)) - maxw = w; - if (maxh == -1) maxh = h; - else if ((h > 0) && (h < maxh)) - maxh = h; - } - if (!xx) maxw = minw; - else maxw = 32767; - if (!xy) maxh = minh; - else maxh = 32767; - evas_object_size_hint_min_set(obj, minw, minh); - evas_object_size_hint_max_set(obj, maxw, maxh); - evas_object_geometry_get(obj, NULL, NULL, &w, &h); - if (w < minw) w = minw; - if (h < minh) h = minh; - if ((maxw >= 0) && (w > maxw)) w = maxw; - if ((maxh >= 0) && (h > maxh)) h = maxh; - evas_object_resize(obj, w, h); -} - -static void -_elm_win_on_resize_obj_del(void *data, - Evas *e __UNUSED__, - Evas_Object *obj __UNUSED__, - void *event_info __UNUSED__) -{ - ELM_WIN_DATA_GET(data, sd); - - sd->resize_objs = eina_list_remove(sd->resize_objs, obj); - - _elm_win_resize_objects_eval(data); -} - -static void -_elm_win_on_resize_obj_changed_size_hints(void *data, - Evas *e __UNUSED__, - Evas_Object *obj __UNUSED__, - void *event_info __UNUSED__) -{ - _elm_win_resize_objects_eval(data); -} void _elm_win_shutdown(void) @@ -1981,8 +1978,17 @@ _elm_win_client_message(void *data, ECORE_X_ATOM_E_ILLUME_ACCESS_ACTION_READ) { /* there would be better way to read highlight object */ - ecore_x_mouse_in_send(sd->x.xwin, e->data.l[2], e->data.l[3]); - ecore_x_mouse_move_send(sd->x.xwin, e->data.l[2], e->data.l[3]); + Evas *evas; + evas = evas_object_evas_get(ELM_WIDGET_DATA(sd)->obj); + if (!evas) return ECORE_CALLBACK_PASS_ON; + + _elm_access_mouse_event_enabled_set(EINA_TRUE); + + evas_event_feed_mouse_in(evas, 0, NULL); + evas_event_feed_mouse_move + (evas, e->data.l[2], e->data.l[3], 0, NULL); + + _elm_access_mouse_event_enabled_set(EINA_FALSE); } else if ((unsigned int)e->data.l[1] == ECORE_X_ATOM_E_ILLUME_ACCESS_ACTION_READ_NEXT) @@ -2611,6 +2617,7 @@ elm_win_add(Evas_Object *parent, opt_i++; opt[opt_i] = 1; opt_i++; + opt[opt_i] = 0; } if (opt_i > 0) tmp_sd.ee = ecore_evas_gl_x11_options_new @@ -2830,11 +2837,11 @@ elm_win_add(Evas_Object *parent, (obj, _elm_win_obj_intercept_stack_below, sd); evas_object_intercept_layer_set_callback_add (obj, _elm_win_obj_intercept_layer_set, sd); -// evas_object_intercept_show_callback_add -// (obj, _elm_win_obj_intercept_show, sd); + evas_object_intercept_show_callback_add + (obj, _elm_win_obj_intercept_show, sd); + evas_object_intercept_move_callback_add + (obj, _ecore_evas_move_, sd); - evas_object_intercept_move_callback_add(obj, - _ecore_evas_move_, sd); TRAP(sd, name_class_set, name, _elm_appname); ecore_evas_callback_delete_request_set(sd->ee, _elm_win_delete_request); ecore_evas_callback_resize_set(sd->ee, _elm_win_resize); @@ -3660,47 +3667,52 @@ elm_win_render(Evas_Object *obj) ecore_evas_manual_render(sd->ee); } -EAPI void -elm_win_rotation_set(Evas_Object *obj, - int rotation) +static int +_win_rotation_degree_check(int rotation) { - ELM_WIN_CHECK(obj); - ELM_WIN_DATA_GET_OR_RETURN(obj, sd); + if ((rotation > 360) || (rotation < 0)) + { + WRN("Rotation degree should be 0 ~ 360 (passed degree: %d)", rotation); + rotation %= 360; + if (rotation < 0) rotation += 360; + } + return rotation; +} - rotation %= 360; - if (rotation < 0) rotation += 360; +static void +_win_rotate(Evas_Object *obj, Elm_Win_Smart_Data *sd, int rotation, Eina_Bool resize) +{ + rotation = _win_rotation_degree_check(rotation); if (sd->rot == rotation) return; sd->rot = rotation; - TRAP(sd, rotation_set, rotation); + if (resize) TRAP(sd, rotation_with_resize_set, rotation); + else TRAP(sd, rotation_set, rotation); evas_object_size_hint_min_set(obj, -1, -1); evas_object_size_hint_max_set(obj, -1, -1); _elm_win_resize_objects_eval(obj); #ifdef HAVE_ELEMENTARY_X _elm_win_xwin_update(sd); #endif + elm_widget_orientation_set(obj, rotation); evas_object_smart_callback_call(obj, SIG_ROTATION_CHANGED, NULL); } EAPI void +elm_win_rotation_set(Evas_Object *obj, + int rotation) +{ + ELM_WIN_CHECK(obj); + ELM_WIN_DATA_GET_OR_RETURN(obj, sd); + _win_rotate(obj, sd, rotation, EINA_FALSE); +} + +EAPI void elm_win_rotation_with_resize_set(Evas_Object *obj, int rotation) { ELM_WIN_CHECK(obj); ELM_WIN_DATA_GET_OR_RETURN(obj, sd); - - rotation %= 360; - if (rotation < 0) rotation += 360; - if (sd->rot == rotation) return; - sd->rot = rotation; - TRAP(sd, rotation_with_resize_set, rotation); - evas_object_size_hint_min_set(obj, -1, -1); - evas_object_size_hint_max_set(obj, -1, -1); - _elm_win_resize_objects_eval(obj); - -#ifdef HAVE_ELEMENTARY_X - _elm_win_xwin_update(sd); -#endif - evas_object_smart_callback_call(obj, SIG_ROTATION_CHANGED, NULL); + _win_rotate(obj, sd, rotation, EINA_TRUE); } EAPI int @@ -3865,6 +3877,38 @@ elm_win_indicator_opacity_get(const Evas_Object *obj) } EAPI void +elm_win_indicator_type_set(Evas_Object *obj, + Elm_Win_Indicator_Type_Mode mode) +{ + ELM_WIN_CHECK(obj); + ELM_WIN_DATA_GET_OR_RETURN(obj, sd); + + if (mode == sd->ind_t_mode) return; + sd->ind_t_mode = mode; +#ifdef HAVE_ELEMENTARY_X + _elm_win_xwindow_get(sd); + if (sd->x.xwin) + { + if (sd->ind_t_mode == ELM_WIN_INDICATOR_TYPE_1) + ecore_x_e_illume_indicator_type_set + (sd->x.xwin, ECORE_X_ILLUME_INDICATOR_TYPE_1); + else if (sd->ind_t_mode == ELM_WIN_INDICATOR_TYPE_2) + ecore_x_e_illume_indicator_type_set + (sd->x.xwin, ECORE_X_ILLUME_INDICATOR_TYPE_2); + } +#endif + //evas_object_smart_callback_call(obj, SIG_INDICATOR_PROP_CHANGED, NULL); +} + +EAPI Elm_Win_Indicator_Type_Mode +elm_win_indicator_type_get(const Evas_Object *obj) +{ + ELM_WIN_CHECK(obj) ELM_WIN_INDICATOR_TYPE_UNKNOWN; + ELM_WIN_DATA_GET_OR_RETURN_VAL(obj, sd, ELM_WIN_INDICATOR_TYPE_UNKNOWN); + + return sd->ind_t_mode; +} +EAPI void elm_win_screen_position_get(const Evas_Object *obj, int *x, int *y) diff --git a/src/lib/elm_win.h b/src/lib/elm_win.h index 999b72f..45ab03e 100644 --- a/src/lib/elm_win.h +++ b/src/lib/elm_win.h @@ -210,6 +210,19 @@ typedef enum } Elm_Win_Indicator_Opacity_Mode; /** + * Defines the type modes of indicator that can be shown + * If the indicator can support several type of indicator, + * you can use this enum value to deal with different type of indicator + */ + +typedef enum +{ + ELM_WIN_INDICATOR_TYPE_UNKNOWN, /**< Unknown indicator type mode */ + ELM_WIN_INDICATOR_TYPE_1, /**< Type 0 the the indicator */ + ELM_WIN_INDICATOR_TYPE_2, /**< Type 1 the indicator */ +} Elm_Win_Indicator_Type_Mode; + +/** * Available commands that can be sent to the Illume manager. * * When running under an Illume session, a window may send commands to the @@ -1391,6 +1404,26 @@ EAPI void elm_win_indicator_opacity_set(Evas_Object *obj, Elm_W EAPI Elm_Win_Indicator_Opacity_Mode elm_win_indicator_opacity_get(const Evas_Object *obj); /** + * Sets the indicator type mode of the window. + * + * @param obj The window object + * @param mode The mode to set, one of #Elm_Win_Indicator_Type_Mode + * + * @ingroup Win + */ +EAPI void elm_win_indicator_type_set(Evas_Object *obj, Elm_Win_Indicator_Type_Mode mode); + +/** + * Gets the indicator type mode of the window. + * + * @param obj The window object + * @return The mode, one of #Elm_Win_Indicator_Type_Mode + * + * @ingroup Win + */ +EAPI Elm_Win_Indicator_Type_Mode elm_win_indicator_type_get(const Evas_Object *obj); + +/** * Get the screen position of a window. * * @param obj The window object diff --git a/src/lib/els_cursor.c b/src/lib/els_cursor.c index c44b342..25e746f 100644 --- a/src/lib/els_cursor.c +++ b/src/lib/els_cursor.c @@ -175,7 +175,7 @@ _elm_cursor_obj_add(Evas_Object *obj, Elm_Cursor *cur) return EINA_FALSE; if (!_elm_theme_object_set(obj, cur->obj, "cursor", cur->cursor_name, - cur->style ? cur->style : "default")) + cur->style ? cur->style : "default")) { evas_object_del(cur->obj); cur->obj = NULL; @@ -502,7 +502,7 @@ elm_cursor_theme(Elm_Cursor *cur) { if ((!cur) || (!cur->obj)) return; if (!_elm_theme_object_set(cur->eventarea, cur->obj, "cursor", - cur->cursor_name, cur->style)) + cur->cursor_name, cur->style)) ERR("Could not apply the theme to the cursor style=%s", cur->style); else _elm_cursor_set_hot_spots(cur); diff --git a/src/lib/els_scroller.c b/src/lib/els_scroller.c index 589cf4f..b590ea5 100644 --- a/src/lib/els_scroller.c +++ b/src/lib/els_scroller.c @@ -9,152 +9,6 @@ typedef struct _Smart_Data Smart_Data; #define EVTIME 1 -//#define SCROLLDBG 1 - -/* smoothness debug calls - for debugging how much smooth your app is */ -#define SMOOTHDBG 1 - -#ifdef SMOOTHDBG -#define SMOOTH_DEBUG_COUNT 100 -#define FPS 1/60 -typedef struct _smooth_debug_info smooth_debug_info; -struct _smooth_debug_info -{ - double t; - double dt; - Evas_Coord pos; - Evas_Coord dpos; - double vpos; -}; - -static smooth_debug_info smooth_x_history[SMOOTH_DEBUG_COUNT]; -static smooth_debug_info smooth_y_history[SMOOTH_DEBUG_COUNT]; -static int smooth_info_x_count = 0; -static int smooth_info_y_count = 0; -static double start_time = 0; -static int _els_scroller_smooth_debug = 0; - -void -_els_scroller_smooth_debug_init(void) -{ - start_time = ecore_time_get(); - smooth_info_x_count = 0; - smooth_info_y_count = 0; - - memset(&(smooth_x_history[0]), 0, sizeof(smooth_x_history[0]) * SMOOTH_DEBUG_COUNT); - memset(&(smooth_y_history[0]), 0, sizeof(smooth_y_history[0]) * SMOOTH_DEBUG_COUNT); - - return; -} - -void -_els_scroller_smooth_debug_shutdown(void) -{ - int i = 0; - int info_x_count = 0; - int info_y_count = 0; - double x_ave = 0, y_ave = 0; - double x_sum = 0, y_sum = 0; - double x_dev = 0, y_dev = 0; - double x_dev_sum = 0, y_dev_sum = 0; - - if (smooth_info_x_count >= SMOOTH_DEBUG_COUNT) - info_x_count = SMOOTH_DEBUG_COUNT; - else - info_x_count = smooth_info_x_count; - - if (smooth_info_y_count >= SMOOTH_DEBUG_COUNT) - info_y_count = SMOOTH_DEBUG_COUNT; - else - info_y_count = smooth_info_y_count; - - printf("\n\n<<< X-axis Smoothness >>>\n"); - printf("| Num | t(time) | dt | x | dx |vx(dx/1fps) |\n"); - - for (i = info_x_count -1; i >= 0; i--) - { - printf("| %4d | %1.6f | %1.6f | %4d | %4d | %9.3f |\n",info_x_count - i, - smooth_x_history[i].t, - smooth_x_history[i].dt, - smooth_x_history[i].pos, - smooth_x_history[i].dpos, - smooth_x_history[i].vpos); - if (i == info_x_count -1) continue; - x_sum += smooth_x_history[i].vpos; - } - x_ave = x_sum / (info_x_count - 1); - for (i = 0; i < info_x_count -1; i++) - { - x_dev_sum += (smooth_x_history[i].vpos - x_ave) * (smooth_x_history[i].vpos - x_ave); - } - x_dev = x_dev_sum / (info_x_count -1); - printf(" Standard deviation of X-axis velocity: %9.3f\n", sqrt(x_dev)); - - printf("\n\n<<< Y-axis Smoothness >>>\n"); - printf("| Num | t(time) | dt | y | dy |vy(dy/1fps) |\n"); - for (i = info_y_count -1; i >= 0; i--) - { - printf("| %4d | %1.6f | %1.6f | %4d | %4d | %9.3f |\n", info_y_count - i, - smooth_y_history[i].t, - smooth_y_history[i].dt, - smooth_y_history[i].pos, - smooth_y_history[i].dpos, - smooth_y_history[i].vpos); - if (i == info_y_count -1) continue; - y_sum += smooth_y_history[i].vpos; - } - y_ave = y_sum / (info_y_count - 1); - for (i = 0; i < info_y_count -1; i++) - { - y_dev_sum += (smooth_y_history[i].vpos - y_ave) * (smooth_y_history[i].vpos - y_ave); - } - y_dev = y_dev_sum / (info_y_count -1); - printf(" Standard deviation of Y-axis velocity: %9.3f\n", sqrt(y_dev)); -} - -void -_els_scroller_smooth_debug_movetime_add(int x, int y) -{ - double tim = 0; - static int bx = 0; - static int by = 0; - - tim = ecore_time_get(); - - if (bx != x) - { - smooth_info_x_count++; - memmove(&(smooth_x_history[1]), &(smooth_x_history[0]), sizeof(smooth_x_history[0]) * (SMOOTH_DEBUG_COUNT - 1)); - smooth_x_history[0].t = tim - start_time; - smooth_x_history[0].dt = smooth_x_history[0].t - smooth_x_history[1].t; - smooth_x_history[0].pos = x; - smooth_x_history[0].dpos = smooth_x_history[0].pos - smooth_x_history[1].pos; - - if (smooth_x_history[0].dpos >= 0) - smooth_x_history[0].vpos = (double)(smooth_x_history[0].dpos) / smooth_x_history[0].dt * FPS; - else - smooth_x_history[0].vpos = -((double)(smooth_x_history[0].dpos) / smooth_x_history[0].dt * FPS); - } - - if (by != y) - { - smooth_info_y_count++; - memmove(&(smooth_y_history[1]), &(smooth_y_history[0]), sizeof(smooth_y_history[0]) * (SMOOTH_DEBUG_COUNT - 1)); - smooth_y_history[0].t = tim - start_time; - smooth_y_history[0].dt = smooth_y_history[0].t - smooth_y_history[1].t; - smooth_y_history[0].pos = y; - smooth_y_history[0].dpos = smooth_y_history[0].pos - smooth_y_history[1].pos; - - if (smooth_y_history[0].dpos >= 0) - smooth_y_history[0].vpos = (double)(smooth_y_history[0].dpos) / smooth_y_history[0].dt * FPS; - else - smooth_y_history[0].vpos = -((double)(smooth_y_history[0].dpos) / smooth_y_history[0].dt * FPS); - } - - bx = x; - by = y; -} -#endif struct _Smart_Data { @@ -1923,11 +1777,6 @@ _smart_event_mouse_down(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSE sd = data; ev = event_info; -#ifdef SMOOTHDBG - if (getenv("ELS_SCROLLER_SMOOTH_DEBUG")) _els_scroller_smooth_debug = 1; - if (_els_scroller_smooth_debug) _els_scroller_smooth_debug_init(); -#endif - // if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return ; if (_elm_config->thumbscroll_enable) { @@ -2084,11 +1933,6 @@ _smart_hold_animator(void *data) oy = fy; } -#ifdef SMOOTHDBG - if (_els_scroller_smooth_debug) - _els_scroller_smooth_debug_movetime_add(ox, oy); -#endif - elm_smart_scroller_child_pos_set(sd->smart_obj, ox, oy); return ECORE_CALLBACK_RENEW; } @@ -2115,10 +1959,6 @@ _smart_event_mouse_up(void *data, Evas *e, Evas_Object *obj __UNUSED__, void *ev Smart_Data *sd; Evas_Coord x = 0, y = 0, ox = 0, oy = 0; -#ifdef SMOOTHDBG - if (_els_scroller_smooth_debug) _els_scroller_smooth_debug_shutdown(); -#endif - sd = data; ev = event_info; sd->down.hold_parent = EINA_FALSE; diff --git a/src/lib/els_tooltip.c b/src/lib/els_tooltip.c index 65d31f5..06a6ebc 100644 --- a/src/lib/els_tooltip.c +++ b/src/lib/els_tooltip.c @@ -131,7 +131,7 @@ _elm_tooltip_show(Elm_Tooltip *tt) } if (tt->free_size) { - tt->tt_win = elm_win_add(NULL, "tooltip", ELM_WIN_BASIC); + tt->tt_win = elm_win_add(NULL, "tooltip", ELM_WIN_TOOLTIP); elm_win_override_set(tt->tt_win, EINA_TRUE); tt->tt_evas = evas_object_evas_get(tt->tt_win); tt->tooltip = edje_object_add(tt->tt_evas); @@ -275,7 +275,8 @@ _elm_tooltip_reconfigure(Elm_Tooltip *tt) { const char *style = tt->style ? tt->style : "default"; const char *str; - if (!_elm_theme_object_set(tt->tt_win ? NULL : tt->owner, tt->tooltip, "tooltip", "base", style)) + if (!_elm_theme_object_set(tt->tt_win ? NULL : tt->owner, tt->tooltip, + "tooltip", "base", style)); { ERR("Could not apply the theme to the tooltip! style=%s", style); if (tt->tt_win) evas_object_del(tt->tt_win); diff --git a/src/modules/datetime_input_ctxpopup/datetime_input_ctxpopup.c b/src/modules/datetime_input_ctxpopup/datetime_input_ctxpopup.c index 3060934..d5474c5 100644 --- a/src/modules/datetime_input_ctxpopup/datetime_input_ctxpopup.c +++ b/src/modules/datetime_input_ctxpopup/datetime_input_ctxpopup.c @@ -30,10 +30,18 @@ struct _DiskItem_Data unsigned int sel_field_value; }; +static Eina_Bool +_diskitem_data_del_idler(void *data) +{ + if (data) free(data); + return ECORE_CALLBACK_CANCEL; +} + static void _diskselector_item_free_cb(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) { - if (data) free(data); + if (data) + ecore_idler_add(_diskitem_data_del_idler, data); } static Eina_Bool @@ -249,6 +257,9 @@ _field_clicked_cb(void *data, Evas_Object *obj) } if (ctx_mod->sel_field) elm_object_signal_emit(ctx_mod->sel_field, "elm,state,select", "elm"); + + /* Raise the Ctxpopup to show it at the top of its layer */ + evas_object_raise(ctx_mod->ctxpopup); evas_object_show(ctx_mod->ctxpopup); }