1 #include <Elementary.h>
2 #include <Elementary_Cursor.h>
4 #include "elm_module_priv.h"
7 * @defgroup Entry Entry
9 * An entry is a convenience widget which shows
10 * a box that the user can enter text into. Unlike a
11 * @ref Scrolled_Entry widget, entries DO NOT scroll with user
12 * input. Entry widgets are capable of expanding past the
13 * boundaries of the window, thus resizing the window to its
16 * You can also insert "items" in the entry with:
18 * \<item size=16x16 vsize=full href=emoticon/haha\>\</item\>
20 * for example. sizing can be set bu size=WxH, relsize=WxH or absize=WxH with
21 * vsize=ascent or vsize=full. the href=NAME sets the item name. Entry
22 * supports a list of emoticon names by default. These are:
25 * - emoticon/angry-shout
26 * - emoticon/crazy-laugh
27 * - emoticon/evil-laugh
29 * - emoticon/goggle-smile
31 * - emoticon/grumpy-smile
33 * - emoticon/guilty-smile
35 * - emoticon/half-smile
36 * - emoticon/happy-panting
38 * - emoticon/indifferent
40 * - emoticon/knowing-grin
42 * - emoticon/little-bit-sorry
43 * - emoticon/love-lots
45 * - emoticon/minimal-smile
46 * - emoticon/not-happy
47 * - emoticon/not-impressed
49 * - emoticon/opensmile
52 * - emoticon/squint-laugh
53 * - emoticon/surprised
54 * - emoticon/suspicious
55 * - emoticon/tongue-dangling
56 * - emoticon/tongue-poke
59 * - emoticon/very-sorry
65 * These are built-in currently, but you can add your own item provieer that
66 * can create inlined objects in the text and fill the space allocated to the
67 * item with a custom object of your own.
69 * See the entry test for some more examples of use of this.
71 * Entries have functions to load a text file, display it,
72 * allowing editing of it and saving of changes back to the file loaded.
73 * Changes are written back to the original file after a short delay.
74 * The file to load and save to is specified by elm_entry_file_set().
76 * Signals that you can add callbacks for are:
78 * "changed" - The text within the entry was changed
79 * "activated" - The entry has had editing finished and changes are to be committed
80 (generally when enter key is pressed)
81 * "press" - The entry has been clicked
82 * "longpressed" - The entry has been clicked for a couple seconds
83 * "clicked" - The entry has been clicked
84 * "clicked,double" - The entry has been double clicked
85 * "focused" - The entry has received focus
86 * "unfocused" - The entry has lost focus
87 * "selection,paste" - A paste action has occurred
88 * "selection,copy" - A copy action has occurred
89 * "selection,cut" - A cut action has occurred
90 * "selection,start" - A selection has begun
91 * "selection,changed" - The selection has changed
92 * "selection,cleared" - The selection has been cleared
93 * "cursor,changed" - The cursor has changed
94 * "anchor,clicked" - The anchor has been clicked
97 typedef struct _Mod_Api Mod_Api;
99 typedef struct _Widget_Data Widget_Data;
100 typedef struct _Elm_Entry_Context_Menu_Item Elm_Entry_Context_Menu_Item;
101 typedef struct _Elm_Entry_Item_Provider Elm_Entry_Item_Provider;
102 typedef struct _Elm_Entry_Text_Filter Elm_Entry_Text_Filter;
108 Evas_Object *hoversel;
112 Evas_Object *mgf_proxy;
113 Evas_Object *mgf_clip;
115 Evas_Coord mgf_height;
118 Ecore_Job *deferred_recalc_job;
119 Ecore_Event_Handler *sel_notify_handler;
120 Ecore_Event_Handler *sel_clear_handler;
121 Ecore_Timer *longpress_timer;
122 Ecore_Timer *delay_write;
123 /* Only for clipboard */
128 Elm_Text_Format format;
130 Evas_Coord downx, downy;
131 Evas_Coord cx, cy, cw, ch;
133 Eina_List *item_providers;
134 Eina_List *text_filters;
135 Eina_List *match_list;
136 Ecore_Job *matchlist_job;
137 Ecore_Job *hovdeljob;
138 Mod_Api *api; // module api if supplied
141 Eina_Bool changed : 1;
142 Eina_Bool linewrap : 1;
143 Eina_Bool char_linewrap : 1;
144 Eina_Bool single_line : 1;
145 Eina_Bool password : 1;
146 Eina_Bool editable : 1;
147 Eina_Bool selection_asked : 1;
148 Eina_Bool have_selection : 1;
149 Eina_Bool selmode : 1;
150 Eina_Bool deferred_cur : 1;
151 Eina_Bool disabled : 1;
152 Eina_Bool double_clicked : 1;
153 Eina_Bool long_pressed : 1;
154 Eina_Bool context_menu : 1;
155 Eina_Bool drag_selection_asked : 1;
156 Eina_Bool bgcolor : 1;
157 Eina_Bool can_write : 1;
158 Eina_Bool autosave : 1;
159 Eina_Bool textonly : 1;
160 Eina_Bool usedown : 1;
161 Eina_Bool autoreturnkey : 1;
162 Eina_Bool input_panel_enable : 1;
163 Eina_Bool autocapital : 1;
164 Elm_Input_Panel_Layout input_panel_layout;
165 Eina_Bool autoperiod : 1;
166 Eina_Bool matchlist_list_clicked : 1;
167 Eina_Bool matchlist_case_sensitive : 1;
168 int matchlist_threshold;
171 struct _Elm_Entry_Context_Menu_Item
175 const char *icon_file;
176 const char *icon_group;
177 Elm_Icon_Type icon_type;
182 struct _Elm_Entry_Item_Provider
184 Evas_Object *(*func) (void *data, Evas_Object *entry, const char *item);
188 struct _Elm_Entry_Text_Filter
190 void (*func) (void *data, Evas_Object *entry, char **text);
194 typedef enum _Length_Unit
201 static const char *widtype = NULL;
203 static Evas_Object *cnpwidgetdata = NULL;
206 #ifdef HAVE_ELEMENTARY_X
207 static Eina_Bool _drag_drop_cb(void *data, Evas_Object *obj, Elm_Selection_Data *);
209 static void _del_hook(Evas_Object *obj);
210 static void _mirrored_set(Evas_Object *obj, Eina_Bool rtl);
211 static void _theme_hook(Evas_Object *obj);
212 static void _disable_hook(Evas_Object *obj);
213 static void _sizing_eval(Evas_Object *obj);
214 static void _on_focus_hook(void *data, Evas_Object *obj);
215 static void _resize(void *data, Evas *e, Evas_Object *obj, void *event_info);
216 static const char *_getbase(Evas_Object *obj);
217 static void _signal_entry_changed(void *data, Evas_Object *obj, const char *emission, const char *source);
218 static void _signal_selection_start(void *data, Evas_Object *obj, const char *emission, const char *source);
219 static void _signal_selection_end(void *data, Evas_Object *obj, const char *emission, const char *source);
220 static void _signal_selection_changed(void *data, Evas_Object *obj, const char *emission, const char *source);
221 static void _signal_selection_cleared(void *data, Evas_Object *obj, const char *emission, const char *source);
222 static void _signal_handler_move_start(void *data, Evas_Object *obj, const char *emission, const char *source);
223 static void _signal_handler_move_end(void *data, Evas_Object *obj, const char *emission, const char *source);
224 static void _signal_handler_moving(void *data, Evas_Object *obj, const char *emission, const char *source);
225 static void _signal_entry_paste_request(void *data, Evas_Object *obj, const char *emission, const char *source);
226 static void _signal_entry_copy_notify(void *data, Evas_Object *obj, const char *emission, const char *source);
227 static void _signal_entry_cut_notify(void *data, Evas_Object *obj, const char *emission, const char *source);
228 static void _signal_cursor_changed(void *data, Evas_Object *obj, const char *emission, const char *source);
229 static void _add_chars_till_limit(Evas_Object *obj, char **text, int can_add, Length_Unit unit);
230 static int _strbuf_key_value_replace(Eina_Strbuf *srcbuf, char *key, const char *value, int deleteflag);
231 static int _stringshare_key_value_replace(const char **srcstring, char *key, const char *value, int deleteflag);
232 static int _entry_length_get(Evas_Object *obj);
233 static void _magnifier_create(void *data);
234 static void _magnifier_show(void *data);
235 static void _magnifier_hide(void *data);
236 static void _magnifier_move(void *data);
238 static const char SIG_CHANGED[] = "changed";
239 static const char SIG_ACTIVATED[] = "activated";
240 static const char SIG_PRESS[] = "press";
241 static const char SIG_LONGPRESSED[] = "longpressed";
242 static const char SIG_CLICKED[] = "clicked";
243 static const char SIG_CLICKED_DOUBLE[] = "clicked,double";
244 static const char SIG_FOCUSED[] = "focused";
245 static const char SIG_UNFOCUSED[] = "unfocused";
246 static const char SIG_SELECTION_PASTE[] = "selection,paste";
247 static const char SIG_SELECTION_COPY[] = "selection,copy";
248 static const char SIG_SELECTION_CUT[] = "selection,cut";
249 static const char SIG_SELECTION_START[] = "selection,start";
250 static const char SIG_SELECTION_CHANGED[] = "selection,changed";
251 static const char SIG_SELECTION_CLEARED[] = "selection,cleared";
252 static const char SIG_CURSOR_CHANGED[] = "cursor,changed";
253 static const char SIG_ANCHOR_CLICKED[] = "anchor,clicked";
254 static const char SIG_MATCHLIST_CLICKED[] = "matchlist,clicked";
255 static const Evas_Smart_Cb_Description _signals[] = {
259 {SIG_LONGPRESSED, ""},
261 {SIG_CLICKED_DOUBLE, ""},
264 {SIG_SELECTION_PASTE, ""},
265 {SIG_SELECTION_COPY, ""},
266 {SIG_SELECTION_CUT, ""},
267 {SIG_SELECTION_START, ""},
268 {SIG_SELECTION_CHANGED, ""},
269 {SIG_SELECTION_CLEARED, ""},
270 {SIG_CURSOR_CHANGED, ""},
271 {SIG_ANCHOR_CLICKED, ""},
272 {SIG_MATCHLIST_CLICKED, ""},
276 typedef enum _Elm_Entry_Magnifier_Type
278 _ENTRY_MAGNIFIER_FIXEDSIZE = 0,
279 _ENTRY_MAGNIFIER_FILLWIDTH,
280 _ENTRY_MAGNIFIER_CIRCULAR,
281 } Elm_Entry_Magnifier_Type;
284 static Eina_List *entries = NULL;
288 void (*obj_hook) (Evas_Object *obj);
289 void (*obj_unhook) (Evas_Object *obj);
290 void (*obj_longpress) (Evas_Object *obj);
291 void (*obj_hidemenu) (Evas_Object *obj);
292 void (*obj_mouseup) (Evas_Object *obj);
296 _module(Evas_Object *obj __UNUSED__)
298 static Elm_Module *m = NULL;
299 if (m) goto ok; // already found - just use
300 if (!(m = _elm_module_find_as("entry/api"))) return NULL;
302 m->api = malloc(sizeof(Mod_Api));
303 if (!m->api) return NULL;
304 ((Mod_Api *)(m->api) )->obj_hook = // called on creation
305 _elm_module_symbol_get(m, "obj_hook");
306 ((Mod_Api *)(m->api) )->obj_unhook = // called on deletion
307 _elm_module_symbol_get(m, "obj_unhook");
308 ((Mod_Api *)(m->api) )->obj_longpress = // called on long press menu
309 _elm_module_symbol_get(m, "obj_longpress");
310 ((Mod_Api *)(m->api) )->obj_hidemenu = // called on hide menu
311 _elm_module_symbol_get(m, "obj_hidemenu");
312 ((Mod_Api *)(m->api) )->obj_mouseup = // called on mouseup
313 _elm_module_symbol_get(m, "obj_mouseup");
314 ok: // ok - return api
319 _buf_append(char *buf, const char *str, int *len, int *alloc)
321 int len2 = strlen(str);
322 if ((*len + len2) >= *alloc)
324 char *buf2 = realloc(buf, *alloc + len2 + 512);
325 if (!buf2) return NULL;
327 *alloc += (512 + len2);
329 strcpy(buf + *len, str);
335 _load_file(const char *file)
339 int alloc = 0, len = 0;
340 char *text = NULL, buf[16384 + 1];
342 f = fopen(file, "rb");
344 while ((size = fread(buf, 1, sizeof(buf) - 1, f)))
348 tmp_text = _buf_append(text, buf, &len, &alloc);
349 if (!tmp_text) break;
357 _load_plain(const char *file)
361 text = _load_file(file);
366 text2 = elm_entry_utf8_to_markup(text);
374 _load(Evas_Object *obj)
376 Widget_Data *wd = elm_widget_data_get(obj);
381 elm_entry_entry_set(obj, "");
386 case ELM_TEXT_FORMAT_PLAIN_UTF8:
387 text = _load_plain(wd->file);
389 case ELM_TEXT_FORMAT_MARKUP_UTF8:
390 text = _load_file(wd->file);
398 elm_entry_entry_set(obj, text);
402 elm_entry_entry_set(obj, "");
406 _save_markup_utf8(const char *file, const char *text)
410 if ((!text) || (!text[0]))
412 ecore_file_unlink(file);
415 f = fopen(file, "wb");
418 // FIXME: report a write error
421 fputs(text, f); // FIXME: catch error
426 _save_plain_utf8(const char *file, const char *text)
430 text2 = elm_entry_markup_to_utf8(text);
433 _save_markup_utf8(file, text2);
438 _save(Evas_Object *obj)
440 Widget_Data *wd = elm_widget_data_get(obj);
442 if (!wd->file) return;
445 case ELM_TEXT_FORMAT_PLAIN_UTF8:
446 _save_plain_utf8(wd->file, elm_entry_entry_get(obj));
448 case ELM_TEXT_FORMAT_MARKUP_UTF8:
449 _save_markup_utf8(wd->file, elm_entry_entry_get(obj));
457 _delay_write(void *data)
459 Widget_Data *wd = elm_widget_data_get(data);
460 if (!wd) return ECORE_CALLBACK_CANCEL;
462 wd->delay_write = NULL;
463 return ECORE_CALLBACK_CANCEL;
466 static Elm_Entry_Text_Filter *
467 _filter_new(void (*func) (void *data, Evas_Object *entry, char **text), void *data)
469 Elm_Entry_Text_Filter *tf = ELM_NEW(Elm_Entry_Text_Filter);
470 if (!tf) return NULL;
473 if (func == elm_entry_filter_limit_size)
475 Elm_Entry_Filter_Limit_Size *lim = data, *lim2;
482 lim2 = malloc(sizeof(Elm_Entry_Filter_Limit_Size));
488 memcpy(lim2, lim, sizeof(Elm_Entry_Filter_Limit_Size));
491 else if (func == elm_entry_filter_accept_set)
493 Elm_Entry_Filter_Accept_Set *as = data, *as2;
500 as2 = malloc(sizeof(Elm_Entry_Filter_Accept_Set));
507 as2->accepted = eina_stringshare_add(as->accepted);
509 as2->accepted = NULL;
511 as2->rejected = eina_stringshare_add(as->rejected);
513 as2->rejected = NULL;
522 _filter_free(Elm_Entry_Text_Filter *tf)
524 if (tf->func == elm_entry_filter_limit_size)
526 Elm_Entry_Filter_Limit_Size *lim = tf->data;
529 else if (tf->func == elm_entry_filter_accept_set)
531 Elm_Entry_Filter_Accept_Set *as = tf->data;
534 if (as->accepted) eina_stringshare_del(as->accepted);
535 if (as->rejected) eina_stringshare_del(as->rejected);
543 _del_pre_hook(Evas_Object *obj)
545 Widget_Data *wd = elm_widget_data_get(obj);
549 ecore_timer_del(wd->delay_write);
550 wd->delay_write = NULL;
551 if (wd->autosave) _save(obj);
556 _del_hook(Evas_Object *obj)
558 Widget_Data *wd = elm_widget_data_get(obj);
559 Elm_Entry_Context_Menu_Item *it;
560 Elm_Entry_Item_Provider *ip;
561 Elm_Entry_Text_Filter *tf;
563 if (wd->file) eina_stringshare_del(wd->file);
565 if (wd->hovdeljob) ecore_job_del(wd->hovdeljob);
566 if ((wd->api) && (wd->api->obj_unhook)) wd->api->obj_unhook(obj); // module - unhook
568 entries = eina_list_remove(entries, obj);
569 #ifdef HAVE_ELEMENTARY_X
570 ecore_event_handler_del(wd->sel_notify_handler);
571 ecore_event_handler_del(wd->sel_clear_handler);
573 if (wd->cut_sel) eina_stringshare_del(wd->cut_sel);
574 if (wd->text) eina_stringshare_del(wd->text);
575 if (wd->bg) evas_object_del(wd->bg);
576 if (wd->deferred_recalc_job) ecore_job_del(wd->deferred_recalc_job);
577 if (wd->matchlist_job) ecore_job_del(wd->matchlist_job);
578 if (wd->longpress_timer) ecore_timer_del(wd->longpress_timer);
579 if (wd->mgf_proxy) evas_object_del(wd->mgf_proxy);
580 if (wd->mgf_bg) evas_object_del(wd->mgf_bg);
581 if (wd->mgf_clip) evas_object_del(wd->mgf_clip);
583 EINA_LIST_FREE(wd->items, it)
585 eina_stringshare_del(it->label);
586 eina_stringshare_del(it->icon_file);
587 eina_stringshare_del(it->icon_group);
590 EINA_LIST_FREE(wd->item_providers, ip)
594 EINA_LIST_FREE(wd->text_filters, tf)
602 _mirrored_set(Evas_Object *obj, Eina_Bool rtl)
604 Widget_Data *wd = elm_widget_data_get(obj);
605 edje_object_mirrored_set(wd->ent, rtl);
609 _theme_hook(Evas_Object *obj)
611 Widget_Data *wd = elm_widget_data_get(obj);
613 Ecore_IMF_Context *ic;
614 _elm_widget_mirrored_reload(obj);
615 _mirrored_set(obj, elm_widget_mirrored_get(obj));
617 t = eina_stringshare_add(elm_entry_entry_get(obj));
618 _elm_theme_object_set(obj, wd->ent, "entry", _getbase(obj), elm_widget_style_get(obj));
619 if (_elm_config->desktop_entry)
620 edje_object_part_text_select_allow_set(wd->ent, "elm.text", EINA_TRUE);
621 elm_entry_entry_set(obj, t);
622 eina_stringshare_del(t);
623 if (elm_widget_disabled_get(obj))
624 edje_object_signal_emit(wd->ent, "elm,state,disabled", "elm");
625 edje_object_part_text_input_panel_enabled_set(wd->ent, "elm.text", wd->input_panel_enable);
626 elm_entry_cursor_pos_set(obj, wd->cursor_pos);
627 if (elm_widget_focus_get(obj))
628 edje_object_signal_emit(wd->ent, "elm,action,focus", "elm");
629 edje_object_message_signal_process(wd->ent);
630 edje_object_scale_set(wd->ent, elm_widget_scale_get(obj) * _elm_config->scale);
634 edje_object_part_text_autoperiod_set(wd->ent, "elm.text", EINA_FALSE);
635 edje_object_part_text_autocapitalization_set(wd->ent, "elm.text", EINA_FALSE);
639 edje_object_part_text_autoperiod_set(wd->ent, "elm.text", wd->autoperiod);
640 edje_object_part_text_autocapitalization_set(wd->ent, "elm.text", wd->autocapital);
643 ic = edje_object_part_text_imf_context_get(wd->ent, "elm.text");
646 ecore_imf_context_input_panel_layout_set(ic, (Ecore_IMF_Input_Panel_Layout)wd->input_panel_layout);
653 _disable_hook(Evas_Object *obj)
655 Widget_Data *wd = elm_widget_data_get(obj);
657 if (elm_widget_disabled_get(obj))
659 edje_object_signal_emit(wd->ent, "elm,state,disabled", "elm");
660 wd->disabled = EINA_TRUE;
664 edje_object_signal_emit(wd->ent, "elm,state,enabled", "elm");
665 wd->disabled = EINA_FALSE;
670 _elm_win_recalc_job(void *data)
672 Widget_Data *wd = elm_widget_data_get(data);
673 Evas_Coord minh = -1, resw = -1;
675 wd->deferred_recalc_job = NULL;
676 evas_object_geometry_get(wd->ent, NULL, NULL, &resw, NULL);
677 edje_object_size_min_restricted_calc(wd->ent, NULL, &minh, resw, 0);
678 elm_coords_finger_size_adjust(1, NULL, 1, &minh);
679 evas_object_size_hint_min_set(data, -1, minh);
681 evas_object_size_hint_max_set(data, -1, minh);
683 if (wd->deferred_cur)
684 elm_widget_show_region_set(data, wd->cx, wd->cy, wd->cw, wd->ch, EINA_FALSE);
688 _sizing_eval(Evas_Object *obj)
690 Widget_Data *wd = elm_widget_data_get(obj);
691 Evas_Coord minw = -1, minh = -1;
692 Evas_Coord resw, resh;
694 if ((wd->linewrap) || (wd->char_linewrap))
696 evas_object_geometry_get(wd->ent, NULL, NULL, &resw, &resh);
697 if ((resw == wd->lastw) && (!wd->changed)) return;
698 wd->changed = EINA_FALSE;
700 if (wd->deferred_recalc_job) ecore_job_del(wd->deferred_recalc_job);
701 wd->deferred_recalc_job = ecore_job_add(_elm_win_recalc_job, obj);
705 evas_object_geometry_get(wd->ent, NULL, NULL, &resw, &resh);
706 edje_object_size_min_calc(wd->ent, &minw, &minh);
707 elm_coords_finger_size_adjust(1, &minw, 1, &minh);
708 evas_object_size_hint_min_set(obj, minw, minh);
710 evas_object_size_hint_max_set(obj, -1, minh);
715 _check_enable_returnkey(Evas_Object *obj)
717 Widget_Data *wd = elm_widget_data_get(obj);
720 Ecore_IMF_Context *ic = elm_entry_imf_context_get(obj);
723 if (!wd->autoreturnkey) return;
725 if (_entry_length_get(obj) == 0)
727 ecore_imf_context_input_panel_key_disabled_set(ic, ECORE_IMF_INPUT_PANEL_LAYOUT_NORMAL, ECORE_IMF_INPUT_PANEL_KEY_ENTER, EINA_TRUE);
731 ecore_imf_context_input_panel_key_disabled_set(ic, ECORE_IMF_INPUT_PANEL_LAYOUT_NORMAL, ECORE_IMF_INPUT_PANEL_KEY_ENTER, EINA_FALSE);
736 _on_focus_hook(void *data __UNUSED__, Evas_Object *obj)
738 Widget_Data *wd = elm_widget_data_get(obj);
739 Evas_Object *top = elm_widget_top_get(obj);
741 if (!wd->editable) return;
742 if (elm_widget_focus_get(obj))
744 printf("[Elm_entry::Focused] obj : %p\n", obj);
745 evas_object_focus_set(wd->ent, EINA_TRUE);
746 edje_object_signal_emit(wd->ent, "elm,action,focus", "elm");
747 if (top) elm_win_keyboard_mode_set(top, ELM_WIN_KEYBOARD_ON);
748 evas_object_smart_callback_call(obj, SIG_FOCUSED, NULL);
749 _check_enable_returnkey(obj);
750 wd->mgf_type = _ENTRY_MAGNIFIER_FILLWIDTH;
751 _magnifier_create(obj);
755 printf("[Elm_entry::Unfocused] obj : %p\n", obj);
756 edje_object_signal_emit(wd->ent, "elm,action,unfocus", "elm");
757 evas_object_focus_set(wd->ent, EINA_FALSE);
758 if (top) elm_win_keyboard_mode_set(top, ELM_WIN_KEYBOARD_OFF);
759 evas_object_smart_callback_call(obj, SIG_UNFOCUSED, NULL);
761 if ((wd->api) && (wd->api->obj_hidemenu))
763 wd->api->obj_hidemenu(obj);
769 _signal_emit_hook(Evas_Object *obj, const char *emission, const char *source)
771 Widget_Data *wd = elm_widget_data_get(obj);
773 edje_object_signal_emit(wd->ent, emission, source);
777 _signal_callback_add_hook(Evas_Object *obj, const char *emission, const char *source, Edje_Signal_Cb func_cb, void *data)
779 Widget_Data *wd = elm_widget_data_get(obj);
781 edje_object_signal_callback_add(wd->ent, emission, source, func_cb, data);
785 _signal_callback_del_hook(Evas_Object *obj, const char *emission, const char *source, Edje_Signal_Cb func_cb, void *data)
787 Widget_Data *wd = elm_widget_data_get(obj);
788 edje_object_signal_callback_del_full(wd->ent, emission, source, func_cb,
793 _on_focus_region_hook(const Evas_Object *obj, Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *h)
795 Widget_Data *wd = elm_widget_data_get(obj);
796 edje_object_part_text_cursor_geometry_get(wd->ent, "elm.text", x, y, w, h);
800 _hoversel_position(Evas_Object *obj)
802 Widget_Data *wd = elm_widget_data_get(obj);
803 Evas_Coord cx, cy, cw, ch, x, y, mw, mh;
808 evas_object_geometry_get(wd->ent, &x, &y, NULL, NULL);
817 edje_object_part_text_cursor_geometry_get(wd->ent, "elm.text",
819 evas_object_size_hint_min_get(wd->hoversel, &mw, &mh);
830 evas_object_move(wd->hoversel, x + cx, y + cy);
831 evas_object_resize(wd->hoversel, cw, ch);
835 _move(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
837 Widget_Data *wd = elm_widget_data_get(data);
839 if (wd->hoversel) _hoversel_position(data);
843 _resize(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
845 Widget_Data *wd = elm_widget_data_get(data);
847 if ((wd->linewrap) || (wd->char_linewrap))
851 if (wd->hoversel) _hoversel_position(data);
852 // Evas_Coord ww, hh;
853 // evas_object_geometry_get(wd->ent, NULL, NULL, &ww, &hh);
857 _hover_del(void *data)
859 Widget_Data *wd = elm_widget_data_get(data);
864 evas_object_del(wd->hoversel);
867 wd->hovdeljob = NULL;
871 _dismissed(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
873 Widget_Data *wd = elm_widget_data_get(data);
876 if (wd->hoversel) evas_object_hide(wd->hoversel);
879 if (!_elm_config->desktop_entry)
882 edje_object_part_text_select_allow_set(wd->ent, "elm.text", EINA_TRUE);
885 elm_widget_scroll_freeze_pop(data);
886 if (wd->hovdeljob) ecore_job_del(wd->hovdeljob);
887 wd->hovdeljob = ecore_job_add(_hover_del, data);
891 _selectall(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
893 Widget_Data *wd = elm_widget_data_get(data);
895 wd->selmode = EINA_TRUE;
896 edje_object_part_text_select_none(wd->ent, "elm.text");
897 edje_object_signal_emit(wd->ent, "elm,state,select,on", "elm");
898 edje_object_part_text_select_all(wd->ent, "elm.text");
899 elm_object_scroll_freeze_pop(data);
903 _select(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
905 Widget_Data *wd = elm_widget_data_get(data);
907 wd->selmode = EINA_TRUE;
908 edje_object_part_text_select_none(wd->ent, "elm.text");
909 if (!_elm_config->desktop_entry)
912 edje_object_part_text_select_allow_set(wd->ent, "elm.text", EINA_TRUE);
914 edje_object_signal_emit(wd->ent, "elm,state,select,on", "elm");
915 if (!_elm_config->desktop_entry)
916 elm_object_scroll_freeze_pop(data);
917 //elm_widget_scroll_hold_push(data);
921 _paste(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
923 Widget_Data *wd = elm_widget_data_get(data);
925 evas_object_smart_callback_call(data, SIG_SELECTION_PASTE, NULL);
926 if (wd->sel_notify_handler)
928 #ifdef HAVE_ELEMENTARY_X
929 Elm_Sel_Format formats;
930 wd->selection_asked = EINA_TRUE;
931 formats = ELM_SEL_FORMAT_MARKUP;
933 formats |= ELM_SEL_FORMAT_IMAGE;
934 elm_selection_get(ELM_SEL_CLIPBOARD, formats, data, NULL, NULL);
940 _store_selection(Elm_Sel_Type seltype, Evas_Object *obj)
942 Widget_Data *wd = elm_widget_data_get(obj);
946 sel = edje_object_part_text_selection_get(wd->ent, "elm.text");
947 elm_selection_set(seltype, obj, ELM_SEL_FORMAT_MARKUP, sel);
948 if (seltype == ELM_SEL_CLIPBOARD)
949 eina_stringshare_replace(&wd->cut_sel, sel);
953 _cut(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
955 Widget_Data *wd = elm_widget_data_get(data);
958 wd->selmode = EINA_FALSE;
959 if (!_elm_config->desktop_entry)
960 edje_object_part_text_select_allow_set(wd->ent, "elm.text", EINA_FALSE);
961 edje_object_signal_emit(wd->ent, "elm,state,select,off", "elm");
962 if (!_elm_config->desktop_entry)
963 elm_widget_scroll_hold_pop(data);
964 _store_selection(ELM_SEL_CLIPBOARD, data);
965 edje_object_part_text_insert(wd->ent, "elm.text", "");
966 edje_object_part_text_select_none(wd->ent, "elm.text");
970 _copy(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
972 Widget_Data *wd = elm_widget_data_get(data);
974 //wd->selmode = EINA_FALSE;
975 if (!_elm_config->desktop_entry)
977 //edje_object_part_text_select_allow_set(wd->ent, "elm.text", EINA_FALSE);
978 //edje_object_signal_emit(wd->ent, "elm,state,select,off", "elm");
979 elm_widget_scroll_hold_pop(data);
981 _store_selection(ELM_SEL_CLIPBOARD, data);
982 // edje_object_part_text_select_none(wd->ent, "elm.text");
986 _cancel(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
988 Widget_Data *wd = elm_widget_data_get(data);
990 wd->selmode = EINA_FALSE;
991 if (!_elm_config->desktop_entry)
992 edje_object_part_text_select_allow_set(wd->ent, "elm.text", EINA_FALSE);
993 edje_object_signal_emit(wd->ent, "elm,state,select,off", "elm");
994 if (!_elm_config->desktop_entry)
995 elm_widget_scroll_hold_pop(data);
996 edje_object_part_text_select_none(wd->ent, "elm.text");
1000 _clipboard_menu(void *data, Evas_Object *obj, void *event_info __UNUSED__)
1002 Widget_Data *wd = elm_widget_data_get(data);
1006 #ifdef HAVE_ELEMENTARY_X
1007 ecore_x_selection_secondary_set(elm_win_xwindow_get(obj), "",1);
1009 cnpwidgetdata = data;
1010 elm_cbhm_helper_init(obj);
1011 if (elm_entry_cnp_textonly_get(obj))
1012 elm_cbhm_send_raw_data("show0");
1014 elm_cbhm_send_raw_data("show1");
1020 _cnpinit(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
1022 Widget_Data *wd = elm_widget_data_get(data);
1024 cnpwidgetdata = data;
1030 _item_clicked(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
1032 Elm_Entry_Context_Menu_Item *it = data;
1033 Evas_Object *obj2 = it->obj;
1034 if (it->func) it->func(it->data, obj2, NULL);
1038 _menu_press(Evas_Object *obj)
1040 Widget_Data *wd = elm_widget_data_get(obj);
1043 const Elm_Entry_Context_Menu_Item *it;
1045 if ((wd->api) && (wd->api->obj_longpress))
1047 wd->api->obj_longpress(obj);
1049 else if (wd->context_menu)
1051 const char *context_menu_orientation;
1053 if (wd->hoversel) evas_object_del(wd->hoversel);
1054 else elm_widget_scroll_freeze_push(obj);
1055 wd->hoversel = elm_hoversel_add(obj);
1056 context_menu_orientation = edje_object_data_get
1057 (wd->ent, "context_menu_orientation");
1058 if ((context_menu_orientation) &&
1059 (!strcmp(context_menu_orientation, "horizontal")))
1060 elm_hoversel_horizontal_set(wd->hoversel, EINA_TRUE);
1061 elm_object_style_set(wd->hoversel, "entry");
1062 elm_widget_sub_object_add(obj, wd->hoversel);
1063 elm_hoversel_label_set(wd->hoversel, "Text");
1064 top = elm_widget_top_get(obj);
1065 if (top) elm_hoversel_hover_parent_set(wd->hoversel, top);
1066 evas_object_smart_callback_add(wd->hoversel, "dismissed", _dismissed, obj);
1070 elm_hoversel_item_add(wd->hoversel, E_("Select"), NULL, ELM_ICON_NONE,
1072 if (1) // need way to detect if someone has a selection
1075 elm_hoversel_item_add(wd->hoversel, E_("Paste"), NULL, ELM_ICON_NONE,
1079 if ((!wd->password) && (wd->editable))
1080 elm_hoversel_item_add(wd->hoversel, E_("More"), NULL, ELM_ICON_NONE,
1081 _clipboard_menu, obj);
1088 if (wd->have_selection)
1090 elm_hoversel_item_add(wd->hoversel, E_("Copy"), NULL, ELM_ICON_NONE,
1093 elm_hoversel_item_add(wd->hoversel, E_("Cut"), NULL, ELM_ICON_NONE,
1096 elm_hoversel_item_add(wd->hoversel, E_("Cancel"), NULL, ELM_ICON_NONE,
1100 elm_hoversel_item_add(wd->hoversel, E_("More"), NULL, ELM_ICON_NONE,
1101 _clipboard_menu, obj);
1105 EINA_LIST_FOREACH(wd->items, l, it)
1107 elm_hoversel_item_add(wd->hoversel, it->label, it->icon_file,
1108 it->icon_type, _item_clicked, it);
1112 _hoversel_position(obj);
1113 evas_object_show(wd->hoversel);
1114 elm_hoversel_hover_begin(wd->hoversel);
1116 if (!_elm_config->desktop_entry)
1118 edje_object_part_text_select_allow_set(wd->ent, "elm.text", EINA_FALSE);
1119 edje_object_part_text_select_abort(wd->ent, "elm.text");
1123 evas_object_smart_callback_call(obj, SIG_LONGPRESSED, NULL);
1127 _magnifier_hide(void *data)
1129 Widget_Data *wd = elm_widget_data_get(data);
1132 evas_object_hide(wd->mgf_bg);
1133 evas_object_hide(wd->mgf_clip);
1137 _magnifier_show(void *data)
1139 Widget_Data *wd = elm_widget_data_get(data);
1142 evas_object_show(wd->mgf_bg);
1143 evas_object_show(wd->mgf_clip);
1147 _magnifier_move(void *data)
1149 Widget_Data *wd = elm_widget_data_get(data);
1152 Evas_Coord x, y, w, h, fs;
1153 Evas_Coord cx, cy, cw, ch, ox, oy;
1155 evas_object_geometry_get(data, &x, &y, &w, &h);
1156 edje_object_part_text_cursor_geometry_get(wd->ent, "elm.text", &cx, &cy, &cw, &ch);
1159 fs = elm_finger_size_get();
1161 if ((cy + y) - wd->mgf_height - fs < 0)
1162 oy = -1 * ((cy + y) - wd->mgf_height - fs);
1164 if (wd->mgf_type == _ENTRY_MAGNIFIER_FIXEDSIZE)
1165 evas_object_move(wd->mgf_bg, (cx + x + cw/2) + ox, (cy + y) - wd->mgf_height - fs + oy);
1166 else if (wd->mgf_type == _ENTRY_MAGNIFIER_FILLWIDTH)
1167 evas_object_move(wd->mgf_bg, x, (cy + y) - wd->mgf_height - fs + oy);
1171 evas_object_move(wd->mgf_proxy, (1 - wd->mgf_scale) * cx + x + ox, (1 - wd->mgf_scale) * cy + y - wd->mgf_height/2 - ch/2 - fs + oy);
1175 _magnifier_create(void *data)
1177 Widget_Data *wd = elm_widget_data_get(data);
1178 Evas_Coord x, y, w, h;
1179 const char* key_data = NULL;
1185 evas_object_image_source_unset(wd->mgf_proxy);
1186 evas_object_color_set(wd->mgf_proxy, 255, 255, 255, 0);
1187 evas_object_hide(wd->mgf_proxy);
1188 evas_object_clip_unset(wd->mgf_proxy);
1189 evas_object_del(wd->mgf_proxy);
1191 if (wd->mgf_bg) evas_object_del(wd->mgf_bg);
1192 if (wd->mgf_clip) evas_object_del(wd->mgf_clip);
1194 evas_object_geometry_get(data, &x, &y, &w, &h);
1195 wd->mgf_bg = edje_object_add(evas_object_evas_get(data));
1197 if (wd->mgf_type == _ENTRY_MAGNIFIER_FIXEDSIZE)
1198 _elm_theme_object_set(data, wd->mgf_bg, "entry", "magnifier", "fixed-size");
1199 else if (wd->mgf_type == _ENTRY_MAGNIFIER_FILLWIDTH)
1200 _elm_theme_object_set(data, wd->mgf_bg, "entry", "magnifier", "fill-width");
1204 wd->mgf_clip = evas_object_rectangle_add(evas_object_evas_get(data));
1205 evas_object_color_set(wd->mgf_clip, 255, 255, 255, 255);
1206 edje_object_part_swallow(wd->mgf_bg, "swallow", wd->mgf_clip);
1208 key_data = edje_object_data_get(wd->mgf_bg, "height");
1209 if (key_data) wd->mgf_height = atoi(key_data);
1210 key_data = edje_object_data_get(wd->mgf_bg, "scale");
1211 if (key_data) wd->mgf_scale = atof(key_data);
1213 if (wd->mgf_type == _ENTRY_MAGNIFIER_FILLWIDTH)
1214 evas_object_resize(wd->mgf_bg, w, wd->mgf_height);
1216 wd->mgf_proxy = evas_object_image_add(evas_object_evas_get(data));
1217 evas_object_image_source_set(wd->mgf_proxy, data);
1218 evas_object_resize(wd->mgf_proxy, w * wd->mgf_scale, h * wd->mgf_scale);
1219 evas_object_image_fill_set(wd->mgf_proxy, 0, 0, w * wd->mgf_scale, h * wd->mgf_scale);
1220 evas_object_color_set(wd->mgf_proxy, 255, 255, 255, 255);
1221 evas_object_pass_events_set(wd->mgf_proxy, EINA_TRUE);
1222 evas_object_show(wd->mgf_proxy);
1223 evas_object_clip_set(wd->mgf_proxy, wd->mgf_clip);
1225 evas_object_layer_set(wd->mgf_bg, EVAS_LAYER_MAX);
1226 evas_object_layer_set(wd->mgf_proxy, EVAS_LAYER_MAX);
1230 _long_press(void *data)
1232 Widget_Data *wd = elm_widget_data_get(data);
1233 if (!wd) return ECORE_CALLBACK_CANCEL;
1235 wd->long_pressed = EINA_TRUE;
1237 if (wd->longpress_timer)
1239 ecore_timer_del(wd->longpress_timer);
1240 wd->longpress_timer = NULL;
1243 _cancel(data, NULL, NULL);
1245 _magnifier_create(data);
1246 _magnifier_move(data);
1247 _magnifier_show(data);
1248 elm_object_scroll_freeze_push(data);
1250 wd->longpress_timer = NULL;
1251 evas_object_smart_callback_call(data, SIG_LONGPRESSED, NULL);
1252 return ECORE_CALLBACK_CANCEL;
1256 _mouse_down(void *data, Evas *evas __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
1258 Widget_Data *wd = elm_widget_data_get(data);
1259 Evas_Event_Mouse_Down *ev = event_info;
1261 if (wd->disabled) return;
1262 if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return;
1263 if (ev->button != 1) return;
1264 // if (ev->flags & EVAS_BUTTON_DOUBLE_CLICK)
1265 if (wd->longpress_timer) ecore_timer_del(wd->longpress_timer);
1266 wd->longpress_timer = ecore_timer_add(_elm_config->longpress_timeout, _long_press, data);
1267 wd->downx = ev->canvas.x;
1268 wd->downy = ev->canvas.y;
1270 wd->long_pressed = EINA_FALSE;
1274 _mouse_up(void *data, Evas *evas __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
1276 Widget_Data *wd = elm_widget_data_get(data);
1277 Evas_Event_Mouse_Up *ev = event_info;
1279 if (wd->disabled) return;
1280 if (ev->button != 1) return;
1282 if (!wd->double_clicked)
1284 if ((wd->api) && (wd->api->obj_mouseup))
1286 wd->api->obj_mouseup(data);
1289 if (wd->longpress_timer)
1291 ecore_timer_del(wd->longpress_timer);
1292 wd->longpress_timer = NULL;
1295 _magnifier_hide(data);
1296 elm_object_scroll_freeze_pop(data);
1298 if (wd->long_pressed)
1305 _mouse_move(void *data, Evas *evas __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
1307 Widget_Data *wd = elm_widget_data_get(data);
1308 Evas_Event_Mouse_Move *ev = event_info;
1310 if (wd->disabled) return;
1313 if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD)
1315 if (wd->longpress_timer)
1317 ecore_timer_del(wd->longpress_timer);
1318 wd->longpress_timer = NULL;
1321 else if (wd->longpress_timer)
1325 dx = wd->downx - ev->cur.canvas.x;
1327 dy = wd->downy - ev->cur.canvas.y;
1330 ((_elm_config->finger_size / 2) *
1331 (_elm_config->finger_size / 2)))
1333 ecore_timer_del(wd->longpress_timer);
1334 wd->longpress_timer = NULL;
1338 else if (wd->longpress_timer)
1342 dx = wd->downx - ev->cur.canvas.x;
1344 dy = wd->downy - ev->cur.canvas.y;
1347 ((_elm_config->finger_size / 2) *
1348 (_elm_config->finger_size / 2)))
1350 ecore_timer_del(wd->longpress_timer);
1351 wd->longpress_timer = NULL;
1355 if (ev->buttons != 1) return;
1357 if (wd->long_pressed)
1359 _magnifier_show(data);
1360 _magnifier_move(data);
1365 _getbase(Evas_Object *obj)
1367 Widget_Data *wd = elm_widget_data_get(obj);
1368 if (!wd) return "base";
1371 if (wd->password) return "base-password";
1374 if (wd->single_line) return "base-single";
1377 if (wd->linewrap) return "base";
1378 else if (wd->char_linewrap) return "base-charwrap";
1379 else return "base-nowrap";
1385 if (wd->password) return "base-password";
1388 if (wd->single_line) return "base-single-noedit";
1391 if (wd->linewrap) return "base-noedit";
1392 else if (wd->char_linewrap) return "base-noedit-charwrap";
1393 else return "base-nowrap-noedit";
1401 _entry_length_get(Evas_Object *obj)
1404 const char *str = elm_entry_entry_get(obj);
1407 char *plain_str = _elm_util_mkup_to_text(str);
1408 if (!plain_str) return 0;
1410 len = strlen(plain_str);
1417 _matchlist_show(void *data)
1419 Widget_Data *wd = elm_widget_data_get(data);
1420 const char *text = NULL;
1422 char *str_list = NULL, *str_result = NULL;
1423 char *str_mkup = NULL, *str_front = NULL, *str_mid = NULL;
1426 Eina_Bool textfound = EINA_FALSE;
1429 if (elm_widget_disabled_get(data)) return;
1431 wd->matchlist_job = NULL;
1433 if (wd->matchlist_list_clicked)
1435 evas_object_hide(wd->hover);
1436 wd->matchlist_list_clicked = EINA_FALSE;
1439 text = elm_entry_entry_get(data);
1442 textlen = strlen(text);
1444 if (textlen < wd->matchlist_threshold)
1446 evas_object_hide(wd->hover);
1450 evas_object_hide(wd->hover);
1454 elm_list_clear(wd->list);
1455 EINA_LIST_FOREACH(wd->match_list, l, str_list)
1457 if (wd->matchlist_case_sensitive)
1458 str_result = strstr(str_list, text);
1460 str_result = strcasestr(str_list, text);
1464 str_mkup = malloc(strlen(str_list) + 16);
1466 textlen = strlen(str_list) - strlen(str_result);
1467 str_front = malloc(textlen + 1);
1468 memset(str_front, 0, textlen + 1);
1469 strncpy(str_front, str_list, textlen);
1471 textlen = strlen(text);
1472 str_mid = malloc(textlen + 1);
1473 memset(str_mid, 0, textlen + 1);
1474 strncpy(str_mid, str_list + strlen(str_front), textlen);
1476 sprintf(str_mkup, "%s<match>%s</match>%s", str_front, str_mid, str_result + strlen(text));
1478 elm_list_item_append(wd->list, str_mkup, NULL, NULL, NULL, NULL);
1480 if (str_mkup) free(str_mkup);
1481 if (str_front) free(str_front);
1482 if (str_mid) free(str_mid);
1484 textfound=EINA_TRUE;
1493 elm_list_go(wd->list);
1494 evas_object_show(wd->hover);
1495 evas_object_raise(wd->hover);
1499 static void _matchlist_list_clicked( void *data, Evas_Object *obj, void *event_info )
1501 Elm_List_Item *it = (Elm_List_Item *) elm_list_selected_item_get(obj);
1502 Widget_Data *wd = elm_widget_data_get(data);
1503 if ((it == NULL) || (wd == NULL))
1506 const char *text = elm_list_item_label_get(it);
1507 evas_object_smart_callback_call((Evas_Object *)data, "selected", (void *)text);
1512 elm_entry_entry_set(data, elm_entry_markup_to_utf8(text));
1513 elm_entry_cursor_end_set(data);
1514 wd->matchlist_list_clicked = EINA_TRUE;
1516 evas_object_smart_callback_call(data, SIG_MATCHLIST_CLICKED, elm_entry_markup_to_utf8(text));
1519 elm_widget_focus_set(data, EINA_TRUE);
1523 elm_entry_matchlist_set(Evas_Object *obj, Eina_List *match_list, Eina_Bool case_sensitive)
1525 Widget_Data *wd = elm_widget_data_get(obj);
1530 Evas_Coord max_w = 9999, max_h = 9999;
1531 const char* key_data = NULL;
1533 wd->matchlist_threshold = 1;
1534 wd->hover = elm_hover_add(elm_widget_parent_get(obj));
1535 elm_hover_parent_set(wd->hover, elm_widget_parent_get(obj));
1536 elm_hover_target_set(wd->hover, obj);
1537 elm_object_style_set(wd->hover, "matchlist");
1539 wd->layout = elm_layout_add(wd->hover);
1540 elm_layout_theme_set(wd->layout, "entry", "matchlist", "default");
1541 wd->list = elm_list_add(wd->layout);
1542 evas_object_size_hint_weight_set(wd->list, EVAS_HINT_EXPAND, 0.0);
1543 evas_object_size_hint_align_set(wd->list, EVAS_HINT_FILL, EVAS_HINT_FILL);
1544 elm_list_mode_set(wd->list, ELM_LIST_EXPAND);
1545 elm_object_style_set(wd->list, "matchlist");
1547 key_data = edje_object_data_get(elm_layout_edje_get(wd->layout), "max_width");
1548 if (key_data) max_w = atoi(key_data);
1549 key_data = edje_object_data_get(elm_layout_edje_get(wd->layout), "max_height");
1550 if (key_data) max_h = atoi(key_data);
1552 elm_list_go(wd->list);
1553 evas_object_size_hint_max_set(wd->list, max_w, max_h);
1554 evas_object_smart_callback_add(wd->list, "selected", _matchlist_list_clicked, obj);
1555 elm_layout_content_set(wd->layout, "elm.swallow.content", wd->list);
1556 elm_hover_content_set(wd->hover, "bottom", wd->layout);
1558 wd->match_list = match_list;
1563 evas_object_del(wd->hover);
1565 wd->match_list = NULL;
1568 wd->matchlist_case_sensitive = case_sensitive;
1573 _signal_entry_changed(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__)
1575 Widget_Data *wd = elm_widget_data_get(data);
1577 wd->changed = EINA_TRUE;
1579 if (wd->text) eina_stringshare_del(wd->text);
1581 _check_enable_returnkey(data);
1582 evas_object_smart_callback_call(data, SIG_CHANGED, NULL);
1583 if (wd->delay_write)
1585 ecore_timer_del(wd->delay_write);
1586 wd->delay_write = NULL;
1589 if ((wd->single_line) && (wd->match_list))
1591 if (wd->matchlist_job) ecore_job_del(wd->matchlist_job);
1592 wd->matchlist_job = ecore_job_add(_matchlist_show, data);
1594 if ((!wd->autosave) || (!wd->file)) return;
1595 wd->delay_write = ecore_timer_add(2.0, _delay_write, data);
1599 _signal_handler_move_start(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__)
1601 Widget_Data *wd = elm_widget_data_get(data);
1602 elm_object_scroll_freeze_push(data);
1604 if ((wd->api) && (wd->api->obj_hidemenu))
1606 wd->api->obj_hidemenu(data);
1609 _magnifier_create(data);
1610 _magnifier_move(data);
1611 _magnifier_show(data);
1615 _signal_handler_move_end(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__)
1617 Widget_Data *wd = elm_widget_data_get(data);
1618 elm_object_scroll_freeze_pop(data);
1620 if (wd->have_selection)
1622 _magnifier_hide(data);
1628 _signal_handler_moving(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__)
1630 _magnifier_move(data);
1631 _magnifier_show(data);
1635 _signal_selection_end(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__)
1637 _magnifier_hide(data);
1642 _signal_selection_start(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__)
1644 Widget_Data *wd = elm_widget_data_get(data);
1648 EINA_LIST_FOREACH(entries, l, entry)
1650 if (entry != data) elm_entry_select_none(entry);
1652 wd->have_selection = EINA_TRUE;
1653 wd->selmode = EINA_TRUE;
1654 evas_object_smart_callback_call(data, SIG_SELECTION_START, NULL);
1655 #ifdef HAVE_ELEMENTARY_X
1656 if (wd->sel_notify_handler)
1658 const char *txt = elm_entry_selection_get(data);
1661 top = elm_widget_top_get(data);
1662 if ((top) && (elm_win_xwindow_get(top)))
1663 elm_selection_set(ELM_SEL_PRIMARY, data, ELM_SEL_FORMAT_MARKUP, txt);
1669 _signal_magnifier_changed(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__)
1671 Evas_Coord cx, cy, cw, ch;
1672 Widget_Data *wd = elm_widget_data_get(data);
1675 edje_object_part_text_cursor_geometry_get(wd->ent, "elm.text", &cx, &cy, &cw, &ch);
1676 if (!wd->deferred_recalc_job)
1677 elm_widget_show_region_set(data, cx, cy, cw, ch, EINA_FALSE);
1680 wd->deferred_cur = EINA_TRUE;
1684 wd->ch = ch + elm_finger_size_get();
1689 _signal_selection_changed(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__)
1691 Evas_Coord cx, cy, cw, ch;
1692 Widget_Data *wd = elm_widget_data_get(data);
1694 wd->have_selection = EINA_TRUE;
1695 wd->selmode = EINA_TRUE;
1696 evas_object_smart_callback_call(data, SIG_SELECTION_CHANGED, NULL);
1697 elm_selection_set(ELM_SEL_PRIMARY, obj, ELM_SEL_FORMAT_MARKUP,
1698 elm_entry_selection_get(data));
1700 edje_object_part_text_cursor_geometry_get(wd->ent, "elm.text", &cx, &cy, &cw, &ch);
1701 if (!wd->deferred_recalc_job)
1702 elm_widget_show_region_set(data, cx, cy, cw, ch + elm_finger_size_get(), EINA_FALSE);
1705 wd->deferred_cur = EINA_TRUE;
1709 wd->ch = ch + elm_finger_size_get();
1714 _signal_selection_cleared(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__)
1716 Widget_Data *wd = elm_widget_data_get(data);
1718 if (!wd->have_selection) return;
1719 wd->have_selection = EINA_FALSE;
1720 wd->selmode = EINA_FALSE;
1721 evas_object_smart_callback_call(data, SIG_SELECTION_CLEARED, NULL);
1722 if (wd->sel_notify_handler)
1726 #ifdef HAVE_ELEMENTARY_X
1729 top = elm_widget_top_get(data);
1730 if ((top) && (elm_win_xwindow_get(top)))
1731 elm_selection_set(ELM_SEL_PRIMARY, data, ELM_SEL_FORMAT_MARKUP,
1734 eina_stringshare_del(wd->cut_sel);
1739 #ifdef HAVE_ELEMENTARY_X
1742 top = elm_widget_top_get(data);
1743 if ((top) && (elm_win_xwindow_get(top)))
1744 elm_selection_clear(ELM_SEL_PRIMARY, data);
1749 if ((wd->api) && (wd->api->obj_hidemenu))
1751 wd->api->obj_hidemenu(data);
1756 _signal_entry_paste_request(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__)
1758 Widget_Data *wd = elm_widget_data_get(data);
1760 evas_object_smart_callback_call(data, SIG_SELECTION_PASTE, NULL);
1761 if (wd->sel_notify_handler)
1763 #ifdef HAVE_ELEMENTARY_X
1766 top = elm_widget_top_get(data);
1767 if ((top) && (elm_win_xwindow_get(top)))
1769 wd->selection_asked = EINA_TRUE;
1770 elm_selection_get(ELM_SEL_CLIPBOARD, ELM_SEL_FORMAT_MARKUP, data,
1778 _signal_entry_copy_notify(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__)
1780 Widget_Data *wd = elm_widget_data_get(data);
1782 evas_object_smart_callback_call(data, SIG_SELECTION_COPY, NULL);
1783 elm_selection_set(ELM_SEL_CLIPBOARD, obj, ELM_SEL_FORMAT_MARKUP,
1784 elm_entry_selection_get(data));
1788 _signal_entry_cut_notify(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__)
1790 Widget_Data *wd = elm_widget_data_get(data);
1792 evas_object_smart_callback_call(data, SIG_SELECTION_CUT, NULL);
1793 elm_selection_set(ELM_SEL_CLIPBOARD, obj, ELM_SEL_FORMAT_MARKUP,
1794 elm_entry_selection_get(data));
1795 edje_object_part_text_insert(wd->ent, "elm.text", "");
1796 wd->changed = EINA_TRUE;
1801 _signal_cursor_changed(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__)
1803 Widget_Data *wd = elm_widget_data_get(data);
1804 Evas_Coord cx, cy, cw, ch;
1806 evas_object_smart_callback_call(data, SIG_CURSOR_CHANGED, NULL);
1807 edje_object_part_text_cursor_geometry_get(wd->ent, "elm.text",
1808 &cx, &cy, &cw, &ch);
1809 wd->cursor_pos = edje_object_part_text_cursor_pos_get(wd->ent, "elm.text", EDJE_CURSOR_MAIN);
1810 if (!wd->deferred_recalc_job)
1811 elm_widget_show_region_set(data, cx, cy, cw, ch, EINA_FALSE);
1814 wd->deferred_cur = EINA_TRUE;
1823 _signal_anchor_down(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__)
1825 Widget_Data *wd = elm_widget_data_get(data);
1830 _signal_anchor_up(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__)
1832 Widget_Data *wd = elm_widget_data_get(data);
1837 _signal_anchor_clicked(void *data, Evas_Object *obj __UNUSED__, const char *emission, const char *source __UNUSED__)
1839 Widget_Data *wd = elm_widget_data_get(data);
1840 Elm_Entry_Anchor_Info ei;
1841 char *buf2, *p, *p2, *n;
1843 p = strrchr(emission, ',');
1846 const Eina_List *geoms;
1850 while (p2 >= emission)
1852 if (*p2 == ',') break;
1856 buf2 = alloca(5 + p - p2);
1857 strncpy(buf2, p2, p - p2);
1860 ei.button = atoi(buf2);
1861 ei.x = ei.y = ei.w = ei.h = 0;
1863 edje_object_part_text_anchor_geometry_get(wd->ent, "elm.text", ei.name);
1866 Evas_Textblock_Rectangle *r;
1868 Evas_Coord px, py, x, y;
1870 evas_object_geometry_get(wd->ent, &x, &y, NULL, NULL);
1871 evas_pointer_output_xy_get(evas_object_evas_get(wd->ent), &px, &py);
1872 EINA_LIST_FOREACH(geoms, l, r)
1874 if (((r->x + x) <= px) && ((r->y + y) <= py) &&
1875 ((r->x + x + r->w) > px) && ((r->y + y + r->h) > py))
1886 evas_object_smart_callback_call(data, SIG_ANCHOR_CLICKED, &ei);
1891 _signal_anchor_move(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__)
1893 Widget_Data *wd = elm_widget_data_get(data);
1898 _signal_anchor_in(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__)
1900 Widget_Data *wd = elm_widget_data_get(data);
1905 _signal_anchor_out(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__)
1907 Widget_Data *wd = elm_widget_data_get(data);
1912 _signal_key_enter(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__)
1914 Widget_Data *wd = elm_widget_data_get(data);
1916 evas_object_smart_callback_call(data, SIG_ACTIVATED, NULL);
1920 _signal_mouse_down(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__)
1922 Widget_Data *wd = elm_widget_data_get(data);
1924 wd->double_clicked = EINA_FALSE;
1925 evas_object_smart_callback_call(data, SIG_PRESS, NULL);
1927 if ((wd->api) && (wd->api->obj_hidemenu))
1929 wd->api->obj_hidemenu(data);
1934 _signal_mouse_clicked(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__)
1936 Widget_Data *wd = elm_widget_data_get(data);
1938 evas_object_smart_callback_call(data, SIG_CLICKED, NULL);
1942 _signal_mouse_double(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__)
1944 Widget_Data *wd = elm_widget_data_get(data);
1946 wd->double_clicked = EINA_TRUE;
1947 evas_object_smart_callback_call(data, SIG_CLICKED_DOUBLE, NULL);
1950 #ifdef HAVE_ELEMENTARY_X
1952 _event_selection_notify(void *data, int type __UNUSED__, void *event)
1954 Widget_Data *wd = elm_widget_data_get(data);
1955 Ecore_X_Event_Selection_Notify *ev = event;
1956 if (!wd) return ECORE_CALLBACK_PASS_ON;
1957 if ((!wd->selection_asked) && (!wd->drag_selection_asked))
1958 return ECORE_CALLBACK_PASS_ON;
1960 if ((ev->selection == ECORE_X_SELECTION_CLIPBOARD) ||
1961 (ev->selection == ECORE_X_SELECTION_PRIMARY))
1963 Ecore_X_Selection_Data_Text *text_data;
1965 text_data = ev->data;
1966 if (text_data->data.content == ECORE_X_SELECTION_CONTENT_TEXT)
1968 if (text_data->text)
1970 char *txt = _elm_util_text_to_mkup(text_data->text);
1974 elm_entry_entry_insert(data, txt);
1979 wd->selection_asked = EINA_FALSE;
1981 else if (ev->selection == ECORE_X_SELECTION_XDND)
1983 Ecore_X_Selection_Data_Text *text_data;
1985 text_data = ev->data;
1986 if (text_data->data.content == ECORE_X_SELECTION_CONTENT_TEXT)
1988 if (text_data->text)
1990 char *txt = _elm_util_text_to_mkup(text_data->text);
1994 /* Massive FIXME: this should be at the drag point */
1995 elm_entry_entry_insert(data, txt);
2000 wd->drag_selection_asked = EINA_FALSE;
2002 ecore_x_dnd_send_finished();
2004 return ECORE_CALLBACK_PASS_ON;
2008 _event_selection_clear(void *data __UNUSED__, int type __UNUSED__, void *event __UNUSED__)
2011 Widget_Data *wd = elm_widget_data_get(data);
2012 Ecore_X_Event_Selection_Clear *ev = event;
2013 if (!wd) return ECORE_CALLBACK_PASS_ON;
2014 if (!wd->have_selection) return ECORE_CALLBACK_PASS_ON;
2015 if ((ev->selection == ECORE_X_SELECTION_CLIPBOARD) ||
2016 (ev->selection == ECORE_X_SELECTION_PRIMARY))
2018 elm_entry_select_none(data);
2023 Evas_Object *top = elm_widget_top_get(data);
2024 Ecore_X_Event_Selection_Clear *ev = event;
2027 return ECORE_CALLBACK_PASS_ON;
2029 if (ev->selection != ECORE_X_SELECTION_SECONDARY)
2031 return ECORE_CALLBACK_PASS_ON;
2034 if (cnpwidgetdata == data)
2036 elm_selection_get(ELM_SEL_SECONDARY,ELM_SEL_FORMAT_MARKUP,data,NULL,NULL);
2040 return ECORE_CALLBACK_PASS_ON;
2045 _drag_drop_cb(void *data __UNUSED__, Evas_Object *obj, Elm_Selection_Data *drop)
2050 wd = elm_widget_data_get(obj);
2052 if (!wd) return EINA_FALSE;
2053 printf("Inserting at (%d,%d) %s\n", drop->x, drop->y, (char*)drop->data);
2055 edje_object_part_text_cursor_copy(wd->ent, "elm.text",
2056 EDJE_CURSOR_MAIN,/*->*/EDJE_CURSOR_USER);
2057 rv = edje_object_part_text_cursor_coord_set(wd->ent,"elm.text",
2058 EDJE_CURSOR_MAIN,drop->x,drop->y);
2059 if (!rv) printf("Warning: Failed to position cursor: paste anyway\n");
2060 elm_entry_entry_insert(obj, drop->data);
2061 edje_object_part_text_cursor_copy(wd->ent, "elm.text",
2062 EDJE_CURSOR_USER,/*->*/EDJE_CURSOR_MAIN);
2068 static Evas_Object *
2069 _get_item(void *data, Evas_Object *edje __UNUSED__, const char *part __UNUSED__, const char *item)
2071 Widget_Data *wd = elm_widget_data_get(data);
2074 Elm_Entry_Item_Provider *ip;
2076 EINA_LIST_FOREACH(wd->item_providers, l, ip)
2078 o = ip->func(ip->data, data, item);
2081 if (!strncmp(item, "file://", 7))
2083 const char *fname = item + 7;
2085 o = evas_object_image_filled_add(evas_object_evas_get(data));
2086 evas_object_image_file_set(o, fname, NULL);
2087 if (evas_object_image_load_error_get(o) == EVAS_LOAD_ERROR_NONE)
2089 evas_object_show(o);
2094 o = edje_object_add(evas_object_evas_get(data));
2095 _elm_theme_object_set(data, o, "entry/emoticon", "wtf", elm_widget_style_get(data));
2099 o = edje_object_add(evas_object_evas_get(data));
2100 if (!_elm_theme_object_set(data, o, "entry", item, elm_widget_style_get(data)))
2101 _elm_theme_object_set(data, o, "entry/emoticon", "wtf", elm_widget_style_get(data));
2106 _strbuf_key_value_replace(Eina_Strbuf *srcbuf, char *key, const char *value, int deleteflag)
2108 const char *srcstring = NULL;
2109 Eina_Strbuf *repbuf = NULL, *diffbuf = NULL;
2110 char *curlocater, *replocater;
2111 char *starttag, *endtag;
2112 int tagtxtlen = 0, insertflag = 0;
2114 srcstring = eina_strbuf_string_get(srcbuf);
2115 curlocater = strstr(srcstring, key);
2117 if (!curlocater || !srcstring)
2125 starttag = strchr(srcstring, '<');
2126 endtag = strchr(srcstring, '>');
2127 tagtxtlen = endtag - starttag;
2128 if (tagtxtlen <= 0) tagtxtlen = 0;
2129 if (starttag < curlocater && curlocater < endtag) break;
2130 if (endtag != NULL && endtag+1 != NULL)
2131 srcstring = endtag+1;
2134 } while (strlen(srcstring) > 1);
2136 if (starttag && endtag && tagtxtlen > strlen(key))
2138 repbuf = eina_strbuf_new();
2139 diffbuf = eina_strbuf_new();
2140 eina_strbuf_append_n(repbuf, starttag, tagtxtlen);
2141 srcstring = eina_strbuf_string_get(repbuf);
2142 curlocater = strstr(srcstring, key);
2144 if (curlocater != NULL)
2146 replocater = curlocater + strlen(key) + 1;
2148 while ((*replocater) && (*replocater != ' ') && (*replocater != '>'))
2151 if (replocater-curlocater > strlen(key)+1)
2153 eina_strbuf_append_n(diffbuf, curlocater, replocater-curlocater+1);
2162 eina_strbuf_reset(repbuf);
2170 if (repbuf == NULL) repbuf = eina_strbuf_new();
2171 if (diffbuf == NULL) diffbuf = eina_strbuf_new();
2175 eina_strbuf_append_printf(repbuf, "<%s=%s>", key, value);
2176 eina_strbuf_prepend(srcbuf, eina_strbuf_string_get(repbuf));
2182 eina_strbuf_prepend(diffbuf, "<");
2183 eina_strbuf_append(diffbuf, ">");
2184 eina_strbuf_replace_first(srcbuf, eina_strbuf_string_get(diffbuf), "");
2188 eina_strbuf_append_printf(repbuf, "%s=%s", key, value);
2189 eina_strbuf_replace_first(srcbuf, eina_strbuf_string_get(diffbuf), eina_strbuf_string_get(repbuf));
2193 if (repbuf) eina_strbuf_free(repbuf);
2194 if (diffbuf) eina_strbuf_free(diffbuf);
2200 _stringshare_key_value_replace(const char **srcstring, char *key, const char *value, int deleteflag)
2202 Eina_Strbuf *sharebuf = NULL;
2204 sharebuf = eina_strbuf_new();
2205 eina_strbuf_append(sharebuf, *srcstring);
2206 _strbuf_key_value_replace(sharebuf, key, value, deleteflag);
2207 eina_stringshare_del(*srcstring);
2208 *srcstring = eina_stringshare_add(eina_strbuf_string_get(sharebuf));
2209 eina_strbuf_free(sharebuf);
2215 _text_filter(void *data, Evas_Object *edje __UNUSED__, const char *part __UNUSED__, Edje_Text_Filter_Type type, char **text)
2217 Widget_Data *wd = elm_widget_data_get(data);
2219 Elm_Entry_Text_Filter *tf;
2221 if (type == EDJE_TEXT_FILTER_FORMAT)
2224 EINA_LIST_FOREACH(wd->text_filters, l, tf)
2226 tf->func(tf->data, data, text);
2233 _add_chars_till_limit(Evas_Object *obj, char **text, int can_add, Length_Unit unit)
2235 int i = 0, unit_size;
2236 int current_len = strlen(*text);
2237 char *new_text = *text;
2238 if (unit >= LENGTH_UNIT_LAST) return;
2241 if (*new_text == '<')
2243 while (*new_text != '>')
2246 if (!*new_text) break;
2253 if (*new_text == '&')
2255 while (*(new_text + index) != ';')
2258 if (!*(new_text + index)) break;
2262 index = evas_string_char_next_get(new_text, index, NULL);
2263 markup = malloc(index + 1);
2264 strncpy(markup, new_text, index);
2266 if (unit == LENGTH_UNIT_BYTE)
2267 unit_size = strlen(elm_entry_markup_to_utf8(markup));
2268 else if (unit == LENGTH_UNIT_CHAR)
2269 unit_size = evas_string_char_len_get(elm_entry_markup_to_utf8(markup));
2275 if (can_add < unit_size)
2279 evas_object_smart_callback_call(obj, "maxlength,reached", NULL);
2285 strncpy(new_text, new_text + index, current_len - ((new_text + index) - *text));
2286 current_len -= index;
2287 (*text)[current_len] = 0;
2292 can_add -= unit_size;
2297 evas_object_smart_callback_call(obj, "maxlength,reached", NULL);
2301 * This adds an entry to @p parent object.
2303 * @param parent The parent object
2304 * @return The new object or NULL if it cannot be created
2309 elm_entry_add(Evas_Object *parent)
2311 Evas_Object *obj, *top;
2315 ELM_WIDGET_STANDARD_SETUP(wd, Widget_Data, parent, e, obj, NULL);
2317 ELM_SET_WIDTYPE(widtype, "entry");
2318 elm_widget_type_set(obj, "entry");
2319 elm_widget_sub_object_add(parent, obj);
2320 elm_widget_on_focus_hook_set(obj, _on_focus_hook, NULL);
2321 elm_widget_data_set(obj, wd);
2322 elm_widget_del_hook_set(obj, _del_hook);
2323 elm_widget_del_pre_hook_set(obj, _del_pre_hook);
2324 elm_widget_theme_hook_set(obj, _theme_hook);
2325 elm_widget_disable_hook_set(obj, _disable_hook);
2326 elm_widget_signal_emit_hook_set(obj, _signal_emit_hook);
2327 elm_widget_on_focus_region_hook_set(obj, _on_focus_region_hook);
2328 elm_widget_signal_callback_add_hook_set(obj, _signal_callback_add_hook);
2329 elm_widget_signal_callback_del_hook_set(obj, _signal_callback_del_hook);
2330 elm_object_cursor_set(obj, ELM_CURSOR_XTERM);
2331 elm_widget_can_focus_set(obj, EINA_TRUE);
2332 elm_widget_highlight_ignore_set(obj, EINA_TRUE);
2334 wd->linewrap = EINA_TRUE;
2335 wd->char_linewrap= EINA_FALSE;
2336 wd->editable = EINA_TRUE;
2337 wd->disabled = EINA_FALSE;
2338 wd->context_menu = EINA_TRUE;
2339 wd->autosave = EINA_TRUE;
2340 wd->textonly = EINA_FALSE;
2341 wd->autoperiod = EINA_TRUE;
2343 wd->ent = edje_object_add(e);
2344 edje_object_item_provider_set(wd->ent, _get_item, obj);
2345 edje_object_text_insert_filter_callback_add(wd->ent, "elm.text", _text_filter, obj);
2346 evas_object_event_callback_add(wd->ent, EVAS_CALLBACK_MOVE, _move, obj);
2347 evas_object_event_callback_add(wd->ent, EVAS_CALLBACK_RESIZE, _resize, obj);
2348 evas_object_event_callback_add(wd->ent, EVAS_CALLBACK_MOUSE_DOWN,
2350 evas_object_event_callback_add(wd->ent, EVAS_CALLBACK_MOUSE_UP,
2352 evas_object_event_callback_add(wd->ent, EVAS_CALLBACK_MOUSE_MOVE,
2355 _elm_theme_object_set(obj, wd->ent, "entry", "base", "default");
2356 edje_object_signal_callback_add(wd->ent, "entry,changed", "elm.text",
2357 _signal_entry_changed, obj);
2358 edje_object_signal_callback_add(wd->ent, "handler,move,start", "elm.text",
2359 _signal_handler_move_start, obj);
2360 edje_object_signal_callback_add(wd->ent, "handler,move,end", "elm.text",
2361 _signal_handler_move_end, obj);
2362 edje_object_signal_callback_add(wd->ent, "handler,moving", "elm.text",
2363 _signal_handler_moving, obj);
2364 edje_object_signal_callback_add(wd->ent, "selection,start", "elm.text",
2365 _signal_selection_start, obj);
2366 edje_object_signal_callback_add(wd->ent, "selection,end", "elm.text",
2367 _signal_selection_end, obj);
2368 edje_object_signal_callback_add(wd->ent, "magnifier,changed", "elm.text",
2369 _signal_magnifier_changed, obj);
2370 edje_object_signal_callback_add(wd->ent, "selection,changed", "elm.text",
2371 _signal_selection_changed, obj);
2372 edje_object_signal_callback_add(wd->ent, "selection,cleared", "elm.text",
2373 _signal_selection_cleared, obj);
2374 edje_object_signal_callback_add(wd->ent, "entry,paste,request", "elm.text",
2375 _signal_entry_paste_request, obj);
2376 edje_object_signal_callback_add(wd->ent, "entry,copy,notify", "elm.text",
2377 _signal_entry_copy_notify, obj);
2378 edje_object_signal_callback_add(wd->ent, "entry,cut,notify", "elm.text",
2379 _signal_entry_cut_notify, obj);
2380 edje_object_signal_callback_add(wd->ent, "cursor,changed", "elm.text",
2381 _signal_cursor_changed, obj);
2382 edje_object_signal_callback_add(wd->ent, "anchor,mouse,down,*", "elm.text",
2383 _signal_anchor_down, obj);
2384 edje_object_signal_callback_add(wd->ent, "anchor,mouse,up,*", "elm.text",
2385 _signal_anchor_up, obj);
2386 edje_object_signal_callback_add(wd->ent, "anchor,mouse,clicked,*", "elm.text",
2387 _signal_anchor_clicked, obj);
2388 edje_object_signal_callback_add(wd->ent, "anchor,mouse,move,*", "elm.text",
2389 _signal_anchor_move, obj);
2390 edje_object_signal_callback_add(wd->ent, "anchor,mouse,in,*", "elm.text",
2391 _signal_anchor_in, obj);
2392 edje_object_signal_callback_add(wd->ent, "anchor,mouse,out,*", "elm.text",
2393 _signal_anchor_out, obj);
2394 edje_object_signal_callback_add(wd->ent, "entry,key,enter", "elm.text",
2395 _signal_key_enter, obj);
2396 edje_object_signal_callback_add(wd->ent, "mouse,down,1", "elm.text",
2397 _signal_mouse_down, obj);
2398 edje_object_signal_callback_add(wd->ent, "mouse,clicked,1", "elm.text",
2399 _signal_mouse_clicked, obj);
2400 edje_object_signal_callback_add(wd->ent, "mouse,down,1,double", "elm.text",
2401 _signal_mouse_double, obj);
2402 edje_object_part_text_set(wd->ent, "elm.text", "");
2403 if (_elm_config->desktop_entry)
2404 edje_object_part_text_select_allow_set(wd->ent, "elm.text", EINA_TRUE);
2405 elm_widget_resize_object_set(obj, wd->ent);
2408 wd->input_panel_enable = edje_object_part_text_input_panel_enabled_get(wd->ent, "elm.text");
2410 #ifdef HAVE_ELEMENTARY_X
2411 top = elm_widget_top_get(obj);
2412 if ((top) && (elm_win_xwindow_get(top)))
2414 wd->sel_notify_handler =
2415 ecore_event_handler_add(ECORE_X_EVENT_SELECTION_NOTIFY,
2416 _event_selection_notify, obj);
2417 wd->sel_clear_handler =
2418 ecore_event_handler_add(ECORE_X_EVENT_SELECTION_CLEAR,
2419 _event_selection_clear, obj);
2422 elm_drop_target_add(obj, ELM_SEL_FORMAT_MARKUP | ELM_SEL_FORMAT_IMAGE,
2423 _drag_drop_cb, NULL);
2426 entries = eina_list_prepend(entries, obj);
2428 // module - find module for entry
2429 wd->api = _module(obj);
2430 // if found - hook in
2431 if ((wd->api) && (wd->api->obj_hook)) wd->api->obj_hook(obj);
2433 _mirrored_set(obj, elm_widget_mirrored_get(obj));
2434 // TODO: convert Elementary to subclassing of Evas_Smart_Class
2435 // TODO: and save some bytes, making descriptions per-class and not instance!
2436 evas_object_smart_callbacks_descriptions_set(obj, _signals);
2440 EAPI void elm_entry_extension_module_data_get(Evas_Object *obj,Elm_Entry_Extension_data *ext_mod)
2442 ELM_CHECK_WIDTYPE(obj, widtype);
2443 Widget_Data *wd = elm_widget_data_get(obj);
2445 ext_mod->cancel = _cancel;
2446 ext_mod->copy = _copy;
2447 ext_mod->cut = _cut;
2448 ext_mod->paste = _paste;
2449 ext_mod->select = _select;
2450 ext_mod->selectall = _selectall;
2451 ext_mod->ent = wd->ent;
2452 ext_mod->items = wd->items;
2453 ext_mod->longpress_timer = wd->longpress_timer;
2454 ext_mod->editable = wd->editable;
2455 ext_mod->have_selection = wd->have_selection;
2456 ext_mod->password = wd->password;
2457 ext_mod->selmode = wd->selmode;
2458 ext_mod->cnpinit = _cnpinit;
2459 ext_mod->context_menu = wd->context_menu;
2460 ext_mod->textonly = wd->textonly;
2464 * This sets the entry object not to line wrap. All input will
2465 * be on a single line, and the entry box will extend with user input.
2467 * @param obj The entry object
2468 * @param single_line If true, the text in the entry
2469 * will be on a single line.
2474 elm_entry_single_line_set(Evas_Object *obj, Eina_Bool single_line)
2476 ELM_CHECK_WIDTYPE(obj, widtype);
2477 Widget_Data *wd = elm_widget_data_get(obj);
2479 if (wd->single_line == single_line) return;
2480 wd->single_line = single_line;
2481 wd->linewrap = EINA_FALSE;
2482 wd->char_linewrap = EINA_FALSE;
2483 elm_entry_cnp_textonly_set(obj, EINA_TRUE);
2488 * This returns true if the entry has been set to single line mode.
2489 * See also elm_entry_single_line_set().
2491 * @param obj The entry object
2492 * @return single_line If true, the text in the entry is set to display
2498 elm_entry_single_line_get(const Evas_Object *obj)
2500 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2501 Widget_Data *wd = elm_widget_data_get(obj);
2502 if (!wd) return EINA_FALSE;
2503 return wd->single_line;
2507 * This sets the entry object to password mode. All text entered
2508 * and/or displayed within the widget will be replaced with asterisks (*).
2510 * @param obj The entry object
2511 * @param password If true, password mode is enabled.
2516 elm_entry_password_set(Evas_Object *obj, Eina_Bool password)
2518 ELM_CHECK_WIDTYPE(obj, widtype);
2519 Widget_Data *wd = elm_widget_data_get(obj);
2521 if (wd->password == password) return;
2522 wd->password = password;
2523 wd->single_line = EINA_TRUE;
2524 wd->linewrap = EINA_FALSE;
2525 wd->char_linewrap = EINA_FALSE;
2530 * This returns whether password mode is enabled.
2531 * See also elm_entry_password_set().
2533 * @param obj The entry object
2534 * @return If true, the entry is set to display all characters
2540 elm_entry_password_get(const Evas_Object *obj)
2542 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2543 Widget_Data *wd = elm_widget_data_get(obj);
2544 if (!wd) return EINA_FALSE;
2545 return wd->password;
2549 * This sets the text displayed within the entry to @p entry.
2551 * @param obj The entry object
2552 * @param entry The text to be displayed
2557 elm_entry_entry_set(Evas_Object *obj, const char *entry)
2559 ELM_CHECK_WIDTYPE(obj, widtype);
2560 Widget_Data *wd = elm_widget_data_get(obj);
2562 if (!entry) entry = "";
2563 if(wd->max_no_of_bytes)
2565 int len = strlen(entry);
2566 if(len > wd->max_no_of_bytes)
2568 ERR("[ERROR]the length of the text set is more than max no of bytes, text cannot be set");
2572 edje_object_part_text_set(wd->ent, "elm.text", entry);
2573 if (wd->text) eina_stringshare_del(wd->text);
2575 wd->changed = EINA_TRUE;
2580 * This returns the text currently shown in object @p entry.
2581 * See also elm_entry_entry_set().
2583 * @param obj The entry object
2584 * @return The currently displayed text or NULL on failure
2589 elm_entry_entry_get(const Evas_Object *obj)
2591 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
2592 Widget_Data *wd = elm_widget_data_get(obj);
2594 if (!wd) return NULL;
2596 if ((wd->text)&&(wd->password))
2597 return elm_entry_markup_to_utf8(wd->text);
2599 if (wd->text) return wd->text;
2600 text = edje_object_part_text_get(wd->ent, "elm.text");
2603 ERR("text=NULL for edje %p, part 'elm.text'", wd->ent);
2606 eina_stringshare_replace(&wd->text, text);
2607 if(wd->password)return elm_entry_markup_to_utf8(wd->text);
2612 * This returns EINA_TRUE if the entry is empty/there was an error
2613 * and EINA_FALSE if it is not empty.
2615 * @param obj The entry object
2616 * @return If the entry is empty or not.
2621 elm_entry_is_empty(const Evas_Object *obj)
2623 /* FIXME: until there's support for that in textblock, we just check
2624 * to see if the there is text or not. */
2625 ELM_CHECK_WIDTYPE(obj, widtype) EINA_TRUE;
2626 Widget_Data *wd = elm_widget_data_get(obj);
2627 const Evas_Object *tb;
2628 //Evas_Textblock_Cursor *cur;
2630 if (!wd) return EINA_TRUE;
2633 /* It's a hack until we get the support suggested above.
2634 * We just create a cursor, point it to the begining, and then
2635 * try to advance it, if it can advance, the tb is not empty,
2636 * otherwise it is. */
2637 tb = edje_object_part_object_get(wd->ent, "elm.text");
2638 cur = evas_object_textblock_cursor_new((Evas_Object *) tb); /* This is
2639 actually, ok for the time being, thsese hackish stuff will be removed
2640 once evas 1.0 is out*/
2641 evas_textblock_cursor_pos_set(cur, 0);
2642 ret = evas_textblock_cursor_char_next(cur);
2643 evas_textblock_cursor_free(cur);
2648 char *str = elm_entry_markup_to_utf8(elm_entry_entry_get(obj));
2649 if (!str) return EINA_TRUE;
2651 ret = (strlen(str) == 0);
2657 * This returns all selected text within the entry.
2659 * @param obj The entry object
2660 * @return The selected text within the entry or NULL on failure
2665 elm_entry_selection_get(const Evas_Object *obj)
2667 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
2668 Widget_Data *wd = elm_widget_data_get(obj);
2669 if (!wd) return NULL;
2670 return edje_object_part_text_selection_get(wd->ent, "elm.text");
2674 * This inserts text in @p entry where the current cursor position.
2676 * This inserts text at the cursor position is as if it was typed
2677 * by the user (note this also allows markup which a user
2678 * can't just "type" as it would be converted to escaped text, so this
2679 * call can be used to insert things like emoticon items or bold push/pop
2680 * tags, other font and color change tags etc.)
2682 * @param obj The entry object
2683 * @param entry The text to insert
2688 elm_entry_entry_insert(Evas_Object *obj, const char *entry)
2690 ELM_CHECK_WIDTYPE(obj, widtype);
2691 Widget_Data *wd = elm_widget_data_get(obj);
2693 edje_object_part_text_insert(wd->ent, "elm.text", entry);
2695 #ifdef HAVE_ELEMENTARY_X
2696 if (cnpwidgetdata == obj)
2697 ecore_x_selection_secondary_set(elm_win_xwindow_get(obj), "",1);
2700 wd->changed = EINA_TRUE;
2705 * This enables word line wrapping in the entry object. It is the opposite
2706 * of elm_entry_single_line_set(). Additionally, setting this disables
2707 * character line wrapping.
2708 * See also elm_entry_line_char_wrap_set().
2710 * @param obj The entry object
2711 * @param wrap If true, the entry will be wrapped once it reaches the end
2712 * of the object. Wrapping will occur at the end of the word before the end of the
2718 elm_entry_line_wrap_set(Evas_Object *obj, Eina_Bool wrap)
2720 ELM_CHECK_WIDTYPE(obj, widtype);
2721 Widget_Data *wd = elm_widget_data_get(obj);
2723 if (wd->linewrap == wrap) return;
2724 wd->linewrap = wrap;
2726 wd->char_linewrap = EINA_FALSE;
2731 * Set wrap width of the entry
2733 * @param obj The entry object
2734 * @param w The wrap width in pixels at a minimum where words need to wrap
2738 elm_entry_wrap_width_set(Evas_Object *obj, Evas_Coord w)
2740 Widget_Data *wd = elm_widget_data_get(obj);
2741 if (wd->wrap_w == w) return;
2747 * get wrap width of the entry
2749 * @param obj The entry object
2750 * @return The wrap width in pixels at a minimum where words need to wrap
2754 elm_entry_wrap_width_get(const Evas_Object *obj)
2756 Widget_Data *wd = elm_widget_data_get(obj);
2761 * This enables character line wrapping in the entry object. It is the opposite
2762 * of elm_entry_single_line_set(). Additionally, setting this disables
2763 * word line wrapping.
2764 * See also elm_entry_line_wrap_set().
2766 * @param obj The entry object
2767 * @param wrap If true, the entry will be wrapped once it reaches the end
2768 * of the object. Wrapping will occur immediately upon reaching the end of the object.
2773 elm_entry_line_char_wrap_set(Evas_Object *obj, Eina_Bool wrap)
2775 ELM_CHECK_WIDTYPE(obj, widtype);
2776 Widget_Data *wd = elm_widget_data_get(obj);
2778 if (wd->char_linewrap == wrap) return;
2779 wd->char_linewrap = wrap;
2780 if(wd->char_linewrap)
2781 wd->linewrap = EINA_FALSE;
2786 * This sets the editable attribute of the entry.
2788 * @param obj The entry object
2789 * @param editable If true, the entry will be editable by the user.
2790 * If false, it will be set to the disabled state.
2795 elm_entry_editable_set(Evas_Object *obj, Eina_Bool editable)
2797 ELM_CHECK_WIDTYPE(obj, widtype);
2798 Widget_Data *wd = elm_widget_data_get(obj);
2800 if (wd->editable == editable) return;
2801 wd->editable = editable;
2804 #ifdef HAVE_ELEMENTARY_X
2806 elm_drop_target_add(obj, ELM_SEL_FORMAT_MARKUP, _drag_drop_cb, NULL);
2808 elm_drop_target_del(obj);
2813 * This gets the editable attribute of the entry.
2814 * See also elm_entry_editable_set().
2816 * @param obj The entry object
2817 * @return If true, the entry is editable by the user.
2818 * If false, it is not editable by the user
2823 elm_entry_editable_get(const Evas_Object *obj)
2825 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2826 Widget_Data *wd = elm_widget_data_get(obj);
2827 if (!wd) return EINA_FALSE;
2828 return wd->editable;
2832 * This drops any existing text selection within the entry.
2834 * @param obj The entry object
2839 elm_entry_select_none(Evas_Object *obj)
2841 ELM_CHECK_WIDTYPE(obj, widtype);
2842 Widget_Data *wd = elm_widget_data_get(obj);
2846 wd->selmode = EINA_FALSE;
2847 if (!_elm_config->desktop_entry)
2848 edje_object_part_text_select_allow_set(wd->ent, "elm.text", EINA_FALSE);
2849 edje_object_signal_emit(wd->ent, "elm,state,select,off", "elm");
2851 wd->have_selection = EINA_FALSE;
2852 edje_object_part_text_select_none(wd->ent, "elm.text");
2856 * This selects all text within the entry.
2858 * @param obj The entry object
2863 elm_entry_select_all(Evas_Object *obj)
2865 ELM_CHECK_WIDTYPE(obj, widtype);
2866 Widget_Data *wd = elm_widget_data_get(obj);
2870 wd->selmode = EINA_FALSE;
2871 if (!_elm_config->desktop_entry)
2872 edje_object_part_text_select_allow_set(wd->ent, "elm.text", EINA_FALSE);
2873 edje_object_signal_emit(wd->ent, "elm,state,select,off", "elm");
2875 wd->have_selection = EINA_TRUE;
2876 edje_object_part_text_select_all(wd->ent, "elm.text");
2880 * This function returns the geometry of the cursor.
2882 * It's useful if you want to draw something on the cursor (or where it is),
2883 * or for example in the case of scrolled entry where you want to show the
2886 * @param obj The entry object
2887 * @param x returned geometry
2888 * @param y returned geometry
2889 * @param w returned geometry
2890 * @param h returned geometry
2891 * @return EINA_TRUE upon success, EINA_FALSE upon failure
2896 elm_entry_cursor_geometry_get(const Evas_Object *obj, Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *h)
2898 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2899 Widget_Data *wd = elm_widget_data_get(obj);
2900 if (!wd) return EINA_FALSE;
2901 edje_object_part_text_cursor_geometry_get(wd->ent, "elm.text", x, y, w, h);
2906 * This moves the cursor one place to the right within the entry.
2908 * @param obj The entry object
2909 * @return EINA_TRUE upon success, EINA_FALSE upon failure
2914 elm_entry_cursor_next(Evas_Object *obj)
2916 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2917 Widget_Data *wd = elm_widget_data_get(obj);
2918 if (!wd) return EINA_FALSE;
2919 return edje_object_part_text_cursor_next(wd->ent, "elm.text", EDJE_CURSOR_MAIN);
2923 * This moves the cursor one place to the left within the entry.
2925 * @param obj The entry object
2926 * @return EINA_TRUE upon success, EINA_FALSE upon failure
2931 elm_entry_cursor_prev(Evas_Object *obj)
2933 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2934 Widget_Data *wd = elm_widget_data_get(obj);
2935 if (!wd) return EINA_FALSE;
2936 return edje_object_part_text_cursor_prev(wd->ent, "elm.text", EDJE_CURSOR_MAIN);
2940 * This moves the cursor one line up within the entry.
2942 * @param obj The entry object
2943 * @return EINA_TRUE upon success, EINA_FALSE upon failure
2948 elm_entry_cursor_up(Evas_Object *obj)
2950 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2951 Widget_Data *wd = elm_widget_data_get(obj);
2952 if (!wd) return EINA_FALSE;
2953 return edje_object_part_text_cursor_up(wd->ent, "elm.text", EDJE_CURSOR_MAIN);
2957 * This moves the cursor one line down within the entry.
2959 * @param obj The entry object
2960 * @return EINA_TRUE upon success, EINA_FALSE upon failure
2965 elm_entry_cursor_down(Evas_Object *obj)
2967 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2968 Widget_Data *wd = elm_widget_data_get(obj);
2969 if (!wd) return EINA_FALSE;
2970 return edje_object_part_text_cursor_down(wd->ent, "elm.text", EDJE_CURSOR_MAIN);
2974 * This moves the cursor to the beginning of the entry.
2976 * @param obj The entry object
2981 elm_entry_cursor_begin_set(Evas_Object *obj)
2983 ELM_CHECK_WIDTYPE(obj, widtype);
2984 Widget_Data *wd = elm_widget_data_get(obj);
2986 edje_object_part_text_cursor_begin_set(wd->ent, "elm.text", EDJE_CURSOR_MAIN);
2990 * This moves the cursor to the end of the entry.
2992 * @param obj The entry object
2997 elm_entry_cursor_end_set(Evas_Object *obj)
2999 ELM_CHECK_WIDTYPE(obj, widtype);
3000 Widget_Data *wd = elm_widget_data_get(obj);
3002 edje_object_part_text_cursor_end_set(wd->ent, "elm.text", EDJE_CURSOR_MAIN);
3006 * This moves the cursor to the beginning of the current line.
3008 * @param obj The entry object
3013 elm_entry_cursor_line_begin_set(Evas_Object *obj)
3015 ELM_CHECK_WIDTYPE(obj, widtype);
3016 Widget_Data *wd = elm_widget_data_get(obj);
3018 edje_object_part_text_cursor_line_begin_set(wd->ent, "elm.text", EDJE_CURSOR_MAIN);
3022 * This moves the cursor to the end of the current line.
3024 * @param obj The entry object
3029 elm_entry_cursor_line_end_set(Evas_Object *obj)
3031 ELM_CHECK_WIDTYPE(obj, widtype);
3032 Widget_Data *wd = elm_widget_data_get(obj);
3034 edje_object_part_text_cursor_line_end_set(wd->ent, "elm.text", EDJE_CURSOR_MAIN);
3038 * This begins a selection within the entry as though
3039 * the user were holding down the mouse button to make a selection.
3041 * @param obj The entry object
3046 elm_entry_cursor_selection_begin(Evas_Object *obj)
3048 ELM_CHECK_WIDTYPE(obj, widtype);
3049 Widget_Data *wd = elm_widget_data_get(obj);
3051 edje_object_part_text_select_begin(wd->ent, "elm.text");
3055 * This ends a selection within the entry as though
3056 * the user had just released the mouse button while making a selection.
3058 * @param obj The entry object
3063 elm_entry_cursor_selection_end(Evas_Object *obj)
3065 ELM_CHECK_WIDTYPE(obj, widtype);
3066 Widget_Data *wd = elm_widget_data_get(obj);
3068 edje_object_part_text_select_extend(wd->ent, "elm.text");
3072 * TODO: fill this in
3074 * @param obj The entry object
3075 * @return TODO: fill this in
3080 elm_entry_cursor_is_format_get(const Evas_Object *obj)
3082 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
3083 Widget_Data *wd = elm_widget_data_get(obj);
3084 if (!wd) return EINA_FALSE;
3085 return edje_object_part_text_cursor_is_format_get(wd->ent, "elm.text", EDJE_CURSOR_MAIN);
3089 * This returns whether the cursor is visible.
3091 * @param obj The entry object
3092 * @return If true, the cursor is visible.
3097 elm_entry_cursor_is_visible_format_get(const Evas_Object *obj)
3099 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
3100 Widget_Data *wd = elm_widget_data_get(obj);
3101 if (!wd) return EINA_FALSE;
3102 return edje_object_part_text_cursor_is_visible_format_get(wd->ent, "elm.text", EDJE_CURSOR_MAIN);
3106 * TODO: fill this in
3108 * @param obj The entry object
3109 * @return TODO: fill this in
3114 elm_entry_cursor_content_get(const Evas_Object *obj)
3116 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
3117 Widget_Data *wd = elm_widget_data_get(obj);
3118 if (!wd) return NULL;
3119 return edje_object_part_text_cursor_content_get(wd->ent, "elm.text", EDJE_CURSOR_MAIN);
3123 * Sets the cursor position in the entry to the given value
3125 * @param obj The entry object
3126 * @param pos The position of the cursor
3131 elm_entry_cursor_pos_set(Evas_Object *obj, int pos)
3133 ELM_CHECK_WIDTYPE(obj, widtype);
3134 Widget_Data *wd = elm_widget_data_get(obj);
3136 edje_object_part_text_cursor_pos_set(wd->ent, "elm.text", EDJE_CURSOR_MAIN, pos);
3137 edje_object_message_signal_process(wd->ent);
3141 * Retrieves the current position of the cursor in the entry
3143 * @param obj The entry object
3144 * @return The cursor position
3149 elm_entry_cursor_pos_get(const Evas_Object *obj)
3151 ELM_CHECK_WIDTYPE(obj, widtype) 0;
3152 Widget_Data *wd = elm_widget_data_get(obj);
3154 return edje_object_part_text_cursor_pos_get(wd->ent, "elm.text", EDJE_CURSOR_MAIN);
3158 * This executes a "cut" action on the selected text in the entry.
3160 * @param obj The entry object
3165 elm_entry_selection_cut(Evas_Object *obj)
3167 ELM_CHECK_WIDTYPE(obj, widtype);
3168 Widget_Data *wd = elm_widget_data_get(obj);
3170 _cut(obj, NULL, NULL);
3174 * This executes a "copy" action on the selected text in the entry.
3176 * @param obj The entry object
3181 elm_entry_selection_copy(Evas_Object *obj)
3183 ELM_CHECK_WIDTYPE(obj, widtype);
3184 Widget_Data *wd = elm_widget_data_get(obj);
3186 _copy(obj, NULL, NULL);
3190 * This executes a "paste" action in the entry.
3192 * @param obj The entry object
3197 elm_entry_selection_paste(Evas_Object *obj)
3199 ELM_CHECK_WIDTYPE(obj, widtype);
3200 Widget_Data *wd = elm_widget_data_get(obj);
3202 _paste(obj, NULL, NULL);
3206 * This clears and frees the items in a entry's contextual (right click) menu.
3208 * @param obj The entry object
3213 elm_entry_context_menu_clear(Evas_Object *obj)
3215 ELM_CHECK_WIDTYPE(obj, widtype);
3216 Widget_Data *wd = elm_widget_data_get(obj);
3217 Elm_Entry_Context_Menu_Item *it;
3219 EINA_LIST_FREE(wd->items, it)
3221 eina_stringshare_del(it->label);
3222 eina_stringshare_del(it->icon_file);
3223 eina_stringshare_del(it->icon_group);
3229 * This adds an item to the entry's contextual menu.
3231 * @param obj The entry object
3232 * @param label The item's text label
3233 * @param icon_file The item's icon file
3234 * @param icon_type The item's icon type
3235 * @param func The callback to execute when the item is clicked
3236 * @param data The data to associate with the item for related functions
3241 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)
3243 ELM_CHECK_WIDTYPE(obj, widtype);
3244 Widget_Data *wd = elm_widget_data_get(obj);
3245 Elm_Entry_Context_Menu_Item *it;
3247 it = calloc(1, sizeof(Elm_Entry_Context_Menu_Item));
3249 wd->items = eina_list_append(wd->items, it);
3251 it->label = eina_stringshare_add(label);
3252 it->icon_file = eina_stringshare_add(icon_file);
3253 it->icon_type = icon_type;
3255 it->data = (void *)data;
3259 * This disables the entry's contextual (right click) menu.
3261 * @param obj The entry object
3262 * @param disabled If true, the menu is disabled
3267 elm_entry_context_menu_disabled_set(Evas_Object *obj, Eina_Bool disabled)
3269 ELM_CHECK_WIDTYPE(obj, widtype);
3270 Widget_Data *wd = elm_widget_data_get(obj);
3272 if (wd->context_menu == !disabled) return;
3273 wd->context_menu = !disabled;
3277 * This returns whether the entry's contextual (right click) menu is disabled.
3279 * @param obj The entry object
3280 * @return If true, the menu is disabled
3285 elm_entry_context_menu_disabled_get(const Evas_Object *obj)
3287 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
3288 Widget_Data *wd = elm_widget_data_get(obj);
3289 if (!wd) return EINA_FALSE;
3290 return !wd->context_menu;
3294 * This appends a custom item provider to the list for that entry
3296 * This appends the given callback. The list is walked from beginning to end
3297 * with each function called given the item href string in the text. If the
3298 * function returns an object handle other than NULL (it should create an
3299 * and object to do this), then this object is used to replace that item. If
3300 * not the next provider is called until one provides an item object, or the
3301 * default provider in entry does.
3303 * @param obj The entry object
3304 * @param func The function called to provide the item object
3305 * @param data The data passed to @p func
3310 elm_entry_item_provider_append(Evas_Object *obj, Evas_Object *(*func) (void *data, Evas_Object *entry, const char *item), void *data)
3312 ELM_CHECK_WIDTYPE(obj, widtype);
3313 Widget_Data *wd = elm_widget_data_get(obj);
3315 EINA_SAFETY_ON_NULL_RETURN(func);
3316 Elm_Entry_Item_Provider *ip = calloc(1, sizeof(Elm_Entry_Item_Provider));
3320 wd->item_providers = eina_list_append(wd->item_providers, ip);
3324 * This prepends a custom item provider to the list for that entry
3326 * This prepends the given callback. See elm_entry_item_provider_append() for
3329 * @param obj The entry object
3330 * @param func The function called to provide the item object
3331 * @param data The data passed to @p func
3336 elm_entry_item_provider_prepend(Evas_Object *obj, Evas_Object *(*func) (void *data, Evas_Object *entry, const char *item), void *data)
3338 ELM_CHECK_WIDTYPE(obj, widtype);
3339 Widget_Data *wd = elm_widget_data_get(obj);
3341 EINA_SAFETY_ON_NULL_RETURN(func);
3342 Elm_Entry_Item_Provider *ip = calloc(1, sizeof(Elm_Entry_Item_Provider));
3346 wd->item_providers = eina_list_prepend(wd->item_providers, ip);
3350 * This removes a custom item provider to the list for that entry
3352 * This removes the given callback. See elm_entry_item_provider_append() for
3355 * @param obj The entry object
3356 * @param func The function called to provide the item object
3357 * @param data The data passed to @p func
3362 elm_entry_item_provider_remove(Evas_Object *obj, Evas_Object *(*func) (void *data, Evas_Object *entry, const char *item), void *data)
3364 ELM_CHECK_WIDTYPE(obj, widtype);
3365 Widget_Data *wd = elm_widget_data_get(obj);
3367 Elm_Entry_Item_Provider *ip;
3369 EINA_SAFETY_ON_NULL_RETURN(func);
3370 EINA_LIST_FOREACH(wd->item_providers, l, ip)
3372 if ((ip->func == func) && ((!data) || (ip->data == data)))
3374 wd->item_providers = eina_list_remove_list(wd->item_providers, l);
3382 * Append a filter function for text inserted in the entry
3384 * Append the given callback to the list. This functions will be called
3385 * whenever any text is inserted into the entry, with the text to be inserted
3386 * as a parameter. The callback function is free to alter the text in any way
3387 * it wants, but it must remember to free the given pointer and update it.
3388 * If the new text is to be discarded, the function can free it and set it text
3389 * parameter to NULL. This will also prevent any following filters from being
3392 * @param obj The entry object
3393 * @param func The function to use as text filter
3394 * @param data User data to pass to @p func
3399 elm_entry_text_filter_append(Evas_Object *obj, void (*func) (void *data, Evas_Object *entry, char **text), void *data)
3402 Elm_Entry_Text_Filter *tf;
3403 ELM_CHECK_WIDTYPE(obj, widtype);
3405 wd = elm_widget_data_get(obj);
3407 EINA_SAFETY_ON_NULL_RETURN(func);
3409 tf = _filter_new(func, data);
3412 wd->text_filters = eina_list_append(wd->text_filters, tf);
3416 * Prepend a filter function for text insdrted in the entry
3418 * Prepend the given callback to the list. See elm_entry_text_filter_append()
3419 * for more information
3421 * @param obj The entry object
3422 * @param func The function to use as text filter
3423 * @param data User data to pass to @p func
3428 elm_entry_text_filter_prepend(Evas_Object *obj, void (*func) (void *data, Evas_Object *entry, char **text), void *data)
3431 Elm_Entry_Text_Filter *tf;
3432 ELM_CHECK_WIDTYPE(obj, widtype);
3434 wd = elm_widget_data_get(obj);
3436 EINA_SAFETY_ON_NULL_RETURN(func);
3438 tf = _filter_new(func, data);
3441 wd->text_filters = eina_list_prepend(wd->text_filters, tf);
3445 * Remove a filter from the list
3447 * Removes the given callback from the filter list. See elm_entry_text_filter_append()
3448 * for more information.
3450 * @param obj The entry object
3451 * @param func The filter function to remove
3452 * @param data The user data passed when adding the function
3457 elm_entry_text_filter_remove(Evas_Object *obj, void (*func) (void *data, Evas_Object *entry, char **text), void *data)
3461 Elm_Entry_Text_Filter *tf;
3462 ELM_CHECK_WIDTYPE(obj, widtype);
3464 wd = elm_widget_data_get(obj);
3466 EINA_SAFETY_ON_NULL_RETURN(func);
3468 EINA_LIST_FOREACH(wd->text_filters, l, tf)
3470 if ((tf->func == func) && ((!data) || (tf->data == data)))
3472 wd->text_filters = eina_list_remove_list(wd->text_filters, l);
3480 * This converts a markup (HTML-like) string into UTF-8.
3481 * Returning string is obtained with malloc.
3482 * After use the returned string, it should be freed.
3484 * @param s The string (in markup) to be converted
3485 * @return The converted string (in UTF-8). It should be freed.
3490 elm_entry_markup_to_utf8(const char *s)
3492 char *ss = _elm_util_mkup_to_text(s);
3493 if (!ss) ss = strdup("");
3498 * This converts a UTF-8 string into markup (HTML-like).
3499 * Returning string is obtained with malloc.
3500 * After use the returned string, it should be freed.
3502 * @param s The string (in UTF-8) to be converted
3503 * @return The converted string (in markup). It should be freed.
3508 elm_entry_utf8_to_markup(const char *s)
3510 char *ss = _elm_util_text_to_mkup(s);
3511 if (!ss) ss = strdup("");
3516 * Get the input method context in the entry widget
3518 * @param obj The entry object
3519 * @return The input method context
3523 EAPI Ecore_IMF_Context *elm_entry_imf_context_get(Evas_Object *obj)
3525 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
3526 Widget_Data *wd = elm_widget_data_get(obj);
3527 if (!wd || !wd->ent) return NULL;
3529 return edje_object_part_text_imf_context_get(wd->ent, "elm.text");
3533 * Set whether entry should enable the return key on soft keyboard automatically
3535 * @param obj The entry object
3536 * @param on If true, entry enables the return key on soft keyboard automatically.
3541 elm_entry_autoenable_returnkey_set(Evas_Object *obj, Eina_Bool on)
3543 ELM_CHECK_WIDTYPE(obj, widtype);
3544 Widget_Data *wd = elm_widget_data_get(obj);
3547 wd->autoreturnkey = on;
3548 _check_enable_returnkey(obj);
3552 * Set whether entry should support auto capitalization
3554 * @param obj The entry object
3555 * @param on If true, entry suports auto capitalization.
3560 elm_entry_autocapitalization_set(Evas_Object *obj, Eina_Bool autocap)
3562 ELM_CHECK_WIDTYPE(obj, widtype);
3563 Widget_Data *wd = elm_widget_data_get(obj);
3567 wd->autocapital = EINA_FALSE;
3569 wd->autocapital = autocap;
3571 if (wd->input_panel_layout == ELM_INPUT_PANEL_LAYOUT_URL ||
3572 wd->input_panel_layout == ELM_INPUT_PANEL_LAYOUT_EMAIL)
3573 wd->autocapital = EINA_FALSE;
3575 edje_object_part_text_autocapitalization_set(wd->ent, "elm.text", wd->autocapital);
3579 * Set whether entry should support auto period
3581 * @param obj The entry object
3582 * @param on If true, entry suports auto period.
3587 elm_entry_autoperiod_set(Evas_Object *obj, Eina_Bool autoperiod)
3589 ELM_CHECK_WIDTYPE(obj, widtype);
3590 Widget_Data *wd = elm_widget_data_get(obj);
3594 wd->autoperiod = EINA_FALSE;
3596 wd->autoperiod = autoperiod;
3598 if (wd->input_panel_layout == ELM_INPUT_PANEL_LAYOUT_URL ||
3599 wd->input_panel_layout == ELM_INPUT_PANEL_LAYOUT_EMAIL)
3600 wd->autoperiod = EINA_FALSE;
3602 edje_object_part_text_autoperiod_set(wd->ent, "elm.text", wd->autoperiod);
3606 * Set the font size on the entry object
3608 * @param obj The entry object
3609 * @param size font size
3614 elm_entry_fontsize_set(Evas_Object *obj, int fontsize)
3616 ELM_CHECK_WIDTYPE(obj, widtype);
3617 Widget_Data *wd = elm_widget_data_get(obj);
3618 Eina_Strbuf *fontbuf = NULL;
3623 t = eina_stringshare_add(elm_entry_entry_get(obj));
3624 fontbuf = eina_strbuf_new();
3625 eina_strbuf_append_printf(fontbuf, "%d", fontsize);
3627 if (fontsize == 0) removeflag = 1; // remove fontsize tag
3629 if (_stringshare_key_value_replace(&t, "font_size", eina_strbuf_string_get(fontbuf), removeflag) == 0)
3631 elm_entry_entry_set(obj, t);
3635 eina_strbuf_free(fontbuf);
3636 eina_stringshare_del(t);
3640 * Set the text align on the entry object
3642 * @param obj The entry object
3643 * @param align align mode
3648 elm_entry_text_align_set(Evas_Object *obj, const char *alignmode)
3650 ELM_CHECK_WIDTYPE(obj, widtype);
3651 Widget_Data *wd = elm_widget_data_get(obj);
3656 t = eina_stringshare_add(elm_entry_entry_get(obj));
3658 if (len <= 0) return;
3660 if (_stringshare_key_value_replace(&t, "align", alignmode, 0) == 0)
3661 elm_entry_entry_set(obj, t);
3665 eina_stringshare_del(t);
3669 * Set the text color on the entry object
3671 * @param obj The entry object
3672 * @param r Red property background color of The entry object
3673 * @param g Green property background color of The entry object
3674 * @param b Blue property background color of The entry object
3675 * @param a Alpha property background alpha of The entry object
3680 elm_entry_text_color_set(Evas_Object *obj, unsigned int r, unsigned int g, unsigned int b, unsigned int a)
3682 ELM_CHECK_WIDTYPE(obj, widtype);
3683 Widget_Data *wd = elm_widget_data_get(obj);
3684 Eina_Strbuf *colorbuf = NULL;
3689 t = eina_stringshare_add(elm_entry_entry_get(obj));
3691 if (len <= 0) return;
3692 colorbuf = eina_strbuf_new();
3693 eina_strbuf_append_printf(colorbuf, "#%02X%02X%02X%02X", r, g, b, a);
3695 if (_stringshare_key_value_replace(&t, "color", eina_strbuf_string_get(colorbuf), 0) == 0)
3697 elm_entry_entry_set(obj, t);
3701 eina_strbuf_free(colorbuf);
3702 eina_stringshare_del(t);
3706 * Set background color of the entry
3708 * @param obj The entry object
3709 * @param r Red property background color of The entry object
3710 * @param g Green property background color of The entry object
3711 * @param b Blue property background color of The entry object
3712 * @param a Alpha property background alpha of The entry object
3716 elm_entry_background_color_set(Evas_Object *obj, unsigned int r, unsigned int g, unsigned int b, unsigned int a)
3718 ELM_CHECK_WIDTYPE(obj, widtype);
3719 Widget_Data *wd = elm_widget_data_get(obj);
3720 evas_object_color_set(wd->bg, r, g, b, a);
3722 if (wd->bgcolor == EINA_FALSE)
3725 edje_object_part_swallow(wd->ent, "entry.swallow.background", wd->bg);
3730 * Filter inserted text based on user defined character and byte limits
3732 * Add this filter to an entry to limit the characters that it will accept
3733 * based the the contents of the provided Elm_Entry_Filter_Limit_Size.
3734 * The funtion works on the UTF-8 representation of the string, converting
3735 * it from the set markup, thus not accounting for any format in it.
3737 * The user must create an Elm_Entry_Filter_Limit_Size structure and pass
3738 * it as data when setting the filter. In it it's possible to set limits
3739 * by character count or bytes (any of them is disabled if 0), and both can
3740 * be set at the same time. In that case, it first checks for characters,
3743 * The function will cut the inserted text in order to allow only the first
3744 * number of characters that are still allowed. The cut is made in
3745 * characters, even when limiting by bytes, in order to always contain
3746 * valid ones and avoid half unicode characters making it in.
3751 elm_entry_filter_limit_size(void *data, Evas_Object *entry, char **text)
3753 Elm_Entry_Filter_Limit_Size *lim = data;
3756 const char *(*text_get)(const Evas_Object *);
3757 const char *widget_type;
3759 EINA_SAFETY_ON_NULL_RETURN(data);
3760 EINA_SAFETY_ON_NULL_RETURN(entry);
3761 EINA_SAFETY_ON_NULL_RETURN(text);
3763 /* hack. I don't want to copy the entire function to work with
3765 widget_type = elm_widget_type_get(entry);
3766 if (!strcmp(widget_type, "entry"))
3767 text_get = elm_entry_entry_get;
3768 else if (!strcmp(widget_type, "scrolled_entry"))
3769 text_get = elm_scrolled_entry_entry_get;
3773 current = elm_entry_markup_to_utf8(text_get(entry));
3775 if (lim->max_char_count > 0)
3777 len = evas_string_char_len_get(current);
3778 if (len >= lim->max_char_count)
3780 evas_object_smart_callback_call(entry, "maxlength,reached", NULL);
3786 newlen = evas_string_char_len_get(elm_entry_markup_to_utf8(*text));
3787 if ((len + newlen) > lim->max_char_count)
3788 _add_chars_till_limit(entry, text, (lim->max_char_count - len), LENGTH_UNIT_CHAR);
3790 else if (lim->max_byte_count > 0)
3792 len = strlen(current);
3793 if (len >= lim->max_byte_count)
3795 evas_object_smart_callback_call(entry, "maxlength,reached", NULL);
3801 newlen = strlen(elm_entry_markup_to_utf8(*text));
3802 if ((len + newlen) > lim->max_byte_count)
3803 _add_chars_till_limit(entry, text, (lim->max_byte_count - len), LENGTH_UNIT_BYTE);
3809 * Filter inserted text based on accepted or rejected sets of characters
3811 * Add this filter to an entry to restrict the set of accepted characters
3812 * based on the sets in the provided Elm_Entry_Filter_Accept_Set.
3813 * This structure contains both accepted and rejected sets, but they are
3814 * mutually exclusive. If accepted is set, it will be used, otherwise it
3815 * goes on to the rejected set.
3818 elm_entry_filter_accept_set(void *data, Evas_Object *entry __UNUSED__, char **text)
3820 Elm_Entry_Filter_Accept_Set *as = data;
3824 int read_idx, last_read_idx = 0, read_char;
3826 EINA_SAFETY_ON_NULL_RETURN(data);
3827 EINA_SAFETY_ON_NULL_RETURN(text);
3829 if ((!as->accepted) && (!as->rejected))
3835 goes_in = EINA_TRUE;
3840 goes_in = EINA_FALSE;
3844 read_idx = evas_string_char_next_get(*text, 0, &read_char);
3847 int cmp_idx, cmp_char;
3848 Eina_Bool in_set = EINA_FALSE;
3850 cmp_idx = evas_string_char_next_get(set, 0, &cmp_char);
3853 if (read_char == cmp_char)
3858 cmp_idx = evas_string_char_next_get(set, cmp_idx, &cmp_char);
3860 if (in_set == goes_in)
3862 int size = read_idx - last_read_idx;
3863 const char *src = (*text) + last_read_idx;
3865 memcpy(insert, *text + last_read_idx, size);
3868 last_read_idx = read_idx;
3869 read_idx = evas_string_char_next_get(*text, read_idx, &read_char);
3875 * This sets the file (and implicitly loads it) for the text to display and
3876 * then edit. All changes are written back to the file after a short delay if
3877 * the entry object is set to autosave.
3879 * @param obj The entry object
3880 * @param file The path to the file to load and save
3881 * @param format The file format
3886 elm_entry_file_set(Evas_Object *obj, const char *file, Elm_Text_Format format)
3888 ELM_CHECK_WIDTYPE(obj, widtype);
3889 Widget_Data *wd = elm_widget_data_get(obj);
3891 if (wd->delay_write)
3893 ecore_timer_del(wd->delay_write);
3894 wd->delay_write = NULL;
3896 if (wd->autosave) _save(obj);
3897 eina_stringshare_replace(&wd->file, file);
3898 wd->format = format;
3903 * Gets the file to load and save and the file format
3905 * @param obj The entry object
3906 * @param file The path to the file to load and save
3907 * @param format The file format
3912 elm_entry_file_get(const Evas_Object *obj, const char **file, Elm_Text_Format *format)
3914 ELM_CHECK_WIDTYPE(obj, widtype);
3915 Widget_Data *wd = elm_widget_data_get(obj);
3917 if (file) *file = wd->file;
3918 if (format) *format = wd->format;
3922 * This function writes any changes made to the file set with
3923 * elm_entry_file_set()
3925 * @param obj The entry object
3930 elm_entry_file_save(Evas_Object *obj)
3932 ELM_CHECK_WIDTYPE(obj, widtype);
3933 Widget_Data *wd = elm_widget_data_get(obj);
3935 if (wd->delay_write)
3937 ecore_timer_del(wd->delay_write);
3938 wd->delay_write = NULL;
3941 wd->delay_write = ecore_timer_add(2.0, _delay_write, obj);
3945 * This sets the entry object to 'autosave' the loaded text file or not.
3947 * @param obj The entry object
3948 * @param autosave Autosave the loaded file or not
3953 elm_entry_autosave_set(Evas_Object *obj, Eina_Bool autosave)
3955 ELM_CHECK_WIDTYPE(obj, widtype);
3956 Widget_Data *wd = elm_widget_data_get(obj);
3958 wd->autosave = !!autosave;
3962 * This gets the entry object's 'autosave' status.
3964 * @param obj The entry object
3965 * @return Autosave the loaded file or not
3970 elm_entry_autosave_get(const Evas_Object *obj)
3972 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
3973 Widget_Data *wd = elm_widget_data_get(obj);
3974 if (!wd) return EINA_FALSE;
3975 return wd->autosave;
3979 * Control pasting of text and images for the widget.
3981 * Normally the entry allows both text and images to be pasted. By setting
3982 * textonly to be true, this prevents images from being pasted.
3984 * Note this only changes the behaviour of text.
3986 * @param obj The entry object
3987 * @param textonly paste mode - EINA_TRUE is text only, EINA_FALSE is text+image+other.
3992 elm_entry_cnp_textonly_set(Evas_Object *obj, Eina_Bool textonly)
3994 Elm_Sel_Format format = ELM_SEL_FORMAT_MARKUP;
3995 ELM_CHECK_WIDTYPE(obj, widtype);
3996 Widget_Data *wd = elm_widget_data_get(obj);
3998 textonly = !!textonly;
3999 if (wd->textonly == textonly) return;
4000 wd->textonly = !!textonly;
4001 if (!textonly) format |= ELM_SEL_FORMAT_IMAGE;
4002 #ifdef HAVE_ELEMENTARY_X
4003 elm_drop_target_add(obj, format, _drag_drop_cb, NULL);
4008 * Getting elm_entry text paste/drop mode.
4010 * In textonly mode, only text may be pasted or dropped into the widget.
4012 * @param obj The entry object
4013 * @return If the widget only accepts text from pastes.
4018 elm_entry_cnp_textonly_get(Evas_Object *obj)
4020 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
4021 Widget_Data *wd = elm_widget_data_get(obj);
4022 if (!wd) return EINA_FALSE;
4023 return wd->textonly;
4027 * This sets the attribute to show the input panel automatically.
4029 * @param obj The entry object
4030 * @param enabled If true, the input panel is appeared when entry is clicked or has a focus
4035 elm_entry_input_panel_enabled_set(Evas_Object *obj, Eina_Bool enabled)
4037 ELM_CHECK_WIDTYPE(obj, widtype);
4038 Widget_Data *wd = elm_widget_data_get(obj);
4041 wd->input_panel_enable = enabled;
4042 edje_object_part_text_input_panel_enabled_set(wd->ent, "elm.text", enabled);
4046 * Set the input panel layout of the entry
4048 * @param obj The entry object
4049 * @param layout the layout to set
4054 elm_entry_input_panel_layout_set(Evas_Object *obj, Elm_Input_Panel_Layout layout)
4056 ELM_CHECK_WIDTYPE(obj, widtype);
4057 Widget_Data *wd = elm_widget_data_get(obj);
4060 Ecore_IMF_Context *ic = elm_entry_imf_context_get(obj);
4063 wd->input_panel_layout = layout;
4065 ecore_imf_context_input_panel_layout_set(ic, (Ecore_IMF_Input_Panel_Layout)layout);
4069 * Set the magnifier style of the entry
4071 * @param obj The entry object
4072 * @param type the magnifier style to set
4077 elm_entry_magnifier_type_set(Evas_Object *obj, int type)
4079 ELM_CHECK_WIDTYPE(obj, widtype);
4080 Widget_Data *wd = elm_widget_data_get(obj);
4083 wd->mgf_type = type;
4084 _magnifier_create(obj);