Merge bring_in, top_bring_in and middle_bring_in into bring_in with ELM_GENLIST_ITEM_SCROLLTO_*.

Signed-off-by: Sanjeev BA <eflelev8@gmail.com>

SVN revision: 68897
This commit is contained in:
Sanjeev BA 2012-03-07 08:29:28 +00:00 committed by Sanjeev BA
parent b2a098dafd
commit 3946d4a76b
5 changed files with 72 additions and 120 deletions

View File

@ -68,7 +68,8 @@ set_api_state(api_data *api)
case TOOLTIP_TEXT_SET: /* 6 */ case TOOLTIP_TEXT_SET: /* 6 */
{ {
elm_genlist_item_tooltip_text_set(elm_genlist_first_item_get(gl), "Tooltip text from API"); elm_genlist_item_tooltip_text_set(elm_genlist_first_item_get(gl), "Tooltip text from API");
elm_genlist_item_bring_in(elm_genlist_first_item_get(gl)); elm_genlist_item_bring_in(elm_genlist_first_item_get(gl),
ELM_GENLIST_ITEM_SCROLLTO_IN);
} }
break; break;
@ -161,7 +162,7 @@ _move(void *data, Evas *evas __UNUSED__, Evas_Object *obj __UNUSED__, void *even
static void static void
_bt50_cb(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) _bt50_cb(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
{ {
elm_genlist_item_bring_in(data); elm_genlist_item_bring_in(data, ELM_GENLIST_ITEM_SCROLLTO_IN);
} }
static void static void

View File

@ -5031,10 +5031,26 @@ EINA_DEPRECATED EAPI void elm_object_tree_unfocusable_set(Evas_O
* *
* @see elm_object_tree_unfocusable_set() * @see elm_object_tree_unfocusable_set()
* *
* @ingroup Focus
* @deprecated Please use elm_object_tree_unfocusable_get() * @deprecated Please use elm_object_tree_unfocusable_get()
*/ */
EINA_DEPRECATED EAPI Eina_Bool elm_object_tree_unfocusable_get(const Evas_Object *obj); EINA_DEPRECATED EAPI Eina_Bool elm_object_tree_unfocusable_get(const Evas_Object *obj);
/**
* Animatedly bring in, to the visible are of a genlist, a given
* item on it.
*
* @deprecated elm_genlist_item_bring_in()
*/
EINA_DEPRECATED EAPI void elm_genlist_item_top_bring_in(Elm_Object_Item *it);
/**
* Animatedly bring in, to the visible are of a genlist, a given
* item on it.
*
* @deprecated elm_genlist_item_bring_in()
*/
EINA_DEPRECATED EAPI void elm_genlist_item_middle_bring_in(Elm_Object_Item *it);
/** /**
* @} * @}
*/ */

View File

@ -14,14 +14,6 @@ typedef struct Elm_Gen_Item_Type Elm_Gen_Item_Type;
typedef struct Elm_Gen_Item_Tooltip Elm_Gen_Item_Tooltip; typedef struct Elm_Gen_Item_Tooltip Elm_Gen_Item_Tooltip;
typedef struct _Widget_Data Widget_Data; typedef struct _Widget_Data Widget_Data;
typedef enum
{
ELM_GENLIST_ITEM_SCROLLTO_NONE = 0, /**< no scrollto */
ELM_GENLIST_ITEM_SCROLLTO_IN = (1 << 0), /**< show, bring in */
ELM_GENLIST_ITEM_SCROLLTO_TOP = (1 << 1), /**< top show, top bring in */
ELM_GENLIST_ITEM_SCROLLTO_MIDDLE = (1 << 2) /**< middle show, middle bring in */
} Elm_Genlist_Item_Scrollto_Type;
struct Elm_Gen_Item_Tooltip struct Elm_Gen_Item_Tooltip
{ {
const void *data; const void *data;

View File

@ -349,7 +349,7 @@ _event_hook(Evas_Object *obj,
else if ((!strcmp(ev->keyname, "Home")) || (!strcmp(ev->keyname, "KP_Home"))) else if ((!strcmp(ev->keyname, "Home")) || (!strcmp(ev->keyname, "KP_Home")))
{ {
it = elm_genlist_first_item_get(obj); it = elm_genlist_first_item_get(obj);
elm_genlist_item_bring_in(it); elm_genlist_item_bring_in(it, ELM_GENLIST_ITEM_SCROLLTO_IN);
elm_genlist_item_selected_set(it, EINA_TRUE); elm_genlist_item_selected_set(it, EINA_TRUE);
ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD; ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
return EINA_TRUE; return EINA_TRUE;
@ -357,7 +357,7 @@ _event_hook(Evas_Object *obj,
else if ((!strcmp(ev->keyname, "End")) || (!strcmp(ev->keyname, "KP_End"))) else if ((!strcmp(ev->keyname, "End")) || (!strcmp(ev->keyname, "KP_End")))
{ {
it = elm_genlist_last_item_get(obj); it = elm_genlist_last_item_get(obj);
elm_genlist_item_bring_in(it); elm_genlist_item_bring_in(it, ELM_GENLIST_ITEM_SCROLLTO_IN);
elm_genlist_item_selected_set(it, EINA_TRUE); elm_genlist_item_selected_set(it, EINA_TRUE);
ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD; ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
return EINA_TRUE; return EINA_TRUE;
@ -4767,17 +4767,19 @@ elm_genlist_item_demote(Elm_Object_Item *it)
} }
EAPI void EAPI void
elm_genlist_item_bring_in(Elm_Object_Item *it) elm_genlist_item_bring_in(Elm_Object_Item *it, Elm_Genlist_Item_Scrollto_Type type)
{ {
ELM_OBJ_ITEM_CHECK_OR_RETURN(it); ELM_OBJ_ITEM_CHECK_OR_RETURN(it);
Elm_Gen_Item *_it = (Elm_Gen_Item *)it; Elm_Gen_Item *_it = (Elm_Gen_Item *)it;
Evas_Coord x, y, w, h;
Evas_Coord gith = 0; Evas_Coord gith = 0;
if (_it->generation < _it->wd->generation) return; if (_it->generation < _it->wd->generation) return;
if ((_it->item->queued) || (!_it->item->mincalcd)) if ((_it->item->queued) || (!_it->item->mincalcd))
{ {
_it->wd->show_item = _it; _it->wd->show_item = _it;
_it->wd->bring_in = EINA_TRUE; _it->wd->bring_in = EINA_TRUE;
_it->wd->scrollto_type = ELM_GENLIST_ITEM_SCROLLTO_IN; _it->wd->scrollto_type = type;
_it->item->showme = EINA_TRUE; _it->item->showme = EINA_TRUE;
return; return;
} }
@ -4786,13 +4788,34 @@ elm_genlist_item_bring_in(Elm_Object_Item *it)
_it->wd->show_item->item->showme = EINA_FALSE; _it->wd->show_item->item->showme = EINA_FALSE;
_it->wd->show_item = NULL; _it->wd->show_item = NULL;
} }
if ((_it->item->group_item) &&
(_it->wd->pan_y > (_it->y + _it->item->block->y))) x = _it->x + _it->item->block->x;
gith = _it->item->group_item->item->h; if (type==ELM_GENLIST_ITEM_SCROLLTO_IN)
elm_smart_scroller_region_bring_in(_it->wd->scr, {
_it->x + _it->item->block->x, if ((_it->item->group_item) &&
_it->y + _it->item->block->y - gith, (_it->wd->pan_y > (_it->y + _it->item->block->y)))
_it->item->block->w, _it->item->h); gith = _it->item->group_item->item->h;
w = _it->item->block->w;
h = _it->item->h;
y = _it->y + _it->item->block->y - gith;
}
else if (type==ELM_GENLIST_ITEM_SCROLLTO_TOP)
{
evas_object_geometry_get(_it->wd->pan_smart, NULL, NULL, &w, &h);
if (_it->item->group_item) gith = _it->item->group_item->item->h;
y = _it->y + _it->item->block->y - gith;
}
else if (type==ELM_GENLIST_ITEM_SCROLLTO_MIDDLE)
{
evas_object_geometry_get(_it->wd->pan_smart, NULL, NULL, &w, &h);
w = _it->item->block->w;
y = _it->y + _it->item->block->y - h / 2 + _it->item->h / 2;
}
else
return;
elm_smart_scroller_region_bring_in(_it->wd->scr,x, y, w, h);
} }
EAPI void EAPI void
@ -4828,31 +4851,7 @@ elm_genlist_item_top_show(Elm_Object_Item *it)
EAPI void EAPI void
elm_genlist_item_top_bring_in(Elm_Object_Item *it) elm_genlist_item_top_bring_in(Elm_Object_Item *it)
{ {
ELM_OBJ_ITEM_CHECK_OR_RETURN(it); elm_genlist_item_bring_in(it, ELM_GENLIST_ITEM_SCROLLTO_TOP);
Elm_Gen_Item *_it = (Elm_Gen_Item *)it;
Evas_Coord ow, oh;
Evas_Coord gith = 0;
if (_it->generation < _it->wd->generation) return;
if ((_it->item->queued) || (!_it->item->mincalcd))
{
_it->wd->show_item = _it;
_it->wd->bring_in = EINA_TRUE;
_it->wd->scrollto_type = ELM_GENLIST_ITEM_SCROLLTO_TOP;
_it->item->showme = EINA_TRUE;
return;
}
if (_it->wd->show_item)
{
_it->wd->show_item->item->showme = EINA_FALSE;
_it->wd->show_item = NULL;
}
evas_object_geometry_get(_it->wd->pan_smart, NULL, NULL, &ow, &oh);
if (_it->item->group_item) gith = _it->item->group_item->item->h;
elm_smart_scroller_region_bring_in(_it->wd->scr,
_it->x + _it->item->block->x,
_it->y + _it->item->block->y - gith,
_it->item->block->w, oh);
} }
EAPI void EAPI void
@ -4887,30 +4886,7 @@ elm_genlist_item_middle_show(Elm_Object_Item *it)
EAPI void EAPI void
elm_genlist_item_middle_bring_in(Elm_Object_Item *it) elm_genlist_item_middle_bring_in(Elm_Object_Item *it)
{ {
ELM_OBJ_ITEM_CHECK_OR_RETURN(it); elm_genlist_item_bring_in(it, ELM_GENLIST_ITEM_SCROLLTO_MIDDLE);
Elm_Gen_Item *_it = (Elm_Gen_Item *)it;
Evas_Coord ow, oh;
if (_it->generation < _it->wd->generation) return;
if ((_it->item->queued) || (!_it->item->mincalcd))
{
_it->wd->show_item = _it;
_it->wd->bring_in = EINA_TRUE;
_it->wd->scrollto_type = ELM_GENLIST_ITEM_SCROLLTO_MIDDLE;
_it->item->showme = EINA_TRUE;
return;
}
if (_it->wd->show_item)
{
_it->wd->show_item->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->item->block->x,
_it->y + _it->item->block->y - oh / 2 +
_it->item->h / 2, _it->item->block->w,
oh);
} }
EINA_DEPRECATED EAPI void EINA_DEPRECATED EAPI void

View File

@ -354,7 +354,7 @@
* *
* @ingroup Genlist * @ingroup Genlist
*/ */
typedef enum typedef enum
{ {
ELM_GENLIST_ITEM_NONE = 0, /**< simple item */ ELM_GENLIST_ITEM_NONE = 0, /**< simple item */
//XXX: ELM_GENLIST_ITEM_TREE //XXX: ELM_GENLIST_ITEM_TREE
@ -372,6 +372,14 @@ typedef enum
ELM_GENLIST_ITEM_FIELD_STATE = (1 << 2) ELM_GENLIST_ITEM_FIELD_STATE = (1 << 2)
} Elm_Genlist_Item_Field_Type; } Elm_Genlist_Item_Field_Type;
typedef enum
{
ELM_GENLIST_ITEM_SCROLLTO_NONE = 0, /**< no scrollto */
ELM_GENLIST_ITEM_SCROLLTO_IN = (1 << 0), /**< show, bring in */
ELM_GENLIST_ITEM_SCROLLTO_TOP = (1 << 1), /**< top show, top bring in */
ELM_GENLIST_ITEM_SCROLLTO_MIDDLE = (1 << 2) /**< middle show, middle bring in */
} Elm_Genlist_Item_Scrollto_Type;
/** /**
* @see Elm_Gen_Item_Class * @see Elm_Gen_Item_Class
*/ */
@ -918,19 +926,18 @@ EAPI void elm_genlist_item_show(Elm_Object_Item *it);
* item on it. * item on it.
* *
* @param it The item to display * @param it The item to display
* @param type The position to bring in, the given item to.
* @ref Elm_Genlist_Item_Scrollto_Type
* *
* This causes genlist to jump to the given item @p it and show it (by * This causes genlist to jump to the given item @p it and show it (by
* animatedly scrolling), if it is not fully visible. This may use animation * animatedly scrolling), if it is not fully visible.
* to do so and take a period of time * This may use animation and take a some time to do so.
* *
* @see elm_genlist_item_show() * @see elm_genlist_item_show()
* @see elm_genlist_item_top_bring_in()
* @see elm_genlist_item_middle_bring_in()
* *
* @ingroup Genlist * @ingroup Genlist
*/ */
//XXX: elm_genlist_item_bring_in(it, TOP/MIDDLE/BOTTOM/...); this kind of API would cover all similar APIs - bring_in, top_bring_in ... EAPI void elm_genlist_item_bring_in(Elm_Object_Item *it, Elm_Genlist_Item_Scrollto_Type type);
EAPI void elm_genlist_item_bring_in(Elm_Object_Item *it);
/** /**
* Show the portion of a genlist's internal list containing a given * Show the portion of a genlist's internal list containing a given
@ -944,33 +951,13 @@ EAPI void elm_genlist_item_bring_in(Elm_Object_Item *it
* The item will be positioned at the top of the genlist viewport. * The item will be positioned at the top of the genlist viewport.
* *
* @see elm_genlist_item_show() * @see elm_genlist_item_show()
* @see elm_genlist_item_top_bring_in() * @see elm_genlist_item_bring_in()
* *
* @ingroup Genlist * @ingroup Genlist
*/ */
//XXX: elm_genlist_item_show(it, TOP/MIDDLE/BOTTOM/...); this kind of API would cover all similar APIs - item_show, item_top_show... //XXX: elm_genlist_item_show(it, TOP/MIDDLE/BOTTOM/...); this kind of API would cover all similar APIs - item_show, item_top_show...
EAPI void elm_genlist_item_top_show(Elm_Object_Item *it); EAPI void elm_genlist_item_top_show(Elm_Object_Item *it);
/**
* Animatedly bring in, to the visible are of a genlist, a given
* item on it.
*
* @param it The item
*
* This causes genlist to jump to the given item @p it and show it (by
* animatedly scrolling), if it is not fully visible. This may use animation
* to do so and take a period of time
*
* The item will be positioned at the top of the genlist viewport.
*
* @see elm_genlist_item_bring_in()
* @see elm_genlist_item_top_show()
*
* @ingroup Genlist
*/
//XXX: elm_genlist_item_bring_in(it, TOP/MIDDLE/BOTTOM/...); this kind of API would cover all similar APIs - bring_in, top_bring_in ...
EAPI void elm_genlist_item_top_bring_in(Elm_Object_Item *it);
/** /**
* Show the portion of a genlist's internal list containing a given * Show the portion of a genlist's internal list containing a given
* item, immediately. * item, immediately.
@ -983,33 +970,13 @@ EAPI void elm_genlist_item_top_bring_in(Elm_Object_Item
* The item will be positioned at the middle of the genlist viewport. * The item will be positioned at the middle of the genlist viewport.
* *
* @see elm_genlist_item_show() * @see elm_genlist_item_show()
* @see elm_genlist_item_middle_bring_in() * @see elm_genlist_item_bring_in()
* *
* @ingroup Genlist * @ingroup Genlist
*/ */
//XXX: elm_genlist_item_show(it, TOP/MIDDLE/BOTTOM/...); this kind of API would cover all similar APIs - item_show, item_top_show... //XXX: elm_genlist_item_show(it, TOP/MIDDLE/BOTTOM/...); this kind of API would cover all similar APIs - item_show, item_top_show...
EAPI void elm_genlist_item_middle_show(Elm_Object_Item *it); EAPI void elm_genlist_item_middle_show(Elm_Object_Item *it);
/**
* Animatedly bring in, to the visible are of a genlist, a given
* item on it.
*
* @param it The item
*
* This causes genlist to jump to the given item @p it and show it (by
* animatedly scrolling), if it is not fully visible. This may use animation
* to do so and take a period of time
*
* The item will be positioned at the middle of the genlist viewport.
*
* @see elm_genlist_item_bring_in()
* @see elm_genlist_item_middle_show()
*
* @ingroup Genlist
*/
//XXX: elm_genlist_item_bring_in(it, TOP/MIDDLE/BOTTOM/...); this kind of API would cover all similar APIs - bring_in, top_bring_in ...
EAPI void elm_genlist_item_middle_bring_in(Elm_Object_Item *it);
/** /**
* Update the contents of an item * Update the contents of an item
* *