Edje text: Added edje_object_part_text_append.
authortasn <tasn@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Sun, 15 May 2011 15:57:38 +0000 (15:57 +0000)
committertasn <tasn@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Sun, 15 May 2011 15:57:38 +0000 (15:57 +0000)
git-svn-id: http://svn.enlightenment.org/svn/e/trunk/edje@59407 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

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

index 113f64e..58c349b 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -84,3 +84,9 @@
 
         * size_min_restricted_calc: Fixed textblock handling.
 
+2011-05-15  Tom Hacohen (TAsn)
+
+        * Entry - New API: added edje_object_part_text_append which appends
+          text to the end of the textblock part. This lets us do cool thing
+          like population of textblock using idler.
+
index b2f163c..4b4fc7a 100644 (file)
@@ -2168,6 +2168,20 @@ EAPI void             edje_object_part_text_select_all              (const Evas_
 EAPI void             edje_object_part_text_insert                  (Evas_Object *obj, const char *part, const char *text);
 
 /**
+ * @brief Insert text for an object part.
+ *
+ * @param obj A valid Evas Object handle
+ * @param part The part name
+ * @param text The text string
+ *
+ * This function inserts the text for an object part at the end; It does not
+ * move the cursor.
+ *
+ * @since 1.1
+ */
+EAPI void             edje_object_part_text_append(Evas_Object *obj, const char *part, const char *text);
+
+/**
  * @brief Return a list of char anchor names.
  *
  * @param obj A valid Evas_Object handle
index 129a2e3..1b85a1a 100644 (file)
@@ -2044,6 +2044,27 @@ _edje_entry_text_markup_set(Edje_Real_Part *rp, const char *text)
 }
 
 void
+_edje_entry_text_markup_append(Edje_Real_Part *rp, const char *text)
+{
+   Entry *en = rp->entry_data;
+   Evas_Textblock_Cursor *end_cur;
+   if (!en) return;
+   end_cur = evas_object_textblock_cursor_new(rp->object);
+   evas_textblock_cursor_paragraph_last(end_cur);
+
+   _text_filter_markup_prepend(en, end_cur, text);
+   evas_textblock_cursor_free(end_cur);
+
+   /* We are updating according to the real cursor on purpose */
+   _anchors_get(en->cursor, rp->object, en);
+   _curs_update_from_curs(en->cursor, rp->object, en);
+   _edje_emit(rp->edje, "entry,changed", rp->part->name);
+   _edje_emit(rp->edje, "cursor,changed", rp->part->name);
+
+   _edje_entry_real_part_configure(rp);
+}
+
+void
 _edje_entry_text_markup_insert(Edje_Real_Part *rp, const char *text)
 {
    Entry *en = rp->entry_data;
index 635f8c2..a2e8e9e 100644 (file)
@@ -1770,6 +1770,7 @@ const char *_edje_entry_selection_get(Edje_Real_Part *rp);
 const char *_edje_entry_text_get(Edje_Real_Part *rp);
 void _edje_entry_text_markup_set(Edje_Real_Part *rp, const char *text);
 void _edje_entry_text_markup_insert(Edje_Real_Part *rp, const char *text);
+void _edje_entry_text_markup_append(Edje_Real_Part *rp, const char *text);
 void _edje_entry_set_cursor_start(Edje_Real_Part *rp);
 void _edje_entry_set_cursor_end(Edje_Real_Part *rp);
 void _edje_entry_cursor_copy(Edje_Real_Part *rp, Edje_Cursor cur, Edje_Cursor dst);
index 31de03a..6572928 100644 (file)
@@ -1173,6 +1173,28 @@ edje_object_part_text_insert(Evas_Object *obj, const char *part, const char *tex
      rp->edje->text_change.func(rp->edje->text_change.data, obj, part);
 }
 
+EAPI void
+edje_object_part_text_append(Evas_Object *obj, const char *part, const char *text)
+{
+   Edje *ed;
+   Edje_Real_Part *rp;
+
+   ed = _edje_fetch(obj);
+   if ((!ed) || (!part)) return;
+   rp = _edje_real_part_recursive_get(ed, (char *)part);
+   if (!rp) return;
+   if ((rp->part->type != EDJE_PART_TYPE_TEXTBLOCK)) return;
+   if (rp->part->entry_mode <= EDJE_ENTRY_EDIT_MODE_NONE) return;
+   _edje_entry_text_markup_append(rp, text);
+   rp->edje->dirty = 1;
+#ifdef EDJE_CALC_CACHE
+   rp->invalidate = 1;
+#endif
+   _edje_recalc(rp->edje);
+   if (rp->edje->text_change.func)
+     rp->edje->text_change.func(rp->edje->text_change.data, obj, part);
+}
+
 EAPI const Eina_List *
 edje_object_part_text_anchor_list_get(const Evas_Object *obj, const char *part)
 {