forked from enlightenment/efl
edje: Edje_Edit - add functions that provide the ability to set and get source for proxy parts state
Summary: This commit contains two new functions that provide the ability to set and get source property of proxy parts state: edje_edit_state_proxy_source_get() and edje_edit_state_proxy_source_set(). Also it contains the implementation of printing source data on edc code generation. @feature Reviewers: cedric, Hermet, seoz, raster, reutskiy.v.v CC: reutskiy.v.v, cedric Differential Revision: https://phab.enlightenment.org/D1061 Signed-off-by: Cedric BAIL <c.bail@partner.samsung.com>
This commit is contained in:
parent
7c8764bf39
commit
244d42b280
|
@ -3519,6 +3519,39 @@ edje_edit_state_map_rotation_center_get(Evas_Object *obj, const char *part, cons
|
||||||
EAPI Eina_Bool
|
EAPI Eina_Bool
|
||||||
edje_edit_state_map_rotation_center_set(Evas_Object *obj, const char *part, const char *state, double value, const char *source_part);
|
edje_edit_state_map_rotation_center_set(Evas_Object *obj, const char *part, const char *state, double value, const char *source_part);
|
||||||
|
|
||||||
|
/** Set the source part for given part state.
|
||||||
|
*
|
||||||
|
* Set source causes the part to use another part content as the content
|
||||||
|
* of this part.
|
||||||
|
*
|
||||||
|
* @param obj Object being edited.
|
||||||
|
* @param part Part that contain state.
|
||||||
|
* @param state The name of the state.
|
||||||
|
* @param value The state value.
|
||||||
|
* @param source_part The name of part to be set as source. If NULL is passed, the source will be unset.
|
||||||
|
*
|
||||||
|
* @return @c EINA_TRUE in case of success, @c EINA_FALSE otherwise.
|
||||||
|
* @see edje_edit_state_proxy_source_get()
|
||||||
|
* @since 1.11
|
||||||
|
*/
|
||||||
|
EAPI Eina_Bool
|
||||||
|
edje_edit_state_proxy_source_set(Evas_Object *obj, const char *part, const char *state, double value, const char *source_name);
|
||||||
|
|
||||||
|
/** Get the source name for given state of part.
|
||||||
|
*
|
||||||
|
* @note The returned string should be freed with @c eina_stringshare_del().
|
||||||
|
* @param obj Object being edited.
|
||||||
|
* @param part Part that contain state.
|
||||||
|
* @param state The name of the state.
|
||||||
|
* @param value The state value.
|
||||||
|
*
|
||||||
|
* @return The name of the source part in case of success. Otherwise returns NULL.
|
||||||
|
* @see edje_edit_state_proxy_source_set()
|
||||||
|
* @since 1.11
|
||||||
|
*/
|
||||||
|
EAPI Eina_Stringshare *
|
||||||
|
edje_edit_state_proxy_source_get(Evas_Object *obj, const char *part, const char *state, double value);
|
||||||
|
|
||||||
//@}
|
//@}
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
/************************** TEXT API ************************************/
|
/************************** TEXT API ************************************/
|
||||||
|
|
|
@ -508,6 +508,21 @@ _edje_part_id_find(Edje *ed, const char *part)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static const char *
|
||||||
|
_edje_part_name_find(Edje *ed, int id)
|
||||||
|
{
|
||||||
|
unsigned int i;
|
||||||
|
if (id < 0) return NULL;
|
||||||
|
|
||||||
|
for (i = 0; i < ed->table_parts_size; i++)
|
||||||
|
{
|
||||||
|
Edje_Real_Part *rp = ed->table_parts[i];
|
||||||
|
if (rp->part->id == id)
|
||||||
|
return rp->part->name;
|
||||||
|
}
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_edje_part_description_id_set(int type, Edje_Part_Description_Common *c, int old_id, int new_id)
|
_edje_part_description_id_set(int type, Edje_Part_Description_Common *c, int old_id, int new_id)
|
||||||
{
|
{
|
||||||
|
@ -6558,6 +6573,41 @@ edje_edit_state_text_size_range_min_max_set(Evas_Object *obj, const char *part,
|
||||||
return EINA_TRUE;
|
return EINA_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
EAPI Eina_Bool
|
||||||
|
edje_edit_state_proxy_source_set(Evas_Object *obj, const char *part, const char *state, double value, const char *source_name)
|
||||||
|
{
|
||||||
|
GET_PD_OR_RETURN(EINA_FALSE);
|
||||||
|
if (rp->part->type != EDJE_PART_TYPE_PROXY)
|
||||||
|
return EINA_FALSE;
|
||||||
|
|
||||||
|
Edje_Part_Description_Proxy *proxy_part = (Edje_Part_Description_Proxy*) pd;
|
||||||
|
|
||||||
|
if (source_name)
|
||||||
|
{
|
||||||
|
int source_id = _edje_part_id_find(ed, source_name);
|
||||||
|
if (source_id < 0)
|
||||||
|
return EINA_FALSE;
|
||||||
|
proxy_part->proxy.id = source_id;
|
||||||
|
}
|
||||||
|
else proxy_part->proxy.id = -1;
|
||||||
|
|
||||||
|
return EINA_TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
EAPI Eina_Stringshare *
|
||||||
|
edje_edit_state_proxy_source_get(Evas_Object *obj, const char *part, const char *state, double value)
|
||||||
|
{
|
||||||
|
GET_PD_OR_RETURN(NULL);
|
||||||
|
if (rp->part->type != EDJE_PART_TYPE_PROXY)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
Edje_Part_Description_Proxy *proxy_part = (Edje_Part_Description_Proxy*) pd;
|
||||||
|
const char * source_name;
|
||||||
|
source_name = _edje_part_name_find(ed, proxy_part->proxy.id);
|
||||||
|
|
||||||
|
return eina_stringshare_add(source_name);
|
||||||
|
}
|
||||||
|
|
||||||
/****************/
|
/****************/
|
||||||
/* IMAGES API */
|
/* IMAGES API */
|
||||||
/****************/
|
/****************/
|
||||||
|
@ -9501,6 +9551,14 @@ _edje_generate_source_of_state(Evas_Object *obj, const char *part, const char *s
|
||||||
|
|
||||||
pro = (Edje_Part_Description_Proxy *) pd;
|
pro = (Edje_Part_Description_Proxy *) pd;
|
||||||
|
|
||||||
|
if (pro->proxy.id >= 0)
|
||||||
|
{
|
||||||
|
const char * source_name;
|
||||||
|
source_name = _edje_part_name_find(ed, pro->proxy.id);
|
||||||
|
if (source_name)
|
||||||
|
BUF_APPENDF(I5"source: \"%s\";\n", source_name);
|
||||||
|
}
|
||||||
|
|
||||||
//Fill
|
//Fill
|
||||||
|
|
||||||
BUF_APPEND(I5"fill {\n");
|
BUF_APPEND(I5"fill {\n");
|
||||||
|
|
Loading…
Reference in New Issue