cedric pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=e1b4c70f3d47f053dbf560e80377d632df700443
commit e1b4c70f3d47f053dbf560e80377d632df700443 Author: Igor Gala <[email protected]> Date: Tue Jun 10 17:12:57 2014 +0200 edje: Edje_Edit - edje_edit_state_text_class_xet() Summary: There are new 'get and set' API for block 'text_class'. Those function return or set the name of text class which would be used similar to color_class, this is the name used by the application to alter the font family and size at runtime. @feature Reviewers: seoz, Hermet, cedric, raster CC: reutskiy.v.v, cedric Differential Revision: https://phab.enlightenment.org/D989 Signed-off-by: Cedric BAIL <[email protected]> --- src/lib/edje/Edje_Edit.h | 25 +++++++++++++++++++++++++ src/lib/edje/edje_edit.c | 31 ++++++++++++++++++++++++++++++- 2 files changed, 55 insertions(+), 1 deletion(-) diff --git a/src/lib/edje/Edje_Edit.h b/src/lib/edje/Edje_Edit.h index 4398fbe..3b59ec6 100644 --- a/src/lib/edje/Edje_Edit.h +++ b/src/lib/edje/Edje_Edit.h @@ -3069,6 +3069,31 @@ edje_edit_state_text_source_get(Evas_Object *obj, const char *part, const char * 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 text class of the given part state. + * + * @param obj Object being edited. + * @param part Part that contain state. + * @param state The name of the state to get text class (not including the state value). + * @param value The state value. + * + * @return The current text class. + */ +EAPI const char * +edje_edit_state_text_class_get(Evas_Object *obj, const char *part, const char *state, double value); + +/** Set the text class of the given part state. + * + * @param obj Object being edited. + * @param part Part that contain state. + * @param state The name of the state to set text class (not including the state value). + * @param value The state value. + * @param color_class The text class to assign. + * + * @return EINA_TRUE if successful, EINA_FALSE otherwise. + */ +EAPI Eina_Bool +edje_edit_state_text_class_set(Evas_Object *obj, const char *part, const char *state, double value, const char *text_class); + /** 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. diff --git a/src/lib/edje/edje_edit.c b/src/lib/edje/edje_edit.c index 38f1c60..a2ebcf8 100644 --- a/src/lib/edje/edje_edit.c +++ b/src/lib/edje/edje_edit.c @@ -4753,7 +4753,6 @@ EAPI Eina_Bool edje_edit_state_text_set(Evas_Object *obj, const char *part, const char *state, double value, const char *text) { Edje_Part_Description_Text *txt; - if ((!obj) || (!part) || (!state) || (!text)) return EINA_FALSE; GET_PD_OR_RETURN(EINA_FALSE); @@ -5210,6 +5209,36 @@ edje_edit_state_text_source_set(Evas_Object *obj, const char *part, const char * return EINA_TRUE; } +EAPI const char* +edje_edit_state_text_class_get(Evas_Object *obj, const char *part, const char *state, double value) +{ + Edje_Part_Description_Text *txt; + GET_PD_OR_RETURN(NULL); + + if ((rp->part->type != EDJE_PART_TYPE_TEXT) && + (rp->part->type != EDJE_PART_TYPE_TEXTBLOCK)) + return NULL; + txt = (Edje_Part_Description_Text *) pd; + + return eina_stringshare_add(txt->text.text_class); +} + +EAPI Eina_Bool +edje_edit_state_text_class_set(Evas_Object *obj, const char *part, const char *state, double value, const char *text_class) +{ + Edje_Part_Description_Text *txt; + if (!text_class) 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; + txt = (Edje_Part_Description_Text *) pd; + + txt->text.text_class = (char *) eina_stringshare_add(text_class); + return EINA_TRUE; +} + /****************/ /* IMAGES API */ /****************/ --
