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 <cedric.bail@samsung.com>
This commit is contained in:
Vyacheslav Reutskiy 2013-12-19 15:29:51 +09:00 committed by Cedric BAIL
parent 891c34f50f
commit 0ad1dfe4e5
2 changed files with 61 additions and 0 deletions

View File

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

View File

@ -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)
{