From 9b36fb6055aedb82da3e20d56681708d7ee9c3fc Mon Sep 17 00:00:00 2001 From: Thiep Ha Date: Thu, 22 Aug 2013 05:16:07 +0900 Subject: [PATCH] notify: Add hide effect to notify. As specified in task T149, the notify has show effect but does not have hide effect. This patch adds hide effect to notify. --- legacy/elementary/ChangeLog | 5 ++ legacy/elementary/NEWS | 1 + .../elementary/data/themes/widgets/notify.edc | 85 +++++++++++++++++-- legacy/elementary/src/lib/elm_notify.c | 46 +++++++++- legacy/elementary/src/lib/elm_widget_notify.h | 2 + 5 files changed, 127 insertions(+), 12 deletions(-) diff --git a/legacy/elementary/ChangeLog b/legacy/elementary/ChangeLog index e63d26d86a..562e0598aa 100644 --- a/legacy/elementary/ChangeLog +++ b/legacy/elementary/ChangeLog @@ -1511,6 +1511,7 @@ not entry. This prevents the asynchronous states between ime and conformant. +<<<<<<< HEAD 2013-07-23 ChunEon Park (Hermet) * File Selector : Support elm_object_part_text_set() for the ok, cancel @@ -1562,3 +1563,7 @@ 2013-08-19 ChunEon Park (Hermet) * Popup: Support "language,changed" smart callback. + +2013-08-22 Thiep Ha + + * Add hide effect for notify. diff --git a/legacy/elementary/NEWS b/legacy/elementary/NEWS index e9abab7e78..2fac39ebab 100644 --- a/legacy/elementary/NEWS +++ b/legacy/elementary/NEWS @@ -127,6 +127,7 @@ Improvements: * Change the method to calculate a distance which be scrolled from linear to sine curve. * Add support for URL in Elm_Image and Elm_Photocam. * Popup: Support "language,changed" smart callback. + * Add hide effect for notify. Fixes: * Now elm_datetime_field_limit_set() can set year limits wihtout problems. diff --git a/legacy/elementary/data/themes/widgets/notify.edc b/legacy/elementary/data/themes/widgets/notify.edc index 6409fa8075..e06b456432 100644 --- a/legacy/elementary/data/themes/widgets/notify.edc +++ b/legacy/elementary/data/themes/widgets/notify.edc @@ -19,6 +19,7 @@ group { name: "elm/notify/block_events/default"; } group { name: "elm/notify/top/default"; //this group is a design similar to the inwin group + data.item: "emit_hide_finished_signal" "yes"; images { image: "shad_circ.png" COMP; image: "bt_dis_base.png" COMP; @@ -96,14 +97,21 @@ group { name: "elm/notify/top/default"; transition: LINEAR 0.5; } program { name: "hide"; - signal: "hide"; + signal: "elm,state,hide"; + source: "elm"; action: STATE_SET "default" 0.0; target: "base"; + transition: LINEAR 0.5; + after: "hide_finished"; + } + program { name: "hide_finished"; + action: SIGNAL_EMIT "elm,action,hide,finished" "elm"; } } } group { name: "elm/notify/center/default"; //this group is a design similar to the inwin group + data.item: "emit_hide_finished_signal" "yes"; images { image: "bt_dis_base.png" COMP; } @@ -145,10 +153,14 @@ group { name: "elm/notify/center/default"; type: RECT; description { state: "default" 0.0; color: 0 0 0 0 ; + rel1.relative: 0.0 -1.0; + rel2.relative: 1.0 0.0; } description { state: "visible" 0.0; inherit: "default" 0.0; color: 255 255 255 255; + rel1.relative: 0.0 0.0; + rel2.relative: 1.0 1.0; } } } @@ -160,15 +172,22 @@ group { name: "elm/notify/center/default"; transition: LINEAR 0.5; } program { name: "hide"; - signal: "hide"; + signal: "elm,state,hide"; + source: "elm"; action: STATE_SET "default" 0.0; target: "clipper"; + transition: LINEAR 0.5; + after: "hide_finished"; + } + program { name: "hide_finished"; + action: SIGNAL_EMIT "elm,action,hide,finished" "elm"; } } } group { name: "elm/notify/bottom/default"; //this group is a design similar to the inwin group + data.item: "emit_hide_finished_signal" "yes"; images { image: "shad_circ.png" COMP; image: "bt_dis_base.png" COMP; @@ -246,14 +265,21 @@ group { name: "elm/notify/bottom/default"; transition: LINEAR 0.5; } program { name: "hide"; - signal: "hide"; + signal: "elm,state,hide"; + source: "elm"; action: STATE_SET "default" 0.0; target: "base"; + transition: LINEAR 0.5; + after: "hide_finished"; + } + program { name: "hide_finished"; + action: SIGNAL_EMIT "elm,action,hide,finished" "elm"; } } } group { name: "elm/notify/left/default"; //this group is a design similar to the inwin group + data.item: "emit_hide_finished_signal" "yes"; images { image: "shad_circ.png" COMP; image: "bt_dis_base.png" COMP; @@ -331,14 +357,21 @@ group { name: "elm/notify/left/default"; transition: LINEAR 0.5; } program { name: "hide"; - signal: "hide"; + signal: "elm,state,hide"; + source: "elm"; action: STATE_SET "default" 0.0; target: "base"; + transition: LINEAR 0.5; + after: "hide_finished"; + } + program { name: "hide_finished"; + action: SIGNAL_EMIT "elm,action,hide,finished" "elm"; } } } group { name: "elm/notify/right/default"; //this group is a design similar to the inwin group + data.item: "emit_hide_finished_signal" "yes"; images { image: "shad_circ.png" COMP; image: "bt_dis_base.png" COMP; @@ -416,14 +449,21 @@ group { name: "elm/notify/right/default"; transition: LINEAR 0.5; } program { name: "hide"; - signal: "hide"; + signal: "elm,state,hide"; + source: "elm"; action: STATE_SET "default" 0.0; target: "base"; + transition: LINEAR 0.5; + after: "hide_finished"; + } + program { name: "hide_finished"; + action: SIGNAL_EMIT "elm,action,hide,finished" "elm"; } } } group { name: "elm/notify/top_left/default"; //this group is a design similar to the inwin group + data.item: "emit_hide_finished_signal" "yes"; images { image: "shad_circ.png" COMP; image: "bt_dis_base.png" COMP; @@ -501,14 +541,21 @@ group { name: "elm/notify/top_left/default"; transition: LINEAR 0.5; } program { name: "hide"; - signal: "hide"; + signal: "elm,state,hide"; + source: "elm"; action: STATE_SET "default" 0.0; target: "base"; + transition: LINEAR 0.5; + after: "hide_finished"; + } + program { name: "hide_finished"; + action: SIGNAL_EMIT "elm,action,hide,finished" "elm"; } } } group { name: "elm/notify/top_right/default"; //this group is a design similar to the inwin group + data.item: "emit_hide_finished_signal" "yes"; images { image: "shad_circ.png" COMP; image: "bt_dis_base.png" COMP; @@ -586,14 +633,21 @@ group { name: "elm/notify/top_right/default"; transition: LINEAR 0.5; } program { name: "hide"; - signal: "hide"; + signal: "elm,state,hide"; + source: "elm"; action: STATE_SET "default" 0.0; target: "base"; + transition: LINEAR 0.5; + after: "hide_finished"; + } + program { name: "hide_finished"; + action: SIGNAL_EMIT "elm,action,hide,finished" "elm"; } } } group { name: "elm/notify/bottom_left/default"; //this group is a design similar to the inwin group + data.item: "emit_hide_finished_signal" "yes"; images { image: "shad_circ.png" COMP; image: "bt_dis_base.png" COMP; @@ -671,14 +725,21 @@ group { name: "elm/notify/bottom_left/default"; transition: LINEAR 0.5; } program { name: "hide"; - signal: "hide"; + signal: "elm,state,hide"; + source: "elm"; action: STATE_SET "default" 0.0; target: "base"; + transition: LINEAR 0.5; + after: "hide_finished"; + } + program { name: "hide_finished"; + action: SIGNAL_EMIT "elm,action,hide,finished" "elm"; } } } group { name: "elm/notify/bottom_right/default"; //this group is a design similar to the inwin group + data.item: "emit_hide_finished_signal" "yes"; images { image: "shad_circ.png" COMP; image: "bt_dis_base.png" COMP; @@ -756,9 +817,15 @@ group { name: "elm/notify/bottom_right/default"; transition: LINEAR 0.5; } program { name: "hide"; - signal: "hide"; + signal: "elm,state,hide"; + source: "elm"; action: STATE_SET "default" 0.0; target: "base"; + transition: LINEAR 0.5; + after: "hide_finished"; + } + program { name: "hide_finished"; + action: SIGNAL_EMIT "elm,action,hide,finished" "elm"; } } } diff --git a/legacy/elementary/src/lib/elm_notify.c b/legacy/elementary/src/lib/elm_notify.c index 46c361aaec..231f6a9289 100644 --- a/legacy/elementary/src/lib/elm_notify.c +++ b/legacy/elementary/src/lib/elm_notify.c @@ -241,6 +241,7 @@ _elm_notify_smart_move(Eo *obj, void *_pd EINA_UNUSED, va_list *list) static Eina_Bool _timer_cb(void *data) { + const char *hide_signal; Evas_Object *obj = data; ELM_NOTIFY_DATA_GET(obj, sd); @@ -248,7 +249,16 @@ _timer_cb(void *data) sd->timer = NULL; if (!evas_object_visible_get(obj)) goto end; - evas_object_hide(obj); + hide_signal = edje_object_data_get(sd->notify, "emit_hide_finished_signal"); + if ((hide_signal) && (!strcmp(hide_signal, "yes"))) + { + sd->in_timeout = EINA_TRUE; + edje_object_signal_emit(sd->notify, "elm,state,hide", "elm"); + } + else //for backport supporting: edc without emitting hide finished signal + { + evas_object_hide(obj); + } evas_object_smart_callback_call(obj, SIG_TIMEOUT, NULL); end: @@ -271,6 +281,8 @@ _elm_notify_smart_show(Eo *obj, void *_pd, va_list *list EINA_UNUSED) { Elm_Notify_Smart_Data *sd = _pd; + sd->had_hidden = EINA_FALSE; + sd->in_timeout = EINA_FALSE; eo_do_super(obj, MY_CLASS, evas_obj_smart_show()); evas_object_show(sd->notify); @@ -282,12 +294,24 @@ _elm_notify_smart_show(Eo *obj, void *_pd, va_list *list EINA_UNUSED) static void _elm_notify_smart_hide(Eo *obj, void *_pd, va_list *list EINA_UNUSED) { + const char *hide_signal; Elm_Notify_Smart_Data *sd = _pd; + if (sd->had_hidden && !sd->in_timeout) + return; eo_do_super(obj, MY_CLASS, evas_obj_smart_hide()); - evas_object_hide(sd->notify); - if (!sd->allow_events) evas_object_hide(sd->block_events); + hide_signal = edje_object_data_get(sd->notify, "emit_hide_finished_signal"); + if ((hide_signal) && (!strcmp(hide_signal, "yes"))) + { + if (!sd->in_timeout) + edje_object_signal_emit(sd->notify, "elm,state,hide", "elm"); + } + else //for backport supporting: edc without emitting hide finished signal + { + evas_object_hide(sd->notify); + if (sd->allow_events) evas_object_hide(sd->block_events); + } ELM_SAFE_FREE(sd->timer, ecore_timer_del); } @@ -433,6 +457,18 @@ _elm_notify_smart_content_unset(Eo *obj, void *_pd, va_list *list) if (ret) *ret = content; } +static void +_hide_finished_cb(void *data, + Evas_Object *obj __UNUSED__, + const char *emission __UNUSED__, + const char *source __UNUSED__) +{ + ELM_NOTIFY_DATA_GET(data, sd); + sd->had_hidden = EINA_TRUE; + evas_object_hide(sd->notify); + if (!sd->allow_events) evas_object_hide(sd->block_events); +} + static void _elm_notify_smart_add(Eo *obj, void *_pd, va_list *list EINA_UNUSED) { @@ -448,6 +484,8 @@ _elm_notify_smart_add(Eo *obj, void *_pd, va_list *list EINA_UNUSED) evas_object_event_callback_add (obj, EVAS_CALLBACK_RESTACK, _restack_cb, obj); + edje_object_signal_callback_add + (priv->notify, "elm,action,hide,finished", "elm", _hide_finished_cb, obj); elm_widget_can_focus_set(obj, EINA_FALSE); elm_notify_align_set(obj, 0.5, 0.0); @@ -458,6 +496,8 @@ _elm_notify_smart_del(Eo *obj, void *_pd, va_list *list EINA_UNUSED) { Elm_Notify_Smart_Data *sd = _pd; + edje_object_signal_callback_del_full + (sd->notify, "elm,action,hide,finished", "elm", _hide_finished_cb, obj); elm_notify_parent_set(obj, NULL); elm_notify_allow_events_set(obj, EINA_FALSE); if (sd->timer) ecore_timer_del(sd->timer); diff --git a/legacy/elementary/src/lib/elm_widget_notify.h b/legacy/elementary/src/lib/elm_widget_notify.h index 701bb45a78..ac6c006836 100644 --- a/legacy/elementary/src/lib/elm_widget_notify.h +++ b/legacy/elementary/src/lib/elm_widget_notify.h @@ -28,6 +28,8 @@ struct _Elm_Notify_Smart_Data Ecore_Timer *timer; Eina_Bool allow_events : 1; + Eina_Bool had_hidden : 1; + Eina_Bool in_timeout : 1; }; /**