summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorAmitesh Singh <amitesh.sh@samsung.com>2014-04-27 13:08:15 +0900
committerDaniel Juyung Seo <seojuyung2@gmail.com>2014-04-27 13:08:15 +0900
commit5047cbcca6f4cbc82e05148a3b23c67f5a975e99 (patch)
tree985756e1beb07ebffaa059a2bb80ab2d6b402293 /src/lib
parentbe41ea4bd466f686d2410b187bfeeb3c344537b5 (diff)
gengrid: Implemented item_select_on_focus feature.
Summary: This is based on bb1e8afd. @feature Test Plan: elementary_test->"Gengrid Focus" Reviewers: seoz, raster CC: seoz Differential Revision: https://phab.enlightenment.org/D702
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/elm_gengrid.c91
1 files changed, 67 insertions, 24 deletions
diff --git a/src/lib/elm_gengrid.c b/src/lib/elm_gengrid.c
index bfcecaebf..72b531e94 100644
--- a/src/lib/elm_gengrid.c
+++ b/src/lib/elm_gengrid.c
@@ -1536,8 +1536,6 @@ _elm_gengrid_item_unfocused(Elm_Gen_Item *it)
1536 evas_object_smart_callback_call(obj, SIG_ITEM_UNFOCUSED, it); 1536 evas_object_smart_callback_call(obj, SIG_ITEM_UNFOCUSED, it);
1537} 1537}
1538 1538
1539/* NOTE: this code will be used later when the item selection on key press
1540 becomes optional. So do not remove this.
1541static Eina_Bool 1539static Eina_Bool
1542_item_focus_up(Elm_Gengrid_Data *sd) 1540_item_focus_up(Elm_Gengrid_Data *sd)
1543{ 1541{
@@ -1652,7 +1650,6 @@ _item_focus_right(Elm_Gengrid_Data *sd)
1652 1650
1653 return EINA_TRUE; 1651 return EINA_TRUE;
1654} 1652}
1655*/
1656 1653
1657static Eina_Bool 1654static Eina_Bool
1658_item_multi_select_left(Elm_Gengrid_Data *sd) 1655_item_multi_select_left(Elm_Gengrid_Data *sd)
@@ -2200,15 +2197,25 @@ _key_action_move(Evas_Object *obj, const char *params)
2200 } 2197 }
2201 if (sd->horizontal) 2198 if (sd->horizontal)
2202 { 2199 {
2203 if (_item_single_select_up(sd)) return EINA_TRUE; 2200 if (!_elm_config->item_select_on_focus_disable)
2204 else return EINA_FALSE; 2201 {
2202 if (_item_single_select_up(sd)) return EINA_TRUE;
2203 else return EINA_FALSE;
2204 }
2205 else
2206 return _item_focus_up(sd);
2205 } 2207 }
2206 else 2208 else
2207 { 2209 {
2208 if (_elm_gengrid_item_edge_check(sd->focused_item, ELM_FOCUS_LEFT)) 2210 if (_elm_gengrid_item_edge_check(sd->focused_item, ELM_FOCUS_LEFT))
2209 return EINA_FALSE; 2211 return EINA_FALSE;
2210 if (_item_single_select_left(sd)) return EINA_TRUE; 2212 if (!_elm_config->item_select_on_focus_disable)
2211 else return EINA_FALSE; 2213 {
2214 if (_item_single_select_left(sd)) return EINA_TRUE;
2215 else return EINA_FALSE;
2216 }
2217 else
2218 return _item_focus_left(sd);
2212 } 2219 }
2213 } 2220 }
2214 else if (!strcmp(dir, "left_multi")) 2221 else if (!strcmp(dir, "left_multi"))
@@ -2248,15 +2255,25 @@ _key_action_move(Evas_Object *obj, const char *params)
2248 } 2255 }
2249 if (sd->horizontal) 2256 if (sd->horizontal)
2250 { 2257 {
2251 if (_item_single_select_down(sd)) return EINA_TRUE; 2258 if (!_elm_config->item_select_on_focus_disable)
2252 else return EINA_FALSE; 2259 {
2260 if (_item_single_select_down(sd)) return EINA_TRUE;
2261 else return EINA_FALSE;
2262 }
2263 else
2264 return _item_focus_down(sd);
2253 } 2265 }
2254 else 2266 else
2255 { 2267 {
2256 if (_elm_gengrid_item_edge_check(sd->focused_item, ELM_FOCUS_RIGHT)) 2268 if (_elm_gengrid_item_edge_check(sd->focused_item, ELM_FOCUS_RIGHT))
2257 return EINA_FALSE; 2269 return EINA_FALSE;
2258 if (_item_single_select_right(sd)) return EINA_TRUE; 2270 if (!_elm_config->item_select_on_focus_disable)
2259 else return EINA_FALSE; 2271 {
2272 if (_item_single_select_right(sd)) return EINA_TRUE;
2273 else return EINA_FALSE;
2274 }
2275 else
2276 return _item_focus_right(sd);
2260 } 2277 }
2261 } 2278 }
2262 else if (!strcmp(dir, "right_multi")) 2279 else if (!strcmp(dir, "right_multi"))
@@ -2298,13 +2315,23 @@ _key_action_move(Evas_Object *obj, const char *params)
2298 { 2315 {
2299 if (_elm_gengrid_item_edge_check(sd->focused_item, ELM_FOCUS_UP)) 2316 if (_elm_gengrid_item_edge_check(sd->focused_item, ELM_FOCUS_UP))
2300 return EINA_FALSE; 2317 return EINA_FALSE;
2301 if (_item_single_select_left(sd)) return EINA_TRUE; 2318 if (!_elm_config->item_select_on_focus_disable)
2302 else return EINA_FALSE; 2319 {
2320 if (_item_single_select_left(sd)) return EINA_TRUE;
2321 else return EINA_FALSE;
2322 }
2323 else
2324 return _item_focus_left(sd);
2303 } 2325 }
2304 else 2326 else
2305 { 2327 {
2306 if (_item_single_select_up(sd)) return EINA_TRUE; 2328 if (!_elm_config->item_select_on_focus_disable)
2307 else return EINA_FALSE; 2329 {
2330 if (_item_single_select_up(sd)) return EINA_TRUE;
2331 else return EINA_FALSE;
2332 }
2333 else
2334 return _item_focus_up(sd);
2308 } 2335 }
2309 } 2336 }
2310 else if (!strcmp(dir, "up_multi")) 2337 else if (!strcmp(dir, "up_multi"))
@@ -2346,13 +2373,23 @@ _key_action_move(Evas_Object *obj, const char *params)
2346 { 2373 {
2347 if (_elm_gengrid_item_edge_check(sd->focused_item, ELM_FOCUS_DOWN)) 2374 if (_elm_gengrid_item_edge_check(sd->focused_item, ELM_FOCUS_DOWN))
2348 return EINA_FALSE; 2375 return EINA_FALSE;
2349 if (_item_single_select_right(sd)) return EINA_TRUE; 2376 if (!_elm_config->item_select_on_focus_disable)
2350 else return EINA_FALSE; 2377 {
2378 if (_item_single_select_right(sd)) return EINA_TRUE;
2379 else return EINA_FALSE;
2380 }
2381 else
2382 return _item_focus_right(sd);
2351 } 2383 }
2352 else 2384 else
2353 { 2385 {
2354 if (_item_single_select_down(sd)) return EINA_TRUE; 2386 if (!_elm_config->item_select_on_focus_disable)
2355 else return EINA_FALSE; 2387 {
2388 if (_item_single_select_down(sd)) return EINA_TRUE;
2389 else return EINA_FALSE;
2390 }
2391 else
2392 return _item_focus_down(sd);
2356 } 2393 }
2357 } 2394 }
2358 else if (!strcmp(dir, "down_multi")) 2395 else if (!strcmp(dir, "down_multi"))
@@ -2375,13 +2412,19 @@ _key_action_move(Evas_Object *obj, const char *params)
2375 else if (!strcmp(dir, "first")) 2412 else if (!strcmp(dir, "first"))
2376 { 2413 {
2377 it = elm_gengrid_first_item_get(obj); 2414 it = elm_gengrid_first_item_get(obj);
2378 elm_gengrid_item_selected_set(it, EINA_TRUE); 2415 if (!_elm_config->item_select_on_focus_disable)
2416 elm_gengrid_item_selected_set(it, EINA_TRUE);
2417 else
2418 elm_object_item_focus_set(it, EINA_TRUE);
2379 return EINA_TRUE; 2419 return EINA_TRUE;
2380 } 2420 }
2381 else if (!strcmp(dir, "last")) 2421 else if (!strcmp(dir, "last"))
2382 { 2422 {
2383 it = elm_gengrid_last_item_get(obj); 2423 it = elm_gengrid_last_item_get(obj);
2384 elm_gengrid_item_selected_set(it, EINA_TRUE); 2424 if (!_elm_config->item_select_on_focus_disable)
2425 elm_gengrid_item_selected_set(it, EINA_TRUE);
2426 else
2427 elm_object_item_focus_set(it, EINA_TRUE);
2385 return EINA_TRUE; 2428 return EINA_TRUE;
2386 } 2429 }
2387 else if (!strcmp(dir, "prior")) 2430 else if (!strcmp(dir, "prior"))
@@ -2430,9 +2473,9 @@ _key_action_select(Evas_Object *obj, const char *params EINA_UNUSED)
2430 ELM_GENGRID_DATA_GET(obj, sd); 2473 ELM_GENGRID_DATA_GET(obj, sd);
2431 Elm_Object_Item *it = NULL; 2474 Elm_Object_Item *it = NULL;
2432 2475
2433 if ((!sd->multi) && (sd->selected)) 2476 if (!sd->multi)
2434 { 2477 {
2435 it = elm_gengrid_selected_item_get(obj); 2478 it = elm_object_focused_item_get(obj);
2436 evas_object_smart_callback_call(WIDGET(it), SIG_ACTIVATED, it); 2479 evas_object_smart_callback_call(WIDGET(it), SIG_ACTIVATED, it);
2437 return EINA_TRUE; 2480 return EINA_TRUE;
2438 } 2481 }
@@ -2551,7 +2594,7 @@ _elm_gengrid_elm_widget_on_focus(Eo *obj, Elm_Gengrid_Data *sd)
2551 it = _elm_gengrid_nearest_visible_item_get(obj, it); 2594 it = _elm_gengrid_nearest_visible_item_get(obj, it);
2552 if (it) 2595 if (it)
2553 { 2596 {
2554 if (is_sel) 2597 if (!_elm_config->item_select_on_focus_disable && is_sel)
2555 elm_gengrid_item_selected_set(it, EINA_TRUE); 2598 elm_gengrid_item_selected_set(it, EINA_TRUE);
2556 else 2599 else
2557 elm_object_item_focus_set(it, EINA_TRUE); 2600 elm_object_item_focus_set(it, EINA_TRUE);