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 else 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, unit_size;
1895 int current_len = strlen(*text);
1896 char *new_text = *text;
1897 if (unit >= LENGTH_UNIT_LAST) return;
1900 if (*new_text == '<')
1902 while (*new_text != '>')
1905 if (!*new_text) break;
1912 if (*new_text == '&')
1914 while (*(new_text + idx) != ';')
1917 if (!*(new_text + idx)) break;
1921 idx = evas_string_char_next_get(new_text, idx, NULL);
1922 markup = malloc(idx + 1);
1923 strncpy(markup, new_text, idx);
1925 if (unit == LENGTH_UNIT_BYTE)
1926 unit_size = strlen(elm_entry_markup_to_utf8(markup));
1927 else if (unit == LENGTH_UNIT_CHAR)
1928 unit_size = evas_string_char_len_get(elm_entry_markup_to_utf8(markup));
1934 if (can_add < unit_size)
1938 evas_object_smart_callback_call(obj, "maxlength,reached", NULL);
1944 strncpy(new_text, new_text + idx, current_len - ((new_text + idx) - *text));
1946 (*text)[current_len] = 0;
1951 can_add -= unit_size;
1956 evas_object_smart_callback_call(obj, "maxlength,reached", NULL);
1960 _elm_entry_text_set(Evas_Object *obj, const char *item, const char *entry)
1963 ELM_CHECK_WIDTYPE(obj, widtype);
1964 if (item && strcmp(item, "default")) return;
1965 Widget_Data *wd = elm_widget_data_get(obj);
1967 if (!entry) entry = "";
1968 if (wd->text) eina_stringshare_del(wd->text);
1970 wd->changed = EINA_TRUE;
1972 /* Clear currently pending job if there is one */
1973 if (wd->append_text_idler)
1975 ecore_idler_del(wd->append_text_idler);
1976 free(wd->append_text_left);
1977 wd->append_text_left = NULL;
1978 wd->append_text_idler = NULL;
1981 len = strlen(entry);
1982 /* Split to ~_CHUNK_SIZE chunks */
1983 if (len > _CHUNK_SIZE)
1985 wd->append_text_left = (char *) malloc(len + 1);
1988 /* If we decided to use the idler */
1989 if (wd->append_text_left)
1991 /* Need to clear the entry first */
1992 edje_object_part_text_set(wd->ent, "elm.text", "");
1993 memcpy(wd->append_text_left, entry, len + 1);
1994 wd->append_text_position = 0;
1995 wd->append_text_len = len;
1996 wd->append_text_idler = ecore_idler_add(_text_append_idler, obj);
2000 edje_object_part_text_set(wd->ent, "elm.text", entry);
2005 _elm_entry_text_get(const Evas_Object *obj, const char *item)
2007 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
2008 Widget_Data *wd = elm_widget_data_get(obj);
2009 if (item && strcmp(item, "default")) return NULL;
2011 if (!wd) return NULL;
2012 if (wd->text) return wd->text;
2013 text = edje_object_part_text_get(wd->ent, "elm.text");
2016 ERR("text=NULL for edje %p, part 'elm.text'", wd->ent);
2020 if (wd->append_text_len > 0)
2024 tlen = strlen(text);
2025 tmpbuf = malloc(tlen + wd->append_text_len + 1);
2028 ERR("Failed to allocate memory for entry's text %p", obj);
2031 memcpy(tmpbuf, text, tlen);
2032 memcpy(tmpbuf + tlen, wd->append_text_left, wd->append_text_len);
2033 tmpbuf[tlen + wd->append_text_len] = '\0';
2034 eina_stringshare_replace(&wd->text, tmpbuf);
2039 eina_stringshare_replace(&wd->text, text);
2045 elm_entry_add(Evas_Object *parent)
2047 Evas_Object *obj, *top;
2051 ELM_WIDGET_STANDARD_SETUP(wd, Widget_Data, parent, e, obj, NULL);
2053 ELM_SET_WIDTYPE(widtype, "entry");
2054 elm_widget_type_set(obj, "entry");
2055 elm_widget_sub_object_add(parent, obj);
2056 elm_widget_on_focus_hook_set(obj, _on_focus_hook, NULL);
2057 elm_widget_data_set(obj, wd);
2058 elm_widget_del_hook_set(obj, _del_hook);
2059 elm_widget_del_pre_hook_set(obj, _del_pre_hook);
2060 elm_widget_theme_hook_set(obj, _theme_hook);
2061 elm_widget_disable_hook_set(obj, _disable_hook);
2062 elm_widget_signal_emit_hook_set(obj, _signal_emit_hook);
2063 elm_widget_focus_region_hook_set(obj, _focus_region_hook);
2064 elm_widget_on_focus_region_hook_set(obj, _on_focus_region_hook);
2065 elm_widget_signal_callback_add_hook_set(obj, _signal_callback_add_hook);
2066 elm_widget_signal_callback_del_hook_set(obj, _signal_callback_del_hook);
2067 elm_object_cursor_set(obj, ELM_CURSOR_XTERM);
2068 elm_widget_can_focus_set(obj, EINA_TRUE);
2069 elm_widget_highlight_ignore_set(obj, EINA_TRUE);
2070 elm_widget_text_set_hook_set(obj, _elm_entry_text_set);
2071 elm_widget_text_get_hook_set(obj, _elm_entry_text_get);
2072 elm_widget_content_set_hook_set(obj, _content_set_hook);
2073 elm_widget_content_unset_hook_set(obj, _content_unset_hook);
2074 elm_widget_content_get_hook_set(obj, _content_get_hook);
2076 wd->scroller = elm_smart_scroller_add(e);
2077 elm_widget_sub_object_add(obj, wd->scroller);
2078 elm_smart_scroller_widget_set(wd->scroller, obj);
2079 elm_smart_scroller_object_theme_set(obj, wd->scroller, "scroller", "entry",
2080 elm_widget_style_get(obj));
2081 evas_object_size_hint_weight_set(wd->scroller, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
2082 evas_object_size_hint_align_set(wd->scroller, EVAS_HINT_FILL, EVAS_HINT_FILL);
2083 elm_smart_scroller_bounce_allow_set(wd->scroller, EINA_FALSE, EINA_FALSE);
2084 evas_object_propagate_events_set(wd->scroller, EINA_TRUE);
2085 evas_object_propagate_events_set(elm_smart_scroller_edje_object_get(
2086 wd->scroller), EINA_TRUE);
2088 wd->linewrap = ELM_WRAP_WORD;
2089 wd->editable = EINA_TRUE;
2090 wd->disabled = EINA_FALSE;
2091 wd->context_menu = EINA_TRUE;
2092 wd->autosave = EINA_TRUE;
2093 wd->textonly = EINA_FALSE;
2095 wd->ent = edje_object_add(e);
2096 elm_widget_sub_object_add(obj, wd->ent);
2097 edje_object_item_provider_set(wd->ent, _get_item, obj);
2098 edje_object_text_insert_filter_callback_add(wd->ent,"elm.text", _text_filter, obj);
2099 evas_object_event_callback_add(wd->ent, EVAS_CALLBACK_MOVE, _move, obj);
2100 evas_object_event_callback_add(wd->ent, EVAS_CALLBACK_MOUSE_DOWN,
2102 evas_object_event_callback_add(wd->ent, EVAS_CALLBACK_MOUSE_UP,
2104 evas_object_event_callback_add(wd->ent, EVAS_CALLBACK_MOUSE_MOVE,
2106 evas_object_event_callback_add(obj, EVAS_CALLBACK_RESIZE, _resize, obj);
2108 _elm_theme_object_set(obj, wd->ent, "entry", "base", "default");
2109 edje_object_signal_callback_add(wd->ent, "entry,changed", "elm.text",
2110 _signal_entry_changed, obj);
2111 edje_object_signal_callback_add(wd->ent, "entry,changed,user", "elm.text",
2112 _signal_entry_changed_user, obj);
2113 edje_object_signal_callback_add(wd->ent, "preedit,changed", "elm.text",
2114 _signal_preedit_changed, obj);
2115 edje_object_signal_callback_add(wd->ent, "selection,start", "elm.text",
2116 _signal_selection_start, obj);
2117 edje_object_signal_callback_add(wd->ent, "selection,changed", "elm.text",
2118 _signal_selection_changed, obj);
2119 edje_object_signal_callback_add(wd->ent, "entry,selection,all,request", "elm.text",
2120 _signal_selection_all, obj);
2121 edje_object_signal_callback_add(wd->ent, "entry,selection,none,request", "elm.text",
2122 _signal_selection_none, obj);
2123 edje_object_signal_callback_add(wd->ent, "selection,cleared", "elm.text",
2124 _signal_selection_cleared, obj);
2125 edje_object_signal_callback_add(wd->ent, "entry,paste,request,*", "elm.text",
2126 _signal_entry_paste_request, obj);
2127 edje_object_signal_callback_add(wd->ent, "entry,copy,notify", "elm.text",
2128 _signal_entry_copy_notify, obj);
2129 edje_object_signal_callback_add(wd->ent, "entry,cut,notify", "elm.text",
2130 _signal_entry_cut_notify, obj);
2131 edje_object_signal_callback_add(wd->ent, "cursor,changed", "elm.text",
2132 _signal_cursor_changed, obj);
2133 edje_object_signal_callback_add(wd->ent, "anchor,mouse,down,*", "elm.text",
2134 _signal_anchor_down, obj);
2135 edje_object_signal_callback_add(wd->ent, "anchor,mouse,up,*", "elm.text",
2136 _signal_anchor_up, obj);
2137 edje_object_signal_callback_add(wd->ent, "anchor,mouse,clicked,*", "elm.text",
2138 _signal_anchor_clicked, obj);
2139 edje_object_signal_callback_add(wd->ent, "anchor,mouse,move,*", "elm.text",
2140 _signal_anchor_move, obj);
2141 edje_object_signal_callback_add(wd->ent, "anchor,mouse,in,*", "elm.text",
2142 _signal_anchor_in, obj);
2143 edje_object_signal_callback_add(wd->ent, "anchor,mouse,out,*", "elm.text",
2144 _signal_anchor_out, obj);
2145 edje_object_signal_callback_add(wd->ent, "entry,key,enter", "elm.text",
2146 _signal_key_enter, obj);
2147 edje_object_signal_callback_add(wd->ent, "mouse,down,1", "elm.text",
2148 _signal_mouse_down, obj);
2149 edje_object_signal_callback_add(wd->ent, "mouse,clicked,1", "elm.text",
2150 _signal_mouse_clicked, obj);
2151 edje_object_signal_callback_add(wd->ent, "mouse,down,1,double", "elm.text",
2152 _signal_mouse_double, obj);
2153 edje_object_signal_callback_add(wd->ent, "mouse,down,1,triple", "elm.text",
2154 _signal_mouse_triple, obj);
2155 edje_object_part_text_set(wd->ent, "elm.text", "");
2156 if (_elm_config->desktop_entry)
2157 edje_object_part_text_select_allow_set(wd->ent, "elm.text", EINA_TRUE);
2158 elm_widget_resize_object_set(obj, wd->ent);
2161 elm_entry_input_panel_layout_set(obj, ELM_INPUT_PANEL_LAYOUT_NORMAL);
2163 #ifdef HAVE_ELEMENTARY_X
2164 top = elm_widget_top_get(obj);
2165 if ((top) && (elm_win_xwindow_get(top)))
2167 wd->sel_notify_handler =
2168 ecore_event_handler_add(ECORE_X_EVENT_SELECTION_NOTIFY,
2169 _event_selection_notify, obj);
2170 wd->sel_clear_handler =
2171 ecore_event_handler_add(ECORE_X_EVENT_SELECTION_CLEAR,
2172 _event_selection_clear, obj);
2175 elm_drop_target_add(obj, ELM_SEL_FORMAT_MARKUP | ELM_SEL_FORMAT_IMAGE,
2176 _drag_drop_cb, NULL);
2179 entries = eina_list_prepend(entries, obj);
2181 // module - find module for entry
2182 wd->api = _module(obj);
2183 // if found - hook in
2184 if ((wd->api) && (wd->api->obj_hook)) wd->api->obj_hook(obj);
2186 _mirrored_set(obj, elm_widget_mirrored_get(obj));
2187 // TODO: convert Elementary to subclassing of Evas_Smart_Class
2188 // TODO: and save some bytes, making descriptions per-class and not instance!
2189 evas_object_smart_callbacks_descriptions_set(obj, _signals);
2194 elm_entry_single_line_set(Evas_Object *obj, Eina_Bool single_line)
2196 ELM_CHECK_WIDTYPE(obj, widtype);
2197 Widget_Data *wd = elm_widget_data_get(obj);
2199 if (wd->single_line == single_line) return;
2200 wd->single_line = single_line;
2201 wd->linewrap = ELM_WRAP_NONE;
2202 elm_entry_cnp_textonly_set(obj, EINA_TRUE);
2206 if (wd->single_line)
2207 elm_smart_scroller_policy_set(wd->scroller,
2208 ELM_SMART_SCROLLER_POLICY_OFF,
2209 ELM_SMART_SCROLLER_POLICY_OFF);
2212 const Elm_Scroller_Policy map[3] =
2214 ELM_SMART_SCROLLER_POLICY_AUTO,
2215 ELM_SMART_SCROLLER_POLICY_ON,
2216 ELM_SMART_SCROLLER_POLICY_OFF
2218 elm_smart_scroller_policy_set(wd->scroller,
2227 elm_entry_single_line_get(const Evas_Object *obj)
2229 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2230 Widget_Data *wd = elm_widget_data_get(obj);
2231 if (!wd) return EINA_FALSE;
2232 return wd->single_line;
2236 elm_entry_password_set(Evas_Object *obj, Eina_Bool password)
2238 ELM_CHECK_WIDTYPE(obj, widtype);
2239 Widget_Data *wd = elm_widget_data_get(obj);
2241 if (wd->password == password) return;
2242 wd->password = password;
2243 wd->single_line = EINA_TRUE;
2244 wd->linewrap = ELM_WRAP_NONE;
2249 elm_entry_password_get(const Evas_Object *obj)
2251 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2252 Widget_Data *wd = elm_widget_data_get(obj);
2253 if (!wd) return EINA_FALSE;
2254 return wd->password;
2258 elm_entry_entry_set(Evas_Object *obj, const char *entry)
2260 _elm_entry_text_set(obj, NULL, entry);
2264 elm_entry_entry_append(Evas_Object *obj, const char *entry)
2267 ELM_CHECK_WIDTYPE(obj, widtype);
2268 Widget_Data *wd = elm_widget_data_get(obj);
2270 if (!entry) entry = "";
2271 wd->changed = EINA_TRUE;
2273 len = strlen(entry);
2274 if (wd->append_text_left)
2277 tmpbuf = realloc(wd->append_text_left, wd->append_text_len + len + 1);
2283 wd->append_text_left = tmpbuf;
2284 memcpy(wd->append_text_left + wd->append_text_len, entry, len + 1);
2285 wd->append_text_len += len;
2289 /* FIXME: Add chunked appending here (like in entry_set) */
2290 edje_object_part_text_append(wd->ent, "elm.text", entry);
2295 elm_entry_entry_get(const Evas_Object *obj)
2297 return _elm_entry_text_get(obj, NULL);
2301 elm_entry_is_empty(const Evas_Object *obj)
2303 /* FIXME: until there's support for that in textblock, we just check
2304 * to see if the there is text or not. */
2305 ELM_CHECK_WIDTYPE(obj, widtype) EINA_TRUE;
2306 Widget_Data *wd = elm_widget_data_get(obj);
2307 const Evas_Object *tb;
2308 Evas_Textblock_Cursor *cur;
2310 if (!wd) return EINA_TRUE;
2311 /* It's a hack until we get the support suggested above.
2312 * We just create a cursor, point it to the begining, and then
2313 * try to advance it, if it can advance, the tb is not empty,
2314 * otherwise it is. */
2315 tb = edje_object_part_object_get(wd->ent, "elm.text");
2316 cur = evas_object_textblock_cursor_new((Evas_Object *) tb); /* This is
2317 actually, ok for the time being, thsese hackish stuff will be removed
2318 once evas 1.0 is out*/
2319 evas_textblock_cursor_pos_set(cur, 0);
2320 ret = evas_textblock_cursor_char_next(cur);
2321 evas_textblock_cursor_free(cur);
2327 elm_entry_selection_get(const Evas_Object *obj)
2329 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
2330 Widget_Data *wd = elm_widget_data_get(obj);
2331 if (!wd) return NULL;
2332 return edje_object_part_text_selection_get(wd->ent, "elm.text");
2336 elm_entry_entry_insert(Evas_Object *obj, const char *entry)
2338 ELM_CHECK_WIDTYPE(obj, widtype);
2339 Widget_Data *wd = elm_widget_data_get(obj);
2341 edje_object_part_text_insert(wd->ent, "elm.text", entry);
2342 wd->changed = EINA_TRUE;
2347 elm_entry_line_wrap_set(Evas_Object *obj, Elm_Wrap_Type wrap)
2349 ELM_CHECK_WIDTYPE(obj, widtype);
2350 Widget_Data *wd = elm_widget_data_get(obj);
2352 if (wd->linewrap == wrap) return;
2354 wd->linewrap = wrap;
2359 elm_entry_line_wrap_get(const Evas_Object *obj)
2361 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2362 Widget_Data *wd = elm_widget_data_get(obj);
2363 if (!wd) return EINA_FALSE;
2364 return wd->linewrap;
2368 elm_entry_editable_set(Evas_Object *obj, Eina_Bool editable)
2370 ELM_CHECK_WIDTYPE(obj, widtype);
2371 Widget_Data *wd = elm_widget_data_get(obj);
2373 if (wd->editable == editable) return;
2374 wd->editable = editable;
2377 #ifdef HAVE_ELEMENTARY_X
2379 elm_drop_target_add(obj, ELM_SEL_FORMAT_MARKUP, _drag_drop_cb, NULL);
2381 elm_drop_target_del(obj);
2386 elm_entry_editable_get(const Evas_Object *obj)
2388 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2389 Widget_Data *wd = elm_widget_data_get(obj);
2390 if (!wd) return EINA_FALSE;
2391 return wd->editable;
2395 elm_entry_select_none(Evas_Object *obj)
2397 ELM_CHECK_WIDTYPE(obj, widtype);
2398 Widget_Data *wd = elm_widget_data_get(obj);
2402 wd->selmode = EINA_FALSE;
2403 if (!_elm_config->desktop_entry)
2404 edje_object_part_text_select_allow_set(wd->ent, "elm.text", EINA_FALSE);
2405 edje_object_signal_emit(wd->ent, "elm,state,select,off", "elm");
2407 wd->have_selection = EINA_FALSE;
2408 edje_object_part_text_select_none(wd->ent, "elm.text");
2412 elm_entry_select_all(Evas_Object *obj)
2414 ELM_CHECK_WIDTYPE(obj, widtype);
2415 Widget_Data *wd = elm_widget_data_get(obj);
2419 wd->selmode = EINA_FALSE;
2420 if (!_elm_config->desktop_entry)
2421 edje_object_part_text_select_allow_set(wd->ent, "elm.text", EINA_FALSE);
2422 edje_object_signal_emit(wd->ent, "elm,state,select,off", "elm");
2424 wd->have_selection = EINA_TRUE;
2425 edje_object_part_text_select_all(wd->ent, "elm.text");
2429 elm_entry_cursor_geometry_get(const Evas_Object *obj, Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *h)
2431 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2432 Widget_Data *wd = elm_widget_data_get(obj);
2433 if (!wd) return EINA_FALSE;
2434 edje_object_part_text_cursor_geometry_get(wd->ent, "elm.text", x, y, w, h);
2439 elm_entry_cursor_next(Evas_Object *obj)
2441 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2442 Widget_Data *wd = elm_widget_data_get(obj);
2443 if (!wd) return EINA_FALSE;
2444 return edje_object_part_text_cursor_next(wd->ent, "elm.text", EDJE_CURSOR_MAIN);
2448 elm_entry_cursor_prev(Evas_Object *obj)
2450 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2451 Widget_Data *wd = elm_widget_data_get(obj);
2452 if (!wd) return EINA_FALSE;
2453 return edje_object_part_text_cursor_prev(wd->ent, "elm.text", EDJE_CURSOR_MAIN);
2457 elm_entry_cursor_up(Evas_Object *obj)
2459 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2460 Widget_Data *wd = elm_widget_data_get(obj);
2461 if (!wd) return EINA_FALSE;
2462 return edje_object_part_text_cursor_up(wd->ent, "elm.text", EDJE_CURSOR_MAIN);
2466 elm_entry_cursor_down(Evas_Object *obj)
2468 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2469 Widget_Data *wd = elm_widget_data_get(obj);
2470 if (!wd) return EINA_FALSE;
2471 return edje_object_part_text_cursor_down(wd->ent, "elm.text", EDJE_CURSOR_MAIN);
2475 elm_entry_cursor_begin_set(Evas_Object *obj)
2477 ELM_CHECK_WIDTYPE(obj, widtype);
2478 Widget_Data *wd = elm_widget_data_get(obj);
2480 edje_object_part_text_cursor_begin_set(wd->ent, "elm.text", EDJE_CURSOR_MAIN);
2484 elm_entry_cursor_end_set(Evas_Object *obj)
2486 ELM_CHECK_WIDTYPE(obj, widtype);
2487 Widget_Data *wd = elm_widget_data_get(obj);
2491 edje_object_part_text_cursor_end_set(wd->ent, "elm.text", EDJE_CURSOR_MAIN);
2494 elm_widget_show_region_get(obj, &x, &y, &w, &h);
2495 elm_smart_scroller_child_region_show(wd->scroller, x, y, w, h);
2500 elm_entry_cursor_line_begin_set(Evas_Object *obj)
2502 ELM_CHECK_WIDTYPE(obj, widtype);
2503 Widget_Data *wd = elm_widget_data_get(obj);
2505 edje_object_part_text_cursor_line_begin_set(wd->ent, "elm.text", EDJE_CURSOR_MAIN);
2509 elm_entry_cursor_line_end_set(Evas_Object *obj)
2511 ELM_CHECK_WIDTYPE(obj, widtype);
2512 Widget_Data *wd = elm_widget_data_get(obj);
2514 edje_object_part_text_cursor_line_end_set(wd->ent, "elm.text", EDJE_CURSOR_MAIN);
2518 elm_entry_cursor_selection_begin(Evas_Object *obj)
2520 ELM_CHECK_WIDTYPE(obj, widtype);
2521 Widget_Data *wd = elm_widget_data_get(obj);
2523 edje_object_part_text_select_begin(wd->ent, "elm.text");
2527 elm_entry_cursor_selection_end(Evas_Object *obj)
2529 ELM_CHECK_WIDTYPE(obj, widtype);
2530 Widget_Data *wd = elm_widget_data_get(obj);
2532 edje_object_part_text_select_extend(wd->ent, "elm.text");
2536 elm_entry_cursor_is_format_get(const Evas_Object *obj)
2538 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2539 Widget_Data *wd = elm_widget_data_get(obj);
2540 if (!wd) return EINA_FALSE;
2541 return edje_object_part_text_cursor_is_format_get(wd->ent, "elm.text", EDJE_CURSOR_MAIN);
2545 elm_entry_cursor_is_visible_format_get(const Evas_Object *obj)
2547 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2548 Widget_Data *wd = elm_widget_data_get(obj);
2549 if (!wd) return EINA_FALSE;
2550 return edje_object_part_text_cursor_is_visible_format_get(wd->ent, "elm.text", EDJE_CURSOR_MAIN);
2554 elm_entry_cursor_content_get(const Evas_Object *obj)
2556 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
2557 Widget_Data *wd = elm_widget_data_get(obj);
2558 if (!wd) return NULL;
2559 return edje_object_part_text_cursor_content_get(wd->ent, "elm.text", EDJE_CURSOR_MAIN);
2563 elm_entry_cursor_pos_set(Evas_Object *obj, int pos)
2565 ELM_CHECK_WIDTYPE(obj, widtype);
2566 Widget_Data *wd = elm_widget_data_get(obj);
2568 edje_object_part_text_cursor_pos_set(wd->ent, "elm.text", EDJE_CURSOR_MAIN, pos);
2569 edje_object_message_signal_process(wd->ent);
2573 elm_entry_cursor_pos_get(const Evas_Object *obj)
2575 ELM_CHECK_WIDTYPE(obj, widtype) 0;
2576 Widget_Data *wd = elm_widget_data_get(obj);
2578 return edje_object_part_text_cursor_pos_get(wd->ent, "elm.text", EDJE_CURSOR_MAIN);
2582 elm_entry_selection_cut(Evas_Object *obj)
2584 ELM_CHECK_WIDTYPE(obj, widtype);
2585 Widget_Data *wd = elm_widget_data_get(obj);
2587 _cut(obj, NULL, NULL);
2591 elm_entry_selection_copy(Evas_Object *obj)
2593 ELM_CHECK_WIDTYPE(obj, widtype);
2594 Widget_Data *wd = elm_widget_data_get(obj);
2596 _copy(obj, NULL, NULL);
2600 elm_entry_selection_paste(Evas_Object *obj)
2602 ELM_CHECK_WIDTYPE(obj, widtype);
2603 Widget_Data *wd = elm_widget_data_get(obj);
2605 _paste(obj, NULL, NULL);
2609 elm_entry_context_menu_clear(Evas_Object *obj)
2611 ELM_CHECK_WIDTYPE(obj, widtype);
2612 Widget_Data *wd = elm_widget_data_get(obj);
2613 Elm_Entry_Context_Menu_Item *it;
2615 EINA_LIST_FREE(wd->items, it)
2617 eina_stringshare_del(it->label);
2618 eina_stringshare_del(it->icon_file);
2619 eina_stringshare_del(it->icon_group);
2625 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)
2627 ELM_CHECK_WIDTYPE(obj, widtype);
2628 Widget_Data *wd = elm_widget_data_get(obj);
2629 Elm_Entry_Context_Menu_Item *it;
2631 it = calloc(1, sizeof(Elm_Entry_Context_Menu_Item));
2633 wd->items = eina_list_append(wd->items, it);
2635 it->label = eina_stringshare_add(label);
2636 it->icon_file = eina_stringshare_add(icon_file);
2637 it->icon_type = icon_type;
2639 it->data = (void *)data;
2643 elm_entry_context_menu_disabled_set(Evas_Object *obj, Eina_Bool disabled)
2645 ELM_CHECK_WIDTYPE(obj, widtype);
2646 Widget_Data *wd = elm_widget_data_get(obj);
2648 if (wd->context_menu == !disabled) return;
2649 wd->context_menu = !disabled;
2653 elm_entry_context_menu_disabled_get(const Evas_Object *obj)
2655 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2656 Widget_Data *wd = elm_widget_data_get(obj);
2657 if (!wd) return EINA_FALSE;
2658 return !wd->context_menu;
2662 elm_entry_item_provider_append(Evas_Object *obj, Evas_Object *(*func) (void *data, Evas_Object *entry, const char *item), void *data)
2664 ELM_CHECK_WIDTYPE(obj, widtype);
2665 Widget_Data *wd = elm_widget_data_get(obj);
2667 EINA_SAFETY_ON_NULL_RETURN(func);
2668 Elm_Entry_Item_Provider *ip = calloc(1, sizeof(Elm_Entry_Item_Provider));
2672 wd->item_providers = eina_list_append(wd->item_providers, ip);
2676 elm_entry_item_provider_prepend(Evas_Object *obj, Evas_Object *(*func) (void *data, Evas_Object *entry, const char *item), void *data)
2678 ELM_CHECK_WIDTYPE(obj, widtype);
2679 Widget_Data *wd = elm_widget_data_get(obj);
2681 EINA_SAFETY_ON_NULL_RETURN(func);
2682 Elm_Entry_Item_Provider *ip = calloc(1, sizeof(Elm_Entry_Item_Provider));
2686 wd->item_providers = eina_list_prepend(wd->item_providers, ip);
2690 elm_entry_item_provider_remove(Evas_Object *obj, Evas_Object *(*func) (void *data, Evas_Object *entry, const char *item), void *data)
2692 ELM_CHECK_WIDTYPE(obj, widtype);
2693 Widget_Data *wd = elm_widget_data_get(obj);
2695 Elm_Entry_Item_Provider *ip;
2697 EINA_SAFETY_ON_NULL_RETURN(func);
2698 EINA_LIST_FOREACH(wd->item_providers, l, ip)
2700 if ((ip->func == func) && ((!data) || (ip->data == data)))
2702 wd->item_providers = eina_list_remove_list(wd->item_providers, l);
2710 elm_entry_text_filter_append(Evas_Object *obj, Elm_Entry_Filter_Cb func, void *data)
2713 Elm_Entry_Text_Filter *tf;
2714 ELM_CHECK_WIDTYPE(obj, widtype);
2716 wd = elm_widget_data_get(obj);
2718 EINA_SAFETY_ON_NULL_RETURN(func);
2720 tf = _filter_new(func, data);
2723 wd->text_filters = eina_list_append(wd->text_filters, tf);
2727 elm_entry_text_filter_prepend(Evas_Object *obj, Elm_Entry_Filter_Cb func, void *data)
2730 Elm_Entry_Text_Filter *tf;
2731 ELM_CHECK_WIDTYPE(obj, widtype);
2733 wd = elm_widget_data_get(obj);
2735 EINA_SAFETY_ON_NULL_RETURN(func);
2737 tf = _filter_new(func, data);
2740 wd->text_filters = eina_list_prepend(wd->text_filters, tf);
2744 elm_entry_text_filter_remove(Evas_Object *obj, Elm_Entry_Filter_Cb func, void *data)
2748 Elm_Entry_Text_Filter *tf;
2749 ELM_CHECK_WIDTYPE(obj, widtype);
2751 wd = elm_widget_data_get(obj);
2753 EINA_SAFETY_ON_NULL_RETURN(func);
2755 EINA_LIST_FOREACH(wd->text_filters, l, tf)
2757 if ((tf->func == func) && ((!data) || (tf->data == data)))
2759 wd->text_filters = eina_list_remove_list(wd->text_filters, l);
2767 elm_entry_markup_to_utf8(const char *s)
2769 char *ss = _elm_util_mkup_to_text(s);
2770 if (!ss) ss = strdup("");
2775 elm_entry_utf8_to_markup(const char *s)
2777 char *ss = _elm_util_text_to_mkup(s);
2778 if (!ss) ss = strdup("");
2783 elm_entry_filter_limit_size(void *data, Evas_Object *entry, char **text)
2785 Elm_Entry_Filter_Limit_Size *lim = data;
2788 const char *(*text_get)(const Evas_Object *);
2789 const char *widget_type;
2791 EINA_SAFETY_ON_NULL_RETURN(data);
2792 EINA_SAFETY_ON_NULL_RETURN(entry);
2793 EINA_SAFETY_ON_NULL_RETURN(text);
2795 /* hack. I don't want to copy the entire function to work with
2797 widget_type = elm_widget_type_get(entry);
2798 if (!strcmp(widget_type, "entry"))
2799 text_get = elm_entry_entry_get;
2803 current = elm_entry_markup_to_utf8(text_get(entry));
2805 if (lim->max_char_count > 0)
2807 len = evas_string_char_len_get(current);
2808 if (len >= lim->max_char_count)
2810 evas_object_smart_callback_call(entry, "maxlength,reached", NULL);
2816 newlen = evas_string_char_len_get(elm_entry_markup_to_utf8(*text));
2817 if ((len + newlen) > lim->max_char_count)
2818 _add_chars_till_limit(entry, text, (lim->max_char_count - len), LENGTH_UNIT_CHAR);
2820 else if (lim->max_byte_count > 0)
2822 len = strlen(current);
2823 if (len >= lim->max_byte_count)
2825 evas_object_smart_callback_call(entry, "maxlength,reached", NULL);
2831 newlen = strlen(elm_entry_markup_to_utf8(*text));
2832 if ((len + newlen) > lim->max_byte_count)
2833 _add_chars_till_limit(entry, text, (lim->max_byte_count - len), LENGTH_UNIT_BYTE);
2839 elm_entry_filter_accept_set(void *data, Evas_Object *entry __UNUSED__, char **text)
2841 Elm_Entry_Filter_Accept_Set *as = data;
2845 int read_idx, last_read_idx = 0, read_char;
2847 EINA_SAFETY_ON_NULL_RETURN(data);
2848 EINA_SAFETY_ON_NULL_RETURN(text);
2850 if ((!as->accepted) && (!as->rejected))
2856 goes_in = EINA_TRUE;
2861 goes_in = EINA_FALSE;
2865 read_idx = evas_string_char_next_get(*text, 0, &read_char);
2868 int cmp_idx, cmp_char;
2869 Eina_Bool in_set = EINA_FALSE;
2871 cmp_idx = evas_string_char_next_get(set, 0, &cmp_char);
2874 if (read_char == cmp_char)
2879 cmp_idx = evas_string_char_next_get(set, cmp_idx, &cmp_char);
2881 if (in_set == goes_in)
2883 int size = read_idx - last_read_idx;
2884 const char *src = (*text) + last_read_idx;
2886 memcpy(insert, *text + last_read_idx, size);
2889 last_read_idx = read_idx;
2890 read_idx = evas_string_char_next_get(*text, read_idx, &read_char);
2896 elm_entry_file_set(Evas_Object *obj, const char *file, Elm_Text_Format format)
2898 ELM_CHECK_WIDTYPE(obj, widtype);
2899 Widget_Data *wd = elm_widget_data_get(obj);
2901 if (wd->delay_write)
2903 ecore_timer_del(wd->delay_write);
2904 wd->delay_write = NULL;
2906 if (wd->autosave) _save(obj);
2907 eina_stringshare_replace(&wd->file, file);
2908 wd->format = format;
2913 elm_entry_file_get(const Evas_Object *obj, const char **file, Elm_Text_Format *format)
2915 ELM_CHECK_WIDTYPE(obj, widtype);
2916 Widget_Data *wd = elm_widget_data_get(obj);
2918 if (file) *file = wd->file;
2919 if (format) *format = wd->format;
2923 elm_entry_file_save(Evas_Object *obj)
2925 ELM_CHECK_WIDTYPE(obj, widtype);
2926 Widget_Data *wd = elm_widget_data_get(obj);
2928 if (wd->delay_write)
2930 ecore_timer_del(wd->delay_write);
2931 wd->delay_write = NULL;
2934 wd->delay_write = ecore_timer_add(2.0, _delay_write, obj);
2938 elm_entry_autosave_set(Evas_Object *obj, Eina_Bool autosave)
2940 ELM_CHECK_WIDTYPE(obj, widtype);
2941 Widget_Data *wd = elm_widget_data_get(obj);
2943 wd->autosave = !!autosave;
2947 elm_entry_autosave_get(const Evas_Object *obj)
2949 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2950 Widget_Data *wd = elm_widget_data_get(obj);
2951 if (!wd) return EINA_FALSE;
2952 return wd->autosave;
2956 elm_entry_cnp_textonly_set(Evas_Object *obj, Eina_Bool textonly)
2958 Elm_Sel_Format format = ELM_SEL_FORMAT_MARKUP;
2959 ELM_CHECK_WIDTYPE(obj, widtype);
2960 Widget_Data *wd = elm_widget_data_get(obj);
2962 textonly = !!textonly;
2963 if (wd->textonly == textonly) return;
2964 wd->textonly = !!textonly;
2965 if (!textonly) format |= ELM_SEL_FORMAT_IMAGE;
2966 #ifdef HAVE_ELEMENTARY_X
2967 elm_drop_target_add(obj, format, _drag_drop_cb, NULL);
2972 elm_entry_cnp_textonly_get(const Evas_Object *obj)
2974 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2975 Widget_Data *wd = elm_widget_data_get(obj);
2976 if (!wd) return EINA_FALSE;
2977 return wd->textonly;
2981 elm_entry_scrollable_set(Evas_Object *obj, Eina_Bool scroll)
2983 ELM_CHECK_WIDTYPE(obj, widtype);
2984 Widget_Data *wd = elm_widget_data_get(obj);
2987 if (wd->scroll == scroll) return;
2988 wd->scroll = scroll;
2991 elm_widget_sub_object_del(obj, wd->scroller);
2992 elm_widget_resize_object_set(obj, wd->scroller);
2993 elm_widget_sub_object_add(obj, wd->ent);
2994 elm_smart_scroller_child_set(wd->scroller, wd->ent);
2995 evas_object_show(wd->scroller);
2996 elm_widget_on_show_region_hook_set(obj, _show_region_hook, obj);
3000 elm_smart_scroller_child_set(wd->scroller, NULL);
3001 elm_widget_sub_object_del(obj, wd->ent);
3002 elm_widget_resize_object_set(obj, wd->ent);
3003 evas_object_smart_member_add(wd->scroller, obj);
3004 elm_widget_sub_object_add(obj, wd->scroller);
3005 evas_object_hide(wd->scroller);
3006 elm_widget_on_show_region_hook_set(obj, NULL, NULL);
3013 elm_entry_scrollable_get(const Evas_Object *obj)
3015 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
3016 Widget_Data *wd = elm_widget_data_get(obj);
3017 if (!wd) return EINA_FALSE;
3022 elm_entry_icon_set(Evas_Object *obj, Evas_Object *icon)
3024 ELM_CHECK_WIDTYPE(obj, widtype);
3025 Widget_Data *wd = elm_widget_data_get(obj);
3028 EINA_SAFETY_ON_NULL_RETURN(icon);
3029 if (wd->icon == icon) return;
3030 if (wd->icon) evas_object_del(wd->icon);
3032 edje = elm_smart_scroller_edje_object_get(wd->scroller);
3034 edje_object_part_swallow(edje, "elm.swallow.icon", wd->icon);
3035 edje_object_signal_emit(edje, "elm,action,show,icon", "elm");
3040 elm_entry_icon_get(const Evas_Object *obj)
3042 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
3043 Widget_Data *wd = elm_widget_data_get(obj);
3044 if (!wd) return NULL;
3049 elm_entry_icon_unset(Evas_Object *obj)
3051 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
3052 Widget_Data *wd = elm_widget_data_get(obj);
3053 Evas_Object *ret = NULL;
3054 if (!wd) return NULL;
3057 Evas_Object *edje = elm_smart_scroller_edje_object_get(wd->scroller);
3058 if (!edje) return NULL;
3060 edje_object_part_unswallow(edje, wd->icon);
3061 edje_object_signal_emit(edje, "elm,action,hide,icon", "elm");
3069 elm_entry_icon_visible_set(Evas_Object *obj, Eina_Bool setting)
3071 ELM_CHECK_WIDTYPE(obj, widtype);
3072 Widget_Data *wd = elm_widget_data_get(obj);
3073 if ((!wd) || (!wd->icon)) return;
3075 evas_object_hide(wd->icon);
3077 evas_object_show(wd->icon);
3082 elm_entry_end_set(Evas_Object *obj, Evas_Object *end)
3084 ELM_CHECK_WIDTYPE(obj, widtype);
3085 Widget_Data *wd = elm_widget_data_get(obj);
3088 EINA_SAFETY_ON_NULL_RETURN(end);
3089 if (wd->end == end) return;
3090 if (wd->end) evas_object_del(wd->end);
3092 edje = elm_smart_scroller_edje_object_get(wd->scroller);
3094 edje_object_part_swallow(edje, "elm.swallow.end", wd->end);
3095 edje_object_signal_emit(edje, "elm,action,show,end", "elm");
3100 elm_entry_end_get(const Evas_Object *obj)
3102 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
3103 Widget_Data *wd = elm_widget_data_get(obj);
3104 if (!wd) return NULL;
3109 elm_entry_end_unset(Evas_Object *obj)
3111 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
3112 Widget_Data *wd = elm_widget_data_get(obj);
3113 Evas_Object *ret = NULL;
3114 if (!wd) return NULL;
3117 Evas_Object *edje = elm_smart_scroller_edje_object_get(wd->scroller);
3118 if (!edje) return NULL;
3120 edje_object_part_unswallow(edje, wd->end);
3121 edje_object_signal_emit(edje, "elm,action,hide,end", "elm");
3129 elm_entry_end_visible_set(Evas_Object *obj, Eina_Bool setting)
3131 ELM_CHECK_WIDTYPE(obj, widtype);
3132 Widget_Data *wd = elm_widget_data_get(obj);
3133 if ((!wd) || (!wd->end)) return;
3135 evas_object_hide(wd->end);
3137 evas_object_show(wd->end);
3142 elm_entry_scrollbar_policy_set(Evas_Object *obj, Elm_Scroller_Policy h, Elm_Scroller_Policy v)
3144 ELM_CHECK_WIDTYPE(obj, widtype);
3145 Widget_Data *wd = elm_widget_data_get(obj);
3146 const Elm_Scroller_Policy map[3] =
3148 ELM_SMART_SCROLLER_POLICY_AUTO,
3149 ELM_SMART_SCROLLER_POLICY_ON,
3150 ELM_SMART_SCROLLER_POLICY_OFF
3155 elm_smart_scroller_policy_set(wd->scroller,
3161 elm_entry_bounce_set(Evas_Object *obj, Eina_Bool h_bounce, Eina_Bool v_bounce)
3163 ELM_CHECK_WIDTYPE(obj, widtype);
3164 Widget_Data *wd = elm_widget_data_get(obj);
3166 elm_smart_scroller_bounce_allow_set(wd->scroller, h_bounce, v_bounce);
3170 elm_entry_bounce_get(const Evas_Object *obj, Eina_Bool *h_bounce, Eina_Bool *v_bounce)
3172 ELM_CHECK_WIDTYPE(obj, widtype);
3173 Widget_Data *wd = elm_widget_data_get(obj);
3175 elm_smart_scroller_bounce_allow_get(wd->scroller, h_bounce, v_bounce);
3179 elm_entry_input_panel_layout_set(Evas_Object *obj, Elm_Input_Panel_Layout layout)
3181 ELM_CHECK_WIDTYPE(obj, widtype);
3182 Widget_Data *wd = elm_widget_data_get(obj);
3185 wd->input_panel_layout = layout;
3187 edje_object_part_text_input_panel_layout_set(wd->ent, "elm.text", layout);
3190 EAPI Elm_Input_Panel_Layout
3191 elm_entry_input_panel_layout_get(Evas_Object *obj)
3193 ELM_CHECK_WIDTYPE(obj, widtype) ELM_INPUT_PANEL_LAYOUT_INVALID;
3194 Widget_Data *wd = elm_widget_data_get(obj);
3195 if (!wd) return ELM_INPUT_PANEL_LAYOUT_INVALID;
3197 return wd->input_panel_layout;