diff --git a/legacy/edje/ChangeLog b/legacy/edje/ChangeLog index e61875a5dd..4def867c1c 100644 --- a/legacy/edje/ChangeLog +++ b/legacy/edje/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/legacy/edje/src/lib/Edje.h b/legacy/edje/src/lib/Edje.h index 64130149ef..584b8ab078 100644 --- a/legacy/edje/src/lib/Edje.h +++ b/legacy/edje/src/lib/Edje.h @@ -2447,6 +2447,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. * diff --git a/legacy/edje/src/lib/edje_util.c b/legacy/edje/src/lib/edje_util.c index 2205ba3a5d..650180dd47 100644 --- a/legacy/edje/src/lib/edje_util.c +++ b/legacy/edje/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) {