cedric pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=16d79850a80ce46a8bc612edfb08220a96ff6484
commit 16d79850a80ce46a8bc612edfb08220a96ff6484 Author: Igor Gala <[email protected]> Date: Tue Jun 10 17:21:10 2014 +0200 edje: Edje_Edit - edje_edit_state_text_text_source_xeg() Summary: There are new 'get and set' API for block 'text.source'. Those function return or set the name of part which is source of text for given part. @feature Reviewers: seoz, Hermet, cedric, raster CC: reutskiy.v.v, cedric Differential Revision: https://phab.enlightenment.org/D979 Signed-off-by: Cedric BAIL <[email protected]> --- src/lib/edje/Edje_Edit.h | 27 +++++++++++++++++++++++++ src/lib/edje/edje_edit.c | 51 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 78 insertions(+) diff --git a/src/lib/edje/Edje_Edit.h b/src/lib/edje/Edje_Edit.h index 6fcd59d..5f98856 100644 --- a/src/lib/edje/Edje_Edit.h +++ b/src/lib/edje/Edje_Edit.h @@ -3042,6 +3042,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_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 content text 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_text_source_set(Evas_Object *obj, const char *part, const char *state, double value, const char *source); + /** Get part name, which used as style text source. * * @param obj Object being edited. diff --git a/src/lib/edje/edje_edit.c b/src/lib/edje/edje_edit.c index 7e4e2e4..d8a28a9 100644 --- a/src/lib/edje/edje_edit.c +++ b/src/lib/edje/edje_edit.c @@ -5283,6 +5283,57 @@ edje_edit_part_effect_set(Evas_Object *obj, const char *part, Edje_Text_Effect e } EAPI const char * +edje_edit_state_text_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_text_source_set(Evas_Object *obj, const char *part, const char *state, double value, const char *source) +{ + Edje_Part_Description_Common *spd; + Edje_Part_Description_Text *txt, *source_txt; + const char *text_source; + int id_text_source; + + if (!source) return EINA_FALSE; + GET_PD_OR_RETURN(EINA_FALSE); + + if ((rp->part->type != EDJE_PART_TYPE_TEXT) && + (rp->part->type != EDJE_PART_TYPE_TEXTBLOCK)) + return EINA_FALSE; + + spd = _edje_part_description_find_byname(eed, source, state, value); + txt = (Edje_Part_Description_Text *) pd; + source_txt = (Edje_Part_Description_Text *) spd; + + id_text_source = _edje_part_id_find(ed, source); + txt->text.id_text_source = id_text_source; + + text_source = source_txt->text.text.str; + _edje_if_string_free(ed, txt->text.text.str); + txt->text.text.str = eina_stringshare_add(text_source); + txt->text.text.id = 0; + + edje_object_calc_force(obj); + 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; --
