From: tasn Date: Sun, 15 May 2011 15:57:38 +0000 (+0000) Subject: Edje text: Added edje_object_part_text_append. X-Git-Tag: submit/trunk/20120815.180907~644 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c1fd1633edca8efefa30667724e3d899ecb1a5a1;p=profile%2Fivi%2Fedje.git Edje text: Added edje_object_part_text_append. git-svn-id: http://svn.enlightenment.org/svn/e/trunk/edje@59407 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33 --- diff --git a/ChangeLog b/ChangeLog index 113f64e..58c349b 100644 --- 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. + diff --git a/src/lib/Edje.h b/src/lib/Edje.h index b2f163c..4b4fc7a 100644 --- a/src/lib/Edje.h +++ b/src/lib/Edje.h @@ -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 diff --git a/src/lib/edje_entry.c b/src/lib/edje_entry.c index 129a2e3..1b85a1a 100644 --- a/src/lib/edje_entry.c +++ b/src/lib/edje_entry.c @@ -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; diff --git a/src/lib/edje_private.h b/src/lib/edje_private.h index 635f8c2..a2e8e9e 100644 --- a/src/lib/edje_private.h +++ b/src/lib/edje_private.h @@ -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); diff --git a/src/lib/edje_util.c b/src/lib/edje_util.c index 31de03a..6572928 100644 --- a/src/lib/edje_util.c +++ b/src/lib/edje_util.c @@ -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) {