config: Add Escape key binding to naviframe. 99/87999/3
authorJaehyun Cho <jae_hyun.cho@samsung.com>
Mon, 12 Sep 2016 11:30:50 +0000 (20:30 +0900)
committerGerrit Code Review <gerrit@review.vlan103.tizen.org>
Tue, 13 Sep 2016 07:17:50 +0000 (00:17 -0700)
Naviframe item is popped when Escape key is pressed.

Change-Id: I8e28c11ae4d04cae0f91b44bddde6e1ccc2c5931

src/lib/elc_naviframe.c

index 2aba4eb..24b6437 100644 (file)
@@ -68,11 +68,13 @@ static Eina_Bool _on_item_back_btn_clicked(void *data,
       Eo *obj EINA_UNUSED, const Eo_Event_Description *desc EINA_UNUSED, void *event_info EINA_UNUSED);
 
 static Eina_Bool _key_action_top_item_get(Evas_Object *obj, const char *params);
+static Eina_Bool _key_action_item_pop(Evas_Object *obj, const char *params);
 
 static char *_access_info_cb(void *data, Evas_Object *obj EINA_UNUSED);
 
 static const Elm_Action key_actions[] = {
    {"top_item_get", _key_action_top_item_get},
+   {"item_pop", _key_action_item_pop},
    {NULL, NULL}
 };
 
@@ -1583,6 +1585,22 @@ _key_action_top_item_get(Evas_Object *obj, const char *params EINA_UNUSED)
    return EINA_TRUE;
 }
 
+static Eina_Bool
+_key_action_item_pop(Evas_Object *obj, const char *params EINA_UNUSED)
+{
+   Elm_Object_Item *eo_item = NULL;
+   eo_item = elm_naviframe_top_item_get(obj);
+   if (!eo_item) return EINA_FALSE;
+
+   ELM_NAVIFRAME_ITEM_DATA_GET(eo_item, it);
+
+   if (it->pushing || it->popping) return EINA_FALSE;
+
+   elm_naviframe_item_pop(obj);
+
+   return EINA_TRUE;
+}
+
 EOLIAN static Eina_Bool
 _elm_naviframe_elm_widget_event(Eo *obj, Elm_Naviframe_Data *sd EINA_UNUSED, Evas_Object *src, Evas_Callback_Type type, void *event_info)
 {
@@ -2106,6 +2124,7 @@ _elm_naviframe_elm_interface_atspi_widget_action_elm_actions_get(Eo *obj EINA_UN
 {
    static Elm_Atspi_Action atspi_actions[] = {
           { "top_item_get", "top_item_get", NULL, _key_action_top_item_get },
+          { "item_pop", "item_pop", NULL, _key_action_item_pop },
           { NULL, NULL, NULL, NULL }
    };
    return &atspi_actions[0];