1 #include <Elementary.h>
2 #include <Elementary_Cursor.h>
4 #include "elm_widget_entry.h"
5 #include "elm_module_priv.h" // TIZEN ONLY
7 #ifdef HAVE_ELEMENTARY_X
13 EAPI const char ELM_ENTRY_SMART_NAME[] = "elm_entry";
15 /* Maximum chunk size to be inserted to the entry at once
16 * FIXME: This size is arbitrary, should probably choose a better size.
17 * Possibly also find a way to set it to a low value for weak computers,
18 * and to a big value for better computers. */
19 #define _CHUNK_SIZE 10000
21 static const char SIG_ABORTED[] = "aborted";
22 static const char SIG_ACTIVATED[] = "activated";
23 static const char SIG_ACCESS_CHANGED[] = "access,changed";
24 static const char SIG_ANCHOR_CLICKED[] = "anchor,clicked";
25 static const char SIG_ANCHOR_DOWN[] = "anchor,down";
26 static const char SIG_ANCHOR_HOVER_OPENED[] = "anchor,hover,opened";
27 static const char SIG_ANCHOR_IN[] = "anchor,in";
28 static const char SIG_ANCHOR_OUT[] = "anchor,out";
29 static const char SIG_ANCHOR_UP[] = "anchor,up";
30 static const char SIG_CHANGED[] = "changed";
31 static const char SIG_CHANGED_USER[] = "changed,user";
32 static const char SIG_CLICKED[] = "clicked";
33 static const char SIG_CLICKED_DOUBLE[] = "clicked,double";
34 static const char SIG_CLICKED_TRIPLE[] = "clicked,triple";
35 static const char SIG_CURSOR_CHANGED[] = "cursor,changed";
36 static const char SIG_CURSOR_CHANGED_MANUAL[] = "cursor,changed,manual";
37 static const char SIG_FOCUSED[] = "focused";
38 static const char SIG_LANG_CHANGED[] = "language,changed";
39 static const char SIG_LONGPRESSED[] = "longpressed";
40 static const char SIG_MAX_LENGTH[] = "maxlength,reached";
41 static const char SIG_PREEDIT_CHANGED[] = "preedit,changed";
42 static const char SIG_PRESS[] = "press";
43 static const char SIG_REDO_REQUEST[] = "redo,request";
44 static const char SIG_SELECTION_CHANGED[] = "selection,changed";
45 static const char SIG_SELECTION_CLEARED[] = "selection,cleared";
46 static const char SIG_SELECTION_COPY[] = "selection,copy";
47 static const char SIG_SELECTION_CUT[] = "selection,cut";
48 static const char SIG_SELECTION_PASTE[] = "selection,paste";
49 static const char SIG_SELECTION_START[] = "selection,start";
50 static const char SIG_TEXT_SET_DONE[] = "text,set,done";
51 static const char SIG_THEME_CHANGED[] = "theme,changed";
52 static const char SIG_UNDO_REQUEST[] = "undo,request";
53 static const char SIG_UNFOCUSED[] = "unfocused";
54 static const char SIG_REJECTED[] = "rejected";
55 static const Evas_Smart_Cb_Description _smart_callbacks[] = {
58 {SIG_ACCESS_CHANGED, ""},
59 {SIG_ANCHOR_CLICKED, ""},
60 {SIG_ANCHOR_DOWN, ""},
61 {SIG_ANCHOR_HOVER_OPENED, ""},
66 {SIG_CHANGED_USER, ""},
68 {SIG_CLICKED_DOUBLE, ""},
69 {SIG_CLICKED_TRIPLE, ""},
70 {SIG_CURSOR_CHANGED, ""},
71 {SIG_CURSOR_CHANGED_MANUAL, ""},
73 {SIG_LANG_CHANGED, ""},
74 {SIG_LONGPRESSED, ""},
76 {SIG_PREEDIT_CHANGED, ""},
78 {SIG_REDO_REQUEST, ""},
79 {SIG_SELECTION_CHANGED, ""},
80 {SIG_SELECTION_CLEARED, ""},
81 {SIG_SELECTION_COPY, ""},
82 {SIG_SELECTION_CUT, ""},
83 {SIG_SELECTION_PASTE, ""},
84 {SIG_SELECTION_START, ""},
85 {SIG_TEXT_SET_DONE, ""},
86 {SIG_THEME_CHANGED, ""},
87 {SIG_UNDO_REQUEST, ""},
92 static const Elm_Layout_Part_Alias_Description _content_aliases[] =
94 {"icon", "elm.swallow.icon"},
95 {"end", "elm.swallow.end"},
99 static const Evas_Smart_Interface *_smart_interfaces[] =
101 (Evas_Smart_Interface *)&ELM_SCROLLABLE_IFACE, NULL
104 EVAS_SMART_SUBCLASS_IFACE_NEW
105 (ELM_ENTRY_SMART_NAME, _elm_entry, Elm_Entry_Smart_Class,
106 Elm_Layout_Smart_Class, elm_layout_smart_class_get, _smart_callbacks,
109 static Eina_List *entries = NULL;
113 void (*obj_hook)(Evas_Object *obj);
114 void (*obj_unhook)(Evas_Object *obj);
115 void (*obj_longpress)(Evas_Object *obj);
117 void (*obj_hidemenu) (Evas_Object *obj);
118 void (*obj_mouseup) (Evas_Object *obj);
122 ////////////////////////// TIZEN ONLY - START
123 static void _hover_cancel_cb(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__);
124 static void _hover_selected_cb(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__);
125 static void _copy_cb(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__);
126 static void _cut_cb(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__);
127 static void _paste_cb(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__);
128 #ifndef ELM_FEATURE_WEARABLE
129 static void _menu_call(Evas_Object *obj);
131 static void _dnd_enter_cb(void *data, Evas_Object *obj);
132 static void _dnd_leave_cb(void *data, Evas_Object *obj);
133 static void _dnd_pos_cb(void *data, Evas_Object *obj, Evas_Coord x, Evas_Coord y, Elm_Xdnd_Action action);
136 _select_all(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
138 ELM_ENTRY_DATA_GET(data, sd);
140 if (!sd->sel_allow) return;
141 sd->sel_mode = EINA_TRUE;
143 if (edje_object_part_text_selection_get(sd->entry_edje, "elm.text") == NULL)
145 edje_object_part_text_select_none(sd->entry_edje, "elm.text");
146 edje_object_signal_emit(sd->entry_edje, "elm,state,select,on", "elm");
147 edje_object_part_text_select_all(sd->entry_edje, "elm.text");
151 edje_object_part_text_cursor_begin_set(sd->entry_edje, "elm.text",
152 EDJE_CURSOR_SELECTION_BEGIN);
153 edje_object_part_text_cursor_begin_set(sd->entry_edje, "elm.text",
154 EDJE_CURSOR_SELECTION_END);
155 edje_object_part_text_cursor_end_set(sd->entry_edje, "elm.text", EDJE_CURSOR_MAIN);
156 edje_object_part_text_select_extend(sd->entry_edje, "elm.text");
157 #ifndef ELM_FEATURE_WEARABLE
164 _select_word(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
166 ELM_ENTRY_DATA_GET(data, sd);
168 if (!sd->sel_allow) return;
169 sd->sel_mode = EINA_TRUE;
171 if (!_elm_config->desktop_entry)
174 edje_object_part_text_select_allow_set
175 (sd->entry_edje, "elm.text", EINA_TRUE);
177 edje_object_signal_emit(sd->entry_edje, "elm,state,select,on", "elm");
178 edje_object_part_text_select_word(sd->entry_edje, "elm.text");
181 #ifdef HAVE_ELEMENTARY_X
182 static Ecore_X_Window
185 Ecore_X_Atom x_atom_cbhm = ecore_x_atom_get("CBHM_XWIN");
186 Ecore_X_Window x_cbhm_win = 0;
187 unsigned char *buf = NULL;
189 int ret = ecore_x_window_prop_property_get(0, x_atom_cbhm, XA_WINDOW, 0, &buf, &num);
191 memcpy(&x_cbhm_win, buf, sizeof(Ecore_X_Window));
199 _cbhm_msg_send(Evas_Object *obj, char *msg)
201 #ifdef HAVE_ELEMENTARY_X
202 Ecore_X_Window x_cbhm_win = _cbhm_window_get();
203 Ecore_X_Atom x_atom_cbhm_msg = ecore_x_atom_get("CBHM_MSG");
204 Ecore_X_Window xwin = elm_win_xwindow_get(obj);
206 if (!x_cbhm_win || !x_atom_cbhm_msg)
209 XClientMessageEvent m;
210 memset(&m, 0, sizeof(m));
211 m.type = ClientMessage;
212 m.display = ecore_x_display_get();
214 m.message_type = x_atom_cbhm_msg;
216 snprintf(m.data.b, 20, "%s", msg);
218 XSendEvent(ecore_x_display_get(), x_cbhm_win, False, NoEventMask, (XEvent*)&m);
228 _xclient_msg_cb(void *data, int type __UNUSED__, void *event)
230 #ifdef HAVE_ELEMENTARY_X
231 Evas_Object *obj = (Evas_Object *)data;
232 ELM_ENTRY_DATA_GET(data, sd);
233 Ecore_X_Event_Client_Message *ev = event;
235 if (ev->message_type != ecore_x_atom_get("CBHM_MSG"))
236 return ECORE_CALLBACK_PASS_ON;
238 if (!strcmp("SET_OWNER", ev->data.b))
240 if (elm_object_focus_get(obj) == EINA_TRUE)
242 ecore_x_selection_secondary_set(elm_win_xwindow_get(data), NULL, 0);
244 if (sd->cnp_mode != ELM_CNP_MODE_MARKUP)
245 _cbhm_msg_send(data, "show0");
247 _cbhm_msg_send(data, "show1");
251 return ECORE_CALLBACK_PASS_ON;
255 _magnifier_hide(void *data)
257 ELM_ENTRY_DATA_GET(data, sd);
259 if (!sd->magnifier_showing) return;
260 evas_object_hide(sd->mgf_bg);
261 elm_object_scroll_freeze_pop(data);
262 sd->magnifier_showing = EINA_FALSE;
266 _magnifier_show(void *data)
268 ELM_ENTRY_DATA_GET(data, sd);
270 if (sd->magnifier_showing) return;
271 evas_object_show(sd->mgf_bg);
272 elm_object_scroll_freeze_push(data);
273 sd->magnifier_showing = EINA_TRUE;
277 _entry_createicon(void *data,
278 Evas_Object *parent, Evas_Coord *xoff, Evas_Coord *yoff)
283 Evas_Coord sel_x = 0, sel_y = 0, sel_h = 0, sel_w = 0, margin_w = 0, margin_h = 0;
284 ELM_ENTRY_DATA_GET(data, sd);
286 icon = evas_object_textblock_add(evas_object_evas_get(parent));
287 text = edje_object_part_text_selection_get(sd->entry_edje, "elm.text");
290 evas_object_color_get(data, &r, &g, &b, &a);
291 evas_object_color_set(icon, r, g, b, a);
294 Evas_Textblock_Style *tb_style =
295 (Evas_Textblock_Style *)evas_object_textblock_style_get(elm_entry_textblock_get(data));
296 evas_object_textblock_style_set(icon, tb_style);
297 evas_object_textblock_size_formatted_get(icon, &margin_w, &margin_h);
299 evas_object_textblock_text_markup_set(icon, text);
301 edje_object_part_text_selection_geometry_get
302 (sd->entry_edje, "elm.text", &sel_x, &sel_y, &sel_w, &sel_h);
304 evas_object_size_hint_weight_set(icon, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
305 evas_object_size_hint_align_set(icon, EVAS_HINT_FILL, EVAS_HINT_FILL);
306 evas_object_move(icon, sel_x, sel_y);
307 evas_object_resize(icon, sel_w + margin_w, sel_h + margin_h);
308 evas_object_show(icon);
310 evas_pointer_canvas_xy_get(evas_object_evas_get(data), &xm, &ym);
311 if (xoff) *xoff = xm - (sel_w / 2);
312 if (yoff) *yoff = ym - (sel_h / 2);
318 _magnifier_proxy_update(Evas_Object *obj, double scale)
320 ELM_ENTRY_DATA_GET(obj, sd);
322 Evas_Coord x, y, w, h;
324 Evas_Coord cx, cy, cw, ch;
325 Evas_Coord mh, ox, oy;
326 Evas_Coord ctnx = 0, ctny = 0;
328 double px, py, pw, ph;
330 evas_object_geometry_get(sd->mgf_bg, &bx, NULL, &bw, NULL);
331 edje_object_part_text_cursor_geometry_get(sd->entry_edje, "elm.text",
334 evas_object_geometry_get(obj, &x, &y, &w, &h);
338 sd->s_iface->content_pos_get(obj, &ox, &oy);
341 edje_object_part_geometry_get(sd->scr_edje, "elm.swallow.content",
342 &ctnx, &ctny, NULL, NULL);
345 evas_object_geometry_get(sd->mgf_proxy, NULL, NULL, NULL, &mh);
346 edje_object_part_geometry_get(sd->mgf_bg, "swallow", &swx, NULL, &sww, NULL);
347 /* px, py are the scaled offsets that indicates the start
348 position of the magnifier viewport area. */
349 px = -(cx * scale) + (cx + x + ctnx - bx) - swx - ctnx * scale;
350 if (cx + x + ctnx <= bx + swx)
352 //show cursor at first pos
353 px = -(cx * scale) - ctnx * scale;
355 else if (x + ctnx + cx + cw * scale >= bx + swx + sww)
357 //show cursor at last pos
359 const char *type = NULL;
360 Evas_Object *top = elm_widget_top_get(obj);
361 Evas_Coord tx = 0, tw = 0;
364 type = evas_object_type_get(top);
365 if (type && !strcmp(type, "elm_win"))
366 evas_object_geometry_get(top, &tx, NULL, &tw, NULL);
368 right_off = tx + tw - (bx + swx + sww);
369 px = px - (cw * scale + right_off);
371 py = -(cy * scale) + mh * 0.5 - ctny * scale;
374 evas_object_image_fill_set(sd->mgf_proxy, px, py, pw, ph);
378 _magnifier_move(void *data)
380 ELM_ENTRY_DATA_GET(data, sd);
382 Evas_Coord x, y, w, h;
383 Evas_Coord cx, cy, ch, ox = 0, oy = 0;
385 Evas_Coord sww, swh, adjh;
387 Evas_Coord ctnx = 0, ctny = 0;
391 const char *type = NULL;
393 edje_object_part_text_cursor_geometry_get(sd->entry_edje, "elm.text",
394 &cx, &cy, NULL, &ch);
397 evas_object_geometry_get(sd->scr_edje, &x, &y, &w, &h);
398 sd->s_iface->content_pos_get(data, &ox, &oy);
403 evas_object_geometry_get(data, &x, &y, &w, &h);
405 edje_object_part_geometry_get(sd->mgf_bg, "bg", NULL, NULL, &mw, &mh);
406 edje_object_part_geometry_get(sd->mgf_bg, "swallow", NULL, NULL, &sww, &swh);
409 edje_object_part_geometry_get(sd->scr_edje, "elm.swallow.content",
410 &ctnx, &ctny, NULL, NULL);
412 adjh = ch * sd->mgf_scale + mh - swh;
413 if (adjh < sd->mgf_height)
414 adjh = sd->mgf_height;
416 /* move to fully show magnifier */
417 if (cy + y - adjh < 0)
418 oy = adjh - (cy + y);
420 //adjusting scale and size
421 adj_scale = sd->mgf_scale;
422 if (cy + y - adjh + oy < 0)
424 Evas_Coord edj_content_h;
426 if (adjh < sd->mgf_height)
427 adjh = sd->mgf_height;
428 edj_content_h = adjh - bdh;
429 adj_scale = (double)edj_content_h / ch;
430 if (adj_scale > sd->mgf_scale)
431 adj_scale = sd->mgf_scale;
433 evas_object_resize(sd->mgf_bg, mw, adjh);
435 mx = cx + x - (mw / 2) + ctnx;
436 my = cy + y - adjh + oy + ctny;
437 evas_object_move(sd->mgf_bg, mx, my);
439 // keep magnifier inside window
440 top = elm_widget_top_get(data);
443 type = evas_object_type_get(top);
444 if (type && !strcmp(type, "elm_win"))
446 Evas_Coord wx, wy, wh, ww;
447 evas_object_geometry_get(top, &wx, &wy, &ww, &wh);
449 evas_object_move(sd->mgf_bg, wx, my);
450 else if (mx + mw > wx + ww)
451 evas_object_move(sd->mgf_bg, wx + ww - mw, my);
455 _magnifier_proxy_update(data, adj_scale);
459 _magnifier_create(void *data)
461 ELM_ENTRY_DATA_GET(data, sd);
463 Evas_Coord x, y, w, h, mw, mh;
465 const char* key_data;
468 if (sd->mgf_proxy) evas_object_del(sd->mgf_proxy);
469 if (sd->mgf_bg) evas_object_del(sd->mgf_bg);
472 evas_object_geometry_get(sd->scr_edje, &x, &y, &w, &h);
474 evas_object_geometry_get(data, &x, &y, &w, &h);
476 if ((w <= 0) || (h <= 0)) return;
478 sd->mgf_bg = edje_object_add(evas_object_evas_get(data));
480 _elm_theme_object_set(data, sd->mgf_bg, "entry", "magnifier",
483 e = evas_object_evas_get(data);
485 key_data = edje_object_data_get(sd->mgf_bg, "height");
486 if (key_data) sd->mgf_height = atoi(key_data);
487 key_data = edje_object_data_get(sd->mgf_bg, "scale");
492 if (lc && lc->decimal_point && strcmp(lc->decimal_point, "."))
495 strncpy(local, key_data, sizeof(local));
497 /* change '.' to local decimal point (ex: ',') */
503 local[j] = lc->decimal_point[0];
508 sd->mgf_scale = atof(local);
511 sd->mgf_scale = atof(key_data);
516 key_data = edje_object_data_get(sd->mgf_bg, "arrow");
518 sd->mgf_arrow_height = atoi(key_data);
520 sd->mgf_arrow_height = 0;
522 elm_scale = elm_config_scale_get();
523 sd->mgf_height = (int)((float)sd->mgf_height * elm_scale);
525 sd->mgf_proxy = evas_object_image_add(e);
526 edje_object_part_swallow(sd->mgf_bg, "swallow", sd->mgf_proxy);
527 evas_object_image_source_set(sd->mgf_proxy, data);
529 /* Tizen Only: Since Proxy has the texture size limitation problem,
530 we set a key value for evas works in some hackish way to avoid this
531 problem. This hackish code should be removed once evas supports
532 a mechanism like a virtual texture. */
533 evas_object_data_set(sd->mgf_proxy, "tizenonly", (void *) 1);
535 // REDWOOD ONLY (20140617): support setting mgf color from app
536 if (sd->mgf_bg_color_set)
538 Edje_Message_Int_Set *msg;
539 msg = malloc(sizeof(Edje_Message_Int_Set) + 3 * sizeof(int));
542 msg->val[0] = sd->mgf_r;
543 msg->val[1] = sd->mgf_g;
544 msg->val[2] = sd->mgf_b;
545 msg->val[3] = sd->mgf_a;
546 edje_object_message_send(sd->mgf_bg, EDJE_MESSAGE_INT_SET, 1, msg);
551 mw = (Evas_Coord)((float)w * sd->mgf_scale);
552 mh = (Evas_Coord)((float)h * sd->mgf_scale);
553 if ((mw <= 0) || (mh <= 0))
556 evas_object_layer_set(sd->mgf_bg, EVAS_LAYER_MAX);
557 evas_object_layer_set(sd->mgf_proxy, EVAS_LAYER_MAX);
561 _signal_long_pressed(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__)
563 ELM_ENTRY_DATA_GET(data, sd);
564 if (sd->disabled) return;
566 sd->long_pressed = EINA_TRUE;
567 sd->hit_selection = (sd->have_selection) ? /* For text DND */
568 edje_object_part_text_xy_in_selection_get(sd->entry_edje,
569 "elm.text", sd->downx, sd->downy) : EINA_FALSE;
570 if (!sd->hit_selection)
571 sd->drag_started = EINA_FALSE;
572 else if (sd->drag_enabled)
575 edje_object_part_text_selection_get(sd->entry_edje, "elm.text");
577 if ((sel) && (sel[0]))
579 sd->drag_started = EINA_TRUE;
580 elm_drag_start(data, ELM_SEL_FORMAT_TEXT,
582 ELM_XDND_ACTION_COPY,
583 _entry_createicon, data,
584 NULL /*Elm_Drag_Pos dragpos*/,
585 NULL /*void *dragdata*/,
586 NULL /*Elm_Drag_Accept acceptcb*/,
587 NULL /*void *acceptdata*/,
588 NULL /*Elm_Drag_Done dragdone*/,
589 NULL /*void *donecbdata*/);
590 edje_object_part_text_cursor_handler_disabled_set
591 (sd->entry_edje, "elm.text", EINA_TRUE);
592 _hover_cancel_cb(data, NULL, NULL);
595 if (!sd->drag_started)
597 _hover_cancel_cb(data, NULL, NULL);
598 if (sd->magnifier_enabled)
600 if ((sd->api) && (sd->api->obj_hidemenu))
601 sd->api->obj_hidemenu(data);
604 _magnifier_create(data);
605 _magnifier_move(data);
606 _magnifier_show(data);
613 _signal_handler_move_start_cb(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__)
615 ELM_ENTRY_DATA_GET(data, sd);
617 elm_object_scroll_freeze_push(data);
619 if ((sd->api) && (sd->api->obj_hidemenu))
620 sd->api->obj_hidemenu(data);
622 if (sd->magnifier_enabled)
626 _magnifier_create(data);
627 _magnifier_move(data);
628 _magnifier_show(data);
634 _signal_handler_move_end_cb(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__)
636 elm_object_scroll_freeze_pop(data);
638 _magnifier_hide(data);
639 #ifndef ELM_FEATURE_WEARABLE
645 _signal_handler_moving_cb(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__)
647 ELM_ENTRY_DATA_GET(data, sd);
649 if ((sd->magnifier_enabled) && (sd->has_text))
651 _magnifier_move(data);
652 _magnifier_show(data);
657 _signal_handler_click_cb(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__)
659 _magnifier_hide(data);
660 #ifndef ELM_FEATURE_WEARABLE
663 elm_widget_scroll_freeze_pop(data);
666 static Evas_Coord_Rectangle
667 _intersection_region_get(Evas_Coord_Rectangle rect1, Evas_Coord_Rectangle rect2)
669 Evas_Coord_Rectangle ret_rect;
670 Evas_Coord_Point l1, l2, r1, r2, p1, p2;
674 r1.x = rect1.x + rect1.w;
675 r1.y = rect1.y + rect1.h;
679 r2.x = rect2.x + rect2.w;
680 r2.y = rect2.y + rect2.h;
682 p1.x = (l1.x > l2.x) ? l1.x : l2.x;
683 p1.y = (l1.y > l2.y) ? l1.y : l2.y;
684 p2.x = (r1.x < r2.x) ? r1.x : r2.x;
685 p2.y = (r1.y < r2.y) ? r1.y : r2.y;
689 ret_rect.w = (p2.x > p1.x) ? p2.x - p1.x : -1;
690 ret_rect.h = (p2.y > p1.y) ? p2.y - p1.y : -1;
695 static Evas_Coord_Rectangle
696 _viewport_region_get(Evas_Object *data)
698 Evas_Object *parent_obj;
699 Evas_Coord_Rectangle geometry, ret_rect;
700 geometry.x = geometry.y = geometry.w = geometry.h = -1;
703 ELM_ENTRY_DATA_GET(data, sd);
704 if (!data || !strlen(elm_widget_type_get(data))) return geometry;
708 sd->s_iface->content_viewport_size_get(data, &geometry.w, &geometry.h);
709 sd->s_iface->content_viewport_pos_get(data, &geometry.x, &geometry.y);
713 evas_object_geometry_get(data,
723 while ((parent_obj = elm_widget_parent_get(parent_obj)))
725 if (!strcmp(elm_widget_type_get(parent_obj), "elm_scroller") ||
726 !strcmp(elm_widget_type_get(parent_obj), "elm_genlist"))
728 evas_object_geometry_get(parent_obj, &geometry.x, &geometry.y, &geometry.w, &geometry.h);
729 if ((ret_rect.w == -1) && (ret_rect.h == -1)) ret_rect = geometry;
730 ret_rect = _intersection_region_get(geometry, ret_rect);
737 static Evas_Coord_Rectangle
738 _layout_region_get(Evas_Object *data)
740 Evas_Coord_Rectangle geometry;
741 geometry.x = geometry.y = geometry.w = geometry.h = -1;
743 if (!data || !strlen(elm_widget_type_get(data))) return geometry;
745 Evas_Object *child_obj = data;
746 Evas_Object *parent_obj;
748 while ((parent_obj = elm_widget_parent_get(child_obj)))
750 if (!strcmp(elm_widget_type_get(parent_obj), "elm_conformant"))
752 evas_object_geometry_get(child_obj, &geometry.x, &geometry.y, &geometry.w, &geometry.h);
755 child_obj = parent_obj;
762 _region_recalc_job(void *data)
764 ELM_ENTRY_DATA_GET(data, sd);
765 Evas_Coord_Rectangle ret_rect;
767 sd->region_recalc_job = NULL;
769 if (!_elm_config->desktop_entry)
771 ret_rect = _viewport_region_get(data);
772 edje_object_part_text_viewport_region_set(sd->entry_edje, "elm.text",
773 ret_rect.x, ret_rect.y,
774 ret_rect.w, ret_rect.h);
775 ret_rect = _layout_region_get(data);
776 edje_object_part_text_layout_region_set(sd->entry_edje, "elm.text",
777 ret_rect.x, ret_rect.y,
778 ret_rect.w, ret_rect.h);
783 _region_get_job(void *data)
785 ELM_ENTRY_DATA_GET(data, sd);
787 sd->region_get_job = NULL;
789 if (!_elm_config->desktop_entry)
791 if (sd->region_recalc_job) ecore_job_del(sd->region_recalc_job);
792 sd->region_recalc_job = ecore_job_add(_region_recalc_job, data);
794 //evas_smart_objects_calculate(evas_object_evas_get(data)); //remove: too many calculation
799 _signal_selection_end(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__)
801 ELM_ENTRY_DATA_GET(data, sd);
802 if (sd->disabled) return;
804 if (sd->magnifier_enabled)
805 _magnifier_hide(data);
806 #ifndef ELM_FEATURE_WEARABLE
812 _signal_magnifier_changed(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__)
814 ELM_ENTRY_DATA_GET(data, sd);
815 Evas_Coord cx, cy, cw, ch;
817 edje_object_part_text_cursor_geometry_get(sd->entry_edje, "elm.text", &cx, &cy, &cw, &ch);
818 if (!sd->deferred_recalc_job)
819 elm_widget_show_region_set(data, cx, cy, cw, ch, EINA_FALSE);
822 sd->deferred_cur = EINA_TRUE;
831 _elm_entry_key_down_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
833 Evas_Event_Key_Down *ev = event_info;
834 if (!ev->keyname) return;
836 ELM_ENTRY_DATA_GET(data, sd);
837 if ((sd->api) && (sd->api->obj_hidemenu))
838 sd->api->obj_hidemenu(data);
842 _keep_selection(void *data __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
844 ELM_ENTRY_DATA_GET(obj, sd);
846 sd->start_sel_pos = edje_object_part_text_cursor_pos_get(sd->entry_edje, "elm.text",
847 EDJE_CURSOR_SELECTION_BEGIN);
848 sd->end_sel_pos = edje_object_part_text_cursor_pos_get(sd->entry_edje, "elm.text",
849 EDJE_CURSOR_SELECTION_END);
853 _paste_translation(void *data, Evas_Object *obj, void *event_info)
855 ELM_ENTRY_DATA_GET(obj, sd);
857 elm_entry_cursor_pos_set(obj, sd->start_sel_pos);
858 elm_entry_cursor_selection_begin(obj);
859 elm_entry_cursor_pos_set(obj, sd->end_sel_pos);
860 elm_entry_cursor_selection_end(obj);
862 _elm_entry_entry_paste(obj, data);
863 if ((data) && (event_info))
864 _elm_entry_entry_paste(obj, " ");
866 _elm_entry_entry_paste(obj, event_info);
870 _is_selected_all(void *data, Evas_Object *obj, void *event_info __UNUSED__)
872 if ((!data) || (!obj)) return;
873 ELM_ENTRY_DATA_GET(obj, sd);
875 Eina_Bool *ret = (Eina_Bool *)data;
877 pos = edje_object_part_text_cursor_pos_get(sd->entry_edje, "elm.text",
878 EDJE_CURSOR_SELECTION_BEGIN);
879 edje_object_part_text_cursor_pos_set(sd->entry_edje, "elm.text",
880 EDJE_CURSOR_USER, pos);
881 if (edje_object_part_text_cursor_prev(sd->entry_edje, "elm.text", EDJE_CURSOR_USER))
888 pos = edje_object_part_text_cursor_pos_get(sd->entry_edje, "elm.text",
889 EDJE_CURSOR_SELECTION_END);
890 edje_object_part_text_cursor_pos_set(sd->entry_edje, "elm.text",
891 EDJE_CURSOR_USER, pos);
892 if (edje_object_part_text_cursor_next(sd->entry_edje, "elm.text", EDJE_CURSOR_USER))
901 void elm_entry_extension_module_data_get(Evas_Object *obj, Elm_Entry_Extension_data *ext_mod)
903 ELM_ENTRY_DATA_GET(obj, sd);
905 ext_mod->cancel = _hover_cancel_cb;
906 ext_mod->copy = _copy_cb;
907 ext_mod->cut = _cut_cb;
908 ext_mod->paste = _paste_cb;
909 ext_mod->select = _select_word;
910 ext_mod->selectall = _select_all;
911 ext_mod->ent = sd->entry_edje;
912 ext_mod->items = sd->items;
913 ext_mod->editable = sd->editable;
914 ext_mod->have_selection = sd->have_selection;
915 ext_mod->password = sd->password;
916 ext_mod->selmode = sd->sel_mode;
917 ext_mod->context_menu = sd->context_menu;
918 ext_mod->cnp_mode = sd->cnp_mode;
919 ext_mod->viewport_rect = _viewport_region_get(obj);
920 ext_mod->keep_selection = _keep_selection;
921 ext_mod->paste_translation = _paste_translation;
922 ext_mod->is_selected_all = _is_selected_all;
925 #ifdef HAVE_ELEMENTARY_X
926 /* Example of env vars:
927 * ILLUME_KBD="0, 0, 800, 301"
928 * ILLUME_IND="0, 0, 800, 32"
929 * ILLUME_STK="0, 568, 800, 32"
932 _sip_part_geometry_get_from_env(const char *part,
938 const char delimiters[] = " ,;";
939 char *env_val, *token;
943 if (!(env_val = getenv(part))) return EINA_FALSE;
945 /* strtok would modify env var if not copied to a buffer */
946 strncpy(buf, env_val, sizeof(buf));
947 buf[PATH_MAX - 1] = '\0';
949 token = strtok(buf, delimiters);
950 if (!token) return EINA_FALSE;
953 token = strtok(NULL, delimiters);
954 if (!token) return EINA_FALSE;
957 token = strtok(NULL, delimiters);
958 if (!token) return EINA_FALSE;
961 token = strtok(NULL, delimiters);
962 if (!token) return EINA_FALSE;
973 _sip_geometry_get(Evas_Object *obj)
975 Ecore_X_Window zone = 0;
978 Eina_Rectangle unirect, srect, vrect, crect;
979 Evas_Coord tx, ty, tw, th;
980 Evas_Coord ww = 0, wh = 0;
982 ELM_ENTRY_DATA_GET(obj, sd);
984 unirect.x = unirect.y = unirect.w = unirect.h = -1;
985 vrect.x = vrect.y = vrect.w = vrect.h = -1;
986 srect.x = srect.y = srect.w = srect.h = -1;
987 crect.x = crect.y = crect.w = crect.h = -1;
988 top = elm_widget_top_get(obj);
989 xwin = elm_win_xwindow_get(top);
992 zone = ecore_x_e_illume_zone_get(xwin);
995 if ((!_sip_part_geometry_get_from_env
996 ("ILLUME_KBD", &vrect.x, &vrect.y, &vrect.w, &vrect.h)) && (xwin))
998 if (!ecore_x_e_illume_keyboard_geometry_get
999 (xwin, &vrect.x, &vrect.y, &vrect.w, &vrect.h))
1001 if (!ecore_x_e_illume_keyboard_geometry_get
1002 (zone, &vrect.x, &vrect.y, &vrect.w, &vrect.h))
1003 vrect.x = vrect.y = vrect.w = vrect.h = 0;
1008 if ((!_sip_part_geometry_get_from_env
1009 ("ILLUME_STK", &srect.x, &srect.y, &srect.w, &srect.h)) && (xwin))
1011 if (!ecore_x_e_illume_softkey_geometry_get
1012 (zone, &srect.x, &srect.y, &srect.w, &srect.h))
1013 srect.x = srect.y = srect.w = srect.h = 0;
1017 if ((!_sip_part_geometry_get_from_env
1018 ("ILLUME_CB", &crect.x, &crect.y, &crect.w, &crect.h)) && (xwin))
1020 if (!ecore_x_e_illume_clipboard_geometry_get
1021 (zone, &crect.x, &crect.y, &crect.w, &crect.h))
1022 crect.x = crect.y = crect.w = crect.h = 0;
1025 if (!eina_rectangle_is_empty(&vrect))
1027 unirect.x = vrect.x;
1028 unirect.y = vrect.y;
1029 unirect.w = vrect.w;
1030 unirect.h = vrect.h;
1032 if (!eina_rectangle_is_empty(&srect))
1034 if (eina_rectangle_is_empty(&unirect))
1036 unirect.x = srect.x;
1037 unirect.y = srect.y;
1038 unirect.w = srect.w;
1039 unirect.h = srect.h;
1043 eina_rectangle_union(&unirect, &srect);
1046 if (!eina_rectangle_is_empty(&crect))
1048 if (eina_rectangle_is_empty(&unirect))
1050 unirect.x = crect.x;
1051 unirect.y = crect.y;
1052 unirect.w = crect.w;
1053 unirect.h = crect.h;
1057 eina_rectangle_union(&unirect, &crect);
1061 tx = ty = tw = th = -1;
1062 evas_object_geometry_get(top, &tx, &ty, &tw, &th);
1064 ecore_x_window_geometry_get(xwin, NULL, NULL, &ww, &wh);
1065 if (eina_rectangle_is_empty(&unirect))
1067 edje_object_part_text_layout_region_set(sd->entry_edje, "elm.text", tx, ty, tw, th);
1071 Evas_Coord lx, ly, lw, lh;
1077 lh = unirect.y - ly;
1082 ly = ty > unirect.y + unirect.h ? ty : unirect.y + unirect.h;
1086 if ((lw > ww) && (ww > 0)) lw = ww;
1087 if ((lh > wh) && (wh > 0)) lh = wh;
1088 edje_object_part_text_layout_region_set(sd->entry_edje, "elm.text", lx, ly, lw, lh);
1093 _on_prop_change(void *data,
1094 int type __UNUSED__,
1095 void *event __UNUSED__)
1097 Ecore_X_Event_Window_Property *ev = event;
1099 if ((ev->atom == ECORE_X_ATOM_E_ILLUME_ZONE) ||
1100 (ev->atom == ECORE_X_ATOM_E_ILLUME_CLIPBOARD_STATE) ||
1101 (ev->atom == ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_STATE) ||
1102 (ev->atom == ECORE_X_ATOM_E_ILLUME_SOFTKEY_GEOMETRY) ||
1103 (ev->atom == ECORE_X_ATOM_E_ILLUME_KEYBOARD_GEOMETRY) ||
1104 (ev->atom == ECORE_X_ATOM_E_ILLUME_CLIPBOARD_GEOMETRY))
1106 if (elm_widget_focus_get(data))
1107 _sip_geometry_get(data);
1110 return ECORE_CALLBACK_PASS_ON;
1113 ////////////////////////// TIZEN ONLY - END
1116 _module_find(Evas_Object *obj __UNUSED__)
1118 static Elm_Module *m = NULL;
1120 if (m) goto ok; // already found - just use
1121 if (!(m = _elm_module_find_as("entry/api"))) return NULL;
1123 m->api = malloc(sizeof(Mod_Api));
1124 if (!m->api) return NULL;
1126 ((Mod_Api *)(m->api))->obj_hook = // called on creation
1127 _elm_module_symbol_get(m, "obj_hook");
1128 ((Mod_Api *)(m->api))->obj_unhook = // called on deletion
1129 _elm_module_symbol_get(m, "obj_unhook");
1130 ((Mod_Api *)(m->api))->obj_longpress = // called on long press menu
1131 _elm_module_symbol_get(m, "obj_longpress");
1133 ((Mod_Api *)(m->api))->obj_hidemenu = // called on hide menu
1134 _elm_module_symbol_get(m, "obj_hidemenu");
1135 ((Mod_Api *)(m->api))->obj_mouseup = // called on mouseup
1136 _elm_module_symbol_get(m, "obj_mouseup");
1138 ok: // ok - return api
1143 _file_load(const char *file)
1149 f = eina_file_open(file, EINA_FALSE);
1150 if (!f) return NULL;
1152 tmp = eina_file_map_all(f, EINA_FILE_SEQUENTIAL);
1153 if (!tmp) goto on_error;
1155 text = malloc(eina_file_size_get(f) + 1);
1156 if (!text) goto on_error;
1158 memcpy(text, tmp, eina_file_size_get(f));
1159 text[eina_file_size_get(f)] = 0;
1161 if (eina_file_map_faulted(f, tmp))
1168 if (tmp) eina_file_map_free(f, tmp);
1175 _plain_load(const char *file)
1179 text = _file_load(file);
1184 text2 = elm_entry_utf8_to_markup(text);
1193 _load_do(Evas_Object *obj)
1197 ELM_ENTRY_DATA_GET(obj, sd);
1201 elm_object_text_set(obj, "");
1207 case ELM_TEXT_FORMAT_PLAIN_UTF8:
1208 text = _plain_load(sd->file);
1211 case ELM_TEXT_FORMAT_MARKUP_UTF8:
1212 text = _file_load(sd->file);
1222 elm_object_text_set(obj, text);
1229 elm_object_text_set(obj, "");
1236 _utf8_markup_save(const char *file,
1241 if ((!text) || (!text[0]))
1243 ecore_file_unlink(file);
1248 f = fopen(file, "wb");
1251 // FIXME: report a write error
1255 fputs(text, f); // FIXME: catch error
1260 _utf8_plain_save(const char *file,
1265 text2 = elm_entry_markup_to_utf8(text);
1269 _utf8_markup_save(file, text2);
1274 _save_do(Evas_Object *obj)
1276 ELM_ENTRY_DATA_GET(obj, sd);
1278 if (!sd->file) return;
1281 case ELM_TEXT_FORMAT_PLAIN_UTF8:
1282 _utf8_plain_save(sd->file, elm_object_text_get(obj));
1285 case ELM_TEXT_FORMAT_MARKUP_UTF8:
1286 _utf8_markup_save(sd->file, elm_object_text_get(obj));
1295 _delay_write(void *data)
1297 ELM_ENTRY_DATA_GET(data, sd);
1300 sd->delay_write = NULL;
1302 return ECORE_CALLBACK_CANCEL;
1306 _elm_entry_guide_update(Evas_Object *obj,
1309 ELM_ENTRY_DATA_GET(obj, sd);
1311 if ((has_text) && (!sd->has_text))
1312 edje_object_signal_emit(sd->entry_edje, "elm,guide,disabled", "elm");
1313 else if ((!has_text) && (sd->has_text))
1314 edje_object_signal_emit(sd->entry_edje, "elm,guide,enabled", "elm");
1316 sd->has_text = has_text;
1319 static Elm_Entry_Markup_Filter *
1320 _filter_new(Elm_Entry_Filter_Cb func,
1323 Elm_Entry_Markup_Filter *tf = ELM_NEW(Elm_Entry_Markup_Filter);
1325 if (!tf) return NULL;
1328 tf->orig_data = data;
1329 if (func == elm_entry_filter_limit_size)
1331 Elm_Entry_Filter_Limit_Size *lim = data, *lim2;
1340 lim2 = malloc(sizeof(Elm_Entry_Filter_Limit_Size));
1347 memcpy(lim2, lim, sizeof(Elm_Entry_Filter_Limit_Size));
1350 else if (func == elm_entry_filter_accept_set)
1352 Elm_Entry_Filter_Accept_Set *as = data, *as2;
1360 as2 = malloc(sizeof(Elm_Entry_Filter_Accept_Set));
1368 as2->accepted = eina_stringshare_add(as->accepted);
1370 as2->accepted = NULL;
1372 as2->rejected = eina_stringshare_add(as->rejected);
1374 as2->rejected = NULL;
1383 _filter_free(Elm_Entry_Markup_Filter *tf)
1385 if (tf->func == elm_entry_filter_limit_size)
1387 Elm_Entry_Filter_Limit_Size *lim = tf->data;
1391 else if (tf->func == elm_entry_filter_accept_set)
1393 Elm_Entry_Filter_Accept_Set *as = tf->data;
1397 if (as->accepted) eina_stringshare_del(as->accepted);
1398 if (as->rejected) eina_stringshare_del(as->rejected);
1407 _mirrored_set(Evas_Object *obj,
1410 ELM_ENTRY_DATA_GET(obj, sd);
1412 edje_object_mirrored_set(sd->entry_edje, rtl);
1414 if (sd->anchor_hover.hover)
1415 elm_widget_mirrored_set(sd->anchor_hover.hover, rtl);
1419 _elm_entry_theme_group_get(Evas_Object *obj)
1421 ELM_ENTRY_DATA_GET(obj, sd);
1425 if (sd->password) return "base-password";
1428 if (sd->single_line) return "base-single";
1431 switch (sd->line_wrap)
1434 return "base-charwrap";
1439 case ELM_WRAP_MIXED:
1440 return "base-mixedwrap";
1444 return "base-nowrap";
1451 if (sd->password) return "base-password";
1454 if (sd->single_line) return "base-single-noedit";
1457 switch (sd->line_wrap)
1460 return "base-noedit-charwrap";
1463 return "base-noedit";
1465 case ELM_WRAP_MIXED:
1466 return "base-noedit-mixedwrap";
1470 return "base-nowrap-noedit";
1477 #ifdef HAVE_ELEMENTARY_X
1479 _drag_drop_cb(void *data __UNUSED__,
1481 Elm_Selection_Data *drop)
1485 ELM_ENTRY_DATA_GET(obj, sd);
1487 edje_object_part_text_cursor_copy
1488 (sd->entry_edje, "elm.text", EDJE_CURSOR_MAIN, /*->*/ EDJE_CURSOR_USER);
1489 rv = edje_object_part_text_cursor_coord_set
1490 (sd->entry_edje, "elm.text", EDJE_CURSOR_MAIN, drop->x, drop->y);
1492 if (!rv) WRN("Warning: Failed to position cursor: paste anyway");
1494 elm_entry_entry_insert(obj, drop->data);
1495 edje_object_part_text_cursor_copy
1496 (sd->entry_edje, "elm.text", EDJE_CURSOR_USER, /*->*/ EDJE_CURSOR_MAIN);
1501 static Elm_Sel_Format
1502 _get_drop_format(Evas_Object *obj)
1504 ELM_ENTRY_DATA_GET(obj, sd);
1506 if ((sd->editable) && (!sd->single_line) && (!sd->password) && (!sd->disabled))
1507 return ELM_SEL_FORMAT_MARKUP | ELM_SEL_FORMAT_IMAGE;
1508 return ELM_SEL_FORMAT_MARKUP;
1512 /* we can't reuse layout's here, because it's on entry_edje only */
1514 _elm_entry_smart_disable(Evas_Object *obj)
1516 ELM_ENTRY_DATA_GET(obj, sd);
1518 #ifdef HAVE_ELEMENTARY_X
1519 elm_drop_target_del(obj, sd->drop_format,
1523 _drag_drop_cb, NULL);
1524 sd->drop_added = EINA_FALSE;
1526 if (elm_object_disabled_get(obj))
1529 edje_object_part_text_select_disabled_set(sd->entry_edje, "elm.text", EINA_TRUE);
1530 edje_object_signal_emit(sd->entry_edje, "elm,state,disabled", "elm");
1533 edje_object_signal_emit(sd->scr_edje, "elm,state,disabled", "elm");
1534 sd->s_iface->freeze_set(obj, EINA_TRUE);
1536 sd->disabled = EINA_TRUE;
1541 edje_object_part_text_select_disabled_set(sd->entry_edje, "elm.text", EINA_FALSE);
1542 edje_object_signal_emit(sd->entry_edje, "elm,state,enabled", "elm");
1545 edje_object_signal_emit(sd->scr_edje, "elm,state,enabled", "elm");
1546 sd->s_iface->freeze_set(obj, EINA_FALSE);
1548 sd->disabled = EINA_FALSE;
1549 #ifdef HAVE_ELEMENTARY_X
1550 if (sd->drop_enabled)
1552 sd->drop_format = _get_drop_format(obj);
1553 elm_drop_target_add(obj, sd->drop_format,
1557 _drag_drop_cb, NULL);
1558 sd->drop_added = EINA_TRUE;
1566 // TIZEN ONLY(130911)
1567 // When cursor geometry is changed by theme or tag, show region geometry needs to be updated.
1569 _cursor_geometry_update(Evas_Object *obj)
1571 Evas_Coord cx, cy, cw, ch, rx, ry, rw, rh;
1573 ELM_ENTRY_DATA_GET(obj, sd);
1574 Elm_Widget_Smart_Data *wsd = evas_object_smart_data_get(obj);
1576 edje_object_part_text_cursor_geometry_get
1577 (sd->entry_edje, "elm.text", &cx, &cy, &cw, &ch);
1578 elm_widget_show_region_get(obj, &rx, &ry, &rw, &rh);
1580 if (cw != rw && cw != 0)
1582 if (ch != rh && ch != 0)
1587 // TIZEN ONLY(131106): Add rectangle for processing mouse up event on paddings inside of entry.
1589 _event_rect_cursor_changed_signal_cb(void *data,
1590 Evas_Object *obj __UNUSED__,
1591 const char *emission __UNUSED__,
1592 const char *source __UNUSED__)
1594 ELM_ENTRY_DATA_GET(data, sd);
1596 edje_object_signal_callback_del
1597 (sd->entry_edje, "cursor,changed", "elm.text",
1598 _event_rect_cursor_changed_signal_cb);
1600 evas_object_smart_callback_call(data, SIG_CURSOR_CHANGED_MANUAL, NULL);
1604 _event_rect_mouse_up_cb(void *data,
1606 Evas_Object *obj __UNUSED__,
1609 Evas_Event_Mouse_Up *ev;
1611 Evas_Coord ox, oy, ow, oh;
1612 Evas_Coord tx, ty, tw, th;
1614 Evas_Coord ex, ey, ew, eh;
1615 Evas_Textblock_Cursor *tc;
1618 ELM_ENTRY_DATA_GET(data, sd);
1620 ev = (Evas_Event_Mouse_Up *)event_info;
1621 if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD)
1624 tb = elm_entry_textblock_get(data);
1625 evas_object_geometry_get(data, &ox, &oy, &ow, &oh);
1626 if ((ev->canvas.x <= ox) || (ev->canvas.x >= ox + ow) ||
1627 (ev->canvas.y <= oy) || (ev->canvas.y >= oy + oh))
1629 edje_object_part_geometry_get(sd->entry_edje, "elm.text", &ex, &ey, &ew, &eh);
1630 evas_object_geometry_get(tb, &tx, &ty, &tw, &th);
1632 cx = ev->canvas.x - tx;
1633 cy = ev->canvas.y - ty;
1634 if (cy >= eh) cy = eh - 1;
1635 if (cy < ey) cy = 0;
1636 if (cx >= ew) cx = ew - 1;
1639 tc = evas_object_textblock_cursor_new(tb);
1640 evas_textblock_cursor_char_coord_set(tc, cx, cy);
1641 pos = evas_textblock_cursor_pos_get(tc);
1643 if (pos != elm_entry_cursor_pos_get(data))
1645 edje_object_signal_callback_add
1646 (sd->entry_edje, "cursor,changed", "elm.text",
1647 _event_rect_cursor_changed_signal_cb, data);
1649 elm_entry_cursor_pos_set(data, pos);
1650 evas_textblock_cursor_free(tc);
1652 elm_entry_select_none(data);
1653 evas_object_smart_callback_call(data, SIG_CLICKED, NULL);
1655 if (!elm_widget_disabled_get(data) &&
1656 !evas_object_freeze_events_get(data))
1658 if (sd->editable && sd->input_panel_enable)
1659 edje_object_part_text_input_panel_show(sd->entry_edje, "elm.text");
1662 ////////////////////////////////
1664 ////////////////////////////////////////////////
1665 // TIZEN_ONLY(131221): Customize accessiblity for editfield
1666 ////////////////////////////////////////////////
1669 _access_info_cb(void *data, Evas_Object *obj __UNUSED__)
1673 ELM_ENTRY_DATA_GET(data, sd);
1675 if ((sd->password && _elm_config->access_password_read_enable) ||
1678 txt = elm_widget_access_info_get(data);
1680 if (!txt) txt = _elm_util_mkup_to_text(elm_entry_entry_get(data));
1681 if (txt && (strlen(txt) > 0)) return strdup(txt);
1683 else if (sd->password && !(_elm_config->access_password_read_enable))
1685 Eina_Strbuf *buf = eina_strbuf_new();
1686 char *text = elm_entry_markup_to_utf8(elm_entry_entry_get(data));
1689 eina_strbuf_append_printf(buf, E_("%d characters"), evas_string_char_len_get(text));
1690 ret = eina_strbuf_string_steal(buf);
1693 eina_strbuf_free(buf);
1697 /* to take care guide text */
1698 txt = edje_object_part_text_get(sd->entry_edje, "elm.guide");
1699 txt = _elm_util_mkup_to_text(txt);
1700 if (txt && (strlen(txt) > 0)) return strdup(txt);
1706 _access_state_cb(void *data, Evas_Object *obj __UNUSED__)
1712 ELM_ENTRY_DATA_GET(data, sd);
1714 top = elm_widget_top_get(data);
1716 buf = eina_strbuf_new();
1718 if (elm_widget_disabled_get(data))
1719 eina_strbuf_append(buf, E_("Disabled"));
1723 if (!eina_strbuf_length_get(buf))
1724 eina_strbuf_append(buf, E_("State: Not Editable"));
1725 else eina_strbuf_append(buf, E_(", Not Editable"));
1727 else if (!elm_widget_disabled_get(data))
1729 if ((elm_object_focus_get(data) && (elm_win_keyboard_mode_get(top) == ELM_WIN_KEYBOARD_OFF) && !sd->on_activate) ||
1730 (!elm_object_focus_get(data)))
1731 eina_strbuf_append(buf, E_("double tap to edit"));
1733 eina_strbuf_append(buf, E_("Editing"));
1736 if (!eina_strbuf_length_get(buf)) goto buf_free;
1738 ret = eina_strbuf_string_steal(buf);
1741 eina_strbuf_free(buf);
1746 _access_context_info_cb(void *data, Evas_Object *obj __UNUSED__)
1752 ELM_ENTRY_DATA_GET(data, sd);
1754 top = elm_widget_top_get(data);
1756 buf = eina_strbuf_new();
1758 if (sd->editable && !elm_widget_disabled_get(data))
1760 if (!((elm_object_focus_get(data) && (elm_win_keyboard_mode_get(top) == ELM_WIN_KEYBOARD_OFF) && !sd->on_activate) ||
1761 (!elm_object_focus_get(data))))
1763 if (sd->on_activate)
1764 sd->on_activate = EINA_FALSE;
1765 if (!elm_entry_is_empty(data))
1766 eina_strbuf_append(buf, E_("Flick up and down to adjust the position"));
1770 if (!eina_strbuf_length_get(buf)) goto buf_free;
1772 ret = eina_strbuf_string_steal(buf);
1775 eina_strbuf_free(buf);
1779 // TIZEN_ONLY(20140625): Add elm_entry_anchor_access_provider_* APIs.
1781 _elm_entry_anchor_access_string_get(Evas_Object *obj,
1787 Elm_Entry_Anchor_Access_Provider *ap;
1789 ELM_ENTRY_DATA_GET(obj, sd);
1791 EINA_LIST_FOREACH(sd->anchor_access_providers, l, ap)
1793 ret = ap->func(ap->data, obj, name, text);
1794 if (ret) return ret;
1800 // TIZEN_ONLY(20140625): Support accessibility for entry anchors.
1802 _elm_entry_anchors_highlight_clear(Evas_Object *obj)
1806 ELM_ENTRY_DATA_GET(obj, sd);
1808 if (sd->anchor_highlight_rect)
1810 data = (char *)evas_object_data_del(sd->anchor_highlight_rect, "anchor_name");
1811 if (data) free(data);
1812 data = (char *)evas_object_data_del(sd->anchor_highlight_rect, "anchor_text");
1813 if (data) free(data);
1814 evas_object_del(sd->anchor_highlight_rect);
1815 sd->anchor_highlight_rect = NULL;
1817 sd->anchor_highlight_pos = -1;
1821 // TIZEN_ONLY(20140625): Support accessibility for entry anchors.
1823 _elm_entry_hide_cb(void *data __UNUSED__,
1826 void *event_info __UNUSED__)
1828 _elm_entry_anchors_highlight_clear(obj);
1832 // TIZEN_ONLY(20140625): Support accessibility for entry anchors.
1834 _elm_entry_anchors_highlight_set(Evas_Object *obj, int pos)
1836 Evas_Textblock_Rectangle *r;
1837 Evas_Object *tb = elm_entry_textblock_get(obj);
1838 Evas *e = evas_object_evas_get(obj);
1839 const Eina_List *anchors_a, *l;
1840 Eina_List *ll, *ll_next, *range = NULL;
1841 Evas_Coord x, y, w, h;
1844 ELM_ENTRY_DATA_GET(obj, sd);
1848 sd->anchor_highlight_pos = -1;
1851 sd->anchor_highlight_pos = pos;
1852 evas_object_geometry_get(sd->entry_edje, &x, &y, &w, &h);
1853 anchors_a = evas_textblock_node_format_list_get(tb, "a");
1857 const Evas_Object_Textblock_Node_Format *node;
1858 Evas_Textblock_Cursor *start, *end;
1860 EINA_LIST_FOREACH(anchors_a, l, node)
1868 const char *s = evas_textblock_node_format_text_get(node);
1869 char *p, *name = NULL;
1871 p = strstr(s, "href=");
1874 name = strdup(p + 5);
1877 start = evas_object_textblock_cursor_new(tb);
1878 end = evas_object_textblock_cursor_new(tb);
1879 evas_textblock_cursor_at_format_set(start, node);
1880 evas_textblock_cursor_copy(start, end);
1882 node = evas_textblock_node_format_next_get(node);
1883 for (; node; node = evas_textblock_node_format_next_get(node))
1885 s = evas_textblock_node_format_text_get(node);
1886 if ((!strcmp(s, "- a")) || (!strcmp(s, "-a")))
1892 Evas_Coord sx, sy, ex, ey;
1893 Evas_Object *rect = NULL;
1894 char *text, *last_name, *last_text;
1895 // TIZEN_ONLY(20140625): Add elm_entry_anchor_access_provider_* APIs.
1896 const char *access_string;
1904 evas_textblock_cursor_at_format_set(end, node);
1905 text = (char *)evas_textblock_cursor_range_text_get(
1906 start, end, EVAS_TEXTBLOCK_TEXT_PLAIN);
1908 if (!(sd->anchor_highlight_rect))
1910 rect = edje_object_add(e);
1911 _elm_theme_object_set(obj, rect, "access", "base", "default");
1912 evas_object_smart_member_add(rect, obj);
1913 evas_object_repeat_events_set(rect, EINA_TRUE);
1914 sd->anchor_highlight_rect = rect;
1918 last_name = evas_object_data_del(sd->anchor_highlight_rect, "anchor_name");
1919 last_text = evas_object_data_del(sd->anchor_highlight_rect, "anchor_text");
1920 if (last_name) free(last_name);
1921 if (last_text) free(last_text);
1924 range = evas_textblock_cursor_range_geometry_get(start, end);
1925 EINA_LIST_FOREACH_SAFE(range, ll, ll_next, r)
1927 if (sx > r->x) sx = r->x;
1928 if (sy > r->y) sy = r->y;
1929 if (ex < r->x + r->w) ex = r->x + r->w;
1930 if (ey < r->y + r->h) ey = r->y + r->h;
1933 range = eina_list_remove_list(range, ll);
1935 elm_widget_show_region_set(obj, sx, sy, ex - sx, ey - sy, EINA_FALSE);
1937 evas_object_geometry_get(sd->entry_edje, &x, &y, &w, &h);
1938 evas_object_resize(sd->anchor_highlight_rect, ex - sx, ey - sy);
1939 evas_object_move(sd->anchor_highlight_rect, sx + x, sy + y);
1940 evas_object_show(sd->anchor_highlight_rect);
1941 evas_object_data_set(sd->anchor_highlight_rect, "anchor_name", name);
1942 evas_object_data_set(sd->anchor_highlight_rect, "anchor_text", text);
1944 // TIZEN_ONLY(20140625): Add elm_entry_anchor_access_provider_* APIs.
1945 access_string = _elm_entry_anchor_access_string_get(obj, name, text);
1946 _elm_access_say(obj, access_string, EINA_FALSE);
1954 evas_textblock_cursor_free(start);
1955 evas_textblock_cursor_free(end);
1960 sd->anchor_highlight_pos = -1;
1965 // TIZEN_ONLY(20140625): Support accessibility for entry anchors.
1967 _elm_entry_anchor_highlight_activate(Evas_Object *obj, int pos)
1969 Elm_Entry_Anchor_Info ei;
1971 ELM_ENTRY_DATA_GET(obj, sd);
1973 if (pos != sd->anchor_highlight_pos)
1974 _elm_entry_anchors_highlight_set(obj, pos);
1977 ei.name = evas_object_data_get(sd->anchor_highlight_rect, "anchor_name");
1978 ei.x = ei.y = ei.w = ei.h = 0;
1981 evas_object_smart_callback_call(obj, SIG_ANCHOR_CLICKED, &ei);
1986 _access_action_cb(void *data, Evas_Object *obj, Elm_Access_Action_Info *action_info)
1988 if (!action_info) return EINA_FALSE;
1991 ELM_ENTRY_DATA_GET(data, sd);
1993 switch (action_info->action_type)
1995 case ELM_ACCESS_ACTION_UP:
1996 if (sd->sel_allow && sd->sel_mode)
1997 elm_entry_select_none(data);
1998 elm_entry_cursor_prev(data);
1999 cp = elm_entry_cursor_content_get(data);
2000 _elm_access_say(data, cp, EINA_FALSE);
2003 case ELM_ACCESS_ACTION_DOWN:
2004 if (sd->sel_allow && sd->sel_mode)
2005 elm_entry_select_none(data);
2006 elm_entry_cursor_next(data);
2007 cp = elm_entry_cursor_content_get(data);
2008 _elm_access_say(data, cp, EINA_FALSE);
2011 case ELM_ACCESS_ACTION_ACTIVATE:
2012 if (!elm_widget_disabled_get(data) &&
2013 !evas_object_freeze_events_get(data))
2015 if (!elm_widget_focus_get(data))
2016 elm_object_focus_set(data, EINA_TRUE);
2017 else if (sd->editable)
2019 pos = elm_entry_cursor_pos_get(data);
2022 elm_entry_cursor_begin_set(data);
2023 _elm_access_say(data, E_("Cursor at beginning of text"), EINA_FALSE);
2027 elm_entry_cursor_end_set(data);
2028 _elm_access_say(data, E_("Cursor at end of text"), EINA_FALSE);
2032 // TIZEN_ONLY(20140625): Support accessibility for entry anchors.
2033 if (!(sd->editable) && (sd->anchor_highlight_pos > -1))
2034 _elm_entry_anchor_highlight_activate(data, sd->anchor_highlight_pos);
2037 evas_object_smart_callback_call(data, SIG_CLICKED, NULL);
2038 if (sd->editable && sd->input_panel_enable)
2040 edje_object_part_text_input_panel_show(sd->entry_edje, "elm.text");
2041 sd->on_activate = EINA_TRUE;
2046 // TIZEN_ONLY(20140625): Support accessibility for entry anchors.
2047 case ELM_ACCESS_ACTION_HIGHLIGHT_NEXT:
2048 if (!elm_widget_disabled_get(data) &&
2049 !evas_object_freeze_events_get(data))
2053 if (_elm_entry_anchors_highlight_set(data, sd->anchor_highlight_pos + 1))
2055 _elm_access_sound_play(ELM_ACCESS_SOUND_HIGHLIGHT);
2058 _elm_entry_anchors_highlight_clear(data);
2063 case ELM_ACCESS_ACTION_HIGHLIGHT_PREV:
2064 if (!elm_widget_disabled_get(data) &&
2065 !evas_object_freeze_events_get(data))
2067 if (elm_entry_editable_get(data) || (sd->anchor_highlight_pos == -1))
2069 if (_elm_entry_anchors_highlight_set(data, sd->anchor_highlight_pos - 1))
2071 _elm_access_sound_play(ELM_ACCESS_SOUND_HIGHLIGHT);
2074 _elm_entry_anchors_highlight_clear(data);
2075 elm_access_highlight_set(obj);
2080 case ELM_ACCESS_ACTION_UNHIGHLIGHT:
2081 _elm_entry_anchors_highlight_clear(data);
2093 _access_obj_process(Evas_Object *obj, Eina_Bool is_access)
2097 ELM_ENTRY_DATA_GET(obj, sd);
2101 ao = elm_access_object_get(elm_entry_textblock_get(obj));
2105 ao = _elm_access_edje_object_part_object_register
2106 (obj, sd->entry_edje, "elm.text");
2107 _elm_access_text_set(_elm_access_object_get(ao),
2108 ELM_ACCESS_TYPE, E_("Edit Field"));
2109 _elm_access_callback_set(_elm_access_object_get(ao),
2110 ELM_ACCESS_INFO, _access_info_cb, obj);
2111 _elm_access_callback_set(_elm_access_object_get(ao),
2112 ELM_ACCESS_STATE, _access_state_cb, obj);
2113 _elm_access_callback_set(_elm_access_object_get(ao),
2114 ELM_ACCESS_CONTEXT_INFO, _access_context_info_cb, obj);
2115 elm_access_action_cb_set(ao, ELM_ACCESS_ACTION_ACTIVATE,
2116 _access_action_cb, obj);
2117 elm_access_action_cb_set(ao, ELM_ACCESS_ACTION_UP,
2118 _access_action_cb, obj);
2119 elm_access_action_cb_set(ao, ELM_ACCESS_ACTION_DOWN,
2120 _access_action_cb, obj);
2121 elm_access_action_cb_set(ao, ELM_ACCESS_ACTION_HIGHLIGHT_NEXT,
2122 _access_action_cb, obj);
2123 elm_access_action_cb_set(ao, ELM_ACCESS_ACTION_HIGHLIGHT_PREV,
2124 _access_action_cb, obj);
2125 elm_access_action_cb_set(ao, ELM_ACCESS_ACTION_UNHIGHLIGHT,
2126 _access_action_cb, obj);
2131 ao = elm_access_object_get(elm_entry_textblock_get(obj));
2134 _elm_access_edje_object_part_object_unregister
2135 (obj, sd->entry_edje, "elm.text");
2140 _elm_entry_smart_focus_next(const Evas_Object *obj,
2141 Elm_Focus_Direction dir,
2144 Eina_List *items = NULL;
2147 if (!_elm_access_auto_highlight_get())
2149 *next = (Evas_Object *)obj;
2150 return !elm_widget_focus_get(obj);
2152 items = eina_list_append(items,
2153 elm_access_object_get(elm_entry_textblock_get((Evas_Object *)obj)));
2155 clear = elm_object_part_content_get(obj, "elm.swallow.clear");
2156 if (clear && evas_object_visible_get(clear))
2157 items = eina_list_append(items, clear);
2159 return elm_widget_focus_list_next_get(obj, items, eina_list_data_get, dir, next);
2163 _elm_entry_smart_access(Evas_Object *obj, Eina_Bool is_access)
2165 ELM_ENTRY_CHECK(obj);
2167 _access_obj_process(obj, is_access);
2169 evas_object_smart_callback_call(obj, SIG_ACCESS_CHANGED, NULL);
2171 /////////////////////////////////////
2173 /* we can't issue the layout's theming code here, cause it assumes an
2174 * unique edje object, always */
2176 _elm_entry_smart_theme(Evas_Object *obj)
2181 Elm_Widget_Smart_Class *parent_parent =
2182 (Elm_Widget_Smart_Class *)((Evas_Smart_Class *)
2183 _elm_entry_parent_sc)->parent;
2185 ELM_ENTRY_DATA_GET(obj, sd);
2187 if (!parent_parent->theme(obj))
2190 evas_event_freeze(evas_object_evas_get(obj));
2192 // TIZEN ONLY(130129) : Currently, for freezing cursor movement only.
2193 edje_object_part_text_freeze(sd->entry_edje, "elm.text");
2196 // TIZEN_ONLY(131221) : Customize accessiblity for editfield
2197 // do not delete access object, application could refer
2198 ao = elm_access_object_get(elm_entry_textblock_get(obj));
2199 _elm_access_object_hover_unregister(ao);
2201 edje_object_mirrored_set
2202 (ELM_WIDGET_DATA(sd)->resize_obj, elm_widget_mirrored_get(obj));
2204 edje_object_scale_set
2205 (ELM_WIDGET_DATA(sd)->resize_obj,
2206 elm_widget_scale_get(obj) * elm_config_scale_get());
2208 _mirrored_set(obj, elm_widget_mirrored_get(obj));
2210 // TIZEN ONLY(130225) : when password mode, elm_object_text_get returns utf8 string.
2211 elm_entry_imf_context_reset(obj);
2214 char *tmp = elm_entry_utf8_to_markup(elm_object_text_get(obj));
2215 t = eina_stringshare_add(tmp);
2219 t = eina_stringshare_add(elm_object_text_get(obj));
2221 // TIZEN ONLY(131106): Add rectangle for processing mouse up event on paddings inside of entry.
2225 elm_object_part_content_unset(obj, "scroller_event_rect");
2227 elm_object_part_content_unset(obj, "event_rect");
2228 evas_object_hide(sd->event_rect);
2232 elm_widget_theme_object_set
2233 (obj, sd->entry_edje, "entry", _elm_entry_theme_group_get(obj),
2234 elm_widget_style_get(obj));
2236 if (_elm_config->desktop_entry)
2237 edje_object_part_text_select_allow_set
2238 (sd->entry_edje, "elm.text", EINA_TRUE);
2240 // TIZEN_ONLY(20130830): For cursor movement when mouse up.
2241 edje_object_part_text_select_disabled_set(sd->entry_edje, "elm.text",
2242 !elm_entry_select_allow_get(obj));
2245 elm_object_text_set(obj, t);
2246 eina_stringshare_del(t);
2248 if (elm_widget_disabled_get(obj))
2249 edje_object_signal_emit(sd->entry_edje, "elm,state,disabled", "elm");
2251 edje_object_part_text_input_panel_layout_set
2252 (sd->entry_edje, "elm.text", sd->input_panel_layout);
2253 edje_object_part_text_input_panel_layout_variation_set
2254 (sd->entry_edje, "elm.text", sd->input_panel_layout_variation);
2255 edje_object_part_text_autocapital_type_set
2256 (sd->entry_edje, "elm.text", sd->autocapital_type);
2257 edje_object_part_text_prediction_allow_set
2258 (sd->entry_edje, "elm.text", sd->prediction_allow);
2259 edje_object_part_text_input_hint_set
2260 (sd->entry_edje, "elm.text", sd->input_hints);
2261 edje_object_part_text_input_panel_enabled_set
2262 (sd->entry_edje, "elm.text", sd->input_panel_enable);
2263 edje_object_part_text_input_panel_imdata_set
2264 (sd->entry_edje, "elm.text", sd->input_panel_imdata,
2265 sd->input_panel_imdata_len);
2266 edje_object_part_text_input_panel_return_key_type_set
2267 (sd->entry_edje, "elm.text", sd->input_panel_return_key_type);
2268 edje_object_part_text_input_panel_return_key_disabled_set
2269 (sd->entry_edje, "elm.text", sd->input_panel_return_key_disabled);
2270 edje_object_part_text_input_panel_show_on_demand_set
2271 (sd->entry_edje, "elm.text", sd->input_panel_show_on_demand);
2272 edje_object_part_text_cursor_handler_disabled_set
2273 (sd->entry_edje, "elm.text", sd->cursor_handler_disabled);
2275 // elm_entry_cursor_pos_set -> cursor,changed -> widget_show_region_set
2276 // -> smart_objects_calculate will call all smart calculate functions,
2277 // and one of them can delete elm_entry.
2278 evas_object_ref(obj);
2280 if (sd->cursor_pos != 0)
2281 elm_entry_cursor_pos_set(obj, sd->cursor_pos);
2283 if (elm_widget_focus_get(obj))
2284 edje_object_signal_emit(sd->entry_edje, "elm,action,focus", "elm");
2286 edje_object_message_signal_process(sd->entry_edje);
2290 sd->s_iface->mirrored_set(obj, elm_widget_mirrored_get(obj));
2292 elm_widget_theme_object_set
2293 (obj, sd->scr_edje, "scroller", "entry", elm_widget_style_get(obj));
2295 str = edje_object_data_get(sd->scr_edje, "focus_highlight");
2299 str = edje_object_data_get(sd->entry_edje, "focus_highlight");
2302 // TIZEN ONLY(131106): Add rectangle for processing mouse up event on paddings inside of entry.
2303 if ((sd->scroll && edje_object_part_exists(sd->scr_edje, "scroller_event_rect")) ||
2304 (!sd->scroll && edje_object_part_exists(sd->entry_edje, "event_rect")))
2306 if (!sd->event_rect)
2308 sd->event_rect = evas_object_rectangle_add(evas_object_evas_get(obj));
2309 evas_object_color_set(sd->event_rect, 0, 0, 0, 0);
2310 evas_object_size_hint_align_set(sd->event_rect, EVAS_HINT_FILL, EVAS_HINT_FILL);
2311 evas_object_event_callback_add(sd->event_rect, EVAS_CALLBACK_MOUSE_UP,
2312 _event_rect_mouse_up_cb, obj);
2316 elm_object_part_content_set(obj, "scroller_event_rect", sd->event_rect);
2318 elm_object_part_content_set(obj, "event_rect", sd->event_rect);
2322 if ((str) && (!strcmp(str, "on")))
2323 elm_widget_highlight_in_theme_set(obj, EINA_TRUE);
2325 elm_widget_highlight_in_theme_set(obj, EINA_FALSE);
2327 elm_layout_sizing_eval(obj);
2329 sd->has_text = !sd->has_text;
2330 _elm_entry_guide_update(obj, !sd->has_text);
2331 // TIZEN_ONLY(131221) : Customize accessiblity for editfield
2332 if (_elm_config->access_mode)
2333 _elm_access_object_hover_register(ao, elm_entry_textblock_get(obj));
2335 evas_event_thaw(evas_object_evas_get(obj));
2336 evas_event_thaw_eval(evas_object_evas_get(obj));
2339 edje_object_part_text_thaw(sd->entry_edje, "elm.text"); //(130129) : Currently, for freezing cursor movement only.
2340 if (!_elm_config->desktop_entry)
2342 if (sd->region_get_job) ecore_job_del(sd->region_get_job);
2343 sd->region_get_job = ecore_job_add(_region_get_job, obj);
2347 // TIZEN ONLY(130911)
2348 _cursor_geometry_update(obj);
2351 evas_object_smart_callback_call(obj, SIG_THEME_CHANGED, NULL);
2353 evas_object_unref(obj);
2359 _cursor_geometry_recalc(Evas_Object *obj)
2361 ELM_ENTRY_DATA_GET(obj, sd);
2363 if (sd->cur_changed)
2364 evas_object_smart_callback_call(obj, SIG_CURSOR_CHANGED, NULL);
2366 if (!sd->deferred_recalc_job)
2368 Evas_Coord cx, cy, cw, ch;
2370 edje_object_part_text_cursor_geometry_get
2371 (sd->entry_edje, "elm.text", &cx, &cy, &cw, &ch);
2372 if (sd->cur_changed)
2374 sd->cur_changed = EINA_FALSE;
2375 elm_widget_show_region_set(obj, cx, cy, cw, ch, EINA_FALSE);
2379 sd->deferred_cur = EINA_TRUE;
2383 _deferred_recalc_job(void *data)
2385 Evas_Coord minh = -1, resw = -1, minw = -1, fw = 0, fh = 0;
2387 ELM_ENTRY_DATA_GET(data, sd);
2391 sd->deferred_recalc_job = NULL;
2393 evas_object_geometry_get(sd->entry_edje, NULL, NULL, &resw, NULL);
2394 edje_object_size_min_restricted_calc(sd->entry_edje, &minw, &minh, resw, 0);
2395 elm_coords_finger_size_adjust(1, &minw, 1, &minh);
2397 /* This is a hack to workaround the way min size hints are treated.
2398 * If the minimum width is smaller than the restricted width, it
2399 * means the minimum doesn't matter. */
2402 Evas_Coord ominw = -1;
2404 evas_object_size_hint_min_get(data, &ominw, NULL);
2411 elm_coords_finger_size_adjust(1, &fw, 1, &fh);
2414 Evas_Coord vmw = 0, vmh = 0;
2416 edje_object_size_min_calc(sd->scr_edje, &vmw, &vmh);
2417 if (sd->single_line)
2419 evas_object_size_hint_min_set(data, vmw, minh + vmh);
2420 evas_object_size_hint_max_set(data, -1, minh + vmh);
2424 evas_object_size_hint_min_set(data, vmw, vmh);
2425 evas_object_size_hint_max_set(data, -1, -1);
2430 if (sd->single_line)
2432 evas_object_size_hint_min_set(data, minw, minh);
2433 evas_object_size_hint_max_set(data, -1, minh);
2437 evas_object_size_hint_min_set(data, fw, minh);
2438 evas_object_size_hint_max_set(data, -1, -1);
2442 if (sd->deferred_cur)
2444 Evas_Coord cx, cy, cw, ch;
2446 edje_object_part_text_cursor_geometry_get
2447 (sd->entry_edje, "elm.text", &cx, &cy, &cw, &ch);
2448 if (sd->cur_changed)
2450 sd->cur_changed = EINA_FALSE;
2451 elm_widget_show_region_set(data, cx, cy, cw, ch, EINA_FALSE);
2457 _elm_entry_smart_sizing_eval(Evas_Object *obj)
2459 Evas_Coord minw = -1, minh = -1;
2460 Evas_Coord resw, resh;
2462 ELM_ENTRY_DATA_GET(obj, sd);
2464 evas_object_geometry_get(obj, NULL, NULL, &resw, &resh);
2468 if ((resw == sd->last_w) && (!sd->changed))
2472 Evas_Coord vw = 0, vh = 0, w = 0, h = 0;
2474 sd->s_iface->content_viewport_size_get(obj, &vw, &vh);
2478 if (vw > sd->ent_mw) w = vw;
2479 if (vh > sd->ent_mh) h = vh;
2480 evas_object_resize(sd->entry_edje, w, h);
2488 evas_event_freeze(evas_object_evas_get(obj));
2489 sd->changed = EINA_FALSE;
2493 Evas_Coord vw = 0, vh = 0, vmw = 0, vmh = 0, w = -1, h = -1;
2495 evas_object_resize(sd->scr_edje, resw, resh);
2496 edje_object_size_min_calc(sd->scr_edje, &vmw, &vmh);
2497 sd->s_iface->content_viewport_size_get(obj, &vw, &vh);
2498 edje_object_size_min_restricted_calc
2499 (sd->entry_edje, &minw, &minh, vw, 0);
2500 elm_coords_finger_size_adjust(1, &minw, 1, &minh);
2502 /* This is a hack to workaround the way min size hints
2503 * are treated. If the minimum width is smaller than the
2504 * restricted width, it means the minimum doesn't
2508 Evas_Coord ominw = -1;
2510 evas_object_size_hint_min_get(sd->entry_edje, &ominw, NULL);
2516 if ((minw > 0) && (vw < minw)) vw = minw;
2517 if (minh > vh) vh = minh;
2519 if (sd->single_line) h = vmh + minh;
2522 evas_object_resize(sd->entry_edje, vw, vh);
2523 evas_object_size_hint_min_set(obj, w, h);
2525 if (sd->single_line)
2526 evas_object_size_hint_max_set(obj, -1, h);
2528 evas_object_size_hint_max_set(obj, -1, -1);
2532 if (sd->deferred_recalc_job)
2533 ecore_job_del(sd->deferred_recalc_job);
2534 sd->deferred_recalc_job =
2535 ecore_job_add(_deferred_recalc_job, obj);
2538 evas_event_thaw(evas_object_evas_get(obj));
2539 evas_event_thaw_eval(evas_object_evas_get(obj));
2543 if (!sd->changed) return;
2544 evas_event_freeze(evas_object_evas_get(obj));
2545 sd->changed = EINA_FALSE;
2549 Evas_Coord vw = 0, vh = 0, vmw = 0, vmh = 0, w = -1, h = -1;
2551 edje_object_size_min_calc(sd->entry_edje, &minw, &minh);
2554 elm_coords_finger_size_adjust(1, &minw, 1, &minh);
2556 sd->s_iface->content_viewport_size_get(obj, &vw, &vh);
2558 if (minw > vw) vw = minw;
2559 if (minh > vh) vh = minh;
2561 evas_object_resize(sd->entry_edje, vw, vh);
2562 edje_object_size_min_calc(sd->scr_edje, &vmw, &vmh);
2563 if (sd->single_line) h = vmh + minh;
2566 evas_object_size_hint_min_set(obj, w, h);
2567 if (sd->single_line)
2568 evas_object_size_hint_max_set(obj, -1, h);
2570 evas_object_size_hint_max_set(obj, -1, -1);
2574 edje_object_size_min_calc(sd->entry_edje, &minw, &minh);
2577 elm_coords_finger_size_adjust(1, &minw, 1, &minh);
2578 evas_object_size_hint_min_set(obj, minw, minh);
2580 if (sd->single_line)
2581 evas_object_size_hint_max_set(obj, -1, minh);
2583 evas_object_size_hint_max_set(obj, -1, -1);
2585 evas_event_thaw(evas_object_evas_get(obj));
2586 evas_event_thaw_eval(evas_object_evas_get(obj));
2589 _cursor_geometry_recalc(obj);
2593 _return_key_enabled_check(Evas_Object *obj)
2595 Eina_Bool return_key_disabled = EINA_FALSE;
2597 ELM_ENTRY_DATA_GET(obj, sd);
2599 if (!sd->auto_return_key) return;
2601 if (elm_entry_is_empty(obj) == EINA_TRUE)
2602 return_key_disabled = EINA_TRUE;
2604 elm_entry_input_panel_return_key_disabled_set(obj, return_key_disabled);
2608 _elm_entry_smart_on_focus(Evas_Object *obj, Elm_Focus_Info *info)
2611 Eina_Bool top_is_win = EINA_FALSE;
2614 ELM_ENTRY_DATA_GET(obj, sd);
2616 top = elm_widget_top_get(obj);
2617 if (!strcmp(evas_object_type_get(top), "elm_win"))
2618 top_is_win = EINA_TRUE;
2620 // if (!sd->editable) return EINA_FALSE; // TIZEN ONLY
2621 if (elm_widget_focus_get(obj))
2623 printf("[Elm_entry::Focused] obj : %p\n", obj); // TIZEN ONLY
2624 evas_object_focus_set(sd->entry_edje, EINA_TRUE);
2625 edje_object_signal_emit(sd->entry_edje, "elm,action,focus", "elm");
2626 sd->needs_focus_region = EINA_TRUE; // TIZEN_ONLY(20130830): For cursor movement when mouse up.
2627 if (sd->editable) // TIZEN ONLY
2629 if (top && top_is_win && sd->input_panel_enable &&
2630 !edje_object_part_text_imf_context_get(sd->entry_edje, "elm.text"))
2631 elm_win_keyboard_mode_set(top, ELM_WIN_KEYBOARD_ON);
2632 evas_object_smart_callback_call(obj, SIG_FOCUSED, info);
2633 _return_key_enabled_check(obj);
2635 // TIZEN_ONLY(20140418): Call _elm_access_highlight_set manually in smart on focus of entry.
2636 if (_elm_config->access_mode)
2638 Evas_Object *tb = elm_entry_textblock_get(obj);
2639 ao = elm_access_object_get(tb);
2640 _elm_access_highlight_set(ao, EINA_TRUE);
2646 printf("[Elm_entry::Unfocused] obj : %p\n", obj); // TIZEN ONLY
2647 _cbhm_msg_send(obj, "cbhm_hide"); // TIZEN ONLY : Hide clipboard
2648 edje_object_signal_emit(sd->entry_edje, "elm,action,unfocus", "elm");
2649 evas_object_focus_set(sd->entry_edje, EINA_FALSE);
2651 if ((sd->api) && (sd->api->obj_hidemenu))
2652 sd->api->obj_hidemenu(obj);
2654 if (sd->editable) // TIZEN ONLY
2656 if (top && top_is_win && sd->input_panel_enable &&
2657 !edje_object_part_text_imf_context_get(sd->entry_edje, "elm.text"))
2658 elm_win_keyboard_mode_set(top, ELM_WIN_KEYBOARD_OFF);
2659 evas_object_smart_callback_call(obj, SIG_UNFOCUSED, NULL);
2662 if (_elm_config->selection_clear_enable)
2664 if ((sd->have_selection) && (!sd->hoversel))
2666 sd->sel_mode = EINA_FALSE;
2667 elm_widget_scroll_hold_pop(obj);
2668 edje_object_part_text_select_allow_set(sd->entry_edje, "elm.text", EINA_FALSE);
2669 edje_object_signal_emit(sd->entry_edje, "elm,state,select,off", "elm");
2670 edje_object_part_text_select_none(sd->entry_edje, "elm.text");
2679 _elm_entry_smart_translate(Evas_Object *obj)
2681 evas_object_smart_callback_call(obj, SIG_LANG_CHANGED, NULL);
2686 // TIZEN_ONLY(20130830): For cursor movement when mouse up.
2688 _entry_cursor_changed_for_focus_region_cb(void *data,
2689 Evas_Object *obj __UNUSED__,
2690 const char *emission __UNUSED__,
2691 const char *source __UNUSED__)
2693 ELM_ENTRY_DATA_GET(data, sd);
2694 if (elm_widget_focus_get(data))
2695 elm_widget_focus_region_show(data);
2696 edje_object_signal_callback_del
2697 (sd->entry_edje, "cursor,updated", "elm.text",
2698 _entry_cursor_changed_for_focus_region_cb);
2703 _elm_entry_smart_on_focus_region(const Evas_Object *obj,
2709 ELM_ENTRY_DATA_GET(obj, sd);
2711 // TIZEN_ONLY(20130830): For cursor movement when mouse up.
2712 //if (sd->needs_focus_region)
2714 // edje_object_signal_callback_add
2715 // (sd->entry_edje, "cursor,updated", "elm.text",
2716 // _entry_cursor_changed_for_focus_region_cb, (void *)obj);
2717 // sd->needs_focus_region = EINA_FALSE;
2718 // return EINA_FALSE;
2722 edje_object_part_text_cursor_geometry_get
2723 (sd->entry_edje, "elm.text", x, y, w, h);
2726 //edje_object_part_text_cursor_geometry_get
2727 // (sd->entry_edje, "elm.text", x, y, w, h);
2729 //////////////////////////////////////////////////////
2733 _show_region_hook(void *data,
2736 Evas_Coord x, y, w, h;
2738 ELM_ENTRY_DATA_GET(data, sd);
2740 elm_widget_show_region_get(obj, &x, &y, &w, &h);
2742 sd->s_iface->content_region_show(obj, x, y, w, h);
2746 _elm_entry_smart_sub_object_del(Evas_Object *obj,
2749 /* unfortunately entry doesn't follow the signal pattern
2750 * elm,state,icon,{visible,hidden}, so we have to replicate this
2752 if (sobj == elm_layout_content_get(obj, "elm.swallow.icon"))
2754 elm_layout_signal_emit(obj, "elm,action,hide,icon", "elm");
2756 else if (sobj == elm_layout_content_get(obj, "elm.swallow.end"))
2758 elm_layout_signal_emit(obj, "elm,action,hide,end", "elm");
2761 if (!ELM_WIDGET_CLASS(_elm_entry_parent_sc)->sub_object_del(obj, sobj))
2768 _hoversel_position(Evas_Object *obj)
2770 Evas_Coord cx, cy, cw, ch, x, y, mw, mh;
2772 ELM_ENTRY_DATA_GET(obj, sd);
2776 evas_object_geometry_get(sd->entry_edje, &x, &y, NULL, NULL);
2785 edje_object_part_text_cursor_geometry_get
2786 (sd->entry_edje, "elm.text", &cx, &cy, &cw, &ch);
2788 evas_object_size_hint_min_get(sd->hoversel, &mw, &mh);
2791 cx += (cw - mw) / 2;
2796 cy += (ch - mh) / 2;
2799 evas_object_move(sd->hoversel, x + cx, y + cy);
2800 evas_object_resize(sd->hoversel, cw, ch);
2804 _hover_del_job(void *data)
2806 ELM_ENTRY_DATA_GET(data, sd);
2810 evas_object_del(sd->hoversel);
2811 sd->hoversel = NULL;
2813 sd->hov_deljob = NULL;
2817 _hover_dismissed_cb(void *data,
2818 Evas_Object *obj __UNUSED__,
2819 void *event_info __UNUSED__)
2821 ELM_ENTRY_DATA_GET(data, sd);
2824 if (sd->hoversel) evas_object_hide(sd->hoversel);
2827 if (!_elm_config->desktop_entry)
2830 edje_object_part_text_select_allow_set
2831 (sd->entry_edje, "elm.text", EINA_TRUE);
2834 elm_widget_scroll_freeze_pop(data);
2835 if (sd->hov_deljob) ecore_job_del(sd->hov_deljob);
2836 sd->hov_deljob = ecore_job_add(_hover_del_job, data);
2840 _hover_selected_cb(void *data,
2841 Evas_Object *obj __UNUSED__,
2842 void *event_info __UNUSED__)
2844 ELM_ENTRY_DATA_GET(data, sd);
2846 sd->sel_mode = EINA_TRUE;
2847 edje_object_part_text_select_none(sd->entry_edje, "elm.text");
2849 if (!_elm_config->desktop_entry)
2852 edje_object_part_text_select_allow_set
2853 (sd->entry_edje, "elm.text", EINA_TRUE);
2855 edje_object_signal_emit(sd->entry_edje, "elm,state,select,on", "elm");
2857 if (!_elm_config->desktop_entry)
2859 elm_widget_scroll_hold_push(data);
2860 sd->scroll_holding = EINA_TRUE;
2865 _item_tags_remove(const char *str)
2873 buf = eina_strbuf_new();
2877 if (!eina_strbuf_append(buf, str))
2879 eina_strbuf_free(buf);
2885 const char *temp = eina_strbuf_string_get(buf);
2886 char *start_tag = NULL;
2887 char *end_tag = NULL;
2891 start_tag = strstr(temp, "<item");
2893 start_tag = strstr(temp, "</item");
2895 end_tag = strstr(start_tag, ">");
2898 if (!end_tag || start_tag > end_tag)
2901 sindex = start_tag - temp;
2902 eindex = end_tag - temp + 1;
2903 if (!eina_strbuf_remove(buf, sindex, eindex))
2907 ret = eina_strbuf_string_steal(buf);
2908 eina_strbuf_free(buf);
2914 _elm_entry_entry_paste(Evas_Object *obj,
2919 ELM_ENTRY_CHECK(obj);
2920 ELM_ENTRY_DATA_GET(obj, sd);
2922 if (sd->cnp_mode == ELM_CNP_MODE_NO_IMAGE)
2924 str = _item_tags_remove(entry);
2925 if (!str) str = strdup(entry);
2928 str = strdup(entry);
2929 if (!str) str = (char *)entry;
2931 edje_object_part_text_user_insert(sd->entry_edje, "elm.text", str);
2933 if (str != entry) free(str);
2936 #ifdef HAVE_ELEMENTARY_X
2937 if (elm_widget_focus_get(obj))
2938 ecore_x_selection_secondary_set(elm_win_xwindow_get(obj), NULL,0);
2944 _paste_cb(void *data,
2945 Evas_Object *obj __UNUSED__,
2946 void *event_info __UNUSED__)
2948 ELM_ENTRY_DATA_GET(data, sd);
2950 evas_object_smart_callback_call(data, SIG_SELECTION_PASTE, NULL);
2951 if (sd->sel_notify_handler)
2953 #ifdef HAVE_ELEMENTARY_X
2954 Elm_Sel_Format formats = ELM_SEL_FORMAT_MARKUP;
2956 sd->selection_asked = EINA_TRUE;
2958 if (sd->cnp_mode == ELM_CNP_MODE_PLAINTEXT)
2959 formats = ELM_SEL_FORMAT_TEXT;
2960 else if (sd->cnp_mode != ELM_CNP_MODE_NO_IMAGE)
2961 formats |= ELM_SEL_FORMAT_IMAGE;
2963 elm_cnp_selection_get
2964 (data, ELM_SEL_TYPE_CLIPBOARD, formats, NULL, NULL);
2969 #ifdef HAVE_ELEMENTARY_WAYLAND
2970 Elm_Sel_Format formats = ELM_SEL_FORMAT_MARKUP;
2971 sd->selection_asked = EINA_TRUE;
2972 if (sd->cnp_mode == ELM_CNP_MODE_PLAINTEXT)
2973 formats = ELM_SEL_FORMAT_TEXT;
2974 else if (sd->cnp_mode != ELM_CNP_MODE_NO_IMAGE)
2975 formats |= ELM_SEL_FORMAT_IMAGE;
2976 elm_cnp_selection_get(data, ELM_SEL_TYPE_CLIPBOARD, formats, NULL, NULL);
2982 _selection_store(Elm_Sel_Type seltype,
2987 ELM_ENTRY_DATA_GET(obj, sd);
2989 sel = edje_object_part_text_selection_get(sd->entry_edje, "elm.text");
2990 if ((!sel) || (!sel[0])) return; /* avoid deleting our own selection */
2992 elm_cnp_selection_set
2993 (obj, seltype, ELM_SEL_FORMAT_MARKUP, sel, strlen(sel));
2994 if (seltype == ELM_SEL_TYPE_CLIPBOARD)
2995 eina_stringshare_replace(&sd->cut_sel, sel);
3000 Evas_Object *obj __UNUSED__,
3001 void *event_info __UNUSED__)
3003 ELM_ENTRY_DATA_GET(data, sd);
3005 evas_object_smart_callback_call(data, SIG_SELECTION_CUT, NULL);
3007 sd->sel_mode = EINA_FALSE;
3008 if (!_elm_config->desktop_entry)
3009 edje_object_part_text_select_allow_set
3010 (sd->entry_edje, "elm.text", EINA_FALSE);
3011 edje_object_signal_emit(sd->entry_edje, "elm,state,select,off", "elm");
3013 if ((!_elm_config->desktop_entry) && (sd->scroll_holding))
3015 elm_widget_scroll_hold_pop(data);
3016 sd->scroll_holding = EINA_FALSE;
3019 _selection_store(ELM_SEL_TYPE_CLIPBOARD, data);
3020 edje_object_part_text_user_insert(sd->entry_edje, "elm.text", "");
3021 elm_layout_sizing_eval(data);
3025 _copy_cb(void *data,
3026 Evas_Object *obj __UNUSED__,
3027 void *event_info __UNUSED__)
3029 ELM_ENTRY_DATA_GET(data, sd);
3031 evas_object_smart_callback_call(data, SIG_SELECTION_COPY, NULL);
3033 sd->sel_mode = EINA_FALSE;
3034 if (!_elm_config->desktop_entry)
3036 edje_object_part_text_select_allow_set
3037 (sd->entry_edje, "elm.text", EINA_FALSE);
3038 edje_object_signal_emit(sd->entry_edje, "elm,state,select,off", "elm");
3039 if (sd->scroll_holding)
3041 elm_widget_scroll_hold_pop(data);
3042 sd->scroll_holding = EINA_FALSE;
3045 _selection_store(ELM_SEL_TYPE_CLIPBOARD, data);
3049 _hover_cancel_cb(void *data,
3050 Evas_Object *obj __UNUSED__,
3051 void *event_info __UNUSED__)
3053 ELM_ENTRY_DATA_GET(data, sd);
3055 sd->sel_mode = EINA_FALSE;
3056 if (!_elm_config->desktop_entry)
3057 edje_object_part_text_select_allow_set
3058 (sd->entry_edje, "elm.text", EINA_FALSE);
3059 edje_object_signal_emit(sd->entry_edje, "elm,state,select,off", "elm");
3060 if ((!_elm_config->desktop_entry) && (sd->scroll_holding))
3062 elm_widget_scroll_hold_pop(data);
3063 sd->scroll_holding = EINA_FALSE;
3065 edje_object_part_text_select_none(sd->entry_edje, "elm.text");
3069 _hover_item_clicked_cb(void *data,
3070 Evas_Object *obj __UNUSED__,
3071 void *event_info __UNUSED__)
3073 Elm_Entry_Context_Menu_Item *it = data;
3074 Evas_Object *obj2 = it->obj;
3076 if (it->func) it->func(it->data, obj2, NULL);
3079 #ifndef ELM_FEATURE_WEARABLE
3081 _menu_call(Evas_Object *obj)
3085 const Elm_Entry_Context_Menu_Item *it;
3087 ELM_ENTRY_DATA_GET(obj, sd);
3089 if ((sd->api) && (sd->api->obj_longpress))
3091 sd->api->obj_longpress(obj);
3093 else if (sd->context_menu)
3095 const char *context_menu_orientation;
3097 if (sd->hoversel) evas_object_del(sd->hoversel);
3098 else elm_widget_scroll_freeze_push(obj);
3100 sd->hoversel = elm_hoversel_add(obj);
3101 context_menu_orientation = edje_object_data_get
3102 (sd->entry_edje, "context_menu_orientation");
3104 if ((context_menu_orientation) &&
3105 (!strcmp(context_menu_orientation, "horizontal")))
3106 elm_hoversel_horizontal_set(sd->hoversel, EINA_TRUE);
3108 elm_object_style_set(sd->hoversel, "entry");
3109 elm_widget_sub_object_add(obj, sd->hoversel);
3110 elm_object_text_set(sd->hoversel, "Text");
3111 top = elm_widget_top_get(obj);
3113 if (top) elm_hoversel_hover_parent_set(sd->hoversel, top);
3115 evas_object_smart_callback_add
3116 (sd->hoversel, "dismissed", _hover_dismissed_cb, obj);
3117 if (sd->have_selection)
3121 elm_hoversel_item_add
3122 (sd->hoversel, E_("Copy"), NULL, ELM_ICON_NONE,
3125 elm_hoversel_item_add
3126 (sd->hoversel, E_("Cut"), NULL, ELM_ICON_NONE,
3128 elm_hoversel_item_add
3129 (sd->hoversel, E_("Cancel"), NULL, ELM_ICON_NONE,
3130 _hover_cancel_cb, obj);
3137 if (!_elm_config->desktop_entry)
3140 elm_hoversel_item_add
3141 (sd->hoversel, E_("Select"), NULL, ELM_ICON_NONE,
3142 _hover_selected_cb, obj);
3144 if (elm_selection_selection_has_owner(obj))
3147 elm_hoversel_item_add
3148 (sd->hoversel, E_("Paste"), NULL, ELM_ICON_NONE,
3153 elm_hoversel_item_add
3154 (sd->hoversel, E_("Cancel"), NULL, ELM_ICON_NONE,
3155 _hover_cancel_cb, obj);
3158 EINA_LIST_FOREACH(sd->items, l, it)
3160 elm_hoversel_item_add(sd->hoversel, it->label, it->icon_file,
3161 it->icon_type, _hover_item_clicked_cb, it);
3166 _hoversel_position(obj);
3167 evas_object_show(sd->hoversel);
3168 elm_hoversel_hover_begin(sd->hoversel);
3171 if (!_elm_config->desktop_entry)
3173 edje_object_part_text_select_allow_set
3174 (sd->entry_edje, "elm.text", EINA_FALSE);
3175 edje_object_part_text_select_abort(sd->entry_edje, "elm.text");
3182 _long_press_cb(void *data)
3184 ELM_ENTRY_DATA_GET(data, sd);
3186 #ifndef ELM_FEATURE_WEARABLE
3187 if (!_elm_config->desktop_entry && !sd->magnifier_enabled) // TIZEN ONLY
3191 sd->longpress_timer = NULL;
3192 evas_object_smart_callback_call(data, SIG_LONGPRESSED, NULL);
3194 return ECORE_CALLBACK_CANCEL;
3198 _mouse_down_cb(void *data,
3199 Evas *evas __UNUSED__,
3200 Evas_Object *obj __UNUSED__,
3203 Evas_Event_Mouse_Down *ev = event_info;
3205 ELM_ENTRY_DATA_GET(data, sd);
3207 if (sd->disabled) return;
3208 if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return;
3209 sd->downx = ev->canvas.x;
3210 sd->downy = ev->canvas.y;
3211 sd->long_pressed = EINA_FALSE;
3212 if (ev->button == 1)
3214 if (sd->longpress_timer) ecore_timer_del(sd->longpress_timer);
3215 sd->longpress_timer = ecore_timer_add
3216 (_elm_config->longpress_timeout, _long_press_cb, data);
3218 #ifndef ELM_FEATURE_WEARABLE
3219 else if (ev->button == 3)
3221 if (_elm_config->desktop_entry)
3227 edje_object_part_text_cursor_handler_disabled_set(sd->entry_edje, "elm.text", EINA_TRUE);
3229 else if (!sd->cursor_handler_disabled)
3231 edje_object_part_text_cursor_handler_disabled_set(sd->entry_edje, "elm.text", EINA_FALSE);
3236 _mouse_up_cb(void *data,
3237 Evas *evas __UNUSED__,
3238 Evas_Object *obj __UNUSED__,
3241 Evas_Event_Mouse_Up *ev = event_info;
3243 ELM_ENTRY_DATA_GET(data, sd);
3245 if (sd->disabled) return;
3246 if (ev->button == 1)
3248 if ((sd->editable) && (sd->drag_started))
3250 edje_object_part_text_cursor_handler_disabled_set
3251 (sd->entry_edje, "elm.text", sd->cursor_handler_disabled);
3254 if (!sd->double_clicked)
3256 if ((sd->api) && (sd->api->obj_mouseup))
3257 sd->api->obj_mouseup(data);
3259 if (sd->magnifier_enabled)
3261 _magnifier_hide(data);
3262 #ifndef ELM_FEATURE_WEARABLE
3263 if ((sd->long_pressed) && (!sd->drag_started))
3267 sd->mouse_upped = EINA_TRUE;
3269 if (sd->longpress_timer)
3271 ecore_timer_del(sd->longpress_timer);
3272 sd->longpress_timer = NULL;
3275 else if ((ev->button == 3) && (!_elm_config->desktop_entry))
3278 #ifndef ELM_FEATURE_WEARABLE
3285 _mouse_move_cb(void *data,
3286 Evas *evas __UNUSED__,
3287 Evas_Object *obj __UNUSED__,
3290 Evas_Event_Mouse_Move *ev = event_info;
3292 ELM_ENTRY_DATA_GET(data, sd);
3294 if (sd->disabled) return;
3297 if (ev->buttons == 1)
3299 if (sd->long_pressed)
3301 if ((!sd->drag_started) && (sd->magnifier_enabled))
3305 _magnifier_show(data);
3306 _magnifier_move(data);
3315 if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD)
3317 if (sd->longpress_timer)
3319 ecore_timer_del(sd->longpress_timer);
3320 sd->longpress_timer = NULL;
3323 else if (sd->longpress_timer)
3327 dx = sd->downx - ev->cur.canvas.x;
3329 dy = sd->downy - ev->cur.canvas.y;
3332 ((_elm_config->finger_size / 2) *
3333 (_elm_config->finger_size / 2)))
3335 ecore_timer_del(sd->longpress_timer);
3336 sd->longpress_timer = NULL;
3340 else if (sd->longpress_timer)
3344 dx = sd->downx - ev->cur.canvas.x;
3346 dy = sd->downy - ev->cur.canvas.y;
3349 ((_elm_config->finger_size / 2) *
3350 (_elm_config->finger_size / 2)))
3352 ecore_timer_del(sd->longpress_timer);
3353 sd->longpress_timer = NULL;
3359 _entry_changed_handle(void *data,
3365 ELM_ENTRY_DATA_GET(data, sd);
3367 evas_event_freeze(evas_object_evas_get(data));
3368 sd->changed = EINA_TRUE;
3369 /* Reset the size hints which are no more relevant. Keep the
3370 * height, this is a hack, but doesn't really matter cause we'll
3371 * re-eval in a moment. */
3372 evas_object_size_hint_min_get(data, NULL, &minh);
3373 evas_object_size_hint_min_set(data, -1, minh);
3375 elm_layout_sizing_eval(data);
3376 if (sd->text) eina_stringshare_del(sd->text);
3380 if (sd->password_text)
3381 eina_stringshare_del(sd->password_text);
3382 sd->password_text = NULL;
3384 if ((sd->api) && (sd->api->obj_hidemenu))
3385 sd->api->obj_hidemenu(data);
3388 if (sd->delay_write)
3390 ecore_timer_del(sd->delay_write);
3391 sd->delay_write = NULL;
3393 evas_event_thaw(evas_object_evas_get(data));
3394 evas_event_thaw_eval(evas_object_evas_get(data));
3395 if ((sd->auto_save) && (sd->file))
3396 sd->delay_write = ecore_timer_add(2.0, _delay_write, data);
3398 _return_key_enabled_check(data);
3399 text = edje_object_part_text_get(sd->entry_edje, "elm.text");
3403 _elm_entry_guide_update(data, EINA_TRUE);
3405 _elm_entry_guide_update(data, EINA_FALSE);
3407 /* callback - this could call callbacks that delete the
3408 * entry... thus... any access to sd after this could be
3411 // TIZEN ONLY(130911)
3412 _cursor_geometry_update(data);
3415 evas_object_smart_callback_call(data, event, NULL);
3419 _entry_changed_signal_cb(void *data,
3420 Evas_Object *obj __UNUSED__,
3421 const char *emission __UNUSED__,
3422 const char *source __UNUSED__)
3424 _entry_changed_handle(data, SIG_CHANGED);
3428 _entry_changed_user_signal_cb(void *data,
3429 Evas_Object *obj __UNUSED__,
3430 const char *emission __UNUSED__,
3431 const char *source __UNUSED__)
3433 Elm_Entry_Change_Info info;
3434 Edje_Entry_Change_Info *edje_info = (Edje_Entry_Change_Info *)
3435 edje_object_signal_callback_extra_data_get();
3439 memcpy(&info, edje_info, sizeof(info));
3440 evas_object_smart_callback_call(data, SIG_CHANGED_USER, &info);
3444 evas_object_smart_callback_call(data, SIG_CHANGED_USER, NULL);
3449 _entry_preedit_changed_signal_cb(void *data,
3450 Evas_Object *obj __UNUSED__,
3451 const char *emission __UNUSED__,
3452 const char *source __UNUSED__)
3454 _entry_changed_handle(data, SIG_PREEDIT_CHANGED);
3458 _entry_undo_request_signal_cb(void *data,
3459 Evas_Object *obj __UNUSED__,
3460 const char *emission __UNUSED__,
3461 const char *source __UNUSED__)
3463 evas_object_smart_callback_call(data, SIG_UNDO_REQUEST, NULL);
3467 _entry_redo_request_signal_cb(void *data,
3468 Evas_Object *obj __UNUSED__,
3469 const char *emission __UNUSED__,
3470 const char *source __UNUSED__)
3472 evas_object_smart_callback_call(data, SIG_REDO_REQUEST, NULL);
3476 _entry_selection_start_signal_cb(void *data,
3477 Evas_Object *obj __UNUSED__,
3478 const char *emission __UNUSED__,
3479 const char *source __UNUSED__)
3484 ELM_ENTRY_DATA_GET(data, sd);
3486 if (!elm_object_focus_get(data)) elm_object_focus_set(data, EINA_TRUE);
3487 EINA_LIST_FOREACH(entries, l, entry)
3489 if (entry != data) elm_entry_select_none(entry);
3493 sd->sel_mode = EINA_TRUE;
3496 evas_object_smart_callback_call(data, SIG_SELECTION_START, NULL);
3497 #ifdef HAVE_ELEMENTARY_X
3498 if (sd->sel_notify_handler)
3500 const char *txt = elm_entry_selection_get(data);
3503 top = elm_widget_top_get(data);
3504 if (txt && top && (elm_win_xwindow_get(top)))
3505 elm_cnp_selection_set(data, ELM_SEL_TYPE_PRIMARY,
3506 ELM_SEL_FORMAT_MARKUP, txt, strlen(txt));
3512 _entry_selection_all_signal_cb(void *data,
3513 Evas_Object *obj __UNUSED__,
3514 const char *emission __UNUSED__,
3515 const char *source __UNUSED__)
3517 elm_entry_select_all(data);
3521 _entry_selection_none_signal_cb(void *data,
3522 Evas_Object *obj __UNUSED__,
3523 const char *emission __UNUSED__,
3524 const char *source __UNUSED__)
3526 ELM_ENTRY_DATA_GET(data, sd); // TIZEN ONLY
3528 elm_entry_select_none(data);
3531 if ((sd->api) && (sd->api->obj_hidemenu))
3532 sd->api->obj_hidemenu(data);
3538 _entry_selection_changed_signal_cb(void *data,
3539 Evas_Object *obj __UNUSED__,
3540 const char *emission __UNUSED__,
3541 const char *source __UNUSED__)
3543 ELM_ENTRY_DATA_GET(data, sd);
3544 Evas_Coord cx, cy, cw, ch; // TIZEN ONLY
3546 sd->have_selection = EINA_TRUE;
3547 sd->sel_mode = EINA_TRUE; // TIZEN ONLY
3548 evas_object_smart_callback_call(data, SIG_SELECTION_CHANGED, NULL);
3549 _selection_store(ELM_SEL_TYPE_PRIMARY, data);
3552 edje_object_part_text_cursor_geometry_get(sd->entry_edje, "elm.text", &cx, &cy, &cw, &ch);
3553 if (!sd->deferred_recalc_job)
3554 elm_widget_show_region_set(data, cx, cy, cw, ch, EINA_FALSE);
3557 sd->deferred_cur = EINA_TRUE;
3567 _entry_selection_cleared_signal_cb(void *data,
3568 Evas_Object *obj __UNUSED__,
3569 const char *emission __UNUSED__,
3570 const char *source __UNUSED__)
3572 ELM_ENTRY_DATA_GET(data, sd);
3574 if (!sd->have_selection) return;
3576 sd->have_selection = EINA_FALSE;
3579 sd->sel_mode = EINA_FALSE;
3582 // TIZEN_ONLY(20130830): For cursor movement when mouse up.
3583 edje_object_part_text_select_allow_set(sd->entry_edje, "elm.text", EINA_FALSE);
3585 evas_object_smart_callback_call(data, SIG_SELECTION_CLEARED, NULL);
3586 if (sd->sel_notify_handler)
3590 #ifdef HAVE_ELEMENTARY_X
3593 top = elm_widget_top_get(data);
3594 if ((top) && (elm_win_xwindow_get(top)))
3595 elm_cnp_selection_set
3596 (data, ELM_SEL_TYPE_PRIMARY, ELM_SEL_FORMAT_MARKUP,
3597 sd->cut_sel, strlen(sd->cut_sel));
3599 eina_stringshare_del(sd->cut_sel);
3602 else if (!sd->drag_started)
3604 #ifdef HAVE_ELEMENTARY_X
3607 top = elm_widget_top_get(data);
3608 if ((top) && (elm_win_xwindow_get(top)))
3609 elm_object_cnp_selection_clear(data, ELM_SEL_TYPE_PRIMARY);
3615 if ((sd->api) && (sd->api->obj_hidemenu))
3617 sd->api->obj_hidemenu(data);
3623 _entry_paste_request_signal_cb(void *data,
3624 Evas_Object *obj __UNUSED__,
3625 const char *emission,
3626 const char *source __UNUSED__)
3628 ELM_ENTRY_DATA_GET(data, sd);
3630 #ifdef HAVE_ELEMENTARY_X
3631 Elm_Sel_Type type = (emission[sizeof("ntry,paste,request,")] == '1') ?
3632 ELM_SEL_TYPE_PRIMARY : ELM_SEL_TYPE_CLIPBOARD;
3635 if (!sd->editable) return;
3636 evas_object_smart_callback_call(data, SIG_SELECTION_PASTE, NULL);
3637 if (sd->sel_notify_handler)
3639 #ifdef HAVE_ELEMENTARY_X
3642 top = elm_widget_top_get(data);
3643 if ((top) && (elm_win_xwindow_get(top)))
3645 Elm_Sel_Format formats = ELM_SEL_FORMAT_MARKUP;
3647 sd->selection_asked = EINA_TRUE;
3649 if (sd->cnp_mode == ELM_CNP_MODE_PLAINTEXT)
3650 formats = ELM_SEL_FORMAT_TEXT;
3651 else if (sd->cnp_mode != ELM_CNP_MODE_NO_IMAGE)
3652 formats |= ELM_SEL_FORMAT_IMAGE;
3654 elm_cnp_selection_get(data, type, formats, NULL, NULL);
3661 _entry_copy_notify_signal_cb(void *data,
3662 Evas_Object *obj __UNUSED__,
3663 const char *emission __UNUSED__,
3664 const char *source __UNUSED__)
3666 _copy_cb(data, NULL, NULL);
3670 _entry_cut_notify_signal_cb(void *data,
3671 Evas_Object *obj __UNUSED__,
3672 const char *emission __UNUSED__,
3673 const char *source __UNUSED__)
3675 _cut_cb(data, NULL, NULL);
3679 _entry_cursor_changed_signal_cb(void *data,
3680 Evas_Object *obj __UNUSED__,
3681 const char *emission __UNUSED__,
3682 const char *source __UNUSED__)
3684 ELM_ENTRY_DATA_GET(data, sd);
3685 int new_pos = edje_object_part_text_cursor_pos_get
3686 (sd->entry_edje, "elm.text", EDJE_CURSOR_MAIN);
3687 if (sd->cursor_pos != new_pos)
3689 sd->cursor_pos = new_pos;
3690 sd->cur_changed = EINA_TRUE;
3692 _cursor_geometry_recalc(data);
3693 // TIZEN ONY - START
3694 if (elm_widget_focus_get(data))
3695 edje_object_signal_emit(sd->entry_edje, "elm,action,show,cursor", "elm");
3700 _entry_cursor_changed_manual_signal_cb(void *data,
3701 Evas_Object *obj __UNUSED__,
3702 const char *emission __UNUSED__,
3703 const char *source __UNUSED__)
3705 ELM_ENTRY_DATA_GET(data, sd);
3706 evas_object_smart_callback_call(data, SIG_CURSOR_CHANGED_MANUAL, NULL);
3707 // TIZEN ONY - START
3708 if (elm_widget_focus_get(data))
3709 edje_object_signal_emit(sd->entry_edje, "elm,action,show,cursor", "elm");
3714 _signal_anchor_geoms_do_things_with_lol(Elm_Entry_Smart_Data *sd,
3715 Elm_Entry_Anchor_Info *ei)
3717 Evas_Textblock_Rectangle *r;
3718 const Eina_List *geoms, *l;
3719 Evas_Coord px, py, x, y;
3721 geoms = edje_object_part_text_anchor_geometry_get
3722 (sd->entry_edje, "elm.text", ei->name);
3726 evas_object_geometry_get(sd->entry_edje, &x, &y, NULL, NULL);
3727 evas_pointer_canvas_xy_get
3728 (evas_object_evas_get(sd->entry_edje), &px, &py);
3730 EINA_LIST_FOREACH(geoms, l, r)
3732 if (((r->x + x) <= px) && ((r->y + y) <= py) &&
3733 ((r->x + x + r->w) > px) && ((r->y + y + r->h) > py))
3745 _entry_anchor_down_signal_cb(void *data,
3746 Evas_Object *obj __UNUSED__,
3747 const char *emission __UNUSED__,
3748 const char *source __UNUSED__)
3750 Elm_Entry_Anchor_Info ei;
3754 ELM_ENTRY_DATA_GET(data, sd);
3756 p = emission + sizeof("nchor,mouse,down,");
3757 ei.button = strtol(p, &p2, 10);
3759 ei.x = ei.y = ei.w = ei.h = 0;
3761 _signal_anchor_geoms_do_things_with_lol(sd, &ei);
3764 evas_object_smart_callback_call(data, SIG_ANCHOR_DOWN, &ei);
3768 _entry_anchor_up_signal_cb(void *data,
3769 Evas_Object *obj __UNUSED__,
3770 const char *emission __UNUSED__,
3771 const char *source __UNUSED__)
3773 Elm_Entry_Anchor_Info ei;
3777 ELM_ENTRY_DATA_GET(data, sd);
3779 p = emission + sizeof("nchor,mouse,up,");
3780 ei.button = strtol(p, &p2, 10);
3782 ei.x = ei.y = ei.w = ei.h = 0;
3784 _signal_anchor_geoms_do_things_with_lol(sd, &ei);
3787 evas_object_smart_callback_call(data, SIG_ANCHOR_UP, &ei);
3791 _anchor_hover_del_cb(void *data,
3793 Evas_Object *obj __UNUSED__,
3794 void *event_info __UNUSED__)
3796 ELM_ENTRY_DATA_GET(data, sd);
3798 if (sd->anchor_hover.pop) evas_object_del(sd->anchor_hover.pop);
3799 sd->anchor_hover.pop = NULL;
3800 evas_object_event_callback_del_full
3801 (sd->anchor_hover.hover, EVAS_CALLBACK_DEL, _anchor_hover_del_cb, obj);
3805 _anchor_hover_clicked_cb(void *data,
3806 Evas_Object *obj __UNUSED__,
3807 void *event_info __UNUSED__)
3809 elm_entry_anchor_hover_end(data);
3813 _entry_hover_anchor_clicked_do(Evas_Object *obj,
3814 Elm_Entry_Anchor_Info *info)
3816 Evas_Object *hover_parent;
3817 Evas_Coord x, w, y, h, px, py;
3818 Elm_Entry_Anchor_Hover_Info ei;
3820 ELM_ENTRY_DATA_GET(obj, sd);
3822 ei.anchor_info = info;
3824 sd->anchor_hover.pop = elm_icon_add(obj);
3825 evas_object_move(sd->anchor_hover.pop, info->x, info->y);
3826 evas_object_resize(sd->anchor_hover.pop, info->w, info->h);
3828 sd->anchor_hover.hover = elm_hover_add(obj);
3829 evas_object_event_callback_add
3830 (sd->anchor_hover.hover, EVAS_CALLBACK_DEL, _anchor_hover_del_cb, obj);
3831 elm_widget_mirrored_set
3832 (sd->anchor_hover.hover, elm_widget_mirrored_get(obj));
3833 if (sd->anchor_hover.hover_style)
3834 elm_object_style_set
3835 (sd->anchor_hover.hover, sd->anchor_hover.hover_style);
3837 hover_parent = sd->anchor_hover.hover_parent;
3838 if (!hover_parent) hover_parent = obj;
3839 elm_hover_parent_set(sd->anchor_hover.hover, hover_parent);
3840 elm_hover_target_set(sd->anchor_hover.hover, sd->anchor_hover.pop);
3841 ei.hover = sd->anchor_hover.hover;
3843 evas_object_geometry_get(hover_parent, &x, &y, &w, &h);
3844 ei.hover_parent.x = x;
3845 ei.hover_parent.y = y;
3846 ei.hover_parent.w = w;
3847 ei.hover_parent.h = h;
3848 px = info->x + (info->w / 2);
3849 py = info->y + (info->h / 2);
3851 if (px < (x + (w / 3))) ei.hover_left = 0;
3853 if (px > (x + ((w * 2) / 3))) ei.hover_right = 0;
3855 if (py < (y + (h / 3))) ei.hover_top = 0;
3856 ei.hover_bottom = 1;
3857 if (py > (y + ((h * 2) / 3))) ei.hover_bottom = 0;
3859 /* Swap right and left because they switch sides in RTL */
3860 if (elm_widget_mirrored_get(sd->anchor_hover.hover))
3862 Eina_Bool tmp = ei.hover_left;
3864 ei.hover_left = ei.hover_right;
3865 ei.hover_right = tmp;
3868 evas_object_smart_callback_call(obj, SIG_ANCHOR_HOVER_OPENED, &ei);
3869 evas_object_smart_callback_add
3870 (sd->anchor_hover.hover, "clicked", _anchor_hover_clicked_cb, obj);
3872 /* FIXME: Should just check if there's any callback registered to
3873 * the smart events instead. This is used to determine if anyone
3874 * cares about the hover or not. */
3875 if (!elm_layout_content_get(sd->anchor_hover.hover, "middle") &&
3876 !elm_layout_content_get(sd->anchor_hover.hover, "left") &&
3877 !elm_layout_content_get(sd->anchor_hover.hover, "right") &&
3878 !elm_layout_content_get(sd->anchor_hover.hover, "top") &&
3879 !elm_layout_content_get(sd->anchor_hover.hover, "bottom"))
3881 evas_object_del(sd->anchor_hover.hover);
3882 sd->anchor_hover.hover = NULL;
3885 evas_object_show(sd->anchor_hover.hover);
3889 _entry_anchor_clicked_signal_cb(void *data,
3890 Evas_Object *obj __UNUSED__,
3891 const char *emission,
3892 const char *source __UNUSED__)
3894 Elm_Entry_Anchor_Info ei;
3898 ELM_ENTRY_DATA_GET(data, sd);
3900 p = emission + sizeof("nchor,mouse,clicked,");
3901 ei.button = strtol(p, &p2, 10);
3903 ei.x = ei.y = ei.w = ei.h = 0;
3905 _signal_anchor_geoms_do_things_with_lol(sd, &ei);
3909 evas_object_smart_callback_call(data, SIG_ANCHOR_CLICKED, &ei);
3911 _entry_hover_anchor_clicked_do(data, &ei);
3916 _entry_anchor_move_signal_cb(void *data __UNUSED__,
3917 Evas_Object *obj __UNUSED__,
3918 const char *emission __UNUSED__,
3919 const char *source __UNUSED__)
3924 _entry_anchor_in_signal_cb(void *data,
3925 Evas_Object *obj __UNUSED__,
3926 const char *emission __UNUSED__,
3927 const char *source __UNUSED__)
3929 Elm_Entry_Anchor_Info ei;
3931 ELM_ENTRY_DATA_GET(data, sd);
3933 ei.name = emission + sizeof("nchor,mouse,in,");
3935 ei.x = ei.y = ei.w = ei.h = 0;
3937 _signal_anchor_geoms_do_things_with_lol(sd, &ei);
3940 evas_object_smart_callback_call(data, SIG_ANCHOR_IN, &ei);
3944 _entry_anchor_out_signal_cb(void *data,
3945 Evas_Object *obj __UNUSED__,
3946 const char *emission __UNUSED__,
3947 const char *source __UNUSED__)
3949 Elm_Entry_Anchor_Info ei;
3951 ELM_ENTRY_DATA_GET(data, sd);
3953 ei.name = emission + sizeof("nchor,mouse,out,");
3955 ei.x = ei.y = ei.w = ei.h = 0;
3957 _signal_anchor_geoms_do_things_with_lol(sd, &ei);
3960 evas_object_smart_callback_call(data, SIG_ANCHOR_OUT, &ei);
3964 _entry_key_enter_signal_cb(void *data,
3965 Evas_Object *obj __UNUSED__,
3966 const char *emission __UNUSED__,
3967 const char *source __UNUSED__)
3969 evas_object_smart_callback_call(data, SIG_ACTIVATED, NULL);
3973 _entry_key_escape_signal_cb(void *data,
3974 Evas_Object *obj __UNUSED__,
3975 const char *emission __UNUSED__,
3976 const char *source __UNUSED__)
3978 evas_object_smart_callback_call(data, SIG_ABORTED, NULL);
3982 _entry_mouse_down_signal_cb(void *data,
3983 Evas_Object *obj __UNUSED__,
3984 const char *emission __UNUSED__,
3985 const char *source __UNUSED__)
3988 ELM_ENTRY_DATA_GET(data, sd);
3989 sd->double_clicked = EINA_FALSE;
3991 evas_object_smart_callback_call(data, SIG_PRESS, NULL);
3995 _entry_mouse_clicked_signal_cb(void *data,
3996 Evas_Object *obj __UNUSED__,
3997 const char *emission __UNUSED__,
3998 const char *source __UNUSED__)
4000 evas_object_smart_callback_call(data, SIG_CLICKED, NULL);
4004 _entry_mouse_double_signal_cb(void *data,
4005 Evas_Object *obj __UNUSED__,
4006 const char *emission __UNUSED__,
4007 const char *source __UNUSED__)
4010 ELM_ENTRY_DATA_GET(data, sd);
4011 if (sd->disabled) return;
4012 sd->double_clicked = EINA_TRUE;
4013 if (!sd->sel_allow) return;
4015 if (!_elm_config->desktop_entry)
4016 edje_object_part_text_select_allow_set
4017 (sd->entry_edje, "elm.text", EINA_TRUE);
4018 _magnifier_hide(data);
4019 #ifndef ELM_FEATURE_WEARABLE
4023 evas_object_smart_callback_call(data, SIG_CLICKED_DOUBLE, NULL);
4027 _entry_mouse_triple_signal_cb(void *data,
4028 Evas_Object *obj __UNUSED__,
4029 const char *emission __UNUSED__,
4030 const char *source __UNUSED__)
4033 ELM_ENTRY_DATA_GET(data, sd);
4034 if (sd->disabled) return;
4035 sd->double_clicked = EINA_TRUE;
4036 if (!sd->sel_allow) return;
4038 if (!_elm_config->desktop_entry)
4039 edje_object_part_text_select_allow_set
4040 (sd->entry_edje, "elm.text", EINA_TRUE);
4041 _magnifier_hide(data);
4042 #ifndef ELM_FEATURE_WEARABLE
4046 evas_object_smart_callback_call(data, SIG_CLICKED_TRIPLE, NULL);
4049 #ifdef HAVE_ELEMENTARY_X
4051 _event_selection_notify(void *data,
4052 int type __UNUSED__,
4055 Ecore_X_Event_Selection_Notify *ev = event;
4057 ELM_ENTRY_DATA_GET(data, sd);
4059 if ((!sd->selection_asked) && (!sd->drag_selection_asked))
4060 return ECORE_CALLBACK_PASS_ON;
4062 if ((ev->selection == ECORE_X_SELECTION_CLIPBOARD) ||
4063 (ev->selection == ECORE_X_SELECTION_PRIMARY))
4065 Ecore_X_Selection_Data_Text *text_data;
4067 text_data = ev->data;
4068 if (text_data->data.content == ECORE_X_SELECTION_CONTENT_TEXT)
4070 if (text_data->text)
4072 char *txt = _elm_util_text_to_mkup(text_data->text);
4076 elm_entry_entry_insert(data, txt);
4081 sd->selection_asked = EINA_FALSE;
4083 else if (ev->selection == ECORE_X_SELECTION_XDND)
4085 Ecore_X_Selection_Data_Text *text_data;
4087 text_data = ev->data;
4088 if (text_data->data.content == ECORE_X_SELECTION_CONTENT_TEXT)
4090 if (text_data->text)
4092 char *txt = _elm_util_text_to_mkup(text_data->text);
4096 /* Massive FIXME: this should be at the drag point */
4097 elm_entry_entry_insert(data, txt);
4102 sd->drag_selection_asked = EINA_FALSE;
4104 ecore_x_dnd_send_finished();
4107 return ECORE_CALLBACK_PASS_ON;
4111 _event_selection_clear(void *data __UNUSED__,
4112 int type __UNUSED__,
4113 void *event __UNUSED__)
4116 Ecore_X_Event_Selection_Clear *ev = event;
4118 ELM_ENTRY_DATA_GET(data, sd);
4120 if (!sd->have_selection) return ECORE_CALLBACK_PASS_ON;
4121 if ((ev->selection == ECORE_X_SELECTION_CLIPBOARD) ||
4122 (ev->selection == ECORE_X_SELECTION_PRIMARY))
4124 elm_entry_select_none(data);
4128 Evas_Object *top = elm_widget_top_get(data);
4129 Ecore_X_Event_Selection_Clear *ev = event;
4132 return ECORE_CALLBACK_PASS_ON;
4134 if (ev->selection != ECORE_X_SELECTION_SECONDARY)
4136 return ECORE_CALLBACK_PASS_ON;
4139 if (elm_widget_focus_get(data))
4141 ELM_ENTRY_DATA_GET(data, sd);
4142 Elm_Sel_Format formats = ELM_SEL_FORMAT_MARKUP;
4143 evas_object_smart_callback_call(data, SIG_SELECTION_PASTE, NULL);
4144 if (sd->cnp_mode == ELM_CNP_MODE_PLAINTEXT)
4145 formats = ELM_SEL_FORMAT_TEXT;
4146 else if (sd->cnp_mode != ELM_CNP_MODE_NO_IMAGE)
4147 formats |= ELM_SEL_FORMAT_IMAGE;
4148 elm_cnp_selection_get(data, ELM_SEL_TYPE_SECONDARY, formats, NULL, NULL);
4150 return ECORE_CALLBACK_DONE;
4154 return ECORE_CALLBACK_PASS_ON;
4158 _dnd_enter_cb(void *data,
4159 Evas_Object *obj __UNUSED__)
4161 elm_object_focus_set(data, EINA_TRUE);
4165 _dnd_leave_cb(void *data,
4166 Evas_Object *obji __UNUSED__)
4168 elm_object_focus_set(data, EINA_FALSE);
4172 _dnd_pos_cb(void *data, Evas_Object *obj __UNUSED__, Evas_Coord x, Evas_Coord y,
4173 Elm_Xdnd_Action action EINA_UNUSED)
4175 elm_object_focus_set(data, EINA_TRUE);
4177 ELM_ENTRY_DATA_GET(data, sd);
4179 edje_object_part_text_cursor_coord_set
4180 (sd->entry_edje, "elm.text", EDJE_CURSOR_USER, x, y);
4181 int pos = edje_object_part_text_cursor_pos_get
4182 (sd->entry_edje, "elm.text", EDJE_CURSOR_USER);
4183 elm_entry_cursor_pos_set(data, pos);
4188 static Evas_Object *
4189 _item_get(void *data,
4190 Evas_Object *edje __UNUSED__,
4191 const char *part __UNUSED__,
4196 Elm_Entry_Item_Provider *ip;
4198 ELM_ENTRY_DATA_GET(data, sd);
4200 EINA_LIST_FOREACH(sd->item_providers, l, ip)
4202 o = ip->func(ip->data, data, item);
4205 if (!strncmp(item, "file://", 7))
4207 const char *fname = item + 7;
4209 o = evas_object_image_filled_add(evas_object_evas_get(data));
4210 evas_object_image_file_set(o, fname, NULL);
4211 if (evas_object_image_load_error_get(o) == EVAS_LOAD_ERROR_NONE)
4213 evas_object_show(o);
4218 o = evas_object_rectangle_add(evas_object_evas_get(data));
4219 evas_object_color_set(o, 0, 0, 0, 0);
4224 o = edje_object_add(evas_object_evas_get(data));
4225 if (!elm_widget_theme_object_set
4226 (data, o, "entry", item, elm_widget_style_get(data)))
4229 o = evas_object_rectangle_add(evas_object_evas_get(data));
4230 evas_object_color_set(o, 0, 0, 0, 0);
4236 _text_filter_cb(void *data,
4237 Evas_Object *edje __UNUSED__,
4238 const char *part __UNUSED__,
4239 Edje_Text_Filter_Type type,
4243 Elm_Entry_Markup_Filter *tf;
4245 ELM_ENTRY_DATA_GET(data, sd);
4247 if (type == EDJE_TEXT_FILTER_FORMAT)
4250 EINA_LIST_FOREACH(sd->text_filters, l, tf)
4252 tf->func(tf->data, data, text);
4259 _markup_filter_cb(void *data,
4260 Evas_Object *edje __UNUSED__,
4261 const char *part __UNUSED__,
4265 Elm_Entry_Markup_Filter *tf;
4267 ELM_ENTRY_DATA_GET(data, sd);
4269 EINA_LIST_FOREACH(sd->markup_filters, l, tf)
4271 tf->func(tf->data, data, text);
4277 /* This function is used to insert text by chunks in jobs */
4279 _text_append_idler(void *data)
4283 Evas_Object *obj = (Evas_Object *)data;
4285 ELM_ENTRY_DATA_GET(obj, sd);
4287 evas_event_freeze(evas_object_evas_get(obj));
4288 if (sd->text) eina_stringshare_del(sd->text);
4291 if (sd->password_text) eina_stringshare_del(sd->password_text);
4292 sd->password_text = NULL;
4294 sd->changed = EINA_TRUE;
4296 start = sd->append_text_position;
4297 if ((start + _CHUNK_SIZE) < sd->append_text_len)
4300 int tag_start, esc_start;
4302 tag_start = esc_start = -1;
4303 /* Find proper markup cut place */
4304 while (pos - start < _CHUNK_SIZE)
4308 eina_unicode_utf8_get_next(sd->append_text_left, &pos);
4310 if (esc_start == -1)
4313 tag_start = prev_pos;
4314 else if (tmp == '>')
4317 if (tag_start == -1)
4320 esc_start = prev_pos;
4321 else if (tmp == ';')
4328 sd->append_text_position = tag_start;
4330 else if (esc_start >= 0)
4332 sd->append_text_position = esc_start;
4336 sd->append_text_position = pos;
4341 sd->append_text_position = sd->append_text_len;
4344 backup = sd->append_text_left[sd->append_text_position];
4345 sd->append_text_left[sd->append_text_position] = '\0';
4347 edje_object_part_text_append
4348 (sd->entry_edje, "elm.text", sd->append_text_left + start);
4350 sd->append_text_left[sd->append_text_position] = backup;
4352 evas_event_thaw(evas_object_evas_get(obj));
4353 evas_event_thaw_eval(evas_object_evas_get(obj));
4355 _elm_entry_guide_update(obj, EINA_TRUE);
4357 /* If there's still more to go, renew the idler, else, cleanup */
4358 if (sd->append_text_position < sd->append_text_len)
4360 return ECORE_CALLBACK_RENEW;
4364 free(sd->append_text_left);
4365 sd->append_text_left = NULL;
4366 sd->append_text_idler = NULL;
4367 evas_object_smart_callback_call(obj, SIG_TEXT_SET_DONE, NULL);
4368 return ECORE_CALLBACK_CANCEL;
4373 _chars_add_till_limit(Evas_Object *obj,
4378 Eina_List *tag_list = NULL;
4379 int i = 0, current_len = 0;
4383 if (unit >= LENGTH_UNIT_LAST) return;
4384 // TIZEN_ONLY (20131111) : Preediting text is not allowed, either.
4385 // if (strstr(*text, "<preedit")) return;
4388 current_len = strlen(*text);
4391 int idx = 0, unit_size = 0;
4392 char *markup, *utfstr;
4394 if (*new_text == '<')
4396 while (*(new_text + idx) != '>')
4399 if (!*(new_text + idx)) break;
4401 if ((*(new_text + idx - 1) == '/') && (idx == 2))
4404 if (tag_list && eina_list_data_get(tag_list))
4406 char *tag = eina_list_data_get(tag_list);
4407 tag_list = eina_list_remove_list(tag_list, tag_list);
4411 else if (*(new_text + 1) == '/')
4414 Eina_List *l, *l_next;
4416 EINA_LIST_FOREACH_SAFE(tag_list, l, l_next, tag)
4418 if (!strncmp(new_text + 1, tag, idx))
4420 tag_list = eina_list_remove_list(tag_list, l);
4426 else if (*(new_text + idx - 1) != '/')
4430 while (*(new_text + 1 + len))
4432 if ((*(new_text + 1 + len) == ' ') ||
4433 (*(new_text + 1 + len) == '=') ||
4434 (*(new_text + 1 + len) == '>'))
4438 char *opener = malloc(len + 1);
4439 strncpy(opener, new_text + 1, len);
4441 if (!strcmp(opener, "br") || !strcmp(opener, "ps") ||
4442 !strcmp(opener, "tab"))
4445 tag_list = eina_list_prepend(tag_list, opener);
4448 else if (*new_text == '&')
4450 while (*(new_text + idx) != ';')
4453 if (!*(new_text + idx)) break;
4456 idx = evas_string_char_next_get(new_text, idx, NULL);
4457 markup = malloc(idx + 1);
4460 strncpy(markup, new_text, idx);
4462 utfstr = elm_entry_markup_to_utf8(markup);
4465 if (unit == LENGTH_UNIT_BYTE)
4466 unit_size = strlen(utfstr);
4467 else if (unit == LENGTH_UNIT_CHAR)
4468 unit_size = evas_string_char_len_get(utfstr);
4475 if (can_add < unit_size)
4479 if (elm_object_focus_get(obj))
4480 evas_object_smart_callback_call(obj, SIG_MAX_LENGTH, NULL);
4486 current_len = new_text - *text;
4487 (*text)[current_len] = 0;
4490 Eina_List *l, *l_next;
4493 Eina_Strbuf *str = eina_strbuf_new();
4494 eina_strbuf_append(str, *text);
4496 EINA_LIST_FOREACH_SAFE(tag_list, l, l_next, tag)
4498 eina_strbuf_append(str, "</");
4499 eina_strbuf_append(str, tag);
4500 eina_strbuf_append(str, ">");
4501 tag_list = eina_list_remove_list(tag_list, l);
4505 *text = eina_strbuf_string_steal(str);
4506 eina_strbuf_free(str);
4513 can_add -= unit_size;
4518 if (elm_object_focus_get(obj))
4519 evas_object_smart_callback_call(obj, SIG_MAX_LENGTH, NULL);
4523 _elm_entry_smart_signal(Evas_Object *obj,
4524 const char *emission,
4527 ELM_ENTRY_DATA_GET(obj, sd);
4528 evas_object_ref(obj);
4529 /* always pass to both edje objs */
4530 edje_object_signal_emit(sd->entry_edje, emission, source);
4531 edje_object_message_signal_process(sd->entry_edje);
4535 edje_object_signal_emit(sd->scr_edje, emission, source);
4536 edje_object_message_signal_process(sd->scr_edje);
4539 // REDWOOD ONLY (140617): Support setting mgf bg from application
4540 if (!strcmp(emission, "elm,mgf,bg,color"))
4542 char **arr = eina_str_split(source, ",", 0);
4544 for (i = 0; arr[i]; i++)
4549 sd->mgf_r = atoi(arr[i]);
4552 sd->mgf_g = atoi(arr[i]);
4555 sd->mgf_b = atoi(arr[i]);
4558 sd->mgf_a = atoi(arr[i]);
4564 sd->mgf_bg_color_set = EINA_TRUE;
4568 sd->mgf_bg_color_set = EINA_FALSE;
4572 evas_object_unref(obj);
4576 _elm_entry_smart_callback_add(Evas_Object *obj,
4577 const char *emission,
4579 Edje_Signal_Cb func_cb,
4584 ELM_ENTRY_DATA_GET(obj, sd);
4586 ro = ELM_WIDGET_DATA(sd)->resize_obj;
4588 ELM_WIDGET_DATA(sd)->resize_obj = sd->entry_edje;
4590 ELM_LAYOUT_CLASS(_elm_entry_parent_sc)->callback_add
4591 (obj, emission, source, func_cb, data);
4595 ELM_WIDGET_DATA(sd)->resize_obj = sd->scr_edje;
4597 ELM_LAYOUT_CLASS(_elm_entry_parent_sc)->callback_add
4598 (obj, emission, source, func_cb, data);
4601 ELM_WIDGET_DATA(sd)->resize_obj = ro;
4605 _elm_entry_smart_callback_del(Evas_Object *obj,
4606 const char *emission,
4608 Edje_Signal_Cb func_cb)
4613 ELM_ENTRY_DATA_GET(obj, sd);
4615 ro = ELM_WIDGET_DATA(sd)->resize_obj;
4617 ELM_WIDGET_DATA(sd)->resize_obj = sd->entry_edje;
4619 data = ELM_LAYOUT_CLASS(_elm_entry_parent_sc)->callback_del
4620 (obj, emission, source, func_cb);
4624 ELM_WIDGET_DATA(sd)->resize_obj = sd->scr_edje;
4626 ELM_LAYOUT_CLASS(_elm_entry_parent_sc)->callback_del
4627 (obj, emission, source, func_cb);
4630 ELM_WIDGET_DATA(sd)->resize_obj = ro;
4636 _elm_entry_smart_content_set(Evas_Object *obj,
4638 Evas_Object *content)
4640 if (!ELM_CONTAINER_CLASS(_elm_entry_parent_sc)->content_set
4641 (obj, part, content))
4644 /* too bad entry does not follow the pattern
4645 * "elm,state,{icon,end},visible", we have to repeat ourselves */
4646 if (!part || !strcmp(part, "icon") || !strcmp(part, "elm.swallow.icon"))
4647 elm_entry_icon_visible_set(obj, EINA_TRUE);
4649 if (!part || !strcmp(part, "end") || !strcmp(part, "elm.swallow.end"))
4650 elm_entry_end_visible_set(obj, EINA_TRUE);
4655 static Evas_Object *
4656 _elm_entry_smart_content_unset(Evas_Object *obj,
4661 ret = ELM_CONTAINER_CLASS(_elm_entry_parent_sc)->content_unset(obj, part);
4662 if (!ret) return NULL;
4664 /* too bad entry does not follow the pattern
4665 * "elm,state,{icon,end},hidden", we have to repeat ourselves */
4666 if (!part || !strcmp(part, "icon") || !strcmp(part, "elm.swallow.icon"))
4667 elm_entry_icon_visible_set(obj, EINA_FALSE);
4669 if (!part || !strcmp(part, "end") || !strcmp(part, "elm.swallow.end"))
4670 elm_entry_end_visible_set(obj, EINA_FALSE);
4676 _elm_entry_smart_text_set(Evas_Object *obj,
4682 ELM_ENTRY_DATA_GET(obj, sd);
4684 if (!entry) entry = "";
4687 if (!strcmp(item, "guide"))
4688 edje_object_part_text_set(sd->entry_edje, "elm.guide", entry);
4690 edje_object_part_text_set(sd->entry_edje, item, entry);
4695 evas_event_freeze(evas_object_evas_get(obj));
4696 if (sd->text) eina_stringshare_del(sd->text);
4699 if (sd->password_text) eina_stringshare_del(sd->password_text);
4700 sd->password_text = NULL;
4702 sd->changed = EINA_TRUE;
4704 /* Clear currently pending job if there is one */
4705 if (sd->append_text_idler)
4707 ecore_idler_del(sd->append_text_idler);
4708 sd->append_text_idler = NULL;
4711 if (sd->append_text_left)
4713 free(sd->append_text_left);
4714 sd->append_text_left = NULL;
4717 len = strlen(entry);
4718 /* Split to ~_CHUNK_SIZE chunks */
4719 if (len > _CHUNK_SIZE)
4721 sd->append_text_left = (char *)malloc(len + 1);
4724 /* If we decided to use the idler */
4725 if (sd->append_text_left)
4727 /* Need to clear the entry first */
4728 edje_object_part_text_set(sd->entry_edje, "elm.text", "");
4729 memcpy(sd->append_text_left, entry, len);
4730 sd->append_text_left[len] = '\0';
4731 sd->append_text_position = 0;
4732 sd->append_text_len = len;
4733 sd->append_text_idler = ecore_idler_add(_text_append_idler, obj);
4737 edje_object_part_text_set(sd->entry_edje, "elm.text", entry);
4738 evas_object_smart_callback_call(obj, SIG_TEXT_SET_DONE, NULL);
4742 _elm_entry_guide_update(obj, EINA_TRUE);
4744 _elm_entry_guide_update(obj, EINA_FALSE);
4746 // TIZEN_ONLY(20140625): Support accessibility for entry anchors.
4747 _elm_entry_anchors_highlight_clear(obj);
4749 evas_event_thaw(evas_object_evas_get(obj));
4750 evas_event_thaw_eval(evas_object_evas_get(obj));
4756 _elm_entry_smart_text_get(const Evas_Object *obj,
4761 ELM_ENTRY_DATA_GET(obj, sd);
4765 if (!strcmp(item, "default")) goto proceed;
4766 else if (!strcmp(item, "guide"))
4767 return edje_object_part_text_get(sd->entry_edje, "elm.guide");
4769 return edje_object_part_text_get(sd->entry_edje, item);
4774 text = edje_object_part_text_get(sd->entry_edje, "elm.text");
4777 ERR("text=NULL for edje %p, part 'elm.text'", sd->entry_edje);
4782 if (sd->append_text_len > 0)
4787 tlen = strlen(text);
4788 len = tlen + sd->append_text_len - sd->append_text_position;
4789 tmpbuf = calloc(1, len + 1);
4792 ERR("Failed to allocate memory for entry's text %p", obj);
4795 memcpy(tmpbuf, text, tlen);
4797 if (sd->append_text_left)
4798 memcpy(tmpbuf + tlen, sd->append_text_left
4799 + sd->append_text_position, sd->append_text_len
4800 - sd->append_text_position);
4802 eina_stringshare_replace(&sd->text, tmpbuf);
4807 eina_stringshare_replace(&sd->text, text);
4814 pw_text = elm_entry_markup_to_utf8(sd->text);
4817 eina_stringshare_replace(&sd->password_text, pw_text);
4819 return sd->password_text;
4827 // TIZEN_ONLY(131221) : Customize accessiblity for editfield
4831 _access_info_cb(void *data __UNUSED__, Evas_Object *obj)
4835 ELM_ENTRY_DATA_GET(obj, sd);
4837 if ((sd->password && _elm_config->access_password_read_enable) ||
4840 txt = elm_widget_access_info_get(obj);
4842 if (!txt) txt = _elm_util_mkup_to_text(elm_entry_entry_get(obj));
4843 if (txt && (strlen(txt) > 0)) return strdup(txt);
4846 // to take care guide text
4847 txt = edje_object_part_text_get(sd->entry_edje, "elm.guide");
4848 txt = _elm_util_mkup_to_text(txt);
4849 if (txt && (strlen(txt) > 0)) return strdup(txt);
4855 _access_state_cb(void *data __UNUSED__, Evas_Object *obj)
4860 ELM_ENTRY_DATA_GET(obj, sd);
4863 buf = eina_strbuf_new();
4865 if (elm_widget_disabled_get(obj))
4866 eina_strbuf_append(buf, E_("State: Disabled"));
4870 if (!eina_strbuf_length_get(buf))
4871 eina_strbuf_append(buf, E_("State: Not Editable"));
4872 else eina_strbuf_append(buf, E_(", Not Editable"));
4875 if (!eina_strbuf_length_get(buf)) goto buf_free;
4877 ret = eina_strbuf_string_steal(buf);
4880 eina_strbuf_free(buf);
4884 /////////////////////////////////
4887 _entry_selection_callbacks_unregister(Evas_Object *obj)
4889 ELM_ENTRY_DATA_GET(obj, sd);
4891 edje_object_signal_callback_del_full
4892 (sd->entry_edje, "selection,start", "elm.text",
4893 _entry_selection_start_signal_cb, obj);
4894 edje_object_signal_callback_del_full
4895 (sd->entry_edje, "selection,changed", "elm.text",
4896 _entry_selection_changed_signal_cb, obj);
4897 edje_object_signal_callback_del_full
4898 (sd->entry_edje, "entry,selection,all,request",
4899 "elm.text", _entry_selection_all_signal_cb, obj);
4900 edje_object_signal_callback_del_full
4901 (sd->entry_edje, "entry,selection,none,request",
4902 "elm.text", _entry_selection_none_signal_cb, obj);
4903 edje_object_signal_callback_del_full
4904 (sd->entry_edje, "selection,cleared", "elm.text",
4905 _entry_selection_cleared_signal_cb, obj);
4906 edje_object_signal_callback_del_full
4907 (sd->entry_edje, "entry,paste,request,*", "elm.text",
4908 _entry_paste_request_signal_cb, obj);
4909 edje_object_signal_callback_del_full
4910 (sd->entry_edje, "entry,copy,notify", "elm.text",
4911 _entry_copy_notify_signal_cb, obj);
4912 edje_object_signal_callback_del_full
4913 (sd->entry_edje, "entry,cut,notify", "elm.text",
4914 _entry_cut_notify_signal_cb, obj);
4918 _entry_selection_callbacks_register(Evas_Object *obj)
4920 ELM_ENTRY_DATA_GET(obj, sd);
4922 edje_object_signal_callback_add
4923 (sd->entry_edje, "selection,start", "elm.text",
4924 _entry_selection_start_signal_cb, obj);
4925 edje_object_signal_callback_add
4926 (sd->entry_edje, "selection,changed", "elm.text",
4927 _entry_selection_changed_signal_cb, obj);
4928 edje_object_signal_callback_add
4929 (sd->entry_edje, "entry,selection,all,request",
4930 "elm.text", _entry_selection_all_signal_cb, obj);
4931 edje_object_signal_callback_add
4932 (sd->entry_edje, "entry,selection,none,request",
4933 "elm.text", _entry_selection_none_signal_cb, obj);
4934 edje_object_signal_callback_add
4935 (sd->entry_edje, "selection,cleared", "elm.text",
4936 _entry_selection_cleared_signal_cb, obj);
4937 edje_object_signal_callback_add
4938 (sd->entry_edje, "entry,paste,request,*", "elm.text",
4939 _entry_paste_request_signal_cb, obj);
4940 edje_object_signal_callback_add
4941 (sd->entry_edje, "entry,copy,notify", "elm.text",
4942 _entry_copy_notify_signal_cb, obj);
4943 edje_object_signal_callback_add
4944 (sd->entry_edje, "entry,cut,notify", "elm.text",
4945 _entry_cut_notify_signal_cb, obj);
4949 _resize_cb(void *data,
4951 Evas_Object *obj __UNUSED__,
4952 void *event_info __UNUSED__)
4954 ELM_ENTRY_DATA_GET(data, sd);
4958 elm_layout_sizing_eval(data);
4960 else if (sd->scroll)
4962 Evas_Coord vw = 0, vh = 0;
4964 sd->s_iface->content_viewport_size_get(data, &vw, &vh);
4965 if (vw < sd->ent_mw) vw = sd->ent_mw;
4966 if (vh < sd->ent_mh) vh = sd->ent_mh;
4967 evas_object_resize(sd->entry_edje, vw, vh);
4970 if (sd->hoversel) _hoversel_position(data);
4973 if (!_elm_config->desktop_entry)
4975 if (sd->region_get_job) ecore_job_del(sd->region_get_job);
4976 sd->region_get_job = ecore_job_add(_region_get_job, data);
4978 if (sd->magnifier_showing)
4979 _magnifier_move(data);
4985 _elm_entry_smart_add(Evas_Object *obj)
4987 EVAS_SMART_DATA_ALLOC(obj, Elm_Entry_Smart_Data);
4989 ELM_WIDGET_CLASS(_elm_entry_parent_sc)->base.add(obj);
4993 _elm_entry_smart_del(Evas_Object *obj)
4995 Elm_Entry_Context_Menu_Item *it;
4996 Elm_Entry_Item_Provider *ip;
4997 Elm_Entry_Markup_Filter *tf;
4998 // TIZEN_ONLY(20140625): Add elm_entry_anchor_access_provider_* APIs.
4999 Elm_Entry_Anchor_Access_Provider *ap;
5002 ELM_ENTRY_DATA_GET(obj, sd);
5004 if (sd->delay_write)
5006 ecore_timer_del(sd->delay_write);
5007 sd->delay_write = NULL;
5008 if (sd->auto_save) _save_do(obj);
5011 // TIZEN ONLY(131106): Add rectangle for processing mouse up event on paddings inside of entry.
5014 evas_object_del(sd->event_rect);
5015 sd->event_rect = NULL;
5019 sd->s_iface->content_viewport_resize_cb_set(obj, NULL);
5021 // TIZEN_ONLY(20140625): Support accessibility for entry anchors.
5022 _elm_entry_anchors_highlight_clear(obj);
5025 elm_entry_anchor_hover_end(obj);
5026 elm_entry_anchor_hover_parent_set(obj, NULL);
5028 evas_event_freeze(evas_object_evas_get(obj));
5030 if (sd->file) eina_stringshare_del(sd->file);
5032 if (sd->hov_deljob) ecore_job_del(sd->hov_deljob);
5033 if ((sd->api) && (sd->api->obj_unhook))
5034 sd->api->obj_unhook(obj); // module - unhook
5036 entries = eina_list_remove(entries, obj);
5037 #ifdef HAVE_ELEMENTARY_X
5038 if (sd->sel_notify_handler)
5039 ecore_event_handler_del(sd->sel_notify_handler);
5040 if (sd->sel_clear_handler)
5041 ecore_event_handler_del(sd->sel_clear_handler);
5042 if (sd->client_msg_handler) // TIZEN ONLY
5043 ecore_event_handler_del(sd->client_msg_handler); //
5044 if (sd->prop_hdl) ecore_event_handler_del(sd->prop_hdl); // TIZEN ONLY
5046 if (sd->cut_sel) eina_stringshare_del(sd->cut_sel);
5047 if (sd->text) eina_stringshare_del(sd->text);
5048 if (sd->deferred_recalc_job)
5049 ecore_job_del(sd->deferred_recalc_job);
5050 if (sd->append_text_idler)
5052 ecore_idler_del(sd->append_text_idler);
5053 free(sd->append_text_left);
5054 sd->append_text_left = NULL;
5055 sd->append_text_idler = NULL;
5057 if (sd->longpress_timer) ecore_timer_del(sd->longpress_timer);
5058 EINA_LIST_FREE (sd->items, it)
5060 eina_stringshare_del(it->label);
5061 eina_stringshare_del(it->icon_file);
5062 eina_stringshare_del(it->icon_group);
5065 EINA_LIST_FREE (sd->item_providers, ip)
5069 EINA_LIST_FREE (sd->text_filters, tf)
5073 EINA_LIST_FREE (sd->markup_filters, tf)
5077 // TIZEN_ONLY(20140625): Add elm_entry_anchor_access_provider_* APIs.
5078 EINA_LIST_FREE (sd->anchor_access_providers, ap)
5083 if (sd->delay_write) ecore_timer_del(sd->delay_write);
5084 if (sd->input_panel_imdata) free(sd->input_panel_imdata);
5086 if (sd->anchor_hover.hover_style)
5087 eina_stringshare_del(sd->anchor_hover.hover_style);
5090 if (sd->password_text) eina_stringshare_del(sd->password_text);
5091 if (sd->region_get_job) ecore_job_del(sd->region_get_job);
5092 if (sd->region_recalc_job) ecore_job_del(sd->region_recalc_job);
5093 if (sd->mgf_proxy) evas_object_del(sd->mgf_proxy);
5094 if (sd->mgf_bg) evas_object_del(sd->mgf_bg);
5096 evas_event_thaw(evas_object_evas_get(obj));
5097 evas_event_thaw_eval(evas_object_evas_get(obj));
5099 ELM_WIDGET_CLASS(_elm_entry_parent_sc)->base.del(obj);
5103 _elm_entry_smart_move(Evas_Object *obj,
5107 ELM_ENTRY_DATA_GET(obj, sd);
5109 ELM_WIDGET_CLASS(_elm_entry_parent_sc)->base.move(obj, x, y);
5111 evas_object_move(sd->hit_rect, x, y);
5113 if (sd->hoversel) _hoversel_position(obj);
5116 if (!_elm_config->desktop_entry)
5118 if (sd->region_get_job) ecore_job_del(sd->region_get_job);
5119 sd->region_get_job = ecore_job_add(_region_get_job, obj);
5125 _elm_entry_smart_resize(Evas_Object *obj,
5129 ELM_ENTRY_DATA_GET(obj, sd);
5131 ELM_WIDGET_CLASS(_elm_entry_parent_sc)->base.resize(obj, w, h);
5133 evas_object_resize(sd->hit_rect, w, h);
5137 _elm_entry_smart_member_add(Evas_Object *obj,
5138 Evas_Object *member)
5140 ELM_ENTRY_DATA_GET(obj, sd);
5142 ELM_WIDGET_CLASS(_elm_entry_parent_sc)->base.member_add(obj, member);
5145 evas_object_raise(sd->hit_rect);
5148 // TIZEN_ONLY(131221) : Customize accessiblity for editfield
5152 _elm_entry_smart_activate(Evas_Object *obj, Elm_Activate act)
5154 if (act != ELM_ACTIVATE_DEFAULT) return EINA_FALSE;
5156 ELM_ENTRY_DATA_GET(obj, sd);
5158 if (!elm_widget_disabled_get(obj) &&
5159 !evas_object_freeze_events_get(obj))
5161 evas_object_smart_callback_call(obj, SIG_CLICKED, NULL);
5162 if (sd->editable && sd->input_panel_enable)
5163 edje_object_part_text_input_panel_show(sd->entry_edje, "elm.text");
5168 ////////////////////
5171 _elm_entry_smart_set_user(Elm_Entry_Smart_Class *sc)
5173 ELM_WIDGET_CLASS(sc)->base.add = _elm_entry_smart_add;
5174 ELM_WIDGET_CLASS(sc)->base.del = _elm_entry_smart_del;
5175 ELM_WIDGET_CLASS(sc)->base.move = _elm_entry_smart_move;
5176 ELM_WIDGET_CLASS(sc)->base.resize = _elm_entry_smart_resize;
5177 ELM_WIDGET_CLASS(sc)->base.member_add = _elm_entry_smart_member_add;
5179 ELM_WIDGET_CLASS(sc)->on_focus_region = _elm_entry_smart_on_focus_region;
5180 ELM_WIDGET_CLASS(sc)->sub_object_del = _elm_entry_smart_sub_object_del;
5181 ELM_WIDGET_CLASS(sc)->on_focus = _elm_entry_smart_on_focus;
5182 ELM_WIDGET_CLASS(sc)->theme = _elm_entry_smart_theme;
5183 ELM_WIDGET_CLASS(sc)->disable = _elm_entry_smart_disable;
5184 ELM_WIDGET_CLASS(sc)->translate = _elm_entry_smart_translate;
5185 // TIZEN_ONLY(131221) : Customize accessiblity for editfield
5186 //ELM_WIDGET_CLASS(sc)->activate = _elm_entry_smart_activate;
5187 ELM_WIDGET_CLASS(sc)->activate = NULL;
5188 ELM_WIDGET_CLASS(sc)->access = _elm_entry_smart_access;
5191 /* not a 'focus chain manager' */
5192 // TIZEN_ONLY(131221) : Customize accessiblity for editfield
5193 //ELM_WIDGET_CLASS(sc)->focus_next = NULL;
5194 ELM_WIDGET_CLASS(sc)->focus_next = _elm_entry_smart_focus_next;
5196 ELM_WIDGET_CLASS(sc)->focus_direction_manager_is = NULL;
5197 ELM_WIDGET_CLASS(sc)->focus_direction = NULL;
5199 ELM_CONTAINER_CLASS(sc)->content_set = _elm_entry_smart_content_set;
5200 ELM_CONTAINER_CLASS(sc)->content_unset = _elm_entry_smart_content_unset;
5202 ELM_LAYOUT_CLASS(sc)->signal = _elm_entry_smart_signal;
5203 ELM_LAYOUT_CLASS(sc)->callback_add = _elm_entry_smart_callback_add;
5204 ELM_LAYOUT_CLASS(sc)->callback_del = _elm_entry_smart_callback_del;
5205 ELM_LAYOUT_CLASS(sc)->text_set = _elm_entry_smart_text_set;
5206 ELM_LAYOUT_CLASS(sc)->text_get = _elm_entry_smart_text_get;
5207 ELM_LAYOUT_CLASS(sc)->sizing_eval = _elm_entry_smart_sizing_eval;
5208 ELM_LAYOUT_CLASS(sc)->content_aliases = _content_aliases;
5211 EAPI const Elm_Entry_Smart_Class *
5212 elm_entry_smart_class_get(void)
5214 static Elm_Entry_Smart_Class _sc =
5215 ELM_ENTRY_SMART_CLASS_INIT_NAME_VERSION(ELM_ENTRY_SMART_NAME);
5216 static const Elm_Entry_Smart_Class *class = NULL;
5217 Evas_Smart_Class *esc = (Evas_Smart_Class *)&_sc;
5222 _elm_entry_smart_set(&_sc);
5223 esc->callbacks = _smart_callbacks;
5230 elm_entry_add(Evas_Object *parent)
5234 #ifdef HAVE_ELEMENTARY_X
5238 EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL);
5240 obj = elm_widget_add(_elm_entry_smart_class_new(), parent);
5241 if (!obj) return NULL;
5243 if (!elm_widget_sub_object_add(parent, obj))
5244 ERR("could not add %p as sub object of %p", obj, parent);
5246 ELM_ENTRY_DATA_GET(obj, sd);
5248 sd->entry_edje = ELM_WIDGET_DATA(sd)->resize_obj;
5250 sd->cnp_mode = ELM_CNP_MODE_MARKUP;
5251 sd->line_wrap = ELM_WRAP_WORD;
5252 sd->context_menu = EINA_TRUE;
5253 sd->disabled = EINA_FALSE;
5254 sd->auto_save = EINA_TRUE;
5255 sd->editable = EINA_TRUE;
5256 sd->scroll = EINA_FALSE;
5258 sd->input_panel_imdata = NULL;
5260 sd->magnifier_enabled = EINA_TRUE;
5261 #ifdef ELM_FEATURE_WEARABLE
5262 sd->drag_enabled = EINA_FALSE;
5263 sd->drop_enabled = EINA_FALSE;
5265 sd->drag_enabled = EINA_TRUE;
5266 sd->drop_enabled = EINA_TRUE;
5268 sd->mouse_upped = EINA_FALSE;
5269 sd->append_text_idler = NULL;
5270 sd->append_text_left = NULL;
5271 #ifdef ELM_FEATURE_WEARABLE
5272 sd->sel_allow = EINA_FALSE;
5274 sd->sel_allow = EINA_TRUE;
5276 sd->cursor_handler_disabled = EINA_FALSE;
5277 sd->scroll_holding = EINA_FALSE;
5279 // TIZEN_ONLY(20140625): Support accessibility for entry anchors.
5280 sd->anchor_highlight_rect = NULL;
5281 sd->anchor_highlight_pos = -1;
5283 // TIZEN_ONLY(20140625): Add elm_entry_anchor_access_provider_* APIs.
5284 sd->anchor_access_providers = NULL;
5287 #ifdef HAVE_ELEMENTARY_X
5288 sd->drop_format = ELM_SEL_FORMAT_MARKUP | ELM_SEL_FORMAT_IMAGE;
5289 elm_drop_target_add(obj, sd->drop_format,
5293 _drag_drop_cb, NULL);
5294 sd->drop_added = EINA_TRUE;
5296 elm_layout_theme_set(obj, "entry", "base", elm_widget_style_get(obj));
5298 sd->hit_rect = evas_object_rectangle_add(evas_object_evas_get(obj));
5299 evas_object_data_set(sd->hit_rect, "_elm_leaveme", obj);
5300 //TODO: Need to check why clipping is not happening when adding hit_rect as smart member of obj
5301 //evas_object_smart_member_add(sd->hit_rect, obj);
5302 evas_object_smart_member_add(sd->hit_rect, sd->entry_edje);
5303 elm_widget_sub_object_add(obj, sd->hit_rect);
5305 /* common scroller hit rectangle setup */
5306 evas_object_color_set(sd->hit_rect, 0, 0, 0, 0);
5307 evas_object_show(sd->hit_rect);
5308 evas_object_repeat_events_set(sd->hit_rect, EINA_TRUE);
5310 sd->s_iface = evas_object_smart_interface_get
5311 (obj, ELM_SCROLLABLE_IFACE_NAME);
5313 sd->s_iface->objects_set(obj, sd->entry_edje, sd->hit_rect);
5315 edje_object_item_provider_set(sd->entry_edje, _item_get, obj);
5317 edje_object_text_insert_filter_callback_add
5318 (sd->entry_edje, "elm.text", _text_filter_cb, obj);
5319 edje_object_text_markup_filter_callback_add
5320 (sd->entry_edje, "elm.text", _markup_filter_cb, obj);
5322 evas_object_event_callback_add
5323 (sd->entry_edje, EVAS_CALLBACK_MOUSE_DOWN, _mouse_down_cb, obj);
5324 evas_object_event_callback_add
5325 (sd->entry_edje, EVAS_CALLBACK_MOUSE_UP, _mouse_up_cb, obj);
5326 evas_object_event_callback_add
5327 (sd->entry_edje, EVAS_CALLBACK_MOUSE_MOVE, _mouse_move_cb, obj);
5329 /* this code can't go in smart_resize. sizing gets wrong */
5330 evas_object_event_callback_add(obj, EVAS_CALLBACK_RESIZE, _resize_cb, obj);
5332 // TIZEN_ONLY(20140625): Support accessibility for entry anchors.
5333 evas_object_event_callback_add(obj, EVAS_CALLBACK_HIDE, _elm_entry_hide_cb, obj);
5336 edje_object_signal_callback_add
5337 (sd->entry_edje, "entry,changed", "elm.text",
5338 _entry_changed_signal_cb, obj);
5339 edje_object_signal_callback_add
5340 (sd->entry_edje, "entry,changed,user", "elm.text",
5341 _entry_changed_user_signal_cb, obj);
5342 edje_object_signal_callback_add
5343 (sd->entry_edje, "preedit,changed", "elm.text",
5344 _entry_preedit_changed_signal_cb, obj);
5346 _entry_selection_callbacks_register(obj);
5348 edje_object_signal_callback_add
5349 (sd->entry_edje, "cursor,changed", "elm.text",
5350 _entry_cursor_changed_signal_cb, obj);
5351 edje_object_signal_callback_add
5352 (sd->entry_edje, "cursor,changed,manual", "elm.text",
5353 _entry_cursor_changed_manual_signal_cb, obj);
5354 edje_object_signal_callback_add
5355 (sd->entry_edje, "anchor,mouse,down,*", "elm.text",
5356 _entry_anchor_down_signal_cb, obj);
5357 edje_object_signal_callback_add
5358 (sd->entry_edje, "anchor,mouse,up,*", "elm.text",
5359 _entry_anchor_up_signal_cb, obj);
5360 edje_object_signal_callback_add
5361 (sd->entry_edje, "anchor,mouse,clicked,*", "elm.text",
5362 _entry_anchor_clicked_signal_cb, obj);
5363 edje_object_signal_callback_add
5364 (sd->entry_edje, "anchor,mouse,move,*", "elm.text",
5365 _entry_anchor_move_signal_cb, obj);
5366 edje_object_signal_callback_add
5367 (sd->entry_edje, "anchor,mouse,in,*", "elm.text",
5368 _entry_anchor_in_signal_cb, obj);
5369 edje_object_signal_callback_add
5370 (sd->entry_edje, "anchor,mouse,out,*", "elm.text",
5371 _entry_anchor_out_signal_cb, obj);
5372 edje_object_signal_callback_add
5373 (sd->entry_edje, "entry,key,enter", "elm.text",
5374 _entry_key_enter_signal_cb, obj);
5375 edje_object_signal_callback_add
5376 (sd->entry_edje, "entry,key,escape", "elm.text",
5377 _entry_key_escape_signal_cb, obj);
5378 edje_object_signal_callback_add
5379 (sd->entry_edje, "mouse,down,1", "elm.text",
5380 _entry_mouse_down_signal_cb, obj);
5381 edje_object_signal_callback_add
5382 (sd->entry_edje, "mouse,clicked,1", "elm.text",
5383 _entry_mouse_clicked_signal_cb, obj);
5384 edje_object_signal_callback_add
5385 (sd->entry_edje, "mouse,down,1,double", "elm.text",
5386 _entry_mouse_double_signal_cb, obj);
5387 edje_object_signal_callback_add
5388 (sd->entry_edje, "mouse,down,1,triple", "elm.text",
5389 _entry_mouse_triple_signal_cb, obj);
5390 edje_object_signal_callback_add
5391 (sd->entry_edje, "entry,undo,request", "elm.text",
5392 _entry_undo_request_signal_cb, obj);
5393 edje_object_signal_callback_add
5394 (sd->entry_edje, "entry,redo,request", "elm.text",
5395 _entry_redo_request_signal_cb, obj);
5398 edje_object_signal_callback_add
5399 (sd->entry_edje, "handler,move,start", "elm.text",
5400 _signal_handler_move_start_cb, obj);
5401 edje_object_signal_callback_add
5402 (sd->entry_edje, "handler,move,end", "elm.text",
5403 _signal_handler_move_end_cb, obj);
5404 edje_object_signal_callback_add
5405 (sd->entry_edje, "handler,moving", "elm.text",
5406 _signal_handler_moving_cb, obj);
5407 edje_object_signal_callback_add
5408 (sd->entry_edje, "selection,end", "elm.text",
5409 _signal_selection_end, obj);
5410 edje_object_signal_callback_add
5411 (sd->entry_edje, "long,pressed", "elm.text",
5412 _signal_long_pressed, obj);
5413 edje_object_signal_callback_add
5414 (sd->entry_edje, "magnifier,changed", "elm.text",
5415 _signal_magnifier_changed, obj);
5416 edje_object_signal_callback_add
5417 (sd->entry_edje, "cursor,handler,move,start", "elm.text",
5418 _signal_handler_move_start_cb, obj);
5419 edje_object_signal_callback_add
5420 (sd->entry_edje, "cursor,handler,move,end", "elm.text",
5421 _signal_handler_move_end_cb, obj);
5422 edje_object_signal_callback_add
5423 (sd->entry_edje, "cursor,handler,moving", "elm.text",
5424 _signal_handler_moving_cb, obj);
5425 edje_object_signal_callback_add
5426 (sd->entry_edje, "cursor,handler,clicked", "elm.text",
5427 _signal_handler_click_cb, obj);
5428 evas_object_event_callback_add(sd->entry_edje, EVAS_CALLBACK_KEY_DOWN,
5429 _elm_entry_key_down_cb, obj);
5432 elm_layout_text_set(obj, "elm.text", "");
5434 elm_object_sub_cursor_set
5435 (ELM_WIDGET_DATA(sd)->resize_obj, obj, ELM_CURSOR_XTERM);
5436 elm_widget_can_focus_set(obj, EINA_TRUE);
5437 if (_elm_config->desktop_entry)
5438 edje_object_part_text_select_allow_set
5439 (sd->entry_edje, "elm.text", EINA_TRUE);
5443 edje_object_part_text_select_allow_set(sd->entry_edje, "elm.text", EINA_FALSE);
5444 edje_object_part_text_viewport_region_set(sd->entry_edje, "elm.text", -1, -1, -1, -1);
5445 edje_object_part_text_layout_region_set(sd->entry_edje, "elm.text", -1, -1, -1, -1);
5449 elm_layout_sizing_eval(obj);
5451 elm_entry_input_panel_layout_set(obj, ELM_INPUT_PANEL_LAYOUT_NORMAL);
5452 elm_entry_input_panel_enabled_set(obj, EINA_TRUE);
5453 elm_entry_prediction_allow_set(obj, EINA_TRUE);
5454 elm_entry_input_hint_set(obj, ELM_INPUT_HINT_AUTO_COMPLETE);
5456 sd->autocapital_type = edje_object_part_text_autocapital_type_get
5457 (sd->entry_edje, "elm.text");
5459 #ifdef HAVE_ELEMENTARY_X
5460 top = elm_widget_top_get(obj);
5461 if ((top) && (elm_win_xwindow_get(top)))
5463 sd->sel_notify_handler =
5464 ecore_event_handler_add
5465 (ECORE_X_EVENT_SELECTION_NOTIFY, _event_selection_notify, obj);
5466 sd->sel_clear_handler =
5467 ecore_event_handler_add
5468 (ECORE_X_EVENT_SELECTION_CLEAR, _event_selection_clear, obj);
5471 sd->client_msg_handler = ecore_event_handler_add(ECORE_X_EVENT_CLIENT_MESSAGE, _xclient_msg_cb, obj); // TIZEN ONLY
5473 sd->prop_hdl = ecore_event_handler_add
5474 (ECORE_X_EVENT_WINDOW_PROPERTY, _on_prop_change, obj); // TIZEN ONLY
5477 entries = eina_list_prepend(entries, obj);
5479 #ifndef ELM_FEATURE_WEARABLE
5480 // module - find module for entry
5481 sd->api = _module_find(obj);
5482 // if found - hook in
5483 if ((sd->api) && (sd->api->obj_hook)) sd->api->obj_hook(obj);
5486 _mirrored_set(obj, elm_widget_mirrored_get(obj));
5488 // TIZEN_ONLY(131221): Customize accessiblity for editfield
5492 _elm_access_object_register(obj, sd->entry_edje);
5493 _elm_access_text_set
5494 (_elm_access_object_get(obj), ELM_ACCESS_TYPE, E_("Edit Field")); // TIZEN ONLY
5495 _elm_access_callback_set
5496 (_elm_access_object_get(obj), ELM_ACCESS_INFO, _access_info_cb, NULL);
5497 _elm_access_callback_set
5498 (_elm_access_object_get(obj), ELM_ACCESS_STATE, _access_state_cb, NULL);
5500 if (_elm_config->access_mode)
5501 _access_obj_process(obj, EINA_TRUE);
5502 //////////////////////////
5504 //Tizen Only: This should be removed when eo is applied.
5505 ELM_WIDGET_DATA_GET(obj, wsd);
5506 wsd->on_create = EINA_FALSE;
5512 elm_entry_text_style_user_push(Evas_Object *obj,
5515 ELM_ENTRY_CHECK(obj);
5516 ELM_ENTRY_DATA_GET(obj, sd);
5518 edje_object_part_text_style_user_push(sd->entry_edje, "elm.text", style);
5519 _elm_entry_smart_theme(obj);
5523 elm_entry_text_style_user_pop(Evas_Object *obj)
5525 ELM_ENTRY_CHECK(obj);
5526 ELM_ENTRY_DATA_GET(obj, sd);
5528 edje_object_part_text_style_user_pop(sd->entry_edje, "elm.text");
5530 _elm_entry_smart_theme(obj);
5534 elm_entry_text_style_user_peek(const Evas_Object *obj)
5536 ELM_ENTRY_CHECK(obj) NULL;
5537 ELM_ENTRY_DATA_GET(obj, sd);
5539 return edje_object_part_text_style_user_peek(sd->entry_edje, "elm.text");
5543 elm_entry_single_line_set(Evas_Object *obj,
5544 Eina_Bool single_line)
5546 ELM_ENTRY_CHECK(obj);
5547 ELM_ENTRY_DATA_GET(obj, sd);
5549 if (sd->single_line == single_line) return;
5551 sd->single_line = single_line;
5552 sd->line_wrap = ELM_WRAP_NONE;
5553 if (elm_entry_cnp_mode_get(obj) == ELM_CNP_MODE_MARKUP)
5554 elm_entry_cnp_mode_set(obj, ELM_CNP_MODE_NO_IMAGE);
5555 _elm_entry_smart_theme(obj);
5559 if (sd->single_line)
5561 sd->s_iface->policy_set
5562 (obj, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_OFF);
5563 //***************** TIZEN Only
5564 sd->s_iface->movement_block_set(obj, ELM_SCROLLER_MOVEMENT_BLOCK_VERTICAL);
5565 //****************************
5567 sd->s_iface->bounce_allow_set(obj, EINA_FALSE, EINA_FALSE);
5572 sd->s_iface->policy_set(obj, sd->policy_h, sd->policy_v);
5574 sd->s_iface->bounce_allow_set(obj, EINA_FALSE, EINA_FALSE);
5577 elm_layout_sizing_eval(obj);
5582 elm_entry_single_line_get(const Evas_Object *obj)
5584 ELM_ENTRY_CHECK(obj) EINA_FALSE;
5585 ELM_ENTRY_DATA_GET(obj, sd);
5587 return sd->single_line;
5591 elm_entry_password_set(Evas_Object *obj,
5594 ELM_ENTRY_CHECK(obj);
5595 ELM_ENTRY_DATA_GET(obj, sd);
5597 password = !!password;
5599 if (sd->password == password) return;
5600 sd->password = password;
5602 #ifdef HAVE_ELEMENTARY_X
5603 elm_drop_target_del(obj, sd->drop_format,
5607 _drag_drop_cb, NULL);
5608 sd->drop_added = EINA_FALSE;
5612 sd->single_line = EINA_TRUE;
5613 sd->line_wrap = ELM_WRAP_NONE;
5614 elm_entry_input_hint_set(obj, ((sd->input_hints & ~ELM_INPUT_HINT_AUTO_COMPLETE) | ELM_INPUT_HINT_SENSITIVE_DATA));
5615 _entry_selection_callbacks_unregister(obj);
5619 #ifdef HAVE_ELEMENTARY_X
5620 if (sd->drop_enabled)
5622 sd->drop_format = _get_drop_format(obj);
5623 elm_drop_target_add(obj, sd->drop_format,
5627 _drag_drop_cb, NULL);
5628 sd->drop_added = EINA_TRUE;
5631 elm_entry_input_hint_set(obj, ((sd->input_hints | ELM_INPUT_HINT_AUTO_COMPLETE) & ~ELM_INPUT_HINT_SENSITIVE_DATA));
5632 _entry_selection_callbacks_register(obj);
5635 _elm_entry_smart_theme(obj);
5639 elm_entry_password_get(const Evas_Object *obj)
5641 ELM_ENTRY_CHECK(obj) EINA_FALSE;
5642 ELM_ENTRY_DATA_GET(obj, sd);
5644 return sd->password;
5648 elm_entry_entry_set(Evas_Object *obj,
5651 ELM_ENTRY_CHECK(obj);
5652 _elm_entry_smart_text_set(obj, NULL, entry);
5656 elm_entry_entry_get(const Evas_Object *obj)
5658 ELM_ENTRY_CHECK(obj) NULL;
5659 return _elm_entry_smart_text_get(obj, NULL);
5663 elm_entry_entry_append(Evas_Object *obj,
5668 ELM_ENTRY_CHECK(obj);
5669 ELM_ENTRY_DATA_GET(obj, sd);
5671 if (!entry) entry = "";
5673 sd->changed = EINA_TRUE;
5675 len = strlen(entry);
5676 if (sd->append_text_left)
5680 tmpbuf = realloc(sd->append_text_left, sd->append_text_len + len + 1);
5686 sd->append_text_left = tmpbuf;
5687 memcpy(sd->append_text_left + sd->append_text_len, entry, len + 1);
5688 sd->append_text_len += len;
5692 /* FIXME: Add chunked appending here (like in entry_set) */
5693 edje_object_part_text_append(sd->entry_edje, "elm.text", entry);
5698 elm_entry_is_empty(const Evas_Object *obj)
5700 /* FIXME: until there's support for that in textblock, we just
5701 * check to see if the there is text or not. */
5702 const Evas_Object *tb;
5703 Evas_Textblock_Cursor *cur;
5706 ELM_ENTRY_CHECK(obj) EINA_TRUE;
5707 ELM_ENTRY_DATA_GET(obj, sd);
5709 /* It's a hack until we get the support suggested above. We just
5710 * create a cursor, point it to the begining, and then try to
5711 * advance it, if it can advance, the tb is not empty, otherwise it
5713 tb = edje_object_part_object_get(sd->entry_edje, "elm.text");
5715 /* This is actually, ok for the time being, these hackish stuff
5716 will be removed once evas 1.0 is out */
5717 cur = evas_object_textblock_cursor_new((Evas_Object *)tb);
5718 evas_textblock_cursor_pos_set(cur, 0);
5719 ret = evas_textblock_cursor_char_next(cur);
5720 evas_textblock_cursor_free(cur);
5723 #if 0 // TIZEN ONLY CODES : IF ABOVE CODES HAVE NO PROBLEM, THEN DELETE THESE CODES.
5724 char *str = elm_entry_markup_to_utf8(elm_entry_entry_get(obj));
5725 if (!str) return EINA_TRUE;
5727 ret = (strlen(str) == 0);
5735 elm_entry_textblock_get(Evas_Object *obj)
5737 ELM_ENTRY_CHECK(obj) NULL;
5738 ELM_ENTRY_DATA_GET(obj, sd);
5740 return (Evas_Object *)edje_object_part_object_get
5741 (sd->entry_edje, "elm.text");
5745 elm_entry_calc_force(Evas_Object *obj)
5747 ELM_ENTRY_CHECK(obj);
5748 ELM_ENTRY_DATA_GET(obj, sd);
5750 edje_object_calc_force(sd->entry_edje);
5751 sd->changed = EINA_TRUE;
5752 elm_layout_sizing_eval(obj);
5756 elm_entry_selection_get(const Evas_Object *obj)
5758 ELM_ENTRY_CHECK(obj) NULL;
5759 ELM_ENTRY_DATA_GET(obj, sd);
5761 if ((sd->password)) return NULL;
5762 return edje_object_part_text_selection_get(sd->entry_edje, "elm.text");
5766 elm_entry_entry_insert(Evas_Object *obj,
5769 ELM_ENTRY_CHECK(obj);
5770 ELM_ENTRY_DATA_GET(obj, sd);
5772 edje_object_part_text_insert(sd->entry_edje, "elm.text", entry);
5774 #ifdef HAVE_ELEMENTARY_X
5775 if (elm_widget_focus_get(obj))
5776 ecore_x_selection_secondary_set(elm_win_xwindow_get(obj), NULL,0);
5779 sd->changed = EINA_TRUE;
5780 elm_layout_sizing_eval(obj);
5784 elm_entry_line_wrap_set(Evas_Object *obj,
5787 ELM_ENTRY_CHECK(obj);
5788 ELM_ENTRY_DATA_GET(obj, sd);
5790 if (sd->line_wrap == wrap) return;
5792 sd->line_wrap = wrap;
5793 _elm_entry_smart_theme(obj);
5797 elm_entry_line_wrap_get(const Evas_Object *obj)
5799 ELM_ENTRY_CHECK(obj) EINA_FALSE;
5800 ELM_ENTRY_DATA_GET(obj, sd);
5802 return sd->line_wrap;
5806 elm_entry_editable_set(Evas_Object *obj,
5809 ELM_ENTRY_CHECK(obj);
5810 ELM_ENTRY_DATA_GET(obj, sd);
5812 if (sd->editable == editable) return;
5813 sd->editable = editable;
5814 _elm_entry_smart_theme(obj);
5816 #ifdef HAVE_ELEMENTARY_X
5817 elm_drop_target_del(obj, sd->drop_format,
5821 _drag_drop_cb, NULL);
5822 sd->drop_added = EINA_FALSE;
5825 if (sd->drop_enabled)
5827 sd->drop_format = _get_drop_format(obj);
5828 elm_drop_target_add(obj, sd->drop_format,
5832 _drag_drop_cb, NULL);
5833 sd->drop_added = EINA_TRUE;
5840 elm_entry_editable_get(const Evas_Object *obj)
5842 ELM_ENTRY_CHECK(obj) EINA_FALSE;
5843 ELM_ENTRY_DATA_GET(obj, sd);
5845 return sd->editable;
5849 elm_entry_select_none(Evas_Object *obj)
5851 ELM_ENTRY_CHECK(obj);
5852 ELM_ENTRY_DATA_GET(obj, sd);
5854 if ((sd->password)) return;
5857 sd->sel_mode = EINA_FALSE;
5858 if (!_elm_config->desktop_entry)
5859 edje_object_part_text_select_allow_set
5860 (sd->entry_edje, "elm.text", EINA_FALSE);
5861 edje_object_signal_emit(sd->entry_edje, "elm,state,select,off", "elm");
5863 edje_object_part_text_select_none(sd->entry_edje, "elm.text");
5867 elm_entry_select_all(Evas_Object *obj)
5869 ELM_ENTRY_CHECK(obj);
5870 ELM_ENTRY_DATA_GET(obj, sd);
5872 if ((sd->password)) return;
5875 sd->sel_mode = EINA_FALSE;
5876 if (!_elm_config->desktop_entry)
5877 edje_object_part_text_select_allow_set
5878 (sd->entry_edje, "elm.text", EINA_FALSE);
5879 edje_object_signal_emit(sd->entry_edje, "elm,state,select,off", "elm");
5881 edje_object_part_text_select_all(sd->entry_edje, "elm.text");
5885 elm_entry_cursor_geometry_get(const Evas_Object *obj,
5891 ELM_ENTRY_CHECK(obj) EINA_FALSE;
5892 ELM_ENTRY_DATA_GET(obj, sd);
5894 edje_object_part_text_cursor_geometry_get
5895 (sd->entry_edje, "elm.text", x, y, w, h);
5900 elm_entry_cursor_next(Evas_Object *obj)
5902 ELM_ENTRY_CHECK(obj) EINA_FALSE;
5903 ELM_ENTRY_DATA_GET(obj, sd);
5905 return edje_object_part_text_cursor_next
5906 (sd->entry_edje, "elm.text", EDJE_CURSOR_MAIN);
5910 elm_entry_cursor_prev(Evas_Object *obj)
5912 ELM_ENTRY_CHECK(obj) EINA_FALSE;
5913 ELM_ENTRY_DATA_GET(obj, sd);
5915 return edje_object_part_text_cursor_prev
5916 (sd->entry_edje, "elm.text", EDJE_CURSOR_MAIN);
5920 elm_entry_cursor_up(Evas_Object *obj)
5922 ELM_ENTRY_CHECK(obj) EINA_FALSE;
5923 ELM_ENTRY_DATA_GET(obj, sd);
5925 return edje_object_part_text_cursor_up
5926 (sd->entry_edje, "elm.text", EDJE_CURSOR_MAIN);
5930 elm_entry_cursor_down(Evas_Object *obj)
5932 ELM_ENTRY_CHECK(obj) EINA_FALSE;
5933 ELM_ENTRY_DATA_GET(obj, sd);
5935 return edje_object_part_text_cursor_down
5936 (sd->entry_edje, "elm.text", EDJE_CURSOR_MAIN);
5940 elm_entry_cursor_begin_set(Evas_Object *obj)
5942 ELM_ENTRY_CHECK(obj);
5943 ELM_ENTRY_DATA_GET(obj, sd);
5945 edje_object_part_text_cursor_begin_set
5946 (sd->entry_edje, "elm.text", EDJE_CURSOR_MAIN);
5950 elm_entry_cursor_end_set(Evas_Object *obj)
5952 ELM_ENTRY_CHECK(obj);
5953 ELM_ENTRY_DATA_GET(obj, sd);
5955 edje_object_part_text_cursor_end_set
5956 (sd->entry_edje, "elm.text", EDJE_CURSOR_MAIN);
5960 elm_entry_cursor_line_begin_set(Evas_Object *obj)
5962 ELM_ENTRY_CHECK(obj);
5963 ELM_ENTRY_DATA_GET(obj, sd);
5965 edje_object_part_text_cursor_line_begin_set
5966 (sd->entry_edje, "elm.text", EDJE_CURSOR_MAIN);
5970 elm_entry_cursor_line_end_set(Evas_Object *obj)
5972 ELM_ENTRY_CHECK(obj);
5973 ELM_ENTRY_DATA_GET(obj, sd);
5975 edje_object_part_text_cursor_line_end_set
5976 (sd->entry_edje, "elm.text", EDJE_CURSOR_MAIN);
5980 elm_entry_cursor_selection_begin(Evas_Object *obj)
5982 ELM_ENTRY_CHECK(obj);
5983 ELM_ENTRY_DATA_GET(obj, sd);
5985 edje_object_part_text_select_begin(sd->entry_edje, "elm.text");
5989 elm_entry_cursor_selection_end(Evas_Object *obj)
5991 ELM_ENTRY_CHECK(obj);
5992 ELM_ENTRY_DATA_GET(obj, sd);
5994 edje_object_part_text_select_extend(sd->entry_edje, "elm.text");
5998 elm_entry_cursor_is_format_get(const Evas_Object *obj)
6000 ELM_ENTRY_CHECK(obj) EINA_FALSE;
6001 ELM_ENTRY_DATA_GET(obj, sd);
6003 return edje_object_part_text_cursor_is_format_get
6004 (sd->entry_edje, "elm.text", EDJE_CURSOR_MAIN);
6008 elm_entry_cursor_is_visible_format_get(const Evas_Object *obj)
6010 ELM_ENTRY_CHECK(obj) EINA_FALSE;
6011 ELM_ENTRY_DATA_GET(obj, sd);
6013 return edje_object_part_text_cursor_is_visible_format_get
6014 (sd->entry_edje, "elm.text", EDJE_CURSOR_MAIN);
6018 elm_entry_cursor_content_get(const Evas_Object *obj)
6020 ELM_ENTRY_CHECK(obj) NULL;
6021 ELM_ENTRY_DATA_GET(obj, sd);
6023 return edje_object_part_text_cursor_content_get
6024 (sd->entry_edje, "elm.text", EDJE_CURSOR_MAIN);
6028 elm_entry_cursor_pos_set(Evas_Object *obj,
6031 ELM_ENTRY_CHECK(obj);
6032 ELM_ENTRY_DATA_GET(obj, sd);
6034 edje_object_part_text_cursor_pos_set
6035 (sd->entry_edje, "elm.text", EDJE_CURSOR_MAIN, pos);
6036 edje_object_message_signal_process(sd->entry_edje);
6040 elm_entry_cursor_pos_get(const Evas_Object *obj)
6042 ELM_ENTRY_CHECK(obj) 0;
6043 ELM_ENTRY_DATA_GET(obj, sd);
6045 return edje_object_part_text_cursor_pos_get
6046 (sd->entry_edje, "elm.text", EDJE_CURSOR_MAIN);
6050 elm_entry_selection_cut(Evas_Object *obj)
6052 ELM_ENTRY_CHECK(obj);
6053 ELM_ENTRY_DATA_GET(obj, sd);
6055 if ((sd->password)) return;
6056 _cut_cb(obj, NULL, NULL);
6060 elm_entry_selection_copy(Evas_Object *obj)
6062 ELM_ENTRY_CHECK(obj);
6063 ELM_ENTRY_DATA_GET(obj, sd);
6065 if ((sd->password)) return;
6066 _copy_cb(obj, NULL, NULL);
6070 elm_entry_selection_paste(Evas_Object *obj)
6072 ELM_ENTRY_CHECK(obj);
6073 ELM_ENTRY_DATA_GET(obj, sd);
6075 if ((sd->password)) return;
6076 _paste_cb(obj, NULL, NULL);
6080 elm_entry_context_menu_clear(Evas_Object *obj)
6082 Elm_Entry_Context_Menu_Item *it;
6084 ELM_ENTRY_CHECK(obj);
6085 ELM_ENTRY_DATA_GET(obj, sd);
6087 EINA_LIST_FREE (sd->items, it)
6089 eina_stringshare_del(it->label);
6090 eina_stringshare_del(it->icon_file);
6091 eina_stringshare_del(it->icon_group);
6097 elm_entry_context_menu_item_add(Evas_Object *obj,
6099 const char *icon_file,
6100 Elm_Icon_Type icon_type,
6104 Elm_Entry_Context_Menu_Item *it;
6106 ELM_ENTRY_CHECK(obj);
6107 ELM_ENTRY_DATA_GET(obj, sd);
6109 it = calloc(1, sizeof(Elm_Entry_Context_Menu_Item));
6112 sd->items = eina_list_append(sd->items, it);
6114 it->label = eina_stringshare_add(label);
6115 it->icon_file = eina_stringshare_add(icon_file);
6116 it->icon_type = icon_type;
6118 it->data = (void *)data;
6122 elm_entry_context_menu_disabled_set(Evas_Object *obj,
6125 ELM_ENTRY_CHECK(obj);
6126 ELM_ENTRY_DATA_GET(obj, sd);
6128 if (sd->context_menu == !disabled) return;
6129 sd->context_menu = !disabled;
6133 elm_entry_context_menu_disabled_get(const Evas_Object *obj)
6135 ELM_ENTRY_CHECK(obj) EINA_FALSE;
6136 ELM_ENTRY_DATA_GET(obj, sd);
6138 return !sd->context_menu;
6141 // TIZEN ONLY - START
6143 elm_entry_select_allow_set(Evas_Object *obj,
6146 ELM_ENTRY_CHECK(obj);
6147 ELM_ENTRY_DATA_GET(obj, sd);
6149 if (sd->sel_allow == allow) return;
6150 sd->sel_allow = allow;
6152 // TIZEN_ONLY(20130830): For cursor movement when mouse up.
6153 edje_object_part_text_select_disabled_set(sd->entry_edje, "elm.text", !allow);
6158 elm_entry_select_allow_get(const Evas_Object *obj)
6160 ELM_ENTRY_CHECK(obj) EINA_FALSE;
6161 ELM_ENTRY_DATA_GET(obj, sd);
6163 return sd->sel_allow;
6167 elm_entry_cursor_handler_disabled_set(Evas_Object *obj,
6170 ELM_ENTRY_CHECK(obj);
6171 ELM_ENTRY_DATA_GET(obj, sd);
6173 if (sd->cursor_handler_disabled == disabled) return;
6174 sd->cursor_handler_disabled = disabled;
6176 if (!_elm_config->desktop_entry)
6177 edje_object_part_text_cursor_handler_disabled_set(sd->entry_edje, "elm.text", disabled);
6181 elm_entry_cursor_handler_disabled_get(const Evas_Object *obj)
6183 ELM_ENTRY_CHECK(obj) EINA_FALSE;
6184 ELM_ENTRY_DATA_GET(obj, sd);
6185 return sd->cursor_handler_disabled;
6190 elm_entry_item_provider_append(Evas_Object *obj,
6191 Elm_Entry_Item_Provider_Cb func,
6194 Elm_Entry_Item_Provider *ip;
6196 ELM_ENTRY_CHECK(obj);
6197 ELM_ENTRY_DATA_GET(obj, sd);
6198 EINA_SAFETY_ON_NULL_RETURN(func);
6200 ip = calloc(1, sizeof(Elm_Entry_Item_Provider));
6205 sd->item_providers = eina_list_append(sd->item_providers, ip);
6209 elm_entry_item_provider_prepend(Evas_Object *obj,
6210 Elm_Entry_Item_Provider_Cb func,
6213 Elm_Entry_Item_Provider *ip;
6215 ELM_ENTRY_CHECK(obj);
6216 ELM_ENTRY_DATA_GET(obj, sd);
6217 EINA_SAFETY_ON_NULL_RETURN(func);
6219 ip = calloc(1, sizeof(Elm_Entry_Item_Provider));
6224 sd->item_providers = eina_list_prepend(sd->item_providers, ip);
6228 elm_entry_item_provider_remove(Evas_Object *obj,
6229 Elm_Entry_Item_Provider_Cb func,
6233 Elm_Entry_Item_Provider *ip;
6235 ELM_ENTRY_CHECK(obj);
6236 ELM_ENTRY_DATA_GET(obj, sd);
6237 EINA_SAFETY_ON_NULL_RETURN(func);
6239 EINA_LIST_FOREACH(sd->item_providers, l, ip)
6241 if ((ip->func == func) && ((!data) || (ip->data == data)))
6243 sd->item_providers = eina_list_remove_list(sd->item_providers, l);
6251 elm_entry_markup_filter_append(Evas_Object *obj,
6252 Elm_Entry_Filter_Cb func,
6255 Elm_Entry_Markup_Filter *tf;
6257 ELM_ENTRY_CHECK(obj);
6258 ELM_ENTRY_DATA_GET(obj, sd);
6259 EINA_SAFETY_ON_NULL_RETURN(func);
6261 tf = _filter_new(func, data);
6264 sd->markup_filters = eina_list_append(sd->markup_filters, tf);
6268 elm_entry_markup_filter_prepend(Evas_Object *obj,
6269 Elm_Entry_Filter_Cb func,
6272 Elm_Entry_Markup_Filter *tf;
6274 ELM_ENTRY_CHECK(obj);
6275 ELM_ENTRY_DATA_GET(obj, sd);
6276 EINA_SAFETY_ON_NULL_RETURN(func);
6278 tf = _filter_new(func, data);
6281 sd->markup_filters = eina_list_prepend(sd->markup_filters, tf);
6285 elm_entry_markup_filter_remove(Evas_Object *obj,
6286 Elm_Entry_Filter_Cb func,
6290 Elm_Entry_Markup_Filter *tf;
6292 ELM_ENTRY_CHECK(obj);
6293 ELM_ENTRY_DATA_GET(obj, sd);
6294 EINA_SAFETY_ON_NULL_RETURN(func);
6296 EINA_LIST_FOREACH(sd->markup_filters, l, tf)
6298 if ((tf->func == func) && ((!data) || (tf->orig_data == data)))
6300 sd->markup_filters = eina_list_remove_list(sd->markup_filters, l);
6308 elm_entry_markup_to_utf8(const char *s)
6310 char *ss = _elm_util_mkup_to_text(s);
6311 if (!ss) ss = strdup("");
6316 elm_entry_utf8_to_markup(const char *s)
6318 char *ss = _elm_util_text_to_mkup(s);
6319 if (!ss) ss = strdup("");
6324 _text_get(const Evas_Object *obj)
6326 return elm_object_text_get(obj);
6330 elm_entry_filter_limit_size(void *data,
6334 const char *(*text_get)(const Evas_Object *);
6335 Elm_Entry_Filter_Limit_Size *lim = data;
6336 char *current, *utfstr;
6339 EINA_SAFETY_ON_NULL_RETURN(data);
6340 EINA_SAFETY_ON_NULL_RETURN(entry);
6341 EINA_SAFETY_ON_NULL_RETURN(text);
6343 /* hack. I don't want to copy the entire function to work with
6345 text_get = _text_get;
6347 current = elm_entry_markup_to_utf8(text_get(entry));
6348 utfstr = elm_entry_markup_to_utf8(*text);
6350 if (lim->max_char_count > 0)
6352 len = evas_string_char_len_get(current);
6353 newlen = evas_string_char_len_get(utfstr);
6354 if ((len >= lim->max_char_count) && (newlen > 0))
6356 if (elm_object_focus_get(entry))
6357 evas_object_smart_callback_call(entry, SIG_MAX_LENGTH, NULL);
6364 if ((len + newlen) > lim->max_char_count)
6365 _chars_add_till_limit
6366 (entry, text, (lim->max_char_count - len), LENGTH_UNIT_CHAR);
6368 else if (lim->max_byte_count > 0)
6370 len = strlen(current);
6371 newlen = strlen(utfstr);
6372 if ((len >= lim->max_byte_count) && (newlen > 0))
6374 if (elm_object_focus_get(entry))
6375 evas_object_smart_callback_call(entry, SIG_MAX_LENGTH, NULL);
6382 if ((len + newlen) > lim->max_byte_count)
6383 _chars_add_till_limit
6384 (entry, text, (lim->max_byte_count - len), LENGTH_UNIT_BYTE);
6392 elm_entry_filter_accept_set(void *data,
6396 int read_idx, last_read_idx = 0, read_char;
6397 Elm_Entry_Filter_Accept_Set *as = data;
6403 EINA_SAFETY_ON_NULL_RETURN(data);
6404 EINA_SAFETY_ON_NULL_RETURN(text);
6406 if ((!as->accepted) && (!as->rejected))
6412 goes_in = EINA_TRUE;
6417 goes_in = EINA_FALSE;
6421 read_idx = evas_string_char_next_get(*text, 0, &read_char);
6422 rejected = EINA_FALSE;
6425 int cmp_idx, cmp_char;
6426 Eina_Bool in_set = EINA_FALSE;
6428 if (read_char == '<')
6430 while (read_char && (read_char != '>'))
6431 read_idx = evas_string_char_next_get(*text, read_idx, &read_char);
6433 if (goes_in) in_set = EINA_TRUE;
6434 else in_set = EINA_FALSE;
6438 if (read_char == '&')
6440 while (read_char && (read_char != ';'))
6441 read_idx = evas_string_char_next_get(*text, read_idx, &read_char);
6445 if (goes_in) in_set = EINA_TRUE;
6446 else in_set = EINA_FALSE;
6449 if (read_char == ';')
6453 tag = malloc(read_idx - last_read_idx + 1);
6457 strncpy(tag, (*text) + last_read_idx, read_idx - last_read_idx);
6458 tag[read_idx - last_read_idx] = 0;
6459 markup = elm_entry_markup_to_utf8(tag);
6468 in_set = EINA_FALSE;
6476 cmp_idx = evas_string_char_next_get(set, 0, &cmp_char);
6479 if (read_char == cmp_char)
6484 cmp_idx = evas_string_char_next_get(set, cmp_idx, &cmp_char);
6490 if (in_set == goes_in)
6492 int size = read_idx - last_read_idx;
6493 const char *src = (*text) + last_read_idx;
6495 memcpy(insert, *text + last_read_idx, size);
6500 rejected = EINA_TRUE;
6505 last_read_idx = read_idx;
6506 read_idx = evas_string_char_next_get(*text, read_idx, &read_char);
6511 evas_object_smart_callback_call(entry, SIG_REJECTED, NULL);
6515 elm_entry_file_set(Evas_Object *obj,
6517 Elm_Text_Format format)
6519 ELM_ENTRY_CHECK(obj) EINA_FALSE;
6520 ELM_ENTRY_DATA_GET(obj, sd);
6522 if (sd->delay_write)
6524 ecore_timer_del(sd->delay_write);
6525 sd->delay_write = NULL;
6528 if (sd->auto_save) _save_do(obj);
6529 eina_stringshare_replace(&sd->file, file);
6530 sd->format = format;
6531 return _load_do(obj);
6535 elm_entry_file_get(const Evas_Object *obj,
6537 Elm_Text_Format *format)
6539 ELM_ENTRY_CHECK(obj);
6540 ELM_ENTRY_DATA_GET(obj, sd);
6542 if (file) *file = sd->file;
6543 if (format) *format = sd->format;
6547 elm_entry_file_save(Evas_Object *obj)
6549 ELM_ENTRY_CHECK(obj);
6550 ELM_ENTRY_DATA_GET(obj, sd);
6552 if (sd->delay_write)
6554 ecore_timer_del(sd->delay_write);
6555 sd->delay_write = NULL;
6558 sd->delay_write = ecore_timer_add(2.0, _delay_write, obj);
6562 elm_entry_autosave_set(Evas_Object *obj,
6563 Eina_Bool auto_save)
6565 ELM_ENTRY_CHECK(obj);
6566 ELM_ENTRY_DATA_GET(obj, sd);
6568 sd->auto_save = !!auto_save;
6572 elm_entry_autosave_get(const Evas_Object *obj)
6574 ELM_ENTRY_CHECK(obj) EINA_FALSE;
6575 ELM_ENTRY_DATA_GET(obj, sd);
6577 return sd->auto_save;
6580 EINA_DEPRECATED EAPI void
6581 elm_entry_cnp_textonly_set(Evas_Object *obj,
6584 Elm_Cnp_Mode cnp_mode = ELM_CNP_MODE_MARKUP;
6586 ELM_ENTRY_CHECK(obj);
6589 cnp_mode = ELM_CNP_MODE_NO_IMAGE;
6590 elm_entry_cnp_mode_set(obj, cnp_mode);
6593 EINA_DEPRECATED EAPI Eina_Bool
6594 elm_entry_cnp_textonly_get(const Evas_Object *obj)
6596 ELM_ENTRY_CHECK(obj) EINA_FALSE;
6598 return elm_entry_cnp_mode_get(obj) != ELM_CNP_MODE_MARKUP;
6602 elm_entry_cnp_mode_set(Evas_Object *obj,
6603 Elm_Cnp_Mode cnp_mode)
6605 Elm_Sel_Format format = ELM_SEL_FORMAT_MARKUP;
6607 ELM_ENTRY_CHECK(obj);
6608 ELM_ENTRY_DATA_GET(obj, sd);
6610 if (sd->cnp_mode == cnp_mode) return;
6611 sd->cnp_mode = cnp_mode;
6612 if (sd->cnp_mode == ELM_CNP_MODE_PLAINTEXT)
6613 format = ELM_SEL_FORMAT_TEXT;
6614 else if (cnp_mode == ELM_CNP_MODE_MARKUP)
6615 format |= ELM_SEL_FORMAT_IMAGE;
6616 #ifdef HAVE_ELEMENTARY_X
6617 if (sd->drop_enabled)
6619 elm_drop_target_del(obj, sd->drop_format,
6623 _drag_drop_cb, NULL);
6624 sd->drop_format = format;
6625 elm_drop_target_add(obj, format,
6629 _drag_drop_cb, NULL);
6630 sd->drop_added = EINA_TRUE;
6636 elm_entry_cnp_mode_get(const Evas_Object *obj)
6638 ELM_ENTRY_CHECK(obj) ELM_CNP_MODE_MARKUP;
6639 ELM_ENTRY_DATA_GET(obj, sd);
6641 return sd->cnp_mode;
6645 _elm_entry_content_viewport_resize_cb(Evas_Object *obj,
6646 Evas_Coord w __UNUSED__, Evas_Coord h __UNUSED__)
6648 ELM_ENTRY_DATA_GET(obj, sd);
6652 elm_layout_sizing_eval(obj);
6654 else if (sd->scroll)
6656 Evas_Coord vw = 0, vh = 0;
6658 sd->s_iface->content_viewport_size_get(obj, &vw, &vh);
6659 if (vw < sd->ent_mw) vw = sd->ent_mw;
6660 if (vh < sd->ent_mh) vh = sd->ent_mh;
6661 evas_object_resize(sd->entry_edje, vw, vh);
6664 if (sd->hoversel) _hoversel_position(obj);
6667 if (!_elm_config->desktop_entry)
6669 if (sd->region_get_job) ecore_job_del(sd->region_get_job);
6670 sd->region_get_job = ecore_job_add(_region_get_job, obj);
6672 if (sd->magnifier_showing)
6673 _magnifier_move(obj);
6679 elm_entry_scrollable_set(Evas_Object *obj,
6682 ELM_ENTRY_CHECK(obj);
6683 ELM_ENTRY_DATA_GET(obj, sd);
6686 if (sd->scroll == scroll) return;
6687 sd->scroll = scroll;
6691 /* we now must re-theme ourselves to a scroller decoration
6692 * and move the entry looking object to be the content of the
6693 * scrollable view */
6694 elm_widget_resize_object_set(obj, NULL, EINA_TRUE);
6695 elm_widget_sub_object_add(obj, sd->entry_edje);
6699 sd->scr_edje = edje_object_add(evas_object_evas_get(obj));
6701 elm_widget_theme_object_set
6702 (obj, sd->scr_edje, "scroller", "entry",
6703 elm_widget_style_get(obj));
6705 evas_object_size_hint_weight_set
6706 (sd->scr_edje, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
6707 evas_object_size_hint_align_set
6708 (sd->scr_edje, EVAS_HINT_FILL, EVAS_HINT_FILL);
6710 evas_object_propagate_events_set(sd->scr_edje, EINA_TRUE);
6713 elm_widget_resize_object_set(obj, sd->scr_edje, EINA_TRUE);
6715 sd->s_iface->objects_set(obj, sd->scr_edje, sd->hit_rect);
6717 sd->s_iface->bounce_allow_set(obj, sd->h_bounce, sd->v_bounce);
6718 if (sd->single_line)
6720 sd->s_iface->policy_set
6721 (obj, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_OFF);
6722 //***************** TIZEN Only
6723 sd->s_iface->movement_block_set(obj, ELM_SCROLLER_MOVEMENT_BLOCK_VERTICAL);
6724 //****************************
6727 sd->s_iface->policy_set(obj, sd->policy_h, sd->policy_v);
6728 sd->s_iface->content_set(obj, sd->entry_edje);
6729 sd->s_iface->content_viewport_resize_cb_set(obj, _elm_entry_content_viewport_resize_cb);
6730 elm_widget_on_show_region_hook_set(obj, _show_region_hook, obj);
6736 sd->s_iface->content_set(obj, NULL);
6737 evas_object_hide(sd->scr_edje);
6739 elm_widget_resize_object_set(obj, sd->entry_edje, EINA_TRUE);
6742 elm_widget_sub_object_add(obj, sd->scr_edje);
6744 sd->s_iface->objects_set(obj, sd->entry_edje, sd->hit_rect);
6746 elm_widget_on_show_region_hook_set(obj, NULL, NULL);
6749 _elm_entry_smart_theme(obj);
6753 elm_entry_scrollable_get(const Evas_Object *obj)
6755 ELM_ENTRY_CHECK(obj) EINA_FALSE;
6756 ELM_ENTRY_DATA_GET(obj, sd);
6762 elm_entry_icon_visible_set(Evas_Object *obj,
6765 ELM_ENTRY_CHECK(obj);
6767 if (!elm_layout_content_get(obj, "elm.swallow.icon")) return;
6770 elm_layout_signal_emit(obj, "elm,action,show,icon", "elm");
6772 elm_layout_signal_emit(obj, "elm,action,hide,icon", "elm");
6774 elm_layout_sizing_eval(obj);
6778 elm_entry_end_visible_set(Evas_Object *obj,
6781 ELM_ENTRY_CHECK(obj);
6783 if (!elm_layout_content_get(obj, "elm.swallow.end")) return;
6786 elm_layout_signal_emit(obj, "elm,action,show,end", "elm");
6788 elm_layout_signal_emit(obj, "elm,action,hide,end", "elm");
6790 elm_layout_sizing_eval(obj);
6794 elm_entry_scrollbar_policy_set(Evas_Object *obj,
6795 Elm_Scroller_Policy h,
6796 Elm_Scroller_Policy v)
6798 ELM_ENTRY_CHECK(obj);
6799 ELM_ENTRY_DATA_GET(obj, sd);
6803 sd->s_iface->policy_set(obj, sd->policy_h, sd->policy_v);
6807 elm_entry_bounce_set(Evas_Object *obj,
6811 ELM_ENTRY_CHECK(obj);
6812 ELM_ENTRY_DATA_GET(obj, sd);
6814 sd->h_bounce = h_bounce;
6815 sd->v_bounce = v_bounce;
6816 sd->s_iface->bounce_allow_set(obj, h_bounce, v_bounce);
6820 elm_entry_bounce_get(const Evas_Object *obj,
6821 Eina_Bool *h_bounce,
6822 Eina_Bool *v_bounce)
6824 ELM_ENTRY_CHECK(obj);
6825 ELM_ENTRY_DATA_GET(obj, sd);
6827 sd->s_iface->bounce_allow_get(obj, h_bounce, v_bounce);
6831 elm_entry_input_panel_layout_set(Evas_Object *obj,
6832 Elm_Input_Panel_Layout layout)
6834 ELM_ENTRY_CHECK(obj);
6835 ELM_ENTRY_DATA_GET(obj, sd);
6837 sd->input_panel_layout = layout;
6839 edje_object_part_text_input_panel_layout_set
6840 (sd->entry_edje, "elm.text", layout);
6842 if (layout == ELM_INPUT_PANEL_LAYOUT_PASSWORD)
6843 elm_entry_input_hint_set(obj, ((sd->input_hints & ~ELM_INPUT_HINT_AUTO_COMPLETE) | ELM_INPUT_HINT_SENSITIVE_DATA));
6844 else if (layout == ELM_INPUT_PANEL_LAYOUT_TERMINAL)
6845 elm_entry_input_hint_set(obj, (sd->input_hints & ~ELM_INPUT_HINT_AUTO_COMPLETE));
6848 EAPI Elm_Input_Panel_Layout
6849 elm_entry_input_panel_layout_get(const Evas_Object *obj)
6851 ELM_ENTRY_CHECK(obj) ELM_INPUT_PANEL_LAYOUT_INVALID;
6852 ELM_ENTRY_DATA_GET(obj, sd);
6854 return sd->input_panel_layout;
6858 elm_entry_input_panel_layout_variation_set(Evas_Object *obj,
6861 ELM_ENTRY_CHECK(obj);
6862 ELM_ENTRY_DATA_GET(obj, sd);
6864 sd->input_panel_layout_variation = variation;
6866 edje_object_part_text_input_panel_layout_variation_set
6867 (sd->entry_edje, "elm.text", variation);
6871 elm_entry_input_panel_layout_variation_get(const Evas_Object *obj)
6873 ELM_ENTRY_CHECK(obj) 0;
6874 ELM_ENTRY_DATA_GET(obj, sd);
6876 return sd->input_panel_layout_variation;
6880 elm_entry_autocapital_type_set(Evas_Object *obj,
6881 Elm_Autocapital_Type autocapital_type)
6883 ELM_ENTRY_CHECK(obj);
6884 ELM_ENTRY_DATA_GET(obj, sd);
6886 sd->autocapital_type = autocapital_type;
6887 edje_object_part_text_autocapital_type_set
6888 (sd->entry_edje, "elm.text", autocapital_type);
6891 EAPI Elm_Autocapital_Type
6892 elm_entry_autocapital_type_get(const Evas_Object *obj)
6894 ELM_ENTRY_CHECK(obj) ELM_AUTOCAPITAL_TYPE_NONE;
6895 ELM_ENTRY_DATA_GET(obj, sd);
6897 return sd->autocapital_type;
6901 elm_entry_prediction_allow_set(Evas_Object *obj,
6902 Eina_Bool prediction)
6904 ELM_ENTRY_CHECK(obj);
6905 ELM_ENTRY_DATA_GET(obj, sd);
6907 sd->prediction_allow = prediction;
6908 edje_object_part_text_prediction_allow_set
6909 (sd->entry_edje, "elm.text", prediction);
6913 elm_entry_prediction_allow_get(const Evas_Object *obj)
6915 ELM_ENTRY_CHECK(obj) EINA_TRUE;
6916 ELM_ENTRY_DATA_GET(obj, sd);
6918 return sd->prediction_allow;
6922 elm_entry_input_hint_set(Evas_Object *obj,
6923 Elm_Input_Hints hints)
6925 ELM_ENTRY_CHECK(obj);
6926 ELM_ENTRY_DATA_GET(obj, sd);
6928 sd->input_hints = hints;
6929 edje_object_part_text_input_hint_set
6930 (sd->entry_edje, "elm.text", hints);
6933 EAPI Elm_Input_Hints
6934 elm_entry_input_hint_get(const Evas_Object *obj)
6936 ELM_ENTRY_CHECK(obj) EINA_TRUE;
6937 ELM_ENTRY_DATA_GET(obj, sd);
6939 return sd->input_hints;
6943 elm_entry_imf_context_reset(Evas_Object *obj)
6945 ELM_ENTRY_CHECK(obj);
6946 ELM_ENTRY_DATA_GET(obj, sd);
6948 edje_object_part_text_imf_context_reset(sd->entry_edje, "elm.text");
6952 elm_entry_input_panel_enabled_set(Evas_Object *obj,
6955 ELM_ENTRY_CHECK(obj);
6956 ELM_ENTRY_DATA_GET(obj, sd);
6958 sd->input_panel_enable = enabled;
6959 edje_object_part_text_input_panel_enabled_set
6960 (sd->entry_edje, "elm.text", enabled);
6964 elm_entry_input_panel_enabled_get(const Evas_Object *obj)
6966 ELM_ENTRY_CHECK(obj) EINA_TRUE;
6967 ELM_ENTRY_DATA_GET(obj, sd);
6969 return sd->input_panel_enable;
6973 elm_entry_input_panel_show(Evas_Object *obj)
6975 ELM_ENTRY_CHECK(obj);
6976 ELM_ENTRY_DATA_GET(obj, sd);
6978 edje_object_part_text_input_panel_show(sd->entry_edje, "elm.text");
6982 elm_entry_input_panel_hide(Evas_Object *obj)
6984 ELM_ENTRY_CHECK(obj);
6985 ELM_ENTRY_DATA_GET(obj, sd);
6987 edje_object_part_text_input_panel_hide(sd->entry_edje, "elm.text");
6991 elm_entry_input_panel_language_set(Evas_Object *obj,
6992 Elm_Input_Panel_Lang lang)
6994 ELM_ENTRY_CHECK(obj);
6995 ELM_ENTRY_DATA_GET(obj, sd);
6997 sd->input_panel_lang = lang;
6998 edje_object_part_text_input_panel_language_set
6999 (sd->entry_edje, "elm.text", lang);
7002 EAPI Elm_Input_Panel_Lang
7003 elm_entry_input_panel_language_get(const Evas_Object *obj)
7005 ELM_ENTRY_CHECK(obj) ELM_INPUT_PANEL_LANG_AUTOMATIC;
7006 ELM_ENTRY_DATA_GET(obj, sd);
7008 return sd->input_panel_lang;
7012 elm_entry_input_panel_imdata_set(Evas_Object *obj,
7016 ELM_ENTRY_CHECK(obj);
7017 ELM_ENTRY_DATA_GET(obj, sd);
7019 if (sd->input_panel_imdata)
7020 free(sd->input_panel_imdata);
7022 sd->input_panel_imdata = calloc(1, len);
7023 sd->input_panel_imdata_len = len;
7024 memcpy(sd->input_panel_imdata, data, len);
7026 edje_object_part_text_input_panel_imdata_set
7027 (sd->entry_edje, "elm.text", sd->input_panel_imdata,
7028 sd->input_panel_imdata_len);
7032 elm_entry_input_panel_imdata_get(const Evas_Object *obj,
7036 ELM_ENTRY_CHECK(obj);
7037 ELM_ENTRY_DATA_GET(obj, sd);
7039 edje_object_part_text_input_panel_imdata_get
7040 (sd->entry_edje, "elm.text", data, len);
7044 elm_entry_input_panel_return_key_type_set(Evas_Object *obj,
7045 Elm_Input_Panel_Return_Key_Type
7048 ELM_ENTRY_CHECK(obj);
7049 ELM_ENTRY_DATA_GET(obj, sd);
7051 sd->input_panel_return_key_type = return_key_type;
7053 edje_object_part_text_input_panel_return_key_type_set
7054 (sd->entry_edje, "elm.text", return_key_type);
7057 EAPI Elm_Input_Panel_Return_Key_Type
7058 elm_entry_input_panel_return_key_type_get(const Evas_Object *obj)
7060 ELM_ENTRY_CHECK(obj) ELM_INPUT_PANEL_RETURN_KEY_TYPE_DEFAULT;
7061 ELM_ENTRY_DATA_GET(obj, sd);
7063 return sd->input_panel_return_key_type;
7067 elm_entry_input_panel_return_key_disabled_set(Evas_Object *obj,
7070 ELM_ENTRY_CHECK(obj);
7071 ELM_ENTRY_DATA_GET(obj, sd);
7073 sd->input_panel_return_key_disabled = disabled;
7075 edje_object_part_text_input_panel_return_key_disabled_set
7076 (sd->entry_edje, "elm.text", disabled);
7080 elm_entry_input_panel_return_key_disabled_get(const Evas_Object *obj)
7082 ELM_ENTRY_CHECK(obj) EINA_FALSE;
7083 ELM_ENTRY_DATA_GET(obj, sd);
7085 return sd->input_panel_return_key_disabled;
7089 elm_entry_input_panel_return_key_autoenabled_set(Evas_Object *obj,
7092 ELM_ENTRY_CHECK(obj);
7093 ELM_ENTRY_DATA_GET(obj, sd);
7095 sd->auto_return_key = enabled;
7096 _return_key_enabled_check(obj);
7100 elm_entry_input_panel_show_on_demand_set(Evas_Object *obj,
7103 ELM_ENTRY_CHECK(obj);
7104 ELM_ENTRY_DATA_GET(obj, sd);
7106 sd->input_panel_show_on_demand = ondemand;
7108 edje_object_part_text_input_panel_show_on_demand_set
7109 (sd->entry_edje, "elm.text", ondemand);
7113 elm_entry_input_panel_show_on_demand_get(const Evas_Object *obj)
7115 ELM_ENTRY_CHECK(obj) EINA_FALSE;
7116 ELM_ENTRY_DATA_GET(obj, sd);
7118 return sd->input_panel_show_on_demand;
7122 elm_entry_imf_context_get(Evas_Object *obj)
7124 ELM_ENTRY_CHECK(obj) NULL;
7125 ELM_ENTRY_DATA_GET(obj, sd);
7126 if (!sd) return NULL;
7128 return edje_object_part_text_imf_context_get(sd->entry_edje, "elm.text");
7131 /* START - ANCHOR HOVER */
7133 _anchor_parent_del_cb(void *data,
7135 Evas_Object *obj __UNUSED__,
7136 void *event_info __UNUSED__)
7138 ELM_ENTRY_DATA_GET(data, sd);
7140 sd->anchor_hover.hover_parent = NULL;
7144 elm_entry_anchor_hover_parent_set(Evas_Object *obj,
7145 Evas_Object *parent)
7147 ELM_ENTRY_CHECK(obj);
7148 ELM_ENTRY_DATA_GET(obj, sd);
7150 if (sd->anchor_hover.hover_parent)
7151 evas_object_event_callback_del_full
7152 (sd->anchor_hover.hover_parent, EVAS_CALLBACK_DEL,
7153 _anchor_parent_del_cb, obj);
7154 sd->anchor_hover.hover_parent = parent;
7155 if (sd->anchor_hover.hover_parent)
7156 evas_object_event_callback_add
7157 (sd->anchor_hover.hover_parent, EVAS_CALLBACK_DEL,
7158 _anchor_parent_del_cb, obj);
7162 elm_entry_anchor_hover_parent_get(const Evas_Object *obj)
7164 ELM_ENTRY_CHECK(obj) NULL;
7165 ELM_ENTRY_DATA_GET(obj, sd);
7167 return sd->anchor_hover.hover_parent;
7171 elm_entry_anchor_hover_style_set(Evas_Object *obj,
7174 ELM_ENTRY_CHECK(obj);
7175 ELM_ENTRY_DATA_GET(obj, sd);
7177 eina_stringshare_replace(&sd->anchor_hover.hover_style, style);
7181 elm_entry_anchor_hover_style_get(const Evas_Object *obj)
7183 ELM_ENTRY_CHECK(obj) NULL;
7184 ELM_ENTRY_DATA_GET(obj, sd);
7186 return sd->anchor_hover.hover_style;
7190 elm_entry_anchor_hover_end(Evas_Object *obj)
7192 ELM_ENTRY_CHECK(obj);
7193 ELM_ENTRY_DATA_GET(obj, sd);
7195 if (sd->anchor_hover.hover) evas_object_del(sd->anchor_hover.hover);
7196 if (sd->anchor_hover.pop) evas_object_del(sd->anchor_hover.pop);
7197 sd->anchor_hover.hover = NULL;
7198 sd->anchor_hover.pop = NULL;
7201 /* END - ANCHOR HOVER */
7203 ////////////// TIZEN ONLY APIs
7205 elm_entry_magnifier_disabled_set(Evas_Object *obj, Eina_Bool disabled)
7207 ELM_ENTRY_CHECK(obj);
7208 ELM_ENTRY_DATA_GET(obj, sd);
7210 if (sd->magnifier_enabled == !disabled) return;
7211 sd->magnifier_enabled = !disabled;
7215 elm_entry_magnifier_disabled_get(const Evas_Object *obj)
7217 ELM_ENTRY_CHECK(obj) EINA_FALSE;
7218 ELM_ENTRY_DATA_GET(obj, sd);
7220 return !sd->magnifier_enabled;
7222 ////////////////////////////////
7224 ////////////// REDWOOD ONLY APIs
7226 elm_entry_drag_disabled_set(Evas_Object *obj, Eina_Bool disabled)
7228 ELM_ENTRY_CHECK(obj);
7229 ELM_ENTRY_DATA_GET(obj, sd);
7231 if (sd->drag_enabled == !disabled) return;
7232 sd->drag_enabled = !disabled;
7236 elm_entry_drag_disabled_get(const Evas_Object *obj)
7238 ELM_ENTRY_CHECK(obj) EINA_FALSE;
7239 ELM_ENTRY_DATA_GET(obj, sd);
7241 return !sd->drag_enabled;
7245 elm_entry_drop_disabled_set(Evas_Object *obj, Eina_Bool disabled)
7247 ELM_ENTRY_CHECK(obj);
7248 ELM_ENTRY_DATA_GET(obj, sd);
7250 if (sd->drop_enabled == !disabled) return;
7251 sd->drop_enabled = !disabled;
7252 elm_drop_target_del(obj, sd->drop_format,
7256 _drag_drop_cb, NULL);
7257 if (!disabled && sd->drop_added)
7259 sd->drop_format = _get_drop_format(obj);
7260 elm_drop_target_add(obj, sd->drop_format,
7264 _drag_drop_cb, NULL);
7269 elm_entry_drop_disabled_get(Evas_Object *obj)
7271 ELM_ENTRY_CHECK(obj) EINA_FALSE;
7272 ELM_ENTRY_DATA_GET(obj, sd);
7274 return !sd->drop_enabled;
7276 ////////////////////////////////
7278 /////////////////////////////////////////////////////////////////////
7279 // TIZEN_ONLY(20140625): Add elm_entry_anchor_access_provider_* APIs.
7280 /////////////////////////////////////////////////////////////////////
7282 elm_entry_anchor_access_provider_append(Evas_Object *obj,
7283 Elm_Entry_Anchor_Access_Provider_Cb func,
7286 Elm_Entry_Anchor_Access_Provider *ap;
7288 ELM_ENTRY_CHECK(obj);
7289 ELM_ENTRY_DATA_GET(obj, sd);
7290 EINA_SAFETY_ON_NULL_RETURN(func);
7292 ap = calloc(1, sizeof(Elm_Entry_Anchor_Access_Provider));
7297 sd->anchor_access_providers = eina_list_append(sd->anchor_access_providers, ap);
7301 elm_entry_anchor_access_provider_prepend(Evas_Object *obj,
7302 Elm_Entry_Anchor_Access_Provider_Cb func,
7305 Elm_Entry_Anchor_Access_Provider *ap;
7307 ELM_ENTRY_CHECK(obj);
7308 ELM_ENTRY_DATA_GET(obj, sd);
7309 EINA_SAFETY_ON_NULL_RETURN(func);
7311 ap = calloc(1, sizeof(Elm_Entry_Anchor_Access_Provider));
7316 sd->anchor_access_providers = eina_list_prepend(sd->anchor_access_providers, ap);
7320 elm_entry_anchor_access_provider_remove(Evas_Object *obj,
7321 Elm_Entry_Anchor_Access_Provider_Cb func,
7325 Elm_Entry_Anchor_Access_Provider *ap;
7327 ELM_ENTRY_CHECK(obj);
7328 ELM_ENTRY_DATA_GET(obj, sd);
7329 EINA_SAFETY_ON_NULL_RETURN(func);
7331 EINA_LIST_FOREACH(sd->anchor_access_providers, l, ap)
7333 if ((ap->func == func) && ((!data) || (ap->data == data)))
7335 sd->anchor_access_providers = eina_list_remove_list(sd->anchor_access_providers, l);
7343 elm_entry_select_region_set(Evas_Object *obj, int start, int end)
7345 ELM_ENTRY_CHECK(obj);
7346 ELM_ENTRY_DATA_GET(obj, sd);
7348 if ((sd->password)) return;
7351 sd->sel_mode = EINA_FALSE;
7352 if (!_elm_config->desktop_entry)
7353 edje_object_part_text_select_allow_set
7354 (sd->entry_edje, "elm.text", EINA_FALSE);
7355 edje_object_signal_emit(sd->entry_edje, "elm,state,select,off", "elm");
7358 /* Set have selection false to not be cleared handler in
7359 selection_cleared_signal_cb() since that callback will be called while
7360 resetting edje text. */
7361 sd->have_selection = EINA_FALSE;
7363 edje_object_part_text_cursor_pos_set(sd->entry_edje, "elm.text", EDJE_CURSOR_MAIN, start);
7364 edje_object_part_text_select_begin(sd->entry_edje, "elm.text");
7365 edje_object_part_text_cursor_pos_set(sd->entry_edje, "elm.text", EDJE_CURSOR_MAIN, end);
7366 edje_object_part_text_select_extend(sd->entry_edje, "elm.text");
7369 /////////////////////////////////////////////////////////////////////