aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--legacy/edje/ChangeLog6
-rw-r--r--legacy/edje/src/lib/Edje.h9
-rw-r--r--legacy/edje/src/lib/edje_entry.c36
-rw-r--r--legacy/edje/src/lib/edje_private.h1
-rw-r--r--legacy/edje/src/lib/edje_util.c14
5 files changed, 61 insertions, 5 deletions
diff --git a/legacy/edje/ChangeLog b/legacy/edje/ChangeLog
index 25e9e80b02..4f4299a382 100644
--- a/legacy/edje/ChangeLog
+++ b/legacy/edje/ChangeLog
@@ -364,3 +364,9 @@
2012-02-24 Jihoon Kim
* add edje_object_part_text_imf_context_get for getting Ecore_IMF_Context handle in edje text object
+
+2012-02-29 Tom Hacohen (TAsn)
+
+ * Entry: Added edje_object_part_text_user_insert.
+ This function inserts text as if the user has inserted it.
+ This means it actually registers as a change and etc.
diff --git a/legacy/edje/src/lib/Edje.h b/legacy/edje/src/lib/Edje.h
index 03e439fa5a..075daf8ab7 100644
--- a/legacy/edje/src/lib/Edje.h
+++ b/legacy/edje/src/lib/Edje.h
@@ -2665,6 +2665,15 @@ EAPI Eina_Bool edje_object_part_text_item_geometry_get (const Evas_
EAPI void edje_object_part_text_cursor_geometry_get (const Evas_Object *obj, const char *part, Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *h);
/**
+ * @brief Deletes the selection and emits a change event.
+ *
+ * @param obj A valid Evas_Object handle
+ * @param part The part name
+ * @since 1.2.0
+ */
+EAPI void edje_object_part_text_user_insert (const Evas_Object *obj, const char *part, const char *text);
+
+/**
* @brief Enables selection if the entry is an EXPLICIT selection mode
* type.
*
diff --git a/legacy/edje/src/lib/edje_entry.c b/legacy/edje/src/lib/edje_entry.c
index a39d8e1cf8..6b94f75f6f 100644
--- a/legacy/edje/src/lib/edje_entry.c
+++ b/legacy/edje/src/lib/edje_entry.c
@@ -1062,12 +1062,14 @@ _range_del_emit(Edje *ed, Evas_Textblock_Cursor *c __UNUSED__, Evas_Object *o __
_edje_emit(ed, "entry,changed", en->rp->part->name);
_edje_emit_full(ed, "entry,changed,user", en->rp->part->name, info,
_free_entry_change_info);
+ _sel_clear(en->cursor, en->rp->object, en);
}
static void
_range_del(Evas_Textblock_Cursor *c __UNUSED__, Evas_Object *o __UNUSED__, Entry *en)
{
evas_textblock_cursor_range_delete(en->sel_start, en->sel_end);
+ _sel_clear(en->cursor, en->rp->object, en);
}
static void
@@ -1441,7 +1443,6 @@ _edje_key_down_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, v
_range_del_emit(ed, en->cursor, rp->object, en);
info->merge = EINA_TRUE;
}
- _sel_clear(en->cursor, rp->object, en);
info->change.insert.pos =
evas_textblock_cursor_pos_get(en->cursor);
info->change.insert.content = eina_stringshare_add("<tab/>");
@@ -1506,7 +1507,6 @@ _edje_key_down_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, v
_range_del_emit(ed, en->cursor, rp->object, en);
info->merge = EINA_TRUE;
}
- _sel_clear(en->cursor, rp->object, en);
info->change.insert.pos =
evas_textblock_cursor_pos_get(en->cursor);
@@ -1549,7 +1549,6 @@ _edje_key_down_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, v
_range_del_emit(ed, en->cursor, rp->object, en);
info->merge = EINA_TRUE;
}
- _sel_clear(en->cursor, rp->object, en);
info->change.insert.pos =
evas_textblock_cursor_pos_get(en->cursor);
@@ -2320,7 +2319,6 @@ _edje_entry_text_markup_insert(Edje_Real_Part *rp, const char *text)
// prepend markup @ cursor pos
if (en->have_selection)
_range_del(en->cursor, rp->object, en);
- _sel_clear(en->cursor, rp->object, en);
//xx
// evas_object_textblock_text_markup_prepend(en->cursor, text);
_text_filter_markup_prepend(en, en->cursor, text);
@@ -2524,6 +2522,35 @@ _edje_entry_cursor_geometry_get(Edje_Real_Part *rp, Evas_Coord *cx, Evas_Coord *
}
void
+_edje_entry_user_insert(Edje_Real_Part *rp, const char *text)
+{
+ Entry *en = rp->entry_data;
+ Edje_Entry_Change_Info *info = calloc(1, sizeof(*info));
+ info->insert = EINA_TRUE;
+ info->change.insert.plain_length = 1;
+ info->change.insert.content = eina_stringshare_add(text);
+ {
+ char *tmp;
+ tmp = evas_textblock_text_markup_to_utf8(rp->object,
+ info->change.insert.content);
+ info->change.insert.plain_length = eina_unicode_utf8_get_len(tmp);
+ free(tmp);
+ }
+
+ if (en->have_selection)
+ {
+ _range_del_emit(rp->edje, en->cursor, rp->object, en);
+ info->merge = EINA_TRUE;
+ }
+ info->change.insert.pos = evas_textblock_cursor_pos_get(en->cursor);
+ _text_filter_text_prepend(en, en->cursor, text);
+ _edje_emit(rp->edje, "entry,changed", rp->part->name);
+ _edje_emit_full(rp->edje, "entry,changed,user", rp->part->name,
+ info, _free_entry_change_info);
+ _edje_emit(rp->edje, "cursor,changed", rp->part->name);
+}
+
+void
_edje_entry_select_allow_set(Edje_Real_Part *rp, Eina_Bool allow)
{
Entry *en = rp->entry_data;
@@ -3247,7 +3274,6 @@ _edje_entry_imf_event_preedit_changed_cb(void *data, Ecore_IMF_Context *ctx __UN
{
/* delete selected characters */
_range_del_emit(ed, en->cursor, rp->object, en);
- _sel_clear(en->cursor, rp->object, en);
}
/* delete preedit characters */
diff --git a/legacy/edje/src/lib/edje_private.h b/legacy/edje/src/lib/edje_private.h
index 30bb242dbd..9636129107 100644
--- a/legacy/edje/src/lib/edje_private.h
+++ b/legacy/edje/src/lib/edje_private.h
@@ -1937,6 +1937,7 @@ const Eina_List *_edje_entry_anchors_list(Edje_Real_Part *rp);
Eina_Bool _edje_entry_item_geometry_get(Edje_Real_Part *rp, const char *item, Evas_Coord *cx, Evas_Coord *cy, Evas_Coord *cw, Evas_Coord *ch);
const Eina_List *_edje_entry_items_list(Edje_Real_Part *rp);
void _edje_entry_cursor_geometry_get(Edje_Real_Part *rp, Evas_Coord *cx, Evas_Coord *cy, Evas_Coord *cw, Evas_Coord *ch);
+void _edje_entry_user_insert(Edje_Real_Part *rp, const char *text);
void _edje_entry_select_allow_set(Edje_Real_Part *rp, Eina_Bool allow);
Eina_Bool _edje_entry_select_allow_get(const Edje_Real_Part *rp);
void _edje_entry_select_abort(Edje_Real_Part *rp);
diff --git a/legacy/edje/src/lib/edje_util.c b/legacy/edje/src/lib/edje_util.c
index 8c72fd8ae0..f844e78b91 100644
--- a/legacy/edje/src/lib/edje_util.c
+++ b/legacy/edje/src/lib/edje_util.c
@@ -1472,6 +1472,20 @@ edje_object_part_text_cursor_geometry_get(const Evas_Object *obj, const char *pa
}
EAPI void
+edje_object_part_text_user_insert(const 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, part);
+ if (!rp) return;
+ if (rp->part->entry_mode > EDJE_ENTRY_EDIT_MODE_NONE)
+ _edje_entry_user_insert(rp, text);
+}
+
+EAPI void
edje_object_part_text_select_allow_set(const Evas_Object *obj, const char *part, Eina_Bool allow)
{
Edje *ed;