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:51:09 +0900
commit2f346109d72b5fd2f7e03c8efe94a50fa72c39c4 (patch)
treee94c64da764f901d82bfb48fab918368606756fb
parent7a25d86ce4874b651339f55593240c37d6bc4fec (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 ca933e14b..6473e15de 100644
--- a/src/lib/elm_genlist.c
+++ b/src/lib/elm_genlist.c
@@ -2321,6 +2321,14 @@ _item_multi_select_up(Elm_Genlist_Smart_Data *sd)
2321 if (!sd->multi) return EINA_FALSE; 2321 if (!sd->multi) return EINA_FALSE;
2322 2322
2323 prev = elm_genlist_item_prev_get(sd->last_selected_item); 2323 prev = elm_genlist_item_prev_get(sd->last_selected_item);
2324 while (prev)
2325 {
2326 if ((((Elm_Gen_Item*)prev)->generation == sd->generation) &&
2327 (!elm_object_item_disabled_get(prev)))
2328 break;
2329 prev = (Elm_Object_Item *)ELM_GEN_ITEM_FROM_INLIST(
2330 EINA_INLIST_GET((Elm_Gen_Item *)prev)->prev);
2331 }
2324 if (!prev) return EINA_TRUE; 2332 if (!prev) return EINA_TRUE;
2325 2333
2326 if (elm_genlist_item_selected_get(prev)) 2334 if (elm_genlist_item_selected_get(prev))
@@ -2347,6 +2355,14 @@ _item_multi_select_down(Elm_Genlist_Smart_Data *sd)
2347 if (!sd->multi) return EINA_FALSE; 2355 if (!sd->multi) return EINA_FALSE;
2348 2356
2349 next = elm_genlist_item_next_get(sd->last_selected_item); 2357 next = elm_genlist_item_next_get(sd->last_selected_item);
2358 while ((next))
2359 {
2360 if ((((Elm_Gen_Item *)next)->generation == sd->generation) &&
2361 (!elm_object_item_disabled_get(next)))
2362 break;
2363 next = (Elm_Object_Item *)ELM_GEN_ITEM_FROM_INLIST(
2364 EINA_INLIST_GET((Elm_Gen_Item *)next)->next);
2365 }
2350 if (!next) return EINA_TRUE; 2366 if (!next) return EINA_TRUE;
2351 2367
2352 if (elm_genlist_item_selected_get(next)) 2368 if (elm_genlist_item_selected_get(next))
@@ -2385,18 +2401,24 @@ _all_items_deselect(Elm_Genlist_Smart_Data *sd)
2385static Eina_Bool 2401static Eina_Bool
2386_item_single_select_up(Elm_Genlist_Smart_Data *sd) 2402_item_single_select_up(Elm_Genlist_Smart_Data *sd)
2387{ 2403{
2388 Elm_Gen_Item *prev; 2404 Elm_Gen_Item *prev = NULL;
2389 2405
2390 if (!sd->selected) 2406 if (!sd->selected)
2391 { 2407 prev = ELM_GEN_ITEM_FROM_INLIST(sd->items->last);
2392 prev = ELM_GEN_ITEM_FROM_INLIST(sd->items->last);
2393 while ((prev) && (prev->generation < sd->generation))
2394 prev = ELM_GEN_ITEM_FROM_INLIST(EINA_INLIST_GET(prev)->prev);
2395 }
2396 else 2408 else
2397 prev = (Elm_Gen_Item *)elm_genlist_item_prev_get 2409 prev = (Elm_Gen_Item *)elm_genlist_item_prev_get
2398 (sd->last_selected_item); 2410 (sd->last_selected_item);
2411
2412 printf("last %p prev %p\n", sd->last_selected_item, prev);
2413 while (prev)
2414 {
2415 if ((prev->generation == sd->generation) &&
2416 (!elm_object_item_disabled_get((Elm_Object_Item *)prev)))
2417 break;
2418 prev = ELM_GEN_ITEM_FROM_INLIST(EINA_INLIST_GET(prev)->prev);
2419 }
2399 2420
2421 printf("prev %p\n", prev);
2400 if (!prev) return EINA_FALSE; 2422 if (!prev) return EINA_FALSE;
2401 2423
2402 _all_items_deselect(sd); 2424 _all_items_deselect(sd);
@@ -2409,17 +2431,23 @@ _item_single_select_up(Elm_Genlist_Smart_Data *sd)
2409static Eina_Bool 2431static Eina_Bool
2410_item_single_select_down(Elm_Genlist_Smart_Data *sd) 2432_item_single_select_down(Elm_Genlist_Smart_Data *sd)
2411{ 2433{
2412 Elm_Gen_Item *next; 2434 Elm_Gen_Item *next = NULL;
2413 2435
2414 if (!sd->selected) 2436 if (!sd->selected)
2437 next = ELM_GEN_ITEM_FROM_INLIST(sd->items);
2438 else
2415 { 2439 {
2416 next = ELM_GEN_ITEM_FROM_INLIST(sd->items); 2440 next = (Elm_Gen_Item *)elm_genlist_item_next_get
2417 while ((next) && (next->generation < sd->generation)) 2441 (sd->last_selected_item);
2418 next = ELM_GEN_ITEM_FROM_INLIST(EINA_INLIST_GET(next)->next); 2442 }
2443
2444 while ((next))
2445 {
2446 if ((next->generation == sd->generation) &&
2447 (!elm_object_item_disabled_get((Elm_Object_Item *)next)))
2448 break;
2449 next = ELM_GEN_ITEM_FROM_INLIST(EINA_INLIST_GET(next)->next);
2419 } 2450 }
2420 else
2421 next = (Elm_Gen_Item *)elm_genlist_item_next_get
2422 (sd->last_selected_item);
2423 2451
2424 if (!next) return EINA_FALSE; 2452 if (!next) return EINA_FALSE;
2425 2453