edje: Edje_Edit - add edje_edit_part_item_del.

Summary:
Delete exist item from part. This part should have BOX or TABLE type.
In parametr - name of exist item to delete it from BOX or TABLE.

@feature

Reviewers: cedric, Hermet, seoz, raster, reutskiy.v.v

CC: reutskiy.v.v, cedric

Differential Revision: https://phab.enlightenment.org/D1070

Signed-off-by: Cedric BAIL <c.bail@partner.samsung.com>
This commit is contained in:
Maksym Volodin 2014-06-23 11:17:51 +02:00 committed by Cedric BAIL
parent cdc477e2f7
commit 748e548763
2 changed files with 64 additions and 0 deletions

View File

@ -1664,6 +1664,17 @@ EAPI Eina_Bool edje_edit_part_item_append(Evas_Object *obj, const char *part, co
*/
EAPI Eina_List * edje_edit_part_items_list_get(Evas_Object *obj, const char *part);
/** Delete item from box or table part.
*
* @param obj Object being edited.
* @param part Part to delete exist item. This part should have BOX or TABLE type.
* @param item_name Name of exist item to delete it from BOX or TABLE.
*
* @return EINA_TRUE if successful, EINA_FALSE otherwise.
* @since 1.11
*/
EAPI Eina_Bool edje_edit_part_item_del(Evas_Object *obj, const char *part, const char* name);
/** Set source for item from table or box items.
*
* @param obj Object being edited.

View File

@ -3900,6 +3900,59 @@ edje_edit_part_items_list_get(Evas_Object *obj, const char *part)
return items_list;
}
EAPI Eina_Bool
edje_edit_part_item_del(Evas_Object *obj, const char *part, const char* name)
{
Edje_Part *ep;
Edje_Pack_Element *item;
unsigned int i;
GET_RP_OR_RETURN(EINA_FALSE);
/* There is only Box and Table is allowed. */
if ((rp->part->type != EDJE_PART_TYPE_BOX) &&
(rp->part->type != EDJE_PART_TYPE_TABLE))
return EINA_FALSE;
ep = rp->part;
if (!ed->file) return EINA_FALSE;
for (i = 0; i < ep->items_count; ++i)
{
item = ep->items[i];
if (!strcmp(name, item->name))
break;
}
if (i == ep->items_count)
{
WRN("Unable to delete item \"%s\". It does not exist.", name);
return EINA_FALSE;
}
{
Edje_Pack_Element **tmp;
_edje_if_string_free(ed, item->name);
--ep->items_count;
while (i < ep->items_count)
{
ep->items[i] = ep->items[i + 1];
i++;
}
tmp = realloc(ep->items, sizeof(Edje_Pack_Element *) * ep->items_count);
if (!tmp)
{
free(item);
return EINA_FALSE;
}
ep->items = tmp;
}
GET_EED_OR_RETURN(EINA_FALSE);
_edje_edit_flag_script_dirty(eed, EINA_TRUE);
return EINA_TRUE;
}
EAPI Eina_Bool
edje_edit_part_item_source_set(Evas_Object *obj, const char *part, const char *item_name, const char *source_group)
{