summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorAmitesh Singh <amitesh.sh@samsung.com>2014-02-18 04:03:34 +0900
committerDaniel Juyung Seo <seojuyung2@gmail.com>2014-02-26 01:26:02 +0900
commiteea1d9b3dc972be583259b8cccda91f644563723 (patch)
treef266e43675188e3f81cfad05684b02176209f087 /src/lib
parent5983ab351d0c44ca5b2ed342bac747f566147399 (diff)
popup: implemented widget item focus feauture.
@feature Summary: 1. Added "item,focused" and "item,unfocused" callbacks for widget item since VIEW(item) is a elm layout. 2. Added sd->box into focus chain to enable the focus movement on widget items. Test Plan: elementary_test -> popup -> "popup-center-title + items + 3 buttons" Reviewers: seoz, woohyun CC: nirajkr Differential Revision: https://phab.enlightenment.org/D563
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/elc_popup.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/lib/elc_popup.c b/src/lib/elc_popup.c
index 6cd77b406..736ea8be7 100644
--- a/src/lib/elc_popup.c
+++ b/src/lib/elc_popup.c
@@ -23,10 +23,14 @@ static const char CONTENT_PART[] = "elm.swallow.content";
23 23
24static const char SIG_BLOCK_CLICKED[] = "block,clicked"; 24static const char SIG_BLOCK_CLICKED[] = "block,clicked";
25static const char SIG_TIMEOUT[] = "timeout"; 25static const char SIG_TIMEOUT[] = "timeout";
26static const char SIG_ITEM_FOCUSED[] = "item,focused";
27static const char SIG_ITEM_UNFOCUSED[] = "item,unfocused";
26 28
27static const Evas_Smart_Cb_Description _smart_callbacks[] = { 29static const Evas_Smart_Cb_Description _smart_callbacks[] = {
28 {SIG_BLOCK_CLICKED, ""}, 30 {SIG_BLOCK_CLICKED, ""},
29 {SIG_TIMEOUT, ""}, 31 {SIG_TIMEOUT, ""},
32 {SIG_ITEM_FOCUSED, ""},
33 {SIG_ITEM_UNFOCUSED, ""},
30 {SIG_WIDGET_LANG_CHANGED, ""}, /**< handled by elm_widget */ 34 {SIG_WIDGET_LANG_CHANGED, ""}, /**< handled by elm_widget */
31 {SIG_WIDGET_ACCESS_CHANGED, ""}, /**< handled by elm_widget */ 35 {SIG_WIDGET_ACCESS_CHANGED, ""}, /**< handled by elm_widget */
32 {SIG_LAYOUT_FOCUSED, ""}, /**< handled by elm_layout */ 36 {SIG_LAYOUT_FOCUSED, ""}, /**< handled by elm_layout */
@@ -843,6 +847,26 @@ _item_signal_emit_hook(Elm_Object_Item *it,
843} 847}
844 848
845static void 849static void
850_item_focused_cb(void *data,
851 Evas_Object *obj EINA_UNUSED,
852 void *event_info EINA_UNUSED)
853{
854 Elm_Object_Item *it = data;
855
856 evas_object_smart_callback_call(WIDGET(it), SIG_ITEM_FOCUSED, it);
857}
858
859static void
860_item_unfocused_cb(void *data,
861 Evas_Object *obj EINA_UNUSED,
862 void *event_info EINA_UNUSED)
863{
864 Elm_Object_Item *it = data;
865
866 evas_object_smart_callback_call(WIDGET(it), SIG_ITEM_UNFOCUSED, it);
867}
868
869static void
846_item_new(Elm_Popup_Item *it) 870_item_new(Elm_Popup_Item *it)
847{ 871{
848 char style[1024]; 872 char style[1024];
@@ -857,6 +881,7 @@ _item_new(Elm_Popup_Item *it)
857 elm_widget_item_signal_emit_hook_set(it, _item_signal_emit_hook); 881 elm_widget_item_signal_emit_hook_set(it, _item_signal_emit_hook);
858 882
859 VIEW(it) = elm_layout_add(WIDGET(it)); 883 VIEW(it) = elm_layout_add(WIDGET(it));
884 elm_object_focus_allow_set(VIEW(it), EINA_TRUE);
860 885
861 snprintf(style, sizeof(style), "popup/%s", elm_widget_style_get(WIDGET(it))); 886 snprintf(style, sizeof(style), "popup/%s", elm_widget_style_get(WIDGET(it)));
862 if (!elm_layout_theme_set(VIEW(it), "popup", "item", style)) 887 if (!elm_layout_theme_set(VIEW(it), "popup", "item", style))
@@ -866,6 +891,8 @@ _item_new(Elm_Popup_Item *it)
866 elm_layout_signal_callback_add(VIEW(it), "elm,action,click", "*", 891 elm_layout_signal_callback_add(VIEW(it), "elm,action,click", "*",
867 _item_select_cb, it); 892 _item_select_cb, it);
868 evas_object_size_hint_align_set(VIEW(it), EVAS_HINT_FILL, EVAS_HINT_FILL); 893 evas_object_size_hint_align_set(VIEW(it), EVAS_HINT_FILL, EVAS_HINT_FILL);
894 evas_object_smart_callback_add(VIEW(it), SIG_LAYOUT_FOCUSED, _item_focused_cb, it);
895 evas_object_smart_callback_add(VIEW(it), SIG_LAYOUT_UNFOCUSED, _item_unfocused_cb, it);
869 evas_object_show(VIEW(it)); 896 evas_object_show(VIEW(it));
870 } 897 }
871} 898}
@@ -1379,6 +1406,9 @@ _elm_popup_smart_focus_next(Eo *obj EINA_UNUSED, void *_pd, va_list *list)
1379 /* content area */ 1406 /* content area */
1380 if (sd->content) items = eina_list_append(items, sd->content_area); 1407 if (sd->content) items = eina_list_append(items, sd->content_area);
1381 1408
1409 /* items */
1410 if (sd->box) items = eina_list_append(items, sd->box);
1411
1382 /* action area */ 1412 /* action area */
1383 if (sd->action_area) items = eina_list_append(items, sd->action_area); 1413 if (sd->action_area) items = eina_list_append(items, sd->action_area);
1384 1414
@@ -1432,6 +1462,9 @@ _elm_popup_smart_focus_direction(Eo *obj EINA_UNUSED, void *_pd, va_list *list)
1432 /* content area */ 1462 /* content area */
1433 if (sd->content) items = eina_list_append(items, sd->content_area); 1463 if (sd->content) items = eina_list_append(items, sd->content_area);
1434 1464
1465 /* items */
1466 if (sd->box) items = eina_list_append(items, sd->box);
1467
1435 /* action area */ 1468 /* action area */
1436 if (sd->action_area) items = eina_list_append(items, sd->action_area); 1469 if (sd->action_area) items = eina_list_append(items, sd->action_area);
1437 1470