summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Juyung Seo <seojuyung2@gmail.com>2014-03-24 00:49:06 +0900
committerDaniel Juyung Seo <seojuyung2@gmail.com>2014-03-24 00:49:06 +0900
commitb72db5c1951cc0f27f2235b495f8030b83ae30dc (patch)
treebdd40b13226f63f5d80a7079cc645a1e95256600
parenteb69708e9131a5b3686309862cd20d9ab45ce339 (diff)
genlist: Fixed item multi/single selection routine to skip disabled item
correctly. @fix
-rw-r--r--src/lib/elm_genlist.c56
1 files changed, 42 insertions, 14 deletions
diff --git a/src/lib/elm_genlist.c b/src/lib/elm_genlist.c
index 09e5a7f28..f8d03bda0 100644
--- a/src/lib/elm_genlist.c
+++ b/src/lib/elm_genlist.c
@@ -2334,6 +2334,14 @@ _item_multi_select_up(Elm_Genlist_Smart_Data *sd)
2334 if (!sd->multi) return EINA_FALSE; 2334 if (!sd->multi) return EINA_FALSE;
2335 2335
2336 prev = elm_genlist_item_prev_get(sd->last_selected_item); 2336 prev = elm_genlist_item_prev_get(sd->last_selected_item);
2337 while (prev)
2338 {
2339 if ((((Elm_Gen_Item*)prev)->generation == sd->generation) &&
2340 (!elm_object_item_disabled_get(prev)))
2341 break;
2342 prev = (Elm_Object_Item *)ELM_GEN_ITEM_FROM_INLIST(
2343 EINA_INLIST_GET((Elm_Gen_Item *)prev)->prev);
2344 }
2337 if (!prev) return EINA_TRUE; 2345 if (!prev) return EINA_TRUE;
2338 2346
2339 if (elm_genlist_item_selected_get(prev)) 2347 if (elm_genlist_item_selected_get(prev))
@@ -2358,6 +2366,14 @@ _item_multi_select_down(Elm_Genlist_Smart_Data *sd)
2358 if (!sd->multi) return EINA_FALSE; 2366 if (!sd->multi) return EINA_FALSE;
2359 2367
2360 next = elm_genlist_item_next_get(sd->last_selected_item); 2368 next = elm_genlist_item_next_get(sd->last_selected_item);
2369 while ((next))
2370 {
2371 if ((((Elm_Gen_Item *)next)->generation == sd->generation) &&
2372 (!elm_object_item_disabled_get(next)))
2373 break;
2374 next = (Elm_Object_Item *)ELM_GEN_ITEM_FROM_INLIST(
2375 EINA_INLIST_GET((Elm_Gen_Item *)next)->next);
2376 }
2361 if (!next) return EINA_TRUE; 2377 if (!next) return EINA_TRUE;
2362 2378
2363 if (elm_genlist_item_selected_get(next)) 2379 if (elm_genlist_item_selected_get(next))
@@ -2394,18 +2410,24 @@ _all_items_deselect(Elm_Genlist_Smart_Data *sd)
2394static Eina_Bool 2410static Eina_Bool
2395_item_single_select_up(Elm_Genlist_Smart_Data *sd) 2411_item_single_select_up(Elm_Genlist_Smart_Data *sd)
2396{ 2412{
2397 Elm_Gen_Item *prev; 2413 Elm_Gen_Item *prev = NULL;
2398 2414
2399 if (!sd->selected) 2415 if (!sd->selected)
2400 { 2416 prev = ELM_GEN_ITEM_FROM_INLIST(sd->items->last);
2401 prev = ELM_GEN_ITEM_FROM_INLIST(sd->items->last);
2402 while ((prev) && (prev->generation < sd->generation))
2403 prev = ELM_GEN_ITEM_FROM_INLIST(EINA_INLIST_GET(prev)->prev);
2404 }
2405 else 2417 else
2406 prev = (Elm_Gen_Item *)elm_genlist_item_prev_get 2418 prev = (Elm_Gen_Item *)elm_genlist_item_prev_get
2407 (sd->last_selected_item); 2419 (sd->last_selected_item);
2420
2421 printf("last %p prev %p\n", sd->last_selected_item, prev);
2422 while (prev)
2423 {
2424 if ((prev->generation == sd->generation) &&
2425 (!elm_object_item_disabled_get((Elm_Object_Item *)prev)))
2426 break;
2427 prev = ELM_GEN_ITEM_FROM_INLIST(EINA_INLIST_GET(prev)->prev);
2428 }
2408 2429
2430 printf("prev %p\n", prev);
2409 if (!prev) return EINA_FALSE; 2431 if (!prev) return EINA_FALSE;
2410 2432
2411 _all_items_deselect(sd); 2433 _all_items_deselect(sd);
@@ -2417,17 +2439,23 @@ _item_single_select_up(Elm_Genlist_Smart_Data *sd)
2417static Eina_Bool 2439static Eina_Bool
2418_item_single_select_down(Elm_Genlist_Smart_Data *sd) 2440_item_single_select_down(Elm_Genlist_Smart_Data *sd)
2419{ 2441{
2420 Elm_Gen_Item *next; 2442 Elm_Gen_Item *next = NULL;
2421 2443
2422 if (!sd->selected) 2444 if (!sd->selected)
2445 next = ELM_GEN_ITEM_FROM_INLIST(sd->items);
2446 else
2423 { 2447 {
2424 next = ELM_GEN_ITEM_FROM_INLIST(sd->items); 2448 next = (Elm_Gen_Item *)elm_genlist_item_next_get
2425 while ((next) && (next->generation < sd->generation)) 2449 (sd->last_selected_item);
2426 next = ELM_GEN_ITEM_FROM_INLIST(EINA_INLIST_GET(next)->next); 2450 }
2451
2452 while ((next))
2453 {
2454 if ((next->generation == sd->generation) &&
2455 (!elm_object_item_disabled_get((Elm_Object_Item *)next)))
2456 break;
2457 next = ELM_GEN_ITEM_FROM_INLIST(EINA_INLIST_GET(next)->next);
2427 } 2458 }
2428 else
2429 next = (Elm_Gen_Item *)elm_genlist_item_next_get
2430 (sd->last_selected_item);
2431 2459
2432 if (!next) return EINA_FALSE; 2460 if (!next) return EINA_FALSE;
2433 2461