cedric pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=6f7233b473b25c0931b6443503dcd75c81354c94
commit 6f7233b473b25c0931b6443503dcd75c81354c94 Author: Igor Gala <[email protected]> Date: Thu Jun 12 02:15:21 2014 +0200 edje: Edje_Edit - edje_edit_state_text_repch_xet() Summary: There are new 'get and set' API for block 'text.repch'. Those functions return or set replacement character for a given text part. This string is used to replace every character to hide the details of the entry. Normally you would use a "*", but you can use anything you like. @feature Reviewers: seoz, Hermet, cedric, raster CC: reutskiy.v.v, cedric Differential Revision: https://phab.enlightenment.org/D1001 Signed-off-by: Cedric BAIL <[email protected]> --- src/lib/edje/Edje_Edit.h | 31 ++++++++++++++++++++++++++++--- src/lib/edje/edje_edit.c | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 63 insertions(+), 3 deletions(-) diff --git a/src/lib/edje/Edje_Edit.h b/src/lib/edje/Edje_Edit.h index 4e85c5b..d6a61d1 100644 --- a/src/lib/edje/Edje_Edit.h +++ b/src/lib/edje/Edje_Edit.h @@ -3170,13 +3170,40 @@ edje_edit_state_text_class_get(Evas_Object *obj, const char *part, const char *s * @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. + * @param text_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 replacement character string 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 replacement character + * (not including the state value). + * @param value The state value. + * + * @return The current replacement character. + */ +EAPI const char * +edje_edit_state_text_repch_get(Evas_Object *obj, const char *part, const char *state, double value); + +/** Set the replacement character string 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 replacement character + * (not including the state value). + * @param value The state value. + * @param repch The replacement character string to assign. + * + * @return EINA_TRUE if successful, EINA_FALSE otherwise. + */ +EAPI Eina_Bool +edje_edit_state_text_repch_set(Evas_Object *obj, const char *part, const char *state, double value, const char *repch); + /** 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. @@ -3185,8 +3212,6 @@ edje_edit_state_text_class_set(Evas_Object *obj, const char *part, const char *s * * @return A list containing all the fonts names found in the edje file. */ - - EAPI Eina_List * edje_edit_fonts_list_get(Evas_Object *obj); /** Add a new font to the edje file. diff --git a/src/lib/edje/edje_edit.c b/src/lib/edje/edje_edit.c index 27e2d45..e3372fc 100644 --- a/src/lib/edje/edje_edit.c +++ b/src/lib/edje/edje_edit.c @@ -5577,6 +5577,41 @@ edje_edit_state_text_class_set(Evas_Object *obj, const char *part, const char *s return EINA_TRUE; } +EAPI const char * +edje_edit_state_text_repch_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(edje_string_get(&txt->text.repch)); +} + +EAPI Eina_Bool +edje_edit_state_text_repch_set(Evas_Object *obj, const char *part, const char *state, double value, const char *repch) +{ + Edje_Part_Description_Text *txt; + + if (!repch) 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; + _edje_if_string_free(ed, txt->text.repch.str); + txt->text.repch.str = eina_stringshare_add(repch); + txt->text.repch.id = 0; + + edje_object_calc_force(obj); + return EINA_TRUE; +} + /****************/ /* IMAGES API */ /****************/ --
