summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Atton <jonathan.atton@gmail.com>2009-10-14 21:57:46 +0000
committerJonathan Atton <jonathan.atton@gmail.com>2009-10-14 21:57:46 +0000
commit210396b1af40005eb2b232c996d1f827a8ce6cbb (patch)
tree6d4673fe178b580924dbad70bcf5e4df3951d69f
parent9a0bac43a35b3c49dd084d96a3af74eee2f105c2 (diff)
Elm genlist: add elm_genlist_item_middle_bring_in/show(item)). Elm slideshow : fix a problem with the timer
SVN revision: 43087
-rw-r--r--AUTHORS1
-rw-r--r--src/bin/test_genlist.c2
-rw-r--r--src/lib/Elementary.h.in2
-rw-r--r--src/lib/elm_genlist.c74
-rw-r--r--src/lib/elm_slideshow.c12
5 files changed, 84 insertions, 7 deletions
diff --git a/AUTHORS b/AUTHORS
index 326c10419..7c06ab839 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -8,3 +8,4 @@ Swisscom - http://www.swisscom.ch/
8Christopher Michael <devilhorns@devilhorns.us> 8Christopher Michael <devilhorns@devilhorns.us>
9Marco Trevisan (Treviño) <mail@3v1n0.net> 9Marco Trevisan (Treviño) <mail@3v1n0.net>
10Michael Bouchaud <michael.bouchaud@gmail.com> 10Michael Bouchaud <michael.bouchaud@gmail.com>
11Jonathan Atton (Watchwolf) <jonathan.atton@gmail.com>
diff --git a/src/bin/test_genlist.c b/src/bin/test_genlist.c
index 2fc6eedc4..32d256f64 100644
--- a/src/bin/test_genlist.c
+++ b/src/bin/test_genlist.c
@@ -62,7 +62,7 @@ _bt50_cb(void *data, Evas_Object *obj, void *event_info)
62static void 62static void
63_bt1500_cb(void *data, Evas_Object *obj, void *event_info) 63_bt1500_cb(void *data, Evas_Object *obj, void *event_info)
64{ 64{
65 elm_genlist_item_bring_in(data); 65 elm_genlist_item_middle_bring_in(data);
66} 66}
67 67
68void 68void
diff --git a/src/lib/Elementary.h.in b/src/lib/Elementary.h.in
index 52e84dda3..18098f6c5 100644
--- a/src/lib/Elementary.h.in
+++ b/src/lib/Elementary.h.in
@@ -771,6 +771,8 @@ extern "C" {
771 EAPI void elm_genlist_item_bring_in(Elm_Genlist_Item *item); 771 EAPI void elm_genlist_item_bring_in(Elm_Genlist_Item *item);
772 EAPI void elm_genlist_item_top_show(Elm_Genlist_Item *item); 772 EAPI void elm_genlist_item_top_show(Elm_Genlist_Item *item);
773 EAPI void elm_genlist_item_top_bring_in(Elm_Genlist_Item *item); 773 EAPI void elm_genlist_item_top_bring_in(Elm_Genlist_Item *item);
774 EAPI void elm_genlist_item_middle_show(Elm_Genlist_Item *it);
775 EAPI void elm_genlist_item_middle_bring_in(Elm_Genlist_Item *it);
774 EAPI void elm_genlist_item_del(Elm_Genlist_Item *item); 776 EAPI void elm_genlist_item_del(Elm_Genlist_Item *item);
775 EAPI const void *elm_genlist_item_data_get(const Elm_Genlist_Item *item); 777 EAPI const void *elm_genlist_item_data_get(const Elm_Genlist_Item *item);
776 EAPI void elm_genlist_item_data_set(Elm_Genlist_Item *it, const void *data); 778 EAPI void elm_genlist_item_data_set(Elm_Genlist_Item *it, const void *data);
diff --git a/src/lib/elm_genlist.c b/src/lib/elm_genlist.c
index 846d97b1c..287437564 100644
--- a/src/lib/elm_genlist.c
+++ b/src/lib/elm_genlist.c
@@ -2399,6 +2399,80 @@ elm_genlist_item_top_bring_in(Elm_Genlist_Item *it)
2399} 2399}
2400 2400
2401/** 2401/**
2402 * Show the given item at the middle
2403 *
2404 * This causes genlist to jump to the given item @p it and show it (by scrolling),
2405 * if it is not fully visible.
2406 *
2407 * @param it The item
2408 *
2409 * @ingroup Genlist
2410 */
2411EAPI void
2412elm_genlist_item_middle_show(Elm_Genlist_Item *it)
2413{
2414 Evas_Coord ow, oh;
2415
2416 if (!it) return;
2417 if (it->delete_me) return;
2418 if ((it->queued) || (!it->mincalcd))
2419 {
2420 it->wd->show_item = it;
2421 it->wd->bring_in = 1;
2422 it->showme = EINA_TRUE;
2423 return;
2424 }
2425 if (it->wd->show_item)
2426 {
2427 it->wd->show_item->showme = EINA_FALSE;
2428 it->wd->show_item = NULL;
2429 }
2430 evas_object_geometry_get(it->wd->pan_smart, NULL, NULL, &ow, &oh);
2431 elm_smart_scroller_child_region_show(it->wd->scr,
2432 it->x + it->block->x,
2433 it->y + it->block->y - oh/2 + it->h/2,
2434 it->block->w, oh);
2435}
2436
2437
2438/**
2439 * Bring in the given item at the middle
2440 *
2441 * This causes genlist to jump to the given item @p it and show it (by scrolling),
2442 * if it is not fully visible. This may use animation to do so and take a
2443 * period of time
2444 *
2445 * @param it The item
2446 *
2447 * @ingroup Genlist
2448 */
2449EAPI void
2450elm_genlist_item_middle_bring_in(Elm_Genlist_Item *it)
2451{
2452 Evas_Coord ow, oh;
2453
2454 if (!it) return;
2455 if (it->delete_me) return;
2456 if ((it->queued) || (!it->mincalcd))
2457 {
2458 it->wd->show_item = it;
2459 it->wd->bring_in = 1;
2460 it->showme = EINA_TRUE;
2461 return;
2462 }
2463 if (it->wd->show_item)
2464 {
2465 it->wd->show_item->showme = EINA_FALSE;
2466 it->wd->show_item = NULL;
2467 }
2468 evas_object_geometry_get(it->wd->pan_smart, NULL, NULL, &ow, &oh);
2469 elm_smart_scroller_region_bring_in(it->wd->scr,
2470 it->x + it->block->x,
2471 it->y + it->block->y - oh/2 + it->h/2,
2472 it->block->w, oh);
2473}
2474
2475/**
2402 * Delete a given item 2476 * Delete a given item
2403 * 2477 *
2404 * This deletes the item from genlist and calls the genlist item del class 2478 * This deletes the item from genlist and calls the genlist item del class
diff --git a/src/lib/elm_slideshow.c b/src/lib/elm_slideshow.c
index f38f10f67..3d4c3403b 100644
--- a/src/lib/elm_slideshow.c
+++ b/src/lib/elm_slideshow.c
@@ -276,6 +276,9 @@ elm_slideshow_next(Evas_Object *obj)
276 276
277 _end(obj, obj, NULL, NULL); 277 _end(obj, obj, NULL, NULL);
278 278
279 if (wd->timer) ecore_timer_del(wd->timer);
280 wd->timer = NULL;
281
279 if(!next->o && next->itc->func.get) 282 if(!next->o && next->itc->func.get)
280 { 283 {
281 next->o = next->itc->func.get((void*)next->data, obj); 284 next->o = next->itc->func.get((void*)next->data, obj);
@@ -290,9 +293,6 @@ elm_slideshow_next(Evas_Object *obj)
290 293
291 wd->previous = wd->current; 294 wd->previous = wd->current;
292 wd->current = next; 295 wd->current = next;
293
294 if (wd->timer) ecore_timer_del(wd->timer);
295 wd->timer = NULL;
296} 296}
297 297
298/** 298/**
@@ -321,6 +321,9 @@ elm_slideshow_previous(Evas_Object *obj)
321 321
322 _end(obj, obj, NULL, NULL); 322 _end(obj, obj, NULL, NULL);
323 323
324 if (wd->timer) ecore_timer_del(wd->timer);
325 wd->timer = NULL;
326
324 if(!prev->o && prev->itc->func.get) 327 if(!prev->o && prev->itc->func.get)
325 { 328 {
326 prev->o = prev->itc->func.get((void*)prev->data, obj); 329 prev->o = prev->itc->func.get((void*)prev->data, obj);
@@ -334,9 +337,6 @@ elm_slideshow_previous(Evas_Object *obj)
334 337
335 wd->previous = wd->current; 338 wd->previous = wd->current;
336 wd->current = prev; 339 wd->current = prev;
337
338 if (wd->timer) ecore_timer_del(wd->timer);
339 wd->timer = NULL;
340} 340}
341 341
342/** 342/**