forked from enlightenment/efl
elm genlist: Refactoring. Moved code for the readability.
SVN revision: 61983
This commit is contained in:
parent
cfa5ac0daf
commit
48581ff328
|
@ -3453,6 +3453,47 @@ elm_genlist_item_prepend(Evas_Object *obj,
|
|||
return it;
|
||||
}
|
||||
|
||||
EAPI Elm_Genlist_Item *
|
||||
elm_genlist_item_insert_after(Evas_Object *obj,
|
||||
const Elm_Genlist_Item_Class *itc,
|
||||
const void *data,
|
||||
Elm_Genlist_Item *parent,
|
||||
Elm_Genlist_Item *after,
|
||||
Elm_Genlist_Item_Flags flags,
|
||||
Evas_Smart_Cb func,
|
||||
const void *func_data)
|
||||
{
|
||||
ELM_CHECK_WIDTYPE(obj, widtype) NULL;
|
||||
EINA_SAFETY_ON_NULL_RETURN_VAL(after, NULL);
|
||||
Widget_Data *wd = elm_widget_data_get(obj);
|
||||
if (!wd) return NULL;
|
||||
Elm_Genlist_Item *it = _item_new(wd, itc, data, parent, flags, func,
|
||||
func_data);
|
||||
if (!it) return NULL;
|
||||
/* It makes no sense to insert after in an empty list with after != NULL, something really bad is happening in your app. */
|
||||
EINA_SAFETY_ON_NULL_RETURN_VAL(wd->items, NULL);
|
||||
|
||||
if (!it->parent)
|
||||
{
|
||||
if ((flags & ELM_GENLIST_ITEM_GROUP) &&
|
||||
(after->flags & ELM_GENLIST_ITEM_GROUP))
|
||||
wd->group_items = eina_list_append_relative(wd->group_items, it,
|
||||
after);
|
||||
}
|
||||
else
|
||||
{
|
||||
it->parent->items = eina_list_append_relative(it->parent->items, it,
|
||||
after);
|
||||
}
|
||||
wd->items = eina_inlist_append_relative(wd->items, EINA_INLIST_GET(it),
|
||||
EINA_INLIST_GET(after));
|
||||
it->rel = after;
|
||||
it->rel->relcount++;
|
||||
it->before = EINA_FALSE;
|
||||
_item_queue(wd, it);
|
||||
return it;
|
||||
}
|
||||
|
||||
EAPI Elm_Genlist_Item *
|
||||
elm_genlist_item_insert_before(Evas_Object *obj,
|
||||
const Elm_Genlist_Item_Class *itc,
|
||||
|
@ -3587,47 +3628,6 @@ elm_genlist_item_sorted_insert(Evas_Object *obj,
|
|||
_elm_genlist_item_compare_data, func, func_data);
|
||||
}
|
||||
|
||||
EAPI Elm_Genlist_Item *
|
||||
elm_genlist_item_insert_after(Evas_Object *obj,
|
||||
const Elm_Genlist_Item_Class *itc,
|
||||
const void *data,
|
||||
Elm_Genlist_Item *parent,
|
||||
Elm_Genlist_Item *after,
|
||||
Elm_Genlist_Item_Flags flags,
|
||||
Evas_Smart_Cb func,
|
||||
const void *func_data)
|
||||
{
|
||||
ELM_CHECK_WIDTYPE(obj, widtype) NULL;
|
||||
EINA_SAFETY_ON_NULL_RETURN_VAL(after, NULL);
|
||||
Widget_Data *wd = elm_widget_data_get(obj);
|
||||
if (!wd) return NULL;
|
||||
Elm_Genlist_Item *it = _item_new(wd, itc, data, parent, flags, func,
|
||||
func_data);
|
||||
if (!it) return NULL;
|
||||
/* It makes no sense to insert after in an empty list with after != NULL, something really bad is happening in your app. */
|
||||
EINA_SAFETY_ON_NULL_RETURN_VAL(wd->items, NULL);
|
||||
|
||||
if (!it->parent)
|
||||
{
|
||||
if ((flags & ELM_GENLIST_ITEM_GROUP) &&
|
||||
(after->flags & ELM_GENLIST_ITEM_GROUP))
|
||||
wd->group_items = eina_list_append_relative(wd->group_items, it,
|
||||
after);
|
||||
}
|
||||
else
|
||||
{
|
||||
it->parent->items = eina_list_append_relative(it->parent->items, it,
|
||||
after);
|
||||
}
|
||||
wd->items = eina_inlist_append_relative(wd->items, EINA_INLIST_GET(it),
|
||||
EINA_INLIST_GET(after));
|
||||
it->rel = after;
|
||||
it->rel->relcount++;
|
||||
it->before = EINA_FALSE;
|
||||
_item_queue(wd, it);
|
||||
return it;
|
||||
}
|
||||
|
||||
EAPI void
|
||||
elm_genlist_clear(Evas_Object *obj)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue