edje: Edje_Edit - add edje_edit_part_item_source functions.

Summary:
Changing item's sources and getting current source of the item.
Add getter and setter for functions with source value in item.
Main functions:
- edje_edit_part_item_source_get
- edje_edit_part_item_source_set

@feature

Reviewers: cedric, Hermet, seoz, raster

CC: reutskiy.v.v, cedric

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

Signed-off-by: Cedric BAIL <c.bail@partner.samsung.com>
This commit is contained in:
Vorobiov Vitalii 2014-06-13 18:02:27 +02:00 committed by Cedric BAIL
parent ad1c183897
commit 246df08184
2 changed files with 92 additions and 1 deletions

View File

@ -1557,7 +1557,7 @@ EAPI Eina_Bool edje_edit_part_drag_threshold_set(Evas_Object *obj, const char *p
* @param obj Object being edited.
* @param part Part to add a new item. This part should have BOX or TABLE type.
* @param item_name Name of new item that is not exist in BOX or TABLE yet.
* @param source_group Source (means group name) of the
* @param source_group Source (means group name) of the new item
*
* @return EINA_TRUE if successful, EINA_FALSE otherwise.
*/
@ -1571,6 +1571,27 @@ 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);
/** Set source for item from table or box items.
*
* @param obj Object being edited.
* @param part Part to change item's source. This part should have BOX or TABLE type.
* @param item_name Name of item.
* @param source_group New gorup name.
*
* @return EINA_TRUE if successful, EINA_FALSE otherwise.
*/
EAPI Eina_Bool edje_edit_part_item_source_set(Evas_Object *obj, const char *part, const char *item_name, const char *source_group);
/** Get source for item from table or box items.
*
* @param obj Object being edited.
* @param part Part to return item's source. This part should have BOX or TABLE type.
* @param item_name Name of item.
*
* @return source of the given item.
*/
EAPI const char * edje_edit_part_item_source_get(Evas_Object *obj, const char *part, const char *item_name);
//@}
/******************************************************************************/
/************************** STATES API ************************************/

View File

@ -3793,6 +3793,76 @@ edje_edit_part_items_list_get(Evas_Object *obj, const char *part)
return items_list;
}
EAPI Eina_Bool
edje_edit_part_item_source_set(Evas_Object *obj, const char *part, const char *item_name, const char *source_group)
{
Edje_Part *ep;
unsigned int i;
Edje_Pack_Element *item;
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;
/* check if a source group is exists. */
if (!eina_hash_find(ed->file->collection, source_group))
return EINA_FALSE;
/* check if item is exists and get it. */
for (i = 0; i < ep->items_count; ++i)
{
if (ep->items[i]->name && (!strcmp(ep->items[i]->name, item_name)))
{
item = ep->items[i];
break;
}
}
if (!item) return EINA_FALSE;
item->source = eina_stringshare_add(source_group);
return EINA_TRUE;
}
EAPI const char *
edje_edit_part_item_source_get(Evas_Object *obj, const char *part, const char *item_name)
{
Edje_Part *ep;
unsigned int i;
Edje_Pack_Element *item;
GET_RP_OR_RETURN(NULL);
/* There is only Box and Table is allowed. */
if ((rp->part->type != EDJE_PART_TYPE_BOX) &&
(rp->part->type != EDJE_PART_TYPE_TABLE))
return NULL;
ep = rp->part;
if (!ed->file) return NULL;
/* check if item is exists and get it. */
for (i = 0; i < ep->items_count; ++i)
{
if (ep->items[i]->name && (!strcmp(ep->items[i]->name, item_name)))
{
item = ep->items[i];
break;
}
}
if (!item) return NULL;
return eina_stringshare_add(item->source);
}
/*********************/
/* PART STATES API */
/*********************/