edje: edje_edit - adding getter and setter for text source

This commit will add API for working with text source.
There are two functions will be added:

1. edje_edit_state_text_source_get
2. edje_edit_state_text_source_set

Reviewers: cedric, seoz, raster

CC: cedric

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

Signed-off-by: Cedric BAIL <cedric.bail@samsung.com>
This commit is contained in:
Vyacheslav Reutskiy 2013-12-19 15:33:53 +09:00 committed by Cedric BAIL
parent 0ad1dfe4e5
commit 811c97eabb
2 changed files with 67 additions and 0 deletions

View File

@ -2706,6 +2706,33 @@ edje_edit_state_text_style_get(Evas_Object *obj, const char *part, const char *s
EAPI Eina_Bool
edje_edit_state_text_style_set(Evas_Object *obj, const char *part, const char *state, double value, const char *style);
/** Get part name, which used as text source.
*
* @param obj Object being edited.
* @param part Part that contain state.
* @param state The name of the state to set the the maximum vertical size of
* the container to be equal (not including the state value).
*
* @return The name of part or NULL, if text_source param not a setted.
*/
EAPI const char *
edje_edit_state_text_source_get(Evas_Object *obj, const char *part, const char *state, double value);
/** Set the source text part for a given part.
* Causes the part to display the text content of another part and update them
* as they change.
*
* @param obj Object being edited.
* @param part Part that contain state.
* @param state The name of the state to set the the maximum vertical size of
* the container to be equal (not including the state value).
* @param source The text source part name.
*
* @return EINA_TRUE if successful, EINA_FALSE - otherwise.
*/
EAPI Eina_Bool
edje_edit_state_text_source_set(Evas_Object *obj, const char *part, const char *state, double value, const char *source);
/** Get the list of all the fonts in the given edje.
*
* Use edje_edit_string_list_free() when you don't need the list anymore.

View File

@ -4652,6 +4652,46 @@ edje_edit_part_effect_set(Evas_Object *obj, const char *part, Edje_Text_Effect e
return EINA_TRUE;
}
EAPI const char *
edje_edit_state_text_source_get(Evas_Object *obj, const char *part, const char *state, double value)
{
Edje_Real_Part *rel;
GET_PD_OR_RETURN(NULL);
if ((rp->part->type == EDJE_PART_TYPE_TEXT) ||
(rp->part->type == EDJE_PART_TYPE_TEXTBLOCK))
{
Edje_Part_Description_Text *txt;
txt = (Edje_Part_Description_Text *) pd;
if (txt->text.id_text_source == -1) return NULL;
rel = ed->table_parts[txt->text.id_text_source % ed->table_parts_size];
if (rel->part->name) return eina_stringshare_add(rel->part->name);
}
return NULL;
}
EAPI Eina_Bool
edje_edit_state_text_source_set(Evas_Object *obj, const char *part, const char *state, double value, const char *source)
{
Edje_Part_Description_Text *txt;
int id_text_source;
GET_PD_OR_RETURN(EINA_FALSE);
if (!source) return EINA_FALSE;
if ((rp->part->type != EDJE_PART_TYPE_TEXT) ||
(rp->part->type != EDJE_PART_TYPE_TEXTBLOCK))
return EINA_FALSE;
txt = (Edje_Part_Description_Text *) pd;
id_text_source = _edje_part_id_find(ed, source);
txt->text.id_text_source = id_text_source;
/* need to recalc, because the source part can has a text */
edje_object_calc_force(obj);
return EINA_TRUE;
}
/****************/
/* IMAGES API */
/****************/