summaryrefslogtreecommitdiff
path: root/legacy/edje
diff options
context:
space:
mode:
Diffstat (limited to 'legacy/edje')
-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 25e9e80..4f4299a 100644
--- a/legacy/edje/ChangeLog
+++ b/legacy/edje/ChangeLog
@@ -364,3 +364,9 @@
3642012-02-24 Jihoon Kim 3642012-02-24 Jihoon Kim
365 365
366 * add edje_object_part_text_imf_context_get for getting Ecore_IMF_Context handle in edje text object 366 * add edje_object_part_text_imf_context_get for getting Ecore_IMF_Context handle in edje text object
367
3682012-02-29 Tom Hacohen (TAsn)
369
370 * Entry: Added edje_object_part_text_user_insert.
371 This function inserts text as if the user has inserted it.
372 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 03e439f..075daf8 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_
2665EAPI 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); 2665EAPI 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);
2666 2666
2667/** 2667/**
2668 * @brief Deletes the selection and emits a change event.
2669 *
2670 * @param obj A valid Evas_Object handle
2671 * @param part The part name
2672 * @since 1.2.0
2673 */
2674EAPI void edje_object_part_text_user_insert (const Evas_Object *obj, const char *part, const char *text);
2675
2676/**
2668 * @brief Enables selection if the entry is an EXPLICIT selection mode 2677 * @brief Enables selection if the entry is an EXPLICIT selection mode
2669 * type. 2678 * type.
2670 * 2679 *
diff --git a/legacy/edje/src/lib/edje_entry.c b/legacy/edje/src/lib/edje_entry.c
index a39d8e1..6b94f75 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 __
1062 _edje_emit(ed, "entry,changed", en->rp->part->name); 1062 _edje_emit(ed, "entry,changed", en->rp->part->name);
1063 _edje_emit_full(ed, "entry,changed,user", en->rp->part->name, info, 1063 _edje_emit_full(ed, "entry,changed,user", en->rp->part->name, info,
1064 _free_entry_change_info); 1064 _free_entry_change_info);
1065 _sel_clear(en->cursor, en->rp->object, en);
1065} 1066}
1066 1067
1067static void 1068static void
1068_range_del(Evas_Textblock_Cursor *c __UNUSED__, Evas_Object *o __UNUSED__, Entry *en) 1069_range_del(Evas_Textblock_Cursor *c __UNUSED__, Evas_Object *o __UNUSED__, Entry *en)
1069{ 1070{
1070 evas_textblock_cursor_range_delete(en->sel_start, en->sel_end); 1071 evas_textblock_cursor_range_delete(en->sel_start, en->sel_end);
1072 _sel_clear(en->cursor, en->rp->object, en);
1071} 1073}
1072 1074
1073static void 1075static void
@@ -1441,7 +1443,6 @@ _edje_key_down_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, v
1441 _range_del_emit(ed, en->cursor, rp->object, en); 1443 _range_del_emit(ed, en->cursor, rp->object, en);
1442 info->merge = EINA_TRUE; 1444 info->merge = EINA_TRUE;
1443 } 1445 }
1444 _sel_clear(en->cursor, rp->object, en);
1445 info->change.insert.pos = 1446 info->change.insert.pos =
1446 evas_textblock_cursor_pos_get(en->cursor); 1447 evas_textblock_cursor_pos_get(en->cursor);
1447 info->change.insert.content = eina_stringshare_add("<tab/>"); 1448 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
1506 _range_del_emit(ed, en->cursor, rp->object, en); 1507 _range_del_emit(ed, en->cursor, rp->object, en);
1507 info->merge = EINA_TRUE; 1508 info->merge = EINA_TRUE;
1508 } 1509 }
1509 _sel_clear(en->cursor, rp->object, en);
1510 1510
1511 info->change.insert.pos = 1511 info->change.insert.pos =
1512 evas_textblock_cursor_pos_get(en->cursor); 1512 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
1549 _range_del_emit(ed, en->cursor, rp->object, en); 1549 _range_del_emit(ed, en->cursor, rp->object, en);
1550 info->merge = EINA_TRUE; 1550 info->merge = EINA_TRUE;
1551 } 1551 }
1552 _sel_clear(en->cursor, rp->object, en);
1553 1552
1554 info->change.insert.pos = 1553 info->change.insert.pos =
1555 evas_textblock_cursor_pos_get(en->cursor); 1554 evas_textblock_cursor_pos_get(en->cursor);
@@ -2320,7 +2319,6 @@ _edje_entry_text_markup_insert(Edje_Real_Part *rp, const char *text)
2320 // prepend markup @ cursor pos 2319 // prepend markup @ cursor pos
2321 if (en->have_selection) 2320 if (en->have_selection)
2322 _range_del(en->cursor, rp->object, en); 2321 _range_del(en->cursor, rp->object, en);
2323 _sel_clear(en->cursor, rp->object, en);
2324 //xx 2322 //xx
2325// evas_object_textblock_text_markup_prepend(en->cursor, text); 2323// evas_object_textblock_text_markup_prepend(en->cursor, text);
2326 _text_filter_markup_prepend(en, en->cursor, text); 2324 _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 *
2524} 2522}
2525 2523
2526void 2524void
2525_edje_entry_user_insert(Edje_Real_Part *rp, const char *text)
2526{
2527 Entry *en = rp->entry_data;
2528 Edje_Entry_Change_Info *info = calloc(1, sizeof(*info));
2529 info->insert = EINA_TRUE;
2530 info->change.insert.plain_length = 1;
2531 info->change.insert.content = eina_stringshare_add(text);
2532 {
2533 char *tmp;
2534 tmp = evas_textblock_text_markup_to_utf8(rp->object,
2535 info->change.insert.content);
2536 info->change.insert.plain_length = eina_unicode_utf8_get_len(tmp);
2537 free(tmp);
2538 }
2539
2540 if (en->have_selection)
2541 {
2542 _range_del_emit(rp->edje, en->cursor, rp->object, en);
2543 info->merge = EINA_TRUE;
2544 }
2545 info->change.insert.pos = evas_textblock_cursor_pos_get(en->cursor);
2546 _text_filter_text_prepend(en, en->cursor, text);
2547 _edje_emit(rp->edje, "entry,changed", rp->part->name);
2548 _edje_emit_full(rp->edje, "entry,changed,user", rp->part->name,
2549 info, _free_entry_change_info);
2550 _edje_emit(rp->edje, "cursor,changed", rp->part->name);
2551}
2552
2553void
2527_edje_entry_select_allow_set(Edje_Real_Part *rp, Eina_Bool allow) 2554_edje_entry_select_allow_set(Edje_Real_Part *rp, Eina_Bool allow)
2528{ 2555{
2529 Entry *en = rp->entry_data; 2556 Entry *en = rp->entry_data;
@@ -3247,7 +3274,6 @@ _edje_entry_imf_event_preedit_changed_cb(void *data, Ecore_IMF_Context *ctx __UN
3247 { 3274 {
3248 /* delete selected characters */ 3275 /* delete selected characters */
3249 _range_del_emit(ed, en->cursor, rp->object, en); 3276 _range_del_emit(ed, en->cursor, rp->object, en);
3250 _sel_clear(en->cursor, rp->object, en);
3251 } 3277 }
3252 3278
3253 /* delete preedit characters */ 3279 /* delete preedit characters */
diff --git a/legacy/edje/src/lib/edje_private.h b/legacy/edje/src/lib/edje_private.h
index 30bb242..9636129 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);
1937Eina_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); 1937Eina_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);
1938const Eina_List *_edje_entry_items_list(Edje_Real_Part *rp); 1938const Eina_List *_edje_entry_items_list(Edje_Real_Part *rp);
1939void _edje_entry_cursor_geometry_get(Edje_Real_Part *rp, Evas_Coord *cx, Evas_Coord *cy, Evas_Coord *cw, Evas_Coord *ch); 1939void _edje_entry_cursor_geometry_get(Edje_Real_Part *rp, Evas_Coord *cx, Evas_Coord *cy, Evas_Coord *cw, Evas_Coord *ch);
1940void _edje_entry_user_insert(Edje_Real_Part *rp, const char *text);
1940void _edje_entry_select_allow_set(Edje_Real_Part *rp, Eina_Bool allow); 1941void _edje_entry_select_allow_set(Edje_Real_Part *rp, Eina_Bool allow);
1941Eina_Bool _edje_entry_select_allow_get(const Edje_Real_Part *rp); 1942Eina_Bool _edje_entry_select_allow_get(const Edje_Real_Part *rp);
1942void _edje_entry_select_abort(Edje_Real_Part *rp); 1943void _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 8c72fd8..f844e78 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
1472} 1472}
1473 1473
1474EAPI void 1474EAPI void
1475edje_object_part_text_user_insert(const Evas_Object *obj, const char *part, const char *text)
1476{
1477 Edje *ed;
1478 Edje_Real_Part *rp;
1479
1480 ed = _edje_fetch(obj);
1481 if ((!ed) || (!part)) return;
1482 rp = _edje_real_part_recursive_get(ed, part);
1483 if (!rp) return;
1484 if (rp->part->entry_mode > EDJE_ENTRY_EDIT_MODE_NONE)
1485 _edje_entry_user_insert(rp, text);
1486}
1487
1488EAPI void
1475edje_object_part_text_select_allow_set(const Evas_Object *obj, const char *part, Eina_Bool allow) 1489edje_object_part_text_select_allow_set(const Evas_Object *obj, const char *part, Eina_Bool allow)
1476{ 1490{
1477 Edje *ed; 1491 Edje *ed;