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 <c.bail@partner.samsung.com>
This commit is contained in:
Igor Gala 2014-06-10 17:21:10 +02:00 committed by Cedric BAIL
parent e15b8c27ac
commit 16d79850a8
2 changed files with 78 additions and 0 deletions

View File

@ -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.

View File

@ -5282,6 +5282,57 @@ 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_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)
{