Elm entry/scrolled_enry: Added *_entry_append API.
authortasn <tasn@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Mon, 13 Jun 2011 11:07:43 +0000 (11:07 +0000)
committertasn <tasn@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Mon, 13 Jun 2011 11:07:43 +0000 (11:07 +0000)
This is very useful when you want to feed an entry from a socket for example
and you don't want to wait until all the information is received

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

src/lib/Elementary.h.in
src/lib/elc_scrolled_entry.c
src/lib/elm_entry.c

index ae91d4f..3403880 100644 (file)
@@ -1360,6 +1360,7 @@ extern "C" {
    EAPI Eina_Bool    elm_entry_password_get(const Evas_Object *obj) EINA_ARG_NONNULL(1);
    EAPI void         elm_entry_entry_set(Evas_Object *obj, const char *entry) EINA_ARG_NONNULL(1);
    EAPI const char  *elm_entry_entry_get(const Evas_Object *obj) EINA_ARG_NONNULL(1);
+   EAPI void         elm_entry_entry_append(Evas_Object *obj, const char *entry) EINA_ARG_NONNULL(1);
    EAPI Eina_Bool    elm_entry_is_empty(const Evas_Object *obj) EINA_ARG_NONNULL(1);
    EAPI const char  *elm_entry_selection_get(const Evas_Object *obj) EINA_ARG_NONNULL(1);
    EAPI void         elm_entry_entry_insert(Evas_Object *obj, const char *entry) EINA_ARG_NONNULL(1);
@@ -2592,6 +2593,7 @@ EAPI Elm_Genlist_Item *elm_genlist_item_sorted_insert(Evas_Object *obj, const El
    EAPI Eina_Bool    elm_scrolled_entry_password_get(const Evas_Object *obj) EINA_ARG_NONNULL(1);
    EAPI void         elm_scrolled_entry_entry_set(Evas_Object *obj, const char *entry) EINA_ARG_NONNULL(1);
    EAPI const char  *elm_scrolled_entry_entry_get(const Evas_Object *obj) EINA_ARG_NONNULL(1);
+   EAPI void         elm_scrolled_entry_entry_append(Evas_Object *obj, const char *entry) EINA_ARG_NONNULL(1);
    EAPI Eina_Bool    elm_scrolled_entry_is_empty(const Evas_Object *obj) EINA_ARG_NONNULL(1);
    EAPI const char  *elm_scrolled_entry_selection_get(const Evas_Object *obj) EINA_ARG_NONNULL(1);
    EAPI void         elm_scrolled_entry_entry_insert(Evas_Object *obj, const char *entry) EINA_ARG_NONNULL(1);
index c54036c..c59e585 100644 (file)
@@ -744,6 +744,23 @@ elm_scrolled_entry_entry_set(Evas_Object *obj, const char *entry)
 }
 
 /**
+ * This appends @p entry to the scrolled entry
+ *
+ * @param obj The scrolled entry object
+ * @param entry The text to be displayed
+ *
+ * @ingroup Scrolled_Entry
+ */
+EAPI void
+elm_scrolled_entry_entry_append(Evas_Object *obj, const char *entry)
+{
+   ELM_CHECK_WIDTYPE(obj, widtype);
+   Widget_Data *wd = elm_widget_data_get(obj);
+   if (!wd) return;
+   elm_entry_entry_append(wd->entry, entry);
+}
+
+/**
  * This returns the text currently shown in object @p entry.
  * See also elm_scrolled_entry_entry_set().
  *
index 2d89bbf..096a22a 100644 (file)
@@ -1907,6 +1907,45 @@ elm_entry_entry_set(Evas_Object *obj, const char *entry)
 }
 
 /**
+ * This appends @p entry to the text of the entry.
+ *
+ * @param obj The entry object
+ * @param entry The text to be displayed
+ *
+ * @ingroup Entry
+ */
+EAPI void
+elm_entry_entry_append(Evas_Object *obj, const char *entry)
+{
+   int len = 0;
+   ELM_CHECK_WIDTYPE(obj, widtype);
+   Widget_Data *wd = elm_widget_data_get(obj);
+   if (!wd) return;
+   if (!entry) entry = "";
+   wd->changed = EINA_TRUE;
+
+   len = strlen(entry);
+   if (wd->append_text_left)
+     {
+        char *tmpbuf;
+        tmpbuf = realloc(wd->append_text_left, wd->append_text_len + len + 1);
+        if (!tmpbuf)
+          {
+             /* Do something */
+             return;
+          }
+        wd->append_text_left = tmpbuf;
+        memcpy(wd->append_text_left + wd->append_text_len, entry, len + 1);
+        wd->append_text_len += len;
+     }
+   else
+     {
+        /* FIXME: Add chunked appending here (like in entry_set) */
+        edje_object_part_text_append(wd->ent, "elm.text", entry);
+     }
+}
+
+/**
  * This returns the text currently shown in object @p entry.
  * See also elm_entry_entry_set().
  *