1 #include <Elementary.h>
2 #include <Elementary_Cursor.h>
6 /* Maximum chunk size to be inserted to the entry at once
7 * FIXME: This size is arbitrary, should probably choose a better size.
8 * Possibly also find a way to set it to a low value for weak computers,
9 * and to a big value for better computers. */
10 #define _CHUNK_SIZE 10000
12 typedef struct _Mod_Api Mod_Api;
14 typedef struct _Widget_Data Widget_Data;
15 typedef struct _Elm_Entry_Context_Menu_Item Elm_Entry_Context_Menu_Item;
16 typedef struct _Elm_Entry_Item_Provider Elm_Entry_Item_Provider;
17 typedef struct _Elm_Entry_Text_Filter Elm_Entry_Text_Filter;
21 Evas_Object *ent, *scroller, *end, *icon;
22 Evas_Object *hoversel;
23 Ecore_Job *deferred_recalc_job;
24 Ecore_Event_Handler *sel_notify_handler;
25 Ecore_Event_Handler *sel_clear_handler;
26 Ecore_Timer *longpress_timer;
27 Ecore_Timer *delay_write;
28 /* for deferred appending */
29 Ecore_Idler *append_text_idler;
30 char *append_text_left;
31 int append_text_position;
33 /* Only for clipboard */
37 Elm_Text_Format format;
38 Evas_Coord lastw, entmw, entmh;
39 Evas_Coord downx, downy;
41 Eina_List *item_providers;
42 Eina_List *text_filters;
44 Mod_Api *api; // module api if supplied
46 Elm_Scroller_Policy policy_h, policy_v;
47 Elm_Wrap_Type linewrap;
48 Elm_Input_Panel_Layout input_panel_layout;
49 Eina_Bool changed : 1;
50 Eina_Bool single_line : 1;
51 Eina_Bool password : 1;
52 Eina_Bool editable : 1;
53 Eina_Bool selection_asked : 1;
54 Eina_Bool have_selection : 1;
55 Eina_Bool selmode : 1;
56 Eina_Bool deferred_cur : 1;
57 Eina_Bool cur_changed : 1;
58 Eina_Bool disabled : 1;
59 Eina_Bool context_menu : 1;
60 Eina_Bool drag_selection_asked : 1;
61 Eina_Bool can_write : 1;
62 Eina_Bool autosave : 1;
63 Eina_Bool textonly : 1;
64 Eina_Bool usedown : 1;
68 struct _Elm_Entry_Context_Menu_Item
72 const char *icon_file;
73 const char *icon_group;
74 Elm_Icon_Type icon_type;
79 struct _Elm_Entry_Item_Provider
81 Evas_Object *(*func) (void *data, Evas_Object *entry, const char *item);
85 struct _Elm_Entry_Text_Filter
87 Elm_Entry_Filter_Cb func;
91 typedef enum _Length_Unit
98 static const char *widtype = NULL;
100 #ifdef HAVE_ELEMENTARY_X
101 static Eina_Bool _drag_drop_cb(void *data, Evas_Object *obj, Elm_Selection_Data *);
103 static void _del_hook(Evas_Object *obj);
104 static void _mirrored_set(Evas_Object *obj, Eina_Bool rtl);
105 static void _theme_hook(Evas_Object *obj);
106 static void _disable_hook(Evas_Object *obj);
107 static void _sizing_eval(Evas_Object *obj);
108 static void _on_focus_hook(void *data, Evas_Object *obj);
109 static void _content_del(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__);
110 static void _content_set_hook(Evas_Object *obj, const char *part, Evas_Object *content);
111 static Evas_Object *_content_unset_hook(Evas_Object *obj, const char *part);
112 static Evas_Object *_content_get_hook(const Evas_Object *obj, const char *part);
113 static void _resize(void *data, Evas *e, Evas_Object *obj, void *event_info);
114 static const char *_getbase(Evas_Object *obj);
115 static void _signal_entry_changed(void *data, Evas_Object *obj, const char *emission, const char *source);
116 static void _signal_selection_start(void *data, Evas_Object *obj, const char *emission, const char *source);
117 static void _signal_selection_changed(void *data, Evas_Object *obj, const char *emission, const char *source);
118 static void _signal_selection_cleared(void *data, Evas_Object *obj, const char *emission, const char *source);
119 static void _signal_entry_paste_request(void *data, Evas_Object *obj, const char *emission, const char *source);
120 static void _signal_entry_copy_notify(void *data, Evas_Object *obj, const char *emission, const char *source);
121 static void _signal_entry_cut_notify(void *data, Evas_Object *obj, const char *emission, const char *source);
122 static void _signal_cursor_changed(void *data, Evas_Object *obj, const char *emission, const char *source);
123 static void _add_chars_till_limit(Evas_Object *obj, char **text, int can_add, Length_Unit unit);
125 static const char SIG_CHANGED[] = "changed";
126 static const char SIG_CHANGED_USER[] = "changed,user";
127 static const char SIG_ACTIVATED[] = "activated";
128 static const char SIG_PRESS[] = "press";
129 static const char SIG_LONGPRESSED[] = "longpressed";
130 static const char SIG_CLICKED[] = "clicked";
131 static const char SIG_CLICKED_DOUBLE[] = "clicked,double";
132 static const char SIG_CLICKED_TRIPLE[] = "clicked,triple";
133 static const char SIG_FOCUSED[] = "focused";
134 static const char SIG_UNFOCUSED[] = "unfocused";
135 static const char SIG_SELECTION_PASTE[] = "selection,paste";
136 static const char SIG_SELECTION_COPY[] = "selection,copy";
137 static const char SIG_SELECTION_CUT[] = "selection,cut";
138 static const char SIG_SELECTION_START[] = "selection,start";
139 static const char SIG_SELECTION_CHANGED[] = "selection,changed";
140 static const char SIG_SELECTION_CLEARED[] = "selection,cleared";
141 static const char SIG_CURSOR_CHANGED[] = "cursor,changed";
142 static const char SIG_ANCHOR_CLICKED[] = "anchor,clicked";
143 static const char SIG_ANCHOR_DOWN[] = "anchor,down";
144 static const char SIG_ANCHOR_UP[] = "anchor,up";
145 static const char SIG_ANCHOR_IN[] = "anchor,in";
146 static const char SIG_ANCHOR_OUT[] = "anchor,out";
147 static const char SIG_PREEDIT_CHANGED[] = "preedit,changed";
148 static const Evas_Smart_Cb_Description _signals[] = {
152 {SIG_LONGPRESSED, ""},
154 {SIG_CLICKED_DOUBLE, ""},
155 {SIG_CLICKED_TRIPLE, ""},
158 {SIG_SELECTION_PASTE, ""},
159 {SIG_SELECTION_COPY, ""},
160 {SIG_SELECTION_CUT, ""},
161 {SIG_SELECTION_START, ""},
162 {SIG_SELECTION_CHANGED, ""},
163 {SIG_SELECTION_CLEARED, ""},
164 {SIG_CURSOR_CHANGED, ""},
165 {SIG_ANCHOR_CLICKED, ""},
166 {SIG_ANCHOR_DOWN, ""},
169 {SIG_ANCHOR_OUT, ""},
170 {SIG_PREEDIT_CHANGED, ""},
171 {SIG_CHANGED_USER, ""},
175 static Eina_List *entries = NULL;
179 void (*obj_hook) (Evas_Object *obj);
180 void (*obj_unhook) (Evas_Object *obj);
181 void (*obj_longpress) (Evas_Object *obj);
185 _module(Evas_Object *obj __UNUSED__)
187 static Elm_Module *m = NULL;
188 if (m) goto ok; // already found - just use
189 if (!(m = _elm_module_find_as("entry/api"))) return NULL;
191 m->api = malloc(sizeof(Mod_Api));
192 if (!m->api) return NULL;
193 ((Mod_Api *)(m->api) )->obj_hook = // called on creation
194 _elm_module_symbol_get(m, "obj_hook");
195 ((Mod_Api *)(m->api) )->obj_unhook = // called on deletion
196 _elm_module_symbol_get(m, "obj_unhook");
197 ((Mod_Api *)(m->api) )->obj_longpress = // called on long press menu
198 _elm_module_symbol_get(m, "obj_longpress");
199 ok: // ok - return api
204 _buf_append(char *buf, const char *str, int *len, int *alloc)
206 int len2 = strlen(str);
207 if ((*len + len2) >= *alloc)
209 char *buf2 = realloc(buf, *alloc + len2 + 512);
210 if (!buf2) return NULL;
212 *alloc += (512 + len2);
214 strcpy(buf + *len, str);
220 _load_file(const char *file)
224 int alloc = 0, len = 0;
225 char *text = NULL, buf[16384 + 1];
227 f = fopen(file, "rb");
229 while ((size = fread(buf, 1, sizeof(buf) - 1, f)))
233 tmp_text = _buf_append(text, buf, &len, &alloc);
234 if (!tmp_text) break;
242 _load_plain(const char *file)
246 text = _load_file(file);
251 text2 = elm_entry_utf8_to_markup(text);
259 _load(Evas_Object *obj)
261 Widget_Data *wd = elm_widget_data_get(obj);
266 elm_entry_entry_set(obj, "");
271 case ELM_TEXT_FORMAT_PLAIN_UTF8:
272 text = _load_plain(wd->file);
274 case ELM_TEXT_FORMAT_MARKUP_UTF8:
275 text = _load_file(wd->file);
283 elm_entry_entry_set(obj, text);
287 elm_entry_entry_set(obj, "");
291 _save_markup_utf8(const char *file, const char *text)
295 if ((!text) || (!text[0]))
297 ecore_file_unlink(file);
300 f = fopen(file, "wb");
303 // FIXME: report a write error
306 fputs(text, f); // FIXME: catch error
311 _save_plain_utf8(const char *file, const char *text)
315 text2 = elm_entry_markup_to_utf8(text);
318 _save_markup_utf8(file, text2);
323 _save(Evas_Object *obj)
325 Widget_Data *wd = elm_widget_data_get(obj);
327 if (!wd->file) return;
330 case ELM_TEXT_FORMAT_PLAIN_UTF8:
331 _save_plain_utf8(wd->file, elm_entry_entry_get(obj));
333 case ELM_TEXT_FORMAT_MARKUP_UTF8:
334 _save_markup_utf8(wd->file, elm_entry_entry_get(obj));
342 _delay_write(void *data)
344 Widget_Data *wd = elm_widget_data_get(data);
345 if (!wd) return ECORE_CALLBACK_CANCEL;
347 wd->delay_write = NULL;
348 return ECORE_CALLBACK_CANCEL;
351 static Elm_Entry_Text_Filter *
352 _filter_new(Elm_Entry_Filter_Cb func, void *data)
354 Elm_Entry_Text_Filter *tf = ELM_NEW(Elm_Entry_Text_Filter);
355 if (!tf) return NULL;
358 if (func == elm_entry_filter_limit_size)
360 Elm_Entry_Filter_Limit_Size *lim = data, *lim2;
367 lim2 = malloc(sizeof(Elm_Entry_Filter_Limit_Size));
373 memcpy(lim2, lim, sizeof(Elm_Entry_Filter_Limit_Size));
376 else if (func == elm_entry_filter_accept_set)
378 Elm_Entry_Filter_Accept_Set *as = data, *as2;
385 as2 = malloc(sizeof(Elm_Entry_Filter_Accept_Set));
392 as2->accepted = eina_stringshare_add(as->accepted);
394 as2->accepted = NULL;
396 as2->rejected = eina_stringshare_add(as->rejected);
398 as2->rejected = NULL;
407 _filter_free(Elm_Entry_Text_Filter *tf)
409 if (tf->func == elm_entry_filter_limit_size)
411 Elm_Entry_Filter_Limit_Size *lim = tf->data;
414 else if (tf->func == elm_entry_filter_accept_set)
416 Elm_Entry_Filter_Accept_Set *as = tf->data;
419 if (as->accepted) eina_stringshare_del(as->accepted);
420 if (as->rejected) eina_stringshare_del(as->rejected);
428 _del_pre_hook(Evas_Object *obj)
430 Widget_Data *wd = elm_widget_data_get(obj);
434 ecore_timer_del(wd->delay_write);
435 wd->delay_write = NULL;
436 if (wd->autosave) _save(obj);
441 _del_hook(Evas_Object *obj)
443 Widget_Data *wd = elm_widget_data_get(obj);
444 Elm_Entry_Context_Menu_Item *it;
445 Elm_Entry_Item_Provider *ip;
446 Elm_Entry_Text_Filter *tf;
448 if (wd->file) eina_stringshare_del(wd->file);
450 if (wd->hovdeljob) ecore_job_del(wd->hovdeljob);
451 if ((wd->api) && (wd->api->obj_unhook)) wd->api->obj_unhook(obj); // module - unhook
453 entries = eina_list_remove(entries, obj);
454 #ifdef HAVE_ELEMENTARY_X
455 if (wd->sel_notify_handler)
456 ecore_event_handler_del(wd->sel_notify_handler);
457 if (wd->sel_clear_handler)
458 ecore_event_handler_del(wd->sel_clear_handler);
460 if (wd->cut_sel) eina_stringshare_del(wd->cut_sel);
461 if (wd->text) eina_stringshare_del(wd->text);
462 if (wd->deferred_recalc_job) ecore_job_del(wd->deferred_recalc_job);
463 if (wd->append_text_idler)
465 ecore_idler_del(wd->append_text_idler);
466 free(wd->append_text_left);
467 wd->append_text_left = NULL;
468 wd->append_text_idler = NULL;
470 if (wd->longpress_timer) ecore_timer_del(wd->longpress_timer);
471 EINA_LIST_FREE(wd->items, it)
473 eina_stringshare_del(it->label);
474 eina_stringshare_del(it->icon_file);
475 eina_stringshare_del(it->icon_group);
478 EINA_LIST_FREE(wd->item_providers, ip)
482 EINA_LIST_FREE(wd->text_filters, tf)
490 _mirrored_set(Evas_Object *obj, Eina_Bool rtl)
492 Widget_Data *wd = elm_widget_data_get(obj);
493 edje_object_mirrored_set(wd->ent, rtl);
497 _theme_hook(Evas_Object *obj)
499 Widget_Data *wd = elm_widget_data_get(obj);
501 _elm_widget_mirrored_reload(obj);
502 _mirrored_set(obj, elm_widget_mirrored_get(obj));
504 t = eina_stringshare_add(elm_entry_entry_get(obj));
505 _elm_theme_object_set(obj, wd->ent, "entry", _getbase(obj), elm_widget_style_get(obj));
506 if (_elm_config->desktop_entry)
507 edje_object_part_text_select_allow_set(wd->ent, "elm.text", EINA_TRUE);
508 elm_entry_entry_set(obj, t);
509 eina_stringshare_del(t);
510 if (elm_widget_disabled_get(obj))
511 edje_object_signal_emit(wd->ent, "elm,state,disabled", "elm");
512 edje_object_part_text_input_panel_layout_set(wd->ent, "elm.text", wd->input_panel_layout);
513 elm_entry_cursor_pos_set(obj, wd->cursor_pos);
514 if (elm_widget_focus_get(obj))
515 edje_object_signal_emit(wd->ent, "elm,action,focus", "elm");
516 edje_object_message_signal_process(wd->ent);
517 edje_object_scale_set(wd->ent, elm_widget_scale_get(obj) * _elm_config->scale);
518 elm_smart_scroller_mirrored_set(wd->scroller, elm_widget_mirrored_get(obj));
519 elm_smart_scroller_object_theme_set(obj, wd->scroller, "scroller", "entry",
520 elm_widget_style_get(obj));
526 edj = elm_smart_scroller_edje_object_get(wd->scroller);
527 str = edje_object_data_get(edj, "focus_highlight");
528 if ((str) && (!strcmp(str, "on")))
529 elm_widget_highlight_in_theme_set(obj, EINA_TRUE);
531 elm_widget_highlight_in_theme_set(obj, EINA_FALSE);
537 _disable_hook(Evas_Object *obj)
539 Widget_Data *wd = elm_widget_data_get(obj);
541 if (elm_widget_disabled_get(obj))
543 edje_object_signal_emit(wd->ent, "elm,state,disabled", "elm");
544 wd->disabled = EINA_TRUE;
548 edje_object_signal_emit(wd->ent, "elm,state,enabled", "elm");
549 wd->disabled = EINA_FALSE;
554 _recalc_cursor_geometry(Evas_Object *obj)
556 Widget_Data *wd = elm_widget_data_get(obj);
558 evas_object_smart_callback_call(obj, SIG_CURSOR_CHANGED, NULL);
559 if (!wd->deferred_recalc_job)
561 Evas_Coord cx, cy, cw, ch;
562 edje_object_part_text_cursor_geometry_get(wd->ent, "elm.text",
566 elm_widget_show_region_set(obj, cx, cy, cw, ch, EINA_FALSE);
567 wd->cur_changed = EINA_FALSE;
571 wd->deferred_cur = EINA_TRUE;
575 _elm_deferred_recalc_job(void *data)
577 Widget_Data *wd = elm_widget_data_get(data);
578 Evas_Coord minh = -1, resw = -1, minw = -1, fw = 0, fh = 0;
580 wd->deferred_recalc_job = NULL;
582 evas_object_geometry_get(wd->ent, NULL, NULL, &resw, NULL);
583 edje_object_size_min_restricted_calc(wd->ent, &minw, &minh, resw, 0);
584 elm_coords_finger_size_adjust(1, &minw, 1, &minh);
587 /* This is a hack to workaround the way min size hints are treated.
588 * If the minimum width is smaller than the restricted width, it means
589 * the mininmum doesn't matter. */
592 Evas_Coord ominw = -1;
593 evas_object_size_hint_min_get(data, &ominw, NULL);
597 elm_coords_finger_size_adjust(1, &fw, 1, &fh);
600 Evas_Coord vmw = 0, vmh = 0;
602 edje_object_size_min_calc
603 (elm_smart_scroller_edje_object_get(wd->scroller),
607 evas_object_size_hint_min_set(data, vmw, minh + vmh);
608 evas_object_size_hint_max_set(data, -1, minh + vmh);
612 evas_object_size_hint_min_set(data, vmw, vmh);
613 evas_object_size_hint_max_set(data, -1, -1);
620 evas_object_size_hint_min_set(data, minw, minh);
621 evas_object_size_hint_max_set(data, -1, minh);
625 evas_object_size_hint_min_set(data, fw, minh);
626 evas_object_size_hint_max_set(data, -1, -1);
630 if (wd->deferred_cur)
632 Evas_Coord cx, cy, cw, ch;
633 edje_object_part_text_cursor_geometry_get(wd->ent, "elm.text",
637 elm_widget_show_region_set(data, cx, cy, cw, ch, EINA_FALSE);
638 wd->cur_changed = EINA_FALSE;
644 _sizing_eval(Evas_Object *obj)
646 Widget_Data *wd = elm_widget_data_get(obj);
647 Evas_Coord minw = -1, minh = -1;
648 Evas_Coord resw, resh;
651 evas_object_geometry_get(obj, NULL, NULL, &resw, &resh);
654 if ((resw == wd->lastw) && (!wd->changed)) return;
655 wd->changed = EINA_FALSE;
659 Evas_Coord vw = 0, vh = 0, vmw = 0, vmh = 0, w = -1, h = -1;
661 evas_object_resize(wd->scroller, resw, resh);
662 edje_object_size_min_calc
663 (elm_smart_scroller_edje_object_get(wd->scroller),
665 elm_smart_scroller_child_viewport_size_get(wd->scroller, &vw, &vh);
666 edje_object_size_min_restricted_calc(wd->ent, &minw, &minh, vw, 0);
669 elm_coords_finger_size_adjust(1, &minw, 1, &minh);
671 if ((minw > 0) && (vw < minw)) vw = minw;
672 if (minh > vh) vh = minh;
674 if (wd->single_line) h = vmh + minh;
676 evas_object_resize(wd->ent, vw, vh);
677 evas_object_size_hint_min_set(obj, w, h);
679 evas_object_size_hint_max_set(obj, -1, h);
681 evas_object_size_hint_max_set(obj, -1, -1);
685 if (wd->deferred_recalc_job) ecore_job_del(wd->deferred_recalc_job);
686 wd->deferred_recalc_job = ecore_job_add(_elm_deferred_recalc_job, obj);
691 if (!wd->changed) return;
692 wd->changed = EINA_FALSE;
696 Evas_Coord vw = 0, vh = 0, vmw = 0, vmh = 0, w = -1, h = -1;
698 edje_object_size_min_calc(wd->ent, &minw, &minh);
701 elm_coords_finger_size_adjust(1, &minw, 1, &minh);
703 elm_smart_scroller_child_viewport_size_get(wd->scroller, &vw, &vh);
705 if ((minw > 0) && (vw < minw)) vw = minw;
706 if (minh > 0) vh = minh;
708 evas_object_resize(wd->ent, vw, vh);
709 edje_object_size_min_calc
710 (elm_smart_scroller_edje_object_get(wd->scroller),
712 if (wd->single_line) h = vmh + minh;
714 evas_object_size_hint_min_set(obj, w, h);
716 evas_object_size_hint_max_set(obj, -1, h);
718 evas_object_size_hint_max_set(obj, -1, -1);
722 edje_object_size_min_calc(wd->ent, &minw, &minh);
725 elm_coords_finger_size_adjust(1, &minw, 1, &minh);
726 evas_object_size_hint_min_set(obj, minw, minh);
728 evas_object_size_hint_max_set(obj, -1, minh);
730 evas_object_size_hint_max_set(obj, -1, -1);
734 _recalc_cursor_geometry(obj);
738 _on_focus_hook(void *data __UNUSED__, Evas_Object *obj)
740 Widget_Data *wd = elm_widget_data_get(obj);
741 Evas_Object *top = elm_widget_top_get(obj);
743 if (!wd->editable) return;
744 if (elm_widget_focus_get(obj))
746 evas_object_focus_set(wd->ent, EINA_TRUE);
747 edje_object_signal_emit(wd->ent, "elm,action,focus", "elm");
748 if (top) elm_win_keyboard_mode_set(top, ELM_WIN_KEYBOARD_ON);
749 evas_object_smart_callback_call(obj, SIG_FOCUSED, NULL);
753 edje_object_signal_emit(wd->ent, "elm,action,unfocus", "elm");
754 evas_object_focus_set(wd->ent, EINA_FALSE);
755 if (top) elm_win_keyboard_mode_set(top, ELM_WIN_KEYBOARD_OFF);
756 evas_object_smart_callback_call(obj, SIG_UNFOCUSED, NULL);
761 _content_del(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
763 Widget_Data *wd = elm_widget_data_get(data);
766 elm_widget_sub_object_del(data, obj);
767 edje_object_part_unswallow(wd->ent, obj);
771 _content_set_hook(Evas_Object *obj, const char *part, Evas_Object *content)
773 Widget_Data *wd = elm_widget_data_get(obj);
774 if ((!wd) || (!content)) return;
776 elm_widget_sub_object_add(obj, content);
777 evas_object_event_callback_add(content, EVAS_CALLBACK_DEL, _content_del, obj);
778 edje_object_part_swallow(wd->ent, part, content);
783 _content_unset_hook(Evas_Object *obj, const char *part)
785 Widget_Data *wd = elm_widget_data_get(obj);
786 Evas_Object *content;
787 if (!wd) return NULL;
789 content = (Evas_Object *)edje_object_part_object_get(wd->ent, part);
790 if (!content) return NULL;
791 elm_widget_sub_object_del(obj, content);
792 evas_object_event_callback_del(content, EVAS_CALLBACK_DEL, _content_del);
793 edje_object_part_unswallow(wd->ent, content);
800 _content_get_hook(const Evas_Object *obj, const char *part)
802 Widget_Data *wd = elm_widget_data_get(obj);
803 Evas_Object *content;
804 if (!wd) return NULL;
806 content = (Evas_Object *)edje_object_part_object_get(wd->ent, part);
811 _signal_emit_hook(Evas_Object *obj, const char *emission, const char *source)
813 Widget_Data *wd = elm_widget_data_get(obj);
815 edje_object_signal_emit(wd->ent, emission, source);
817 edje_object_signal_emit(elm_smart_scroller_edje_object_get(wd->scroller),
822 _signal_callback_add_hook(Evas_Object *obj, const char *emission, const char *source, Edje_Signal_Cb func_cb, void *data)
824 Widget_Data *wd = elm_widget_data_get(obj);
826 edje_object_signal_callback_add(wd->ent, emission, source, func_cb, data);
828 edje_object_signal_callback_add(elm_smart_scroller_edje_object_get(wd->scroller),
829 emission, source, func_cb, data);
833 _signal_callback_del_hook(Evas_Object *obj, const char *emission, const char *source, Edje_Signal_Cb func_cb, void *data)
835 Widget_Data *wd = elm_widget_data_get(obj);
836 edje_object_signal_callback_del_full(wd->ent, emission, source, func_cb,
839 edje_object_signal_callback_del_full(elm_smart_scroller_edje_object_get(wd->scroller),
840 emission, source, func_cb, data);
844 _on_focus_region_hook(const Evas_Object *obj, Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *h)
846 Widget_Data *wd = elm_widget_data_get(obj);
847 edje_object_part_text_cursor_geometry_get(wd->ent, "elm.text", x, y, w, h);
851 _focus_region_hook(Evas_Object *obj, Evas_Coord x, Evas_Coord y, Evas_Coord w, Evas_Coord h)
853 Widget_Data *wd = elm_widget_data_get(obj);
855 elm_smart_scroller_child_region_show(wd->scroller, x, y, w, h);
859 _show_region_hook(void *data, Evas_Object *obj)
861 Widget_Data *wd = elm_widget_data_get(data);
862 Evas_Coord x, y, w, h;
864 elm_widget_show_region_get(obj, &x, &y, &w, &h);
866 elm_smart_scroller_child_region_show(wd->scroller, x, y, w, h);
870 _hoversel_position(Evas_Object *obj)
872 Widget_Data *wd = elm_widget_data_get(obj);
873 Evas_Coord cx, cy, cw, ch, x, y, mw, mh;
878 evas_object_geometry_get(wd->ent, &x, &y, NULL, NULL);
887 edje_object_part_text_cursor_geometry_get(wd->ent, "elm.text",
889 evas_object_size_hint_min_get(wd->hoversel, &mw, &mh);
900 evas_object_move(wd->hoversel, x + cx, y + cy);
901 evas_object_resize(wd->hoversel, cw, ch);
905 _move(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
907 Widget_Data *wd = elm_widget_data_get(data);
909 if (wd->hoversel) _hoversel_position(data);
913 _resize(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
915 Widget_Data *wd = elm_widget_data_get(data);
924 Evas_Coord vw = 0, vh = 0;
926 elm_smart_scroller_child_viewport_size_get(wd->scroller, &vw, &vh);
927 if (vw < wd->entmw) vw = wd->entmw;
928 if (vh < wd->entmh) vh = wd->entmh;
929 evas_object_resize(wd->ent, vw, vh);
931 if (wd->hoversel) _hoversel_position(data);
935 _hover_del(void *data)
937 Widget_Data *wd = elm_widget_data_get(data);
942 evas_object_del(wd->hoversel);
945 wd->hovdeljob = NULL;
949 _dismissed(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
951 Widget_Data *wd = elm_widget_data_get(data);
954 if (wd->hoversel) evas_object_hide(wd->hoversel);
957 if (!_elm_config->desktop_entry)
960 edje_object_part_text_select_allow_set(wd->ent, "elm.text", EINA_TRUE);
963 elm_widget_scroll_freeze_pop(data);
964 if (wd->hovdeljob) ecore_job_del(wd->hovdeljob);
965 wd->hovdeljob = ecore_job_add(_hover_del, data);
969 _select(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
971 Widget_Data *wd = elm_widget_data_get(data);
973 wd->selmode = EINA_TRUE;
974 edje_object_part_text_select_none(wd->ent, "elm.text");
975 if (!_elm_config->desktop_entry)
978 edje_object_part_text_select_allow_set(wd->ent, "elm.text", EINA_TRUE);
980 edje_object_signal_emit(wd->ent, "elm,state,select,on", "elm");
981 if (!_elm_config->desktop_entry)
982 elm_widget_scroll_hold_push(data);
986 _elm_entry_entry_paste(Evas_Object *obj, const char *entry)
988 elm_entry_entry_insert(obj, entry);
989 evas_object_smart_callback_call(obj, SIG_CHANGED_USER, NULL);
993 _paste(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
995 Widget_Data *wd = elm_widget_data_get(data);
997 evas_object_smart_callback_call(data, SIG_SELECTION_PASTE, NULL);
998 if (wd->sel_notify_handler)
1000 #ifdef HAVE_ELEMENTARY_X
1001 Elm_Sel_Format formats;
1002 wd->selection_asked = EINA_TRUE;
1003 formats = ELM_SEL_FORMAT_MARKUP;
1005 formats |= ELM_SEL_FORMAT_IMAGE;
1006 elm_selection_get(ELM_SEL_CLIPBOARD, formats, data, NULL, NULL);
1012 _store_selection(Elm_Sel_Type seltype, Evas_Object *obj)
1014 Widget_Data *wd = elm_widget_data_get(obj);
1018 sel = edje_object_part_text_selection_get(wd->ent, "elm.text");
1019 if ((!sel) || (!sel[0])) return; /* avoid deleting our own selection */
1020 elm_selection_set(seltype, obj, ELM_SEL_FORMAT_MARKUP, sel);
1021 if (seltype == ELM_SEL_CLIPBOARD)
1022 eina_stringshare_replace(&wd->cut_sel, sel);
1026 _cut(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
1028 Widget_Data *wd = elm_widget_data_get(data);
1031 wd->selmode = EINA_FALSE;
1032 if (!_elm_config->desktop_entry)
1033 edje_object_part_text_select_allow_set(wd->ent, "elm.text", EINA_FALSE);
1034 edje_object_signal_emit(wd->ent, "elm,state,select,off", "elm");
1035 if (!_elm_config->desktop_entry)
1036 elm_widget_scroll_hold_pop(data);
1037 _store_selection(ELM_SEL_CLIPBOARD, data);
1038 edje_object_part_text_insert(wd->ent, "elm.text", "");
1039 edje_object_part_text_select_none(wd->ent, "elm.text");
1044 _copy(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
1046 Widget_Data *wd = elm_widget_data_get(data);
1048 wd->selmode = EINA_FALSE;
1049 if (!_elm_config->desktop_entry)
1051 edje_object_part_text_select_allow_set(wd->ent, "elm.text", EINA_FALSE);
1052 edje_object_signal_emit(wd->ent, "elm,state,select,off", "elm");
1053 elm_widget_scroll_hold_pop(data);
1055 _store_selection(ELM_SEL_CLIPBOARD, data);
1056 // edje_object_part_text_select_none(wd->ent, "elm.text");
1060 _cancel(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
1062 Widget_Data *wd = elm_widget_data_get(data);
1064 wd->selmode = EINA_FALSE;
1065 if (!_elm_config->desktop_entry)
1066 edje_object_part_text_select_allow_set(wd->ent, "elm.text", EINA_FALSE);
1067 edje_object_signal_emit(wd->ent, "elm,state,select,off", "elm");
1068 if (!_elm_config->desktop_entry)
1069 elm_widget_scroll_hold_pop(data);
1070 edje_object_part_text_select_none(wd->ent, "elm.text");
1074 _item_clicked(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
1076 Elm_Entry_Context_Menu_Item *it = data;
1077 Evas_Object *obj2 = it->obj;
1078 if (it->func) it->func(it->data, obj2, NULL);
1082 _menu_press(Evas_Object *obj)
1084 Widget_Data *wd = elm_widget_data_get(obj);
1087 const Elm_Entry_Context_Menu_Item *it;
1089 if ((wd->api) && (wd->api->obj_longpress))
1091 wd->api->obj_longpress(obj);
1093 else if (wd->context_menu)
1095 const char *context_menu_orientation;
1097 if (wd->hoversel) evas_object_del(wd->hoversel);
1098 else elm_widget_scroll_freeze_push(obj);
1099 wd->hoversel = elm_hoversel_add(obj);
1100 context_menu_orientation = edje_object_data_get
1101 (wd->ent, "context_menu_orientation");
1102 if ((context_menu_orientation) &&
1103 (!strcmp(context_menu_orientation, "horizontal")))
1104 elm_hoversel_horizontal_set(wd->hoversel, EINA_TRUE);
1105 elm_object_style_set(wd->hoversel, "entry");
1106 elm_widget_sub_object_add(obj, wd->hoversel);
1107 elm_object_text_set(wd->hoversel, "Text");
1108 top = elm_widget_top_get(obj);
1109 if (top) elm_hoversel_hover_parent_set(wd->hoversel, top);
1110 evas_object_smart_callback_add(wd->hoversel, "dismissed", _dismissed, obj);
1111 if (wd->have_selection)
1115 if (wd->have_selection)
1117 elm_hoversel_item_add(wd->hoversel, E_("Copy"), NULL, ELM_ICON_NONE,
1120 elm_hoversel_item_add(wd->hoversel, E_("Cut"), NULL, ELM_ICON_NONE,
1123 elm_hoversel_item_add(wd->hoversel, E_("Cancel"), NULL, ELM_ICON_NONE,
1131 if (!_elm_config->desktop_entry)
1134 elm_hoversel_item_add(wd->hoversel, E_("Select"), NULL, ELM_ICON_NONE,
1137 if (elm_selection_selection_has_owner())
1140 elm_hoversel_item_add(wd->hoversel, E_("Paste"), NULL, ELM_ICON_NONE,
1145 EINA_LIST_FOREACH(wd->items, l, it)
1147 elm_hoversel_item_add(wd->hoversel, it->label, it->icon_file,
1148 it->icon_type, _item_clicked, it);
1152 _hoversel_position(obj);
1153 evas_object_show(wd->hoversel);
1154 elm_hoversel_hover_begin(wd->hoversel);
1156 if (!_elm_config->desktop_entry)
1158 edje_object_part_text_select_allow_set(wd->ent, "elm.text", EINA_FALSE);
1159 edje_object_part_text_select_abort(wd->ent, "elm.text");
1165 _long_press(void *data)
1167 Widget_Data *wd = elm_widget_data_get(data);
1168 if (!wd) return ECORE_CALLBACK_CANCEL;
1170 wd->longpress_timer = NULL;
1171 evas_object_smart_callback_call(data, SIG_LONGPRESSED, NULL);
1172 return ECORE_CALLBACK_CANCEL;
1176 _mouse_down(void *data, Evas *evas __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
1178 Widget_Data *wd = elm_widget_data_get(data);
1179 Evas_Event_Mouse_Down *ev = event_info;
1181 if (wd->disabled) return;
1182 if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return;
1183 wd->downx = ev->canvas.x;
1184 wd->downy = ev->canvas.y;
1185 if (ev->button == 1)
1187 if (wd->longpress_timer) ecore_timer_del(wd->longpress_timer);
1188 wd->longpress_timer = ecore_timer_add(_elm_config->longpress_timeout, _long_press, data);
1193 _mouse_up(void *data, Evas *evas __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
1195 Widget_Data *wd = elm_widget_data_get(data);
1196 Evas_Event_Mouse_Up *ev = event_info;
1198 if (wd->disabled) return;
1199 if (ev->button == 1)
1201 if (wd->longpress_timer)
1203 ecore_timer_del(wd->longpress_timer);
1204 wd->longpress_timer = NULL;
1207 else if (ev->button == 3)
1215 _mouse_move(void *data, Evas *evas __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
1217 Widget_Data *wd = elm_widget_data_get(data);
1218 Evas_Event_Mouse_Move *ev = event_info;
1220 if (wd->disabled) return;
1223 if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD)
1225 if (wd->longpress_timer)
1227 ecore_timer_del(wd->longpress_timer);
1228 wd->longpress_timer = NULL;
1231 else if (wd->longpress_timer)
1235 dx = wd->downx - ev->cur.canvas.x;
1237 dy = wd->downy - ev->cur.canvas.y;
1240 ((_elm_config->finger_size / 2) *
1241 (_elm_config->finger_size / 2)))
1243 ecore_timer_del(wd->longpress_timer);
1244 wd->longpress_timer = NULL;
1248 else if (wd->longpress_timer)
1252 dx = wd->downx - ev->cur.canvas.x;
1254 dy = wd->downy - ev->cur.canvas.y;
1257 ((_elm_config->finger_size / 2) *
1258 (_elm_config->finger_size / 2)))
1260 ecore_timer_del(wd->longpress_timer);
1261 wd->longpress_timer = NULL;
1267 _getbase(Evas_Object *obj)
1269 Widget_Data *wd = elm_widget_data_get(obj);
1270 if (!wd) return "base";
1273 if (wd->password) return "base-password";
1276 if (wd->single_line) return "base-single";
1279 switch (wd->linewrap)
1282 return "base-charwrap";
1285 case ELM_WRAP_MIXED:
1286 return "base-mixedwrap";
1289 return "base-nowrap";
1296 if (wd->password) return "base-password";
1299 if (wd->single_line) return "base-single-noedit";
1302 switch (wd->linewrap)
1305 return "base-noedit-charwrap";
1307 return "base-noedit";
1308 case ELM_WRAP_MIXED:
1309 return "base-noedit-mixedwrap";
1312 return "base-nowrap-noedit";
1321 _entry_changed_common_handling(void *data, const char *event)
1323 Widget_Data *wd = elm_widget_data_get(data);
1326 wd->changed = EINA_TRUE;
1327 /* Reset the size hints which are no more relevant.
1328 * Keep the height, this is a hack, but doesn't really matter
1329 * cause we'll re-eval in a moment. */
1330 evas_object_size_hint_min_get(data, NULL, &minh);
1331 evas_object_size_hint_min_set(data, -1, minh);
1333 if (wd->text) eina_stringshare_del(wd->text);
1335 evas_object_smart_callback_call(data, event, NULL);
1336 if (wd->delay_write)
1338 ecore_timer_del(wd->delay_write);
1339 wd->delay_write = NULL;
1341 if ((!wd->autosave) || (!wd->file)) return;
1342 wd->delay_write = ecore_timer_add(2.0, _delay_write, data);
1346 _signal_entry_changed(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__)
1348 _entry_changed_common_handling(data, SIG_CHANGED);
1352 _signal_entry_changed_user(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__)
1354 evas_object_smart_callback_call(data, SIG_CHANGED_USER, NULL);
1358 _signal_preedit_changed(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__)
1360 _entry_changed_common_handling(data, SIG_PREEDIT_CHANGED);
1364 _signal_selection_start(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__)
1366 Widget_Data *wd = elm_widget_data_get(data);
1370 EINA_LIST_FOREACH(entries, l, entry)
1372 if (entry != data) elm_entry_select_none(entry);
1374 wd->have_selection = EINA_TRUE;
1375 evas_object_smart_callback_call(data, SIG_SELECTION_START, NULL);
1376 #ifdef HAVE_ELEMENTARY_X
1377 if (wd->sel_notify_handler)
1379 const char *txt = elm_entry_selection_get(data);
1382 top = elm_widget_top_get(data);
1383 if ((top) && (elm_win_xwindow_get(top)))
1384 elm_selection_set(ELM_SEL_PRIMARY, data, ELM_SEL_FORMAT_MARKUP, txt);
1390 _signal_selection_all(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__)
1392 Widget_Data *wd = elm_widget_data_get(data);
1394 elm_entry_select_all(data);
1398 _signal_selection_none(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__)
1400 Widget_Data *wd = elm_widget_data_get(data);
1402 elm_entry_select_none(data);
1406 _signal_selection_changed(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__)
1408 Widget_Data *wd = elm_widget_data_get(data);
1410 wd->have_selection = EINA_TRUE;
1411 evas_object_smart_callback_call(data, SIG_SELECTION_CHANGED, NULL);
1412 _store_selection(ELM_SEL_PRIMARY, data);
1416 _signal_selection_cleared(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__)
1418 Widget_Data *wd = elm_widget_data_get(data);
1420 if (!wd->have_selection) return;
1421 wd->have_selection = EINA_FALSE;
1422 evas_object_smart_callback_call(data, SIG_SELECTION_CLEARED, NULL);
1423 if (wd->sel_notify_handler)
1427 #ifdef HAVE_ELEMENTARY_X
1430 top = elm_widget_top_get(data);
1431 if ((top) && (elm_win_xwindow_get(top)))
1432 elm_selection_set(ELM_SEL_PRIMARY, data, ELM_SEL_FORMAT_MARKUP,
1435 eina_stringshare_del(wd->cut_sel);
1440 #ifdef HAVE_ELEMENTARY_X
1443 top = elm_widget_top_get(data);
1444 if ((top) && (elm_win_xwindow_get(top)))
1445 elm_selection_clear(ELM_SEL_PRIMARY, data);
1452 _signal_entry_paste_request(void *data, Evas_Object *obj __UNUSED__, const char *emission, const char *source __UNUSED__)
1454 Widget_Data *wd = elm_widget_data_get(data);
1455 Elm_Sel_Type type = (emission[sizeof("ntry,paste,request,")] == '1') ? ELM_SEL_PRIMARY : ELM_SEL_CLIPBOARD;
1457 evas_object_smart_callback_call(data, SIG_SELECTION_PASTE, NULL);
1458 if (wd->sel_notify_handler)
1460 #ifdef HAVE_ELEMENTARY_X
1463 top = elm_widget_top_get(data);
1464 if ((top) && (elm_win_xwindow_get(top)))
1466 wd->selection_asked = EINA_TRUE;
1467 elm_selection_get(type, ELM_SEL_FORMAT_MARKUP, data,
1475 _signal_entry_copy_notify(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__)
1477 _copy(data, NULL, NULL);
1481 _signal_entry_cut_notify(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__)
1483 _cut(data, NULL, NULL);
1487 _signal_cursor_changed(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__)
1489 Widget_Data *wd = elm_widget_data_get(data);
1491 wd->cursor_pos = edje_object_part_text_cursor_pos_get(wd->ent, "elm.text", EDJE_CURSOR_MAIN);
1492 wd->cur_changed = EINA_TRUE;
1493 _recalc_cursor_geometry(data);
1497 _signal_anchor_geoms_do_things_with(Widget_Data *wd, Elm_Entry_Anchor_Info *ei)
1499 const Eina_List *geoms, *l;
1500 Evas_Textblock_Rectangle *r;
1501 Evas_Coord px, py, x, y;
1503 geoms = edje_object_part_text_anchor_geometry_get(wd->ent, "elm.text", ei->name);
1507 evas_object_geometry_get(wd->ent, &x, &y, NULL, NULL);
1508 evas_pointer_canvas_xy_get(evas_object_evas_get(wd->ent), &px, &py);
1509 EINA_LIST_FOREACH(geoms, l, r)
1511 if (((r->x + x) <= px) && ((r->y + y) <= py) &&
1512 ((r->x + x + r->w) > px) && ((r->y + y + r->h) > py))
1524 _signal_anchor_down(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__)
1526 Widget_Data *wd = elm_widget_data_get(data);
1527 Elm_Entry_Anchor_Info ei;
1531 p = emission + sizeof("nchor,mouse,down,");
1532 ei.button = strtol(p, &p2, 10);
1534 ei.x = ei.y = ei.w = ei.h = 0;
1536 _signal_anchor_geoms_do_things_with(wd, &ei);
1539 evas_object_smart_callback_call(data, SIG_ANCHOR_DOWN, &ei);
1543 _signal_anchor_up(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__)
1545 Widget_Data *wd = elm_widget_data_get(data);
1546 Elm_Entry_Anchor_Info ei;
1550 p = emission + sizeof("nchor,mouse,up,");
1551 ei.button = strtol(p, &p2, 10);
1553 ei.x = ei.y = ei.w = ei.h = 0;
1555 _signal_anchor_geoms_do_things_with(wd, &ei);
1558 evas_object_smart_callback_call(data, SIG_ANCHOR_UP, &ei);
1562 _signal_anchor_clicked(void *data, Evas_Object *obj __UNUSED__, const char *emission, const char *source __UNUSED__)
1564 Widget_Data *wd = elm_widget_data_get(data);
1565 Elm_Entry_Anchor_Info ei;
1569 p = emission + sizeof("nchor,mouse,clicked,");
1570 ei.button = strtol(p, &p2, 10);
1572 ei.x = ei.y = ei.w = ei.h = 0;
1574 _signal_anchor_geoms_do_things_with(wd, &ei);
1577 evas_object_smart_callback_call(data, SIG_ANCHOR_CLICKED, &ei);
1581 _signal_anchor_move(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__)
1583 Widget_Data *wd = elm_widget_data_get(data);
1588 _signal_anchor_in(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__)
1590 Widget_Data *wd = elm_widget_data_get(data);
1591 Elm_Entry_Anchor_Info ei;
1593 ei.name = emission + sizeof("nchor,mouse,in,");
1595 ei.x = ei.y = ei.w = ei.h = 0;
1597 _signal_anchor_geoms_do_things_with(wd, &ei);
1600 evas_object_smart_callback_call(data, SIG_ANCHOR_IN, &ei);
1604 _signal_anchor_out(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__)
1606 Widget_Data *wd = elm_widget_data_get(data);
1607 Elm_Entry_Anchor_Info ei;
1609 ei.name = emission + sizeof("nchor,mouse,out,");
1611 ei.x = ei.y = ei.w = ei.h = 0;
1613 _signal_anchor_geoms_do_things_with(wd, &ei);
1616 evas_object_smart_callback_call(data, SIG_ANCHOR_OUT, &ei);
1620 _signal_key_enter(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__)
1622 Widget_Data *wd = elm_widget_data_get(data);
1624 evas_object_smart_callback_call(data, SIG_ACTIVATED, NULL);
1628 _signal_mouse_down(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__)
1630 Widget_Data *wd = elm_widget_data_get(data);
1632 evas_object_smart_callback_call(data, SIG_PRESS, NULL);
1636 _signal_mouse_clicked(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__)
1638 Widget_Data *wd = elm_widget_data_get(data);
1640 evas_object_smart_callback_call(data, SIG_CLICKED, NULL);
1644 _signal_mouse_double(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__)
1646 Widget_Data *wd = elm_widget_data_get(data);
1648 evas_object_smart_callback_call(data, SIG_CLICKED_DOUBLE, NULL);
1652 _signal_mouse_triple(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__)
1654 Widget_Data *wd = elm_widget_data_get(data);
1656 evas_object_smart_callback_call(data, SIG_CLICKED_TRIPLE, NULL);
1659 #ifdef HAVE_ELEMENTARY_X
1661 _event_selection_notify(void *data, int type __UNUSED__, void *event)
1663 Widget_Data *wd = elm_widget_data_get(data);
1664 Ecore_X_Event_Selection_Notify *ev = event;
1665 if (!wd) return ECORE_CALLBACK_PASS_ON;
1666 if ((!wd->selection_asked) && (!wd->drag_selection_asked))
1667 return ECORE_CALLBACK_PASS_ON;
1669 if ((ev->selection == ECORE_X_SELECTION_CLIPBOARD) ||
1670 (ev->selection == ECORE_X_SELECTION_PRIMARY))
1672 Ecore_X_Selection_Data_Text *text_data;
1674 text_data = ev->data;
1675 if (text_data->data.content == ECORE_X_SELECTION_CONTENT_TEXT)
1677 if (text_data->text)
1679 char *txt = _elm_util_text_to_mkup(text_data->text);
1683 elm_entry_entry_insert(data, txt);
1688 wd->selection_asked = EINA_FALSE;
1690 else if (ev->selection == ECORE_X_SELECTION_XDND)
1692 Ecore_X_Selection_Data_Text *text_data;
1694 text_data = ev->data;
1695 if (text_data->data.content == ECORE_X_SELECTION_CONTENT_TEXT)
1697 if (text_data->text)
1699 char *txt = _elm_util_text_to_mkup(text_data->text);
1703 /* Massive FIXME: this should be at the drag point */
1704 elm_entry_entry_insert(data, txt);
1709 wd->drag_selection_asked = EINA_FALSE;
1711 ecore_x_dnd_send_finished();
1714 return ECORE_CALLBACK_PASS_ON;
1718 _event_selection_clear(void *data __UNUSED__, int type __UNUSED__, void *event __UNUSED__)
1720 Widget_Data *wd = elm_widget_data_get(data);
1721 Ecore_X_Event_Selection_Clear *ev = event;
1722 if (!wd) return ECORE_CALLBACK_PASS_ON;
1723 if (!wd->have_selection) return ECORE_CALLBACK_PASS_ON;
1724 if ((ev->selection == ECORE_X_SELECTION_CLIPBOARD) ||
1725 (ev->selection == ECORE_X_SELECTION_PRIMARY))
1727 elm_entry_select_none(data);
1729 return ECORE_CALLBACK_PASS_ON;
1733 _drag_drop_cb(void *data __UNUSED__, Evas_Object *obj, Elm_Selection_Data *drop)
1738 wd = elm_widget_data_get(obj);
1739 if (!wd) return EINA_FALSE;
1740 printf("Inserting at (%d,%d) %s\n",drop->x,drop->y,(char*)drop->data);
1742 edje_object_part_text_cursor_copy(wd->ent, "elm.text",
1743 EDJE_CURSOR_MAIN,/*->*/EDJE_CURSOR_USER);
1744 rv = edje_object_part_text_cursor_coord_set(wd->ent,"elm.text",
1745 EDJE_CURSOR_MAIN,drop->x,drop->y);
1746 if (!rv) printf("Warning: Failed to position cursor: paste anyway\n");
1747 elm_entry_entry_insert(obj, drop->data);
1748 edje_object_part_text_cursor_copy(wd->ent, "elm.text",
1749 EDJE_CURSOR_USER,/*->*/EDJE_CURSOR_MAIN);
1755 static Evas_Object *
1756 _get_item(void *data, Evas_Object *edje __UNUSED__, const char *part __UNUSED__, const char *item)
1758 Widget_Data *wd = elm_widget_data_get(data);
1761 Elm_Entry_Item_Provider *ip;
1763 EINA_LIST_FOREACH(wd->item_providers, l, ip)
1765 o = ip->func(ip->data, data, item);
1768 if (!strncmp(item, "file://", 7))
1770 const char *fname = item + 7;
1772 o = evas_object_image_filled_add(evas_object_evas_get(data));
1773 evas_object_image_file_set(o, fname, NULL);
1774 if (evas_object_image_load_error_get(o) == EVAS_LOAD_ERROR_NONE)
1776 evas_object_show(o);
1781 o = edje_object_add(evas_object_evas_get(data));
1782 _elm_theme_object_set(data, o, "entry/emoticon", "wtf", elm_widget_style_get(data));
1786 o = edje_object_add(evas_object_evas_get(data));
1787 if (!_elm_theme_object_set(data, o, "entry", item, elm_widget_style_get(data)))
1788 _elm_theme_object_set(data, o, "entry/emoticon", "wtf", elm_widget_style_get(data));
1793 _text_filter(void *data, Evas_Object *edje __UNUSED__, const char *part __UNUSED__, Edje_Text_Filter_Type type, char **text)
1795 Widget_Data *wd = elm_widget_data_get(data);
1797 Elm_Entry_Text_Filter *tf;
1799 if (type == EDJE_TEXT_FILTER_FORMAT)
1802 EINA_LIST_FOREACH(wd->text_filters, l, tf)
1804 tf->func(tf->data, data, text);
1810 /* This function is used to insert text by chunks in jobs */
1812 _text_append_idler(void *data)
1816 Evas_Object *obj = (Evas_Object *) data;
1817 Widget_Data *wd = elm_widget_data_get(obj);
1818 if (wd->text) eina_stringshare_del(wd->text);
1820 wd->changed = EINA_TRUE;
1822 start = wd->append_text_position;
1823 if (start + _CHUNK_SIZE < wd->append_text_len)
1826 int tag_start, esc_start;
1828 tag_start = esc_start = -1;
1829 /* Find proper markup cut place */
1830 while (pos - start < _CHUNK_SIZE)
1834 eina_unicode_utf8_get_next(wd->append_text_left, &pos);
1835 if (esc_start == -1)
1838 tag_start = prev_pos;
1839 else if (tmp == '>')
1842 if (tag_start == -1)
1845 esc_start = prev_pos;
1846 else if (tmp == ';')
1853 wd->append_text_position = tag_start;
1855 else if (esc_start >= 0)
1857 wd->append_text_position = esc_start;
1861 wd->append_text_position = pos;
1866 wd->append_text_position = wd->append_text_len;
1869 backup = wd->append_text_left[wd->append_text_position];
1870 wd->append_text_left[wd->append_text_position] = '\0';
1872 edje_object_part_text_append(wd->ent, "elm.text",
1873 wd->append_text_left + start);
1875 wd->append_text_left[wd->append_text_position] = backup;
1877 /* If there's still more to go, renew the idler, else, cleanup */
1878 if (wd->append_text_position < wd->append_text_len)
1880 return ECORE_CALLBACK_RENEW;
1884 free(wd->append_text_left);
1885 wd->append_text_left = NULL;
1886 wd->append_text_idler = NULL;
1887 return ECORE_CALLBACK_CANCEL;
1892 _add_chars_till_limit(Evas_Object *obj, char **text, int can_add, Length_Unit unit)
1894 int i = 0, current_len = 0;
1898 if (unit >= LENGTH_UNIT_LAST) return;
1900 current_len = strlen(*text);
1903 if (*new_text == '<')
1905 while (*new_text != '>')
1908 if (!*new_text) break;
1914 int idx = 0, unit_size = 0;
1915 char *markup, *utfstr;
1916 if (*new_text == '&')
1918 while (*(new_text + idx) != ';')
1921 if (!*(new_text + idx)) break;
1924 idx = evas_string_char_next_get(new_text, idx, NULL);
1925 markup = malloc(idx + 1);
1926 if (!markup) return;
1927 strncpy(markup, new_text, idx);
1929 utfstr = elm_entry_markup_to_utf8(markup);
1932 if (unit == LENGTH_UNIT_BYTE)
1933 unit_size = strlen(utfstr);
1934 else if (unit == LENGTH_UNIT_CHAR)
1935 unit_size = evas_string_char_len_get(utfstr);
1944 if (can_add < unit_size)
1948 evas_object_smart_callback_call(obj, "maxlength,reached", NULL);
1954 strncpy(new_text, new_text + idx, current_len - ((new_text + idx) - *text));
1956 (*text)[current_len] = 0;
1961 can_add -= unit_size;
1966 evas_object_smart_callback_call(obj, "maxlength,reached", NULL);
1970 _elm_entry_text_set(Evas_Object *obj, const char *item, const char *entry)
1973 ELM_CHECK_WIDTYPE(obj, widtype);
1974 if (item && strcmp(item, "default")) return;
1975 Widget_Data *wd = elm_widget_data_get(obj);
1977 if (!entry) entry = "";
1978 if (wd->text) eina_stringshare_del(wd->text);
1980 wd->changed = EINA_TRUE;
1982 /* Clear currently pending job if there is one */
1983 if (wd->append_text_idler)
1985 ecore_idler_del(wd->append_text_idler);
1986 free(wd->append_text_left);
1987 wd->append_text_left = NULL;
1988 wd->append_text_idler = NULL;
1991 len = strlen(entry);
1992 /* Split to ~_CHUNK_SIZE chunks */
1993 if (len > _CHUNK_SIZE)
1995 wd->append_text_left = (char *) malloc(len + 1);
1998 /* If we decided to use the idler */
1999 if (wd->append_text_left)
2001 /* Need to clear the entry first */
2002 edje_object_part_text_set(wd->ent, "elm.text", "");
2003 memcpy(wd->append_text_left, entry, len + 1);
2004 wd->append_text_position = 0;
2005 wd->append_text_len = len;
2006 wd->append_text_idler = ecore_idler_add(_text_append_idler, obj);
2010 edje_object_part_text_set(wd->ent, "elm.text", entry);
2015 _elm_entry_text_get(const Evas_Object *obj, const char *item)
2017 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
2018 Widget_Data *wd = elm_widget_data_get(obj);
2019 if (item && strcmp(item, "default")) return NULL;
2021 if (!wd) return NULL;
2022 if (wd->text) return wd->text;
2023 text = edje_object_part_text_get(wd->ent, "elm.text");
2026 ERR("text=NULL for edje %p, part 'elm.text'", wd->ent);
2030 if (wd->append_text_len > 0)
2034 tlen = strlen(text);
2035 tmpbuf = malloc(tlen + wd->append_text_len + 1);
2038 ERR("Failed to allocate memory for entry's text %p", obj);
2041 memcpy(tmpbuf, text, tlen);
2042 memcpy(tmpbuf + tlen, wd->append_text_left, wd->append_text_len);
2043 tmpbuf[tlen + wd->append_text_len] = '\0';
2044 eina_stringshare_replace(&wd->text, tmpbuf);
2049 eina_stringshare_replace(&wd->text, text);
2055 elm_entry_add(Evas_Object *parent)
2057 Evas_Object *obj, *top;
2061 ELM_WIDGET_STANDARD_SETUP(wd, Widget_Data, parent, e, obj, NULL);
2063 ELM_SET_WIDTYPE(widtype, "entry");
2064 elm_widget_type_set(obj, "entry");
2065 elm_widget_sub_object_add(parent, obj);
2066 elm_widget_on_focus_hook_set(obj, _on_focus_hook, NULL);
2067 elm_widget_data_set(obj, wd);
2068 elm_widget_del_hook_set(obj, _del_hook);
2069 elm_widget_del_pre_hook_set(obj, _del_pre_hook);
2070 elm_widget_theme_hook_set(obj, _theme_hook);
2071 elm_widget_disable_hook_set(obj, _disable_hook);
2072 elm_widget_signal_emit_hook_set(obj, _signal_emit_hook);
2073 elm_widget_focus_region_hook_set(obj, _focus_region_hook);
2074 elm_widget_on_focus_region_hook_set(obj, _on_focus_region_hook);
2075 elm_widget_signal_callback_add_hook_set(obj, _signal_callback_add_hook);
2076 elm_widget_signal_callback_del_hook_set(obj, _signal_callback_del_hook);
2077 elm_object_cursor_set(obj, ELM_CURSOR_XTERM);
2078 elm_widget_can_focus_set(obj, EINA_TRUE);
2079 elm_widget_highlight_ignore_set(obj, EINA_TRUE);
2080 elm_widget_text_set_hook_set(obj, _elm_entry_text_set);
2081 elm_widget_text_get_hook_set(obj, _elm_entry_text_get);
2082 elm_widget_content_set_hook_set(obj, _content_set_hook);
2083 elm_widget_content_unset_hook_set(obj, _content_unset_hook);
2084 elm_widget_content_get_hook_set(obj, _content_get_hook);
2086 wd->scroller = elm_smart_scroller_add(e);
2087 elm_widget_sub_object_add(obj, wd->scroller);
2088 evas_object_smart_member_add(wd->scroller, obj);
2089 elm_smart_scroller_widget_set(wd->scroller, obj);
2090 elm_smart_scroller_object_theme_set(obj, wd->scroller, "scroller", "entry",
2091 elm_widget_style_get(obj));
2092 evas_object_size_hint_weight_set(wd->scroller, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
2093 evas_object_size_hint_align_set(wd->scroller, EVAS_HINT_FILL, EVAS_HINT_FILL);
2094 elm_smart_scroller_bounce_allow_set(wd->scroller, EINA_FALSE, EINA_FALSE);
2095 evas_object_propagate_events_set(wd->scroller, EINA_TRUE);
2096 evas_object_propagate_events_set(elm_smart_scroller_edje_object_get(
2097 wd->scroller), EINA_TRUE);
2099 wd->linewrap = ELM_WRAP_WORD;
2100 wd->editable = EINA_TRUE;
2101 wd->disabled = EINA_FALSE;
2102 wd->context_menu = EINA_TRUE;
2103 wd->autosave = EINA_TRUE;
2104 wd->textonly = EINA_FALSE;
2106 wd->ent = edje_object_add(e);
2107 elm_widget_sub_object_add(obj, wd->ent);
2108 edje_object_item_provider_set(wd->ent, _get_item, obj);
2109 edje_object_text_insert_filter_callback_add(wd->ent,"elm.text", _text_filter, obj);
2110 evas_object_event_callback_add(wd->ent, EVAS_CALLBACK_MOVE, _move, obj);
2111 evas_object_event_callback_add(wd->ent, EVAS_CALLBACK_MOUSE_DOWN,
2113 evas_object_event_callback_add(wd->ent, EVAS_CALLBACK_MOUSE_UP,
2115 evas_object_event_callback_add(wd->ent, EVAS_CALLBACK_MOUSE_MOVE,
2117 evas_object_event_callback_add(obj, EVAS_CALLBACK_RESIZE, _resize, obj);
2119 _elm_theme_object_set(obj, wd->ent, "entry", "base", "default");
2120 edje_object_signal_callback_add(wd->ent, "entry,changed", "elm.text",
2121 _signal_entry_changed, obj);
2122 edje_object_signal_callback_add(wd->ent, "entry,changed,user", "elm.text",
2123 _signal_entry_changed_user, obj);
2124 edje_object_signal_callback_add(wd->ent, "preedit,changed", "elm.text",
2125 _signal_preedit_changed, obj);
2126 edje_object_signal_callback_add(wd->ent, "selection,start", "elm.text",
2127 _signal_selection_start, obj);
2128 edje_object_signal_callback_add(wd->ent, "selection,changed", "elm.text",
2129 _signal_selection_changed, obj);
2130 edje_object_signal_callback_add(wd->ent, "entry,selection,all,request", "elm.text",
2131 _signal_selection_all, obj);
2132 edje_object_signal_callback_add(wd->ent, "entry,selection,none,request", "elm.text",
2133 _signal_selection_none, obj);
2134 edje_object_signal_callback_add(wd->ent, "selection,cleared", "elm.text",
2135 _signal_selection_cleared, obj);
2136 edje_object_signal_callback_add(wd->ent, "entry,paste,request,*", "elm.text",
2137 _signal_entry_paste_request, obj);
2138 edje_object_signal_callback_add(wd->ent, "entry,copy,notify", "elm.text",
2139 _signal_entry_copy_notify, obj);
2140 edje_object_signal_callback_add(wd->ent, "entry,cut,notify", "elm.text",
2141 _signal_entry_cut_notify, obj);
2142 edje_object_signal_callback_add(wd->ent, "cursor,changed", "elm.text",
2143 _signal_cursor_changed, obj);
2144 edje_object_signal_callback_add(wd->ent, "anchor,mouse,down,*", "elm.text",
2145 _signal_anchor_down, obj);
2146 edje_object_signal_callback_add(wd->ent, "anchor,mouse,up,*", "elm.text",
2147 _signal_anchor_up, obj);
2148 edje_object_signal_callback_add(wd->ent, "anchor,mouse,clicked,*", "elm.text",
2149 _signal_anchor_clicked, obj);
2150 edje_object_signal_callback_add(wd->ent, "anchor,mouse,move,*", "elm.text",
2151 _signal_anchor_move, obj);
2152 edje_object_signal_callback_add(wd->ent, "anchor,mouse,in,*", "elm.text",
2153 _signal_anchor_in, obj);
2154 edje_object_signal_callback_add(wd->ent, "anchor,mouse,out,*", "elm.text",
2155 _signal_anchor_out, obj);
2156 edje_object_signal_callback_add(wd->ent, "entry,key,enter", "elm.text",
2157 _signal_key_enter, obj);
2158 edje_object_signal_callback_add(wd->ent, "mouse,down,1", "elm.text",
2159 _signal_mouse_down, obj);
2160 edje_object_signal_callback_add(wd->ent, "mouse,clicked,1", "elm.text",
2161 _signal_mouse_clicked, obj);
2162 edje_object_signal_callback_add(wd->ent, "mouse,down,1,double", "elm.text",
2163 _signal_mouse_double, obj);
2164 edje_object_signal_callback_add(wd->ent, "mouse,down,1,triple", "elm.text",
2165 _signal_mouse_triple, obj);
2166 edje_object_part_text_set(wd->ent, "elm.text", "");
2167 if (_elm_config->desktop_entry)
2168 edje_object_part_text_select_allow_set(wd->ent, "elm.text", EINA_TRUE);
2169 elm_widget_resize_object_set(obj, wd->ent);
2172 elm_entry_input_panel_layout_set(obj, ELM_INPUT_PANEL_LAYOUT_NORMAL);
2174 #ifdef HAVE_ELEMENTARY_X
2175 top = elm_widget_top_get(obj);
2176 if ((top) && (elm_win_xwindow_get(top)))
2178 wd->sel_notify_handler =
2179 ecore_event_handler_add(ECORE_X_EVENT_SELECTION_NOTIFY,
2180 _event_selection_notify, obj);
2181 wd->sel_clear_handler =
2182 ecore_event_handler_add(ECORE_X_EVENT_SELECTION_CLEAR,
2183 _event_selection_clear, obj);
2186 elm_drop_target_add(obj, ELM_SEL_FORMAT_MARKUP | ELM_SEL_FORMAT_IMAGE,
2187 _drag_drop_cb, NULL);
2190 entries = eina_list_prepend(entries, obj);
2192 // module - find module for entry
2193 wd->api = _module(obj);
2194 // if found - hook in
2195 if ((wd->api) && (wd->api->obj_hook)) wd->api->obj_hook(obj);
2197 _mirrored_set(obj, elm_widget_mirrored_get(obj));
2198 // TODO: convert Elementary to subclassing of Evas_Smart_Class
2199 // TODO: and save some bytes, making descriptions per-class and not instance!
2200 evas_object_smart_callbacks_descriptions_set(obj, _signals);
2205 elm_entry_single_line_set(Evas_Object *obj, Eina_Bool single_line)
2207 ELM_CHECK_WIDTYPE(obj, widtype);
2208 Widget_Data *wd = elm_widget_data_get(obj);
2210 if (wd->single_line == single_line) return;
2211 wd->single_line = single_line;
2212 wd->linewrap = ELM_WRAP_NONE;
2213 elm_entry_cnp_textonly_set(obj, EINA_TRUE);
2217 if (wd->single_line)
2218 elm_smart_scroller_policy_set(wd->scroller,
2219 ELM_SMART_SCROLLER_POLICY_OFF,
2220 ELM_SMART_SCROLLER_POLICY_OFF);
2223 const Elm_Scroller_Policy map[3] =
2225 ELM_SMART_SCROLLER_POLICY_AUTO,
2226 ELM_SMART_SCROLLER_POLICY_ON,
2227 ELM_SMART_SCROLLER_POLICY_OFF
2229 elm_smart_scroller_policy_set(wd->scroller,
2238 elm_entry_single_line_get(const Evas_Object *obj)
2240 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2241 Widget_Data *wd = elm_widget_data_get(obj);
2242 if (!wd) return EINA_FALSE;
2243 return wd->single_line;
2247 elm_entry_password_set(Evas_Object *obj, Eina_Bool password)
2249 ELM_CHECK_WIDTYPE(obj, widtype);
2250 Widget_Data *wd = elm_widget_data_get(obj);
2252 if (wd->password == password) return;
2253 wd->password = password;
2254 wd->single_line = EINA_TRUE;
2255 wd->linewrap = ELM_WRAP_NONE;
2260 elm_entry_password_get(const Evas_Object *obj)
2262 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2263 Widget_Data *wd = elm_widget_data_get(obj);
2264 if (!wd) return EINA_FALSE;
2265 return wd->password;
2269 elm_entry_entry_set(Evas_Object *obj, const char *entry)
2271 _elm_entry_text_set(obj, NULL, entry);
2275 elm_entry_entry_append(Evas_Object *obj, const char *entry)
2278 ELM_CHECK_WIDTYPE(obj, widtype);
2279 Widget_Data *wd = elm_widget_data_get(obj);
2281 if (!entry) entry = "";
2282 wd->changed = EINA_TRUE;
2284 len = strlen(entry);
2285 if (wd->append_text_left)
2288 tmpbuf = realloc(wd->append_text_left, wd->append_text_len + len + 1);
2294 wd->append_text_left = tmpbuf;
2295 memcpy(wd->append_text_left + wd->append_text_len, entry, len + 1);
2296 wd->append_text_len += len;
2300 /* FIXME: Add chunked appending here (like in entry_set) */
2301 edje_object_part_text_append(wd->ent, "elm.text", entry);
2306 elm_entry_entry_get(const Evas_Object *obj)
2308 return _elm_entry_text_get(obj, NULL);
2312 elm_entry_is_empty(const Evas_Object *obj)
2314 /* FIXME: until there's support for that in textblock, we just check
2315 * to see if the there is text or not. */
2316 ELM_CHECK_WIDTYPE(obj, widtype) EINA_TRUE;
2317 Widget_Data *wd = elm_widget_data_get(obj);
2318 const Evas_Object *tb;
2319 Evas_Textblock_Cursor *cur;
2321 if (!wd) return EINA_TRUE;
2322 /* It's a hack until we get the support suggested above.
2323 * We just create a cursor, point it to the begining, and then
2324 * try to advance it, if it can advance, the tb is not empty,
2325 * otherwise it is. */
2326 tb = edje_object_part_object_get(wd->ent, "elm.text");
2327 cur = evas_object_textblock_cursor_new((Evas_Object *) tb); /* This is
2328 actually, ok for the time being, thsese hackish stuff will be removed
2329 once evas 1.0 is out*/
2330 evas_textblock_cursor_pos_set(cur, 0);
2331 ret = evas_textblock_cursor_char_next(cur);
2332 evas_textblock_cursor_free(cur);
2338 elm_entry_selection_get(const Evas_Object *obj)
2340 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
2341 Widget_Data *wd = elm_widget_data_get(obj);
2342 if (!wd) return NULL;
2343 return edje_object_part_text_selection_get(wd->ent, "elm.text");
2347 elm_entry_entry_insert(Evas_Object *obj, const char *entry)
2349 ELM_CHECK_WIDTYPE(obj, widtype);
2350 Widget_Data *wd = elm_widget_data_get(obj);
2352 edje_object_part_text_insert(wd->ent, "elm.text", entry);
2353 wd->changed = EINA_TRUE;
2358 elm_entry_line_wrap_set(Evas_Object *obj, Elm_Wrap_Type wrap)
2360 ELM_CHECK_WIDTYPE(obj, widtype);
2361 Widget_Data *wd = elm_widget_data_get(obj);
2363 if (wd->linewrap == wrap) return;
2365 wd->linewrap = wrap;
2370 elm_entry_line_wrap_get(const Evas_Object *obj)
2372 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2373 Widget_Data *wd = elm_widget_data_get(obj);
2374 if (!wd) return EINA_FALSE;
2375 return wd->linewrap;
2379 elm_entry_editable_set(Evas_Object *obj, Eina_Bool editable)
2381 ELM_CHECK_WIDTYPE(obj, widtype);
2382 Widget_Data *wd = elm_widget_data_get(obj);
2384 if (wd->editable == editable) return;
2385 wd->editable = editable;
2388 #ifdef HAVE_ELEMENTARY_X
2390 elm_drop_target_add(obj, ELM_SEL_FORMAT_MARKUP, _drag_drop_cb, NULL);
2392 elm_drop_target_del(obj);
2397 elm_entry_editable_get(const Evas_Object *obj)
2399 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2400 Widget_Data *wd = elm_widget_data_get(obj);
2401 if (!wd) return EINA_FALSE;
2402 return wd->editable;
2406 elm_entry_select_none(Evas_Object *obj)
2408 ELM_CHECK_WIDTYPE(obj, widtype);
2409 Widget_Data *wd = elm_widget_data_get(obj);
2413 wd->selmode = EINA_FALSE;
2414 if (!_elm_config->desktop_entry)
2415 edje_object_part_text_select_allow_set(wd->ent, "elm.text", EINA_FALSE);
2416 edje_object_signal_emit(wd->ent, "elm,state,select,off", "elm");
2418 wd->have_selection = EINA_FALSE;
2419 edje_object_part_text_select_none(wd->ent, "elm.text");
2423 elm_entry_select_all(Evas_Object *obj)
2425 ELM_CHECK_WIDTYPE(obj, widtype);
2426 Widget_Data *wd = elm_widget_data_get(obj);
2430 wd->selmode = EINA_FALSE;
2431 if (!_elm_config->desktop_entry)
2432 edje_object_part_text_select_allow_set(wd->ent, "elm.text", EINA_FALSE);
2433 edje_object_signal_emit(wd->ent, "elm,state,select,off", "elm");
2435 wd->have_selection = EINA_TRUE;
2436 edje_object_part_text_select_all(wd->ent, "elm.text");
2440 elm_entry_cursor_geometry_get(const Evas_Object *obj, Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *h)
2442 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2443 Widget_Data *wd = elm_widget_data_get(obj);
2444 if (!wd) return EINA_FALSE;
2445 edje_object_part_text_cursor_geometry_get(wd->ent, "elm.text", x, y, w, h);
2450 elm_entry_cursor_next(Evas_Object *obj)
2452 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2453 Widget_Data *wd = elm_widget_data_get(obj);
2454 if (!wd) return EINA_FALSE;
2455 return edje_object_part_text_cursor_next(wd->ent, "elm.text", EDJE_CURSOR_MAIN);
2459 elm_entry_cursor_prev(Evas_Object *obj)
2461 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2462 Widget_Data *wd = elm_widget_data_get(obj);
2463 if (!wd) return EINA_FALSE;
2464 return edje_object_part_text_cursor_prev(wd->ent, "elm.text", EDJE_CURSOR_MAIN);
2468 elm_entry_cursor_up(Evas_Object *obj)
2470 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2471 Widget_Data *wd = elm_widget_data_get(obj);
2472 if (!wd) return EINA_FALSE;
2473 return edje_object_part_text_cursor_up(wd->ent, "elm.text", EDJE_CURSOR_MAIN);
2477 elm_entry_cursor_down(Evas_Object *obj)
2479 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2480 Widget_Data *wd = elm_widget_data_get(obj);
2481 if (!wd) return EINA_FALSE;
2482 return edje_object_part_text_cursor_down(wd->ent, "elm.text", EDJE_CURSOR_MAIN);
2486 elm_entry_cursor_begin_set(Evas_Object *obj)
2488 ELM_CHECK_WIDTYPE(obj, widtype);
2489 Widget_Data *wd = elm_widget_data_get(obj);
2491 edje_object_part_text_cursor_begin_set(wd->ent, "elm.text", EDJE_CURSOR_MAIN);
2495 elm_entry_cursor_end_set(Evas_Object *obj)
2497 ELM_CHECK_WIDTYPE(obj, widtype);
2498 Widget_Data *wd = elm_widget_data_get(obj);
2502 edje_object_part_text_cursor_end_set(wd->ent, "elm.text", EDJE_CURSOR_MAIN);
2505 elm_widget_show_region_get(obj, &x, &y, &w, &h);
2506 elm_smart_scroller_child_region_show(wd->scroller, x, y, w, h);
2511 elm_entry_cursor_line_begin_set(Evas_Object *obj)
2513 ELM_CHECK_WIDTYPE(obj, widtype);
2514 Widget_Data *wd = elm_widget_data_get(obj);
2516 edje_object_part_text_cursor_line_begin_set(wd->ent, "elm.text", EDJE_CURSOR_MAIN);
2520 elm_entry_cursor_line_end_set(Evas_Object *obj)
2522 ELM_CHECK_WIDTYPE(obj, widtype);
2523 Widget_Data *wd = elm_widget_data_get(obj);
2525 edje_object_part_text_cursor_line_end_set(wd->ent, "elm.text", EDJE_CURSOR_MAIN);
2529 elm_entry_cursor_selection_begin(Evas_Object *obj)
2531 ELM_CHECK_WIDTYPE(obj, widtype);
2532 Widget_Data *wd = elm_widget_data_get(obj);
2534 edje_object_part_text_select_begin(wd->ent, "elm.text");
2538 elm_entry_cursor_selection_end(Evas_Object *obj)
2540 ELM_CHECK_WIDTYPE(obj, widtype);
2541 Widget_Data *wd = elm_widget_data_get(obj);
2543 edje_object_part_text_select_extend(wd->ent, "elm.text");
2547 elm_entry_cursor_is_format_get(const Evas_Object *obj)
2549 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2550 Widget_Data *wd = elm_widget_data_get(obj);
2551 if (!wd) return EINA_FALSE;
2552 return edje_object_part_text_cursor_is_format_get(wd->ent, "elm.text", EDJE_CURSOR_MAIN);
2556 elm_entry_cursor_is_visible_format_get(const Evas_Object *obj)
2558 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2559 Widget_Data *wd = elm_widget_data_get(obj);
2560 if (!wd) return EINA_FALSE;
2561 return edje_object_part_text_cursor_is_visible_format_get(wd->ent, "elm.text", EDJE_CURSOR_MAIN);
2565 elm_entry_cursor_content_get(const Evas_Object *obj)
2567 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
2568 Widget_Data *wd = elm_widget_data_get(obj);
2569 if (!wd) return NULL;
2570 return edje_object_part_text_cursor_content_get(wd->ent, "elm.text", EDJE_CURSOR_MAIN);
2574 elm_entry_cursor_pos_set(Evas_Object *obj, int pos)
2576 ELM_CHECK_WIDTYPE(obj, widtype);
2577 Widget_Data *wd = elm_widget_data_get(obj);
2579 edje_object_part_text_cursor_pos_set(wd->ent, "elm.text", EDJE_CURSOR_MAIN, pos);
2580 edje_object_message_signal_process(wd->ent);
2584 elm_entry_cursor_pos_get(const Evas_Object *obj)
2586 ELM_CHECK_WIDTYPE(obj, widtype) 0;
2587 Widget_Data *wd = elm_widget_data_get(obj);
2589 return edje_object_part_text_cursor_pos_get(wd->ent, "elm.text", EDJE_CURSOR_MAIN);
2593 elm_entry_selection_cut(Evas_Object *obj)
2595 ELM_CHECK_WIDTYPE(obj, widtype);
2596 Widget_Data *wd = elm_widget_data_get(obj);
2598 _cut(obj, NULL, NULL);
2602 elm_entry_selection_copy(Evas_Object *obj)
2604 ELM_CHECK_WIDTYPE(obj, widtype);
2605 Widget_Data *wd = elm_widget_data_get(obj);
2607 _copy(obj, NULL, NULL);
2611 elm_entry_selection_paste(Evas_Object *obj)
2613 ELM_CHECK_WIDTYPE(obj, widtype);
2614 Widget_Data *wd = elm_widget_data_get(obj);
2616 _paste(obj, NULL, NULL);
2620 elm_entry_context_menu_clear(Evas_Object *obj)
2622 ELM_CHECK_WIDTYPE(obj, widtype);
2623 Widget_Data *wd = elm_widget_data_get(obj);
2624 Elm_Entry_Context_Menu_Item *it;
2626 EINA_LIST_FREE(wd->items, it)
2628 eina_stringshare_del(it->label);
2629 eina_stringshare_del(it->icon_file);
2630 eina_stringshare_del(it->icon_group);
2636 elm_entry_context_menu_item_add(Evas_Object *obj, const char *label, const char *icon_file, Elm_Icon_Type icon_type, Evas_Smart_Cb func, const void *data)
2638 ELM_CHECK_WIDTYPE(obj, widtype);
2639 Widget_Data *wd = elm_widget_data_get(obj);
2640 Elm_Entry_Context_Menu_Item *it;
2642 it = calloc(1, sizeof(Elm_Entry_Context_Menu_Item));
2644 wd->items = eina_list_append(wd->items, it);
2646 it->label = eina_stringshare_add(label);
2647 it->icon_file = eina_stringshare_add(icon_file);
2648 it->icon_type = icon_type;
2650 it->data = (void *)data;
2654 elm_entry_context_menu_disabled_set(Evas_Object *obj, Eina_Bool disabled)
2656 ELM_CHECK_WIDTYPE(obj, widtype);
2657 Widget_Data *wd = elm_widget_data_get(obj);
2659 if (wd->context_menu == !disabled) return;
2660 wd->context_menu = !disabled;
2664 elm_entry_context_menu_disabled_get(const Evas_Object *obj)
2666 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2667 Widget_Data *wd = elm_widget_data_get(obj);
2668 if (!wd) return EINA_FALSE;
2669 return !wd->context_menu;
2673 elm_entry_item_provider_append(Evas_Object *obj, Evas_Object *(*func) (void *data, Evas_Object *entry, const char *item), void *data)
2675 ELM_CHECK_WIDTYPE(obj, widtype);
2676 Widget_Data *wd = elm_widget_data_get(obj);
2678 EINA_SAFETY_ON_NULL_RETURN(func);
2679 Elm_Entry_Item_Provider *ip = calloc(1, sizeof(Elm_Entry_Item_Provider));
2683 wd->item_providers = eina_list_append(wd->item_providers, ip);
2687 elm_entry_item_provider_prepend(Evas_Object *obj, Evas_Object *(*func) (void *data, Evas_Object *entry, const char *item), void *data)
2689 ELM_CHECK_WIDTYPE(obj, widtype);
2690 Widget_Data *wd = elm_widget_data_get(obj);
2692 EINA_SAFETY_ON_NULL_RETURN(func);
2693 Elm_Entry_Item_Provider *ip = calloc(1, sizeof(Elm_Entry_Item_Provider));
2697 wd->item_providers = eina_list_prepend(wd->item_providers, ip);
2701 elm_entry_item_provider_remove(Evas_Object *obj, Evas_Object *(*func) (void *data, Evas_Object *entry, const char *item), void *data)
2703 ELM_CHECK_WIDTYPE(obj, widtype);
2704 Widget_Data *wd = elm_widget_data_get(obj);
2706 Elm_Entry_Item_Provider *ip;
2708 EINA_SAFETY_ON_NULL_RETURN(func);
2709 EINA_LIST_FOREACH(wd->item_providers, l, ip)
2711 if ((ip->func == func) && ((!data) || (ip->data == data)))
2713 wd->item_providers = eina_list_remove_list(wd->item_providers, l);
2721 elm_entry_text_filter_append(Evas_Object *obj, Elm_Entry_Filter_Cb func, void *data)
2724 Elm_Entry_Text_Filter *tf;
2725 ELM_CHECK_WIDTYPE(obj, widtype);
2727 wd = elm_widget_data_get(obj);
2729 EINA_SAFETY_ON_NULL_RETURN(func);
2731 tf = _filter_new(func, data);
2734 wd->text_filters = eina_list_append(wd->text_filters, tf);
2738 elm_entry_text_filter_prepend(Evas_Object *obj, Elm_Entry_Filter_Cb func, void *data)
2741 Elm_Entry_Text_Filter *tf;
2742 ELM_CHECK_WIDTYPE(obj, widtype);
2744 wd = elm_widget_data_get(obj);
2746 EINA_SAFETY_ON_NULL_RETURN(func);
2748 tf = _filter_new(func, data);
2751 wd->text_filters = eina_list_prepend(wd->text_filters, tf);
2755 elm_entry_text_filter_remove(Evas_Object *obj, Elm_Entry_Filter_Cb func, void *data)
2759 Elm_Entry_Text_Filter *tf;
2760 ELM_CHECK_WIDTYPE(obj, widtype);
2762 wd = elm_widget_data_get(obj);
2764 EINA_SAFETY_ON_NULL_RETURN(func);
2766 EINA_LIST_FOREACH(wd->text_filters, l, tf)
2768 if ((tf->func == func) && ((!data) || (tf->data == data)))
2770 wd->text_filters = eina_list_remove_list(wd->text_filters, l);
2778 elm_entry_markup_to_utf8(const char *s)
2780 char *ss = _elm_util_mkup_to_text(s);
2781 if (!ss) ss = strdup("");
2786 elm_entry_utf8_to_markup(const char *s)
2788 char *ss = _elm_util_text_to_mkup(s);
2789 if (!ss) ss = strdup("");
2794 elm_entry_filter_limit_size(void *data, Evas_Object *entry, char **text)
2796 Elm_Entry_Filter_Limit_Size *lim = data;
2799 const char *(*text_get)(const Evas_Object *);
2800 const char *widget_type;
2802 EINA_SAFETY_ON_NULL_RETURN(data);
2803 EINA_SAFETY_ON_NULL_RETURN(entry);
2804 EINA_SAFETY_ON_NULL_RETURN(text);
2806 /* hack. I don't want to copy the entire function to work with
2808 widget_type = elm_widget_type_get(entry);
2809 if (!strcmp(widget_type, "entry"))
2810 text_get = elm_entry_entry_get;
2814 current = elm_entry_markup_to_utf8(text_get(entry));
2816 if (lim->max_char_count > 0)
2818 len = evas_string_char_len_get(current);
2819 if (len >= lim->max_char_count)
2821 evas_object_smart_callback_call(entry, "maxlength,reached", NULL);
2827 newlen = evas_string_char_len_get(elm_entry_markup_to_utf8(*text));
2828 if ((len + newlen) > lim->max_char_count)
2829 _add_chars_till_limit(entry, text, (lim->max_char_count - len), LENGTH_UNIT_CHAR);
2831 else if (lim->max_byte_count > 0)
2833 len = strlen(current);
2834 if (len >= lim->max_byte_count)
2836 evas_object_smart_callback_call(entry, "maxlength,reached", NULL);
2842 newlen = strlen(elm_entry_markup_to_utf8(*text));
2843 if ((len + newlen) > lim->max_byte_count)
2844 _add_chars_till_limit(entry, text, (lim->max_byte_count - len), LENGTH_UNIT_BYTE);
2850 elm_entry_filter_accept_set(void *data, Evas_Object *entry __UNUSED__, char **text)
2852 Elm_Entry_Filter_Accept_Set *as = data;
2856 int read_idx, last_read_idx = 0, read_char;
2858 EINA_SAFETY_ON_NULL_RETURN(data);
2859 EINA_SAFETY_ON_NULL_RETURN(text);
2861 if ((!as->accepted) && (!as->rejected))
2867 goes_in = EINA_TRUE;
2872 goes_in = EINA_FALSE;
2876 read_idx = evas_string_char_next_get(*text, 0, &read_char);
2879 int cmp_idx, cmp_char;
2880 Eina_Bool in_set = EINA_FALSE;
2882 cmp_idx = evas_string_char_next_get(set, 0, &cmp_char);
2885 if (read_char == cmp_char)
2890 cmp_idx = evas_string_char_next_get(set, cmp_idx, &cmp_char);
2892 if (in_set == goes_in)
2894 int size = read_idx - last_read_idx;
2895 const char *src = (*text) + last_read_idx;
2897 memcpy(insert, *text + last_read_idx, size);
2900 last_read_idx = read_idx;
2901 read_idx = evas_string_char_next_get(*text, read_idx, &read_char);
2907 elm_entry_file_set(Evas_Object *obj, const char *file, Elm_Text_Format format)
2909 ELM_CHECK_WIDTYPE(obj, widtype);
2910 Widget_Data *wd = elm_widget_data_get(obj);
2912 if (wd->delay_write)
2914 ecore_timer_del(wd->delay_write);
2915 wd->delay_write = NULL;
2917 if (wd->autosave) _save(obj);
2918 eina_stringshare_replace(&wd->file, file);
2919 wd->format = format;
2924 elm_entry_file_get(const Evas_Object *obj, const char **file, Elm_Text_Format *format)
2926 ELM_CHECK_WIDTYPE(obj, widtype);
2927 Widget_Data *wd = elm_widget_data_get(obj);
2929 if (file) *file = wd->file;
2930 if (format) *format = wd->format;
2934 elm_entry_file_save(Evas_Object *obj)
2936 ELM_CHECK_WIDTYPE(obj, widtype);
2937 Widget_Data *wd = elm_widget_data_get(obj);
2939 if (wd->delay_write)
2941 ecore_timer_del(wd->delay_write);
2942 wd->delay_write = NULL;
2945 wd->delay_write = ecore_timer_add(2.0, _delay_write, obj);
2949 elm_entry_autosave_set(Evas_Object *obj, Eina_Bool autosave)
2951 ELM_CHECK_WIDTYPE(obj, widtype);
2952 Widget_Data *wd = elm_widget_data_get(obj);
2954 wd->autosave = !!autosave;
2958 elm_entry_autosave_get(const Evas_Object *obj)
2960 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2961 Widget_Data *wd = elm_widget_data_get(obj);
2962 if (!wd) return EINA_FALSE;
2963 return wd->autosave;
2967 elm_entry_cnp_textonly_set(Evas_Object *obj, Eina_Bool textonly)
2969 Elm_Sel_Format format = ELM_SEL_FORMAT_MARKUP;
2970 ELM_CHECK_WIDTYPE(obj, widtype);
2971 Widget_Data *wd = elm_widget_data_get(obj);
2973 textonly = !!textonly;
2974 if (wd->textonly == textonly) return;
2975 wd->textonly = !!textonly;
2976 if (!textonly) format |= ELM_SEL_FORMAT_IMAGE;
2977 #ifdef HAVE_ELEMENTARY_X
2978 elm_drop_target_add(obj, format, _drag_drop_cb, NULL);
2983 elm_entry_cnp_textonly_get(const Evas_Object *obj)
2985 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2986 Widget_Data *wd = elm_widget_data_get(obj);
2987 if (!wd) return EINA_FALSE;
2988 return wd->textonly;
2992 elm_entry_scrollable_set(Evas_Object *obj, Eina_Bool scroll)
2994 ELM_CHECK_WIDTYPE(obj, widtype);
2995 Widget_Data *wd = elm_widget_data_get(obj);
2998 if (wd->scroll == scroll) return;
2999 wd->scroll = scroll;
3002 elm_widget_sub_object_del(obj, wd->scroller);
3003 elm_widget_resize_object_set(obj, wd->scroller);
3004 elm_widget_sub_object_add(obj, wd->ent);
3005 elm_smart_scroller_child_set(wd->scroller, wd->ent);
3006 evas_object_show(wd->scroller);
3007 elm_widget_on_show_region_hook_set(obj, _show_region_hook, obj);
3011 elm_smart_scroller_child_set(wd->scroller, NULL);
3012 elm_widget_sub_object_del(obj, wd->ent);
3013 elm_widget_resize_object_set(obj, wd->ent);
3014 evas_object_smart_member_add(wd->scroller, obj);
3015 elm_widget_sub_object_add(obj, wd->scroller);
3016 evas_object_hide(wd->scroller);
3017 elm_widget_on_show_region_hook_set(obj, NULL, NULL);
3024 elm_entry_scrollable_get(const Evas_Object *obj)
3026 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
3027 Widget_Data *wd = elm_widget_data_get(obj);
3028 if (!wd) return EINA_FALSE;
3033 elm_entry_icon_set(Evas_Object *obj, Evas_Object *icon)
3035 ELM_CHECK_WIDTYPE(obj, widtype);
3036 Widget_Data *wd = elm_widget_data_get(obj);
3039 EINA_SAFETY_ON_NULL_RETURN(icon);
3040 if (wd->icon == icon) return;
3041 if (wd->icon) evas_object_del(wd->icon);
3043 edje = elm_smart_scroller_edje_object_get(wd->scroller);
3045 edje_object_part_swallow(edje, "elm.swallow.icon", wd->icon);
3046 edje_object_signal_emit(edje, "elm,action,show,icon", "elm");
3051 elm_entry_icon_get(const Evas_Object *obj)
3053 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
3054 Widget_Data *wd = elm_widget_data_get(obj);
3055 if (!wd) return NULL;
3060 elm_entry_icon_unset(Evas_Object *obj)
3062 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
3063 Widget_Data *wd = elm_widget_data_get(obj);
3064 Evas_Object *ret = NULL;
3065 if (!wd) return NULL;
3068 Evas_Object *edje = elm_smart_scroller_edje_object_get(wd->scroller);
3069 if (!edje) return NULL;
3071 edje_object_part_unswallow(edje, wd->icon);
3072 edje_object_signal_emit(edje, "elm,action,hide,icon", "elm");
3080 elm_entry_icon_visible_set(Evas_Object *obj, Eina_Bool setting)
3082 ELM_CHECK_WIDTYPE(obj, widtype);
3083 Widget_Data *wd = elm_widget_data_get(obj);
3084 if ((!wd) || (!wd->icon)) return;
3086 evas_object_hide(wd->icon);
3088 evas_object_show(wd->icon);
3093 elm_entry_end_set(Evas_Object *obj, Evas_Object *end)
3095 ELM_CHECK_WIDTYPE(obj, widtype);
3096 Widget_Data *wd = elm_widget_data_get(obj);
3099 EINA_SAFETY_ON_NULL_RETURN(end);
3100 if (wd->end == end) return;
3101 if (wd->end) evas_object_del(wd->end);
3103 edje = elm_smart_scroller_edje_object_get(wd->scroller);
3105 edje_object_part_swallow(edje, "elm.swallow.end", wd->end);
3106 edje_object_signal_emit(edje, "elm,action,show,end", "elm");
3111 elm_entry_end_get(const Evas_Object *obj)
3113 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
3114 Widget_Data *wd = elm_widget_data_get(obj);
3115 if (!wd) return NULL;
3120 elm_entry_end_unset(Evas_Object *obj)
3122 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
3123 Widget_Data *wd = elm_widget_data_get(obj);
3124 Evas_Object *ret = NULL;
3125 if (!wd) return NULL;
3128 Evas_Object *edje = elm_smart_scroller_edje_object_get(wd->scroller);
3129 if (!edje) return NULL;
3131 edje_object_part_unswallow(edje, wd->end);
3132 edje_object_signal_emit(edje, "elm,action,hide,end", "elm");
3140 elm_entry_end_visible_set(Evas_Object *obj, Eina_Bool setting)
3142 ELM_CHECK_WIDTYPE(obj, widtype);
3143 Widget_Data *wd = elm_widget_data_get(obj);
3144 if ((!wd) || (!wd->end)) return;
3146 evas_object_hide(wd->end);
3148 evas_object_show(wd->end);
3153 elm_entry_scrollbar_policy_set(Evas_Object *obj, Elm_Scroller_Policy h, Elm_Scroller_Policy v)
3155 ELM_CHECK_WIDTYPE(obj, widtype);
3156 Widget_Data *wd = elm_widget_data_get(obj);
3157 const Elm_Scroller_Policy map[3] =
3159 ELM_SMART_SCROLLER_POLICY_AUTO,
3160 ELM_SMART_SCROLLER_POLICY_ON,
3161 ELM_SMART_SCROLLER_POLICY_OFF
3166 elm_smart_scroller_policy_set(wd->scroller,
3172 elm_entry_bounce_set(Evas_Object *obj, Eina_Bool h_bounce, Eina_Bool v_bounce)
3174 ELM_CHECK_WIDTYPE(obj, widtype);
3175 Widget_Data *wd = elm_widget_data_get(obj);
3177 elm_smart_scroller_bounce_allow_set(wd->scroller, h_bounce, v_bounce);
3181 elm_entry_bounce_get(const Evas_Object *obj, Eina_Bool *h_bounce, Eina_Bool *v_bounce)
3183 ELM_CHECK_WIDTYPE(obj, widtype);
3184 Widget_Data *wd = elm_widget_data_get(obj);
3186 elm_smart_scroller_bounce_allow_get(wd->scroller, h_bounce, v_bounce);
3190 elm_entry_input_panel_layout_set(Evas_Object *obj, Elm_Input_Panel_Layout layout)
3192 ELM_CHECK_WIDTYPE(obj, widtype);
3193 Widget_Data *wd = elm_widget_data_get(obj);
3196 wd->input_panel_layout = layout;
3198 edje_object_part_text_input_panel_layout_set(wd->ent, "elm.text", layout);
3201 EAPI Elm_Input_Panel_Layout
3202 elm_entry_input_panel_layout_get(Evas_Object *obj)
3204 ELM_CHECK_WIDTYPE(obj, widtype) ELM_INPUT_PANEL_LAYOUT_INVALID;
3205 Widget_Data *wd = elm_widget_data_get(obj);
3206 if (!wd) return ELM_INPUT_PANEL_LAYOUT_INVALID;
3208 return wd->input_panel_layout;