1 #include "edje_private.h"
5 static Eina_Bool _edje_entry_imf_retrieve_surrounding_cb(void *data, Ecore_IMF_Context *ctx, char **text, int *cursor_pos);
6 static void _edje_entry_imf_event_commit_cb(void *data, Ecore_IMF_Context *ctx, void *event_info);
7 static void _edje_entry_imf_event_preedit_changed_cb(void *data, Ecore_IMF_Context *ctx, void *event_info);
8 static void _edje_entry_imf_event_delete_surrounding_cb(void *data, Ecore_IMF_Context *ctx, void *event);
12 static void _edje_entry_start_handler_mouse_down_cb(void *data, Evas *e, Evas_Object *obj, void *event_info);
13 static void _edje_entry_start_handler_mouse_move_cb(void *data, Evas *e, Evas_Object *obj, void *event_info);
14 static void _edje_entry_start_handler_mouse_up_cb(void *data, Evas *e, Evas_Object *obj, void *event_info);
16 static void _edje_entry_end_handler_mouse_down_cb(void *data, Evas *e, Evas_Object *obj, void *event_info);
17 static void _edje_entry_end_handler_mouse_move_cb(void *data, Evas *e, Evas_Object *obj, void *event_info);
18 static void _edje_entry_end_handler_mouse_up_cb(void *data, Evas *e, Evas_Object *obj, void *event_info);
20 static void _edje_entry_cursor_handler_mouse_down_cb(void *data, Evas *e, Evas_Object *obj, void *event_info);
21 static void _edje_entry_cursor_handler_mouse_move_cb(void *data, Evas *e, Evas_Object *obj, void *event_info);
22 static void _edje_entry_cursor_handler_mouse_up_cb(void *data, Evas *e, Evas_Object *obj, void *event_info);
25 typedef struct _Entry Entry;
26 typedef struct _Sel Sel;
27 typedef struct _Anchor Anchor;
30 typedef enum _Entry_Long_Press_State
34 _ENTRY_LONG_PRESS_RELEASED
35 } Entry_Long_Press_State;
38 static void _edje_entry_imf_cursor_location_set(Entry *en);
39 static void _edje_entry_imf_cursor_info_set(Entry *en);
44 Evas_Coord ox, oy; // TIZEN ONLY
45 Evas_Coord sx, sy; // TIZEN ONLY
46 Evas_Coord rx, ry; // TIZEN ONLY
47 Evas_Coord dx, dy; // TIZEN ONLY
48 Evas_Coord_Rectangle layout_region; // TIZEN ONLY
49 Evas_Coord_Rectangle viewport_region; // TIZEN ONLY
50 Evas_Object *cursor_bg;
51 Evas_Object *cursor_fg, *cursor_fg2;
52 Evas_Object *sel_handler_start; // TIZEN ONLY
53 Evas_Object *sel_handler_end; // TIZEN ONLY
54 Evas_Object *sel_handler_edge_start; // TIZEN ONLY
55 Evas_Object *sel_handler_edge_end; // TIZEN ONLY
56 Evas_Object *cursor_handler; // TIZEN ONLY
57 Evas_Textblock_Cursor *cursor;
58 Evas_Textblock_Cursor *sel_start, *sel_end;
59 Evas_Textblock_Cursor *cursor_user, *cursor_user_extra;
60 Evas_Textblock_Cursor *preedit_start, *preedit_end;
61 Ecore_Timer *pw_timer;
64 Eina_List *anchorlist;
68 Edje_Input_Panel_Lang input_panel_lang;
69 Eina_Bool composing : 1;
70 Eina_Bool selecting : 1;
71 Eina_Bool have_selection : 1;
72 Eina_Bool select_allow : 1;
73 Eina_Bool select_mod_start : 1;
74 Eina_Bool select_mod_end : 1;
75 Eina_Bool handler_bypassing: 1; // TIZEN ONLY
76 Eina_Bool cursor_handler_disabled: 1; // TIZEN ONLY
77 Eina_Bool cursor_handler_show : 1; // TIZEN ONLY
78 Eina_Bool had_sel : 1;
79 Eina_Bool input_panel_enable : 1;
80 Eina_Bool prediction_allow : 1;
81 Eina_Bool focused : 1; // TIZEN ONLY
82 // TIZEN ONLY(130129) : Currently, for freezing cursor movement.
85 int select_dragging_state;
88 Eina_Bool have_preedit : 1;
89 Eina_Bool commit_cancel : 1; // For skipping useless commit
90 Ecore_IMF_Context *imf_context;
93 Ecore_Timer *long_press_timer; // TIZEN ONLY
94 Ecore_Timer *cursor_handler_click_timer; // TIZEN ONLY
95 Entry_Long_Press_State long_press_state; // TIZEN ONLY
100 Evas_Textblock_Rectangle rect;
101 Evas_Object *obj_fg, *obj_bg, *obj, *sobj;
108 Evas_Textblock_Cursor *start, *end;
113 #ifdef HAVE_ECORE_IMF
115 _preedit_clear(Entry *en)
117 if (en->preedit_start)
119 evas_textblock_cursor_free(en->preedit_start);
120 en->preedit_start = NULL;
125 evas_textblock_cursor_free(en->preedit_end);
126 en->preedit_end = NULL;
129 en->have_preedit = EINA_FALSE;
133 _preedit_del(Entry *en)
135 if (!en || !en->have_preedit) return;
136 if (!en->preedit_start || !en->preedit_end) return;
137 if (!evas_textblock_cursor_compare(en->preedit_start, en->preedit_end)) return;
139 /* delete the preedit characters */
140 evas_textblock_cursor_range_delete(en->preedit_start, en->preedit_end);
144 _edje_entry_focus_in_cb(void *data, Evas_Object *o __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__)
150 if ((rp->type != EDJE_RP_TYPE_TEXT) ||
151 (!rp->typedata.text)) return;
152 if (!rp || !rp->typedata.text->entry_data || !rp->edje || !rp->edje->obj) return;
154 en = rp->typedata.text->entry_data;
155 if (!en || !en->imf_context) return;
157 if (evas_object_focus_get(rp->edje->obj))
159 // TIZEN ONLY - START
160 if ((!en->sel_handler_start) && (!en->sel_handler_end) &&
161 (en->rp->part->select_mode == EDJE_ENTRY_SELECTION_MODE_BLOCK_HANDLE))
163 if (rp->part->source8)
165 en->sel_handler_end = edje_object_add(en->rp->edje->base.evas);
166 edje_object_file_set(en->sel_handler_end, en->rp->edje->path, en->rp->part->source8);
168 evas_object_layer_set(en->sel_handler_end, EVAS_LAYER_MAX - 2);
169 en->rp->edje->subobjs = eina_list_append(en->rp->edje->subobjs, en->sel_handler_end);
170 evas_object_event_callback_add(en->sel_handler_end, EVAS_CALLBACK_MOUSE_DOWN, _edje_entry_end_handler_mouse_down_cb, en->rp);
171 evas_object_event_callback_add(en->sel_handler_end, EVAS_CALLBACK_MOUSE_UP, _edje_entry_end_handler_mouse_up_cb, en->rp);
172 evas_object_event_callback_add(en->sel_handler_end, EVAS_CALLBACK_MOUSE_MOVE, _edje_entry_end_handler_mouse_move_cb, en->rp);
175 if (rp->part->source7)
177 en->sel_handler_start = edje_object_add(en->rp->edje->base.evas);
178 edje_object_file_set(en->sel_handler_start, en->rp->edje->path, en->rp->part->source7);
179 evas_object_layer_set(en->sel_handler_start, EVAS_LAYER_MAX - 2);
180 en->rp->edje->subobjs = eina_list_append(en->rp->edje->subobjs, en->sel_handler_start);
181 evas_object_event_callback_add(en->sel_handler_start, EVAS_CALLBACK_MOUSE_DOWN, _edje_entry_start_handler_mouse_down_cb, en->rp);
182 evas_object_event_callback_add(en->sel_handler_start, EVAS_CALLBACK_MOUSE_UP, _edje_entry_start_handler_mouse_up_cb, en->rp);
183 evas_object_event_callback_add(en->sel_handler_start, EVAS_CALLBACK_MOUSE_MOVE, _edje_entry_start_handler_mouse_move_cb, en->rp);
187 if (rp->part->source10)
189 en->sel_handler_edge_start = edje_object_add(en->rp->edje->base.evas);
190 edje_object_file_set(en->sel_handler_edge_start, en->rp->edje->path, en->rp->part->source10);
191 evas_object_layer_set(en->sel_handler_edge_start, EVAS_LAYER_MAX - 2);
192 en->rp->edje->subobjs = eina_list_append(en->rp->edje->subobjs, en->sel_handler_edge_start);
193 evas_object_clip_set(en->sel_handler_edge_start, evas_object_clip_get(rp->object));
197 if (rp->part->source11)
199 en->sel_handler_edge_end = edje_object_add(en->rp->edje->base.evas);
200 edje_object_file_set(en->sel_handler_edge_end, en->rp->edje->path, en->rp->part->source11);
201 evas_object_layer_set(en->sel_handler_edge_end, EVAS_LAYER_MAX - 2);
202 en->rp->edje->subobjs = eina_list_append(en->rp->edje->subobjs, en->sel_handler_edge_end);
203 evas_object_clip_set(en->sel_handler_edge_end, evas_object_clip_get(rp->object));
206 if (en->sel_handler_start)
207 edje_object_signal_emit(en->sel_handler_start, "edje,focus,in", "edje");
208 if (en->sel_handler_end)
209 edje_object_signal_emit(en->sel_handler_end, "edje,focus,in", "edje");
210 if (en->cursor_handler)
211 edje_object_signal_emit(en->cursor_handler, "edje,focus,in", "edje");
212 if (en->sel_handler_edge_start)
213 edje_object_signal_emit(en->sel_handler_edge_start, "edje,focus,in", "edje");
214 if (en->sel_handler_edge_end)
215 edje_object_signal_emit(en->sel_handler_edge_end, "edje,focus,in", "edje");
218 ecore_imf_context_reset(en->imf_context);
219 ecore_imf_context_focus_in(en->imf_context);
220 _edje_entry_imf_cursor_info_set(en);
221 en->focused = EINA_TRUE;
226 _edje_entry_focus_out_cb(void *data, Evas_Object *o __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__)
232 if ((rp->type != EDJE_RP_TYPE_TEXT) ||
233 (!rp->typedata.text)) return;
234 if (!rp || !rp->typedata.text->entry_data) return;
236 en = rp->typedata.text->entry_data;
237 if (!en || !en->imf_context) return;
239 // TIZEN ONLY - START
240 if (en->sel_handler_start)
241 edje_object_signal_emit(en->sel_handler_start, "edje,focus,out", "edje");
242 if (en->sel_handler_end)
243 edje_object_signal_emit(en->sel_handler_end, "edje,focus,out", "edje");
244 if (en->cursor_handler)
245 edje_object_signal_emit(en->cursor_handler, "edje,focus,out", "edje");
246 if (en->sel_handler_edge_start)
247 edje_object_signal_emit(en->sel_handler_edge_start, "edje,focus,out", "edje");
248 if (en->sel_handler_edge_end)
249 edje_object_signal_emit(en->sel_handler_edge_end, "edje,focus,out", "edje");
252 ecore_imf_context_reset(en->imf_context);
253 ecore_imf_context_focus_out(en->imf_context);
258 _edje_focus_in_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
261 #ifdef HAVE_ECORE_IMF
266 _edje_emit(ed, "focus,in", "");
268 rp = ed->focused_part;
271 if ((rp->type != EDJE_RP_TYPE_TEXT) ||
272 (!rp->typedata.text)) return;
273 en = rp->typedata.text->entry_data;
274 if ((!en) || (rp->part->type != EDJE_PART_TYPE_TEXTBLOCK) ||
275 (rp->part->entry_mode < EDJE_ENTRY_EDIT_MODE_SELECTABLE)) // TIZEN ONLY
278 // TIZEN ONLY - START
279 if ((!en->sel_handler_start) && (!en->sel_handler_end) &&
280 (en->rp->part->select_mode == EDJE_ENTRY_SELECTION_MODE_BLOCK_HANDLE))
282 if (rp->part->source8)
284 en->sel_handler_end = edje_object_add(en->rp->edje->base.evas);
285 edje_object_file_set(en->sel_handler_end, en->rp->edje->path, en->rp->part->source8);
287 evas_object_layer_set(en->sel_handler_end, EVAS_LAYER_MAX - 2);
288 en->rp->edje->subobjs = eina_list_append(en->rp->edje->subobjs, en->sel_handler_end);
289 evas_object_event_callback_add(en->sel_handler_end, EVAS_CALLBACK_MOUSE_DOWN, _edje_entry_end_handler_mouse_down_cb, en->rp);
290 evas_object_event_callback_add(en->sel_handler_end, EVAS_CALLBACK_MOUSE_UP, _edje_entry_end_handler_mouse_up_cb, en->rp);
291 evas_object_event_callback_add(en->sel_handler_end, EVAS_CALLBACK_MOUSE_MOVE, _edje_entry_end_handler_mouse_move_cb, en->rp);
294 if (rp->part->source7)
296 en->sel_handler_start = edje_object_add(en->rp->edje->base.evas);
297 edje_object_file_set(en->sel_handler_start, en->rp->edje->path, en->rp->part->source7);
298 evas_object_layer_set(en->sel_handler_start, EVAS_LAYER_MAX - 2);
299 en->rp->edje->subobjs = eina_list_append(en->rp->edje->subobjs, en->sel_handler_start);
300 evas_object_event_callback_add(en->sel_handler_start, EVAS_CALLBACK_MOUSE_DOWN, _edje_entry_start_handler_mouse_down_cb, en->rp);
301 evas_object_event_callback_add(en->sel_handler_start, EVAS_CALLBACK_MOUSE_UP, _edje_entry_start_handler_mouse_up_cb, en->rp);
302 evas_object_event_callback_add(en->sel_handler_start, EVAS_CALLBACK_MOUSE_MOVE, _edje_entry_start_handler_mouse_move_cb, en->rp);
306 if (rp->part->source10)
308 en->sel_handler_edge_start = edje_object_add(en->rp->edje->base.evas);
309 edje_object_file_set(en->sel_handler_edge_start, en->rp->edje->path, en->rp->part->source10);
310 evas_object_layer_set(en->sel_handler_edge_start, EVAS_LAYER_MAX - 2);
311 en->rp->edje->subobjs = eina_list_append(en->rp->edje->subobjs, en->sel_handler_edge_start);
312 evas_object_clip_set(en->sel_handler_edge_start, evas_object_clip_get(rp->object));
316 if (rp->part->source11)
318 en->sel_handler_edge_end = edje_object_add(en->rp->edje->base.evas);
319 edje_object_file_set(en->sel_handler_edge_end, en->rp->edje->path, en->rp->part->source11);
320 evas_object_layer_set(en->sel_handler_edge_end, EVAS_LAYER_MAX - 2);
321 en->rp->edje->subobjs = eina_list_append(en->rp->edje->subobjs, en->sel_handler_edge_end);
322 evas_object_clip_set(en->sel_handler_edge_end, evas_object_clip_get(rp->object));
325 if (en->sel_handler_start)
326 edje_object_signal_emit(en->sel_handler_start, "edje,focus,in", "edje");
327 if (en->sel_handler_end)
328 edje_object_signal_emit(en->sel_handler_end, "edje,focus,in", "edje");
329 if (en->cursor_handler)
330 edje_object_signal_emit(en->cursor_handler, "edje,focus,in", "edje");
331 if (en->sel_handler_edge_start)
332 edje_object_signal_emit(en->sel_handler_edge_start, "edje,focus,in", "edje");
333 if (en->sel_handler_edge_end)
334 edje_object_signal_emit(en->sel_handler_edge_end, "edje,focus,in", "edje");
336 en->focused = EINA_TRUE;
337 if (rp->part->entry_mode < EDJE_ENTRY_EDIT_MODE_EDITABLE) return;
340 #ifdef HAVE_ECORE_IMF
341 if (!en->imf_context) return;
343 ecore_imf_context_reset(en->imf_context);
344 ecore_imf_context_focus_in(en->imf_context);
345 _edje_entry_imf_cursor_info_set(en);
350 _edje_focus_out_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
353 #ifdef HAVE_ECORE_IMF
354 Edje_Real_Part *rp = ed->focused_part;
358 _edje_emit(ed, "focus,out", "");
360 #ifdef HAVE_ECORE_IMF
362 if ((rp->type != EDJE_RP_TYPE_TEXT) ||
363 (!rp->typedata.text)) return;
364 en = rp->typedata.text->entry_data;
365 if ((!en) || (rp->part->type != EDJE_PART_TYPE_TEXTBLOCK) ||
366 (rp->part->entry_mode < EDJE_ENTRY_EDIT_MODE_SELECTABLE)) // TIZEN ONLY
369 // TIZEN ONLY - START
370 if (en->sel_handler_start)
371 edje_object_signal_emit(en->sel_handler_start, "edje,focus,out", "edje");
372 if (en->sel_handler_end)
373 edje_object_signal_emit(en->sel_handler_end, "edje,focus,out", "edje");
374 if (en->cursor_handler)
375 edje_object_signal_emit(en->cursor_handler, "edje,focus,out", "edje");
376 if (en->sel_handler_edge_start)
377 edje_object_signal_emit(en->sel_handler_edge_start, "edje,focus,out", "edje");
378 if (en->sel_handler_edge_end)
379 edje_object_signal_emit(en->sel_handler_edge_end, "edje,focus,out", "edje");
380 en->focused = EINA_FALSE;
381 if (rp->part->entry_mode < EDJE_ENTRY_EDIT_MODE_EDITABLE) return;
384 if (!en->imf_context) return;
386 ecore_imf_context_reset(en->imf_context);
387 ecore_imf_context_focus_out(en->imf_context);
392 _text_filter_markup_prepend_internal(Entry *en, Evas_Textblock_Cursor *c, char *text)
394 Edje_Markup_Filter_Callback *cb;
397 EINA_LIST_FOREACH(en->rp->edje->markup_filter_callbacks, l, cb)
399 if (!strcmp(cb->part, en->rp->part->name))
401 cb->func(cb->data, en->rp->edje->obj, cb->part, &text);
405 #ifdef HAVE_ECORE_IMF
406 // For skipping useless commit
407 if (en->have_preedit && (!text || !strcmp(text, "")))
408 en->commit_cancel = EINA_TRUE;
410 en->commit_cancel = EINA_FALSE;
414 evas_object_textblock_text_markup_prepend(c, text);
420 _text_filter_text_prepend(Entry *en, Evas_Textblock_Cursor *c, const char *text)
423 Edje_Text_Insert_Filter_Callback *cb;
426 text2 = strdup(text);
427 EINA_LIST_FOREACH(en->rp->edje->text_insert_filter_callbacks, l, cb)
429 if (!strcmp(cb->part, en->rp->part->name))
431 cb->func(cb->data, en->rp->edje->obj, cb->part, EDJE_TEXT_FILTER_TEXT, &text2);
438 markup_text = evas_textblock_text_utf8_to_markup(NULL, text2);
441 _text_filter_markup_prepend_internal(en, c, markup_text);
446 _text_filter_format_prepend(Entry *en, Evas_Textblock_Cursor *c, const char *text)
449 Edje_Text_Insert_Filter_Callback *cb;
452 text2 = strdup(text);
453 EINA_LIST_FOREACH(en->rp->edje->text_insert_filter_callbacks, l, cb)
455 if (!strcmp(cb->part, en->rp->part->name))
457 cb->func(cb->data, en->rp->edje->obj, cb->part, EDJE_TEXT_FILTER_FORMAT, &text2);
463 char *s, *markup_text;
469 while (*s == ' ') s++;
475 markup_text = (char*) malloc(strlen(s) + 3);
478 *(markup_text) = '<';
479 strncpy((markup_text + 1), s, strlen(s));
480 *(markup_text + strlen(s) + 1) = '>';
481 *(markup_text + strlen(s) + 2) = '\0';
484 else if (s[0] == '-')
487 while (*s == ' ') s++;
493 markup_text = (char*) malloc(strlen(s) + 4);
496 *(markup_text) = '<';
497 *(markup_text + 1) = '/';
498 strncpy((markup_text + 2), s, strlen(s));
499 *(markup_text + strlen(s) + 2) = '>';
500 *(markup_text + strlen(s) + 3) = '\0';
505 markup_text = (char*) malloc(strlen(s) + 4);
508 *(markup_text) = '<';
509 strncpy((markup_text + 1), s, strlen(s));
510 *(markup_text + strlen(s) + 1) = '/';
511 *(markup_text + strlen(s) + 2) = '>';
512 *(markup_text + strlen(s) + 3) = '\0';
517 _text_filter_markup_prepend_internal(en, c, markup_text);
522 _text_filter_markup_prepend(Entry *en, Evas_Textblock_Cursor *c, const char *text)
525 Edje_Text_Insert_Filter_Callback *cb;
528 text2 = strdup(text);
529 EINA_LIST_FOREACH(en->rp->edje->text_insert_filter_callbacks, l, cb)
531 if (!strcmp(cb->part, en->rp->part->name))
533 cb->func(cb->data, en->rp->edje->obj, cb->part, EDJE_TEXT_FILTER_MARKUP, &text2);
538 _text_filter_markup_prepend_internal(en, c, text2);
542 _curs_update_from_curs(Evas_Textblock_Cursor *c, Evas_Object *o __UNUSED__, Entry *en, Evas_Coord *cx, Evas_Coord *cy)
545 Evas_Textblock_Cursor_Type cur_type;
546 if (c != en->cursor) return;
547 switch (en->rp->part->cursor_mode)
549 case EDJE_ENTRY_CURSOR_MODE_BEFORE:
550 cur_type = EVAS_TEXTBLOCK_CURSOR_BEFORE;
552 case EDJE_ENTRY_CURSOR_MODE_UNDER:
553 /* no break for a resaon */
555 cur_type = EVAS_TEXTBLOCK_CURSOR_UNDER;
557 evas_textblock_cursor_geometry_get(c, cx, cy, &cw, &ch, NULL, cur_type);
563 _curs_line_last_get(Evas_Textblock_Cursor *c __UNUSED__, Evas_Object *o, Entry *en __UNUSED__)
565 Evas_Textblock_Cursor *cc;
568 cc = evas_object_textblock_cursor_new(o);
569 evas_textblock_cursor_paragraph_last(cc);
570 ln = evas_textblock_cursor_line_geometry_get(cc, NULL, NULL, NULL, NULL);
571 evas_textblock_cursor_free(cc);
576 _curs_lin_start(Evas_Textblock_Cursor *c, Evas_Object *o __UNUSED__,
577 Entry *en __UNUSED__)
579 evas_textblock_cursor_line_char_first(c);
583 _curs_lin_end(Evas_Textblock_Cursor *c, Evas_Object *o __UNUSED__,
584 Entry *en __UNUSED__)
586 evas_textblock_cursor_line_char_last(c);
590 _curs_start(Evas_Textblock_Cursor *c, Evas_Object *o __UNUSED__,
591 Entry *en __UNUSED__)
593 evas_textblock_cursor_paragraph_first(c);
597 _curs_end(Evas_Textblock_Cursor *c, Evas_Object *o __UNUSED__, Entry *en __UNUSED__)
599 evas_textblock_cursor_paragraph_last(c);
603 _curs_jump_line(Evas_Textblock_Cursor *c, Evas_Object *o, Entry *en, int ln)
606 Evas_Coord lx, ly, lw, lh;
607 int last = _curs_line_last_get(c, o, en);
609 if (ln < 0) return EINA_FALSE;
610 if (ln > last) return EINA_FALSE;
612 _curs_update_from_curs(c, o, en, &cx, &cy);
614 if (!evas_object_textblock_line_number_geometry_get(o, ln, &lx, &ly, &lw, &lh))
616 if (evas_textblock_cursor_char_coord_set(c, cx, ly + (lh / 2)))
618 evas_textblock_cursor_line_set(c, ln);
619 if (cx < (lx + (lw / 2)))
621 if (ln == last) _curs_end(c, o, en);
622 _curs_lin_start(c, o, en);
629 _curs_lin_end(c, o, en);
635 _curs_jump_line_by(Evas_Textblock_Cursor *c, Evas_Object *o, Entry *en, int by)
639 ln = evas_textblock_cursor_line_geometry_get(c, NULL, NULL, NULL, NULL) + by;
640 return _curs_jump_line(c, o, en, ln);
644 _curs_up(Evas_Textblock_Cursor *c, Evas_Object *o, Entry *en)
646 return _curs_jump_line_by(c, o, en, -1);
650 _curs_down(Evas_Textblock_Cursor *c, Evas_Object *o, Entry *en)
652 return _curs_jump_line_by(c, o, en, 1);
656 _sel_start(Evas_Textblock_Cursor *c, Evas_Object *o, Entry *en)
658 if (en->sel_start) return;
659 en->sel_start = evas_object_textblock_cursor_new(o);
660 evas_textblock_cursor_copy(c, en->sel_start);
661 en->sel_end = evas_object_textblock_cursor_new(o);
662 evas_textblock_cursor_copy(c, en->sel_end);
664 en->have_selection = EINA_FALSE;
668 en->selection = NULL;
673 _sel_enable(Evas_Textblock_Cursor *c __UNUSED__, Evas_Object *o __UNUSED__, Entry *en)
675 if (en->have_selection) return;
676 en->have_selection = EINA_TRUE;
680 en->selection = NULL;
683 _edje_entry_imf_context_reset(en->rp);
684 _edje_emit(en->rp->edje, "selection,start", en->rp->part->name);
688 _sel_extend(Evas_Textblock_Cursor *c, Evas_Object *o, Entry *en)
690 if (!en->sel_end) return;
691 _sel_enable(c, o, en);
692 if (!evas_textblock_cursor_compare(c, en->sel_end)) return;
694 evas_textblock_cursor_copy(c, en->sel_end);
696 _edje_entry_imf_cursor_info_set(en);
701 en->selection = NULL;
703 _edje_emit(en->rp->edje, "selection,changed", en->rp->part->name);
704 // TIZEN ONLY - start
705 if (en->cursor_handler_show)
707 evas_object_hide(en->cursor_handler);
708 en->cursor_handler_show = EINA_FALSE;
714 _sel_preextend(Evas_Textblock_Cursor *c, Evas_Object *o, Entry *en)
716 if (!en->sel_end) return;
717 _sel_enable(c, o, en);
718 if (!evas_textblock_cursor_compare(c, en->sel_start)) return;
720 evas_textblock_cursor_copy(c, en->sel_start);
722 _edje_entry_imf_cursor_info_set(en);
727 en->selection = NULL;
729 _edje_emit(en->rp->edje, "selection,changed", en->rp->part->name);
730 // TIZEN ONLY - start
731 if (en->cursor_handler_show)
733 evas_object_hide(en->cursor_handler);
734 en->cursor_handler_show = EINA_FALSE;
740 _sel_clear(Evas_Textblock_Cursor *c __UNUSED__, Evas_Object *o __UNUSED__, Entry *en)
742 en->had_sel = EINA_FALSE;
745 evas_textblock_cursor_free(en->sel_start);
746 evas_textblock_cursor_free(en->sel_end);
747 en->sel_start = NULL;
753 en->selection = NULL;
760 if (sel->obj_bg) evas_object_del(sel->obj_bg);
761 if (sel->obj_fg) evas_object_del(sel->obj_fg);
763 // TIZEN ONLY - START
764 if (en->rp->part->select_mode == EDJE_ENTRY_SELECTION_MODE_BLOCK_HANDLE)
766 evas_object_hide(en->sel_handler_start);
767 evas_object_hide(en->sel_handler_end);
769 evas_object_hide(en->sel_handler_edge_start);
770 evas_object_hide(en->sel_handler_edge_end);
774 en->sel = eina_list_remove_list(en->sel, en->sel);
776 if (en->have_selection)
778 en->have_selection = EINA_FALSE;
779 evas_object_show(en->cursor_fg);
780 _edje_emit(en->rp->edje, "selection,cleared", en->rp->part->name);
785 _sel_update(Evas_Textblock_Cursor *c __UNUSED__, Evas_Object *o, Entry *en)
787 Eina_List *range = NULL, *l;
789 Evas_Coord x, y, w, h;
790 Evas_Object *smart, *clip;
792 smart = evas_object_smart_parent_get(o);
793 clip = evas_object_clip_get(o);
796 range = evas_textblock_cursor_range_geometry_get(en->sel_start, en->sel_end);
801 if (eina_list_count(range) != eina_list_count(en->sel))
806 if (sel->obj_bg) evas_object_del(sel->obj_bg);
807 if (sel->obj_fg) evas_object_del(sel->obj_fg);
809 en->sel = eina_list_remove_list(en->sel, en->sel);
811 if (en->have_selection)
813 for (l = range; l; l = eina_list_next(l))
817 sel = calloc(1, sizeof(Sel));
818 en->sel = eina_list_append(en->sel, sel);
819 ob = edje_object_add(en->rp->edje->base.evas);
820 edje_object_file_set(ob, en->rp->edje->path, en->rp->part->source);
821 evas_object_smart_member_add(ob, smart);
822 evas_object_stack_below(ob, o);
823 evas_object_clip_set(ob, clip);
824 evas_object_pass_events_set(ob, EINA_TRUE);
825 evas_object_show(ob);
827 _edje_subobj_register(en->rp->edje, sel->obj_bg);
829 ob = edje_object_add(en->rp->edje->base.evas);
830 edje_object_file_set(ob, en->rp->edje->path, en->rp->part->source2);
831 evas_object_smart_member_add(ob, smart);
832 evas_object_stack_above(ob, o);
833 evas_object_clip_set(ob, clip);
834 evas_object_pass_events_set(ob, EINA_TRUE);
835 evas_object_show(ob);
837 _edje_subobj_register(en->rp->edje, sel->obj_fg);
842 evas_object_geometry_get(o, &x, &y, &w, &h);
843 if (en->have_selection)
845 // TIZEN ONLY - START
846 int list_cnt, list_idx;
848 list_cnt = eina_list_count(en->sel);
850 evas_object_hide(en->cursor_fg);
851 evas_object_hide(en->cursor_bg);
854 EINA_LIST_FOREACH(en->sel, l, sel)
856 Evas_Textblock_Rectangle *r;
857 list_idx++; // TIZEN ONLY
862 evas_object_move(sel->obj_bg, x + r->x, y + r->y);
863 evas_object_resize(sel->obj_bg, r->w, r->h);
867 evas_object_move(sel->obj_fg, x + r->x, y + r->y);
868 evas_object_resize(sel->obj_fg, r->w, r->h);
870 // TIZEN ONLY - START
871 if (en->rp->part->select_mode == EDJE_ENTRY_SELECTION_MODE_BLOCK_HANDLE)
874 const char *gc = edje_object_data_get(en->sel_handler_start, "gap");
876 if (gc) bh_gap = atoi(gc);
878 if (en->handler_bypassing)
889 if (list_idx == fh_idx)
891 Evas_Coord nx, ny, handler_height = 0;
893 edje_object_part_geometry_get(en->sel_handler_start, "handle", NULL, NULL, NULL, &handler_height);
895 //keep same touch pos when by passing
896 if (en->handler_bypassing)
898 nx = x + r->x + r->w;
906 evas_object_hide(en->sel_handler_start);
908 edje_object_size_min_calc(en->sel_handler_edge_start, &edge_w, NULL);
909 evas_object_move(en->sel_handler_edge_start, nx, ny);
910 evas_object_resize(en->sel_handler_edge_start, edge_w, r->h);
912 evas_object_hide(en->sel_handler_edge_start);
914 // if viewport region is not set, show handlers
915 if (en->viewport_region.x == -1 && en->viewport_region.y == -1 &&
916 en->viewport_region.w == -1 && en->viewport_region.h == -1)
918 evas_object_hide(en->sel_handler_start);
919 evas_object_move(en->sel_handler_start, nx, ny);
920 edje_object_signal_emit(en->sel_handler_start, "elm,state,top", "elm");
921 evas_object_show(en->sel_handler_start);
923 evas_object_show(en->sel_handler_edge_start);
927 if ((en->viewport_region.w > 0 && en->viewport_region.h > 0) &&
928 (nx >= en->viewport_region.x) && (nx <= (en->viewport_region.x + en->viewport_region.w)) &&
929 (ny >= en->viewport_region.y) && (ny <= (en->viewport_region.y + en->viewport_region.h)))
931 if (en->layout_region.w != -1 && en->layout_region.h != -1 &&
932 ((ny - handler_height) > en->layout_region.y))
934 evas_object_move(en->sel_handler_start, nx, ny);
935 if (nx <= en->layout_region.x + bh_gap)
936 edje_object_signal_emit(en->sel_handler_start, "elm,state,top,reversed", "elm");
938 edje_object_signal_emit(en->sel_handler_start, "elm,state,top", "elm");
942 evas_object_move(en->sel_handler_start, nx, ny + r->h);
943 if (nx <= en->layout_region.x + bh_gap)
944 edje_object_signal_emit(en->sel_handler_start, "elm,state,bottom,reversed", "elm");
946 edje_object_signal_emit(en->sel_handler_start, "elm,state,bottom", "elm");
949 evas_object_show(en->sel_handler_start);
950 evas_object_show(en->sel_handler_edge_start);
954 if (list_idx == eh_idx)
956 Evas_Coord nx, ny, handler_height = 0;
959 edje_object_part_geometry_get(en->sel_handler_end, "handle", NULL, NULL, NULL, &handler_height);
961 //keep pos when bypassing
962 if (en->handler_bypassing)
965 ny = y + r->y + r->h;
969 nx = x + r->x + r->w;
970 ny = y + r->y + r->h;
973 evas_object_hide(en->sel_handler_end);
975 edje_object_size_min_calc(en->sel_handler_edge_end, &edge_w, NULL);
976 evas_object_move(en->sel_handler_edge_end, nx, ny - r->h);
977 evas_object_resize(en->sel_handler_edge_end, edge_w, r->h);
979 evas_object_hide(en->sel_handler_edge_end);
981 // if viewport region is not set, show handlers
982 if (en->viewport_region.x == -1 && en->viewport_region.y == -1 &&
983 en->viewport_region.w == -1 && en->viewport_region.h == -1)
985 evas_object_move(en->sel_handler_end, nx, ny);
986 evas_object_move(en->sel_handler_end, nx, ny);
987 edje_object_signal_emit(en->sel_handler_end, "elm,state,bottom", "elm");
988 evas_object_show(en->sel_handler_end);
990 evas_object_show(en->sel_handler_edge_end);
994 if ((en->viewport_region.w > 0 && en->viewport_region.h > 0) &&
995 (nx >= en->viewport_region.x) && (nx <= (en->viewport_region.x + en->viewport_region.w)) &&
996 (ny >= en->viewport_region.y) && (ny <= (en->viewport_region.y + en->viewport_region.h)))
998 evas_object_move(en->sel_handler_end, nx, ny - r->h);
999 if (en->layout_region.w != -1 && en->layout_region.h != -1 &&
1000 ((ny + handler_height) > (en->layout_region.y + en->layout_region.h)))
1002 if (nx >= en->layout_region.w - bh_gap)
1003 edje_object_signal_emit(en->sel_handler_end, "elm,state,top,reversed", "elm");
1005 edje_object_signal_emit(en->sel_handler_end, "elm,state,top", "elm");
1009 evas_object_move(en->sel_handler_end, nx, ny);
1011 if (nx >= en->layout_region.w - bh_gap)
1012 edje_object_signal_emit(en->sel_handler_end, "elm,state,bottom,reversed", "elm");
1014 edje_object_signal_emit(en->sel_handler_end, "elm,state,bottom", "elm");
1017 evas_object_show(en->sel_handler_end);
1019 evas_object_show(en->sel_handler_edge_end);
1026 *(&(sel->rect)) = *r;
1027 range = eina_list_remove_list(range, range);
1036 range = eina_list_remove_list(range, range);
1042 _edje_anchor_mouse_down_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
1045 Evas_Event_Mouse_Down *ev = event_info;
1046 Edje_Real_Part *rp = an->en->rp;
1052 if ((rp->type != EDJE_RP_TYPE_TEXT) ||
1053 (!rp->typedata.text)) return;
1054 en = rp->typedata.text->entry_data;
1055 if (((rp->part->select_mode == EDJE_ENTRY_SELECTION_MODE_EXPLICIT) ||
1056 (rp->part->select_mode == EDJE_ENTRY_SELECTION_MODE_BLOCK_HANDLE)) &&
1059 ignored = rp->part->ignore_flags & ev->event_flags;
1060 if ((!ev->event_flags) || (!ignored))
1064 len = 200 + strlen(n);
1066 if (ev->flags & EVAS_BUTTON_TRIPLE_CLICK)
1067 snprintf(buf, len, "anchor,mouse,down,%i,%s,triple", ev->button, n);
1068 else if (ev->flags & EVAS_BUTTON_DOUBLE_CLICK)
1069 snprintf(buf, len, "anchor,mouse,down,%i,%s,double", ev->button, n);
1071 snprintf(buf, len, "anchor,mouse,down,%i,%s", ev->button, n);
1072 _edje_emit(rp->edje, buf, rp->part->name);
1077 _edje_anchor_mouse_up_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
1080 Evas_Event_Mouse_Up *ev = event_info;
1081 Edje_Real_Part *rp = an->en->rp;
1087 if ((rp->type != EDJE_RP_TYPE_TEXT) ||
1088 (!rp->typedata.text)) return;
1089 en = rp->typedata.text->entry_data;
1090 ignored = rp->part->ignore_flags & ev->event_flags;
1091 if (((rp->part->select_mode == EDJE_ENTRY_SELECTION_MODE_EXPLICIT) ||
1092 (rp->part->select_mode == EDJE_ENTRY_SELECTION_MODE_BLOCK_HANDLE)) &&
1097 len = 200 + strlen(n);
1099 if ((!ev->event_flags) || (!ignored))
1101 snprintf(buf, len, "anchor,mouse,up,%i,%s", ev->button, n);
1102 _edje_emit(rp->edje, buf, rp->part->name);
1104 if ((rp->still_in) && (rp->clicked_button == ev->button) && (!ignored))
1106 snprintf(buf, len, "anchor,mouse,clicked,%i,%s", ev->button, n);
1107 _edje_emit(rp->edje, buf, rp->part->name);
1112 _edje_anchor_mouse_move_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
1115 Evas_Event_Mouse_Move *ev = event_info;
1116 Edje_Real_Part *rp = an->en->rp;
1122 if ((rp->type != EDJE_RP_TYPE_TEXT) ||
1123 (!rp->typedata.text)) return;
1124 en = rp->typedata.text->entry_data;
1125 if (((rp->part->select_mode == EDJE_ENTRY_SELECTION_MODE_EXPLICIT) ||
1126 (rp->part->select_mode == EDJE_ENTRY_SELECTION_MODE_BLOCK_HANDLE)) &&
1129 ignored = rp->part->ignore_flags & ev->event_flags;
1130 if ((!ev->event_flags) || (!ignored))
1134 len = 200 + strlen(n);
1136 snprintf(buf, len, "anchor,mouse,move,%s", n);
1137 _edje_emit(rp->edje, buf, rp->part->name);
1142 _edje_anchor_mouse_in_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
1145 Evas_Event_Mouse_In *ev = event_info;
1146 Edje_Real_Part *rp = an->en->rp;
1151 ignored = rp->part->ignore_flags & ev->event_flags;
1152 if ((!ev->event_flags) || (!ignored))
1156 len = 200 + strlen(n);
1158 snprintf(buf, len, "anchor,mouse,in,%s", n);
1159 _edje_emit(rp->edje, buf, rp->part->name);
1164 _edje_anchor_mouse_out_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
1167 Evas_Event_Mouse_Out *ev = event_info;
1168 Edje_Real_Part *rp = an->en->rp;
1173 ignored = rp->part->ignore_flags & ev->event_flags;
1174 if ((!ev->event_flags) || (!ignored))
1178 len = 200 + strlen(n);
1180 snprintf(buf, len, "anchor,mouse,out,%s", n);
1181 _edje_emit(rp->edje, buf, rp->part->name);
1186 _anchors_update(Evas_Textblock_Cursor *c __UNUSED__, Evas_Object *o, Entry *en)
1188 Eina_List *l, *ll, *range = NULL;
1189 Evas_Coord x, y, w, h;
1190 Evas_Object *smart, *clip;
1194 smart = evas_object_smart_parent_get(o);
1195 clip = evas_object_clip_get(o);
1197 evas_object_geometry_get(o, &x, &y, &w, &h);
1198 EINA_LIST_FOREACH(en->anchors, l, an)
1209 sel = an->sel->data;
1210 if (sel->obj_bg) evas_object_del(sel->obj_bg);
1211 if (sel->obj_fg) evas_object_del(sel->obj_fg);
1212 if (sel->obj) evas_object_del(sel->obj);
1214 an->sel = eina_list_remove_list(an->sel, an->sel);
1217 sel = calloc(1, sizeof(Sel));
1218 an->sel = eina_list_append(an->sel, sel);
1220 if (en->rp->edje->item_provider.func)
1222 ob = en->rp->edje->item_provider.func
1223 (en->rp->edje->item_provider.data, smart,
1224 en->rp->part->name, an->name);
1225 evas_object_smart_member_add(ob, smart);
1226 evas_object_stack_above(ob, o);
1227 evas_object_clip_set(ob, clip);
1228 evas_object_pass_events_set(ob, EINA_TRUE);
1229 evas_object_show(ob);
1238 evas_textblock_cursor_range_geometry_get(an->start, an->end);
1239 if (eina_list_count(range) != eina_list_count(an->sel))
1243 sel = an->sel->data;
1244 if (sel->obj_bg) evas_object_del(sel->obj_bg);
1245 if (sel->obj_fg) evas_object_del(sel->obj_fg);
1246 if (sel->obj) evas_object_del(sel->obj);
1248 an->sel = eina_list_remove_list(an->sel, an->sel);
1250 for (ll = range; ll; ll = eina_list_next(ll))
1254 sel = calloc(1, sizeof(Sel));
1255 an->sel = eina_list_append(an->sel, sel);
1256 ob = edje_object_add(en->rp->edje->base.evas);
1257 edje_object_file_set(ob, en->rp->edje->path, en->rp->part->source5);
1258 evas_object_smart_member_add(ob, smart);
1259 evas_object_stack_below(ob, o);
1260 evas_object_clip_set(ob, clip);
1261 evas_object_pass_events_set(ob, EINA_TRUE);
1262 evas_object_show(ob);
1264 _edje_subobj_register(en->rp->edje, sel->obj_bg);
1266 ob = edje_object_add(en->rp->edje->base.evas);
1267 edje_object_file_set(ob, en->rp->edje->path, en->rp->part->source6);
1268 evas_object_smart_member_add(ob, smart);
1269 evas_object_stack_above(ob, o);
1270 evas_object_clip_set(ob, clip);
1271 evas_object_pass_events_set(ob, EINA_TRUE);
1272 evas_object_show(ob);
1274 _edje_subobj_register(en->rp->edje, sel->obj_fg);
1276 ob = evas_object_rectangle_add(en->rp->edje->base.evas);
1277 evas_object_color_set(ob, 0, 0, 0, 0);
1278 evas_object_smart_member_add(ob, smart);
1279 evas_object_stack_above(ob, o);
1280 evas_object_clip_set(ob, clip);
1281 evas_object_repeat_events_set(ob, EINA_TRUE);
1282 evas_object_event_callback_add(ob, EVAS_CALLBACK_MOUSE_DOWN, _edje_anchor_mouse_down_cb, an);
1283 evas_object_event_callback_add(ob, EVAS_CALLBACK_MOUSE_UP, _edje_anchor_mouse_up_cb, an);
1284 evas_object_event_callback_add(ob, EVAS_CALLBACK_MOUSE_MOVE, _edje_anchor_mouse_move_cb, an);
1285 evas_object_event_callback_add(ob, EVAS_CALLBACK_MOUSE_IN, _edje_anchor_mouse_in_cb, an);
1286 evas_object_event_callback_add(ob, EVAS_CALLBACK_MOUSE_OUT, _edje_anchor_mouse_out_cb, an);
1287 evas_object_show(ob);
1292 EINA_LIST_FOREACH(an->sel, ll, sel)
1296 Evas_Coord cx, cy, cw, ch;
1298 if (!evas_textblock_cursor_format_item_geometry_get
1299 (an->start, &cx, &cy, &cw, &ch))
1301 evas_object_move(sel->obj, x + cx, y + cy);
1302 evas_object_resize(sel->obj, cw, ch);
1306 Evas_Textblock_Rectangle *r;
1309 *(&(sel->rect)) = *r;
1312 evas_object_move(sel->obj_bg, x + r->x, y + r->y);
1313 evas_object_resize(sel->obj_bg, r->w, r->h);
1317 evas_object_move(sel->obj_fg, x + r->x, y + r->y);
1318 evas_object_resize(sel->obj_fg, r->w, r->h);
1322 evas_object_move(sel->obj, x + r->x, y + r->y);
1323 evas_object_resize(sel->obj, r->w, r->h);
1325 range = eina_list_remove_list(range, range);
1333 _anchors_clear(Evas_Textblock_Cursor *c __UNUSED__, Evas_Object *o __UNUSED__, Entry *en)
1335 while (en->anchorlist)
1337 free(en->anchorlist->data);
1338 en->anchorlist = eina_list_remove_list(en->anchorlist, en->anchorlist);
1340 while (en->itemlist)
1342 free(en->itemlist->data);
1343 en->itemlist = eina_list_remove_list(en->itemlist, en->itemlist);
1347 Anchor *an = en->anchors->data;
1349 evas_textblock_cursor_free(an->start);
1350 evas_textblock_cursor_free(an->end);
1353 Sel *sel = an->sel->data;
1354 if (sel->obj_bg) evas_object_del(sel->obj_bg);
1355 if (sel->obj_fg) evas_object_del(sel->obj_fg);
1356 if (sel->obj) evas_object_del(sel->obj);
1358 an->sel = eina_list_remove_list(an->sel, an->sel);
1362 en->anchors = eina_list_remove_list(en->anchors, en->anchors);
1367 _anchors_get(Evas_Textblock_Cursor *c, Evas_Object *o, Entry *en)
1369 const Eina_List *anchors_a, *anchors_item;
1371 _anchors_clear(c, o, en);
1373 anchors_a = evas_textblock_node_format_list_get(o, "a");
1374 anchors_item = evas_textblock_node_format_list_get(o, "item");
1378 const Evas_Object_Textblock_Node_Format *node;
1379 const Eina_List *itr;
1380 EINA_LIST_FOREACH(anchors_a, itr, node)
1382 const char *s = evas_textblock_node_format_text_get(node);
1384 an = calloc(1, sizeof(Anchor));
1389 p = strstr(s, "href=");
1392 an->name = strdup(p + 5);
1394 en->anchors = eina_list_append(en->anchors, an);
1395 an->start = evas_object_textblock_cursor_new(o);
1396 an->end = evas_object_textblock_cursor_new(o);
1397 evas_textblock_cursor_at_format_set(an->start, node);
1398 evas_textblock_cursor_copy(an->start, an->end);
1400 /* Close the anchor, if the anchor was without text,
1401 * free it as well */
1402 node = evas_textblock_node_format_next_get(node);
1403 for (; node; node = evas_textblock_node_format_next_get(node))
1405 s = evas_textblock_node_format_text_get(node);
1406 if ((!strcmp(s, "- a")) || (!strcmp(s, "-a")))
1412 evas_textblock_cursor_at_format_set(an->end, node);
1414 else if (!evas_textblock_cursor_compare(an->start, an->end))
1416 if (an->name) free(an->name);
1417 evas_textblock_cursor_free(an->start);
1418 evas_textblock_cursor_free(an->end);
1419 en->anchors = eina_list_remove(en->anchors, an);
1428 const Evas_Object_Textblock_Node_Format *node;
1429 const Eina_List *itr;
1430 EINA_LIST_FOREACH(anchors_item, itr, node)
1432 const char *s = evas_textblock_node_format_text_get(node);
1434 an = calloc(1, sizeof(Anchor));
1440 p = strstr(s, "href=");
1443 an->name = strdup(p + 5);
1445 en->anchors = eina_list_append(en->anchors, an);
1446 an->start = evas_object_textblock_cursor_new(o);
1447 an->end = evas_object_textblock_cursor_new(o);
1448 evas_textblock_cursor_at_format_set(an->start, node);
1449 evas_textblock_cursor_copy(an->start, an->end);
1450 /* Although needed in textblock, don't bother with finding the end
1451 * here cause it doesn't really matter. */
1457 _free_entry_change_info(void *_info)
1459 Edje_Entry_Change_Info *info = (Edje_Entry_Change_Info *) _info;
1462 eina_stringshare_del(info->change.insert.content);
1466 eina_stringshare_del(info->change.del.content);
1472 _range_del_emit(Edje *ed, Evas_Textblock_Cursor *c __UNUSED__, Evas_Object *o __UNUSED__, Entry *en)
1476 Edje_Entry_Change_Info *info;
1478 start = evas_textblock_cursor_pos_get(en->sel_start);
1479 end = evas_textblock_cursor_pos_get(en->sel_end);
1483 info = calloc(1, sizeof(*info));
1484 info->insert = EINA_FALSE;
1485 info->change.del.start = start;
1486 info->change.del.end = end;
1488 tmp = evas_textblock_cursor_range_text_get(en->sel_start, en->sel_end, EVAS_TEXTBLOCK_TEXT_MARKUP);
1489 info->change.del.content = eina_stringshare_add(tmp);
1491 evas_textblock_cursor_range_delete(en->sel_start, en->sel_end);
1492 _edje_emit(ed, "entry,changed", en->rp->part->name);
1493 _edje_emit_full(ed, "entry,changed,user", en->rp->part->name, info,
1494 _free_entry_change_info);
1496 _sel_clear(en->cursor, en->rp->object, en);
1500 _range_del(Evas_Textblock_Cursor *c __UNUSED__, Evas_Object *o __UNUSED__, Entry *en)
1502 evas_textblock_cursor_range_delete(en->sel_start, en->sel_end);
1503 _sel_clear(en->cursor, en->rp->object, en);
1507 _delete_emit(Edje *ed, Evas_Textblock_Cursor *c, Entry *en, size_t pos,
1508 Eina_Bool backspace)
1510 if (!evas_textblock_cursor_char_next(c))
1514 evas_textblock_cursor_char_prev(c);
1516 Edje_Entry_Change_Info *info = calloc(1, sizeof(*info));
1517 char *tmp = evas_textblock_cursor_content_get(c);
1519 info->insert = EINA_FALSE;
1522 info->change.del.start = pos - 1;
1523 info->change.del.end = pos;
1527 info->change.del.start = pos + 1;
1528 info->change.del.end = pos;
1531 info->change.del.content = eina_stringshare_add(tmp);
1534 evas_textblock_cursor_char_delete(c);
1535 _edje_emit(ed, "entry,changed", en->rp->part->name);
1536 _edje_emit_full(ed, "entry,changed,user", en->rp->part->name,
1537 info, _free_entry_change_info);
1541 _edje_entry_hide_visible_password(Edje_Real_Part *rp)
1543 const Evas_Object_Textblock_Node_Format *node;
1544 node = evas_textblock_node_format_first_get(rp->object);
1545 for (; node; node = evas_textblock_node_format_next_get(node))
1547 const char *text = evas_textblock_node_format_text_get(node);
1550 if (!strcmp(text, "+ password=off"))
1552 evas_textblock_node_format_remove_pair(rp->object,
1553 (Evas_Object_Textblock_Node_Format *) node);
1558 _edje_entry_real_part_configure(rp);
1559 _edje_emit(rp->edje, "entry,changed", rp->part->name);
1563 _password_timer_cb(void *data)
1565 Entry *en = (Entry *)data;
1566 _edje_entry_hide_visible_password(en->rp);
1567 en->pw_timer = NULL;
1568 return ECORE_CALLBACK_CANCEL;
1572 _is_modifier(const char *key)
1574 if ((!strncmp(key, "Shift", 5)) ||
1575 (!strncmp(key, "Control", 7)) ||
1576 (!strncmp(key, "Alt", 3)) ||
1577 (!strncmp(key, "Meta", 4)) ||
1578 (!strncmp(key, "Super", 5)) ||
1579 (!strncmp(key, "Hyper", 5)) ||
1580 (!strcmp(key, "Scroll_Lock")) ||
1581 (!strcmp(key, "Num_Lock")) ||
1582 (!strcmp(key, "Caps_Lock")))
1588 _compose_seq_reset(Entry *en)
1592 EINA_LIST_FREE(en->seq, str) eina_stringshare_del(str);
1593 en->composing = EINA_FALSE;
1597 _edje_key_down_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
1600 Evas_Event_Key_Down *ev = event_info;
1601 Edje_Real_Part *rp = ed->focused_part;
1603 Eina_Bool control, alt, shift;
1604 Eina_Bool multiline;
1605 Eina_Bool cursor_changed;
1608 if ((rp->type != EDJE_RP_TYPE_TEXT) ||
1609 (!rp->typedata.text)) return;
1610 en = rp->typedata.text->entry_data;
1611 if ((!en) || (rp->part->type != EDJE_PART_TYPE_TEXTBLOCK) ||
1612 (rp->part->entry_mode < EDJE_ENTRY_EDIT_MODE_EDITABLE))
1614 if (!ev->keyname) return;
1616 // TIZEN ONLY - START
1617 if (en->cursor_handler_show)
1619 evas_object_hide(en->cursor_handler);
1620 en->cursor_handler_show = EINA_FALSE;
1624 #ifdef HAVE_ECORE_IMF
1625 if (en->imf_context)
1627 Ecore_IMF_Event_Key_Down ecore_ev;
1628 Eina_Bool filter_ret;
1629 ecore_imf_evas_event_key_down_wrap(ev, &ecore_ev);
1632 filter_ret = ecore_imf_context_filter_event(en->imf_context,
1633 ECORE_IMF_EVENT_KEY_DOWN,
1634 (Ecore_IMF_Event *)&ecore_ev);
1636 if (en->have_preedit)
1638 if (!strcmp(ev->keyname, "Down") ||
1639 (!strcmp(ev->keyname, "KP_Down") && !ev->string) ||
1640 !strcmp(ev->keyname, "Up") ||
1641 (!strcmp(ev->keyname, "KP_Up") && !ev->string) ||
1642 !strcmp(ev->keyname, "Next") ||
1643 (!strcmp(ev->keyname, "KP_Next") && !ev->string) ||
1644 !strcmp(ev->keyname, "Prior") ||
1645 (!strcmp(ev->keyname, "KP_Prior") && !ev->string) ||
1646 !strcmp(ev->keyname, "Home") ||
1647 (!strcmp(ev->keyname, "KP_Home") && !ev->string) ||
1648 !strcmp(ev->keyname, "End") ||
1649 (!strcmp(ev->keyname, "KP_End") && !ev->string))
1650 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
1659 old_cur_pos = evas_textblock_cursor_pos_get(en->cursor);
1661 control = evas_key_modifier_is_set(ev->modifiers, "Control");
1662 alt = evas_key_modifier_is_set(ev->modifiers, "Alt");
1663 shift = evas_key_modifier_is_set(ev->modifiers, "Shift");
1664 multiline = rp->part->multiline;
1665 cursor_changed = EINA_FALSE;
1666 if (!strcmp(ev->keyname, "Escape"))
1668 _compose_seq_reset(en);
1669 // dead keys here. Escape for now (should emit these)
1670 _edje_emit(ed, "entry,key,escape", rp->part->name);
1671 // TIZEN ONLY (20130327) : This code is doing nothing for entry now.
1672 // And for Tizen "ESC" is used for another purpose.
1673 //ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
1675 else if (!strcmp(ev->keyname, "Up") ||
1676 (!strcmp(ev->keyname, "KP_Up") && !ev->string))
1678 _compose_seq_reset(en);
1681 if (en->have_selection &&
1682 (evas_textblock_cursor_pos_get(en->sel_start) != evas_textblock_cursor_pos_get(en->sel_end)))
1683 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
1684 if (en->select_allow)
1688 _sel_start(en->cursor, rp->object, en);
1689 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
1691 else _sel_clear(en->cursor, rp->object, en);
1693 if (_curs_up(en->cursor, rp->object, en))
1694 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
1695 if (en->select_allow)
1697 if (shift) _sel_extend(en->cursor, rp->object, en);
1698 else _sel_clear(en->cursor, rp->object, en);
1701 _edje_emit(ed, "entry,key,up", rp->part->name);
1702 _edje_emit(rp->edje, "cursor,changed,manual", rp->part->name);
1704 else if (!strcmp(ev->keyname, "Down") ||
1705 (!strcmp(ev->keyname, "KP_Down") && !ev->string))
1707 _compose_seq_reset(en);
1710 if (en->have_selection &&
1711 (evas_textblock_cursor_pos_get(en->sel_start) != evas_textblock_cursor_pos_get(en->sel_end)))
1712 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
1713 if (en->select_allow)
1717 _sel_start(en->cursor, rp->object, en);
1718 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
1720 else _sel_clear(en->cursor, rp->object, en);
1722 if (_curs_down(en->cursor, rp->object, en))
1723 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
1724 if (en->select_allow)
1726 if (shift) _sel_extend(en->cursor, rp->object, en);
1727 else _sel_clear(en->cursor, rp->object, en);
1730 _edje_emit(ed, "entry,key,down", rp->part->name);
1731 _edje_emit(rp->edje, "cursor,changed,manual", rp->part->name);
1733 else if (!strcmp(ev->keyname, "Left") ||
1734 (!strcmp(ev->keyname, "KP_Left") && !ev->string))
1736 _compose_seq_reset(en);
1737 if (en->have_selection &&
1738 (evas_textblock_cursor_pos_get(en->sel_start) != evas_textblock_cursor_pos_get(en->sel_end)))
1739 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
1740 if (en->select_allow)
1744 _sel_start(en->cursor, rp->object, en);
1745 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
1747 else _sel_clear(en->cursor, rp->object, en);
1749 if (evas_textblock_cursor_char_prev(en->cursor))
1750 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
1751 /* If control is pressed, go to the start of the word */
1752 if (control) evas_textblock_cursor_word_start(en->cursor);
1753 if (en->select_allow)
1755 if (shift) _sel_extend(en->cursor, rp->object, en);
1756 else _sel_clear(en->cursor, rp->object, en);
1758 _edje_emit(ed, "entry,key,left", rp->part->name);
1759 _edje_emit(rp->edje, "cursor,changed,manual", rp->part->name);
1761 else if (!strcmp(ev->keyname, "Right") ||
1762 (!strcmp(ev->keyname, "KP_Right") && !ev->string))
1764 _compose_seq_reset(en);
1765 if (en->have_selection &&
1766 (evas_textblock_cursor_pos_get(en->sel_start) != evas_textblock_cursor_pos_get(en->sel_end)))
1767 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
1768 if (en->select_allow)
1772 _sel_start(en->cursor, rp->object, en);
1773 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
1775 else _sel_clear(en->cursor, rp->object, en);
1777 /* If control is pressed, go to the end of the word */
1778 if (control) evas_textblock_cursor_word_end(en->cursor);
1779 if (evas_textblock_cursor_char_next(en->cursor))
1780 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
1781 if (en->select_allow)
1783 if (shift) _sel_extend(en->cursor, rp->object, en);
1784 else _sel_clear(en->cursor, rp->object, en);
1786 _edje_emit(ed, "entry,key,right", rp->part->name);
1787 _edje_emit(rp->edje, "cursor,changed,manual", rp->part->name);
1789 else if (!strcmp(ev->keyname, "BackSpace"))
1791 _compose_seq_reset(en);
1792 if (control && !en->have_selection)
1794 // del to start of previous word
1795 _sel_start(en->cursor, rp->object, en);
1797 evas_textblock_cursor_char_prev(en->cursor);
1798 evas_textblock_cursor_word_start(en->cursor);
1800 _sel_preextend(en->cursor, rp->object, en);
1802 _range_del_emit(ed, en->cursor, rp->object, en);
1804 else if ((alt) && (shift))
1810 if (en->have_selection)
1812 _range_del_emit(ed, en->cursor, rp->object, en);
1816 if (evas_textblock_cursor_char_prev(en->cursor))
1818 _delete_emit(ed, en->cursor, en, old_cur_pos, EINA_TRUE);
1822 _sel_clear(en->cursor, rp->object, en);
1823 _anchors_get(en->cursor, rp->object, en);
1824 _edje_emit(ed, "entry,key,backspace", rp->part->name);
1825 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
1827 else if (!strcmp(ev->keyname, "Delete") ||
1828 (!strcmp(ev->keyname, "KP_Delete") && !ev->string))
1830 _compose_seq_reset(en);
1833 // del to end of next word
1834 _sel_start(en->cursor, rp->object, en);
1836 evas_textblock_cursor_word_end(en->cursor);
1837 evas_textblock_cursor_char_next(en->cursor);
1839 _sel_extend(en->cursor, rp->object, en);
1841 _range_del_emit(ed, en->cursor, rp->object, en);
1849 if (en->have_selection)
1851 _range_del_emit(ed, en->cursor, rp->object, en);
1855 _delete_emit(ed, en->cursor, en, old_cur_pos, EINA_FALSE);
1858 _sel_clear(en->cursor, rp->object, en);
1859 _anchors_get(en->cursor, rp->object, en);
1860 _edje_emit(ed, "entry,key,delete", rp->part->name);
1861 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
1863 else if (!strcmp(ev->keyname, "Home") ||
1864 ((!strcmp(ev->keyname, "KP_Home")) && !ev->string))
1866 _compose_seq_reset(en);
1867 if (en->select_allow)
1869 if (shift) _sel_start(en->cursor, rp->object, en);
1870 else _sel_clear(en->cursor, rp->object, en);
1872 if ((control) && (multiline))
1873 _curs_start(en->cursor, rp->object, en);
1875 _curs_lin_start(en->cursor, rp->object, en);
1876 if (en->select_allow)
1878 if (shift) _sel_extend(en->cursor, rp->object, en);
1880 _edje_emit(ed, "entry,key,home", rp->part->name);
1881 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
1883 else if (!strcmp(ev->keyname, "End") ||
1884 ((!strcmp(ev->keyname, "KP_End")) && !ev->string))
1886 _compose_seq_reset(en);
1887 if (en->select_allow)
1889 if (shift) _sel_start(en->cursor, rp->object, en);
1890 else _sel_clear(en->cursor, rp->object, en);
1892 if ((control) && (multiline))
1893 _curs_end(en->cursor, rp->object, en);
1895 _curs_lin_end(en->cursor, rp->object, en);
1896 if (en->select_allow)
1898 if (shift) _sel_extend(en->cursor, rp->object, en);
1900 _edje_emit(ed, "entry,key,end", rp->part->name);
1901 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
1903 else if ((control) && (!shift) && (!strcmp(ev->keyname, "v")))
1905 _compose_seq_reset(en);
1906 _edje_emit(ed, "entry,paste,request", rp->part->name);
1907 _edje_emit(ed, "entry,paste,request,3", rp->part->name);
1908 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
1910 else if ((control) && (!strcmp(ev->keyname, "a")))
1912 _compose_seq_reset(en);
1915 _edje_emit(ed, "entry,selection,none,request", rp->part->name);
1916 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
1920 if (en->select_allow) // TIZEN ONLY
1921 _edje_emit(ed, "entry,selection,all,request", rp->part->name);
1922 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
1925 else if ((control) && (((!shift) && !strcmp(ev->keyname, "c")) || !strcmp(ev->keyname, "Insert")))
1927 _compose_seq_reset(en);
1928 _edje_emit(ed, "entry,copy,notify", rp->part->name);
1929 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
1931 else if ((control) && (!shift) && ((!strcmp(ev->keyname, "x") || (!strcmp(ev->keyname, "m")))))
1933 _compose_seq_reset(en);
1934 _edje_emit(ed, "entry,cut,notify", rp->part->name);
1935 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
1937 else if ((control) && (!strcmp(ev->keyname, "z")))
1939 _compose_seq_reset(en);
1943 _edje_emit(ed, "entry,redo,request", rp->part->name);
1948 _edje_emit(ed, "entry,undo,request", rp->part->name);
1950 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
1952 else if ((control) && (!shift) && (!strcmp(ev->keyname, "y")))
1954 _compose_seq_reset(en);
1956 _edje_emit(ed, "entry,redo,request", rp->part->name);
1957 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
1959 else if ((control) && (!shift) && (!strcmp(ev->keyname, "w")))
1961 _compose_seq_reset(en);
1962 _sel_clear(en->cursor, rp->object, en);
1963 // select current word?
1964 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
1966 else if (!strcmp(ev->keyname, "Tab"))
1968 _compose_seq_reset(en);
1977 Edje_Entry_Change_Info *info = calloc(1, sizeof(*info));
1978 info->insert = EINA_TRUE;
1979 info->change.insert.plain_length = 1;
1981 if (en->have_selection)
1983 _range_del_emit(ed, en->cursor, rp->object, en);
1984 info->merge = EINA_TRUE;
1986 info->change.insert.pos =
1987 evas_textblock_cursor_pos_get(en->cursor);
1988 info->change.insert.content = eina_stringshare_add("<tab/>");
1990 // evas_textblock_cursor_format_prepend(en->cursor, "tab");
1991 _text_filter_format_prepend(en, en->cursor, "tab");
1992 _anchors_get(en->cursor, rp->object, en);
1993 _edje_emit(ed, "entry,changed", rp->part->name);
1994 _edje_emit_full(ed, "entry,changed,user", rp->part->name,
1995 info, _free_entry_change_info);
1997 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
1999 _edje_emit(ed, "entry,key,tab", rp->part->name);
2001 else if ((!strcmp(ev->keyname, "ISO_Left_Tab")) && (multiline))
2003 _compose_seq_reset(en);
2005 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
2007 else if (!strcmp(ev->keyname, "Prior") ||
2008 (!strcmp(ev->keyname, "KP_Prior") && !ev->string))
2010 _compose_seq_reset(en);
2011 if (en->select_allow)
2013 if (shift) _sel_start(en->cursor, rp->object, en);
2014 else _sel_clear(en->cursor, rp->object, en);
2016 _curs_jump_line_by(en->cursor, rp->object, en, -10);
2017 if (en->select_allow)
2019 if (shift) _sel_extend(en->cursor, rp->object, en);
2020 else _sel_clear(en->cursor, rp->object, en);
2022 _edje_emit(ed, "entry,key,pgup", rp->part->name);
2023 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
2025 else if (!strcmp(ev->keyname, "Next") ||
2026 (!strcmp(ev->keyname, "KP_Next") && !ev->string))
2028 _compose_seq_reset(en);
2029 if (en->select_allow)
2031 if (shift) _sel_start(en->cursor, rp->object, en);
2032 else _sel_clear(en->cursor, rp->object, en);
2034 _curs_jump_line_by(en->cursor, rp->object, en, 10);
2035 if (en->select_allow)
2037 if (shift) _sel_extend(en->cursor, rp->object, en);
2038 else _sel_clear(en->cursor, rp->object, en);
2040 _edje_emit(ed, "entry,key,pgdn", rp->part->name);
2041 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
2043 else if ((!strcmp(ev->keyname, "Return")) || (!strcmp(ev->keyname, "KP_Enter")))
2045 _compose_seq_reset(en);
2048 Edje_Entry_Change_Info *info = calloc(1, sizeof(*info));
2049 info->insert = EINA_TRUE;
2050 info->change.insert.plain_length = 1;
2051 if (en->have_selection)
2053 _range_del_emit(ed, en->cursor, rp->object, en);
2054 info->merge = EINA_TRUE;
2057 info->change.insert.pos =
2058 evas_textblock_cursor_pos_get(en->cursor);
2060 evas_object_textblock_legacy_newline_get(rp->object))
2063 // evas_textblock_cursor_format_prepend(en->cursor, "br");
2064 _text_filter_format_prepend(en, en->cursor, "br");
2065 info->change.insert.content = eina_stringshare_add("<br/>");
2070 // evas_textblock_cursor_format_prepend(en->cursor, "ps");
2071 _text_filter_format_prepend(en, en->cursor, "ps");
2072 info->change.insert.content = eina_stringshare_add("<ps/>");
2074 _anchors_get(en->cursor, rp->object, en);
2075 _edje_emit(ed, "entry,changed", rp->part->name);
2076 _edje_emit_full(ed, "entry,changed,user", rp->part->name,
2077 info, _free_entry_change_info);
2078 _edje_emit(ed, "cursor,changed", rp->part->name);
2079 cursor_changed = EINA_TRUE;
2080 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
2082 _edje_emit(ed, "entry,key,enter", rp->part->name);
2086 char *compres = NULL, *string = (char *)ev->string;
2087 Eina_Bool free_string = EINA_FALSE;
2088 Ecore_Compose_State state;
2092 _compose_seq_reset(en);
2093 en->seq = eina_list_append(en->seq, eina_stringshare_add(ev->key));
2094 state = ecore_compose_get(en->seq, &compres);
2095 if (state == ECORE_COMPOSE_MIDDLE) en->composing = EINA_TRUE;
2096 else en->composing = EINA_FALSE;
2097 if (!en->composing) _compose_seq_reset(en);
2102 if (_is_modifier(ev->key)) goto end;
2103 en->seq = eina_list_append(en->seq, eina_stringshare_add(ev->key));
2104 state = ecore_compose_get(en->seq, &compres);
2105 if (state == ECORE_COMPOSE_NONE) _compose_seq_reset(en);
2106 else if (state == ECORE_COMPOSE_DONE)
2108 _compose_seq_reset(en);
2112 free_string = EINA_TRUE;
2119 Edje_Entry_Change_Info *info = calloc(1, sizeof(*info));
2120 info->insert = EINA_TRUE;
2121 info->change.insert.plain_length = 1;
2122 info->change.insert.content = eina_stringshare_add(string);
2124 if (en->have_selection)
2126 _range_del_emit(ed, en->cursor, rp->object, en);
2127 info->merge = EINA_TRUE;
2130 info->change.insert.pos =
2131 evas_textblock_cursor_pos_get(en->cursor);
2132 // if PASSWORD_SHOW_LAST mode, appending text with password=off tag
2133 if ((rp->part->entry_mode == EDJE_ENTRY_EDIT_MODE_PASSWORD) &&
2134 _edje_password_show_last)
2136 _edje_entry_hide_visible_password(en->rp);
2137 _text_filter_format_prepend(en, en->cursor, "+ password=off");
2138 _text_filter_text_prepend(en, en->cursor, string);
2139 _text_filter_format_prepend(en, en->cursor, "- password");
2142 ecore_timer_del(en->pw_timer);
2143 en->pw_timer = NULL;
2145 en->pw_timer = ecore_timer_add(TO_DOUBLE(_edje_password_show_last_timeout),
2146 _password_timer_cb, en);
2149 _text_filter_text_prepend(en, en->cursor, string);
2150 _anchors_get(en->cursor, rp->object, en);
2151 _edje_emit(ed, "entry,changed", rp->part->name);
2152 _edje_emit_full(ed, "entry,changed,user", rp->part->name,
2153 info, _free_entry_change_info);
2154 _edje_emit(ed, "cursor,changed", rp->part->name);
2155 cursor_changed = EINA_TRUE;
2156 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
2158 if (free_string) free(string);
2161 if (!cursor_changed && (old_cur_pos != evas_textblock_cursor_pos_get(en->cursor)))
2162 _edje_emit(ed, "cursor,changed", rp->part->name);
2164 _edje_entry_imf_cursor_info_set(en);
2165 _edje_entry_real_part_configure(rp);
2169 _edje_key_up_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
2172 Edje_Real_Part *rp = ed->focused_part;
2176 if ((rp->type != EDJE_RP_TYPE_TEXT) ||
2177 (!rp->typedata.text)) return;
2178 en = rp->typedata.text->entry_data;
2179 if ((!en) || (rp->part->type != EDJE_PART_TYPE_TEXTBLOCK) ||
2180 (rp->part->entry_mode < EDJE_ENTRY_EDIT_MODE_EDITABLE))
2183 #ifdef HAVE_ECORE_IMF
2184 if (en->imf_context)
2186 Evas_Event_Key_Up *ev = event_info;
2187 Ecore_IMF_Event_Key_Up ecore_ev;
2189 ecore_imf_evas_event_key_up_wrap(ev, &ecore_ev);
2190 if (ecore_imf_context_filter_event(en->imf_context,
2191 ECORE_IMF_EVENT_KEY_UP,
2192 (Ecore_IMF_Event *)&ecore_ev))
2200 // TIZEN ONLY - START
2202 _edje_entry_select_word(Edje_Real_Part *rp)
2205 if (!rp) return EINA_FALSE;
2206 if ((rp->type != EDJE_RP_TYPE_TEXT) ||
2207 (!rp->typedata.text)) return EINA_FALSE;
2209 en = rp->typedata.text->entry_data;
2210 if (!en) return EINA_FALSE;
2212 if (en->cursor_fg) evas_object_hide(en->cursor_fg);
2213 if (en->cursor_bg) evas_object_hide(en->cursor_bg);
2215 evas_textblock_cursor_word_start(en->cursor);
2217 if (evas_textblock_cursor_eol_get(en->cursor))
2219 evas_textblock_cursor_char_prev(en->cursor);
2220 evas_textblock_cursor_word_start(en->cursor);
2223 _sel_clear(en->cursor, rp->object, en);
2224 _sel_enable(en->cursor, rp->object, en);
2225 _sel_start(en->cursor, rp->object, en);
2227 evas_textblock_cursor_word_end(en->cursor);
2228 evas_textblock_cursor_char_next(en->cursor);
2230 _sel_extend(en->cursor, rp->object, en);
2231 _edje_entry_real_part_configure(rp);
2233 en->had_sel = EINA_TRUE;
2234 en->selecting = EINA_FALSE;
2240 _long_press_cb(void *data)
2242 Edje_Real_Part *rp = data;
2244 if (!rp) return ECORE_CALLBACK_CANCEL;
2245 if ((rp->type != EDJE_RP_TYPE_TEXT) ||
2246 (!rp->typedata.text)) return ECORE_CALLBACK_CANCEL;
2248 en = rp->typedata.text->entry_data;
2249 if (!en) return ECORE_CALLBACK_CANCEL;
2251 if (en->long_press_timer)
2253 ecore_timer_del(en->long_press_timer);
2254 en->long_press_timer = NULL;
2257 en->long_press_state = _ENTRY_LONG_PRESSED;
2258 en->long_press_timer = NULL;
2260 _edje_emit(en->rp->edje, "long,pressed", en->rp->part->name);
2262 if ((en->cursor_handler) && (!en->cursor_handler_disabled) && (en->focused))
2264 edje_object_signal_emit(en->cursor_handler, "edje,cursor,handle,show", "edje");
2265 evas_object_show(en->cursor_handler);
2266 en->cursor_handler_show = EINA_TRUE;
2268 return ECORE_CALLBACK_CANCEL;
2273 _edje_part_move_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
2275 Edje_Real_Part *rp = data;
2278 if ((rp->type != EDJE_RP_TYPE_TEXT) ||
2279 (!rp->typedata.text)) return;
2280 en = rp->typedata.text->entry_data;
2282 _edje_entry_imf_cursor_location_set(en);
2286 _edje_part_mouse_down_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
2289 Edje_Real_Part *rp = data;
2290 Evas_Event_Mouse_Down *ev = event_info;
2292 Evas_Coord x, y, w, h;
2293 // Eina_Bool multiline;
2294 Evas_Textblock_Cursor *tc = NULL;
2295 Eina_Bool dosel = EINA_FALSE;
2298 if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return;
2299 if ((rp->type != EDJE_RP_TYPE_TEXT) ||
2300 (!rp->typedata.text)) return;
2301 en = rp->typedata.text->entry_data;
2302 en->long_press_state = _ENTRY_LONG_PRESSING; // TIZEN ONLY
2303 if ((!en) || (rp->part->type != EDJE_PART_TYPE_TEXTBLOCK) ||
2304 (rp->part->entry_mode < EDJE_ENTRY_EDIT_MODE_SELECTABLE))
2306 if ((ev->button != 1) && (ev->button != 2)) return;
2308 // TIZEN ONLY - START
2309 en->dx = ev->canvas.x;
2310 en->dy = ev->canvas.y;
2313 #ifdef HAVE_ECORE_IMF
2314 if (en->imf_context)
2316 Ecore_IMF_Event_Mouse_Down ecore_ev;
2317 ecore_imf_evas_event_mouse_down_wrap(ev, &ecore_ev);
2318 if (ecore_imf_context_filter_event(en->imf_context,
2319 ECORE_IMF_EVENT_MOUSE_DOWN,
2320 (Ecore_IMF_Event *)&ecore_ev))
2325 _edje_entry_imf_context_reset(rp);
2327 shift = evas_key_modifier_is_set(ev->modifiers, "Shift");
2328 en->select_mod_start = EINA_FALSE;
2329 en->select_mod_end = EINA_FALSE;
2330 if (rp->part->select_mode == EDJE_ENTRY_SELECTION_MODE_DEFAULT)
2332 else if ((rp->part->select_mode == EDJE_ENTRY_SELECTION_MODE_EXPLICIT) ||
2333 (rp->part->select_mode == EDJE_ENTRY_SELECTION_MODE_BLOCK_HANDLE))
2335 if (en->select_allow) dosel = EINA_TRUE;
2337 if (ev->button == 2) dosel = EINA_FALSE;
2340 evas_object_geometry_get(rp->object, &x, &y, &w, &h);
2341 cx = ev->canvas.x - x;
2342 cy = ev->canvas.y - y;
2343 if (ev->flags & EVAS_BUTTON_TRIPLE_CLICK)
2347 tc = evas_object_textblock_cursor_new(rp->object);
2348 evas_textblock_cursor_copy(en->cursor, tc);
2349 if (evas_textblock_cursor_compare(en->cursor, en->sel_start) < 0)
2350 evas_textblock_cursor_line_char_first(en->cursor);
2352 evas_textblock_cursor_line_char_last(en->cursor);
2353 _sel_extend(en->cursor, rp->object, en);
2357 en->have_selection = EINA_FALSE;
2358 en->selecting = EINA_FALSE;
2359 _sel_clear(en->cursor, rp->object, en);
2360 tc = evas_object_textblock_cursor_new(rp->object);
2361 evas_textblock_cursor_copy(en->cursor, tc);
2362 evas_textblock_cursor_line_char_first(en->cursor);
2363 _sel_start(en->cursor, rp->object, en);
2364 evas_textblock_cursor_line_char_last(en->cursor);
2365 _sel_extend(en->cursor, rp->object, en);
2369 else if (ev->flags & EVAS_BUTTON_DOUBLE_CLICK)
2373 tc = evas_object_textblock_cursor_new(rp->object);
2374 evas_textblock_cursor_copy(en->cursor, tc);
2375 if (evas_textblock_cursor_compare(en->cursor, en->sel_start) < 0)
2376 evas_textblock_cursor_word_start(en->cursor);
2379 evas_textblock_cursor_word_end(en->cursor);
2380 evas_textblock_cursor_char_next(en->cursor);
2382 _sel_extend(en->cursor, rp->object, en);
2386 en->have_selection = EINA_FALSE;
2387 en->selecting = EINA_FALSE;
2388 _sel_clear(en->cursor, rp->object, en);
2389 tc = evas_object_textblock_cursor_new(rp->object);
2390 evas_textblock_cursor_copy(en->cursor, tc);
2391 evas_textblock_cursor_word_start(en->cursor);
2392 _sel_start(en->cursor, rp->object, en);
2393 evas_textblock_cursor_word_end(en->cursor);
2394 evas_textblock_cursor_char_next(en->cursor);
2395 _sel_extend(en->cursor, rp->object, en);
2400 tc = evas_object_textblock_cursor_new(rp->object);
2401 evas_textblock_cursor_copy(en->cursor, tc);
2402 // multiline = rp->part->multiline;
2403 evas_object_geometry_get(rp->object, &x, &y, &w, &h);
2404 cx = ev->canvas.x - x;
2405 cy = ev->canvas.y - y;
2406 if (en->rp->part->select_mode == EDJE_ENTRY_SELECTION_MODE_BLOCK_HANDLE)
2408 evas_textblock_cursor_char_coord_set(en->cursor, cx, cy);
2412 if (!evas_textblock_cursor_char_coord_set(en->cursor, cx, cy))
2414 Evas_Coord lx, ly, lw, lh;
2417 line = evas_textblock_cursor_line_coord_set(en->cursor, cy);
2420 if (rp->part->multiline)
2421 _curs_end(en->cursor, rp->object, en);
2424 evas_textblock_cursor_paragraph_first(en->cursor);
2425 evas_textblock_cursor_line_geometry_get(en->cursor, &lx, &ly, &lw, &lh);
2426 if (!evas_textblock_cursor_char_coord_set(en->cursor, cx, ly + (lh / 2)))
2427 _curs_end(en->cursor, rp->object, en);
2434 lnum = evas_textblock_cursor_line_geometry_get(en->cursor, &lx, &ly, &lw, &lh);
2437 _curs_lin_start(en->cursor, rp->object, en);
2442 _curs_lin_start(en->cursor, rp->object, en);
2444 _curs_lin_end(en->cursor, rp->object, en);
2451 if ((en->have_selection) &&
2452 (rp->part->select_mode == EDJE_ENTRY_SELECTION_MODE_EXPLICIT))
2455 _sel_extend(en->cursor, rp->object, en);
2458 Eina_List *first, *last;
2462 last = eina_list_last(en->sel);
2465 Evas_Textblock_Rectangle *r1, *r2;
2466 Evas_Coord d, d1, d2;
2472 d = (r1->y + (r1->h / 2)) - cy;
2474 d = r2->x + r2->w - 1 - cx;
2476 d = (r2->y + (r2->h / 2)) - cy;
2478 sc = rp->edje->scale;
2479 if (sc == ZERO) sc = _edje_scale;
2480 d = (Evas_Coord)MUL(FROM_INT(20), sc); // FIXME: maxing number!
2486 en->select_mod_start = EINA_TRUE;
2487 en->selecting = EINA_TRUE;
2494 en->select_mod_end = EINA_TRUE;
2495 en->selecting = EINA_TRUE;
2503 if ((en->have_selection) && (shift))
2504 _sel_extend(en->cursor, rp->object, en);
2507 en->selecting = EINA_TRUE;
2508 _sel_clear(en->cursor, rp->object, en);
2509 if (en->select_allow)
2511 _sel_start(en->cursor, rp->object, en);
2517 if (evas_textblock_cursor_compare(tc, en->cursor))
2519 _edje_emit(rp->edje, "cursor,changed", rp->part->name);
2520 _edje_emit(rp->edje, "cursor,changed,manual", rp->part->name);
2522 evas_textblock_cursor_free(tc);
2524 // TIZEN ONLY - START
2525 if (en->rp->part->select_mode == EDJE_ENTRY_SELECTION_MODE_BLOCK_HANDLE)
2527 if (en->long_press_timer) ecore_timer_del(en->long_press_timer);
2528 en->long_press_timer = ecore_timer_add(0.5, _long_press_cb, data); //FIXME: timer value
2531 _edje_entry_real_part_configure(rp);
2532 if (ev->button == 2)
2534 _edje_emit(rp->edje, "entry,paste,request", rp->part->name);
2535 _edje_emit(rp->edje, "entry,paste,request,1", rp->part->name);
2540 _edje_part_mouse_up_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
2543 Edje_Real_Part *rp = data;
2544 Evas_Event_Mouse_Up *ev = event_info;
2546 Evas_Coord x, y, w, h;
2547 Evas_Textblock_Cursor *tc;
2548 if (ev->button != 1) return;
2550 //if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return; //TIZEN ONLY
2551 //if (ev->flags & EVAS_BUTTON_TRIPLE_CLICK) return; // TIZEN ONLY
2552 //if (ev->flags & EVAS_BUTTON_DOUBLE_CLICK) return; // TIZEN ONLY
2553 if ((rp->type != EDJE_RP_TYPE_TEXT) ||
2554 (!rp->typedata.text)) return;
2555 en = rp->typedata.text->entry_data;
2556 if ((!en) || (rp->part->type != EDJE_PART_TYPE_TEXTBLOCK) ||
2557 (rp->part->entry_mode < EDJE_ENTRY_EDIT_MODE_SELECTABLE))
2560 // TIZEN ONLY - START
2561 if (en->long_press_timer)
2563 ecore_timer_del(en->long_press_timer);
2564 en->long_press_timer = NULL;
2567 if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD)
2569 _edje_entry_imf_cursor_info_set(en);
2573 if (ev->flags & EVAS_BUTTON_TRIPLE_CLICK) return;
2574 if (ev->flags & EVAS_BUTTON_DOUBLE_CLICK) return;
2576 if (en->long_press_state == _ENTRY_LONG_PRESSED)
2578 en->long_press_state = _ENTRY_LONG_PRESS_RELEASED;
2579 _edje_entry_imf_cursor_info_set(en);
2581 if ((strcmp(_edje_entry_text_get(rp), "") == 0) && (en->cursor_handler_show))
2583 evas_object_hide(en->cursor_handler);
2584 en->cursor_handler_show = EINA_FALSE;
2588 en->long_press_state = _ENTRY_LONG_PRESS_RELEASED;
2590 if ((en->cursor_handler) && (!en->cursor_handler_disabled) && (!en->have_selection))
2592 evas_object_show(en->cursor_handler);
2593 en->cursor_handler_show = EINA_TRUE;
2597 #ifdef HAVE_ECORE_IMF
2598 if (en->imf_context)
2600 Ecore_IMF_Event_Mouse_Up ecore_ev;
2601 ecore_imf_evas_event_mouse_up_wrap(ev, &ecore_ev);
2602 if (ecore_imf_context_filter_event(en->imf_context,
2603 ECORE_IMF_EVENT_MOUSE_UP,
2604 (Ecore_IMF_Event *)&ecore_ev))
2609 tc = evas_object_textblock_cursor_new(rp->object);
2610 evas_textblock_cursor_copy(en->cursor, tc);
2611 evas_object_geometry_get(rp->object, &x, &y, &w, &h);
2612 cx = ev->canvas.x - x;
2613 cy = ev->canvas.y - y;
2614 if (!evas_textblock_cursor_char_coord_set(en->cursor, cx, cy))
2616 Evas_Coord lx, ly, lw, lh;
2619 line = evas_textblock_cursor_line_coord_set(en->cursor, cy);
2622 if (rp->part->multiline)
2623 _curs_end(en->cursor, rp->object, en);
2626 evas_textblock_cursor_paragraph_first(en->cursor);
2627 evas_textblock_cursor_line_geometry_get(en->cursor, &lx, &ly, &lw, &lh);
2628 if (!evas_textblock_cursor_char_coord_set(en->cursor, cx, ly + (lh / 2)))
2629 _curs_end(en->cursor, rp->object, en);
2636 lnum = evas_textblock_cursor_line_geometry_get(en->cursor, &lx, &ly, &lw, &lh);
2639 _curs_lin_start(en->cursor, rp->object, en);
2644 _curs_lin_start(en->cursor, rp->object, en);
2646 _curs_lin_end(en->cursor, rp->object, en);
2650 if (rp->part->select_mode != EDJE_ENTRY_SELECTION_MODE_BLOCK_HANDLE)
2652 if ((rp->part->select_mode == EDJE_ENTRY_SELECTION_MODE_EXPLICIT))
2654 if (en->select_allow)
2658 if (en->select_mod_end)
2659 _sel_extend(en->cursor, rp->object, en);
2660 else if (en->select_mod_start)
2661 _sel_preextend(en->cursor, rp->object, en);
2664 _sel_extend(en->cursor, rp->object, en);
2665 //evas_textblock_cursor_copy(en->cursor, en->sel_end);
2669 evas_textblock_cursor_copy(en->cursor, en->sel_end);
2673 if (en->have_selection)
2674 en->had_sel = EINA_TRUE;
2675 en->selecting = EINA_FALSE;
2679 if (evas_textblock_cursor_compare(tc, en->cursor))
2681 _edje_emit(rp->edje, "cursor,changed", rp->part->name);
2682 _edje_emit(rp->edje, "cursor,changed,manual", rp->part->name);
2685 _edje_entry_imf_cursor_info_set(en);
2687 evas_textblock_cursor_free(tc);
2689 _edje_entry_real_part_configure(rp);
2693 _edje_part_mouse_move_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
2696 Edje_Real_Part *rp = data;
2697 Evas_Event_Mouse_Move *ev = event_info;
2699 Evas_Coord x, y, w, h;
2700 Evas_Textblock_Cursor *tc;
2702 if ((rp->type != EDJE_RP_TYPE_TEXT) ||
2703 (!rp->typedata.text)) return;
2704 en = rp->typedata.text->entry_data;
2705 if ((!en) || (rp->part->type != EDJE_PART_TYPE_TEXTBLOCK) ||
2706 (rp->part->entry_mode < EDJE_ENTRY_EDIT_MODE_SELECTABLE))
2709 #ifdef HAVE_ECORE_IMF
2710 if (en->imf_context)
2712 Ecore_IMF_Event_Mouse_Move ecore_ev;
2713 ecore_imf_evas_event_mouse_move_wrap(ev, &ecore_ev);
2714 if (ecore_imf_context_filter_event(en->imf_context,
2715 ECORE_IMF_EVENT_MOUSE_MOVE,
2716 (Ecore_IMF_Event *)&ecore_ev))
2721 // TIZEN ONLY - START
2722 if (rp->part->select_mode == EDJE_ENTRY_SELECTION_MODE_BLOCK_HANDLE)
2724 _edje_entry_real_part_configure(rp);
2726 if (en->long_press_state == _ENTRY_LONG_PRESSING)
2730 dx = en->dx - ev->cur.canvas.x;
2731 dy = en->dy - ev->cur.canvas.y;
2733 /* FIXME: Magic number 40 is used to ignore finger move while detecting long press. */
2734 /* This should be replaced with the constant or variable relevant to the elm_finger_size. */
2735 if (((dx*dx) + (dy*dy)) > (40*40))
2737 en->long_press_state = _ENTRY_LONG_PRESS_RELEASED;
2738 if (en->long_press_timer)
2740 ecore_timer_del(en->long_press_timer);
2741 en->long_press_timer = NULL;
2745 else if (en->long_press_state == _ENTRY_LONG_PRESSED)
2747 Evas_Coord flx, fly, flh;
2748 Evas_Coord cnx, cny;
2750 tc = evas_object_textblock_cursor_new(rp->object);
2751 evas_textblock_cursor_copy(en->cursor, tc);
2752 evas_object_geometry_get(rp->object, &x, &y, &w, &h);
2754 cx = ev->cur.canvas.x - x;
2755 cy = ev->cur.canvas.y - y;
2756 evas_textblock_cursor_char_coord_set(en->cursor, cx, cy);
2758 /* handle the special cases in which pressed position is above the first line or below the last line */
2759 evas_object_textblock_line_number_geometry_get(rp->object, 0, &flx, &fly, NULL, &flh);
2760 evas_textblock_cursor_line_geometry_get(en->cursor, &cnx, &cny, NULL, NULL);
2761 if ((cnx == flx) && (cny == fly))
2763 /* cursor is in the first line */
2764 evas_textblock_cursor_char_coord_set(en->cursor, cx, fly + flh / 2);
2768 Evas_Textblock_Cursor *lc;
2769 Evas_Coord llx, lly, llh;
2771 lc = evas_object_textblock_cursor_new(rp->object);
2772 evas_textblock_cursor_copy(en->cursor, lc);
2773 evas_textblock_cursor_paragraph_last(lc);
2774 evas_textblock_cursor_line_geometry_get(lc, &llx, &lly, NULL, &llh);
2775 if ((cnx == llx) && (cny == lly))
2777 /* cursor is in the last line */
2778 evas_textblock_cursor_char_coord_set(en->cursor, cx, lly + llh / 2);
2780 evas_textblock_cursor_free(lc);
2783 if (evas_textblock_cursor_compare(tc, en->cursor))
2785 _edje_emit(rp->edje, "cursor,changed", rp->part->name);
2787 evas_textblock_cursor_free(tc);
2789 //_edje_emit(en->rp->edje, "magnifier,changed", en->rp->part->name);
2791 } // TIZEN ONLY - END
2796 tc = evas_object_textblock_cursor_new(rp->object);
2797 evas_textblock_cursor_copy(en->cursor, tc);
2798 evas_object_geometry_get(rp->object, &x, &y, &w, &h);
2799 cx = ev->cur.canvas.x - x;
2800 cy = ev->cur.canvas.y - y;
2801 if (!evas_textblock_cursor_char_coord_set(en->cursor, cx, cy))
2803 Evas_Coord lx, ly, lw, lh;
2805 if (evas_textblock_cursor_line_coord_set(en->cursor, cy) < 0)
2807 if (rp->part->multiline)
2808 _curs_end(en->cursor, rp->object, en);
2811 evas_textblock_cursor_paragraph_first(en->cursor);
2812 evas_textblock_cursor_line_geometry_get(en->cursor, &lx, &ly, &lw, &lh);
2813 if (!evas_textblock_cursor_char_coord_set(en->cursor, cx, ly + (lh / 2)))
2814 _curs_end(en->cursor, rp->object, en);
2819 evas_textblock_cursor_line_geometry_get(en->cursor, &lx, &ly, &lw, &lh);
2821 _curs_lin_start(en->cursor, rp->object, en);
2823 _curs_lin_end(en->cursor, rp->object, en);
2827 if ((rp->part->select_mode == EDJE_ENTRY_SELECTION_MODE_EXPLICIT) ||
2828 (rp->part->select_mode == EDJE_ENTRY_SELECTION_MODE_BLOCK_HANDLE))
2830 if (en->select_allow)
2834 if (en->select_mod_end)
2835 _sel_extend(en->cursor, rp->object, en);
2836 else if (en->select_mod_start)
2837 _sel_preextend(en->cursor, rp->object, en);
2840 _sel_extend(en->cursor, rp->object, en);
2845 _sel_extend(en->cursor, rp->object, en);
2847 if (en->select_allow)
2849 if (evas_textblock_cursor_compare(en->sel_start, en->sel_end) != 0)
2850 _sel_enable(en->cursor, rp->object, en);
2851 if (en->have_selection)
2852 _sel_update(en->cursor, rp->object, en);
2854 if (evas_textblock_cursor_compare(tc, en->cursor))
2856 _edje_emit(rp->edje, "cursor,changed", rp->part->name);
2857 _edje_emit(rp->edje, "cursor,changed,manual", rp->part->name);
2859 evas_textblock_cursor_free(tc);
2861 _edje_entry_real_part_configure(rp);
2866 // TIZEN ONLY - START
2868 _cursor_handler_click_cb(void *data)
2870 Edje_Real_Part *rp = data;
2872 if (!rp) return ECORE_CALLBACK_CANCEL;
2873 if ((rp->type != EDJE_RP_TYPE_TEXT) ||
2874 (!rp->typedata.text)) return ECORE_CALLBACK_CANCEL;
2875 en = rp->typedata.text->entry_data;
2876 if (!en) return ECORE_CALLBACK_CANCEL;
2878 if (en->cursor_handler_click_timer)
2880 ecore_timer_del(en->cursor_handler_click_timer);
2881 en->cursor_handler_click_timer = NULL;
2883 en->cursor_handler_click_timer = NULL;
2885 return ECORE_CALLBACK_CANCEL;
2889 _edje_entry_cursor_handler_mouse_down_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info)
2892 Edje_Real_Part *rp = data;
2893 Evas_Event_Mouse_Down *ev = event_info;
2894 Evas_Coord ox, oy, ow, oh;
2895 Evas_Coord lx, ly, lw, lh;
2898 if ((rp->type != EDJE_RP_TYPE_TEXT) ||
2899 (!rp->typedata.text)) return;
2900 en = rp->typedata.text->entry_data;
2902 if (ev->button != 1) return;
2904 en->rx = en->sx = ev->canvas.x;
2905 en->ry = en->sy = ev->canvas.y;
2907 evas_object_geometry_get(obj, &ox, &oy, NULL, NULL);
2908 edje_object_size_min_calc(obj, &ow, &oh);
2909 evas_textblock_cursor_line_geometry_get(en->cursor, &lx, &ly, &lw, &lh);
2911 en->ox = ox + ow/2 - en->rx;
2912 en->oy = oy - en->ry - lh/2;
2914 _edje_emit(rp->edje, "cursor,handler,move,start", en->rp->part->name);
2916 if (en->cursor_handler_click_timer) ecore_timer_del(en->cursor_handler_click_timer);
2917 en->cursor_handler_click_timer = ecore_timer_add(0.1, _cursor_handler_click_cb, data); //FIXME: timer value
2921 _edje_entry_cursor_handler_mouse_up_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
2924 Edje_Real_Part *rp = data;
2925 Evas_Event_Mouse_Up *ev = event_info;
2928 if ((rp->type != EDJE_RP_TYPE_TEXT) ||
2929 (!rp->typedata.text)) return;
2930 en = rp->typedata.text->entry_data;
2932 if (ev->button != 1) return;
2934 if (en->cursor_handler_click_timer)
2936 ecore_timer_del(en->cursor_handler_click_timer);
2937 en->cursor_handler_click_timer = NULL;
2939 _edje_emit(rp->edje, "cursor,handler,clicked", rp->part->name);
2943 _edje_entry_imf_cursor_info_set(en);
2944 _edje_emit(rp->edje, "cursor,handler,move,end", en->rp->part->name);
2949 _edje_entry_cursor_handler_mouse_move_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
2952 Edje_Real_Part *rp = data;
2953 Evas_Event_Mouse_Move *ev = event_info;
2954 Evas_Coord x, y, tx, ty, tw, th;
2959 if ((rp->type != EDJE_RP_TYPE_TEXT) ||
2960 (!rp->typedata.text)) return;
2961 en = rp->typedata.text->entry_data;
2963 if (ev->buttons != 1) return;
2965 x = ev->cur.canvas.x;
2966 y = ev->cur.canvas.y;
2968 en->rx += (x - en->sx);
2969 en->ry += (y - en->sy);
2970 en->sx = ev->cur.canvas.x;
2971 en->sy = ev->cur.canvas.y;
2973 evas_object_geometry_get(rp->object, &tx, &ty, NULL, NULL);
2974 evas_object_textblock_size_formatted_get(rp->object, &tw, &th);
2976 cx = en->rx + en->ox - tx;
2977 cy = en->ry + en->oy - ty;
2979 evas_textblock_cursor_line_geometry_get(en->cursor, NULL, NULL, NULL, &lh);
2980 if (cx <= 0) cx = 1;
2981 if (cy <= 0) cy = lh / 2;
2982 if (cy > th) cy = th - 1;
2984 evas_textblock_cursor_char_coord_set(en->cursor, cx, cy);
2986 //_edje_entry_imf_cursor_info_set(en);
2987 _edje_emit(rp->edje, "cursor,changed", rp->part->name); //to scroll scroller
2988 _edje_entry_real_part_configure(rp);
2990 _edje_emit(rp->edje, "cursor,handler,moving", rp->part->name);
2994 _edje_entry_start_handler_mouse_down_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info)
2996 Evas_Event_Mouse_Down *ev = event_info;
2997 Evas_Coord ox, oy, ow, oh;
2998 Evas_Coord lx, ly, lw, lh;
2999 Edje_Real_Part *rp = data;
3000 Entry *en = rp->typedata.text->entry_data;
3002 if (ev->button != 1) return;
3004 en->rx = en->sx = ev->canvas.x;
3005 en->ry = en->sy = ev->canvas.y;
3007 evas_object_geometry_get(obj, &ox, &oy, NULL, NULL);
3008 edje_object_size_min_calc(obj, &ow, &oh);
3009 evas_textblock_cursor_line_geometry_get(en->cursor, &lx, &ly, &lw, &lh);
3011 en->ox = ox + ow/2 - en->rx;
3012 //en->oy = oy + oh - en->ry + lh/2;
3013 en->oy = oy + oh - en->ry - lh/2;
3015 en->select_mod_start = EINA_TRUE;
3016 en->selecting = EINA_TRUE;
3018 _edje_emit(en->rp->edje, "handler,move,start", en->rp->part->name);
3022 _edje_entry_start_handler_mouse_up_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
3024 Edje_Real_Part *rp = data;
3025 Entry *en = rp->typedata.text->entry_data;
3027 //switch sel_start,end
3028 if (evas_textblock_cursor_compare(en->sel_start, en->sel_end) >= 0)
3030 Evas_Textblock_Cursor *tc;
3031 tc = evas_object_textblock_cursor_new(rp->object);
3032 evas_textblock_cursor_copy(en->sel_start, tc);
3033 evas_textblock_cursor_copy(en->sel_end, en->sel_start);
3034 evas_textblock_cursor_copy(tc, en->sel_end);
3035 evas_textblock_cursor_free(tc);
3038 en->handler_bypassing = EINA_FALSE;
3039 _edje_entry_real_part_configure(rp);
3041 _edje_emit(en->rp->edje, "handler,move,end", en->rp->part->name);
3045 _edje_entry_start_handler_mouse_move_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
3047 Evas_Event_Mouse_Move *ev = event_info;
3048 Edje_Real_Part *rp = data;
3049 Entry *en = rp->typedata.text->entry_data;
3050 Evas_Coord x, y, tx, ty, tw, th;
3053 Evas_Textblock_Cursor_Type cur_type;
3056 if (ev->buttons != 1) return;
3058 x = ev->cur.canvas.x;
3059 y = ev->cur.canvas.y;
3061 en->rx += (x - en->sx);
3062 en->ry += (y - en->sy);
3063 en->sx = ev->cur.canvas.x;
3064 en->sy = ev->cur.canvas.y;
3066 evas_object_geometry_get(rp->object, &tx, &ty, NULL, NULL);
3067 evas_object_textblock_size_formatted_get(rp->object, &tw, &th);
3069 cx = en->rx + en->ox - tx;
3070 cy = en->ry + en->oy - ty;
3072 evas_textblock_cursor_line_geometry_get(en->cursor, NULL, NULL, NULL, &lh);
3073 if (cx <= 0) cx = 1;
3074 if (cy <= 0) cy = lh / 2;
3075 if (cy > th) cy = th - 1;
3077 switch (rp->part->cursor_mode)
3079 case EDJE_ENTRY_CURSOR_MODE_BEFORE:
3080 cur_type = EVAS_TEXTBLOCK_CURSOR_BEFORE;
3082 case EDJE_ENTRY_CURSOR_MODE_UNDER:
3084 cur_type = EVAS_TEXTBLOCK_CURSOR_UNDER;
3087 evas_textblock_cursor_geometry_get(en->sel_end, &sx, &sy, NULL, NULL, NULL, cur_type);
3089 evas_textblock_cursor_char_coord_set(en->cursor, cx, cy);
3092 if (evas_textblock_cursor_compare(en->cursor, en->sel_end) >= 0)
3093 en->handler_bypassing = EINA_TRUE;
3095 en->handler_bypassing = EINA_FALSE;
3098 if (en->select_allow)
3102 if (en->select_mod_start)
3103 _sel_preextend(en->cursor, rp->object, en);
3106 _edje_entry_real_part_configure(rp);
3107 _edje_emit(en->rp->edje, "handler,moving", en->rp->part->name);
3111 _edje_entry_end_handler_mouse_down_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
3113 Evas_Event_Mouse_Down *ev = event_info;
3114 Evas_Coord ox, oy, ow, oh;
3115 Evas_Coord lx, ly, lw, lh;
3116 Edje_Real_Part *rp = data;
3117 Entry *en = rp->typedata.text->entry_data;
3119 if (ev->button != 1) return;
3121 en->rx = en->sx = ev->canvas.x;
3122 en->ry = en->sy = ev->canvas.y;
3124 evas_object_geometry_get(obj, &ox, &oy, NULL, NULL);
3125 edje_object_size_min_calc(obj, &ow, &oh);
3126 evas_textblock_cursor_line_geometry_get(en->cursor, &lx, &ly, &lw, &lh);
3128 en->ox = ox + ow/2 - en->rx;
3129 en->oy = oy - en->ry - lh/2;
3131 en->select_mod_end = EINA_TRUE;
3132 en->selecting = EINA_TRUE;
3134 _edje_emit(en->rp->edje, "handler,move,start", en->rp->part->name);
3138 _edje_entry_end_handler_mouse_up_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
3140 Edje_Real_Part *rp = data;
3141 Entry *en = rp->typedata.text->entry_data;
3143 //switch sel_start,end
3144 if (evas_textblock_cursor_compare(en->sel_start, en->sel_end) >= 0)
3146 Evas_Textblock_Cursor *tc;
3147 tc = evas_object_textblock_cursor_new(rp->object);
3148 evas_textblock_cursor_copy(en->sel_start, tc);
3149 evas_textblock_cursor_copy(en->sel_end, en->sel_start);
3150 evas_textblock_cursor_copy(tc, en->sel_end);
3152 if (evas_textblock_cursor_compare(en->sel_start, en->sel_end) == 0)
3154 evas_textblock_cursor_char_next(en->sel_end);
3156 evas_textblock_cursor_free(tc);
3159 en->handler_bypassing = EINA_FALSE;
3160 _edje_entry_real_part_configure(rp);
3162 _edje_emit(en->rp->edje, "handler,move,end", en->rp->part->name);
3166 _edje_entry_end_handler_mouse_move_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
3168 Evas_Event_Mouse_Move *ev = event_info;
3169 Edje_Real_Part *rp = data;
3170 Entry *en = rp->typedata.text->entry_data;
3171 Evas_Coord x, y, tx, ty, tw, th;
3173 Evas_Textblock_Cursor_Type cur_type;
3176 if (ev->buttons != 1) return;
3178 x = ev->cur.canvas.x;
3179 y = ev->cur.canvas.y;
3181 en->rx += (x - en->sx);
3182 en->ry += (y - en->sy);
3183 en->sx = ev->cur.canvas.x;
3184 en->sy = ev->cur.canvas.y;
3186 evas_object_geometry_get(rp->object, &tx, &ty, NULL, NULL);
3187 evas_object_textblock_size_formatted_get(rp->object, &tw, &th);
3189 cx = en->rx + en->ox - tx;
3190 cy = en->ry + en->oy - ty;
3194 if (cy > th) cy = th - 1;
3196 switch (rp->part->cursor_mode)
3198 case EDJE_ENTRY_CURSOR_MODE_BEFORE:
3199 cur_type = EVAS_TEXTBLOCK_CURSOR_BEFORE;
3201 case EDJE_ENTRY_CURSOR_MODE_UNDER:
3203 cur_type = EVAS_TEXTBLOCK_CURSOR_UNDER;
3206 evas_textblock_cursor_geometry_get(en->sel_start, &sx, &sy, NULL, NULL, NULL, cur_type);
3207 evas_textblock_cursor_char_coord_set(en->cursor, cx, cy);
3210 if (evas_textblock_cursor_compare(en->cursor, en->sel_start) <= 0)
3211 en->handler_bypassing = EINA_TRUE;
3213 en->handler_bypassing = EINA_FALSE;
3216 if (en->select_allow)
3220 if (en->select_mod_end)
3221 _sel_extend(en->cursor, rp->object, en);
3224 _edje_entry_real_part_configure(rp);
3225 _edje_emit(en->rp->edje, "handler,moving", en->rp->part->name);
3230 _evas_focus_in_cb(void *data, Evas *e, __UNUSED__ void *event_info)
3232 Edje *ed = (Edje *)data;
3234 if (evas_focus_get(e) == ed->obj)
3236 _edje_focus_in_cb(data, NULL, NULL, NULL);
3241 _evas_focus_out_cb(void *data, Evas *e, __UNUSED__ void *event_info)
3243 Edje *ed = (Edje *)data;
3245 if (evas_focus_get(e) == ed->obj)
3247 _edje_focus_out_cb(data, NULL, NULL, NULL);
3251 /***************************************************************/
3253 _edje_entry_init(Edje *ed)
3255 if (!ed->has_entries)
3257 if (ed->entries_inited)
3259 ed->entries_inited = EINA_TRUE;
3261 evas_object_event_callback_add(ed->obj, EVAS_CALLBACK_FOCUS_IN, _edje_focus_in_cb, ed);
3262 evas_object_event_callback_add(ed->obj, EVAS_CALLBACK_FOCUS_OUT, _edje_focus_out_cb, ed);
3263 evas_object_event_callback_add(ed->obj, EVAS_CALLBACK_KEY_DOWN, _edje_key_down_cb, ed);
3264 evas_object_event_callback_add(ed->obj, EVAS_CALLBACK_KEY_UP, _edje_key_up_cb, ed);
3265 evas_event_callback_add(ed->base.evas, EVAS_CALLBACK_CANVAS_FOCUS_IN, _evas_focus_in_cb, ed);
3266 evas_event_callback_add(ed->base.evas, EVAS_CALLBACK_CANVAS_FOCUS_OUT, _evas_focus_out_cb, ed);
3270 _edje_entry_shutdown(Edje *ed)
3272 if (!ed->has_entries)
3274 if (!ed->entries_inited)
3276 ed->entries_inited = EINA_FALSE;
3278 evas_object_event_callback_del(ed->obj, EVAS_CALLBACK_FOCUS_IN, _edje_focus_in_cb);
3279 evas_object_event_callback_del(ed->obj, EVAS_CALLBACK_FOCUS_OUT, _edje_focus_out_cb);
3280 evas_object_event_callback_del(ed->obj, EVAS_CALLBACK_KEY_DOWN, _edje_key_down_cb);
3281 evas_object_event_callback_del(ed->obj, EVAS_CALLBACK_KEY_UP, _edje_key_up_cb);
3282 if (evas_event_callback_del_full(ed->base.evas, EVAS_CALLBACK_CANVAS_FOCUS_IN, _evas_focus_in_cb, ed) != ed)
3283 ERR("could not unregister EVAS_CALLBACK_FOCUS_IN");
3284 if (evas_event_callback_del_full(ed->base.evas, EVAS_CALLBACK_CANVAS_FOCUS_OUT, _evas_focus_out_cb, ed) != ed)
3285 ERR("could not unregister EVAS_CALLBACK_FOCUS_OUT");
3289 _edje_entry_real_part_init(Edje_Real_Part *rp)
3292 #ifdef HAVE_ECORE_IMF
3294 const Ecore_IMF_Context_Info *ctx_info;
3297 if ((rp->type != EDJE_RP_TYPE_TEXT) ||
3298 (!rp->typedata.text)) return;
3299 en = calloc(1, sizeof(Entry));
3301 rp->typedata.text->entry_data = en;
3304 evas_object_event_callback_add(rp->object, EVAS_CALLBACK_MOVE, _edje_part_move_cb, rp);
3306 evas_object_event_callback_add(rp->object, EVAS_CALLBACK_MOUSE_DOWN, _edje_part_mouse_down_cb, rp);
3307 evas_object_event_callback_add(rp->object, EVAS_CALLBACK_MOUSE_UP, _edje_part_mouse_up_cb, rp);
3308 evas_object_event_callback_add(rp->object, EVAS_CALLBACK_MOUSE_MOVE, _edje_part_mouse_move_cb, rp);
3310 if (rp->part->select_mode == EDJE_ENTRY_SELECTION_MODE_DEFAULT)
3311 en->select_allow = EINA_TRUE;
3313 if (rp->part->entry_mode == EDJE_ENTRY_EDIT_MODE_PASSWORD)
3315 Edje_Part_Description_Text *txt;
3317 txt = (Edje_Part_Description_Text *)rp->chosen_description;
3319 en->select_allow = EINA_FALSE;
3320 if (txt && edje_string_get(&txt->text.repch))
3321 evas_object_textblock_replace_char_set(rp->object, edje_string_get(&txt->text.repch));
3323 evas_object_textblock_replace_char_set(rp->object, "*");
3326 en->cursor_bg = edje_object_add(rp->edje->base.evas);
3327 edje_object_file_set(en->cursor_bg, rp->edje->path, rp->part->source3);
3328 evas_object_smart_member_add(en->cursor_bg, rp->edje->obj);
3329 evas_object_stack_below(en->cursor_bg, rp->object);
3330 evas_object_clip_set(en->cursor_bg, evas_object_clip_get(rp->object));
3331 evas_object_pass_events_set(en->cursor_bg, EINA_TRUE);
3332 _edje_subobj_register(en->rp->edje, en->cursor_bg);
3334 en->cursor_fg = edje_object_add(rp->edje->base.evas);
3335 edje_object_file_set(en->cursor_fg, rp->edje->path, rp->part->source4);
3336 evas_object_smart_member_add(en->cursor_fg, rp->edje->obj);
3337 evas_object_stack_above(en->cursor_fg, rp->object);
3338 evas_object_clip_set(en->cursor_fg, evas_object_clip_get(rp->object));
3339 evas_object_pass_events_set(en->cursor_fg, EINA_TRUE);
3340 _edje_subobj_register(en->rp->edje, en->cursor_fg);
3342 /* A proxy to the main cursor. */
3343 if (rp->part->cursor_mode == EDJE_ENTRY_CURSOR_MODE_BEFORE)
3345 en->cursor_fg2 = evas_object_image_add(rp->edje->base.evas);
3346 evas_object_image_source_set(en->cursor_fg2, en->cursor_fg);
3347 evas_object_image_fill_set(en->cursor_fg2, 0, 0, 1, 1);
3348 evas_object_smart_member_add(en->cursor_fg2, rp->edje->obj);
3349 evas_object_stack_above(en->cursor_fg2, rp->object);
3350 evas_object_clip_set(en->cursor_fg2, evas_object_clip_get(rp->object));
3351 evas_object_pass_events_set(en->cursor_fg2, EINA_TRUE);
3352 _edje_subobj_register(en->rp->edje, en->cursor_fg2);
3355 // TIZEN ONLY - START
3357 en->cursor_handler_disabled = EINA_FALSE;
3358 en->cursor_handler = NULL;
3359 if (rp->part->source9)
3361 en->cursor_handler = edje_object_add(en->rp->edje->base.evas);
3362 edje_object_file_set(en->cursor_handler , en->rp->edje->path, rp->part->source9);
3364 evas_object_layer_set(en->cursor_handler , EVAS_LAYER_MAX - 2);
3365 en->rp->edje->subobjs = eina_list_append(en->rp->edje->subobjs, en->cursor_handler );
3367 evas_object_event_callback_add(en->cursor_handler , EVAS_CALLBACK_MOUSE_DOWN, _edje_entry_cursor_handler_mouse_down_cb, en->rp);
3368 evas_object_event_callback_add(en->cursor_handler , EVAS_CALLBACK_MOUSE_UP, _edje_entry_cursor_handler_mouse_up_cb, en->rp);
3369 evas_object_event_callback_add(en->cursor_handler , EVAS_CALLBACK_MOUSE_MOVE, _edje_entry_cursor_handler_mouse_move_cb, en->rp);
3371 en->cursor_handler_show = EINA_FALSE;
3373 en->focused = EINA_FALSE;
3375 evas_object_textblock_legacy_newline_set(rp->object, EINA_TRUE);
3377 if (rp->part->entry_mode >= EDJE_ENTRY_EDIT_MODE_EDITABLE)
3379 evas_object_show(en->cursor_bg);
3380 evas_object_show(en->cursor_fg);
3381 evas_object_show(en->cursor_fg2);
3382 en->input_panel_enable = EINA_TRUE;
3384 #ifdef HAVE_ECORE_IMF
3387 en->commit_cancel = EINA_FALSE;
3389 edje_object_signal_callback_add(rp->edje->obj, "focus,part,in", rp->part->name, _edje_entry_focus_in_cb, rp);
3390 edje_object_signal_callback_add(rp->edje->obj, "focus,part,out", rp->part->name, _edje_entry_focus_out_cb, rp);
3392 ctx_id = ecore_imf_context_default_id_get();
3395 ctx_info = ecore_imf_context_info_by_id_get(ctx_id);
3396 if (!ctx_info->canvas_type ||
3397 strcmp(ctx_info->canvas_type, "evas") == 0)
3399 en->imf_context = ecore_imf_context_add(ctx_id);
3403 ctx_id = ecore_imf_context_default_id_by_canvas_type_get("evas");
3406 en->imf_context = ecore_imf_context_add(ctx_id);
3411 en->imf_context = NULL;
3413 if (!en->imf_context) goto done;
3415 ecore_imf_context_client_window_set
3417 (void *)ecore_evas_window_get
3418 (ecore_evas_ecore_evas_get(rp->edje->base.evas)));
3419 ecore_imf_context_client_canvas_set(en->imf_context, rp->edje->base.evas);
3421 ecore_imf_context_retrieve_surrounding_callback_set(en->imf_context,
3422 _edje_entry_imf_retrieve_surrounding_cb, rp->edje);
3423 ecore_imf_context_event_callback_add(en->imf_context, ECORE_IMF_CALLBACK_COMMIT, _edje_entry_imf_event_commit_cb, rp->edje);
3424 ecore_imf_context_event_callback_add(en->imf_context, ECORE_IMF_CALLBACK_DELETE_SURROUNDING, _edje_entry_imf_event_delete_surrounding_cb, rp->edje);
3425 ecore_imf_context_event_callback_add(en->imf_context, ECORE_IMF_CALLBACK_PREEDIT_CHANGED, _edje_entry_imf_event_preedit_changed_cb, rp->edje);
3426 ecore_imf_context_input_mode_set(en->imf_context,
3427 rp->part->entry_mode == EDJE_ENTRY_EDIT_MODE_PASSWORD ?
3428 ECORE_IMF_INPUT_MODE_INVISIBLE : ECORE_IMF_INPUT_MODE_FULL);
3430 if (rp->part->entry_mode == EDJE_ENTRY_EDIT_MODE_PASSWORD)
3431 ecore_imf_context_input_panel_language_set(en->imf_context, ECORE_IMF_INPUT_PANEL_LANG_ALPHABET);
3434 #ifdef HAVE_ECORE_IMF
3437 en->cursor = (Evas_Textblock_Cursor *)evas_object_textblock_cursor_get(rp->object);
3441 _edje_entry_real_part_shutdown(Edje_Real_Part *rp)
3445 if ((rp->type != EDJE_RP_TYPE_TEXT) ||
3446 (!rp->typedata.text)) return;
3447 en = rp->typedata.text->entry_data;
3449 rp->typedata.text->entry_data = NULL;
3450 _sel_clear(en->cursor, rp->object, en);
3451 _anchors_clear(en->cursor, rp->object, en);
3452 #ifdef HAVE_ECORE_IMF
3455 // TIZEN ONLY - START
3456 rp->edje->subobjs = eina_list_remove(rp->edje->subobjs, en->cursor_bg);
3457 rp->edje->subobjs = eina_list_remove(rp->edje->subobjs, en->cursor_fg);
3458 rp->edje->subobjs = eina_list_remove(rp->edje->subobjs, en->sel_handler_start);
3459 rp->edje->subobjs = eina_list_remove(rp->edje->subobjs, en->sel_handler_end);
3460 rp->edje->subobjs = eina_list_remove(rp->edje->subobjs, en->sel_handler_edge_start);
3461 rp->edje->subobjs = eina_list_remove(rp->edje->subobjs, en->sel_handler_edge_end);
3462 rp->edje->subobjs = eina_list_remove(rp->edje->subobjs, en->cursor_handler);
3464 evas_object_del(en->cursor_bg);
3465 evas_object_del(en->cursor_fg);
3466 evas_object_del(en->cursor_fg2);
3468 // TIZEN ONLY - START
3469 if (en->sel_handler_start)
3471 evas_object_del(en->sel_handler_start);
3472 en->sel_handler_start = NULL;
3474 if (en->sel_handler_end)
3476 evas_object_del(en->sel_handler_end);
3477 en->sel_handler_end = NULL;
3479 if (en->cursor_handler)
3481 evas_object_del(en->cursor_handler);
3482 en->cursor_handler = NULL;
3484 if (en->sel_handler_edge_start)
3486 evas_object_del(en->sel_handler_edge_start);
3487 en->sel_handler_edge_start = NULL;
3489 if (en->sel_handler_edge_end)
3491 evas_object_del(en->sel_handler_edge_end);
3492 en->sel_handler_edge_end = NULL;
3495 if (en->long_press_timer)
3497 ecore_timer_del(en->long_press_timer);
3498 en->long_press_timer = NULL;
3500 if (en->cursor_handler_click_timer)
3502 ecore_timer_del(en->cursor_handler_click_timer);
3503 en->cursor_handler_click_timer = NULL;
3509 ecore_timer_del(en->pw_timer);
3510 en->pw_timer = NULL;
3513 #ifdef HAVE_ECORE_IMF
3514 if (rp->part->entry_mode >= EDJE_ENTRY_EDIT_MODE_EDITABLE)
3516 if (en->imf_context)
3518 ecore_imf_context_event_callback_del(en->imf_context, ECORE_IMF_CALLBACK_COMMIT, _edje_entry_imf_event_commit_cb);
3519 ecore_imf_context_event_callback_del(en->imf_context, ECORE_IMF_CALLBACK_DELETE_SURROUNDING, _edje_entry_imf_event_delete_surrounding_cb);
3520 ecore_imf_context_event_callback_del(en->imf_context, ECORE_IMF_CALLBACK_PREEDIT_CHANGED, _edje_entry_imf_event_preedit_changed_cb);
3522 ecore_imf_context_del(en->imf_context);
3523 en->imf_context = NULL;
3526 edje_object_signal_callback_del(rp->edje->obj, "focus,part,in", rp->part->name, _edje_entry_focus_in_cb);
3527 edje_object_signal_callback_del(rp->edje->obj, "focus,part,out", rp->part->name, _edje_entry_focus_out_cb);
3528 ecore_imf_shutdown();
3531 _compose_seq_reset(en);
3537 _edje_entry_real_part_configure(Edje_Real_Part *rp)
3539 Evas_Coord x, y, w, h, xx, yy, ww, hh, xx2, yy2;
3541 Evas_Textblock_Cursor_Type cur_type;
3542 Eina_Bool bidi_cursor = EINA_FALSE;
3544 if ((rp->type != EDJE_RP_TYPE_TEXT) ||
3545 (!rp->typedata.text)) return;
3546 en = rp->typedata.text->entry_data;
3548 switch (rp->part->cursor_mode)
3550 case EDJE_ENTRY_CURSOR_MODE_BEFORE:
3551 cur_type = EVAS_TEXTBLOCK_CURSOR_BEFORE;
3553 case EDJE_ENTRY_CURSOR_MODE_UNDER:
3554 /* no break for a resaon */
3556 cur_type = EVAS_TEXTBLOCK_CURSOR_UNDER;
3559 _sel_update(en->cursor, rp->object, en);
3560 _anchors_update(en->cursor, rp->object, en);
3562 xx = yy = ww = hh = -1;
3563 evas_object_geometry_get(rp->object, &x, &y, &w, &h);
3564 /* For split cursor need to assign return value to bidi_cursor.
3565 * bidi_cursor = evas_textblock_geometry_bidi_get() */
3566 evas_textblock_cursor_geometry_bidi_get(en->cursor, &xx, &yy, &ww, &hh, &xx2, &yy2, NULL, NULL, cur_type);
3571 evas_object_move(en->cursor_bg, x + xx, y + yy);
3572 evas_object_resize(en->cursor_bg, ww, hh);
3576 evas_object_move(en->cursor_fg, x + xx, y + yy);
3577 evas_object_resize(en->cursor_fg, ww, hh);
3584 evas_object_image_fill_set(en->cursor_fg2, 0, 0, ww, hh / 2);
3585 evas_object_move(en->cursor_fg2, x + xx2, y + yy2 + (hh / 2));
3586 evas_object_resize(en->cursor_fg, ww, hh / 2);
3587 evas_object_resize(en->cursor_fg2, ww, hh / 2);
3589 evas_object_show(en->cursor_fg2);
3593 evas_object_hide(en->cursor_fg2);
3597 if (en->cursor_handler && (!en->cursor_handler_disabled || en->long_press_state == _ENTRY_LONG_PRESSED || en->long_press_state == _ENTRY_LONG_PRESSING))
3599 Evas_Coord chx, chy;
3602 evas_object_move(en->cursor_handler, chx, chy);
3603 if (((chx < en->viewport_region.x) || (chy < en->viewport_region.y) ||
3604 (chx > en->viewport_region.x + en->viewport_region.w) || (chy > en->viewport_region.y + en->viewport_region.h))
3605 && (en->cursor_handler_show))
3607 evas_object_hide(en->cursor_handler);
3608 en->cursor_handler_show = EINA_FALSE;
3614 _edje_entry_selection_get(Edje_Real_Part *rp)
3618 if ((rp->type != EDJE_RP_TYPE_TEXT) ||
3619 (!rp->typedata.text)) return NULL;
3620 en = rp->typedata.text->entry_data;
3621 if (!en) return NULL;
3622 // get selection - convert to markup
3623 if ((!en->selection) && (en->have_selection))
3624 en->selection = evas_textblock_cursor_range_text_get
3625 (en->sel_start, en->sel_end, EVAS_TEXTBLOCK_TEXT_MARKUP);
3626 return en->selection;
3630 _edje_entry_text_get(Edje_Real_Part *rp)
3634 if ((rp->type != EDJE_RP_TYPE_TEXT) ||
3635 (!rp->typedata.text)) return NULL;
3636 en = rp->typedata.text->entry_data;
3637 if (!en) return NULL;
3638 // get text - convert to markup
3639 return evas_object_textblock_text_markup_get(rp->object);
3643 _edje_entry_text_markup_set(Edje_Real_Part *rp, const char *text)
3647 if ((rp->type != EDJE_RP_TYPE_TEXT) ||
3648 (!rp->typedata.text)) return;
3649 en = rp->typedata.text->entry_data;
3651 _edje_entry_imf_context_reset(rp);
3652 // set text as markup
3653 _sel_clear(en->cursor, rp->object, en);
3654 evas_object_textblock_text_markup_set(rp->object, text);
3655 _edje_entry_set_cursor_start(rp);
3657 _anchors_get(en->cursor, rp->object, en);
3658 _edje_emit(rp->edje, "entry,changed", rp->part->name);
3660 // TIZEN ONLY(130129) : Currently, for freezing cursor movement.
3663 _edje_entry_imf_cursor_info_set(en);
3664 _edje_entry_real_part_configure(rp);
3669 /* Don't emit cursor changed cause it didn't. It's just init to 0. */
3670 _edje_emit(rp->edje, "cursor,changed", rp->part->name);
3675 _edje_entry_text_markup_append(Edje_Real_Part *rp, const char *text)
3679 if ((rp->type != EDJE_RP_TYPE_TEXT) ||
3680 (!rp->typedata.text)) return;
3681 en = rp->typedata.text->entry_data;
3682 Evas_Textblock_Cursor *end_cur;
3684 end_cur = evas_object_textblock_cursor_new(rp->object);
3685 evas_textblock_cursor_paragraph_last(end_cur);
3687 _text_filter_markup_prepend(en, end_cur, text);
3688 evas_textblock_cursor_free(end_cur);
3690 /* We are updating according to the real cursor on purpose */
3691 _anchors_get(en->cursor, rp->object, en);
3692 _edje_emit(rp->edje, "entry,changed", rp->part->name);
3694 _edje_entry_real_part_configure(rp);
3698 _edje_entry_text_markup_insert(Edje_Real_Part *rp, const char *text)
3702 if ((rp->type != EDJE_RP_TYPE_TEXT) ||
3703 (!rp->typedata.text)) return;
3704 en = rp->typedata.text->entry_data;
3706 _edje_entry_imf_context_reset(rp);
3708 // prepend markup @ cursor pos
3709 if (en->have_selection)
3710 _range_del(en->cursor, rp->object, en);
3712 // evas_object_textblock_text_markup_prepend(en->cursor, text);
3713 _text_filter_markup_prepend(en, en->cursor, text);
3714 _anchors_get(en->cursor, rp->object, en);
3715 // TIZEN ONLY - START
3716 if (en->cursor_handler_show)
3718 evas_object_hide(en->cursor_handler);
3719 en->cursor_handler_show = EINA_FALSE;
3722 _edje_emit(rp->edje, "entry,changed", rp->part->name);
3723 _edje_emit(rp->edje, "cursor,changed", rp->part->name);
3725 _edje_entry_imf_cursor_info_set(en);
3726 _edje_entry_real_part_configure(rp);
3730 _edje_entry_set_cursor_start(Edje_Real_Part *rp)
3734 if ((rp->type != EDJE_RP_TYPE_TEXT) ||
3735 (!rp->typedata.text)) return;
3736 en = rp->typedata.text->entry_data;
3738 _curs_start(en->cursor, rp->object, en);
3740 // TIZEN ONLY(130129) : Currently, for freezing cursor movement.
3742 _edje_entry_imf_cursor_info_set(en);
3746 _edje_entry_set_cursor_end(Edje_Real_Part *rp)
3750 if ((rp->type != EDJE_RP_TYPE_TEXT) ||
3751 (!rp->typedata.text)) return;
3752 en = rp->typedata.text->entry_data;
3754 _curs_end(en->cursor, rp->object, en);
3756 _edje_entry_imf_cursor_info_set(en);
3760 _edje_entry_select_none(Edje_Real_Part *rp)
3764 if ((rp->type != EDJE_RP_TYPE_TEXT) ||
3765 (!rp->typedata.text)) return;
3766 en = rp->typedata.text->entry_data;
3768 _sel_clear(en->cursor, rp->object, en);
3772 _edje_entry_select_all(Edje_Real_Part *rp)
3776 if ((rp->type != EDJE_RP_TYPE_TEXT) ||
3777 (!rp->typedata.text)) return;
3778 en = rp->typedata.text->entry_data;
3781 _edje_entry_imf_context_reset(rp);
3783 _sel_clear(en->cursor, rp->object, en);
3784 _curs_start(en->cursor, rp->object, en);
3785 _sel_enable(en->cursor, rp->object, en);
3786 _sel_start(en->cursor, rp->object, en);
3787 _curs_end(en->cursor, rp->object, en);
3788 _sel_extend(en->cursor, rp->object, en);
3790 _edje_entry_real_part_configure(rp);
3792 // TIZEN ONLY - START
3793 en->select_allow = EINA_TRUE;
3794 en->had_sel = EINA_TRUE;
3796 _edje_emit(en->rp->edje, "selection,end", en->rp->part->name);
3801 _edje_entry_select_begin(Edje_Real_Part *rp)
3805 if ((rp->type != EDJE_RP_TYPE_TEXT) ||
3806 (!rp->typedata.text)) return;
3807 en = rp->typedata.text->entry_data;
3810 _sel_clear(en->cursor, rp->object, en);
3811 _sel_enable(en->cursor, rp->object, en);
3812 _sel_start(en->cursor, rp->object, en);
3813 _sel_extend(en->cursor, rp->object, en);
3815 _edje_entry_real_part_configure(rp);
3819 _edje_entry_select_extend(Edje_Real_Part *rp)
3823 if ((rp->type != EDJE_RP_TYPE_TEXT) ||
3824 (!rp->typedata.text)) return;
3825 en = rp->typedata.text->entry_data;
3827 _sel_extend(en->cursor, rp->object, en);
3829 _edje_entry_real_part_configure(rp);
3833 _edje_entry_anchor_geometry_get(Edje_Real_Part *rp, const char *anchor)
3839 if ((rp->type != EDJE_RP_TYPE_TEXT) ||
3840 (!rp->typedata.text)) return NULL;
3841 en = rp->typedata.text->entry_data;
3842 if (!en) return NULL;
3843 EINA_LIST_FOREACH(en->anchors, l, an)
3845 if (an->item) continue;
3846 if (!strcmp(anchor, an->name))
3853 _edje_entry_anchors_list(Edje_Real_Part *rp)
3856 Eina_List *l, *anchors = NULL;
3859 if ((rp->type != EDJE_RP_TYPE_TEXT) ||
3860 (!rp->typedata.text)) return NULL;
3861 en = rp->typedata.text->entry_data;
3862 if (!en) return NULL;
3863 if (!en->anchorlist)
3865 EINA_LIST_FOREACH(en->anchors, l, an)
3867 const char *n = an->name;
3868 if (an->item) continue;
3870 anchors = eina_list_append(anchors, strdup(n));
3872 en->anchorlist = anchors;
3874 return en->anchorlist;
3878 _edje_entry_item_geometry_get(Edje_Real_Part *rp, const char *item, Evas_Coord *cx, Evas_Coord *cy, Evas_Coord *cw, Evas_Coord *ch)
3884 if ((rp->type != EDJE_RP_TYPE_TEXT) ||
3885 (!rp->typedata.text)) return EINA_FALSE;
3886 en = rp->typedata.text->entry_data;
3887 if (!en) return EINA_FALSE;
3888 EINA_LIST_FOREACH(en->anchors, l, an)
3890 if (an->item) continue;
3891 if (!strcmp(item, an->name))
3893 evas_textblock_cursor_format_item_geometry_get(an->start, cx, cy, cw, ch);
3901 _edje_entry_items_list(Edje_Real_Part *rp)
3904 Eina_List *l, *items = NULL;
3907 if ((rp->type != EDJE_RP_TYPE_TEXT) ||
3908 (!rp->typedata.text)) return NULL;
3909 en = rp->typedata.text->entry_data;
3910 if (!en) return NULL;
3913 EINA_LIST_FOREACH(en->anchors, l, an)
3915 const char *n = an->name;
3916 if (an->item) continue;
3918 items = eina_list_append(items, strdup(n));
3920 en->itemlist = items;
3922 return en->itemlist;
3925 // TIZEN ONLY - START
3927 _edje_entry_layout_region_set(Edje_Real_Part *rp, Evas_Coord x, Evas_Coord y, Evas_Coord w, Evas_Coord h)
3931 if ((rp->type != EDJE_RP_TYPE_TEXT) ||
3932 (!rp->typedata.text)) return;
3933 en = rp->typedata.text->entry_data;
3936 en->layout_region.x = x;
3937 en->layout_region.y = y;
3938 en->layout_region.w = w;
3939 en->layout_region.h = h;
3940 _sel_update(en->cursor, rp->object, en);
3944 _edje_entry_viewport_region_set(Edje_Real_Part *rp, Evas_Coord x, Evas_Coord y, Evas_Coord w, Evas_Coord h)
3947 if ((rp->type != EDJE_RP_TYPE_TEXT) ||
3948 (!rp->typedata.text)) return;
3949 en = rp->typedata.text->entry_data;
3952 en->viewport_region.x = x;
3953 en->viewport_region.y = y;
3954 en->viewport_region.w = w;
3955 en->viewport_region.h = h;
3956 _sel_update(en->cursor, rp->object, en);
3960 _edje_entry_selection_handler_geometry_get(Edje_Real_Part *rp, Edje_Selection_Handler type, Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *h)
3963 Evas_Coord ex, ey, hx, hy, edx, edy, edw, edh;
3964 if ((rp->type != EDJE_RP_TYPE_TEXT) ||
3965 (!rp->typedata.text)) return;
3966 en = rp->typedata.text->entry_data;
3969 evas_object_geometry_get(rp->object, &ex, &ey, NULL, NULL);
3972 case EDJE_SELECTION_HANDLER_START:
3973 if (en->sel_handler_start)
3975 evas_object_geometry_get(en->sel_handler_start, &hx, &hy, NULL, NULL);
3976 edje_object_part_geometry_get(en->sel_handler_start, "handle", &edx, &edy, &edw, &edh);
3981 case EDJE_SELECTION_HANDLER_END:
3982 if (en->sel_handler_end)
3984 evas_object_geometry_get(en->sel_handler_end, &hx, &hy, NULL, NULL);
3985 edje_object_part_geometry_get(en->sel_handler_end, "handle", &edx, &edy, &edw, &edh);
4001 _edje_entry_cursor_handler_disabled_get(Edje_Real_Part *rp)
4004 if ((rp->type != EDJE_RP_TYPE_TEXT) ||
4005 (!rp->typedata.text)) return EINA_FALSE;
4006 en = rp->typedata.text->entry_data;
4007 if (!en) return EINA_FALSE;
4008 return en->cursor_handler_disabled;
4012 _edje_entry_cursor_handler_disabled_set(Edje_Real_Part *rp, Eina_Bool disabled)
4015 if ((rp->type != EDJE_RP_TYPE_TEXT) ||
4016 (!rp->typedata.text)) return;
4017 en = rp->typedata.text->entry_data;
4020 en->cursor_handler_disabled = disabled;
4025 _edje_entry_cursor_geometry_get(Edje_Real_Part *rp, Evas_Coord *cx, Evas_Coord *cy, Evas_Coord *cw, Evas_Coord *ch)
4027 Evas_Coord x, y, w, h, xx, yy, ww, hh;
4029 Evas_Textblock_Cursor_Type cur_type;
4031 if ((rp->type != EDJE_RP_TYPE_TEXT) ||
4032 (!rp->typedata.text)) return;
4033 en = rp->typedata.text->entry_data;
4035 switch (rp->part->cursor_mode)
4037 case EDJE_ENTRY_CURSOR_MODE_BEFORE:
4038 cur_type = EVAS_TEXTBLOCK_CURSOR_BEFORE;
4040 case EDJE_ENTRY_CURSOR_MODE_UNDER:
4041 /* no break for a resaon */
4043 cur_type = EVAS_TEXTBLOCK_CURSOR_UNDER;
4047 xx = yy = ww = hh = -1;
4048 evas_object_geometry_get(rp->object, &x, &y, &w, &h);
4049 evas_textblock_cursor_geometry_get(en->cursor, &xx, &yy, &ww, &hh, NULL, cur_type);
4051 if (rp->part->cursor_mode == EDJE_ENTRY_CURSOR_MODE_BEFORE)
4052 edje_object_size_min_restricted_calc(en->cursor_fg, &ww, NULL, ww, 0);
4054 if (cx) *cx = x + xx;
4055 if (cy) *cy = y + yy;
4061 _edje_entry_user_insert(Edje_Real_Part *rp, const char *text)
4064 Edje_Entry_Change_Info *info;
4066 if ((rp->type != EDJE_RP_TYPE_TEXT) ||
4067 (!rp->typedata.text)) return;
4068 en = rp->typedata.text->entry_data;
4070 info = calloc(1, sizeof(*info));
4072 info->insert = EINA_TRUE;
4073 info->change.insert.plain_length = 1;
4074 info->change.insert.content = eina_stringshare_add(text);
4077 tmp = evas_textblock_text_markup_to_utf8(rp->object,
4078 info->change.insert.content);
4079 info->change.insert.plain_length = eina_unicode_utf8_get_len(tmp);
4083 if (en->have_selection)
4085 _range_del_emit(rp->edje, en->cursor, rp->object, en);
4086 info->merge = EINA_TRUE;
4088 info->change.insert.pos = evas_textblock_cursor_pos_get(en->cursor);
4089 _text_filter_markup_prepend(en, en->cursor, text);
4090 _anchors_get(en->cursor, rp->object, en);
4091 // TIZEN ONLY - START
4092 if (en->cursor_handler_show)
4094 evas_object_hide(en->cursor_handler);
4095 en->cursor_handler_show = EINA_FALSE;
4098 _edje_emit(rp->edje, "entry,changed", rp->part->name);
4099 _edje_emit_full(rp->edje, "entry,changed,user", rp->part->name,
4100 info, _free_entry_change_info);
4101 _edje_emit(rp->edje, "cursor,changed", rp->part->name);
4103 _edje_entry_imf_cursor_info_set(en);
4104 _edje_entry_real_part_configure(rp);
4108 _edje_entry_select_allow_set(Edje_Real_Part *rp, Eina_Bool allow)
4112 if ((rp->type != EDJE_RP_TYPE_TEXT) ||
4113 (!rp->typedata.text)) return;
4114 en = rp->typedata.text->entry_data;
4116 if (rp->part->select_mode == EDJE_ENTRY_SELECTION_MODE_DEFAULT)
4118 en->select_allow = allow;
4122 _edje_entry_select_allow_get(const Edje_Real_Part *rp)
4126 if ((rp->type != EDJE_RP_TYPE_TEXT) ||
4127 (!rp->typedata.text)) return EINA_FALSE;
4128 en = rp->typedata.text->entry_data;
4129 if (!en) return EINA_FALSE;
4130 return en->select_allow;
4134 _edje_entry_select_abort(Edje_Real_Part *rp)
4138 if ((rp->type != EDJE_RP_TYPE_TEXT) ||
4139 (!rp->typedata.text)) return;
4140 en = rp->typedata.text->entry_data;
4144 en->selecting = EINA_FALSE;
4146 _edje_entry_imf_context_reset(rp);
4147 _edje_entry_imf_cursor_info_set(en);
4148 _edje_entry_real_part_configure(rp);
4152 // TIZEN ONLY - START
4154 _edje_entry_selection_geometry_get(Edje_Real_Part *rp, Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *h)
4156 Entry *en = rp->typedata.text->entry_data;
4157 if (!en || !en->have_selection || !en->sel)
4162 Evas_Textblock_Rectangle rect;
4163 Evas_Coord tx, ty, tw, th;
4166 if (!l) return EINA_FALSE;
4167 sel = eina_list_data_get(l);
4168 if (!sel) return EINA_FALSE;
4173 l = eina_list_last(en->sel);
4174 if (!l) return EINA_FALSE;
4175 sel = eina_list_data_get(l);
4176 if (!sel) return EINA_FALSE;
4180 th = rect.y - ty + rect.h;
4182 EINA_LIST_FOREACH(en->sel, l, sel)
4186 if (tw < sel->rect.w) tw = sel->rect.w;
4187 if (sel->rect.x < tx) tx = sel->rect.x;
4192 evas_object_geometry_get(rp->object, &vx, &vy, NULL, NULL);
4206 _edje_entry_imf_context_get(Edje_Real_Part *rp)
4210 if ((rp->type != EDJE_RP_TYPE_TEXT) ||
4211 (!rp->typedata.text)) return NULL;
4212 en = rp->typedata.text->entry_data;
4213 if (!en) return NULL;
4215 #ifdef HAVE_ECORE_IMF
4216 return en->imf_context;
4223 _edje_entry_autocapital_type_set(Edje_Real_Part *rp, Edje_Text_Autocapital_Type autocapital_type)
4227 if ((rp->type != EDJE_RP_TYPE_TEXT) ||
4228 (!rp->typedata.text)) return;
4229 en = rp->typedata.text->entry_data;
4232 if (rp->part->entry_mode == EDJE_ENTRY_EDIT_MODE_PASSWORD)
4233 autocapital_type = EDJE_TEXT_AUTOCAPITAL_TYPE_NONE;
4235 #ifdef HAVE_ECORE_IMF
4236 if (en->imf_context)
4237 ecore_imf_context_autocapital_type_set(en->imf_context, autocapital_type);
4241 Edje_Text_Autocapital_Type
4242 _edje_entry_autocapital_type_get(Edje_Real_Part *rp)
4246 if ((rp->type != EDJE_RP_TYPE_TEXT) ||
4247 (!rp->typedata.text)) return EDJE_TEXT_AUTOCAPITAL_TYPE_NONE;
4248 en = rp->typedata.text->entry_data;
4249 if (!en) return EDJE_TEXT_AUTOCAPITAL_TYPE_NONE;
4251 #ifdef HAVE_ECORE_IMF
4252 if (en->imf_context)
4253 return ecore_imf_context_autocapital_type_get(en->imf_context);
4256 return EDJE_TEXT_AUTOCAPITAL_TYPE_NONE;
4260 _edje_entry_prediction_allow_set(Edje_Real_Part *rp, Eina_Bool prediction)
4264 if ((rp->type != EDJE_RP_TYPE_TEXT) ||
4265 (!rp->typedata.text)) return;
4266 en = rp->typedata.text->entry_data;
4268 en->prediction_allow = prediction;
4269 #ifdef HAVE_ECORE_IMF
4270 if (en->imf_context)
4271 ecore_imf_context_prediction_allow_set(en->imf_context, prediction);
4276 _edje_entry_prediction_allow_get(Edje_Real_Part *rp)
4280 if ((rp->type != EDJE_RP_TYPE_TEXT) ||
4281 (!rp->typedata.text)) return EINA_FALSE;
4282 en = rp->typedata.text->entry_data;
4283 if (!en) return EINA_FALSE;
4284 return en->prediction_allow;
4288 _edje_entry_input_panel_enabled_set(Edje_Real_Part *rp, Eina_Bool enabled)
4292 if ((rp->type != EDJE_RP_TYPE_TEXT) ||
4293 (!rp->typedata.text)) return;
4294 en = rp->typedata.text->entry_data;
4296 en->input_panel_enable = enabled;
4297 #ifdef HAVE_ECORE_IMF
4298 if (en->imf_context)
4299 ecore_imf_context_input_panel_enabled_set(en->imf_context, enabled);
4304 _edje_entry_input_panel_enabled_get(Edje_Real_Part *rp)
4308 if ((rp->type != EDJE_RP_TYPE_TEXT) ||
4309 (!rp->typedata.text)) return EINA_FALSE;
4310 en = rp->typedata.text->entry_data;
4311 if (!en) return EINA_FALSE;
4312 return en->input_panel_enable;
4316 _edje_entry_input_panel_show(Edje_Real_Part *rp)
4320 if ((rp->type != EDJE_RP_TYPE_TEXT) ||
4321 (!rp->typedata.text)) return;
4322 en = rp->typedata.text->entry_data;
4324 #ifdef HAVE_ECORE_IMF
4325 if (en->imf_context)
4326 ecore_imf_context_input_panel_show(en->imf_context);
4331 _edje_entry_input_panel_hide(Edje_Real_Part *rp)
4335 if ((rp->type != EDJE_RP_TYPE_TEXT) ||
4336 (!rp->typedata.text)) return;
4337 en = rp->typedata.text->entry_data;
4339 #ifdef HAVE_ECORE_IMF
4340 if (en->imf_context)
4341 ecore_imf_context_input_panel_hide(en->imf_context);
4346 _edje_entry_input_panel_language_set(Edje_Real_Part *rp, Edje_Input_Panel_Lang lang)
4350 if ((rp->type != EDJE_RP_TYPE_TEXT) ||
4351 (!rp->typedata.text)) return;
4352 en = rp->typedata.text->entry_data;
4354 en->input_panel_lang = lang;
4355 #ifdef HAVE_ECORE_IMF
4356 if (en->imf_context)
4357 ecore_imf_context_input_panel_language_set(en->imf_context, lang);
4361 Edje_Input_Panel_Lang
4362 _edje_entry_input_panel_language_get(Edje_Real_Part *rp)
4366 if ((rp->type != EDJE_RP_TYPE_TEXT) ||
4367 (!rp->typedata.text)) return EDJE_INPUT_PANEL_LANG_AUTOMATIC;
4368 en = rp->typedata.text->entry_data;
4369 if (!en) return EDJE_INPUT_PANEL_LANG_AUTOMATIC;
4370 return en->input_panel_lang;
4373 #ifdef HAVE_ECORE_IMF
4375 _edje_entry_input_panel_imdata_set(Edje_Real_Part *rp, const void *data, int len)
4378 _edje_entry_input_panel_imdata_set(Edje_Real_Part *rp, const void *data __UNUSED__, int len __UNUSED__)
4383 if ((rp->type != EDJE_RP_TYPE_TEXT) ||
4384 (!rp->typedata.text)) return;
4385 en = rp->typedata.text->entry_data;
4387 #ifdef HAVE_ECORE_IMF
4388 if (en->imf_context)
4389 ecore_imf_context_input_panel_imdata_set(en->imf_context, data, len);
4393 #ifdef HAVE_ECORE_IMF
4395 _edje_entry_input_panel_imdata_get(Edje_Real_Part *rp, void *data, int *len)
4398 _edje_entry_input_panel_imdata_get(Edje_Real_Part *rp, void *data __UNUSED__, int *len __UNUSED__)
4403 if ((rp->type != EDJE_RP_TYPE_TEXT) ||
4404 (!rp->typedata.text)) return;
4405 en = rp->typedata.text->entry_data;
4407 #ifdef HAVE_ECORE_IMF
4408 if (en->imf_context)
4409 ecore_imf_context_input_panel_imdata_get(en->imf_context, data, len);
4413 #ifdef HAVE_ECORE_IMF
4415 _edje_entry_input_panel_return_key_type_set(Edje_Real_Part *rp, Edje_Input_Panel_Return_Key_Type return_key_type)
4418 _edje_entry_input_panel_return_key_type_set(Edje_Real_Part *rp, Edje_Input_Panel_Return_Key_Type return_key_type __UNUSED__)
4423 if ((rp->type != EDJE_RP_TYPE_TEXT) ||
4424 (!rp->typedata.text)) return;
4425 en = rp->typedata.text->entry_data;
4427 #ifdef HAVE_ECORE_IMF
4428 if (en->imf_context)
4429 ecore_imf_context_input_panel_return_key_type_set(en->imf_context, return_key_type);
4433 Edje_Input_Panel_Return_Key_Type
4434 _edje_entry_input_panel_return_key_type_get(Edje_Real_Part *rp)
4438 if ((rp->type != EDJE_RP_TYPE_TEXT) ||
4439 (!rp->typedata.text)) return EDJE_INPUT_PANEL_RETURN_KEY_TYPE_DEFAULT;
4440 en = rp->typedata.text->entry_data;
4441 if (!en) return EDJE_INPUT_PANEL_RETURN_KEY_TYPE_DEFAULT;
4442 #ifdef HAVE_ECORE_IMF
4443 if (en->imf_context)
4444 return ecore_imf_context_input_panel_return_key_type_get(en->imf_context);
4446 return EDJE_INPUT_PANEL_RETURN_KEY_TYPE_DEFAULT;
4449 #ifdef HAVE_ECORE_IMF
4451 _edje_entry_input_panel_return_key_disabled_set(Edje_Real_Part *rp, Eina_Bool disabled)
4454 _edje_entry_input_panel_return_key_disabled_set(Edje_Real_Part *rp, Eina_Bool disabled __UNUSED__)
4459 if ((rp->type != EDJE_RP_TYPE_TEXT) ||
4460 (!rp->typedata.text)) return;
4461 en = rp->typedata.text->entry_data;
4463 #ifdef HAVE_ECORE_IMF
4464 if (en->imf_context)
4465 ecore_imf_context_input_panel_return_key_disabled_set(en->imf_context, disabled);
4470 _edje_entry_input_panel_return_key_disabled_get(Edje_Real_Part *rp)
4474 if ((rp->type != EDJE_RP_TYPE_TEXT) ||
4475 (!rp->typedata.text)) return EINA_FALSE;
4476 en = rp->typedata.text->entry_data;
4477 if (!en) return EINA_FALSE;
4478 #ifdef HAVE_ECORE_IMF
4479 if (en->imf_context)
4480 return ecore_imf_context_input_panel_return_key_disabled_get(en->imf_context);
4485 static Evas_Textblock_Cursor *
4486 _cursor_get(Edje_Real_Part *rp, Edje_Cursor cur)
4490 if ((rp->type != EDJE_RP_TYPE_TEXT) ||
4491 (!rp->typedata.text)) return NULL;
4492 en = rp->typedata.text->entry_data;
4493 if (!en) return NULL;
4496 case EDJE_CURSOR_MAIN:
4498 case EDJE_CURSOR_SELECTION_BEGIN:
4499 return en->sel_start;
4500 case EDJE_CURSOR_SELECTION_END:
4502 case EDJE_CURSOR_PREEDIT_START:
4503 if (!en->preedit_start)
4504 en->preedit_start = evas_object_textblock_cursor_new(rp->object);
4505 return en->preedit_start;
4506 case EDJE_CURSOR_PREEDIT_END:
4507 if (!en->preedit_end)
4508 en->preedit_end = evas_object_textblock_cursor_new(rp->object);
4509 return en->preedit_end;
4510 case EDJE_CURSOR_USER:
4511 if (!en->cursor_user)
4512 en->cursor_user = evas_object_textblock_cursor_new(rp->object);
4513 return en->cursor_user;
4514 case EDJE_CURSOR_USER_EXTRA:
4515 if (!en->cursor_user_extra)
4516 en->cursor_user_extra = evas_object_textblock_cursor_new(rp->object);
4517 return en->cursor_user_extra;
4525 _edje_entry_cursor_next(Edje_Real_Part *rp, Edje_Cursor cur)
4528 Evas_Textblock_Cursor *c = _cursor_get(rp, cur);
4530 if ((rp->type != EDJE_RP_TYPE_TEXT) ||
4531 (!rp->typedata.text)) return EINA_FALSE;
4532 en = rp->typedata.text->entry_data;
4533 if (!en) return EINA_FALSE;
4535 if (!c) return EINA_FALSE;
4537 _edje_entry_imf_context_reset(rp);
4539 if (!evas_textblock_cursor_char_next(c))
4543 _sel_update(c, rp->object, rp->typedata.text->entry_data);
4544 _edje_entry_imf_cursor_info_set(en);
4546 _edje_emit(rp->edje, "cursor,changed", rp->part->name);
4547 _edje_entry_real_part_configure(rp);
4552 _edje_entry_cursor_prev(Edje_Real_Part *rp, Edje_Cursor cur)
4555 Evas_Textblock_Cursor *c = _cursor_get(rp, cur);
4557 if ((rp->type != EDJE_RP_TYPE_TEXT) ||
4558 (!rp->typedata.text)) return EINA_FALSE;
4559 en = rp->typedata.text->entry_data;
4560 if (!en) return EINA_FALSE;
4561 if (!c) return EINA_FALSE;
4563 _edje_entry_imf_context_reset(rp);
4565 if (!evas_textblock_cursor_char_prev(c))
4567 if (evas_textblock_cursor_paragraph_prev(c)) goto ok;
4568 else return EINA_FALSE;
4571 _sel_update(c, rp->object, rp->typedata.text->entry_data);
4573 _edje_entry_imf_cursor_info_set(en);
4575 _edje_emit(rp->edje, "cursor,changed", rp->part->name);
4576 _edje_entry_real_part_configure(rp);
4581 _edje_entry_cursor_up(Edje_Real_Part *rp, Edje_Cursor cur)
4584 Evas_Textblock_Cursor *c = _cursor_get(rp, cur);
4585 Evas_Coord lx, ly, lw, lh, cx, cy, cw, ch;
4588 if ((rp->type != EDJE_RP_TYPE_TEXT) ||
4589 (!rp->typedata.text)) return EINA_FALSE;
4590 en = rp->typedata.text->entry_data;
4591 if (!en) return EINA_FALSE;
4592 if (!c) return EINA_FALSE;
4594 _edje_entry_imf_context_reset(rp);
4596 ln = evas_textblock_cursor_line_geometry_get(c, NULL, NULL, NULL, NULL);
4598 if (ln < 0) return EINA_FALSE;
4599 if (!evas_object_textblock_line_number_geometry_get(rp->object, ln,
4600 &lx, &ly, &lw, &lh))
4602 evas_textblock_cursor_char_geometry_get(c, &cx, &cy, &cw, &ch);
4603 if (!evas_textblock_cursor_char_coord_set(c, cx, ly + (lh / 2)))
4605 if (cx < (lx + (lw / 2)))
4606 evas_textblock_cursor_line_char_last(c);
4608 evas_textblock_cursor_line_char_last(c);
4610 _sel_update(c, rp->object, rp->typedata.text->entry_data);
4612 _edje_entry_imf_cursor_info_set(en);
4614 _edje_emit(rp->edje, "cursor,changed", rp->part->name);
4615 _edje_entry_real_part_configure(rp);
4620 _edje_entry_cursor_down(Edje_Real_Part *rp, Edje_Cursor cur)
4623 Evas_Textblock_Cursor *c = _cursor_get(rp, cur);
4624 Evas_Coord lx, ly, lw, lh, cx, cy, cw, ch;
4627 if ((rp->type != EDJE_RP_TYPE_TEXT) ||
4628 (!rp->typedata.text)) return EINA_FALSE;
4629 en = rp->typedata.text->entry_data;
4630 if (!en) return EINA_FALSE;
4631 if (!c) return EINA_FALSE;
4633 _edje_entry_imf_context_reset(rp);
4635 ln = evas_textblock_cursor_line_geometry_get(c, NULL, NULL, NULL, NULL);
4637 if (!evas_object_textblock_line_number_geometry_get(rp->object, ln,
4638 &lx, &ly, &lw, &lh))
4640 evas_textblock_cursor_char_geometry_get(c, &cx, &cy, &cw, &ch);
4641 if (!evas_textblock_cursor_char_coord_set(c, cx, ly + (lh / 2)))
4643 if (cx < (lx + (lw / 2)))
4644 evas_textblock_cursor_line_char_last(c);
4646 evas_textblock_cursor_line_char_last(c);
4648 _sel_update(c, rp->object, rp->typedata.text->entry_data);
4650 _edje_entry_imf_cursor_info_set(en);
4651 _edje_emit(rp->edje, "cursor,changed", rp->part->name);
4652 _edje_entry_real_part_configure(rp);
4657 _edje_entry_cursor_begin(Edje_Real_Part *rp, Edje_Cursor cur)
4660 Evas_Textblock_Cursor *c = _cursor_get(rp, cur);
4662 if ((rp->type != EDJE_RP_TYPE_TEXT) ||
4663 (!rp->typedata.text)) return;
4664 en = rp->typedata.text->entry_data;
4668 _edje_entry_imf_context_reset(rp);
4670 evas_textblock_cursor_paragraph_first(c);
4671 _sel_update(c, rp->object, rp->typedata.text->entry_data);
4673 _edje_entry_imf_cursor_info_set(en);
4674 _edje_emit(rp->edje, "cursor,changed", rp->part->name);
4675 _edje_entry_real_part_configure(rp);
4679 _edje_entry_cursor_end(Edje_Real_Part *rp, Edje_Cursor cur)
4682 Evas_Textblock_Cursor *c = _cursor_get(rp, cur);
4684 if ((rp->type != EDJE_RP_TYPE_TEXT) ||
4685 (!rp->typedata.text)) return;
4686 en = rp->typedata.text->entry_data;
4690 _edje_entry_imf_context_reset(rp);
4692 _curs_end(c, rp->object, rp->typedata.text->entry_data);
4693 _sel_update(c, rp->object, rp->typedata.text->entry_data);
4695 _edje_entry_imf_cursor_info_set(en);
4697 _edje_emit(rp->edje, "cursor,changed", rp->part->name);
4698 _edje_entry_real_part_configure(rp);
4702 _edje_entry_cursor_copy(Edje_Real_Part *rp, Edje_Cursor cur, Edje_Cursor dst)
4705 Evas_Textblock_Cursor *c;
4706 Evas_Textblock_Cursor *d;
4708 if ((rp->type != EDJE_RP_TYPE_TEXT) ||
4709 (!rp->typedata.text)) return;
4710 en = rp->typedata.text->entry_data;
4712 c = _cursor_get(rp, cur);
4714 d = _cursor_get(rp, dst);
4716 evas_textblock_cursor_copy(c, d);
4717 _sel_update(c, rp->object, rp->typedata.text->entry_data);
4719 _edje_entry_imf_context_reset(rp);
4720 _edje_entry_imf_cursor_info_set(en);
4721 _edje_emit(rp->edje, "cursor,changed", rp->part->name);
4722 _edje_entry_real_part_configure(rp);
4726 _edje_entry_cursor_line_begin(Edje_Real_Part *rp, Edje_Cursor cur)
4729 Evas_Textblock_Cursor *c = _cursor_get(rp, cur);
4731 if ((rp->type != EDJE_RP_TYPE_TEXT) ||
4732 (!rp->typedata.text)) return;
4733 en = rp->typedata.text->entry_data;
4736 _edje_entry_imf_context_reset(rp);
4738 evas_textblock_cursor_line_char_first(c);
4739 _sel_update(c, rp->object, rp->typedata.text->entry_data);
4741 _edje_entry_imf_cursor_info_set(en);
4743 _edje_emit(rp->edje, "cursor,changed", rp->part->name);
4744 _edje_entry_real_part_configure(rp);
4748 _edje_entry_cursor_line_end(Edje_Real_Part *rp, Edje_Cursor cur)
4751 Evas_Textblock_Cursor *c = _cursor_get(rp, cur);
4753 if ((rp->type != EDJE_RP_TYPE_TEXT) ||
4754 (!rp->typedata.text)) return;
4755 en = rp->typedata.text->entry_data;
4758 _edje_entry_imf_context_reset(rp);
4759 evas_textblock_cursor_line_char_last(c);
4760 _sel_update(c, rp->object, rp->typedata.text->entry_data);
4762 _edje_entry_imf_cursor_info_set(en);
4763 _edje_emit(rp->edje, "cursor,changed", rp->part->name);
4764 _edje_entry_real_part_configure(rp);
4768 _edje_entry_cursor_coord_set(Edje_Real_Part *rp, Edje_Cursor cur,
4769 Evas_Coord x, Evas_Coord y)
4771 Evas_Textblock_Cursor *c = _cursor_get(rp, cur);
4772 if (!c) return EINA_FALSE;
4773 return evas_textblock_cursor_char_coord_set(c, x, y);
4777 _edje_entry_cursor_is_format_get(Edje_Real_Part *rp, Edje_Cursor cur)
4779 Evas_Textblock_Cursor *c = _cursor_get(rp, cur);
4780 if (!c) return EINA_FALSE;
4781 if (evas_textblock_cursor_is_format(c)) return EINA_TRUE;
4786 _edje_entry_cursor_is_visible_format_get(Edje_Real_Part *rp, Edje_Cursor cur)
4788 Evas_Textblock_Cursor *c = _cursor_get(rp, cur);
4789 if (!c) return EINA_FALSE;
4790 return evas_textblock_cursor_format_is_visible_get(c);
4794 _edje_entry_cursor_content_get(Edje_Real_Part *rp, Edje_Cursor cur)
4796 static char *s = NULL;
4797 Evas_Textblock_Cursor *c = _cursor_get(rp, cur);
4799 if (!c) return NULL;
4806 s = evas_textblock_cursor_content_get(c);
4811 _edje_entry_cursor_pos_set(Edje_Real_Part *rp, Edje_Cursor cur, int pos)
4814 Evas_Textblock_Cursor *c = _cursor_get(rp, cur);
4816 if ((rp->type != EDJE_RP_TYPE_TEXT) ||
4817 (!rp->typedata.text)) return;
4818 en = rp->typedata.text->entry_data;
4821 /* Abort if cursor position didn't really change */
4822 if (evas_textblock_cursor_pos_get(c) == pos)
4825 _edje_entry_imf_context_reset(rp);
4826 evas_textblock_cursor_pos_set(c, pos);
4827 _sel_update(c, rp->object, rp->typedata.text->entry_data);
4829 _edje_emit(rp->edje, "cursor,changed", rp->part->name);
4830 // TIZEN ONLY(130129) : Currently, for freezing cursor movement.
4833 _edje_entry_imf_cursor_info_set(en);
4834 _edje_entry_real_part_configure(rp);
4840 _edje_entry_cursor_pos_get(Edje_Real_Part *rp, Edje_Cursor cur)
4842 Evas_Textblock_Cursor *c = _cursor_get(rp, cur);
4844 return evas_textblock_cursor_pos_get(c);
4848 _edje_entry_input_panel_layout_set(Edje_Real_Part *rp, Edje_Input_Panel_Layout layout)
4852 if ((rp->type != EDJE_RP_TYPE_TEXT) ||
4853 (!rp->typedata.text)) return;
4854 en = rp->typedata.text->entry_data;
4856 #ifdef HAVE_ECORE_IMF
4857 if (en->imf_context)
4858 ecore_imf_context_input_panel_layout_set(en->imf_context, layout);
4864 Edje_Input_Panel_Layout
4865 _edje_entry_input_panel_layout_get(Edje_Real_Part *rp)
4869 if ((rp->type != EDJE_RP_TYPE_TEXT) ||
4870 (!rp->typedata.text)) return EDJE_INPUT_PANEL_LAYOUT_INVALID;
4871 en = rp->typedata.text->entry_data;
4872 if (!en) return EDJE_INPUT_PANEL_LAYOUT_INVALID;
4873 #ifdef HAVE_ECORE_IMF
4874 if (en->imf_context)
4875 return ecore_imf_context_input_panel_layout_get(en->imf_context);
4878 return EDJE_INPUT_PANEL_LAYOUT_INVALID;
4882 _edje_entry_input_panel_layout_variation_set(Edje_Real_Part *rp, int variation)
4886 if ((rp->type != EDJE_RP_TYPE_TEXT) ||
4887 (!rp->typedata.text)) return;
4888 en = rp->typedata.text->entry_data;
4890 #ifdef HAVE_ECORE_IMF
4891 if (en->imf_context)
4892 ecore_imf_context_input_panel_layout_variation_set(en->imf_context, variation);
4899 _edje_entry_input_panel_layout_variation_get(Edje_Real_Part *rp)
4903 if ((rp->type != EDJE_RP_TYPE_TEXT) ||
4904 (!rp->typedata.text)) return 0;
4905 en = rp->typedata.text->entry_data;
4907 #ifdef HAVE_ECORE_IMF
4908 if (en->imf_context)
4909 return ecore_imf_context_input_panel_layout_variation_get(en->imf_context);
4916 _edje_entry_imf_context_reset(Edje_Real_Part *rp)
4920 if ((rp->type != EDJE_RP_TYPE_TEXT) ||
4921 (!rp->typedata.text)) return;
4922 en = rp->typedata.text->entry_data;
4924 #ifdef HAVE_ECORE_IMF
4925 if (en->imf_context)
4926 ecore_imf_context_reset(en->imf_context);
4927 if (en->commit_cancel)
4928 en->commit_cancel = EINA_FALSE;
4933 _edje_entry_imf_cursor_location_set(Entry *en)
4935 #ifdef HAVE_ECORE_IMF
4936 Evas_Coord cx, cy, cw, ch;
4937 if (!en || !en->rp || !en->imf_context) return;
4939 _edje_entry_cursor_geometry_get(en->rp, &cx, &cy, &cw, &ch);
4940 ecore_imf_context_cursor_location_set(en->imf_context, cx, cy, cw, ch);
4947 _edje_entry_imf_cursor_info_set(Entry *en)
4951 #ifdef HAVE_ECORE_IMF
4952 if (!en || !en->rp || !en->imf_context) return;
4954 if (en->have_selection)
4956 if (evas_textblock_cursor_compare(en->sel_start, en->sel_end) < 0)
4957 cursor_pos = evas_textblock_cursor_pos_get(en->sel_start);
4959 cursor_pos = evas_textblock_cursor_pos_get(en->sel_end);
4962 cursor_pos = evas_textblock_cursor_pos_get(en->cursor);
4964 ecore_imf_context_cursor_position_set(en->imf_context, cursor_pos);
4966 _edje_entry_imf_cursor_location_set(en);
4972 #ifdef HAVE_ECORE_IMF
4974 _edje_entry_imf_retrieve_surrounding_cb(void *data, Ecore_IMF_Context *ctx __UNUSED__, char **text, int *cursor_pos)
4977 Edje_Real_Part *rp = ed->focused_part;
4981 Eina_Strbuf *buf = NULL;
4983 if (!rp) return EINA_FALSE;
4984 if ((rp->type != EDJE_RP_TYPE_TEXT) ||
4985 (!rp->typedata.text)) return EINA_FALSE;
4987 en = rp->typedata.text->entry_data;
4988 if ((!en) || (rp->part->type != EDJE_PART_TYPE_TEXTBLOCK) ||
4989 (rp->part->entry_mode < EDJE_ENTRY_EDIT_MODE_SELECTABLE))
4994 str = _edje_entry_text_get(rp);
4997 plain_text = evas_textblock_text_markup_to_utf8(NULL, str);
5001 if (en->have_selection)
5003 buf = eina_strbuf_new();
5006 eina_strbuf_append_n(buf, plain_text, evas_textblock_cursor_pos_get(en->sel_start));
5008 eina_strbuf_append(buf, plain_text);
5010 *text = strdup(eina_strbuf_string_get(buf));
5011 eina_strbuf_free(buf);
5014 *text = strdup(plain_text);
5028 if (en->have_selection && en->sel_start)
5029 *cursor_pos = evas_textblock_cursor_pos_get(en->sel_start);
5030 else if (en->cursor)
5031 *cursor_pos = evas_textblock_cursor_pos_get(en->cursor);
5040 _edje_entry_imf_event_commit_cb(void *data, Ecore_IMF_Context *ctx __UNUSED__, void *event_info)
5043 Edje_Real_Part *rp = ed->focused_part;
5045 char *commit_str = event_info;
5049 if ((rp->type != EDJE_RP_TYPE_TEXT) ||
5050 (!rp->typedata.text)) return;
5052 en = rp->typedata.text->entry_data;
5053 if ((!en) || (rp->part->type != EDJE_PART_TYPE_TEXTBLOCK) ||
5054 (rp->part->entry_mode < EDJE_ENTRY_EDIT_MODE_SELECTABLE))
5057 if (en->have_selection)
5059 if (strcmp(commit_str, ""))
5061 /* delete selected characters */
5062 _range_del_emit(ed, en->cursor, rp->object, en);
5063 _sel_clear(en->cursor, rp->object, en);
5067 start_pos = evas_textblock_cursor_pos_get(en->cursor);
5069 /* delete preedit characters */
5073 // Skipping commit process when it is useless
5074 if (en->commit_cancel)
5076 en->commit_cancel = EINA_FALSE;
5080 if ((rp->part->entry_mode == EDJE_ENTRY_EDIT_MODE_PASSWORD) &&
5081 _edje_password_show_last)
5082 _edje_entry_hide_visible_password(en->rp);
5083 if ((rp->part->entry_mode == EDJE_ENTRY_EDIT_MODE_PASSWORD) &&
5084 _edje_password_show_last && (!en->preedit_start))
5086 _text_filter_format_prepend(en, en->cursor, "+ password=off");
5087 _text_filter_text_prepend(en, en->cursor, commit_str);
5088 _text_filter_format_prepend(en, en->cursor, "- password");
5092 ecore_timer_del(en->pw_timer);
5093 en->pw_timer = NULL;
5095 en->pw_timer = ecore_timer_add(TO_DOUBLE(_edje_password_show_last_timeout),
5096 _password_timer_cb, en);
5099 _text_filter_text_prepend(en, en->cursor, commit_str);
5102 _edje_entry_imf_cursor_info_set(en);
5103 _anchors_get(en->cursor, rp->object, en);
5104 // TIZEN ONLY - START
5105 if (en->cursor_handler_show)
5107 evas_object_hide(en->cursor_handler);
5108 en->cursor_handler_show = EINA_FALSE;
5111 _edje_emit(rp->edje, "entry,changed", rp->part->name);
5114 Edje_Entry_Change_Info *info = calloc(1, sizeof(*info));
5115 info->insert = EINA_TRUE;
5116 info->change.insert.pos = start_pos;
5117 info->change.insert.content = eina_stringshare_add(commit_str);
5118 info->change.insert.plain_length =
5119 eina_unicode_utf8_get_len(info->change.insert.content);
5120 _edje_emit_full(ed, "entry,changed,user", rp->part->name,
5121 info, _free_entry_change_info);
5122 _edje_emit(ed, "cursor,changed", rp->part->name);
5125 _edje_entry_imf_cursor_info_set(en);
5126 _edje_entry_real_part_configure(rp);
5130 _edje_entry_imf_event_preedit_changed_cb(void *data, Ecore_IMF_Context *ctx __UNUSED__, void *event_info __UNUSED__)
5133 Edje_Real_Part *rp = ed->focused_part;
5136 int preedit_start_pos, preedit_end_pos;
5137 char *preedit_string;
5138 char *preedit_tag_index;
5139 char *pretag = NULL;
5140 char *markup_txt = NULL;
5141 char *tagname[] = {NULL, "preedit", "preedit_sel", "preedit_sel",
5142 "preedit_sub1", "preedit_sub2", "preedit_sub3", "preedit_sub4"};
5144 size_t preedit_type_size = sizeof(tagname) / sizeof(tagname[0]);
5145 Eina_Bool preedit_end_state = EINA_FALSE;
5146 Eina_List *attrs = NULL, *l = NULL;
5147 Ecore_IMF_Preedit_Attr *attr;
5149 Eina_Strbuf *preedit_attr_str;
5153 if ((rp->type != EDJE_RP_TYPE_TEXT) ||
5154 (!rp->typedata.text)) return;
5156 en = rp->typedata.text->entry_data;
5157 if ((!en) || (rp->part->type != EDJE_PART_TYPE_TEXTBLOCK) ||
5158 (rp->part->entry_mode < EDJE_ENTRY_EDIT_MODE_SELECTABLE))
5161 if (!en->imf_context) return;
5162 // TIZEN ONLY - START
5163 if (en->cursor_handler_show)
5165 evas_object_hide(en->cursor_handler);
5166 en->cursor_handler_show = EINA_FALSE;
5170 ecore_imf_context_preedit_string_with_attributes_get(en->imf_context,
5172 &attrs, &cursor_pos);
5173 if (!preedit_string) return;
5175 if (!strcmp(preedit_string, ""))
5176 preedit_end_state = EINA_TRUE;
5178 if (en->have_selection && !preedit_end_state)
5180 /* delete selected characters */
5181 _range_del_emit(ed, en->cursor, rp->object, en);
5184 if (en->preedit_start && en->preedit_end)
5186 /* extract the tag string */
5187 char *str = evas_textblock_cursor_range_text_get(en->preedit_start, en->preedit_end, EVAS_TEXTBLOCK_TEXT_MARKUP);
5191 preedit_tag_index = strstr(str, "<preedit");
5193 if ((preedit_tag_index - str) > 0)
5195 pretag = calloc(1, sizeof(char)*(preedit_tag_index-str+1));
5196 if (preedit_tag_index)
5198 strncpy(pretag, str, preedit_tag_index-str);
5205 /* delete preedit characters */
5208 preedit_start_pos = evas_textblock_cursor_pos_get(en->cursor);
5210 /* restore previous tag */
5213 _text_filter_markup_prepend(en, en->cursor, pretag);
5217 /* insert preedit character(s) */
5218 if (strlen(preedit_string) > 0)
5220 buf = eina_strbuf_new();
5223 EINA_LIST_FOREACH(attrs, l, attr)
5225 if (attr->preedit_type <= preedit_type_size &&
5226 tagname[attr->preedit_type])
5228 preedit_attr_str = eina_strbuf_new();
5229 if (preedit_attr_str)
5231 eina_strbuf_append_n(preedit_attr_str, preedit_string + attr->start_index, attr->end_index - attr->start_index);
5232 markup_txt = evas_textblock_text_utf8_to_markup(NULL, eina_strbuf_string_get(preedit_attr_str));
5236 eina_strbuf_append_printf(buf, "<%s>%s</%s>", tagname[attr->preedit_type], markup_txt, tagname[attr->preedit_type]);
5239 eina_strbuf_free(preedit_attr_str);
5243 eina_strbuf_append(buf, preedit_string);
5248 eina_strbuf_append(buf, preedit_string);
5251 // For skipping useless commit
5252 if (!preedit_end_state)
5253 en->have_preedit = EINA_TRUE;
5255 if ((rp->part->entry_mode == EDJE_ENTRY_EDIT_MODE_PASSWORD) &&
5256 _edje_password_show_last)
5258 _edje_entry_hide_visible_password(en->rp);
5259 _text_filter_format_prepend(en, en->cursor, "+ password=off");
5260 _text_filter_markup_prepend(en, en->cursor, eina_strbuf_string_get(buf));
5261 _text_filter_format_prepend(en, en->cursor, "- password");
5264 ecore_timer_del(en->pw_timer);
5265 en->pw_timer = NULL;
5267 en->pw_timer = ecore_timer_add(TO_DOUBLE(_edje_password_show_last_timeout),
5268 _password_timer_cb, en);
5272 _text_filter_markup_prepend(en, en->cursor, eina_strbuf_string_get(buf));
5274 eina_strbuf_free(buf);
5277 if (!preedit_end_state)
5279 /* set preedit start cursor */
5280 if (!en->preedit_start)
5281 en->preedit_start = evas_object_textblock_cursor_new(rp->object);
5282 evas_textblock_cursor_copy(en->cursor, en->preedit_start);
5284 /* set preedit end cursor */
5285 if (!en->preedit_end)
5286 en->preedit_end = evas_object_textblock_cursor_new(rp->object);
5287 evas_textblock_cursor_copy(en->cursor, en->preedit_end);
5289 preedit_end_pos = evas_textblock_cursor_pos_get(en->cursor);
5291 for (i = 0; i < (preedit_end_pos - preedit_start_pos); i++)
5293 evas_textblock_cursor_char_prev(en->preedit_start);
5296 en->have_preedit = EINA_TRUE;
5298 /* set cursor position */
5299 evas_textblock_cursor_pos_set(en->cursor, preedit_start_pos + cursor_pos);
5302 _edje_entry_imf_cursor_info_set(en);
5303 _anchors_get(en->cursor, rp->object, en);
5304 _edje_emit(rp->edje, "preedit,changed", rp->part->name);
5305 _edje_emit(ed, "cursor,changed", rp->part->name);
5307 /* delete attribute list */
5310 EINA_LIST_FREE(attrs, attr) free(attr);
5313 free(preedit_string);
5317 _edje_entry_imf_event_delete_surrounding_cb(void *data, Ecore_IMF_Context *ctx __UNUSED__, void *event_info)
5320 Edje_Real_Part *rp = ed->focused_part;
5322 Ecore_IMF_Event_Delete_Surrounding *ev = event_info;
5323 Evas_Textblock_Cursor *del_start, *del_end;
5326 if ((!rp) || (!ev)) return;
5327 if ((rp->type != EDJE_RP_TYPE_TEXT) ||
5328 (!rp->typedata.text)) return;
5330 en = rp->typedata.text->entry_data;
5331 if ((!en) || (rp->part->type != EDJE_PART_TYPE_TEXTBLOCK) ||
5332 (rp->part->entry_mode < EDJE_ENTRY_EDIT_MODE_SELECTABLE))
5335 cursor_pos = evas_textblock_cursor_pos_get(en->cursor);
5337 del_start = evas_object_textblock_cursor_new(en->rp->object);
5338 evas_textblock_cursor_pos_set(del_start, cursor_pos + ev->offset);
5340 del_end = evas_object_textblock_cursor_new(en->rp->object);
5341 evas_textblock_cursor_pos_set(del_end, cursor_pos + ev->offset + ev->n_chars);
5343 evas_textblock_cursor_range_delete(del_start, del_end);
5345 evas_textblock_cursor_free(del_start);
5346 evas_textblock_cursor_free(del_end);
5351 ////////////////////////////////////// TIZEN ONLY(130129) : START //////////////////////////////////
5352 void _edje_entry_freeze(Edje_Real_Part *rp)
5356 if ((rp->type != EDJE_RP_TYPE_TEXT) ||
5357 (!rp->typedata.text)) return;
5359 en = rp->typedata.text->entry_data;
5362 en->freeze = EINA_TRUE;
5365 void _edje_entry_thaw(Edje_Real_Part *rp)
5369 if ((rp->type != EDJE_RP_TYPE_TEXT) ||
5370 (!rp->typedata.text)) return;
5372 en = rp->typedata.text->entry_data;
5375 en->freeze = EINA_FALSE;
5377 _edje_entry_imf_cursor_info_set(en);
5378 _edje_entry_real_part_configure(rp);
5380 /////////////////////////////////////////// TIZEN ONLY : END ////////////////////////////////////////
5382 /* vim:set ts=8 sw=3 sts=3 expandtab cino=>5n-2f0^-2{2(0W1st0 :*/