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)
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,
41} 41}
42 42
43static void 43static void
44_popup_dismiss_btn_cb(void *data, Evas_Object *obj EINA_UNUSED,
45 void *event_info EINA_UNUSED)
46{
47 elm_popup_dismiss(data);
48}
49
50static void
44_popup_align_cb(void *data, Evas_Object *obj EINA_UNUSED, 51_popup_align_cb(void *data, Evas_Object *obj EINA_UNUSED,
45 void *event_info EINA_UNUSED) 52 void *event_info EINA_UNUSED)
46{ 53{
@@ -796,6 +803,34 @@ _popup_content_only_cb(void *data, Evas_Object *obj EINA_UNUSED,
796} 803}
797 804
798static void 805static void
806_popup_center_title_text_1button_hide_effect_cb(void *data, Evas_Object *obj EINA_UNUSED,
807 void *event_info EINA_UNUSED)
808{
809 Evas_Object *popup;
810 Evas_Object *btn;
811
812 popup = elm_popup_add(data);
813 elm_popup_scrollable_set(popup, is_popup_scroll);
814
815 // popup text
816 elm_object_text_set(popup, "This Popup has title area, content area and "
817 "action area set, action area has one button Close");
818 // popup title
819 elm_object_part_text_set(popup, "title,text", "Title");
820
821 // popup buttons
822 btn = elm_button_add(popup);
823 elm_object_text_set(btn, "Close");
824 elm_object_part_content_set(popup, "button1", btn);
825 evas_object_smart_callback_add(popup, "dismissed", _response_cb, NULL);
826 evas_object_smart_callback_add(btn, "clicked", _popup_dismiss_btn_cb, popup);
827
828 // popup show should be called after adding all the contents and the buttons
829 // of popup to set the focus into popup's contents correctly.
830 evas_object_show(popup);
831}
832
833static void
799_focus_changed_cb(void *data, Evas_Object *obj, void *event_info EINA_UNUSED) 834_focus_changed_cb(void *data, Evas_Object *obj, void *event_info EINA_UNUSED)
800{ 835{
801 Eina_Bool check = elm_check_state_get(obj); 836 Eina_Bool check = elm_check_state_get(obj);
@@ -873,6 +908,8 @@ test_popup(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
873 elm_list_item_append(list, "popup with content only", 908 elm_list_item_append(list, "popup with content only",
874 NULL, NULL, _popup_content_only_cb, 909 NULL, NULL, _popup_content_only_cb,
875 win); 910 win);
911 elm_list_item_append(list, "popup-center-title + text + 1 button + hide effect", NULL,
912 NULL, _popup_center_title_text_1button_hide_effect_cb, win);
876 elm_list_go(list); 913 elm_list_go(list);
877 evas_object_show(list); 914 evas_object_show(list);
878 915
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
51_timeout_cb(void *data, Eo *obj EINA_UNUSED, 51_timeout_cb(void *data, Eo *obj EINA_UNUSED,
52 const Eo_Event_Description *desc EINA_UNUSED, void *event_info EINA_UNUSED); 52 const Eo_Event_Description *desc EINA_UNUSED, void *event_info EINA_UNUSED);
53 53
54static Eina_Bool
55_hide_effect_finished_cb(void *data, Eo *obj EINA_UNUSED,
56 const Eo_Event_Description *desc EINA_UNUSED, void *event_info EINA_UNUSED);
57
54static const Elm_Action key_actions[] = { 58static const Elm_Action key_actions[] = {
55 {"move", _key_action_move}, 59 {"move", _key_action_move},
56 {NULL, NULL} 60 {NULL, NULL}
@@ -58,7 +62,8 @@ static const Elm_Action key_actions[] = {
58 62
59EO_CALLBACKS_ARRAY_DEFINE(_notify_cb, 63EO_CALLBACKS_ARRAY_DEFINE(_notify_cb,
60 { ELM_NOTIFY_EVENT_BLOCK_CLICKED, _block_clicked_cb }, 64 { ELM_NOTIFY_EVENT_BLOCK_CLICKED, _block_clicked_cb },
61 { ELM_NOTIFY_EVENT_TIMEOUT, _timeout_cb } 65 { ELM_NOTIFY_EVENT_TIMEOUT, _timeout_cb },
66 { ELM_NOTIFY_EVENT_DISMISSED, _hide_effect_finished_cb }
62); 67);
63 68
64static void _on_content_del(void *data, Evas *e, Evas_Object *obj, void *event_info); 69static void _on_content_del(void *data, Evas *e, Evas_Object *obj, void *event_info);
@@ -113,6 +118,16 @@ _timeout_cb(void *data,
113 return EINA_TRUE; 118 return EINA_TRUE;
114} 119}
115 120
121static Eina_Bool
122_hide_effect_finished_cb(void *data,
123 Eo *obj EINA_UNUSED, const Eo_Event_Description *desc EINA_UNUSED, void *event_info EINA_UNUSED)
124{
125 eo_do(data, eo_event_callback_call(ELM_POPUP_EVENT_DISMISSED, NULL));
126
127 return EINA_TRUE;
128}
129
130
116static Evas_Object * 131static Evas_Object *
117_access_object_get(const Evas_Object *obj, const char* part) 132_access_object_get(const Evas_Object *obj, const char* part)
118{ 133{
@@ -1820,6 +1835,13 @@ _elm_popup_scrollable_get(Eo *obj EINA_UNUSED, Elm_Popup_Data *pd)
1820 return pd->scroll; 1835 return pd->scroll;
1821} 1836}
1822 1837
1838EOLIAN static void
1839_elm_popup_dismiss(Eo *obj EINA_UNUSED, Elm_Popup_Data *pd)
1840{
1841 elm_layout_signal_emit(pd->main_layout, "elm,state,hide", "elm");
1842 elm_notify_dismiss(pd->notify);
1843}
1844
1823static void 1845static void
1824_elm_popup_class_constructor(Eo_Class *klass) 1846_elm_popup_class_constructor(Eo_Class *klass)
1825{ 1847{
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,
421 evas_object_hide(sd->notify); 421 evas_object_hide(sd->notify);
422 if (!sd->allow_events) evas_object_hide(sd->block_events); 422 if (!sd->allow_events) evas_object_hide(sd->block_events);
423 eo_do_super(data, MY_CLASS, evas_obj_smart_hide()); 423 eo_do_super(data, MY_CLASS, evas_obj_smart_hide());
424 eo_do(data, eo_event_callback_call(ELM_NOTIFY_EVENT_DISMISSED, NULL));
424} 425}
425 426
426EOLIAN static void 427EOLIAN static void
@@ -665,6 +666,14 @@ _elm_notify_align_set(Eo *obj, Elm_Notify_Data *sd, double horizontal, double ve
665} 666}
666 667
667EOLIAN static void 668EOLIAN static void
669_elm_notify_dismiss(Eo *obj EINA_UNUSED, Elm_Notify_Data *sd)
670{
671 elm_layout_signal_emit(sd->block_events, "elm,state,hide", "elm");
672 edje_object_signal_emit(sd->notify, "elm,state,hide", "elm");
673}
674
675
676EOLIAN static void
668_elm_notify_align_get(Eo *obj EINA_UNUSED, Elm_Notify_Data *sd, double *horizontal, double *vertical) 677_elm_notify_align_get(Eo *obj EINA_UNUSED, Elm_Notify_Data *sd, double *horizontal, double *vertical)
669{ 678{
670 if (horizontal) 679 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)
68 timeout: double; [[The timeout in seconds]] 68 timeout: double; [[The timeout in seconds]]
69 } 69 }
70 } 70 }
71 dismiss {
72 [[Dismiss a notify object.]]
73 }
71 } 74 }
72 implements { 75 implements {
73 class.constructor; 76 class.constructor;
@@ -94,6 +97,7 @@ class Elm.Notify (Elm.Container)
94 events { 97 events {
95 block,clicked; 98 block,clicked;
96 timeout; 99 timeout;
100 dismissed;
97 } 101 }
98 102
99} 103}
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)
156 @in data: const(void)* @optional; [[Data passed to $func above.]] 156 @in data: const(void)* @optional; [[Data passed to $func above.]]
157 } 157 }
158 } 158 }
159 dismiss {
160 [[Dismiss a Popup object.]]
161 }
159 } 162 }
160 implements { 163 implements {
161 class.constructor; 164 class.constructor;
@@ -188,6 +191,7 @@ class Elm.Popup (Elm.Layout, Elm_Interface_Atspi_Widget_Action)
188 item,unfocused; 191 item,unfocused;
189 language,changed; 192 language,changed;
190 access,changed; 193 access,changed;
194 dismissed;
191 } 195 }
192 196
193} 197}