summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVaibhav Gupta <g.vaibhav1@samsung.com>2015-05-21 18:02:00 +0900
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>2015-05-21 18:02:00 +0900
commit5099f9eeec52ae71746ede0fd3ff375dc0e83aef (patch)
tree1c200dc67a63578f29eba862db189f066ba60be9
parentbebee23d076cdbcc3675a1ededec0e6274ac20c0 (diff)
Gengrid: Updated gengrid to select the last item.
Summary: Updated gengrid to move item selection in 'vertical' mode to the last item, when currently selected item is not in the last row. As per the original behaviour, on moving down from such an item, it takes the focus out of the gengrid widget. Now it is updated to go to the last item (in last row), and then on further pressing down, focus comes out of gengrid. This is something similar to what happens in other UI systems like in Ubuntu and Windows, when pressing down on (n-1)th row, the last item in the nth row gets focused. Signed-off-by: Vaibhav Gupta <g.vaibhav1@samsung.com> Reviewers: Hermet, SanghyeonLee, raster Reviewed By: raster Subscribers: sachin.dev, singh.amitesh Differential Revision: https://phab.enlightenment.org/D2418
-rw-r--r--src/lib/elm_gengrid.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/src/lib/elm_gengrid.c b/src/lib/elm_gengrid.c
index af7cec941..cb9aa78b2 100644
--- a/src/lib/elm_gengrid.c
+++ b/src/lib/elm_gengrid.c
@@ -1932,25 +1932,34 @@ static Eina_Bool
1932_item_single_select_down(Elm_Gengrid_Data *sd) 1932_item_single_select_down(Elm_Gengrid_Data *sd)
1933{ 1933{
1934 unsigned int i; 1934 unsigned int i;
1935 Elm_Object_Item *eo_next; 1935 unsigned int idx;
1936 Elm_Object_Item *eo_next, *eo_orig;
1936 1937
1937 if (!sd->selected) 1938 if (!sd->selected)
1938 eo_next = EO_OBJ(ELM_GEN_ITEM_FROM_INLIST(sd->items)); 1939 eo_next = EO_OBJ(ELM_GEN_ITEM_FROM_INLIST(sd->items));
1939 else 1940 else
1940 eo_next = sd->last_selected_item; 1941 eo_next = sd->last_selected_item;
1942 eo_orig = eo_next;
1941 1943
1942 while (eo_next) 1944 while (eo_next)
1943 { 1945 {
1944 for (i = 0; i < sd->nmax; i++) 1946 for (i = 0; i < sd->nmax; i++)
1945 { 1947 {
1946 eo_next = elm_gengrid_item_next_get(eo_next); 1948 eo_next = elm_gengrid_item_next_get(eo_next);
1947 if (!eo_next) return EINA_FALSE; 1949 if (!eo_next) break;
1948 } 1950 }
1949 1951
1950 if (!elm_object_item_disabled_get(eo_next)) break; 1952 if (eo_next && !elm_object_item_disabled_get(eo_next)) break;
1951 } 1953 }
1952 1954
1953 if (!eo_next) return EINA_FALSE; 1955 if (!eo_next)
1956 {
1957 idx = elm_gengrid_item_index_get(eo_orig);
1958 if ((idx == sd->item_count) || ((sd->item_count) % (sd->nmax) == 0))
1959 return EINA_FALSE;
1960 else
1961 eo_next = elm_gengrid_last_item_get(sd->obj);
1962 }
1954 1963
1955 _all_items_deselect(sd); 1964 _all_items_deselect(sd);
1956 elm_gengrid_item_selected_set(eo_next, EINA_TRUE); 1965 elm_gengrid_item_selected_set(eo_next, EINA_TRUE);