summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorVyacheslav Reutskiy <v.reutskiy@samsung.com>2013-12-19 15:29:51 +0900
committerCedric BAIL <cedric.bail@samsung.com>2013-12-19 15:53:24 +0900
commit0ad1dfe4e596aeb194b205e63a771d26279a1846 (patch)
tree1e50b38b55e15d1cee045afdb469c82852b022e8 /src
parent891c34f50fe226f025af30dafbf46b33af850f9d (diff)
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>
Diffstat (limited to 'src')
-rw-r--r--src/lib/edje/Edje_Edit.h27
-rw-r--r--src/lib/edje/edje_edit.c34
2 files changed, 61 insertions, 0 deletions
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
2679 */ 2679 */
2680EAPI Eina_Bool edje_edit_state_text_max_y_set(Evas_Object *obj, const char *part, const char *state, double value, Eina_Bool v); 2680EAPI Eina_Bool edje_edit_state_text_max_y_set(Evas_Object *obj, const char *part, const char *state, double value, Eina_Bool v);
2681 2681
2682/** Get style name for a given part state.
2683 *
2684 * @param obj Object being edited.
2685 * @param part The name of the part to get the style of.
2686 * @param state The state of the part to get the style of.
2687 * @param value Value of the state.
2688 *
2689 * @return Style used by the part or NULL if error or nothing is set.
2690 */
2691EAPI const char *
2692edje_edit_state_text_style_get(Evas_Object *obj, const char *part, const char *state, double value);
2693
2694/** Set style name for a given part state.
2695 *
2696 * Causes the part to use the default style and tags defined in the "style" block with the specified name.
2697 *
2698 * @param obj Object being edited.
2699 * @param part Part to set the style of.
2700 * @param state State in which the style is set.
2701 * @param value Value of the state.
2702 * @param style The style name to use.
2703 *
2704 * @return EINA_TRUE if successful, EINA_FALSE - otherwise.
2705 */
2706EAPI Eina_Bool
2707edje_edit_state_text_style_set(Evas_Object *obj, const char *part, const char *state, double value, const char *style);
2708
2682/** Get the list of all the fonts in the given edje. 2709/** Get the list of all the fonts in the given edje.
2683 * 2710 *
2684 * Use edje_edit_string_list_free() when you don't need the list anymore. 2711 * 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);
4384FUNC_TEXT_BOOL(max, x); 4384FUNC_TEXT_BOOL(max, x);
4385FUNC_TEXT_BOOL(max, y); 4385FUNC_TEXT_BOOL(max, y);
4386 4386
4387EAPI const char *
4388edje_edit_state_text_style_get(Evas_Object *obj, const char *part, const char *state, double value)
4389{
4390 Edje_Part_Description_Text *txt;
4391
4392 GET_PD_OR_RETURN(NULL);
4393
4394 if ((rp->part->type != EDJE_PART_TYPE_TEXT) &&
4395 (rp->part->type != EDJE_PART_TYPE_TEXTBLOCK))
4396 return NULL;
4397
4398 txt = (Edje_Part_Description_Text *)pd;
4399 return eina_stringshare_add(txt->text.style.str);
4400}
4401
4402EAPI Eina_Bool
4403edje_edit_state_text_style_set(Evas_Object *obj, const char *part, const char *state, double value, const char *style)
4404{
4405 Edje_Part_Description_Text *txt;
4406
4407 GET_PD_OR_RETURN(EINA_FALSE);
4408 if (!style) return EINA_FALSE;
4409
4410 if ((rp->part->type != EDJE_PART_TYPE_TEXT) &&
4411 (rp->part->type != EDJE_PART_TYPE_TEXTBLOCK))
4412 return EINA_FALSE;
4413
4414 txt = (Edje_Part_Description_Text *)pd;
4415 txt->text.style.str = eina_stringshare_add(style);
4416
4417 edje_object_calc_force(obj);
4418 return EINA_TRUE;
4419}
4420
4387EAPI Eina_List * 4421EAPI Eina_List *
4388edje_edit_fonts_list_get(Evas_Object *obj) 4422edje_edit_fonts_list_get(Evas_Object *obj)
4389{ 4423{