Elm genlist: add elm_genlist_item_middle_bring_in/show(item)). Elm slideshow : fix a problem with the timer

SVN revision: 43087
This commit is contained in:
Jonathan Atton 2009-10-14 21:57:46 +00:00
parent 015304b20b
commit 947f7ffd37
5 changed files with 84 additions and 7 deletions

View File

@ -8,3 +8,4 @@ Swisscom - http://www.swisscom.ch/
Christopher Michael <devilhorns@devilhorns.us>
Marco Trevisan (Treviño) <mail@3v1n0.net>
Michael Bouchaud <michael.bouchaud@gmail.com>
Jonathan Atton (Watchwolf) <jonathan.atton@gmail.com>

View File

@ -62,7 +62,7 @@ _bt50_cb(void *data, Evas_Object *obj, void *event_info)
static void
_bt1500_cb(void *data, Evas_Object *obj, void *event_info)
{
elm_genlist_item_bring_in(data);
elm_genlist_item_middle_bring_in(data);
}
void

View File

@ -771,6 +771,8 @@ extern "C" {
EAPI void elm_genlist_item_bring_in(Elm_Genlist_Item *item);
EAPI void elm_genlist_item_top_show(Elm_Genlist_Item *item);
EAPI void elm_genlist_item_top_bring_in(Elm_Genlist_Item *item);
EAPI void elm_genlist_item_middle_show(Elm_Genlist_Item *it);
EAPI void elm_genlist_item_middle_bring_in(Elm_Genlist_Item *it);
EAPI void elm_genlist_item_del(Elm_Genlist_Item *item);
EAPI const void *elm_genlist_item_data_get(const Elm_Genlist_Item *item);
EAPI void elm_genlist_item_data_set(Elm_Genlist_Item *it, const void *data);

View File

@ -2398,6 +2398,80 @@ elm_genlist_item_top_bring_in(Elm_Genlist_Item *it)
it->block->w, oh);
}
/**
* Show the given item at the middle
*
* This causes genlist to jump to the given item @p it and show it (by scrolling),
* if it is not fully visible.
*
* @param it The item
*
* @ingroup Genlist
*/
EAPI void
elm_genlist_item_middle_show(Elm_Genlist_Item *it)
{
Evas_Coord ow, oh;
if (!it) return;
if (it->delete_me) return;
if ((it->queued) || (!it->mincalcd))
{
it->wd->show_item = it;
it->wd->bring_in = 1;
it->showme = EINA_TRUE;
return;
}
if (it->wd->show_item)
{
it->wd->show_item->showme = EINA_FALSE;
it->wd->show_item = NULL;
}
evas_object_geometry_get(it->wd->pan_smart, NULL, NULL, &ow, &oh);
elm_smart_scroller_child_region_show(it->wd->scr,
it->x + it->block->x,
it->y + it->block->y - oh/2 + it->h/2,
it->block->w, oh);
}
/**
* Bring in the given item at the middle
*
* This causes genlist to jump to the given item @p it and show it (by scrolling),
* if it is not fully visible. This may use animation to do so and take a
* period of time
*
* @param it The item
*
* @ingroup Genlist
*/
EAPI void
elm_genlist_item_middle_bring_in(Elm_Genlist_Item *it)
{
Evas_Coord ow, oh;
if (!it) return;
if (it->delete_me) return;
if ((it->queued) || (!it->mincalcd))
{
it->wd->show_item = it;
it->wd->bring_in = 1;
it->showme = EINA_TRUE;
return;
}
if (it->wd->show_item)
{
it->wd->show_item->showme = EINA_FALSE;
it->wd->show_item = NULL;
}
evas_object_geometry_get(it->wd->pan_smart, NULL, NULL, &ow, &oh);
elm_smart_scroller_region_bring_in(it->wd->scr,
it->x + it->block->x,
it->y + it->block->y - oh/2 + it->h/2,
it->block->w, oh);
}
/**
* Delete a given item
*

View File

@ -276,6 +276,9 @@ elm_slideshow_next(Evas_Object *obj)
_end(obj, obj, NULL, NULL);
if (wd->timer) ecore_timer_del(wd->timer);
wd->timer = NULL;
if(!next->o && next->itc->func.get)
{
next->o = next->itc->func.get((void*)next->data, obj);
@ -290,9 +293,6 @@ elm_slideshow_next(Evas_Object *obj)
wd->previous = wd->current;
wd->current = next;
if (wd->timer) ecore_timer_del(wd->timer);
wd->timer = NULL;
}
/**
@ -321,6 +321,9 @@ elm_slideshow_previous(Evas_Object *obj)
_end(obj, obj, NULL, NULL);
if (wd->timer) ecore_timer_del(wd->timer);
wd->timer = NULL;
if(!prev->o && prev->itc->func.get)
{
prev->o = prev->itc->func.get((void*)prev->data, obj);
@ -334,9 +337,6 @@ elm_slideshow_previous(Evas_Object *obj)
wd->previous = wd->current;
wd->current = prev;
if (wd->timer) ecore_timer_del(wd->timer);
wd->timer = NULL;
}
/**