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
This commit is contained in:
parent
f6db79f205
commit
d36f570bc1
|
@ -40,6 +40,13 @@ _popup_close_cb(void *data, Evas_Object *obj EINA_UNUSED,
|
|||
evas_object_del(data);
|
||||
}
|
||||
|
||||
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)
|
||||
|
@ -795,6 +802,34 @@ _popup_content_only_cb(void *data, Evas_Object *obj EINA_UNUSED,
|
|||
elm_object_focus_set(btn, EINA_TRUE);
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
|
@ -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);
|
||||
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -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
|
||||
|
@ -664,6 +665,14 @@ _elm_notify_align_set(Eo *obj, Elm_Notify_Data *sd, double horizontal, double ve
|
|||
_calc(obj);
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue