summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortaehyub <taehyub.kim@samsung.com>2015-12-31 13:08:28 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2015-12-31 13:13:55 +0900
commit0a34a4c6a4767c46baced6940c152363d4836d36 (patch)
tree0084696f4418173e1a7182c65f5aebcce6003c17
parent329faede52765f69faba258287cedbae6cf7659e (diff)
downloadelementary-0a34a4c6a4767c46baced6940c152363d4836d36.tar.gz
popup: add popup dismiss function for hide effect
Summary: add popup dismiss function for hide effect Test Plan: 1. applied this patch 2. launch elementary_test 3. run "popup" -> "popup-center-title + text + 1 button + hide effect" 4. click the "close" button and check the hide effect Reviewers: Hermet, woohyun, kimcinoo, raster Differential Revision: https://phab.enlightenment.org/D3502 @feature
-rw-r--r--src/bin/test_popup.c37
-rw-r--r--src/lib/elc_popup.c24
-rw-r--r--src/lib/elm_notify.c9
-rw-r--r--src/lib/elm_notify.eo4
-rw-r--r--src/lib/elm_popup.eo4
5 files changed, 77 insertions, 1 deletions
diff --git a/src/bin/test_popup.c b/src/bin/test_popup.c
index dcfba0eeb..3ab08e172 100644
--- a/src/bin/test_popup.c
+++ b/src/bin/test_popup.c
@@ -41,6 +41,13 @@ _popup_close_cb(void *data, Evas_Object *obj EINA_UNUSED,
}
static void
+_popup_dismiss_btn_cb(void *data, Evas_Object *obj EINA_UNUSED,
+ void *event_info EINA_UNUSED)
+{
+ elm_popup_dismiss(data);
+}
+
+static void
_popup_align_cb(void *data, Evas_Object *obj EINA_UNUSED,
void *event_info EINA_UNUSED)
{
@@ -796,6 +803,34 @@ _popup_content_only_cb(void *data, Evas_Object *obj EINA_UNUSED,
}
static void
+_popup_center_title_text_1button_hide_effect_cb(void *data, Evas_Object *obj EINA_UNUSED,
+ void *event_info EINA_UNUSED)
+{
+ Evas_Object *popup;
+ Evas_Object *btn;
+
+ popup = elm_popup_add(data);
+ elm_popup_scrollable_set(popup, is_popup_scroll);
+
+ // popup text
+ elm_object_text_set(popup, "This Popup has title area, content area and "
+ "action area set, action area has one button Close");
+ // popup title
+ elm_object_part_text_set(popup, "title,text", "Title");
+
+ // popup buttons
+ btn = elm_button_add(popup);
+ elm_object_text_set(btn, "Close");
+ elm_object_part_content_set(popup, "button1", btn);
+ evas_object_smart_callback_add(popup, "dismissed", _response_cb, NULL);
+ evas_object_smart_callback_add(btn, "clicked", _popup_dismiss_btn_cb, popup);
+
+ // popup show should be called after adding all the contents and the buttons
+ // of popup to set the focus into popup's contents correctly.
+ evas_object_show(popup);
+}
+
+static void
_focus_changed_cb(void *data, Evas_Object *obj, void *event_info EINA_UNUSED)
{
Eina_Bool check = elm_check_state_get(obj);
@@ -873,6 +908,8 @@ test_popup(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
elm_list_item_append(list, "popup with content only",
NULL, NULL, _popup_content_only_cb,
win);
+ elm_list_item_append(list, "popup-center-title + text + 1 button + hide effect", NULL,
+ NULL, _popup_center_title_text_1button_hide_effect_cb, win);
elm_list_go(list);
evas_object_show(list);
diff --git a/src/lib/elc_popup.c b/src/lib/elc_popup.c
index 5b13bb303..d9b952a22 100644
--- a/src/lib/elc_popup.c
+++ b/src/lib/elc_popup.c
@@ -51,6 +51,10 @@ static Eina_Bool
_timeout_cb(void *data, Eo *obj EINA_UNUSED,
const Eo_Event_Description *desc EINA_UNUSED, void *event_info EINA_UNUSED);
+static Eina_Bool
+_hide_effect_finished_cb(void *data, Eo *obj EINA_UNUSED,
+ const Eo_Event_Description *desc EINA_UNUSED, void *event_info EINA_UNUSED);
+
static const Elm_Action key_actions[] = {
{"move", _key_action_move},
{NULL, NULL}
@@ -58,7 +62,8 @@ static const Elm_Action key_actions[] = {
EO_CALLBACKS_ARRAY_DEFINE(_notify_cb,
{ ELM_NOTIFY_EVENT_BLOCK_CLICKED, _block_clicked_cb },
- { ELM_NOTIFY_EVENT_TIMEOUT, _timeout_cb }
+ { ELM_NOTIFY_EVENT_TIMEOUT, _timeout_cb },
+ { ELM_NOTIFY_EVENT_DISMISSED, _hide_effect_finished_cb }
);
static void _on_content_del(void *data, Evas *e, Evas_Object *obj, void *event_info);
@@ -113,6 +118,16 @@ _timeout_cb(void *data,
return EINA_TRUE;
}
+static Eina_Bool
+_hide_effect_finished_cb(void *data,
+ Eo *obj EINA_UNUSED, const Eo_Event_Description *desc EINA_UNUSED, void *event_info EINA_UNUSED)
+{
+ eo_do(data, eo_event_callback_call(ELM_POPUP_EVENT_DISMISSED, NULL));
+
+ return EINA_TRUE;
+}
+
+
static Evas_Object *
_access_object_get(const Evas_Object *obj, const char* part)
{
@@ -1820,6 +1835,13 @@ _elm_popup_scrollable_get(Eo *obj EINA_UNUSED, Elm_Popup_Data *pd)
return pd->scroll;
}
+EOLIAN static void
+_elm_popup_dismiss(Eo *obj EINA_UNUSED, Elm_Popup_Data *pd)
+{
+ elm_layout_signal_emit(pd->main_layout, "elm,state,hide", "elm");
+ elm_notify_dismiss(pd->notify);
+}
+
static void
_elm_popup_class_constructor(Eo_Class *klass)
{
diff --git a/src/lib/elm_notify.c b/src/lib/elm_notify.c
index 501458539..097aed91f 100644
--- a/src/lib/elm_notify.c
+++ b/src/lib/elm_notify.c
@@ -421,6 +421,7 @@ _hide_finished_cb(void *data,
evas_object_hide(sd->notify);
if (!sd->allow_events) evas_object_hide(sd->block_events);
eo_do_super(data, MY_CLASS, evas_obj_smart_hide());
+ eo_do(data, eo_event_callback_call(ELM_NOTIFY_EVENT_DISMISSED, NULL));
}
EOLIAN static void
@@ -665,6 +666,14 @@ _elm_notify_align_set(Eo *obj, Elm_Notify_Data *sd, double horizontal, double ve
}
EOLIAN static void
+_elm_notify_dismiss(Eo *obj EINA_UNUSED, Elm_Notify_Data *sd)
+{
+ elm_layout_signal_emit(sd->block_events, "elm,state,hide", "elm");
+ edje_object_signal_emit(sd->notify, "elm,state,hide", "elm");
+}
+
+
+EOLIAN static void
_elm_notify_align_get(Eo *obj EINA_UNUSED, Elm_Notify_Data *sd, double *horizontal, double *vertical)
{
if (horizontal)
diff --git a/src/lib/elm_notify.eo b/src/lib/elm_notify.eo
index 23b21ec52..581051382 100644
--- a/src/lib/elm_notify.eo
+++ b/src/lib/elm_notify.eo
@@ -68,6 +68,9 @@ class Elm.Notify (Elm.Container)
timeout: double; [[The timeout in seconds]]
}
}
+ dismiss {
+ [[Dismiss a notify object.]]
+ }
}
implements {
class.constructor;
@@ -94,6 +97,7 @@ class Elm.Notify (Elm.Container)
events {
block,clicked;
timeout;
+ dismissed;
}
}
diff --git a/src/lib/elm_popup.eo b/src/lib/elm_popup.eo
index ec90a9e80..bed908641 100644
--- a/src/lib/elm_popup.eo
+++ b/src/lib/elm_popup.eo
@@ -156,6 +156,9 @@ class Elm.Popup (Elm.Layout, Elm_Interface_Atspi_Widget_Action)
@in data: const(void)* @optional; [[Data passed to $func above.]]
}
}
+ dismiss {
+ [[Dismiss a Popup object.]]
+ }
}
implements {
class.constructor;
@@ -188,6 +191,7 @@ class Elm.Popup (Elm.Layout, Elm_Interface_Atspi_Widget_Action)
item,unfocused;
language,changed;
access,changed;
+ dismissed;
}
}