From 0ad1dfe4e596aeb194b205e63a771d26279a1846 Mon Sep 17 00:00:00 2001 From: Vyacheslav Reutskiy Date: Thu, 19 Dec 2013 15:29:51 +0900 Subject: [PATCH] edje: edje_edit - adding getter and setter for text style This commit will add API for working with text style. There are two functions will be added: 1. edje_edit_state_text_style_get 2. edje_edit_state_text_style_set Reviewers: cedric, seoz, raster Reviewed By: cedric CC: cedric Differential Revision: https://phab.enlightenment.org/D388 Signed-off-by: Cedric BAIL --- src/lib/edje/Edje_Edit.h | 27 +++++++++++++++++++++++++++ src/lib/edje/edje_edit.c | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 61 insertions(+) diff --git a/src/lib/edje/Edje_Edit.h b/src/lib/edje/Edje_Edit.h index d216ec237d..5d38a6c255 100644 --- a/src/lib/edje/Edje_Edit.h +++ b/src/lib/edje/Edje_Edit.h @@ -2679,6 +2679,33 @@ EAPI Eina_Bool edje_edit_state_text_min_y_set(Evas_Object *obj, const char *part */ EAPI Eina_Bool edje_edit_state_text_max_y_set(Evas_Object *obj, const char *part, const char *state, double value, Eina_Bool v); +/** Get style name for a given part state. + * + * @param obj Object being edited. + * @param part The name of the part to get the style of. + * @param state The state of the part to get the style of. + * @param value Value of the state. + * + * @return Style used by the part or NULL if error or nothing is set. + */ +EAPI const char * +edje_edit_state_text_style_get(Evas_Object *obj, const char *part, const char *state, double value); + +/** Set style name for a given part state. + * + * Causes the part to use the default style and tags defined in the "style" block with the specified name. + * + * @param obj Object being edited. + * @param part Part to set the style of. + * @param state State in which the style is set. + * @param value Value of the state. + * @param style The style name to use. + * + * @return EINA_TRUE if successful, EINA_FALSE - otherwise. + */ +EAPI Eina_Bool +edje_edit_state_text_style_set(Evas_Object *obj, const char *part, const char *state, double value, const char *style); + /** 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 3188f399a8..6c8f19a50f 100644 --- a/src/lib/edje/edje_edit.c +++ b/src/lib/edje/edje_edit.c @@ -4384,6 +4384,40 @@ FUNC_TEXT_BOOL(min, y); FUNC_TEXT_BOOL(max, x); FUNC_TEXT_BOOL(max, y); +EAPI const char * +edje_edit_state_text_style_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.style.str); +} + +EAPI Eina_Bool +edje_edit_state_text_style_set(Evas_Object *obj, const char *part, const char *state, double value, const char *style) +{ + Edje_Part_Description_Text *txt; + + GET_PD_OR_RETURN(EINA_FALSE); + if (!style) 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.style.str = eina_stringshare_add(style); + + edje_object_calc_force(obj); + return EINA_TRUE; +} + EAPI Eina_List * edje_edit_fonts_list_get(Evas_Object *obj) {