From ea566ed283829022f396556d25b159bc722213b4 Mon Sep 17 00:00:00 2001 From: tasn Date: Mon, 23 Jan 2012 16:10:27 +0000 Subject: [PATCH] Edje textblock: Added edje_object_part_text_style_user_set/get That correspond to the new textblock functions. git-svn-id: http://svn.enlightenment.org/svn/e/trunk/edje@67474 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33 --- ChangeLog | 5 +++++ src/lib/Edje.h | 27 +++++++++++++++++++++++++++ src/lib/edje_util.c | 39 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 71 insertions(+) diff --git a/ChangeLog b/ChangeLog index e61875a..4def867 100644 --- a/ChangeLog +++ b/ChangeLog @@ -291,3 +291,8 @@ * Fix the ability to change the edje file source of an edje object inside a callback - it worked but you couldn't swallow/set text etc. +2012-01-03 Tom Hacohen (TAsn) + + * Entry: Added edje_object_part_text_style_user_set/get that'll use + the new corresponding textblock functions. + diff --git a/src/lib/Edje.h b/src/lib/Edje.h index 6413014..584b8ab 100644 --- a/src/lib/Edje.h +++ b/src/lib/Edje.h @@ -2448,6 +2448,33 @@ EAPI Eina_Bool edje_object_part_text_set (Evas_Object *obj, const c EAPI const char *edje_object_part_text_get (const Evas_Object *obj, const char *part); /** + * @brief Set the style of the + * + * @param obj A valid Evas_Object handle + * @param part The part name + * @param style The style to set (textblock conventions). + * + * This function sets the style associated with the textblock part. + * + * @since 1.2.0 + */ +EAPI void edje_object_part_text_style_user_set(Evas_Object *obj, const char *part, const char *style); + +/** + * @brief Return the text of the object part. + * + * @param obj A valid Evas_Object handle + * @param part The part name + * + * @return The text string + * + * This function returns the style associated with the textblock part. + * + * @since 1.2.0 + */ +EAPI const char *edje_object_part_text_style_user_get(Evas_Object *obj, const char *part); + +/** * @brief Sets the raw (non escaped) text for an object part. * * @param obj A valid Evas Object handle diff --git a/src/lib/edje_util.c b/src/lib/edje_util.c index 2205ba3..650180d 100644 --- a/src/lib/edje_util.c +++ b/src/lib/edje_util.c @@ -1058,6 +1058,45 @@ _edje_object_part_text_raw_append(Evas_Object *obj, Edje_Real_Part *rp, const ch return EINA_TRUE; } +EAPI void +edje_object_part_text_style_user_set(Evas_Object *obj, const char *part, + const char *style) +{ + Edje *ed; + Edje_Real_Part *rp; + Evas_Textblock_Style *ts; + + ed = _edje_fetch(obj); + if ((!ed) || (!part) || (!style)) return; + rp = _edje_real_part_recursive_get(ed, (char *)part); + if (!rp) return; + if (rp->part->type != EDJE_PART_TYPE_TEXTBLOCK) return; + + ts = evas_textblock_style_new(); + evas_textblock_style_set(ts, style); + evas_object_textblock_style_user_set(rp->object, ts); +} + +EAPI const char * +edje_object_part_text_style_user_get(Evas_Object *obj, const char *part) +{ + Edje *ed; + Edje_Real_Part *rp; + const Evas_Textblock_Style *ts; + + ed = _edje_fetch(obj); + if ((!ed) || (!part)) return NULL; + rp = _edje_real_part_recursive_get(ed, (char *)part); + if (!rp) return NULL; + if (rp->part->type != EDJE_PART_TYPE_TEXTBLOCK) return NULL; + + ts = evas_object_textblock_style_user_get(rp->object); + if (ts) + return evas_textblock_style_get(ts); + else + return NULL; +} + EAPI Eina_Bool edje_object_part_text_set(Evas_Object *obj, const char *part, const char *text) { -- 2.7.4