forked from enlightenment/efl
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:
parent
cdc477e2f7
commit
748e548763
|
@ -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);
|
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.
|
/** Set source for item from table or box items.
|
||||||
*
|
*
|
||||||
* @param obj Object being edited.
|
* @param obj Object being edited.
|
||||||
|
|
|
@ -3900,6 +3900,59 @@ edje_edit_part_items_list_get(Evas_Object *obj, const char *part)
|
||||||
return items_list;
|
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
|
EAPI Eina_Bool
|
||||||
edje_edit_part_item_source_set(Evas_Object *obj, const char *part, const char *item_name, const char *source_group)
|
edje_edit_part_item_source_set(Evas_Object *obj, const char *part, const char *item_name, const char *source_group)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue