2 * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
4 #include <Elementary.h>
6 #include "elm_module_priv.h"
8 * @defgroup Entry Entry
11 * An entry is a convenience widget which shows
12 * a box that the user can enter text into. Unlike a
13 * @ref Scrolled_Entry widget, entries DO NOT scroll with user
14 * input. Entry widgets are capable of expanding past the
15 * boundaries of the window, thus resizing the window to its
18 * You can also insert "items" in the entry with:
20 * \<item size=16x16 vsize=full href=emoticon/haha\>\</item\>
22 * for example. sizing can be set bu size=WxH, relsize=WxH or absize=WxH with
23 * vsize=ascent or vsize=full. the href=NAME sets the item name. Entry
24 * supports a list of emoticon names by default. These are:
27 * - emoticon/angry-shout
28 * - emoticon/crazy-laugh
29 * - emoticon/evil-laugh
31 * - emoticon/goggle-smile
33 * - emoticon/grumpy-smile
35 * - emoticon/guilty-smile
37 * - emoticon/half-smile
38 * - emoticon/happy-panting
40 * - emoticon/indifferent
42 * - emoticon/knowing-grin
44 * - emoticon/little-bit-sorry
45 * - emoticon/love-lots
47 * - emoticon/minimal-smile
48 * - emoticon/not-happy
49 * - emoticon/not-impressed
51 * - emoticon/opensmile
54 * - emoticon/squint-laugh
55 * - emoticon/surprised
56 * - emoticon/suspicious
57 * - emoticon/tongue-dangling
58 * - emoticon/tongue-poke
61 * - emoticon/very-sorry
67 * These are built-in currently, but you can add your own item provieer that
68 * can create inlined objects in the text and fill the space allocated to the
69 * item with a custom object of your own.
71 * See the entry test for some more examples of use of this.
73 * Signals that you can add callbacks for are:
74 * - "changed" - The text within the entry was changed
75 * - "activated" - The entry has received focus and the cursor
76 * - "press" - The entry has been clicked
77 * - "longpressed" - The entry has been clicked for a couple seconds
78 * - "clicked" - The entry has been clicked
79 * - "clicked,double" - The entry has been double clicked
80 * - "focused" - The entry has received focus
81 * - "unfocused" - The entry has lost focus
82 * - "selection,paste" - A paste action has occurred
83 * - "selection,copy" - A copy action has occurred
84 * - "selection,cut" - A cut action has occurred
85 * - "selection,start" - A selection has begun
86 * - "selection,changed" - The selection has changed
87 * - "selection,cleared" - The selection has been cleared
88 * - "cursor,changed" - The cursor has changed
89 * - "anchor,clicked" - The anchor has been clicked
92 typedef struct _Mod_Api Mod_Api;
94 typedef struct _Widget_Data Widget_Data;
95 typedef struct _Elm_Entry_Item_Provider Elm_Entry_Item_Provider;
100 Evas_Object *popup;/*copy paste UI - elm_popup*/
101 Evas_Object *ctxpopup;/*copy paste UI - elm_ctxpopup*/
103 Evas_Object *hoversel;
104 Ecore_Job *deferred_recalc_job;
105 Ecore_Event_Handler *sel_notify_handler;
106 Ecore_Event_Handler *sel_clear_handler;
107 Ecore_Timer *longpress_timer;
108 /* Only for clipboard */
112 int ellipsis_threshold;
114 Evas_Coord downx, downy;
115 Evas_Coord cx, cy, cw, ch;
117 Eina_List *item_providers;
118 Ecore_Job *hovdeljob;
119 Mod_Api *api; // module api if supplied
121 Eina_Bool changed : 1;
122 Eina_Bool linewrap : 1;
123 Eina_Bool char_linewrap : 1;
124 Eina_Bool single_line : 1;
125 Eina_Bool password : 1;
126 Eina_Bool show_last_character : 1;
127 Eina_Bool editable : 1;
128 Eina_Bool selection_asked : 1;
129 Eina_Bool have_selection : 1;
130 Eina_Bool selmode : 1;
131 Eina_Bool deferred_cur : 1;
132 Eina_Bool disabled : 1;
133 Eina_Bool double_clicked : 1;
134 Eina_Bool context_menu : 1;
135 Eina_Bool drag_selection_asked : 1;
136 Eina_Bool bgcolor : 1;
137 Eina_Bool ellipsis : 1;
138 Eina_Bool autoreturnkey : 1;
139 Eina_Bool input_panel_enable : 1;
140 Eina_Bool autocapital : 1;
141 Elm_Input_Panel_Layout input_panel_layout;
142 Eina_Bool autoperiod : 1;
145 struct _Elm_Entry_Item_Provider
147 Evas_Object *(*func) (void *data, Evas_Object *entry, const char *item);
151 static const char *widtype = NULL;
153 static Evas_Object *cnpwidgetdata = NULL;
156 static Eina_Bool _drag_drop_cb(void *data, Evas_Object *obj, Elm_Drop_Data *);
157 static void _del_hook(Evas_Object *obj);
158 static void _theme_hook(Evas_Object *obj);
159 static void _disable_hook(Evas_Object *obj);
160 static void _sizing_eval(Evas_Object *obj);
161 static void _on_focus_hook(void *data, Evas_Object *obj);
162 static void _resize(void *data, Evas *e, Evas_Object *obj, void *event_info);
163 static const char *_getbase(Evas_Object *obj);
164 static void _signal_entry_changed(void *data, Evas_Object *obj, const char *emission, const char *source);
165 static void _signal_selection_start(void *data, Evas_Object *obj, const char *emission, const char *source);
166 static void _signal_selection_changed(void *data, Evas_Object *obj, const char *emission, const char *source);
167 static void _signal_selection_cleared(void *data, Evas_Object *obj, const char *emission, const char *source);
168 static void _signal_entry_paste_request(void *data, Evas_Object *obj, const char *emission, const char *source);
169 static void _signal_entry_copy_notify(void *data, Evas_Object *obj, const char *emission, const char *source);
170 static void _signal_entry_cut_notify(void *data, Evas_Object *obj, const char *emission, const char *source);
171 static void _signal_cursor_changed(void *data, Evas_Object *obj, const char *emission, const char *source);
172 static int _get_value_in_key_string(const char *oldstring, char *key, char **value);
173 static int _strbuf_key_value_replace(Eina_Strbuf *srcbuf, char *key, const char *value, int deleteflag);
174 static int _stringshare_key_value_replace(const char **srcstring, char *key, const char *value, int deleteflag);
175 static int _is_width_over(Evas_Object *obj);
176 static void _ellipsis_entry_to_width(Evas_Object *obj);
177 static void _reverse_ellipsis_entry(Evas_Object *obj);
178 static int _textinput_control_function(void *data,void *input_data);
179 static int _entry_length_get(Evas_Object *obj);
181 static const char SIG_CHANGED[] = "changed";
182 static const char SIG_ACTIVATED[] = "activated";
183 static const char SIG_PRESS[] = "press";
184 static const char SIG_LONGPRESSED[] = "longpressed";
185 static const char SIG_CLICKED[] = "clicked";
186 static const char SIG_CLICKED_DOUBLE[] = "clicked,double";
187 static const char SIG_FOCUSED[] = "focused";
188 static const char SIG_UNFOCUSED[] = "unfocused";
189 static const char SIG_SELECTION_PASTE[] = "selection,paste";
190 static const char SIG_SELECTION_COPY[] = "selection,copy";
191 static const char SIG_SELECTION_CUT[] = "selection,cut";
192 static const char SIG_SELECTION_START[] = "selection,start";
193 static const char SIG_SELECTION_CHANGED[] = "selection,changed";
194 static const char SIG_SELECTION_CLEARED[] = "selection,cleared";
195 static const char SIG_CURSOR_CHANGED[] = "cursor,changed";
196 static const char SIG_ANCHOR_CLICKED[] = "anchor,clicked";
197 #ifdef HAVE_CONFORMANT_AUTOSCROLL
198 static const char SIG_IMPREGION_CHANGED[] = "impregion,changed";
200 static const Evas_Smart_Cb_Description _signals[] = {
204 {SIG_LONGPRESSED, ""},
206 {SIG_CLICKED_DOUBLE, ""},
209 {SIG_SELECTION_PASTE, ""},
210 {SIG_SELECTION_COPY, ""},
211 {SIG_SELECTION_CUT, ""},
212 {SIG_SELECTION_START, ""},
213 {SIG_SELECTION_CHANGED, ""},
214 {SIG_SELECTION_CLEARED, ""},
215 {SIG_CURSOR_CHANGED, ""},
216 {SIG_ANCHOR_CLICKED, ""},
220 static Eina_List *entries = NULL;
224 void (*obj_hook) (Evas_Object *obj);
225 void (*obj_unhook) (Evas_Object *obj);
226 void (*obj_longpress) (Evas_Object *obj);
227 void (*obj_mouseup) (Evas_Object *obj);
231 _module(Evas_Object *obj __UNUSED__)
233 static Elm_Module *m = NULL;
234 if (m) goto ok; // already found - just use
235 if (!(m = _elm_module_find_as("entry/api"))) return NULL;
237 m->api = malloc(sizeof(Mod_Api));
238 if (!m->api) return NULL;
239 ((Mod_Api *)(m->api) )->obj_hook = // called on creation
240 _elm_module_symbol_get(m, "obj_hook");
241 ((Mod_Api *)(m->api) )->obj_unhook = // called on deletion
242 _elm_module_symbol_get(m, "obj_unhook");
243 ((Mod_Api *)(m->api) )->obj_longpress = // called on long press menu
244 _elm_module_symbol_get(m, "obj_longpress");
245 ((Mod_Api *)(m->api) )->obj_mouseup = // called on mouseup
246 _elm_module_symbol_get(m, "obj_mouseup");
247 ok: // ok - return api
252 _del_hook(Evas_Object *obj)
254 Widget_Data *wd = elm_widget_data_get(obj);
255 Elm_Entry_Context_Menu_Item *it;
256 Elm_Entry_Item_Provider *ip;
258 if (wd->hovdeljob) ecore_job_del(wd->hovdeljob);
259 if ((wd->api) && (wd->api->obj_unhook)) wd->api->obj_unhook(obj); // module - unhook
261 entries = eina_list_remove(entries, obj);
262 #ifdef HAVE_ELEMENTARY_X
263 ecore_event_handler_del(wd->sel_notify_handler);
264 ecore_event_handler_del(wd->sel_clear_handler);
266 if (wd->cut_sel) eina_stringshare_del(wd->cut_sel);
267 if (wd->text) eina_stringshare_del(wd->text);
268 if (wd->bg) evas_object_del(wd->bg);
269 if (wd->deferred_recalc_job) ecore_job_del(wd->deferred_recalc_job);
270 if (wd->longpress_timer) ecore_timer_del(wd->longpress_timer);
271 EINA_LIST_FREE(wd->items, it)
273 eina_stringshare_del(it->label);
274 eina_stringshare_del(it->icon_file);
275 eina_stringshare_del(it->icon_group);
278 EINA_LIST_FREE(wd->item_providers, ip)
286 _theme_hook(Evas_Object *obj)
288 Widget_Data *wd = elm_widget_data_get(obj);
290 Ecore_IMF_Context *ic;
292 t = eina_stringshare_add(elm_entry_entry_get(obj));
293 _elm_theme_object_set(obj, wd->ent, "entry", _getbase(obj), elm_widget_style_get(obj));
294 elm_entry_entry_set(obj, t);
295 eina_stringshare_del(t);
296 edje_object_scale_set(wd->ent, elm_widget_scale_get(obj) * _elm_config->scale);
297 edje_object_part_text_autocapitalization_set(wd->ent, "elm.text", wd->autocapital);
298 edje_object_part_text_autoperiod_set(wd->ent, "elm.text", wd->autoperiod);
299 edje_object_part_text_input_panel_enabled_set(wd->ent, "elm.text", wd->input_panel_enable);
301 ic = edje_object_part_text_imf_context_get(wd->ent, "elm.text");
304 ecore_imf_context_input_panel_layout_set(ic, (Ecore_IMF_Input_Panel_Layout)wd->input_panel_layout);
311 _disable_hook(Evas_Object *obj)
313 Widget_Data *wd = elm_widget_data_get(obj);
315 if (elm_widget_disabled_get(obj))
317 edje_object_signal_emit(wd->ent, "elm,state,disabled", "elm");
318 wd->disabled = EINA_TRUE;
322 edje_object_signal_emit(wd->ent, "elm,state,enabled", "elm");
323 wd->disabled = EINA_FALSE;
328 _elm_win_recalc_job(void *data)
330 Widget_Data *wd = elm_widget_data_get(data);
331 Evas_Coord minw = -1, minh = -1, maxh = -1;
332 Evas_Coord resw, resh, minminw;
334 wd->deferred_recalc_job = NULL;
335 evas_object_geometry_get(wd->ent, NULL, NULL, &resw, &resh);
338 edje_object_size_min_restricted_calc(wd->ent, &minw, &minh, 0, 0);
339 elm_coords_finger_size_adjust(1, &minw, 1, &minh);
341 edje_object_size_min_restricted_calc(wd->ent, &minw, &minh, resw, 0);
342 elm_coords_finger_size_adjust(1, &minw, 1, &minh);
343 evas_object_size_hint_min_set(data, minminw, minh);
344 if (wd->single_line) maxh = minh;
345 evas_object_size_hint_max_set(data, -1, maxh);
346 if (wd->deferred_cur)
347 elm_widget_show_region_set(data, wd->cx, wd->cy, wd->cw, wd->ch);
351 _sizing_eval(Evas_Object *obj)
353 Widget_Data *wd = elm_widget_data_get(obj);
354 Evas_Coord minw = -1, minh = -1, maxw = -1, maxh = -1;
355 Evas_Coord resw, resh;
357 if (wd->linewrap || wd->char_linewrap)
359 evas_object_geometry_get(wd->ent, NULL, NULL, &resw, &resh);
360 if ((resw == wd->lastw) && (!wd->changed)) return;
361 wd->changed = EINA_FALSE;
363 if (wd->deferred_recalc_job) ecore_job_del(wd->deferred_recalc_job);
364 wd->deferred_recalc_job = ecore_job_add(_elm_win_recalc_job, obj);
368 evas_object_geometry_get(wd->ent, NULL, NULL, &resw, &resh);
369 edje_object_size_min_calc(wd->ent, &minw, &minh);
370 elm_coords_finger_size_adjust(1, &minw, 1, &minh);
371 evas_object_size_hint_min_set(obj, minw, minh);
372 if (wd->single_line) maxh = minh;
373 evas_object_size_hint_max_set(obj, maxw, maxh);
375 if (wd->ellipsis && wd->single_line)
377 if (_is_width_over(obj))
378 _ellipsis_entry_to_width(obj);
379 else if (wd->ellipsis_threshold > 1 && _entry_length_get(obj) < wd->ellipsis_threshold)
380 _reverse_ellipsis_entry(obj);
386 _check_enable_returnkey(Evas_Object *obj)
388 Widget_Data *wd = elm_widget_data_get(obj);
391 Ecore_IMF_Context *ic = elm_entry_imf_context_get(obj);
394 if (!wd->autoreturnkey) return;
396 if (_entry_length_get(obj) == 0)
398 ecore_imf_context_input_panel_key_disabled_set(ic, ECORE_IMF_INPUT_PANEL_LAYOUT_NORMAL, ECORE_IMF_INPUT_PANEL_KEY_ENTER, EINA_TRUE);
402 ecore_imf_context_input_panel_key_disabled_set(ic, ECORE_IMF_INPUT_PANEL_LAYOUT_NORMAL, ECORE_IMF_INPUT_PANEL_KEY_ENTER, EINA_FALSE);
406 #ifdef HAVE_CONFORMANT_AUTOSCROLL
408 _imp_region_get_hook(const Evas_Object *obj, Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *h)
410 Evas_Coord cx = 0, cy = 0, cw = 0, ch = 0;
411 Widget_Data *wd = elm_widget_data_get(obj);
412 if (!wd) return NULL;
413 edje_object_part_text_cursor_geometry_get(wd->ent, "elm.text",
424 _on_focus_hook(void *data __UNUSED__, Evas_Object *obj)
426 Widget_Data *wd = elm_widget_data_get(obj);
427 Evas_Object *top = elm_widget_top_get(obj);
429 if (!wd->editable) return;
430 if (elm_widget_focus_get(obj))
432 evas_object_focus_set(wd->ent, 1);
433 edje_object_signal_emit(wd->ent, "elm,action,focus", "elm");
435 if (top) elm_win_keyboard_mode_set(top, ELM_WIN_KEYBOARD_ON);
436 evas_object_smart_callback_call(obj, SIG_FOCUSED, NULL);
437 _check_enable_returnkey(obj);
441 edje_object_signal_emit(wd->ent, "elm,action,unfocus", "elm");
442 edje_object_part_text_set(wd->ent, "elm_entry_remain_byte_count", "");
443 evas_object_focus_set(wd->ent, 0);
444 if (top) elm_win_keyboard_mode_set(top, ELM_WIN_KEYBOARD_OFF);
445 evas_object_smart_callback_call(obj, SIG_UNFOCUSED, NULL);
450 _signal_emit_hook(Evas_Object *obj, const char *emission, const char *source)
452 Widget_Data *wd = elm_widget_data_get(obj);
454 edje_object_signal_emit(wd->ent, emission, source);
458 _signal_callback_add_hook(Evas_Object *obj, const char *emission, const char *source, void (*func_cb) (void *data, Evas_Object *o, const char *emission, const char *source), void *data)
460 Widget_Data *wd = elm_widget_data_get(obj);
462 edje_object_signal_callback_add(wd->ent, emission, source, func_cb, data);
466 _signal_callback_del_hook(Evas_Object *obj, const char *emission, const char *source, void (*func_cb) (void *data, Evas_Object *o, const char *emission, const char *source))
468 Widget_Data *wd = elm_widget_data_get(obj);
469 if (!wd) return NULL;
470 return edje_object_signal_callback_del(wd->ent, emission, source, func_cb);
474 _hoversel_position(Evas_Object *obj)
476 Widget_Data *wd = elm_widget_data_get(obj);
477 Evas_Coord cx, cy, cw, ch, x, y, mw, mh;
479 evas_object_geometry_get(wd->ent, &x, &y, NULL, NULL);
480 edje_object_part_text_cursor_geometry_get(wd->ent, "elm.text",
482 evas_object_size_hint_min_get(wd->hoversel, &mw, &mh);
493 evas_object_move(wd->hoversel, x + cx, y + cy);
494 evas_object_resize(wd->hoversel, cw, ch);
498 _move(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
500 Widget_Data *wd = elm_widget_data_get(data);
502 if (wd->hoversel) _hoversel_position(data);
506 _resize(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
508 Widget_Data *wd = elm_widget_data_get(data);
510 if (wd->linewrap || wd->char_linewrap)
514 if (wd->hoversel) _hoversel_position(data);
515 // Evas_Coord ww, hh;
516 // evas_object_geometry_get(wd->ent, NULL, NULL, &ww, &hh);
520 _hover_del(void *data)
522 Widget_Data *wd = elm_widget_data_get(data);
527 evas_object_del(wd->hoversel);
530 wd->hovdeljob = NULL;
534 _dismissed(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
536 Widget_Data *wd = elm_widget_data_get(data);
538 if (wd->hoversel) evas_object_hide(wd->hoversel);
542 edje_object_part_text_select_allow_set(wd->ent, "elm.text", EINA_TRUE);
544 elm_widget_scroll_freeze_pop(data);
545 if (wd->hovdeljob) ecore_job_del(wd->hovdeljob);
546 wd->hovdeljob = ecore_job_add(_hover_del, data);
550 _select(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
552 Widget_Data *wd = elm_widget_data_get(data);
554 wd->selmode = EINA_TRUE;
555 edje_object_part_text_select_none(wd->ent, "elm.text");
557 edje_object_part_text_select_allow_set(wd->ent, "elm.text", EINA_TRUE);
558 edje_object_signal_emit(wd->ent, "elm,state,select,on", "elm");
559 elm_widget_scroll_hold_push(data);
563 _paste(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
565 Widget_Data *wd = elm_widget_data_get(data);
567 evas_object_smart_callback_call(data, SIG_SELECTION_PASTE, NULL);
568 if (wd->sel_notify_handler)
570 #ifdef HAVE_ELEMENTARY_X
571 wd->selection_asked = EINA_TRUE;
572 elm_selection_get(ELM_SEL_CLIPBOARD, ELM_SEL_FORMAT_MARKUP, data);
578 _store_selection(Elm_Sel_Type seltype, Evas_Object *obj)
580 Widget_Data *wd = elm_widget_data_get(obj);
584 sel = edje_object_part_text_selection_get(wd->ent, "elm.text");
585 elm_selection_set(seltype, obj, ELM_SEL_FORMAT_MARKUP, sel);
586 if (seltype == ELM_SEL_CLIPBOARD)
587 eina_stringshare_replace(&wd->cut_sel, sel);
591 _cut(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
593 Widget_Data *wd = elm_widget_data_get(data);
596 wd->selmode = EINA_FALSE;
597 edje_object_part_text_select_allow_set(wd->ent, "elm.text", EINA_FALSE);
598 edje_object_signal_emit(wd->ent, "elm,state,select,off", "elm");
599 elm_widget_scroll_hold_pop(data);
600 _store_selection(ELM_SEL_CLIPBOARD, data);
601 edje_object_part_text_insert(wd->ent, "elm.text", "");
602 edje_object_part_text_select_none(wd->ent, "elm.text");
606 _copy(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
608 Widget_Data *wd = elm_widget_data_get(data);
610 wd->selmode = EINA_FALSE;
611 edje_object_part_text_select_allow_set(wd->ent, "elm.text", EINA_FALSE);
612 edje_object_signal_emit(wd->ent, "elm,state,select,off", "elm");
613 elm_widget_scroll_hold_pop(data);
614 _store_selection(ELM_SEL_CLIPBOARD, data);
615 // edje_object_part_text_select_none(wd->ent, "elm.text");
619 _cancel(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
621 Widget_Data *wd = elm_widget_data_get(data);
623 wd->selmode = EINA_FALSE;
624 edje_object_part_text_select_allow_set(wd->ent, "elm.text", EINA_FALSE);
625 edje_object_signal_emit(wd->ent, "elm,state,select,off", "elm");
626 elm_widget_scroll_hold_pop(data);
627 edje_object_part_text_select_none(wd->ent, "elm.text");
631 _clipboard_menu(void *data, Evas_Object *obj, void *event_info __UNUSED__)
633 Widget_Data *wd = elm_widget_data_get(data);
637 ecore_x_selection_secondary_set(elm_win_xwindow_get(obj), "",1);
638 cnpwidgetdata = data;
639 elm_cbhm_helper_init(obj);
640 elm_cbhm_send_raw_data("show");
646 _cnpinit(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
648 Widget_Data *wd = elm_widget_data_get(data);
650 cnpwidgetdata = data;
656 _item_clicked(void *data, Evas_Object *obj, void *event_info __UNUSED__)
658 Elm_Entry_Context_Menu_Item *it = data;
659 Evas_Object *obj2 = it->obj;
661 if (it->func) it->func(it->data, obj2, NULL);
665 _long_press(void *data)
667 Widget_Data *wd = elm_widget_data_get(data);
670 const Elm_Entry_Context_Menu_Item *it;
671 if (!wd) return ECORE_CALLBACK_CANCEL;
673 if (wd->longpress_timer)
675 ecore_timer_del(wd->longpress_timer);
676 wd->longpress_timer = NULL;
679 if ((wd->api) && (wd->api->obj_longpress))
681 wd->api->obj_longpress(data);
683 else if (wd->context_menu)
685 const char *context_menu_orientation;
687 if (wd->hoversel) evas_object_del(wd->hoversel);
688 else elm_widget_scroll_freeze_push(data);
689 wd->hoversel = elm_hoversel_add(data);
690 context_menu_orientation = edje_object_data_get
691 (wd->ent, "context_menu_orientation");
692 if ((context_menu_orientation) &&
693 (!strcmp(context_menu_orientation, "horizontal")))
694 elm_hoversel_horizontal_set(wd->hoversel, 1);
695 elm_object_style_set(wd->hoversel, "entry");
696 elm_widget_sub_object_add(data, wd->hoversel);
697 elm_hoversel_label_set(wd->hoversel, "Text");
698 top = elm_widget_top_get(data);
699 if (top) elm_hoversel_hover_parent_set(wd->hoversel, top);
700 evas_object_smart_callback_add(wd->hoversel, "dismissed", _dismissed, data);
704 elm_hoversel_item_add(wd->hoversel, "Select", NULL, ELM_ICON_NONE,
706 if (1) // need way to detect if someone has a selection
709 elm_hoversel_item_add(wd->hoversel, "Paste", NULL, ELM_ICON_NONE,
714 elm_hoversel_item_add(wd->hoversel, "More", NULL, ELM_ICON_NONE,
715 _clipboard_menu, data);
722 if (wd->have_selection)
724 elm_hoversel_item_add(wd->hoversel, "Copy", NULL, ELM_ICON_NONE,
727 elm_hoversel_item_add(wd->hoversel, "Cut", NULL, ELM_ICON_NONE,
730 elm_hoversel_item_add(wd->hoversel, "Cancel", NULL, ELM_ICON_NONE,
733 elm_hoversel_item_add(wd->hoversel, "More", NULL, ELM_ICON_NONE,
734 _clipboard_menu, data);
738 EINA_LIST_FOREACH(wd->items, l, it)
740 elm_hoversel_item_add(wd->hoversel, it->label, it->icon_file,
741 it->icon_type, _item_clicked, it);
745 _hoversel_position(data);
746 evas_object_show(wd->hoversel);
747 elm_hoversel_hover_begin(wd->hoversel);
749 edje_object_part_text_select_allow_set(wd->ent, "elm.text", EINA_FALSE);
750 edje_object_part_text_select_abort(wd->ent, "elm.text");
752 wd->longpress_timer = NULL;
753 evas_object_smart_callback_call(data, SIG_LONGPRESSED, NULL);
754 return ECORE_CALLBACK_CANCEL;
758 _mouse_down(void *data, Evas *evas __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
760 Widget_Data *wd = elm_widget_data_get(data);
761 Evas_Event_Mouse_Down *ev = event_info;
763 if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return;
764 if (ev->button != 1) return;
765 // if (ev->flags & EVAS_BUTTON_DOUBLE_CLICK)
766 if (wd->longpress_timer) ecore_timer_del(wd->longpress_timer);
767 wd->longpress_timer = ecore_timer_add(1.0, _long_press, data);
768 wd->downx = ev->canvas.x;
769 wd->downy = ev->canvas.y;
773 _mouse_up(void *data, Evas *evas __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
775 Widget_Data *wd = elm_widget_data_get(data);
776 Evas_Event_Mouse_Up *ev = event_info;
778 if (ev->button != 1) return;
780 if (!wd->double_clicked)
782 if ((wd->api) && (wd->api->obj_mouseup))
784 wd->api->obj_mouseup(data);
787 if (wd->longpress_timer)
789 ecore_timer_del(wd->longpress_timer);
790 wd->longpress_timer = NULL;
795 _mouse_move(void *data, Evas *evas __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
797 Widget_Data *wd = elm_widget_data_get(data);
798 Evas_Event_Mouse_Move *ev = event_info;
802 if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD)
804 if (wd->longpress_timer)
806 ecore_timer_del(wd->longpress_timer);
807 wd->longpress_timer = NULL;
810 else if (wd->longpress_timer)
814 dx = wd->downx - ev->cur.canvas.x;
816 dy = wd->downy - ev->cur.canvas.y;
819 ((_elm_config->finger_size / 2) *
820 (_elm_config->finger_size / 2)))
822 ecore_timer_del(wd->longpress_timer);
823 wd->longpress_timer = NULL;
827 else if (wd->longpress_timer)
831 dx = wd->downx - ev->cur.canvas.x;
833 dy = wd->downy - ev->cur.canvas.y;
836 ((_elm_config->finger_size / 2) *
837 (_elm_config->finger_size / 2)))
839 ecore_timer_del(wd->longpress_timer);
840 wd->longpress_timer = NULL;
846 _getbase(Evas_Object *obj)
848 Widget_Data *wd = elm_widget_data_get(obj);
849 if (!wd) return "base";
854 if (wd->show_last_character) return "custom-password";
855 else return "base-password";
859 if (wd->single_line) return "base-single";
862 if (wd->linewrap) return "base";
863 else if (wd->char_linewrap) return "base-charwrap";
864 else return "base-nowrap";
872 if (wd->show_last_character) return "custom-password";
873 else return "base-password";
877 if (wd->single_line) return "base-single-noedit";
880 if (wd->linewrap) return "base-noedit";
881 else if (wd->char_linewrap) return "base-noedit-charwrap";
882 else return "base-nowrap-noedit";
890 _str_append(char *str, const char *txt, int *len, int *alloc)
892 int txt_len = strlen(txt);
894 if (txt_len <= 0) return str;
895 if ((*len + txt_len) >= *alloc)
900 alloc2 = *alloc + txt_len + 128;
901 str2 = realloc(str, alloc2);
902 if (!str2) return str;
906 strcpy(str + *len, txt);
911 /*FIXME: Sholud be implemented somewhere else, it really depends on the context
912 * because some markups can be implemented otherwise according to style.
913 * probably doing it in textblock and making it translate according to it's
914 * style is correct. */
916 _strncpy(char* dest, const char* src, size_t count)
920 ERR( "dest is NULL" );
925 ERR( "src is NULL" );
930 ERR( "count is smaller than 0" );
934 return strncpy( dest, src, count );
938 _mkup_to_text(const char *mkup)
941 int str_len = 0, str_alloc = 0;
943 char *tag_start, *tag_end, *esc_start, *esc_end, *ts;
945 if (!mkup) return NULL;
947 tag_start = tag_end = esc_start = esc_end = NULL;
952 if (((p!=NULL)&&(*p == 0)) ||
953 (tag_end) || (esc_end) ||
954 (tag_start) || (esc_start))
960 ttag = malloc(tag_end - tag_start);
963 _strncpy(ttag, tag_start + 1, tag_end - tag_start - 1);
964 ttag[tag_end - tag_start - 1] = 0;
965 if (!strcmp(ttag, "br"))
966 str = _str_append(str, "\n", &str_len, &str_alloc);
967 else if (!strcmp(ttag, "\n"))
968 str = _str_append(str, "\n", &str_len, &str_alloc);
969 else if (!strcmp(ttag, "\\n"))
970 str = _str_append(str, "\n", &str_len, &str_alloc);
971 else if (!strcmp(ttag, "\t"))
972 str = _str_append(str, "\t", &str_len, &str_alloc);
973 else if (!strcmp(ttag, "\\t"))
974 str = _str_append(str, "\t", &str_len, &str_alloc);
975 else if (!strcmp(ttag, "ps")) /* Unicode paragraph separator */
976 str = _str_append(str, "\xE2\x80\xA9", &str_len, &str_alloc);
979 tag_start = tag_end = NULL;
983 ts = malloc(esc_end - esc_start + 1);
987 _strncpy(ts, esc_start, esc_end - esc_start);
988 ts[esc_end - esc_start] = 0;
989 esc = evas_textblock_escape_string_get(ts);
991 str = _str_append(str, esc, &str_len, &str_alloc);
994 esc_start = esc_end = NULL;
996 else if ((p!=NULL)&&(*p == 0))
998 ts = malloc(p - s + 1);
1001 _strncpy(ts, s, p - s);
1003 str = _str_append(str, ts, &str_len, &str_alloc);
1009 if ((p!=NULL)&&(*p == '<'))
1015 ts = malloc(p - s + 1);
1018 _strncpy(ts, s, p - s);
1020 str = _str_append(str, ts, &str_len, &str_alloc);
1026 else if ((p!=NULL)&&(*p == '>'))
1034 else if ((p!=NULL)&&(*p == '&'))
1040 ts = malloc(p - s + 1);
1043 _strncpy(ts, s, p - s);
1045 str = _str_append(str, ts, &str_len, &str_alloc);
1051 else if ((p!=NULL)&&(*p == ';'))
1065 _entry_length_get(Evas_Object *obj)
1068 const char *str = elm_entry_entry_get(obj);
1071 char *plain_str = _mkup_to_text(str);
1072 if (!plain_str) return 0;
1074 len = strlen(plain_str);
1081 _text_to_mkup(const char *text)
1084 int str_len = 0, str_alloc = 0;
1085 int ch, pos = 0, pos2 = 0;
1087 if (!text) return NULL;
1091 pos2 = evas_string_char_next_get((char *)(text), pos2, &ch);
1092 if ((ch <= 0) || (pos2 <= 0)) break;
1094 str = _str_append(str, "<br>", &str_len, &str_alloc);
1095 else if (ch == '\t')
1096 str = _str_append(str, "<\t>", &str_len, &str_alloc);
1098 str = _str_append(str, "<", &str_len, &str_alloc);
1100 str = _str_append(str, ">", &str_len, &str_alloc);
1102 str = _str_append(str, "&", &str_len, &str_alloc);
1103 else if (ch == 0x2029)
1104 str = _str_append(str, "<ps>", &str_len, &str_alloc);
1109 _strncpy(tstr, text + pos, pos2 - pos);
1110 tstr[pos2 - pos] = 0;
1111 str = _str_append(str, tstr, &str_len, &str_alloc);
1118 _signal_entry_changed(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__)
1120 Widget_Data *wd = elm_widget_data_get(data);
1122 wd->changed = EINA_TRUE;
1124 if (wd->text) eina_stringshare_del(wd->text);
1126 _check_enable_returnkey(data);
1127 evas_object_smart_callback_call(data, SIG_CHANGED, NULL);
1131 _signal_selection_start(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__)
1133 Widget_Data *wd = elm_widget_data_get(data);
1137 EINA_LIST_FOREACH(entries, l, entry)
1139 if (entry != data) elm_entry_select_none(entry);
1141 wd->have_selection = EINA_TRUE;
1142 wd->selmode = EINA_TRUE;
1143 evas_object_smart_callback_call(data, SIG_SELECTION_START, NULL);
1144 #ifdef HAVE_ELEMENTARY_X
1145 if (wd->sel_notify_handler)
1147 const char *txt = elm_entry_selection_get(data);
1150 top = elm_widget_top_get(data);
1151 if ((top) && (elm_win_xwindow_get(top)))
1152 elm_selection_set(ELM_SEL_PRIMARY, data, ELM_SEL_FORMAT_MARKUP, txt);
1158 _signal_selection_changed(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__)
1160 Widget_Data *wd = elm_widget_data_get(data);
1162 wd->have_selection = EINA_TRUE;
1163 wd->selmode = EINA_TRUE;
1164 evas_object_smart_callback_call(data, SIG_SELECTION_CHANGED, NULL);
1165 elm_selection_set(ELM_SEL_PRIMARY, obj, ELM_SEL_FORMAT_MARKUP,
1166 elm_entry_selection_get(data));
1170 _signal_selection_cleared(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__)
1172 Widget_Data *wd = elm_widget_data_get(data);
1174 if (!wd->have_selection) return;
1175 wd->have_selection = EINA_FALSE;
1176 wd->selmode = EINA_FALSE;
1177 evas_object_smart_callback_call(data, SIG_SELECTION_CLEARED, NULL);
1178 if (wd->sel_notify_handler)
1182 #ifdef HAVE_ELEMENTARY_X
1185 top = elm_widget_top_get(data);
1186 if ((top) && (elm_win_xwindow_get(top)))
1187 elm_selection_set(ELM_SEL_PRIMARY, data, ELM_SEL_FORMAT_MARKUP,
1190 eina_stringshare_del(wd->cut_sel);
1195 #ifdef HAVE_ELEMENTARY_X
1198 top = elm_widget_top_get(data);
1199 if ((top) && (elm_win_xwindow_get(top)))
1200 elm_selection_clear(ELM_SEL_PRIMARY, data);
1207 _signal_entry_paste_request(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__)
1209 Widget_Data *wd = elm_widget_data_get(data);
1211 evas_object_smart_callback_call(data, SIG_SELECTION_PASTE, NULL);
1212 if (wd->sel_notify_handler)
1214 #ifdef HAVE_ELEMENTARY_X
1217 top = elm_widget_top_get(data);
1218 if ((top) && (elm_win_xwindow_get(top)))
1220 wd->selection_asked = EINA_TRUE;
1221 elm_selection_get(ELM_SEL_CLIPBOARD, ELM_SEL_FORMAT_MARKUP, data);
1228 _signal_entry_copy_notify(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__)
1230 Widget_Data *wd = elm_widget_data_get(data);
1232 evas_object_smart_callback_call(data, SIG_SELECTION_COPY, NULL);
1233 elm_selection_set(ELM_SEL_CLIPBOARD, obj, ELM_SEL_FORMAT_MARKUP,
1234 elm_entry_selection_get(data));
1238 _signal_entry_cut_notify(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__)
1240 Widget_Data *wd = elm_widget_data_get(data);
1242 evas_object_smart_callback_call(data, SIG_SELECTION_CUT, NULL);
1243 elm_selection_set(ELM_SEL_CLIPBOARD, obj, ELM_SEL_FORMAT_MARKUP,
1244 elm_entry_selection_get(data));
1245 edje_object_part_text_insert(wd->ent, "elm.text", "");
1246 wd->changed = EINA_TRUE;
1251 _signal_cursor_changed(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__)
1253 Widget_Data *wd = elm_widget_data_get(data);
1254 Evas_Coord cx, cy, cw, ch;
1256 evas_object_smart_callback_call(data, SIG_CURSOR_CHANGED, NULL);
1257 edje_object_part_text_cursor_geometry_get(wd->ent, "elm.text",
1258 &cx, &cy, &cw, &ch);
1259 if (!wd->deferred_recalc_job)
1260 elm_widget_show_region_set(data, cx, cy, cw, ch);
1263 wd->deferred_cur = EINA_TRUE;
1269 #ifdef HAVE_CONFORMANT_AUTOSCROLL
1270 evas_object_smart_callback_call(data, SIG_IMPREGION_CHANGED, NULL);
1275 _signal_anchor_down(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__)
1277 Widget_Data *wd = elm_widget_data_get(data);
1282 _signal_anchor_up(void *data, Evas_Object *obj __UNUSED__, const char *emission, const char *source __UNUSED__)
1284 Widget_Data *wd = elm_widget_data_get(data);
1285 Elm_Entry_Anchor_Info ei;
1286 char *buf2, *p, *p2, *n;
1288 p = strrchr(emission, ',');
1291 const Eina_List *geoms;
1295 while (p2 >= emission)
1297 if (*p2 == ',') break;
1301 buf2 = alloca(5 + p - p2);
1302 strncpy(buf2, p2, p - p2);
1305 ei.button = atoi(buf2);
1306 ei.x = ei.y = ei.w = ei.h = 0;
1308 edje_object_part_text_anchor_geometry_get(wd->ent, "elm.text", ei.name);
1311 Evas_Textblock_Rectangle *r;
1313 Evas_Coord px, py, x, y;
1315 evas_object_geometry_get(wd->ent, &x, &y, NULL, NULL);
1316 evas_pointer_output_xy_get(evas_object_evas_get(wd->ent), &px, &py);
1317 EINA_LIST_FOREACH(geoms, l, r)
1319 if (((r->x + x) <= px) && ((r->y + y) <= py) &&
1320 ((r->x + x + r->w) > px) && ((r->y + y + r->h) > py))
1331 evas_object_smart_callback_call(data, SIG_ANCHOR_CLICKED, &ei);
1336 _signal_anchor_move(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__)
1338 Widget_Data *wd = elm_widget_data_get(data);
1343 _signal_anchor_in(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__)
1345 Widget_Data *wd = elm_widget_data_get(data);
1350 _signal_anchor_out(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__)
1352 Widget_Data *wd = elm_widget_data_get(data);
1357 _signal_key_enter(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__)
1359 Widget_Data *wd = elm_widget_data_get(data);
1361 evas_object_smart_callback_call(data, SIG_ACTIVATED, NULL);
1365 _signal_mouse_down(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__)
1367 Widget_Data *wd = elm_widget_data_get(data);
1369 wd->double_clicked = EINA_FALSE;
1370 evas_object_smart_callback_call(data, SIG_PRESS, NULL);
1374 _signal_mouse_up(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__)
1376 Widget_Data *wd = elm_widget_data_get(data);
1378 evas_object_smart_callback_call(data, SIG_CLICKED, NULL);
1382 _signal_mouse_double(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__)
1384 Widget_Data *wd = elm_widget_data_get(data);
1386 wd->double_clicked = EINA_TRUE;
1387 evas_object_smart_callback_call(data, SIG_CLICKED_DOUBLE, NULL);
1390 #ifdef HAVE_ELEMENTARY_X
1392 _event_selection_notify(void *data, int type __UNUSED__, void *event)
1394 Widget_Data *wd = elm_widget_data_get(data);
1395 Ecore_X_Event_Selection_Notify *ev = event;
1396 if (!wd) return ECORE_CALLBACK_PASS_ON;
1397 if (!wd->selection_asked && !wd->drag_selection_asked)
1398 return ECORE_CALLBACK_PASS_ON;
1400 if ((ev->selection == ECORE_X_SELECTION_CLIPBOARD) ||
1401 (ev->selection == ECORE_X_SELECTION_PRIMARY))
1403 Ecore_X_Selection_Data_Text *text_data;
1405 text_data = ev->data;
1406 if (text_data->data.content == ECORE_X_SELECTION_CONTENT_TEXT)
1408 if (text_data->text)
1410 char *txt = _text_to_mkup(text_data->text);
1414 elm_entry_entry_insert(data, txt);
1419 wd->selection_asked = EINA_FALSE;
1421 else if (ev->selection == ECORE_X_SELECTION_XDND)
1423 Ecore_X_Selection_Data_Text *text_data;
1425 text_data = ev->data;
1426 if (text_data->data.content == ECORE_X_SELECTION_CONTENT_TEXT)
1428 if (text_data->text)
1430 char *txt = _text_to_mkup(text_data->text);
1434 /* Massive FIXME: this should be at the drag point */
1435 elm_entry_entry_insert(data, txt);
1440 wd->drag_selection_asked = EINA_FALSE;
1442 ecore_x_dnd_send_finished();
1446 return ECORE_CALLBACK_PASS_ON;
1450 _event_selection_clear(void *data, int type __UNUSED__, void *event)
1453 Widget_Data *wd = elm_widget_data_get(data);
1454 Ecore_X_Event_Selection_Clear *ev = event;
1456 if (!wd->have_selection) return 1;
1457 if ((ev->selection == ECORE_X_SELECTION_CLIPBOARD) ||
1458 (ev->selection == ECORE_X_SELECTION_PRIMARY))
1460 elm_entry_select_none(data);
1465 Evas_Object *top = elm_widget_top_get(data);
1466 Ecore_X_Event_Selection_Clear *ev = event;
1469 return ECORE_CALLBACK_PASS_ON;
1471 if (ev->selection != ECORE_X_SELECTION_SECONDARY)
1473 return ECORE_CALLBACK_PASS_ON;
1476 elm_selection_get(ELM_SEL_SECONDARY,ELM_SEL_FORMAT_MARKUP,data);
1479 return ECORE_CALLBACK_PASS_ON;
1484 _drag_drop_cb(void *data __UNUSED__, Evas_Object *obj, Elm_Drop_Data *drop)
1489 wd = elm_widget_data_get(obj);
1491 if (!wd) return EINA_FALSE;
1492 //printf("Inserting at (%d,%d) %s\n",drop->x,drop->y,(char*)drop->data);
1494 edje_object_part_text_cursor_copy(wd->ent, "elm.text",
1495 EDJE_CURSOR_MAIN,/*->*/EDJE_CURSOR_USER);
1496 rv = edje_object_part_text_cursor_coord_set(wd->ent,"elm.text",
1497 EDJE_CURSOR_MAIN,drop->x,drop->y);
1498 // if (!rv) printf("Warning: Failed to position cursor: paste anyway\n");
1499 elm_entry_entry_insert(obj, drop->data);
1500 edje_object_part_text_cursor_copy(wd->ent, "elm.text",
1501 EDJE_CURSOR_USER,/*->*/EDJE_CURSOR_MAIN);
1507 static Evas_Object *
1508 _get_item(void *data, Evas_Object *edje __UNUSED__, const char *part __UNUSED__, const char *item)
1510 Widget_Data *wd = elm_widget_data_get(data);
1513 Elm_Entry_Item_Provider *ip;
1516 EINA_LIST_FOREACH(wd->item_providers, l, ip)
1518 o = ip->func(ip->data, data, item);
1521 o = edje_object_add(evas_object_evas_get(data));
1522 if (!strncmp(item, "emoticon/", 9))
1523 ok = _elm_theme_object_set(data, o, "entry", item, elm_widget_style_get(data));
1525 _elm_theme_object_set(data, o, "entry/emoticon", "wtf", elm_widget_style_get(data));
1530 _get_value_in_key_string(const char *oldstring, char *key, char **value)
1532 char *curlocater, *starttag, *endtag;
1533 int firstindex = 0, foundflag = -1;
1535 curlocater = strstr(oldstring, key);
1538 starttag = curlocater;
1539 endtag = curlocater + strlen(key);
1540 if (endtag == NULL || *endtag != '=')
1546 firstindex = abs(oldstring - curlocater);
1547 firstindex += strlen(key)+1; // strlen("key") + strlen("=")
1548 *value = (char*)oldstring + firstindex;
1550 while (oldstring != starttag)
1552 if (*starttag == '>')
1557 if (*starttag == '<')
1561 if (starttag == NULL) break;
1564 while (NULL != endtag)
1575 if (endtag == NULL) break;
1578 if (foundflag != 0 && *starttag == '<' && *endtag == '>')
1588 if (foundflag == 1) return 0;
1594 _strbuf_key_value_replace(Eina_Strbuf *srcbuf, char *key, const char *value, int deleteflag)
1596 const char *srcstring = NULL;
1597 Eina_Strbuf *repbuf = NULL, *diffbuf = NULL;
1598 char *curlocater, *replocater;
1599 char *starttag, *endtag;
1600 int tagtxtlen = 0, insertflag = 0;
1602 srcstring = eina_strbuf_string_get(srcbuf);
1603 curlocater = strstr(srcstring, key);
1605 if (curlocater == NULL)
1613 starttag = strchr(srcstring, '<');
1614 endtag = strchr(srcstring, '>');
1615 tagtxtlen = endtag - starttag;
1616 if (tagtxtlen <= 0) tagtxtlen = 0;
1617 if (starttag < curlocater && curlocater < endtag) break;
1618 if (endtag != NULL && endtag+1 != NULL)
1619 srcstring = endtag+1;
1622 } while (strlen(srcstring) > 1);
1624 if (starttag && endtag && tagtxtlen > strlen(key))
1626 repbuf = eina_strbuf_new();
1627 diffbuf = eina_strbuf_new();
1628 eina_strbuf_append_n(repbuf, starttag, tagtxtlen);
1629 srcstring = eina_strbuf_string_get(repbuf);
1630 curlocater = strstr(srcstring, key);
1632 if (curlocater != NULL)
1634 replocater = curlocater + strlen(key) + 1;
1636 while (*replocater == ' ' || *replocater == '=')
1641 while (*replocater != NULL && *replocater != ' ' && *replocater != '>')
1644 if (replocater-curlocater > strlen(key)+1)
1647 eina_strbuf_append_n(diffbuf, curlocater, replocater-curlocater+1);
1656 eina_strbuf_reset(repbuf);
1664 if (repbuf == NULL) repbuf = eina_strbuf_new();
1665 if (diffbuf == NULL) diffbuf = eina_strbuf_new();
1669 eina_strbuf_append_printf(repbuf, "<%s=%s>", key, value);
1670 eina_strbuf_prepend(srcbuf, eina_strbuf_string_get(repbuf));
1676 eina_strbuf_prepend(diffbuf, "<");
1677 eina_strbuf_append(diffbuf, ">");
1678 eina_strbuf_replace_first(srcbuf, eina_strbuf_string_get(diffbuf), "");
1682 eina_strbuf_append_printf(repbuf, "%s=%s", key, value);
1683 eina_strbuf_replace_first(srcbuf, eina_strbuf_string_get(diffbuf), eina_strbuf_string_get(repbuf));
1687 if (repbuf) eina_strbuf_free(repbuf);
1688 if (diffbuf) eina_strbuf_free(diffbuf);
1694 _stringshare_key_value_replace(const char **srcstring, char *key, const char *value, int deleteflag)
1696 Eina_Strbuf *sharebuf = NULL;
1698 sharebuf = eina_strbuf_new();
1699 eina_strbuf_append(sharebuf, *srcstring);
1700 _strbuf_key_value_replace(sharebuf, key, value, deleteflag);
1701 eina_stringshare_del(*srcstring);
1702 *srcstring = eina_stringshare_add(eina_strbuf_string_get(sharebuf));
1703 eina_strbuf_free(sharebuf);
1709 _is_width_over(Evas_Object *obj)
1711 Evas_Coord x, y, w, h;
1712 Evas_Coord vx, vy, vw, vh;
1713 Widget_Data *wd = elm_widget_data_get(obj);
1717 edje_object_part_geometry_get(wd->ent,"elm.text",&x,&y,&w,&h);
1719 evas_object_geometry_get (obj, &vx,&vy,&vw,&vh);
1721 if (x >= 0 && y >= 0)
1724 if (4 < wd->wrap_w && w > wd->wrap_w)
1731 _reverse_ellipsis_entry(Evas_Object *obj)
1733 Widget_Data *wd = elm_widget_data_get(obj);
1734 int cur_fontsize = 0;
1735 Eina_Strbuf *fontbuf = NULL, *txtbuf = NULL;
1736 char **kvalue = NULL;
1737 const char *minfont, *deffont, *maxfont;
1738 const char *ellipsis_string = "...";
1739 int minfontsize, maxfontsize, minshowcount;
1741 minshowcount = strlen(ellipsis_string) + 1;
1742 minfont = edje_object_data_get(wd->ent, "min_font_size");
1743 if (minfont) minfontsize = atoi(minfont);
1744 else minfontsize = 1;
1745 maxfont = edje_object_data_get(wd->ent, "max_font_size");
1746 if (maxfont) maxfontsize = atoi(maxfont);
1747 else maxfontsize = 1;
1748 deffont = edje_object_data_get(wd->ent, "default_font_size");
1749 if (deffont) cur_fontsize = atoi(deffont);
1750 else cur_fontsize = 1;
1751 if (minfontsize == maxfontsize || cur_fontsize == 1) return; // theme is not ready for ellipsis
1752 if (strlen(edje_object_part_text_get(wd->ent, "elm.text")) <= 0) return;
1754 if (_get_value_in_key_string(edje_object_part_text_get(wd->ent, "elm.text"), "font_size", &kvalue) == 0)
1756 if (*kvalue != NULL) cur_fontsize = atoi((char*)kvalue);
1759 txtbuf = eina_strbuf_new();
1760 eina_strbuf_append(txtbuf, edje_object_part_text_get(wd->ent, "elm.text"));
1762 if (cur_fontsize >= atoi(deffont))
1764 if (txtbuf) eina_strbuf_free(txtbuf);
1768 if (_is_width_over(obj) != 1)
1770 int rev_fontsize = cur_fontsize;
1774 if (rev_fontsize > atoi(deffont))
1777 if (fontbuf != NULL)
1779 eina_strbuf_free(fontbuf);
1782 fontbuf = eina_strbuf_new();
1783 eina_strbuf_append_printf(fontbuf, "%d", rev_fontsize);
1784 _strbuf_key_value_replace(txtbuf, "font_size", eina_strbuf_string_get(fontbuf), 0);
1785 edje_object_part_text_set(wd->ent, "elm.text", eina_strbuf_string_get(txtbuf));
1787 eina_strbuf_free(fontbuf);
1789 } while (_is_width_over(obj) != 1);
1791 while (_is_width_over(obj))
1794 if (rev_fontsize < atoi(deffont))
1797 if (fontbuf != NULL)
1799 eina_strbuf_free(fontbuf);
1802 fontbuf = eina_strbuf_new();
1803 eina_strbuf_append_printf(fontbuf, "%d", rev_fontsize);
1804 _strbuf_key_value_replace(txtbuf, "font_size", eina_strbuf_string_get(fontbuf), 0);
1805 edje_object_part_text_set(wd->ent, "elm.text", eina_strbuf_string_get(txtbuf));
1806 eina_strbuf_free(fontbuf);
1811 if (txtbuf) eina_strbuf_free(txtbuf);
1817 _ellipsis_entry_to_width(Evas_Object *obj)
1819 Widget_Data *wd = elm_widget_data_get(obj);
1820 int cur_fontsize = 0, len, jumpcount;
1821 Eina_Strbuf *fontbuf = NULL, *txtbuf = NULL;
1822 char **kvalue = NULL;
1823 const char *minfont, *deffont, *maxfont;
1824 const char *ellipsis_string = "...";
1825 int minfontsize, maxfontsize, minshowcount;
1826 int i, tagend, cur_len;
1829 minshowcount = strlen(ellipsis_string) + 1;
1830 minfont = edje_object_data_get(wd->ent, "min_font_size");
1831 if (minfont) minfontsize = atoi(minfont);
1832 else minfontsize = 1;
1833 maxfont = edje_object_data_get(wd->ent, "max_font_size");
1834 if (maxfont) maxfontsize = atoi(maxfont);
1835 else maxfontsize = 1;
1836 deffont = edje_object_data_get(wd->ent, "default_font_size");
1837 if (deffont) cur_fontsize = atoi(deffont);
1838 else cur_fontsize = 1;
1839 if (minfontsize == maxfontsize || cur_fontsize == 1) return; // theme is not ready for ellipsis
1840 if (strlen(edje_object_part_text_get(wd->ent, "elm.text")) <= 0) return;
1842 if (_get_value_in_key_string(edje_object_part_text_get(wd->ent, "elm.text"), "font_size", &kvalue) == 0)
1844 if (*kvalue != NULL) cur_fontsize = atoi((char*)kvalue);
1847 txtbuf = eina_strbuf_new();
1848 eina_strbuf_append(txtbuf, edje_object_part_text_get(wd->ent, "elm.text"));
1850 while (_is_width_over(obj))
1852 if (wd->ellipsis_threshold == 0)
1853 wd->ellipsis_threshold = _entry_length_get(obj);
1854 if (cur_fontsize > minfontsize)
1857 if (fontbuf != NULL)
1859 eina_strbuf_free(fontbuf);
1862 fontbuf = eina_strbuf_new();
1863 eina_strbuf_append_printf(fontbuf, "%d", cur_fontsize);
1864 _strbuf_key_value_replace(txtbuf, "font_size", eina_strbuf_string_get(fontbuf), 0);
1865 edje_object_part_text_set(wd->ent, "elm.text", eina_strbuf_string_get(txtbuf));
1866 eina_strbuf_free(fontbuf);
1868 edje_object_part_text_cursor_end_set(wd->ent, "elm.text", EDJE_CURSOR_MAIN);
1872 len = _entry_length_get(obj);
1873 cur_str = edje_object_part_text_get(wd->ent, "elm.text");
1874 cur_len = strlen(cur_str);
1876 for (i = 0; i < len; i++)
1878 if(cur_str[i] == '>' && cur_str[i+1] != NULL &&
1879 cur_str[i+1] != '<')
1886 while (jumpcount < len-strlen(ellipsis_string))
1888 cur_str = edje_object_part_text_get(wd->ent, "elm.text");
1892 eina_strbuf_free(txtbuf);
1895 txtbuf = eina_strbuf_new();
1896 eina_strbuf_append_n(txtbuf, cur_str, tagend+1);
1897 eina_strbuf_append(txtbuf, ellipsis_string);
1898 eina_strbuf_append(txtbuf, cur_str+tagend+jumpcount+1);
1899 edje_object_part_text_set(wd->ent, "elm.text", eina_strbuf_string_get(txtbuf));
1900 edje_object_part_text_cursor_end_set(wd->ent, "elm.text", EDJE_CURSOR_MAIN);
1902 if (_is_width_over(obj))
1910 if (txtbuf) eina_strbuf_free(txtbuf);
1915 static int _textinput_control_function(void *data,void *input_data)
1917 /*calculate character count*/
1918 Evas_Object *entry = (Evas_Object *)data;
1919 Widget_Data *wd = elm_widget_data_get((Evas_Object *)data);
1922 size_t insert_text_len=0;
1923 char *text = edje_object_part_text_get(wd->ent, "elm.text");
1925 size_t remain_bytes;
1928 byte_len = strlen(text);/*no of bytes*/
1929 remain_bytes = wd->max_no_of_bytes-byte_len;
1930 sprintf(buf,"%d",remain_bytes);
1931 edje_object_part_text_set(wd->ent, "elm_entry_remain_byte_count", buf);
1934 insert_text = (char *)input_data;
1935 insert_text_len = strlen(insert_text);
1936 if(remain_bytes<insert_text_len)
1938 evas_object_smart_callback_call(entry, "maxlength,reached", NULL);
1941 if(byte_len>=wd->max_no_of_bytes)
1943 evas_object_smart_callback_call(entry, "maxlength,reached", NULL);
1952 * This adds an entry to @p parent object.
1954 * @param parent The parent object
1955 * @return The new object or NULL if it cannot be created
1960 elm_entry_add(Evas_Object *parent)
1962 Evas_Object *obj, *top;
1966 wd = ELM_NEW(Widget_Data);
1967 e = evas_object_evas_get(parent);
1968 wd->bgcolor = EINA_FALSE;
1969 wd->bg = evas_object_rectangle_add(e);
1970 evas_object_color_set(wd->bg, 0, 0, 0, 0);
1971 obj = elm_widget_add(e);
1972 ELM_SET_WIDTYPE(widtype, "entry");
1973 elm_widget_type_set(obj, "entry");
1974 elm_widget_sub_object_add(parent, obj);
1975 elm_widget_on_focus_hook_set(obj, _on_focus_hook, NULL);
1976 elm_widget_data_set(obj, wd);
1977 elm_widget_del_hook_set(obj, _del_hook);
1978 elm_widget_theme_hook_set(obj, _theme_hook);
1979 elm_widget_disable_hook_set(obj, _disable_hook);
1980 elm_widget_signal_emit_hook_set(obj, _signal_emit_hook);
1981 elm_widget_signal_callback_add_hook_set(obj, _signal_callback_add_hook);
1982 elm_widget_signal_callback_del_hook_set(obj, _signal_callback_del_hook);
1983 elm_widget_can_focus_set(obj, 1);
1984 #ifdef HAVE_CONFORMANT_AUTOSCROLL
1985 elm_widget_imp_region_get_hook_set(obj, _imp_region_get_hook, NULL);
1988 wd->linewrap = EINA_TRUE;
1989 wd->ellipsis = EINA_FALSE;
1990 wd->char_linewrap= EINA_FALSE;
1991 wd->editable = EINA_TRUE;
1992 wd->disabled = EINA_FALSE;
1993 wd->context_menu = EINA_TRUE;
1995 wd->ellipsis_threshold = 0;
1997 wd->ent = edje_object_add(e);
1998 edje_object_item_provider_set(wd->ent, _get_item, obj);
1999 evas_object_event_callback_add(wd->ent, EVAS_CALLBACK_MOVE, _move, obj);
2000 evas_object_event_callback_add(wd->ent, EVAS_CALLBACK_RESIZE, _resize, obj);
2001 evas_object_event_callback_add(wd->ent, EVAS_CALLBACK_MOUSE_DOWN,
2003 evas_object_event_callback_add(wd->ent, EVAS_CALLBACK_MOUSE_UP,
2005 evas_object_event_callback_add(wd->ent, EVAS_CALLBACK_MOUSE_MOVE,
2008 _elm_theme_object_set(obj, wd->ent, "entry", "base", "default");
2009 edje_object_signal_callback_add(wd->ent, "entry,changed", "elm.text",
2010 _signal_entry_changed, obj);
2011 edje_object_signal_callback_add(wd->ent, "selection,start", "elm.text",
2012 _signal_selection_start, obj);
2013 edje_object_signal_callback_add(wd->ent, "selection,changed", "elm.text",
2014 _signal_selection_changed, obj);
2015 edje_object_signal_callback_add(wd->ent, "selection,cleared", "elm.text",
2016 _signal_selection_cleared, obj);
2017 edje_object_signal_callback_add(wd->ent, "entry,paste,request", "elm.text",
2018 _signal_entry_paste_request, obj);
2019 edje_object_signal_callback_add(wd->ent, "entry,copy,notify", "elm.text",
2020 _signal_entry_copy_notify, obj);
2021 edje_object_signal_callback_add(wd->ent, "entry,cut,notify", "elm.text",
2022 _signal_entry_cut_notify, obj);
2023 edje_object_signal_callback_add(wd->ent, "cursor,changed", "elm.text",
2024 _signal_cursor_changed, obj);
2025 edje_object_signal_callback_add(wd->ent, "anchor,mouse,down,*", "elm.text",
2026 _signal_anchor_down, obj);
2027 edje_object_signal_callback_add(wd->ent, "anchor,mouse,up,*", "elm.text",
2028 _signal_anchor_up, obj);
2029 edje_object_signal_callback_add(wd->ent, "anchor,mouse,move,*", "elm.text",
2030 _signal_anchor_move, obj);
2031 edje_object_signal_callback_add(wd->ent, "anchor,mouse,in,*", "elm.text",
2032 _signal_anchor_in, obj);
2033 edje_object_signal_callback_add(wd->ent, "anchor,mouse,out,*", "elm.text",
2034 _signal_anchor_out, obj);
2035 edje_object_signal_callback_add(wd->ent, "entry,key,enter", "elm.text",
2036 _signal_key_enter, obj);
2037 edje_object_signal_callback_add(wd->ent, "mouse,down,1", "elm.text",
2038 _signal_mouse_down, obj);
2039 edje_object_signal_callback_add(wd->ent, "mouse,up,1", "elm.text",
2040 _signal_mouse_up, obj);
2041 edje_object_signal_callback_add(wd->ent, "mouse,down,1,double", "elm.text",
2042 _signal_mouse_double, obj);
2043 edje_object_part_text_set(wd->ent, "elm.text", "");
2044 elm_widget_resize_object_set(obj, wd->ent);
2047 wd->input_panel_enable = edje_object_part_text_input_panel_enabled_get(wd->ent, "elm.text");
2049 #ifdef HAVE_ELEMENTARY_X
2050 top = elm_widget_top_get(obj);
2051 if ((top) && (elm_win_xwindow_get(top)))
2053 wd->sel_notify_handler =
2054 ecore_event_handler_add(ECORE_X_EVENT_SELECTION_NOTIFY,
2055 _event_selection_notify, obj);
2056 wd->sel_clear_handler =
2057 ecore_event_handler_add(ECORE_X_EVENT_SELECTION_CLEAR,
2058 _event_selection_clear, obj);
2061 elm_drop_target_add(obj, ELM_SEL_FORMAT_MARKUP,_drag_drop_cb, NULL);
2064 entries = eina_list_prepend(entries, obj);
2066 // module - find module for entry
2067 wd->api = _module(obj);
2068 // if found - hook in
2069 if ((wd->api) && (wd->api->obj_hook)) wd->api->obj_hook(obj);
2071 // TODO: convert Elementary to subclassing of Evas_Smart_Class
2072 // TODO: and save some bytes, making descriptions per-class and not instance!
2073 evas_object_smart_callbacks_descriptions_set(obj, _signals);
2077 EAPI void elm_entry_extension_module_data_get(Evas_Object *obj,Elm_Entry_Extension_data *ext_mod)
2079 ELM_CHECK_WIDTYPE(obj, widtype);
2080 Widget_Data *wd = elm_widget_data_get(obj);
2082 ext_mod->cancel = _cancel;
2083 ext_mod->copy = _copy;
2084 ext_mod->cut = _cut;
2085 ext_mod->paste = _paste;
2086 ext_mod->select = _select;
2087 ext_mod->selectall = NULL; /* to be implemented*/
2088 ext_mod->ent = wd->ent;
2089 ext_mod->items = wd->items;
2090 ext_mod->longpress_timer = wd->longpress_timer;
2091 ext_mod->editable = wd->editable;
2092 ext_mod->have_selection = wd->have_selection;
2093 ext_mod->password = wd->password;
2094 ext_mod->selmode = wd->selmode;
2095 ext_mod->cnpinit = _cnpinit;
2096 ext_mod->context_menu = wd->context_menu;
2100 * This sets the entry object not to line wrap. All input will
2101 * be on a single line, and the entry box will extend with user input.
2103 * @param obj The entry object
2104 * @param single_line If true, the text in the entry
2105 * will be on a single line.
2110 elm_entry_single_line_set(Evas_Object *obj, Eina_Bool single_line)
2112 ELM_CHECK_WIDTYPE(obj, widtype);
2113 Widget_Data *wd = elm_widget_data_get(obj);
2115 Ecore_IMF_Context *ic;
2117 if (wd->single_line == single_line) return;
2118 wd->single_line = single_line;
2119 wd->linewrap = EINA_FALSE;
2120 wd->char_linewrap = EINA_FALSE;
2121 t = eina_stringshare_add(elm_entry_entry_get(obj));
2122 _elm_theme_object_set(obj, wd->ent, "entry", _getbase(obj), elm_widget_style_get(obj));
2123 elm_entry_entry_set(obj, t);
2124 edje_object_part_text_autocapitalization_set(wd->ent, "elm.text", wd->autocapital);
2125 edje_object_part_text_autoperiod_set(wd->ent, "elm.text", wd->autoperiod);
2126 ic = elm_entry_imf_context_get(obj);
2129 ecore_imf_context_input_panel_layout_set(ic, wd->input_panel_layout);
2132 eina_stringshare_del(t);
2137 * This returns true if the entry has been set to single line mode.
2138 * See also elm_entry_single_line_set().
2140 * @param obj The entry object
2141 * @return single_line If true, the text in the entry is set to display
2147 elm_entry_single_line_get(const Evas_Object *obj)
2149 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2150 Widget_Data *wd = elm_widget_data_get(obj);
2151 if (!wd) return EINA_FALSE;
2152 return wd->single_line;
2156 * This set's the maximum bytes that can be added in entry.
2158 * @param obj The entry object
2159 * @param max_no_of_bytes Maximum number of bytes entry can have.
2164 elm_entry_maximum_bytes_set(Evas_Object *obj, int max_no_of_bytes)
2166 Widget_Data *wd = elm_widget_data_get(obj);
2168 wd->max_no_of_bytes = max_no_of_bytes;
2169 edje_object_signal_emit(wd->ent, "elm,state,remain,bytes,show", "elm");
2170 edje_object_part_textinput_callback_set(wd->ent, "elm.text", _textinput_control_function,obj);
2175 * This sets the entry object to password mode. All text entered
2176 * and/or displayed within the widget will be replaced with asterisks (*).
2178 * @param obj The entry object
2179 * @param password If true, password mode is enabled.
2184 elm_entry_password_set(Evas_Object *obj, Eina_Bool password)
2186 ELM_CHECK_WIDTYPE(obj, widtype);
2187 Widget_Data *wd = elm_widget_data_get(obj);
2188 Ecore_IMF_Context *ic;
2191 if (wd->password == password) return;
2192 wd->password = password;
2193 wd->single_line = EINA_TRUE;
2194 wd->linewrap = EINA_FALSE;
2195 wd->char_linewrap = EINA_FALSE;
2196 if (_elm_config->password_show_last_character)
2197 wd->show_last_character = EINA_TRUE;
2198 t = eina_stringshare_add(elm_entry_entry_get(obj));
2199 _elm_theme_object_set(obj, wd->ent, "entry", _getbase(obj), elm_widget_style_get(obj));
2200 elm_entry_entry_set(obj, t);
2206 elm_entry_autoperiod_set(obj, EINA_FALSE);
2209 if (wd->autocapital)
2211 elm_entry_autocapitalization_set(obj, EINA_FALSE);
2215 ic = elm_entry_imf_context_get(obj);
2218 ecore_imf_context_input_panel_layout_set(ic, wd->input_panel_layout);
2221 eina_stringshare_del(t);
2226 * This set's the entry in password mode with out masking the last character entered by user,
2227 * and later masking the character after 2 seconds.
2229 * @param obj The entry object
2230 * @param show_last_character The show_last_character flag (1 for "password mode along with showing last character"
2236 elm_entry_password_show_last_character_set(Evas_Object *obj, Eina_Bool show_last_character)
2238 Widget_Data *wd = elm_widget_data_get(obj);
2241 if ((wd->password == show_last_character)&&(wd->show_last_character ==show_last_character)) return;
2242 wd->show_last_character = show_last_character;
2243 wd->password = show_last_character;
2244 wd->single_line = EINA_TRUE;
2245 wd->linewrap = EINA_FALSE;
2246 wd->char_linewrap = EINA_FALSE;
2247 t = eina_stringshare_add(elm_entry_entry_get(obj));
2248 _elm_theme_object_set(obj, wd->ent, "entry", _getbase(obj), elm_widget_style_get(obj));
2249 elm_entry_entry_set(obj, t);
2250 eina_stringshare_del(t);
2255 * This returns whether password mode is enabled.
2256 * See also elm_entry_password_set().
2258 * @param obj The entry object
2259 * @return If true, the entry is set to display all characters
2265 elm_entry_password_get(const Evas_Object *obj)
2267 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2268 Widget_Data *wd = elm_widget_data_get(obj);
2269 if (!wd) return EINA_FALSE;
2270 return wd->password;
2274 * This sets the text displayed within the entry to @p entry.
2276 * @param obj The entry object
2277 * @param entry The text to be displayed
2282 elm_entry_entry_set(Evas_Object *obj, const char *entry)
2284 ELM_CHECK_WIDTYPE(obj, widtype);
2285 Widget_Data *wd = elm_widget_data_get(obj);
2287 if (!entry) entry = "";
2288 if(wd->max_no_of_bytes)
2290 int len = strlen(entry);
2291 if(len > wd->max_no_of_bytes)
2293 ERR("[ERROR]the length of the text set is more than max no of bytes, text cannot be set");
2297 edje_object_part_text_set(wd->ent, "elm.text", entry);
2298 if (wd->text) eina_stringshare_del(wd->text);
2300 wd->changed = EINA_TRUE;
2305 * This returns the text currently shown in object @p entry.
2306 * See also elm_entry_entry_set().
2308 * @param obj The entry object
2309 * @return The currently displayed text or NULL on failure
2314 elm_entry_entry_get(const Evas_Object *obj)
2316 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
2317 Widget_Data *wd = elm_widget_data_get(obj);
2319 if (!wd) return NULL;
2321 if ((wd->text)&&(wd->password))
2322 return elm_entry_markup_to_utf8(wd->text);
2324 if (wd->text) return wd->text;
2325 text = edje_object_part_text_get(wd->ent, "elm.text");
2328 ERR("text=NULL for edje %p, part 'elm.text'", wd->ent);
2331 eina_stringshare_replace(&wd->text, text);
2332 if(wd->password)return elm_entry_markup_to_utf8(wd->text);
2337 * This returns all selected text within the entry.
2339 * @param obj The entry object
2340 * @return The selected text within the entry or NULL on failure
2345 elm_entry_selection_get(const Evas_Object *obj)
2347 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
2348 Widget_Data *wd = elm_widget_data_get(obj);
2349 if (!wd) return NULL;
2350 return edje_object_part_text_selection_get(wd->ent, "elm.text");
2354 * This inserts text in @p entry at the beginning of the entry
2357 * @param obj The entry object
2358 * @param entry The text to insert
2363 elm_entry_entry_insert(Evas_Object *obj, const char *entry)
2365 ELM_CHECK_WIDTYPE(obj, widtype);
2366 Widget_Data *wd = elm_widget_data_get(obj);
2368 edje_object_part_text_insert(wd->ent, "elm.text", entry);
2370 if (cnpwidgetdata == obj)
2371 ecore_x_selection_secondary_set(elm_win_xwindow_get(obj), "",1);
2373 wd->changed = EINA_TRUE;
2378 * This enables word line wrapping in the entry object. It is the opposite
2379 * of elm_entry_single_line_set(). Additionally, setting this disables
2380 * character line wrapping.
2381 * See also elm_entry_line_char_wrap_set().
2383 * @param obj The entry object
2384 * @param wrap If true, the entry will be wrapped once it reaches the end
2385 * of the object. Wrapping will occur at the end of the word before the end of the
2391 elm_entry_line_wrap_set(Evas_Object *obj, Eina_Bool wrap)
2393 ELM_CHECK_WIDTYPE(obj, widtype);
2394 Widget_Data *wd = elm_widget_data_get(obj);
2397 if (wd->linewrap == wrap) return;
2398 wd->linewrap = wrap;
2400 wd->char_linewrap = EINA_FALSE;
2401 t = eina_stringshare_add(elm_entry_entry_get(obj));
2402 _elm_theme_object_set(obj, wd->ent, "entry", _getbase(obj), elm_widget_style_get(obj));
2403 elm_entry_entry_set(obj, t);
2404 eina_stringshare_del(t);
2409 * Set wrap width of the entry
2411 * @param obj The entry object
2412 * @param w The wrap width in pixels at a minimum where words need to wrap
2416 elm_entry_wrap_width_set(Evas_Object *obj, Evas_Coord w)
2418 Widget_Data *wd = elm_widget_data_get(obj);
2419 if (wd->wrap_w == w) return;
2425 * get wrap width of the entry
2427 * @param obj The entry object
2428 * @return The wrap width in pixels at a minimum where words need to wrap
2432 elm_entry_wrap_width_get(const Evas_Object *obj)
2434 Widget_Data *wd = elm_widget_data_get(obj);
2439 * This enables character line wrapping in the entry object. It is the opposite
2440 * of elm_entry_single_line_set(). Additionally, setting this disables
2441 * word line wrapping.
2442 * See also elm_entry_line_wrap_set().
2444 * @param obj The entry object
2445 * @param wrap If true, the entry will be wrapped once it reaches the end
2446 * of the object. Wrapping will occur immediately upon reaching the end of the object.
2451 elm_entry_line_char_wrap_set(Evas_Object *obj, Eina_Bool wrap)
2453 ELM_CHECK_WIDTYPE(obj, widtype);
2454 Widget_Data *wd = elm_widget_data_get(obj);
2457 if (wd->char_linewrap == wrap) return;
2458 wd->char_linewrap = wrap;
2459 if(wd->char_linewrap)
2460 wd->linewrap = EINA_FALSE;
2461 t = eina_stringshare_add(elm_entry_entry_get(obj));
2462 _elm_theme_object_set(obj, wd->ent, "entry", _getbase(obj), elm_widget_style_get(obj));
2463 elm_entry_entry_set(obj, t);
2464 eina_stringshare_del(t);
2469 * This sets the editable attribute of the entry.
2471 * @param obj The entry object
2472 * @param editable If true, the entry will be editable by the user.
2473 * If false, it will be set to the disabled state.
2478 elm_entry_editable_set(Evas_Object *obj, Eina_Bool editable)
2480 ELM_CHECK_WIDTYPE(obj, widtype);
2481 Widget_Data *wd = elm_widget_data_get(obj);
2484 if (wd->editable == editable) return;
2485 wd->editable = editable;
2486 t = eina_stringshare_add(elm_entry_entry_get(obj));
2487 _elm_theme_object_set(obj, wd->ent, "entry", _getbase(obj), elm_widget_style_get(obj));
2488 elm_entry_entry_set(obj, t);
2489 eina_stringshare_del(t);
2492 #ifdef HAVE_ELEMENTARY_X
2494 elm_drop_target_add(obj, ELM_SEL_FORMAT_MARKUP, _drag_drop_cb, NULL);
2496 elm_drop_target_del(obj);
2501 * This gets the editable attribute of the entry.
2502 * See also elm_entry_editable_set().
2504 * @param obj The entry object
2505 * @return If true, the entry is editable by the user.
2506 * If false, it is not editable by the user
2511 elm_entry_editable_get(const Evas_Object *obj)
2513 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2514 Widget_Data *wd = elm_widget_data_get(obj);
2515 if (!wd) return EINA_FALSE;
2516 return wd->editable;
2520 * This drops any existing text selection within the entry.
2522 * @param obj The entry object
2527 elm_entry_select_none(Evas_Object *obj)
2529 ELM_CHECK_WIDTYPE(obj, widtype);
2530 Widget_Data *wd = elm_widget_data_get(obj);
2534 wd->selmode = EINA_FALSE;
2535 edje_object_part_text_select_allow_set(wd->ent, "elm.text", EINA_FALSE);
2536 edje_object_signal_emit(wd->ent, "elm,state,select,off", "elm");
2538 wd->have_selection = EINA_FALSE;
2539 edje_object_part_text_select_none(wd->ent, "elm.text");
2543 * This selects all text within the entry.
2545 * @param obj The entry object
2550 elm_entry_select_all(Evas_Object *obj)
2552 ELM_CHECK_WIDTYPE(obj, widtype);
2553 Widget_Data *wd = elm_widget_data_get(obj);
2557 wd->selmode = EINA_FALSE;
2558 edje_object_part_text_select_allow_set(wd->ent, "elm.text", EINA_FALSE);
2559 edje_object_signal_emit(wd->ent, "elm,state,select,off", "elm");
2561 wd->have_selection = EINA_TRUE;
2562 edje_object_part_text_select_all(wd->ent, "elm.text");
2566 * This moves the cursor one place to the right within the entry.
2568 * @param obj The entry object
2569 * @return EINA_TRUE upon success, EINA_FALSE upon failure
2574 elm_entry_cursor_next(Evas_Object *obj)
2576 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2577 Widget_Data *wd = elm_widget_data_get(obj);
2578 if (!wd) return EINA_FALSE;
2579 return edje_object_part_text_cursor_next(wd->ent, "elm.text", EDJE_CURSOR_MAIN);
2583 * This moves the cursor one place to the left within the entry.
2585 * @param obj The entry object
2586 * @return EINA_TRUE upon success, EINA_FALSE upon failure
2591 elm_entry_cursor_prev(Evas_Object *obj)
2593 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2594 Widget_Data *wd = elm_widget_data_get(obj);
2595 if (!wd) return EINA_FALSE;
2596 return edje_object_part_text_cursor_prev(wd->ent, "elm.text", EDJE_CURSOR_MAIN);
2600 * This moves the cursor one line up within the entry.
2602 * @param obj The entry object
2603 * @return EINA_TRUE upon success, EINA_FALSE upon failure
2608 elm_entry_cursor_up(Evas_Object *obj)
2610 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2611 Widget_Data *wd = elm_widget_data_get(obj);
2612 if (!wd) return EINA_FALSE;
2613 return edje_object_part_text_cursor_up(wd->ent, "elm.text", EDJE_CURSOR_MAIN);
2617 * This moves the cursor one line down within the entry.
2619 * @param obj The entry object
2620 * @return EINA_TRUE upon success, EINA_FALSE upon failure
2625 elm_entry_cursor_down(Evas_Object *obj)
2627 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2628 Widget_Data *wd = elm_widget_data_get(obj);
2629 if (!wd) return EINA_FALSE;
2630 return edje_object_part_text_cursor_down(wd->ent, "elm.text", EDJE_CURSOR_MAIN);
2634 * This moves the cursor to the beginning of the entry.
2636 * @param obj The entry object
2641 elm_entry_cursor_begin_set(Evas_Object *obj)
2643 ELM_CHECK_WIDTYPE(obj, widtype);
2644 Widget_Data *wd = elm_widget_data_get(obj);
2646 edje_object_part_text_cursor_begin_set(wd->ent, "elm.text", EDJE_CURSOR_MAIN);
2650 * This moves the cursor to the end of the entry.
2652 * @param obj The entry object
2657 elm_entry_cursor_end_set(Evas_Object *obj)
2659 ELM_CHECK_WIDTYPE(obj, widtype);
2660 Widget_Data *wd = elm_widget_data_get(obj);
2662 edje_object_part_text_cursor_end_set(wd->ent, "elm.text", EDJE_CURSOR_MAIN);
2666 * This moves the cursor to the beginning of the current line.
2668 * @param obj The entry object
2673 elm_entry_cursor_line_begin_set(Evas_Object *obj)
2675 ELM_CHECK_WIDTYPE(obj, widtype);
2676 Widget_Data *wd = elm_widget_data_get(obj);
2678 edje_object_part_text_cursor_line_begin_set(wd->ent, "elm.text", EDJE_CURSOR_MAIN);
2682 * This moves the cursor to the end of the current line.
2684 * @param obj The entry object
2689 elm_entry_cursor_line_end_set(Evas_Object *obj)
2691 ELM_CHECK_WIDTYPE(obj, widtype);
2692 Widget_Data *wd = elm_widget_data_get(obj);
2694 edje_object_part_text_cursor_line_end_set(wd->ent, "elm.text", EDJE_CURSOR_MAIN);
2698 * This begins a selection within the entry as though
2699 * the user were holding down the mouse button to make a selection.
2701 * @param obj The entry object
2706 elm_entry_cursor_selection_begin(Evas_Object *obj)
2708 ELM_CHECK_WIDTYPE(obj, widtype);
2709 Widget_Data *wd = elm_widget_data_get(obj);
2711 edje_object_part_text_select_begin(wd->ent, "elm.text");
2715 * This ends a selection within the entry as though
2716 * the user had just released the mouse button while making a selection.
2718 * @param obj The entry object
2723 elm_entry_cursor_selection_end(Evas_Object *obj)
2725 ELM_CHECK_WIDTYPE(obj, widtype);
2726 Widget_Data *wd = elm_widget_data_get(obj);
2728 edje_object_part_text_select_extend(wd->ent, "elm.text");
2732 * TODO: fill this in
2734 * @param obj The entry object
2735 * @return TODO: fill this in
2740 elm_entry_cursor_is_format_get(const Evas_Object *obj)
2742 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2743 Widget_Data *wd = elm_widget_data_get(obj);
2744 if (!wd) return EINA_FALSE;
2745 return edje_object_part_text_cursor_is_format_get(wd->ent, "elm.text", EDJE_CURSOR_MAIN);
2749 * This returns whether the cursor is visible.
2751 * @param obj The entry object
2752 * @return If true, the cursor is visible.
2757 elm_entry_cursor_is_visible_format_get(const Evas_Object *obj)
2759 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2760 Widget_Data *wd = elm_widget_data_get(obj);
2761 if (!wd) return EINA_FALSE;
2762 return edje_object_part_text_cursor_is_visible_format_get(wd->ent, "elm.text", EDJE_CURSOR_MAIN);
2766 * TODO: fill this in
2768 * @param obj The entry object
2769 * @return TODO: fill this in
2774 elm_entry_cursor_content_get(const Evas_Object *obj)
2776 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
2777 Widget_Data *wd = elm_widget_data_get(obj);
2778 if (!wd) return NULL;
2779 return edje_object_part_text_cursor_content_get(wd->ent, "elm.text", EDJE_CURSOR_MAIN);
2783 * This executes a "cut" action on the selected text in the entry.
2785 * @param obj The entry object
2790 elm_entry_selection_cut(Evas_Object *obj)
2792 ELM_CHECK_WIDTYPE(obj, widtype);
2793 Widget_Data *wd = elm_widget_data_get(obj);
2795 _cut(obj, NULL, NULL);
2799 * This executes a "copy" action on the selected text in the entry.
2801 * @param obj The entry object
2806 elm_entry_selection_copy(Evas_Object *obj)
2808 ELM_CHECK_WIDTYPE(obj, widtype);
2809 Widget_Data *wd = elm_widget_data_get(obj);
2811 _copy(obj, NULL, NULL);
2815 * This executes a "paste" action in the entry.
2817 * @param obj The entry object
2822 elm_entry_selection_paste(Evas_Object *obj)
2824 ELM_CHECK_WIDTYPE(obj, widtype);
2825 Widget_Data *wd = elm_widget_data_get(obj);
2827 _paste(obj, NULL, NULL);
2831 * This clears and frees the items in a entry's contextual (right click) menu.
2833 * @param obj The entry object
2838 elm_entry_context_menu_clear(Evas_Object *obj)
2840 ELM_CHECK_WIDTYPE(obj, widtype);
2841 Widget_Data *wd = elm_widget_data_get(obj);
2842 Elm_Entry_Context_Menu_Item *it;
2844 EINA_LIST_FREE(wd->items, it)
2846 eina_stringshare_del(it->label);
2847 eina_stringshare_del(it->icon_file);
2848 eina_stringshare_del(it->icon_group);
2854 * This adds an item to the entry's contextual menu.
2856 * @param obj The entry object
2857 * @param label The item's text label
2858 * @param icon_file The item's icon file
2859 * @param icon_type The item's icon type
2860 * @param func The callback to execute when the item is clicked
2861 * @param data The data to associate with the item for related functions
2866 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)
2868 ELM_CHECK_WIDTYPE(obj, widtype);
2869 Widget_Data *wd = elm_widget_data_get(obj);
2870 Elm_Entry_Context_Menu_Item *it;
2872 it = calloc(1, sizeof(Elm_Entry_Context_Menu_Item));
2874 wd->items = eina_list_append(wd->items, it);
2876 it->label = eina_stringshare_add(label);
2877 it->icon_file = eina_stringshare_add(icon_file);
2878 it->icon_type = icon_type;
2880 it->data = (void *)data;
2884 * This disables the entry's contextual (right click) menu.
2886 * @param obj The entry object
2887 * @param disabled If true, the menu is disabled
2892 elm_entry_context_menu_disabled_set(Evas_Object *obj, Eina_Bool disabled)
2894 ELM_CHECK_WIDTYPE(obj, widtype);
2895 Widget_Data *wd = elm_widget_data_get(obj);
2897 if (wd->context_menu == !disabled) return;
2898 wd->context_menu = !disabled;
2902 * This returns whether the entry's contextual (right click) menu is disabled.
2904 * @param obj The entry object
2905 * @return If true, the menu is disabled
2910 elm_entry_context_menu_disabled_get(const Evas_Object *obj)
2912 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2913 Widget_Data *wd = elm_widget_data_get(obj);
2914 if (!wd) return EINA_FALSE;
2915 return !wd->context_menu;
2919 * This appends a custom item provider to the list for that entry
2921 * This appends the given callback. The list is walked from beginning to end
2922 * with each function called given the item href string in the text. If the
2923 * function returns an object handle other than NULL (it should create an
2924 * and object to do this), then this object is used to replace that item. If
2925 * not the next provider is called until one provides an item object, or the
2926 * default provider in entry does.
2928 * @param obj The entry object
2929 * @param func The function called to provide the item object
2930 * @param data The data passed to @p func
2935 elm_entry_item_provider_append(Evas_Object *obj, Evas_Object *(*func) (void *data, Evas_Object *entry, const char *item), void *data)
2937 ELM_CHECK_WIDTYPE(obj, widtype);
2938 Widget_Data *wd = elm_widget_data_get(obj);
2941 Elm_Entry_Item_Provider *ip = calloc(1, sizeof(Elm_Entry_Item_Provider));
2945 wd->item_providers = eina_list_append(wd->item_providers, ip);
2949 * This prepends a custom item provider to the list for that entry
2951 * This prepends the given callback. See elm_entry_item_provider_append() for
2954 * @param obj The entry object
2955 * @param func The function called to provide the item object
2956 * @param data The data passed to @p func
2961 elm_entry_item_provider_prepend(Evas_Object *obj, Evas_Object *(*func) (void *data, Evas_Object *entry, const char *item), void *data)
2963 ELM_CHECK_WIDTYPE(obj, widtype);
2964 Widget_Data *wd = elm_widget_data_get(obj);
2967 Elm_Entry_Item_Provider *ip = calloc(1, sizeof(Elm_Entry_Item_Provider));
2971 wd->item_providers = eina_list_prepend(wd->item_providers, ip);
2975 * This removes a custom item provider to the list for that entry
2977 * This removes the given callback. See elm_entry_item_provider_append() for
2980 * @param obj The entry object
2981 * @param func The function called to provide the item object
2982 * @param data The data passed to @p func
2987 elm_entry_item_provider_remove(Evas_Object *obj, Evas_Object *(*func) (void *data, Evas_Object *entry, const char *item), void *data)
2989 ELM_CHECK_WIDTYPE(obj, widtype);
2990 Widget_Data *wd = elm_widget_data_get(obj);
2992 Elm_Entry_Item_Provider *ip;
2995 EINA_LIST_FOREACH(wd->item_providers, l, ip)
2997 if ((ip->func == func) && (ip->data == data))
2999 wd->item_providers = eina_list_remove_list(wd->item_providers, l);
3007 * This converts a markup (HTML-like) string into UTF-8.
3009 * @param s The string (in markup) to be converted
3010 * @return The converted string (in UTF-8)
3015 elm_entry_markup_to_utf8(const char *s)
3017 char *ss = _mkup_to_text(s);
3018 if (!ss) ss = strdup("");
3023 * This converts a UTF-8 string into markup (HTML-like).
3025 * @param s The string (in UTF-8) to be converted
3026 * @return The converted string (in markup)
3031 elm_entry_utf8_to_markup(const char *s)
3033 char *ss = _text_to_mkup(s);
3034 if (!ss) ss = strdup("");
3039 * Get the input method context in the entry widget
3041 * @param obj The entry object
3042 * @return The input method context
3046 EAPI Ecore_IMF_Context *elm_entry_imf_context_get(Evas_Object *obj)
3048 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
3049 Widget_Data *wd = elm_widget_data_get(obj);
3050 if (!wd || !wd->ent) return NULL;
3052 return edje_object_part_text_imf_context_get(wd->ent, "elm.text");
3056 * Set whether entry should enable the return key on soft keyboard automatically
3058 * @param obj The entry object
3059 * @param on If true, entry enables the return key on soft keyboard automatically.
3064 elm_entry_autoenable_returnkey_set(Evas_Object *obj, Eina_Bool on)
3066 ELM_CHECK_WIDTYPE(obj, widtype);
3067 Widget_Data *wd = elm_widget_data_get(obj);
3070 wd->autoreturnkey = on;
3071 _check_enable_returnkey(obj);
3075 * Set whether entry should support auto capitalization
3077 * @param obj The entry object
3078 * @param on If true, entry suports auto capitalization.
3083 elm_entry_autocapitalization_set(Evas_Object *obj, Eina_Bool autocap)
3085 ELM_CHECK_WIDTYPE(obj, widtype);
3086 Widget_Data *wd = elm_widget_data_get(obj);
3090 wd->autocapital = EINA_FALSE;
3092 wd->autocapital = autocap;
3094 if (wd->input_panel_layout == ELM_INPUT_PANEL_LAYOUT_URL ||
3095 wd->input_panel_layout == ELM_INPUT_PANEL_LAYOUT_EMAIL)
3096 wd->autocapital = EINA_FALSE;
3098 edje_object_part_text_autocapitalization_set(wd->ent, "elm.text", wd->autocapital);
3102 * Set whether entry should support auto period
3104 * @param obj The entry object
3105 * @param on If true, entry suports auto period.
3110 elm_entry_autoperiod_set(Evas_Object *obj, Eina_Bool autoperiod)
3112 ELM_CHECK_WIDTYPE(obj, widtype);
3113 Widget_Data *wd = elm_widget_data_get(obj);
3117 wd->autoperiod = EINA_FALSE;
3119 wd->autoperiod = autoperiod;
3121 if (wd->input_panel_layout == ELM_INPUT_PANEL_LAYOUT_URL ||
3122 wd->input_panel_layout == ELM_INPUT_PANEL_LAYOUT_EMAIL)
3123 wd->autoperiod = EINA_FALSE;
3125 edje_object_part_text_autoperiod_set(wd->ent, "elm.text", wd->autoperiod);
3129 * Set the font size on the entry object
3131 * @param obj The entry object
3132 * @param size font size
3137 elm_entry_fontsize_set(Evas_Object *obj, int fontsize)
3139 ELM_CHECK_WIDTYPE(obj, widtype);
3140 Widget_Data *wd = elm_widget_data_get(obj);
3141 Eina_Strbuf *fontbuf = NULL;
3146 t = eina_stringshare_add(elm_entry_entry_get(obj));
3147 fontbuf = eina_strbuf_new();
3148 eina_strbuf_append_printf(fontbuf, "%d", fontsize);
3150 if (fontsize == 0) removeflag = 1; // remove fontsize tag
3152 if (_stringshare_key_value_replace(&t, "font_size", eina_strbuf_string_get(fontbuf), removeflag) == 0)
3154 elm_entry_entry_set(obj, t);
3158 eina_strbuf_free(fontbuf);
3159 eina_stringshare_del(t);
3163 * Set the text align on the entry object
3165 * @param obj The entry object
3166 * @param align align mode
3171 elm_entry_text_align_set(Evas_Object *obj, const char *alignmode)
3173 ELM_CHECK_WIDTYPE(obj, widtype);
3174 Widget_Data *wd = elm_widget_data_get(obj);
3179 t = eina_stringshare_add(elm_entry_entry_get(obj));
3181 if (len <= 0) return;
3183 if (_stringshare_key_value_replace(&t, "align", alignmode, 0) == 0)
3184 elm_entry_entry_set(obj, t);
3188 eina_stringshare_del(t);
3192 * Set the text color on the entry object
3194 * @param obj The entry object
3195 * @param r Red property background color of The entry object
3196 * @param g Green property background color of The entry object
3197 * @param b Blue property background color of The entry object
3198 * @param a Alpha property background alpha of The entry object
3203 elm_entry_text_color_set(Evas_Object *obj, unsigned int r, unsigned int g, unsigned int b, unsigned int a)
3205 ELM_CHECK_WIDTYPE(obj, widtype);
3206 Widget_Data *wd = elm_widget_data_get(obj);
3207 Eina_Strbuf *colorbuf = NULL;
3212 t = eina_stringshare_add(elm_entry_entry_get(obj));
3214 if (len <= 0) return;
3215 colorbuf = eina_strbuf_new();
3216 eina_strbuf_append_printf(colorbuf, "#%02X%02X%02X%02X", r, g, b, a);
3218 if (_stringshare_key_value_replace(&t, "color", eina_strbuf_string_get(colorbuf), 0) == 0)
3220 elm_entry_entry_set(obj, t);
3224 eina_strbuf_free(colorbuf);
3225 eina_stringshare_del(t);
3230 * Set background color of the entry
3232 * @param obj The entry object
3233 * @param r Red property background color of The entry object
3234 * @param g Green property background color of The entry object
3235 * @param b Blue property background color of The entry object
3236 * @param a Alpha property background alpha of The entry object
3240 elm_entry_background_color_set(Evas_Object *obj, unsigned int r, unsigned int g, unsigned int b, unsigned int a)
3242 ELM_CHECK_WIDTYPE(obj, widtype);
3243 Widget_Data *wd = elm_widget_data_get(obj);
3244 evas_object_color_set(wd->bg, r, g, b, a);
3246 if (wd->bgcolor == EINA_FALSE)
3249 edje_object_part_swallow(wd->ent, "entry.swallow.background", wd->bg);
3254 * Set the ellipsis behavior of the entry
3256 * @param obj The entry object
3257 * @param ellipsis To ellipsis text or not
3261 elm_entry_ellipsis_set(Evas_Object *obj, Eina_Bool ellipsis)
3263 ELM_CHECK_WIDTYPE(obj, widtype);
3264 Widget_Data *wd = elm_widget_data_get(obj);
3265 if (wd->ellipsis == ellipsis) return;
3266 wd->ellipsis = ellipsis;
3272 * This sets the attribute to show the input panel automatically.
3274 * @param obj The entry object
3275 * @param enabled If true, the input panel is appeared when entry is clicked or has a focus
3280 elm_entry_input_panel_enabled_set(Evas_Object *obj, Eina_Bool enabled)
3282 ELM_CHECK_WIDTYPE(obj, widtype);
3283 Widget_Data *wd = elm_widget_data_get(obj);
3286 wd->input_panel_enable = enabled;
3287 edje_object_part_text_input_panel_enabled_set(wd->ent, "elm.text", enabled);
3291 * Set the input panel layout of the entry
3293 * @param obj The entry object
3294 * @param layout the layout to set
3299 elm_entry_input_panel_layout_set(Evas_Object *obj, Elm_Input_Panel_Layout layout)
3301 ELM_CHECK_WIDTYPE(obj, widtype);
3302 Widget_Data *wd = elm_widget_data_get(obj);
3305 Ecore_IMF_Context *ic = elm_entry_imf_context_get(obj);
3308 wd->input_panel_layout = layout;
3310 ecore_imf_context_input_panel_layout_set(ic, (Ecore_IMF_Input_Panel_Layout)layout);
3313 /* vim:set ts=8 sw=3 sts=3 expandtab cino=>5n-2f0^-2{2(0W1st0 :*/