summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorAmitesh Singh <amitesh.sh@samsung.com>2014-04-27 12:38:27 +0900
committerDaniel Juyung Seo <seojuyung2@gmail.com>2014-04-27 12:40:17 +0900
commita11aaedfbab6af2b935f4e253f4d55bde5ef023e (patch)
treec54950024c1a2a97a857d821fa2445f461b7b393 /src/lib
parent3559a7d2ca62ff366fe5942e6a882b9993495fc1 (diff)
genlist: Implemented item_select_on_focus feature.
Summary: @feature Test Plan: elementary_test->Genlist Focus Reviewers: seoz, raster CC: seoz Differential Revision: https://phab.enlightenment.org/D705
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/elm_genlist.c31
1 files changed, 21 insertions, 10 deletions
diff --git a/src/lib/elm_genlist.c b/src/lib/elm_genlist.c
index e3c049e00..9124d7bdd 100644
--- a/src/lib/elm_genlist.c
+++ b/src/lib/elm_genlist.c
@@ -2479,8 +2479,6 @@ _elm_genlist_item_unfocused(Elm_Gen_Item *it)
2479 evas_object_smart_callback_call(obj, SIG_ITEM_UNFOCUSED, it); 2479 evas_object_smart_callback_call(obj, SIG_ITEM_UNFOCUSED, it);
2480} 2480}
2481 2481
2482/* NOTE: this code will be used later when the item selection on key press
2483 becomes optional. So do not remove this.
2484static Eina_Bool 2482static Eina_Bool
2485_item_focused_next(Evas_Object *obj, Elm_Focus_Direction dir) 2483_item_focused_next(Evas_Object *obj, Elm_Focus_Direction dir)
2486{ 2484{
@@ -2533,7 +2531,6 @@ _item_focused_next(Evas_Object *obj, Elm_Focus_Direction dir)
2533 2531
2534 return EINA_TRUE; 2532 return EINA_TRUE;
2535} 2533}
2536*/
2537 2534
2538static void 2535static void
2539_elm_genlist_item_content_focus_set(Elm_Gen_Item *it, Elm_Focus_Direction dir) 2536_elm_genlist_item_content_focus_set(Elm_Gen_Item *it, Elm_Focus_Direction dir)
@@ -2587,6 +2584,7 @@ _key_action_move_dir(Evas_Object *obj, Elm_Focus_Direction dir, Eina_Bool multi)
2587 Eina_Bool ret = EINA_FALSE; 2584 Eina_Bool ret = EINA_FALSE;
2588 Evas_Coord v = 0; 2585 Evas_Coord v = 0;
2589 Evas_Coord min = 0; 2586 Evas_Coord min = 0;
2587 Eina_Bool focus_only = EINA_FALSE;
2590 2588
2591 // get content size and viewport size 2589 // get content size and viewport size
2592 eo_do(obj, 2590 eo_do(obj,
@@ -2594,23 +2592,28 @@ _key_action_move_dir(Evas_Object *obj, Elm_Focus_Direction dir, Eina_Bool multi)
2594 (NULL, NULL, NULL, &v), 2592 (NULL, NULL, NULL, &v),
2595 elm_interface_scrollable_content_size_get(NULL, &min)); 2593 elm_interface_scrollable_content_size_get(NULL, &min));
2596 2594
2597 if (multi) 2595 if (multi && !_elm_config->item_select_on_focus_disable)
2598 { 2596 {
2599 if (dir == ELM_FOCUS_UP) 2597 if (dir == ELM_FOCUS_UP)
2600 ret = _item_multi_select_up(sd); 2598 ret = _item_multi_select_up(sd);
2601 else if (dir == ELM_FOCUS_DOWN) 2599 else if (dir == ELM_FOCUS_DOWN)
2602 ret = _item_multi_select_down(sd); 2600 ret = _item_multi_select_down(sd);
2603 } 2601 }
2604 else 2602 else if (!multi && !_elm_config->item_select_on_focus_disable)
2605 { 2603 {
2606 if (dir == ELM_FOCUS_UP) 2604 if (dir == ELM_FOCUS_UP)
2607 ret = _item_single_select_up(sd); 2605 ret = _item_single_select_up(sd);
2608 else if (dir == ELM_FOCUS_DOWN) 2606 else if (dir == ELM_FOCUS_DOWN)
2609 ret = _item_single_select_down(sd); 2607 ret = _item_single_select_down(sd);
2610 } 2608 }
2609 else if (_elm_config->item_select_on_focus_disable)
2610 {
2611 ret = _item_focused_next(obj, dir);
2612 }
2611 if (ret) 2613 if (ret)
2612 return EINA_TRUE; 2614 return EINA_TRUE;
2613 2615
2616 focus_only = _elm_config->item_select_on_focus_disable && elm_widget_focus_highlight_enabled_get(obj);
2614 // handle item loop feature 2617 // handle item loop feature
2615 if (sd->item_loop_enable) 2618 if (sd->item_loop_enable)
2616 { 2619 {
@@ -2628,7 +2631,9 @@ _key_action_move_dir(Evas_Object *obj, Elm_Focus_Direction dir, Eina_Bool multi)
2628 else if(dir == ELM_FOCUS_DOWN) 2631 else if(dir == ELM_FOCUS_DOWN)
2629 it = elm_genlist_first_item_get(obj); 2632 it = elm_genlist_first_item_get(obj);
2630 2633
2631 if (it) 2634 if (it && focus_only)
2635 elm_object_item_focus_set(it, EINA_TRUE);
2636 else if (it)
2632 elm_genlist_item_selected_set(it, EINA_TRUE); 2637 elm_genlist_item_selected_set(it, EINA_TRUE);
2633 } 2638 }
2634 return EINA_TRUE; 2639 return EINA_TRUE;
@@ -2751,7 +2756,7 @@ _key_action_select(Evas_Object *obj, const char *params EINA_UNUSED)
2751{ 2756{
2752 Elm_Object_Item *it = NULL; 2757 Elm_Object_Item *it = NULL;
2753 2758
2754 it = elm_genlist_selected_item_get(obj); 2759 it = elm_object_focused_item_get(obj);
2755 elm_genlist_item_expanded_set(it, !elm_genlist_item_expanded_get(it)); 2760 elm_genlist_item_expanded_set(it, !elm_genlist_item_expanded_get(it));
2756 evas_object_smart_callback_call(WIDGET(it), SIG_ACTIVATED, it); 2761 evas_object_smart_callback_call(WIDGET(it), SIG_ACTIVATED, it);
2757 2762
@@ -2916,7 +2921,7 @@ _elm_genlist_elm_widget_on_focus(Eo *obj, Elm_Genlist_Data *sd)
2916 it = _elm_genlist_nearest_visible_item_get(obj, it); 2921 it = _elm_genlist_nearest_visible_item_get(obj, it);
2917 if (it) 2922 if (it)
2918 { 2923 {
2919 if (is_sel) 2924 if (!_elm_config->item_select_on_focus_disable && is_sel)
2920 elm_genlist_item_selected_set(it, EINA_TRUE); 2925 elm_genlist_item_selected_set(it, EINA_TRUE);
2921 else 2926 else
2922 elm_object_item_focus_set(it, EINA_TRUE); 2927 elm_object_item_focus_set(it, EINA_TRUE);
@@ -5161,7 +5166,10 @@ _elm_genlist_looping_up_cb(void *data,
5161{ 5166{
5162 Evas_Object *genlist = data; 5167 Evas_Object *genlist = data;
5163 Elm_Object_Item *it = elm_genlist_last_item_get(genlist); 5168 Elm_Object_Item *it = elm_genlist_last_item_get(genlist);
5164 elm_genlist_item_selected_set(it, EINA_TRUE); 5169 if (!_elm_config->item_select_on_focus_disable)
5170 elm_genlist_item_selected_set(it, EINA_TRUE);
5171 else
5172 elm_object_item_focus_set(it, EINA_TRUE);
5165 elm_layout_signal_emit(genlist, "elm,action,looping,up,end", "elm"); 5173 elm_layout_signal_emit(genlist, "elm,action,looping,up,end", "elm");
5166} 5174}
5167 5175
@@ -5173,7 +5181,10 @@ _elm_genlist_looping_down_cb(void *data,
5173{ 5181{
5174 Evas_Object *genlist = data; 5182 Evas_Object *genlist = data;
5175 Elm_Object_Item *it = elm_genlist_first_item_get(genlist); 5183 Elm_Object_Item *it = elm_genlist_first_item_get(genlist);
5176 elm_genlist_item_selected_set(it, EINA_TRUE); 5184 if (!_elm_config->item_select_on_focus_disable)
5185 elm_genlist_item_selected_set(it, EINA_TRUE);
5186 else
5187 elm_object_item_focus_set(it, EINA_TRUE);
5177 elm_layout_signal_emit(genlist, "elm,action,looping,down,end", "elm"); 5188 elm_layout_signal_emit(genlist, "elm,action,looping,down,end", "elm");
5178} 5189}
5179 5190