seoz pushed a commit to branch master.
commit 5c4bc2f561de7f02a014f97108c49657bd8e2a88
Author: Thiep Ha <[email protected]>
Date: Thu Aug 22 05:16:07 2013 +0900
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.
---
ChangeLog | 5 +++
NEWS | 1 +
data/themes/widgets/notify.edc | 85 +++++++++++++++++++++++++++++++++++++-----
src/lib/elm_notify.c | 46 +++++++++++++++++++++--
src/lib/elm_widget_notify.h | 2 +
5 files changed, 127 insertions(+), 12 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index e63d26d..562e059 100644
--- a/ChangeLog
+++ b/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/NEWS b/NEWS
index e9abab7..2fac39e 100644
--- a/NEWS
+++ b/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/data/themes/widgets/notify.edc b/data/themes/widgets/notify.edc
index 6409fa8..e06b456 100644
--- a/data/themes/widgets/notify.edc
+++ b/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/src/lib/elm_notify.c b/src/lib/elm_notify.c
index 46c361a..231f6a9 100644
--- a/src/lib/elm_notify.c
+++ b/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);
}
@@ -434,6 +458,18 @@ _elm_notify_smart_content_unset(Eo *obj, void *_pd,
va_list *list)
}
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)
{
Elm_Notify_Smart_Data *priv = _pd;
@@ -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/src/lib/elm_widget_notify.h b/src/lib/elm_widget_notify.h
index 701bb45..ac6c006 100644
--- a/src/lib/elm_widget_notify.h
+++ b/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;
};
/**
--
------------------------------------------------------------------------------
Introducing Performance Central, a new site from SourceForge and
AppDynamics. Performance Central is your source for news, insights,
analysis and resources for efficient Application Performance Management.
Visit us today!
http://pubads.g.doubleclick.net/gampad/clk?id=48897511&iu=/4140/ostg.clktrk