Edje textblock: Added edje_object_part_text_style_user_set/get
authortasn <tasn@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Mon, 23 Jan 2012 16:10:27 +0000 (16:10 +0000)
committertasn <tasn@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Mon, 23 Jan 2012 16:10:27 +0000 (16:10 +0000)
That correspond to the new textblock functions.

git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/edje@67474 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

ChangeLog
src/lib/Edje.h
src/lib/edje_util.c

index e61875a..4def867 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
         * 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.
+
index 6413014..584b8ab 100644 (file)
@@ -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
index 2205ba3..650180d 100644 (file)
@@ -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)
 {