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";
852 if((wd->password)&&(wd->show_last_character)) return "custom-password";
853 else if(wd->password) return "base-password";
856 if (wd->single_line) return "base-single";
859 if (wd->linewrap) return "base";
860 else if (wd->char_linewrap) return "base-charwrap";
861 else return "base-nowrap";
867 if((wd->password)&&(wd->show_last_character)) return "custom-password";
868 else if(wd->password) return "base-password";
871 if (wd->single_line) return "base-single-noedit";
874 if (wd->linewrap) return "base-noedit";
875 else if (wd->char_linewrap) return "base-noedit-charwrap";
876 else return "base-nowrap-noedit";
884 _str_append(char *str, const char *txt, int *len, int *alloc)
886 int txt_len = strlen(txt);
888 if (txt_len <= 0) return str;
889 if ((*len + txt_len) >= *alloc)
894 alloc2 = *alloc + txt_len + 128;
895 str2 = realloc(str, alloc2);
896 if (!str2) return str;
900 strcpy(str + *len, txt);
905 /*FIXME: Sholud be implemented somewhere else, it really depends on the context
906 * because some markups can be implemented otherwise according to style.
907 * probably doing it in textblock and making it translate according to it's
908 * style is correct. */
910 _strncpy(char* dest, const char* src, size_t count)
914 ERR( "dest is NULL" );
919 ERR( "src is NULL" );
924 ERR( "count is smaller than 0" );
928 return strncpy( dest, src, count );
932 _mkup_to_text(const char *mkup)
935 int str_len = 0, str_alloc = 0;
937 char *tag_start, *tag_end, *esc_start, *esc_end, *ts;
939 if (!mkup) return NULL;
941 tag_start = tag_end = esc_start = esc_end = NULL;
946 if (((p!=NULL)&&(*p == 0)) ||
947 (tag_end) || (esc_end) ||
948 (tag_start) || (esc_start))
954 ttag = malloc(tag_end - tag_start);
957 _strncpy(ttag, tag_start + 1, tag_end - tag_start - 1);
958 ttag[tag_end - tag_start - 1] = 0;
959 if (!strcmp(ttag, "br"))
960 str = _str_append(str, "\n", &str_len, &str_alloc);
961 else if (!strcmp(ttag, "\n"))
962 str = _str_append(str, "\n", &str_len, &str_alloc);
963 else if (!strcmp(ttag, "\\n"))
964 str = _str_append(str, "\n", &str_len, &str_alloc);
965 else if (!strcmp(ttag, "\t"))
966 str = _str_append(str, "\t", &str_len, &str_alloc);
967 else if (!strcmp(ttag, "\\t"))
968 str = _str_append(str, "\t", &str_len, &str_alloc);
969 else if (!strcmp(ttag, "ps")) /* Unicode paragraph separator */
970 str = _str_append(str, "\xE2\x80\xA9", &str_len, &str_alloc);
973 tag_start = tag_end = NULL;
977 ts = malloc(esc_end - esc_start + 1);
981 _strncpy(ts, esc_start, esc_end - esc_start);
982 ts[esc_end - esc_start] = 0;
983 esc = evas_textblock_escape_string_get(ts);
985 str = _str_append(str, esc, &str_len, &str_alloc);
988 esc_start = esc_end = NULL;
990 else if ((p!=NULL)&&(*p == 0))
992 ts = malloc(p - s + 1);
995 _strncpy(ts, s, p - s);
997 str = _str_append(str, ts, &str_len, &str_alloc);
1003 if ((p!=NULL)&&(*p == '<'))
1009 ts = malloc(p - s + 1);
1012 _strncpy(ts, s, p - s);
1014 str = _str_append(str, ts, &str_len, &str_alloc);
1020 else if ((p!=NULL)&&(*p == '>'))
1028 else if ((p!=NULL)&&(*p == '&'))
1034 ts = malloc(p - s + 1);
1037 _strncpy(ts, s, p - s);
1039 str = _str_append(str, ts, &str_len, &str_alloc);
1045 else if ((p!=NULL)&&(*p == ';'))
1059 _entry_length_get(Evas_Object *obj)
1062 const char *str = elm_entry_entry_get(obj);
1065 char *plain_str = _mkup_to_text(str);
1066 if (!plain_str) return 0;
1068 len = strlen(plain_str);
1075 _text_to_mkup(const char *text)
1078 int str_len = 0, str_alloc = 0;
1079 int ch, pos = 0, pos2 = 0;
1081 if (!text) return NULL;
1085 pos2 = evas_string_char_next_get((char *)(text), pos2, &ch);
1086 if ((ch <= 0) || (pos2 <= 0)) break;
1088 str = _str_append(str, "<br>", &str_len, &str_alloc);
1089 else if (ch == '\t')
1090 str = _str_append(str, "<\t>", &str_len, &str_alloc);
1092 str = _str_append(str, "<", &str_len, &str_alloc);
1094 str = _str_append(str, ">", &str_len, &str_alloc);
1096 str = _str_append(str, "&", &str_len, &str_alloc);
1097 else if (ch == 0x2029)
1098 str = _str_append(str, "<ps>", &str_len, &str_alloc);
1103 _strncpy(tstr, text + pos, pos2 - pos);
1104 tstr[pos2 - pos] = 0;
1105 str = _str_append(str, tstr, &str_len, &str_alloc);
1112 _signal_entry_changed(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__)
1114 Widget_Data *wd = elm_widget_data_get(data);
1116 wd->changed = EINA_TRUE;
1118 if (wd->text) eina_stringshare_del(wd->text);
1120 _check_enable_returnkey(data);
1121 evas_object_smart_callback_call(data, SIG_CHANGED, NULL);
1125 _signal_selection_start(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__)
1127 Widget_Data *wd = elm_widget_data_get(data);
1131 EINA_LIST_FOREACH(entries, l, entry)
1133 if (entry != data) elm_entry_select_none(entry);
1135 wd->have_selection = EINA_TRUE;
1136 wd->selmode = EINA_TRUE;
1137 evas_object_smart_callback_call(data, SIG_SELECTION_START, NULL);
1138 #ifdef HAVE_ELEMENTARY_X
1139 if (wd->sel_notify_handler)
1141 const char *txt = elm_entry_selection_get(data);
1144 top = elm_widget_top_get(data);
1145 if ((top) && (elm_win_xwindow_get(top)))
1146 elm_selection_set(ELM_SEL_PRIMARY, data, ELM_SEL_FORMAT_MARKUP, txt);
1152 _signal_selection_changed(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__)
1154 Widget_Data *wd = elm_widget_data_get(data);
1156 wd->have_selection = EINA_TRUE;
1157 wd->selmode = EINA_TRUE;
1158 evas_object_smart_callback_call(data, SIG_SELECTION_CHANGED, NULL);
1159 elm_selection_set(ELM_SEL_PRIMARY, obj, ELM_SEL_FORMAT_MARKUP,
1160 elm_entry_selection_get(data));
1164 _signal_selection_cleared(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__)
1166 Widget_Data *wd = elm_widget_data_get(data);
1168 if (!wd->have_selection) return;
1169 wd->have_selection = EINA_FALSE;
1170 wd->selmode = EINA_FALSE;
1171 evas_object_smart_callback_call(data, SIG_SELECTION_CLEARED, NULL);
1172 if (wd->sel_notify_handler)
1176 #ifdef HAVE_ELEMENTARY_X
1179 top = elm_widget_top_get(data);
1180 if ((top) && (elm_win_xwindow_get(top)))
1181 elm_selection_set(ELM_SEL_PRIMARY, data, ELM_SEL_FORMAT_MARKUP,
1184 eina_stringshare_del(wd->cut_sel);
1189 #ifdef HAVE_ELEMENTARY_X
1192 top = elm_widget_top_get(data);
1193 if ((top) && (elm_win_xwindow_get(top)))
1194 elm_selection_clear(ELM_SEL_PRIMARY, data);
1201 _signal_entry_paste_request(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__)
1203 Widget_Data *wd = elm_widget_data_get(data);
1205 evas_object_smart_callback_call(data, SIG_SELECTION_PASTE, NULL);
1206 if (wd->sel_notify_handler)
1208 #ifdef HAVE_ELEMENTARY_X
1211 top = elm_widget_top_get(data);
1212 if ((top) && (elm_win_xwindow_get(top)))
1214 wd->selection_asked = EINA_TRUE;
1215 elm_selection_get(ELM_SEL_CLIPBOARD, ELM_SEL_FORMAT_MARKUP, data);
1222 _signal_entry_copy_notify(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__)
1224 Widget_Data *wd = elm_widget_data_get(data);
1226 evas_object_smart_callback_call(data, SIG_SELECTION_COPY, NULL);
1227 elm_selection_set(ELM_SEL_CLIPBOARD, obj, ELM_SEL_FORMAT_MARKUP,
1228 elm_entry_selection_get(data));
1232 _signal_entry_cut_notify(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__)
1234 Widget_Data *wd = elm_widget_data_get(data);
1236 evas_object_smart_callback_call(data, SIG_SELECTION_CUT, NULL);
1237 elm_selection_set(ELM_SEL_CLIPBOARD, obj, ELM_SEL_FORMAT_MARKUP,
1238 elm_entry_selection_get(data));
1239 edje_object_part_text_insert(wd->ent, "elm.text", "");
1240 wd->changed = EINA_TRUE;
1245 _signal_cursor_changed(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__)
1247 Widget_Data *wd = elm_widget_data_get(data);
1248 Evas_Coord cx, cy, cw, ch;
1250 evas_object_smart_callback_call(data, SIG_CURSOR_CHANGED, NULL);
1251 edje_object_part_text_cursor_geometry_get(wd->ent, "elm.text",
1252 &cx, &cy, &cw, &ch);
1253 if (!wd->deferred_recalc_job)
1254 elm_widget_show_region_set(data, cx, cy, cw, ch);
1257 wd->deferred_cur = EINA_TRUE;
1263 #ifdef HAVE_CONFORMANT_AUTOSCROLL
1264 evas_object_smart_callback_call(data, SIG_IMPREGION_CHANGED, NULL);
1269 _signal_anchor_down(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__)
1271 Widget_Data *wd = elm_widget_data_get(data);
1276 _signal_anchor_up(void *data, Evas_Object *obj __UNUSED__, const char *emission, const char *source __UNUSED__)
1278 Widget_Data *wd = elm_widget_data_get(data);
1279 Elm_Entry_Anchor_Info ei;
1280 char *buf2, *p, *p2, *n;
1282 p = strrchr(emission, ',');
1285 const Eina_List *geoms;
1289 while (p2 >= emission)
1291 if (*p2 == ',') break;
1295 buf2 = alloca(5 + p - p2);
1296 strncpy(buf2, p2, p - p2);
1299 ei.button = atoi(buf2);
1300 ei.x = ei.y = ei.w = ei.h = 0;
1302 edje_object_part_text_anchor_geometry_get(wd->ent, "elm.text", ei.name);
1305 Evas_Textblock_Rectangle *r;
1307 Evas_Coord px, py, x, y;
1309 evas_object_geometry_get(wd->ent, &x, &y, NULL, NULL);
1310 evas_pointer_output_xy_get(evas_object_evas_get(wd->ent), &px, &py);
1311 EINA_LIST_FOREACH(geoms, l, r)
1313 if (((r->x + x) <= px) && ((r->y + y) <= py) &&
1314 ((r->x + x + r->w) > px) && ((r->y + y + r->h) > py))
1325 evas_object_smart_callback_call(data, SIG_ANCHOR_CLICKED, &ei);
1330 _signal_anchor_move(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__)
1332 Widget_Data *wd = elm_widget_data_get(data);
1337 _signal_anchor_in(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__)
1339 Widget_Data *wd = elm_widget_data_get(data);
1344 _signal_anchor_out(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__)
1346 Widget_Data *wd = elm_widget_data_get(data);
1351 _signal_key_enter(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__)
1353 Widget_Data *wd = elm_widget_data_get(data);
1355 evas_object_smart_callback_call(data, SIG_ACTIVATED, NULL);
1359 _signal_mouse_down(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__)
1361 Widget_Data *wd = elm_widget_data_get(data);
1363 wd->double_clicked = EINA_FALSE;
1364 evas_object_smart_callback_call(data, SIG_PRESS, NULL);
1368 _signal_mouse_up(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__)
1370 Widget_Data *wd = elm_widget_data_get(data);
1372 evas_object_smart_callback_call(data, SIG_CLICKED, NULL);
1376 _signal_mouse_double(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__)
1378 Widget_Data *wd = elm_widget_data_get(data);
1380 wd->double_clicked = EINA_TRUE;
1381 evas_object_smart_callback_call(data, SIG_CLICKED_DOUBLE, NULL);
1384 #ifdef HAVE_ELEMENTARY_X
1386 _event_selection_notify(void *data, int type __UNUSED__, void *event)
1388 Widget_Data *wd = elm_widget_data_get(data);
1389 Ecore_X_Event_Selection_Notify *ev = event;
1390 if (!wd) return ECORE_CALLBACK_PASS_ON;
1391 if (!wd->selection_asked && !wd->drag_selection_asked)
1392 return ECORE_CALLBACK_PASS_ON;
1394 if ((ev->selection == ECORE_X_SELECTION_CLIPBOARD) ||
1395 (ev->selection == ECORE_X_SELECTION_PRIMARY))
1397 Ecore_X_Selection_Data_Text *text_data;
1399 text_data = ev->data;
1400 if (text_data->data.content == ECORE_X_SELECTION_CONTENT_TEXT)
1402 if (text_data->text)
1404 char *txt = _text_to_mkup(text_data->text);
1408 elm_entry_entry_insert(data, txt);
1413 wd->selection_asked = EINA_FALSE;
1415 else if (ev->selection == ECORE_X_SELECTION_XDND)
1417 Ecore_X_Selection_Data_Text *text_data;
1419 text_data = ev->data;
1420 if (text_data->data.content == ECORE_X_SELECTION_CONTENT_TEXT)
1422 if (text_data->text)
1424 char *txt = _text_to_mkup(text_data->text);
1428 /* Massive FIXME: this should be at the drag point */
1429 elm_entry_entry_insert(data, txt);
1434 wd->drag_selection_asked = EINA_FALSE;
1436 ecore_x_dnd_send_finished();
1440 return ECORE_CALLBACK_PASS_ON;
1444 _event_selection_clear(void *data, int type __UNUSED__, void *event)
1447 Widget_Data *wd = elm_widget_data_get(data);
1448 Ecore_X_Event_Selection_Clear *ev = event;
1450 if (!wd->have_selection) return 1;
1451 if ((ev->selection == ECORE_X_SELECTION_CLIPBOARD) ||
1452 (ev->selection == ECORE_X_SELECTION_PRIMARY))
1454 elm_entry_select_none(data);
1459 Evas_Object *top = elm_widget_top_get(data);
1460 Ecore_X_Event_Selection_Clear *ev = event;
1463 return ECORE_CALLBACK_PASS_ON;
1465 if (ev->selection != ECORE_X_SELECTION_SECONDARY)
1467 return ECORE_CALLBACK_PASS_ON;
1470 elm_selection_get(ELM_SEL_SECONDARY,ELM_SEL_FORMAT_MARKUP,data);
1473 return ECORE_CALLBACK_PASS_ON;
1478 _drag_drop_cb(void *data __UNUSED__, Evas_Object *obj, Elm_Drop_Data *drop)
1483 wd = elm_widget_data_get(obj);
1485 if (!wd) return EINA_FALSE;
1486 //printf("Inserting at (%d,%d) %s\n",drop->x,drop->y,(char*)drop->data);
1488 edje_object_part_text_cursor_copy(wd->ent, "elm.text",
1489 EDJE_CURSOR_MAIN,/*->*/EDJE_CURSOR_USER);
1490 rv = edje_object_part_text_cursor_coord_set(wd->ent,"elm.text",
1491 EDJE_CURSOR_MAIN,drop->x,drop->y);
1492 // if (!rv) printf("Warning: Failed to position cursor: paste anyway\n");
1493 elm_entry_entry_insert(obj, drop->data);
1494 edje_object_part_text_cursor_copy(wd->ent, "elm.text",
1495 EDJE_CURSOR_USER,/*->*/EDJE_CURSOR_MAIN);
1501 static Evas_Object *
1502 _get_item(void *data, Evas_Object *edje __UNUSED__, const char *part __UNUSED__, const char *item)
1504 Widget_Data *wd = elm_widget_data_get(data);
1507 Elm_Entry_Item_Provider *ip;
1510 EINA_LIST_FOREACH(wd->item_providers, l, ip)
1512 o = ip->func(ip->data, data, item);
1515 o = edje_object_add(evas_object_evas_get(data));
1516 if (!strncmp(item, "emoticon/", 9))
1517 ok = _elm_theme_object_set(data, o, "entry", item, elm_widget_style_get(data));
1519 _elm_theme_object_set(data, o, "entry/emoticon", "wtf", elm_widget_style_get(data));
1524 _get_value_in_key_string(const char *oldstring, char *key, char **value)
1526 char *curlocater, *starttag, *endtag;
1527 int firstindex = 0, foundflag = -1;
1529 curlocater = strstr(oldstring, key);
1532 starttag = curlocater;
1533 endtag = curlocater + strlen(key);
1534 if (endtag == NULL || *endtag != '=')
1540 firstindex = abs(oldstring - curlocater);
1541 firstindex += strlen(key)+1; // strlen("key") + strlen("=")
1542 *value = (char*)oldstring + firstindex;
1544 while (oldstring != starttag)
1546 if (*starttag == '>')
1551 if (*starttag == '<')
1555 if (starttag == NULL) break;
1558 while (NULL != endtag)
1569 if (endtag == NULL) break;
1572 if (foundflag != 0 && *starttag == '<' && *endtag == '>')
1582 if (foundflag == 1) return 0;
1588 _strbuf_key_value_replace(Eina_Strbuf *srcbuf, char *key, const char *value, int deleteflag)
1590 const char *srcstring = NULL;
1591 Eina_Strbuf *repbuf = NULL, *diffbuf = NULL;
1592 char *curlocater, *replocater;
1593 char *starttag, *endtag;
1594 int tagtxtlen = 0, insertflag = 0;
1596 srcstring = eina_strbuf_string_get(srcbuf);
1597 curlocater = strstr(srcstring, key);
1599 if (curlocater == NULL)
1607 starttag = strchr(srcstring, '<');
1608 endtag = strchr(srcstring, '>');
1609 tagtxtlen = endtag - starttag;
1610 if (tagtxtlen <= 0) tagtxtlen = 0;
1611 if (starttag < curlocater && curlocater < endtag) break;
1612 if (endtag != NULL && endtag+1 != NULL)
1613 srcstring = endtag+1;
1616 } while (strlen(srcstring) > 1);
1618 if (starttag && endtag && tagtxtlen > strlen(key))
1620 repbuf = eina_strbuf_new();
1621 diffbuf = eina_strbuf_new();
1622 eina_strbuf_append_n(repbuf, starttag, tagtxtlen);
1623 srcstring = eina_strbuf_string_get(repbuf);
1624 curlocater = strstr(srcstring, key);
1626 if (curlocater != NULL)
1628 replocater = curlocater + strlen(key) + 1;
1630 while (*replocater == ' ' || *replocater == '=')
1635 while (*replocater != NULL && *replocater != ' ' && *replocater != '>')
1638 if (replocater-curlocater > strlen(key)+1)
1641 eina_strbuf_append_n(diffbuf, curlocater, replocater-curlocater+1);
1650 eina_strbuf_reset(repbuf);
1658 if (repbuf == NULL) repbuf = eina_strbuf_new();
1659 if (diffbuf == NULL) diffbuf = eina_strbuf_new();
1663 eina_strbuf_append_printf(repbuf, "<%s=%s>", key, value);
1664 eina_strbuf_prepend(srcbuf, eina_strbuf_string_get(repbuf));
1670 eina_strbuf_prepend(diffbuf, "<");
1671 eina_strbuf_append(diffbuf, ">");
1672 eina_strbuf_replace_first(srcbuf, eina_strbuf_string_get(diffbuf), "");
1676 eina_strbuf_append_printf(repbuf, "%s=%s", key, value);
1677 eina_strbuf_replace_first(srcbuf, eina_strbuf_string_get(diffbuf), eina_strbuf_string_get(repbuf));
1681 if (repbuf) eina_strbuf_free(repbuf);
1682 if (diffbuf) eina_strbuf_free(diffbuf);
1688 _stringshare_key_value_replace(const char **srcstring, char *key, const char *value, int deleteflag)
1690 Eina_Strbuf *sharebuf = NULL;
1692 sharebuf = eina_strbuf_new();
1693 eina_strbuf_append(sharebuf, *srcstring);
1694 _strbuf_key_value_replace(sharebuf, key, value, deleteflag);
1695 eina_stringshare_del(*srcstring);
1696 *srcstring = eina_stringshare_add(eina_strbuf_string_get(sharebuf));
1697 eina_strbuf_free(sharebuf);
1703 _is_width_over(Evas_Object *obj)
1705 Evas_Coord x, y, w, h;
1706 Evas_Coord vx, vy, vw, vh;
1707 Widget_Data *wd = elm_widget_data_get(obj);
1711 edje_object_part_geometry_get(wd->ent,"elm.text",&x,&y,&w,&h);
1713 evas_object_geometry_get (obj, &vx,&vy,&vw,&vh);
1715 if (x >= 0 && y >= 0)
1718 if (4 < wd->wrap_w && w > wd->wrap_w)
1725 _reverse_ellipsis_entry(Evas_Object *obj)
1727 Widget_Data *wd = elm_widget_data_get(obj);
1728 int cur_fontsize = 0;
1729 Eina_Strbuf *fontbuf = NULL, *txtbuf = NULL;
1730 char **kvalue = NULL;
1731 const char *minfont, *deffont, *maxfont;
1732 const char *ellipsis_string = "...";
1733 int minfontsize, maxfontsize, minshowcount;
1735 minshowcount = strlen(ellipsis_string) + 1;
1736 minfont = edje_object_data_get(wd->ent, "min_font_size");
1737 if (minfont) minfontsize = atoi(minfont);
1738 else minfontsize = 1;
1739 maxfont = edje_object_data_get(wd->ent, "max_font_size");
1740 if (maxfont) maxfontsize = atoi(maxfont);
1741 else maxfontsize = 1;
1742 deffont = edje_object_data_get(wd->ent, "default_font_size");
1743 if (deffont) cur_fontsize = atoi(deffont);
1744 else cur_fontsize = 1;
1745 if (minfontsize == maxfontsize || cur_fontsize == 1) return; // theme is not ready for ellipsis
1746 if (strlen(edje_object_part_text_get(wd->ent, "elm.text")) <= 0) return;
1748 if (_get_value_in_key_string(edje_object_part_text_get(wd->ent, "elm.text"), "font_size", &kvalue) == 0)
1750 if (*kvalue != NULL) cur_fontsize = atoi((char*)kvalue);
1753 txtbuf = eina_strbuf_new();
1754 eina_strbuf_append(txtbuf, edje_object_part_text_get(wd->ent, "elm.text"));
1756 if (cur_fontsize >= atoi(deffont))
1758 if (txtbuf) eina_strbuf_free(txtbuf);
1762 if (_is_width_over(obj) != 1)
1764 int rev_fontsize = cur_fontsize;
1768 if (rev_fontsize > atoi(deffont))
1771 if (fontbuf != NULL)
1773 eina_strbuf_free(fontbuf);
1776 fontbuf = eina_strbuf_new();
1777 eina_strbuf_append_printf(fontbuf, "%d", rev_fontsize);
1778 _strbuf_key_value_replace(txtbuf, "font_size", eina_strbuf_string_get(fontbuf), 0);
1779 edje_object_part_text_set(wd->ent, "elm.text", eina_strbuf_string_get(txtbuf));
1781 eina_strbuf_free(fontbuf);
1783 } while (_is_width_over(obj) != 1);
1785 while (_is_width_over(obj))
1788 if (rev_fontsize < atoi(deffont))
1791 if (fontbuf != NULL)
1793 eina_strbuf_free(fontbuf);
1796 fontbuf = eina_strbuf_new();
1797 eina_strbuf_append_printf(fontbuf, "%d", rev_fontsize);
1798 _strbuf_key_value_replace(txtbuf, "font_size", eina_strbuf_string_get(fontbuf), 0);
1799 edje_object_part_text_set(wd->ent, "elm.text", eina_strbuf_string_get(txtbuf));
1800 eina_strbuf_free(fontbuf);
1805 if (txtbuf) eina_strbuf_free(txtbuf);
1811 _ellipsis_entry_to_width(Evas_Object *obj)
1813 Widget_Data *wd = elm_widget_data_get(obj);
1814 int cur_fontsize = 0, len, jumpcount;
1815 Eina_Strbuf *fontbuf = NULL, *txtbuf = NULL;
1816 char **kvalue = NULL;
1817 const char *minfont, *deffont, *maxfont;
1818 const char *ellipsis_string = "...";
1819 int minfontsize, maxfontsize, minshowcount;
1820 int i, tagend, cur_len;
1823 minshowcount = strlen(ellipsis_string) + 1;
1824 minfont = edje_object_data_get(wd->ent, "min_font_size");
1825 if (minfont) minfontsize = atoi(minfont);
1826 else minfontsize = 1;
1827 maxfont = edje_object_data_get(wd->ent, "max_font_size");
1828 if (maxfont) maxfontsize = atoi(maxfont);
1829 else maxfontsize = 1;
1830 deffont = edje_object_data_get(wd->ent, "default_font_size");
1831 if (deffont) cur_fontsize = atoi(deffont);
1832 else cur_fontsize = 1;
1833 if (minfontsize == maxfontsize || cur_fontsize == 1) return; // theme is not ready for ellipsis
1834 if (strlen(edje_object_part_text_get(wd->ent, "elm.text")) <= 0) return;
1836 if (_get_value_in_key_string(edje_object_part_text_get(wd->ent, "elm.text"), "font_size", &kvalue) == 0)
1838 if (*kvalue != NULL) cur_fontsize = atoi((char*)kvalue);
1841 txtbuf = eina_strbuf_new();
1842 eina_strbuf_append(txtbuf, edje_object_part_text_get(wd->ent, "elm.text"));
1844 while (_is_width_over(obj))
1846 if (wd->ellipsis_threshold == 0)
1847 wd->ellipsis_threshold = _entry_length_get(obj);
1848 if (cur_fontsize > minfontsize)
1851 if (fontbuf != NULL)
1853 eina_strbuf_free(fontbuf);
1856 fontbuf = eina_strbuf_new();
1857 eina_strbuf_append_printf(fontbuf, "%d", cur_fontsize);
1858 _strbuf_key_value_replace(txtbuf, "font_size", eina_strbuf_string_get(fontbuf), 0);
1859 edje_object_part_text_set(wd->ent, "elm.text", eina_strbuf_string_get(txtbuf));
1860 eina_strbuf_free(fontbuf);
1862 edje_object_part_text_cursor_end_set(wd->ent, "elm.text", EDJE_CURSOR_MAIN);
1866 len = _entry_length_get(obj);
1867 cur_str = edje_object_part_text_get(wd->ent, "elm.text");
1868 cur_len = strlen(cur_str);
1870 for (i = 0; i < len; i++)
1872 if(cur_str[i] == '>' && cur_str[i+1] != NULL &&
1873 cur_str[i+1] != '<')
1880 while (jumpcount < len-strlen(ellipsis_string))
1882 cur_str = edje_object_part_text_get(wd->ent, "elm.text");
1886 eina_strbuf_free(txtbuf);
1889 txtbuf = eina_strbuf_new();
1890 eina_strbuf_append_n(txtbuf, cur_str, tagend+1);
1891 eina_strbuf_append(txtbuf, ellipsis_string);
1892 eina_strbuf_append(txtbuf, cur_str+tagend+jumpcount+1);
1893 edje_object_part_text_set(wd->ent, "elm.text", eina_strbuf_string_get(txtbuf));
1894 edje_object_part_text_cursor_end_set(wd->ent, "elm.text", EDJE_CURSOR_MAIN);
1896 if (_is_width_over(obj))
1904 if (txtbuf) eina_strbuf_free(txtbuf);
1909 static int _textinput_control_function(void *data,void *input_data)
1911 /*calculate character count*/
1912 Evas_Object *entry = (Evas_Object *)data;
1913 Widget_Data *wd = elm_widget_data_get((Evas_Object *)data);
1916 size_t insert_text_len=0;
1917 char *text = edje_object_part_text_get(wd->ent, "elm.text");
1919 size_t remain_bytes;
1922 byte_len = strlen(text);/*no of bytes*/
1923 remain_bytes = wd->max_no_of_bytes-byte_len;
1924 sprintf(buf,"%d",remain_bytes);
1925 edje_object_part_text_set(wd->ent, "elm_entry_remain_byte_count", buf);
1928 insert_text = (char *)input_data;
1929 insert_text_len = strlen(insert_text);
1930 if(remain_bytes<insert_text_len)
1932 evas_object_smart_callback_call(entry, "maxlength,reached", NULL);
1935 if(byte_len>=wd->max_no_of_bytes)
1937 evas_object_smart_callback_call(entry, "maxlength,reached", NULL);
1946 * This adds an entry to @p parent object.
1948 * @param parent The parent object
1949 * @return The new object or NULL if it cannot be created
1954 elm_entry_add(Evas_Object *parent)
1956 Evas_Object *obj, *top;
1960 wd = ELM_NEW(Widget_Data);
1961 e = evas_object_evas_get(parent);
1962 wd->bgcolor = EINA_FALSE;
1963 wd->bg = evas_object_rectangle_add(e);
1964 evas_object_color_set(wd->bg, 0, 0, 0, 0);
1965 obj = elm_widget_add(e);
1966 ELM_SET_WIDTYPE(widtype, "entry");
1967 elm_widget_type_set(obj, "entry");
1968 elm_widget_sub_object_add(parent, obj);
1969 elm_widget_on_focus_hook_set(obj, _on_focus_hook, NULL);
1970 elm_widget_data_set(obj, wd);
1971 elm_widget_del_hook_set(obj, _del_hook);
1972 elm_widget_theme_hook_set(obj, _theme_hook);
1973 elm_widget_disable_hook_set(obj, _disable_hook);
1974 elm_widget_signal_emit_hook_set(obj, _signal_emit_hook);
1975 elm_widget_signal_callback_add_hook_set(obj, _signal_callback_add_hook);
1976 elm_widget_signal_callback_del_hook_set(obj, _signal_callback_del_hook);
1977 elm_widget_can_focus_set(obj, 1);
1978 #ifdef HAVE_CONFORMANT_AUTOSCROLL
1979 elm_widget_imp_region_get_hook_set(obj, _imp_region_get_hook, NULL);
1982 wd->linewrap = EINA_TRUE;
1983 wd->ellipsis = EINA_FALSE;
1984 wd->char_linewrap= EINA_FALSE;
1985 wd->editable = EINA_TRUE;
1986 wd->disabled = EINA_FALSE;
1987 wd->context_menu = EINA_TRUE;
1989 wd->ellipsis_threshold = 0;
1991 wd->ent = edje_object_add(e);
1992 edje_object_item_provider_set(wd->ent, _get_item, obj);
1993 evas_object_event_callback_add(wd->ent, EVAS_CALLBACK_MOVE, _move, obj);
1994 evas_object_event_callback_add(wd->ent, EVAS_CALLBACK_RESIZE, _resize, obj);
1995 evas_object_event_callback_add(wd->ent, EVAS_CALLBACK_MOUSE_DOWN,
1997 evas_object_event_callback_add(wd->ent, EVAS_CALLBACK_MOUSE_UP,
1999 evas_object_event_callback_add(wd->ent, EVAS_CALLBACK_MOUSE_MOVE,
2002 _elm_theme_object_set(obj, wd->ent, "entry", "base", "default");
2003 edje_object_signal_callback_add(wd->ent, "entry,changed", "elm.text",
2004 _signal_entry_changed, obj);
2005 edje_object_signal_callback_add(wd->ent, "selection,start", "elm.text",
2006 _signal_selection_start, obj);
2007 edje_object_signal_callback_add(wd->ent, "selection,changed", "elm.text",
2008 _signal_selection_changed, obj);
2009 edje_object_signal_callback_add(wd->ent, "selection,cleared", "elm.text",
2010 _signal_selection_cleared, obj);
2011 edje_object_signal_callback_add(wd->ent, "entry,paste,request", "elm.text",
2012 _signal_entry_paste_request, obj);
2013 edje_object_signal_callback_add(wd->ent, "entry,copy,notify", "elm.text",
2014 _signal_entry_copy_notify, obj);
2015 edje_object_signal_callback_add(wd->ent, "entry,cut,notify", "elm.text",
2016 _signal_entry_cut_notify, obj);
2017 edje_object_signal_callback_add(wd->ent, "cursor,changed", "elm.text",
2018 _signal_cursor_changed, obj);
2019 edje_object_signal_callback_add(wd->ent, "anchor,mouse,down,*", "elm.text",
2020 _signal_anchor_down, obj);
2021 edje_object_signal_callback_add(wd->ent, "anchor,mouse,up,*", "elm.text",
2022 _signal_anchor_up, obj);
2023 edje_object_signal_callback_add(wd->ent, "anchor,mouse,move,*", "elm.text",
2024 _signal_anchor_move, obj);
2025 edje_object_signal_callback_add(wd->ent, "anchor,mouse,in,*", "elm.text",
2026 _signal_anchor_in, obj);
2027 edje_object_signal_callback_add(wd->ent, "anchor,mouse,out,*", "elm.text",
2028 _signal_anchor_out, obj);
2029 edje_object_signal_callback_add(wd->ent, "entry,key,enter", "elm.text",
2030 _signal_key_enter, obj);
2031 edje_object_signal_callback_add(wd->ent, "mouse,down,1", "elm.text",
2032 _signal_mouse_down, obj);
2033 edje_object_signal_callback_add(wd->ent, "mouse,up,1", "elm.text",
2034 _signal_mouse_up, obj);
2035 edje_object_signal_callback_add(wd->ent, "mouse,down,1,double", "elm.text",
2036 _signal_mouse_double, obj);
2037 edje_object_part_text_set(wd->ent, "elm.text", "");
2038 elm_widget_resize_object_set(obj, wd->ent);
2041 wd->input_panel_enable = edje_object_part_text_input_panel_enabled_get(wd->ent, "elm.text");
2043 #ifdef HAVE_ELEMENTARY_X
2044 top = elm_widget_top_get(obj);
2045 if ((top) && (elm_win_xwindow_get(top)))
2047 wd->sel_notify_handler =
2048 ecore_event_handler_add(ECORE_X_EVENT_SELECTION_NOTIFY,
2049 _event_selection_notify, obj);
2050 wd->sel_clear_handler =
2051 ecore_event_handler_add(ECORE_X_EVENT_SELECTION_CLEAR,
2052 _event_selection_clear, obj);
2055 elm_drop_target_add(obj, ELM_SEL_FORMAT_MARKUP,_drag_drop_cb, NULL);
2058 entries = eina_list_prepend(entries, obj);
2060 // module - find module for entry
2061 wd->api = _module(obj);
2062 // if found - hook in
2063 if ((wd->api) && (wd->api->obj_hook)) wd->api->obj_hook(obj);
2065 // TODO: convert Elementary to subclassing of Evas_Smart_Class
2066 // TODO: and save some bytes, making descriptions per-class and not instance!
2067 evas_object_smart_callbacks_descriptions_set(obj, _signals);
2071 EAPI void elm_entry_extension_module_data_get(Evas_Object *obj,Elm_Entry_Extension_data *ext_mod)
2073 ELM_CHECK_WIDTYPE(obj, widtype);
2074 Widget_Data *wd = elm_widget_data_get(obj);
2076 ext_mod->cancel = _cancel;
2077 ext_mod->copy = _copy;
2078 ext_mod->cut = _cut;
2079 ext_mod->paste = _paste;
2080 ext_mod->select = _select;
2081 ext_mod->selectall = NULL; /* to be implemented*/
2082 ext_mod->ent = wd->ent;
2083 ext_mod->items = wd->items;
2084 ext_mod->longpress_timer = wd->longpress_timer;
2085 ext_mod->editable = wd->editable;
2086 ext_mod->have_selection = wd->have_selection;
2087 ext_mod->password = wd->password;
2088 ext_mod->cnpinit = _cnpinit;
2089 ext_mod->context_menu = wd->context_menu;
2093 * This sets the entry object not to line wrap. All input will
2094 * be on a single line, and the entry box will extend with user input.
2096 * @param obj The entry object
2097 * @param single_line If true, the text in the entry
2098 * will be on a single line.
2103 elm_entry_single_line_set(Evas_Object *obj, Eina_Bool single_line)
2105 ELM_CHECK_WIDTYPE(obj, widtype);
2106 Widget_Data *wd = elm_widget_data_get(obj);
2108 Ecore_IMF_Context *ic;
2110 if (wd->single_line == single_line) return;
2111 wd->single_line = single_line;
2112 wd->linewrap = EINA_FALSE;
2113 wd->char_linewrap = EINA_FALSE;
2114 t = eina_stringshare_add(elm_entry_entry_get(obj));
2115 _elm_theme_object_set(obj, wd->ent, "entry", _getbase(obj), elm_widget_style_get(obj));
2116 elm_entry_entry_set(obj, t);
2117 edje_object_part_text_autocapitalization_set(wd->ent, "elm.text", wd->autocapital);
2118 edje_object_part_text_autoperiod_set(wd->ent, "elm.text", wd->autoperiod);
2119 ic = elm_entry_imf_context_get(obj);
2122 ecore_imf_context_input_panel_layout_set(ic, wd->input_panel_layout);
2125 eina_stringshare_del(t);
2130 * This returns true if the entry has been set to single line mode.
2131 * See also elm_entry_single_line_set().
2133 * @param obj The entry object
2134 * @return single_line If true, the text in the entry is set to display
2140 elm_entry_single_line_get(const Evas_Object *obj)
2142 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2143 Widget_Data *wd = elm_widget_data_get(obj);
2144 if (!wd) return EINA_FALSE;
2145 return wd->single_line;
2149 * This set's the maximum bytes that can be added in entry.
2151 * @param obj The entry object
2152 * @param max_no_of_bytes Maximum number of bytes entry can have.
2157 elm_entry_maximum_bytes_set(Evas_Object *obj, int max_no_of_bytes)
2159 Widget_Data *wd = elm_widget_data_get(obj);
2161 wd->max_no_of_bytes = max_no_of_bytes;
2162 edje_object_signal_emit(wd->ent, "elm,state,remain,bytes,show", "elm");
2163 edje_object_part_textinput_callback_set(wd->ent, "elm.text", _textinput_control_function,obj);
2168 * This sets the entry object to password mode. All text entered
2169 * and/or displayed within the widget will be replaced with asterisks (*).
2171 * @param obj The entry object
2172 * @param password If true, password mode is enabled.
2177 elm_entry_password_set(Evas_Object *obj, Eina_Bool password)
2179 ELM_CHECK_WIDTYPE(obj, widtype);
2180 Widget_Data *wd = elm_widget_data_get(obj);
2181 Ecore_IMF_Context *ic;
2184 if (wd->password == password) return;
2185 wd->password = password;
2186 wd->show_last_character = EINA_FALSE;
2187 wd->single_line = EINA_TRUE;
2188 wd->linewrap = EINA_FALSE;
2189 wd->char_linewrap = EINA_FALSE;
2190 t = eina_stringshare_add(elm_entry_entry_get(obj));
2191 _elm_theme_object_set(obj, wd->ent, "entry", _getbase(obj), elm_widget_style_get(obj));
2192 elm_entry_entry_set(obj, t);
2198 elm_entry_autoperiod_set(obj, EINA_FALSE);
2201 if (wd->autocapital)
2203 elm_entry_autocapitalization_set(obj, EINA_FALSE);
2207 ic = elm_entry_imf_context_get(obj);
2210 ecore_imf_context_input_panel_layout_set(ic, wd->input_panel_layout);
2213 eina_stringshare_del(t);
2218 * This set's the entry in password mode with out masking the last character entered by user,
2219 * and later masking the character after 2 seconds.
2221 * @param obj The entry object
2222 * @param show_last_character The show_last_character flag (1 for "password mode along with showing last character"
2228 elm_entry_password_show_last_character_set(Evas_Object *obj, Eina_Bool show_last_character)
2230 Widget_Data *wd = elm_widget_data_get(obj);
2233 if ((wd->password == show_last_character)&&(wd->show_last_character ==show_last_character)) return;
2234 wd->show_last_character = show_last_character;
2235 wd->password = show_last_character;
2236 wd->single_line = EINA_TRUE;
2237 wd->linewrap = EINA_FALSE;
2238 wd->char_linewrap = EINA_FALSE;
2239 t = eina_stringshare_add(elm_entry_entry_get(obj));
2240 _elm_theme_object_set(obj, wd->ent, "entry", _getbase(obj), elm_widget_style_get(obj));
2241 elm_entry_entry_set(obj, t);
2242 eina_stringshare_del(t);
2247 * This returns whether password mode is enabled.
2248 * See also elm_entry_password_set().
2250 * @param obj The entry object
2251 * @return If true, the entry is set to display all characters
2257 elm_entry_password_get(const Evas_Object *obj)
2259 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2260 Widget_Data *wd = elm_widget_data_get(obj);
2261 if (!wd) return EINA_FALSE;
2262 return wd->password;
2266 * This sets the text displayed within the entry to @p entry.
2268 * @param obj The entry object
2269 * @param entry The text to be displayed
2274 elm_entry_entry_set(Evas_Object *obj, const char *entry)
2276 ELM_CHECK_WIDTYPE(obj, widtype);
2277 Widget_Data *wd = elm_widget_data_get(obj);
2279 if (!entry) entry = "";
2280 if(wd->max_no_of_bytes)
2282 int len = strlen(entry);
2283 if(len > wd->max_no_of_bytes)
2285 ERR("[ERROR]the length of the text set is more than max no of bytes, text cannot be set");
2289 edje_object_part_text_set(wd->ent, "elm.text", entry);
2290 if (wd->text) eina_stringshare_del(wd->text);
2292 wd->changed = EINA_TRUE;
2297 * This returns the text currently shown in object @p entry.
2298 * See also elm_entry_entry_set().
2300 * @param obj The entry object
2301 * @return The currently displayed text or NULL on failure
2306 elm_entry_entry_get(const Evas_Object *obj)
2308 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
2309 Widget_Data *wd = elm_widget_data_get(obj);
2311 if (!wd) return NULL;
2312 if (wd->text) return wd->text;
2313 text = edje_object_part_text_get(wd->ent, "elm.text");
2316 ERR("text=NULL for edje %p, part 'elm.text'", wd->ent);
2319 eina_stringshare_replace(&wd->text, text);
2324 * This returns all selected text within the entry.
2326 * @param obj The entry object
2327 * @return The selected text within the entry or NULL on failure
2332 elm_entry_selection_get(const Evas_Object *obj)
2334 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
2335 Widget_Data *wd = elm_widget_data_get(obj);
2336 if (!wd) return NULL;
2337 return edje_object_part_text_selection_get(wd->ent, "elm.text");
2341 * This inserts text in @p entry at the beginning of the entry
2344 * @param obj The entry object
2345 * @param entry The text to insert
2350 elm_entry_entry_insert(Evas_Object *obj, const char *entry)
2352 ELM_CHECK_WIDTYPE(obj, widtype);
2353 Widget_Data *wd = elm_widget_data_get(obj);
2355 edje_object_part_text_insert(wd->ent, "elm.text", entry);
2357 if (cnpwidgetdata == obj)
2358 ecore_x_selection_secondary_set(elm_win_xwindow_get(obj), "",1);
2360 wd->changed = EINA_TRUE;
2365 * This enables word line wrapping in the entry object. It is the opposite
2366 * of elm_entry_single_line_set(). Additionally, setting this disables
2367 * character line wrapping.
2368 * See also elm_entry_line_char_wrap_set().
2370 * @param obj The entry object
2371 * @param wrap If true, the entry will be wrapped once it reaches the end
2372 * of the object. Wrapping will occur at the end of the word before the end of the
2378 elm_entry_line_wrap_set(Evas_Object *obj, Eina_Bool wrap)
2380 ELM_CHECK_WIDTYPE(obj, widtype);
2381 Widget_Data *wd = elm_widget_data_get(obj);
2384 if (wd->linewrap == wrap) return;
2385 wd->linewrap = wrap;
2387 wd->char_linewrap = EINA_FALSE;
2388 t = eina_stringshare_add(elm_entry_entry_get(obj));
2389 _elm_theme_object_set(obj, wd->ent, "entry", _getbase(obj), elm_widget_style_get(obj));
2390 elm_entry_entry_set(obj, t);
2391 eina_stringshare_del(t);
2396 * Set wrap width of the entry
2398 * @param obj The entry object
2399 * @param w The wrap width in pixels at a minimum where words need to wrap
2403 elm_entry_wrap_width_set(Evas_Object *obj, Evas_Coord w)
2405 Widget_Data *wd = elm_widget_data_get(obj);
2406 if (wd->wrap_w == w) return;
2412 * get wrap width of the entry
2414 * @param obj The entry object
2415 * @return The wrap width in pixels at a minimum where words need to wrap
2419 elm_entry_wrap_width_get(const Evas_Object *obj)
2421 Widget_Data *wd = elm_widget_data_get(obj);
2426 * This enables character line wrapping in the entry object. It is the opposite
2427 * of elm_entry_single_line_set(). Additionally, setting this disables
2428 * word line wrapping.
2429 * See also elm_entry_line_wrap_set().
2431 * @param obj The entry object
2432 * @param wrap If true, the entry will be wrapped once it reaches the end
2433 * of the object. Wrapping will occur immediately upon reaching the end of the object.
2438 elm_entry_line_char_wrap_set(Evas_Object *obj, Eina_Bool wrap)
2440 ELM_CHECK_WIDTYPE(obj, widtype);
2441 Widget_Data *wd = elm_widget_data_get(obj);
2444 if (wd->char_linewrap == wrap) return;
2445 wd->char_linewrap = wrap;
2446 if(wd->char_linewrap)
2447 wd->linewrap = EINA_FALSE;
2448 t = eina_stringshare_add(elm_entry_entry_get(obj));
2449 _elm_theme_object_set(obj, wd->ent, "entry", _getbase(obj), elm_widget_style_get(obj));
2450 elm_entry_entry_set(obj, t);
2451 eina_stringshare_del(t);
2456 * This sets the editable attribute of the entry.
2458 * @param obj The entry object
2459 * @param editable If true, the entry will be editable by the user.
2460 * If false, it will be set to the disabled state.
2465 elm_entry_editable_set(Evas_Object *obj, Eina_Bool editable)
2467 ELM_CHECK_WIDTYPE(obj, widtype);
2468 Widget_Data *wd = elm_widget_data_get(obj);
2471 if (wd->editable == editable) return;
2472 wd->editable = editable;
2473 t = eina_stringshare_add(elm_entry_entry_get(obj));
2474 _elm_theme_object_set(obj, wd->ent, "entry", _getbase(obj), elm_widget_style_get(obj));
2475 elm_entry_entry_set(obj, t);
2476 eina_stringshare_del(t);
2479 #ifdef HAVE_ELEMENTARY_X
2481 elm_drop_target_add(obj, ELM_SEL_FORMAT_MARKUP, _drag_drop_cb, NULL);
2483 elm_drop_target_del(obj);
2488 * This gets the editable attribute of the entry.
2489 * See also elm_entry_editable_set().
2491 * @param obj The entry object
2492 * @return If true, the entry is editable by the user.
2493 * If false, it is not editable by the user
2498 elm_entry_editable_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->editable;
2507 * This drops any existing text selection within the entry.
2509 * @param obj The entry object
2514 elm_entry_select_none(Evas_Object *obj)
2516 ELM_CHECK_WIDTYPE(obj, widtype);
2517 Widget_Data *wd = elm_widget_data_get(obj);
2521 wd->selmode = EINA_FALSE;
2522 edje_object_part_text_select_allow_set(wd->ent, "elm.text", EINA_FALSE);
2523 edje_object_signal_emit(wd->ent, "elm,state,select,off", "elm");
2525 wd->have_selection = EINA_FALSE;
2526 edje_object_part_text_select_none(wd->ent, "elm.text");
2530 * This selects all text within the entry.
2532 * @param obj The entry object
2537 elm_entry_select_all(Evas_Object *obj)
2539 ELM_CHECK_WIDTYPE(obj, widtype);
2540 Widget_Data *wd = elm_widget_data_get(obj);
2544 wd->selmode = EINA_FALSE;
2545 edje_object_part_text_select_allow_set(wd->ent, "elm.text", EINA_FALSE);
2546 edje_object_signal_emit(wd->ent, "elm,state,select,off", "elm");
2548 wd->have_selection = EINA_TRUE;
2549 edje_object_part_text_select_all(wd->ent, "elm.text");
2553 * This moves the cursor one place to the right within the entry.
2555 * @param obj The entry object
2556 * @return EINA_TRUE upon success, EINA_FALSE upon failure
2561 elm_entry_cursor_next(Evas_Object *obj)
2563 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2564 Widget_Data *wd = elm_widget_data_get(obj);
2565 if (!wd) return EINA_FALSE;
2566 return edje_object_part_text_cursor_next(wd->ent, "elm.text", EDJE_CURSOR_MAIN);
2570 * This moves the cursor one place to the left within the entry.
2572 * @param obj The entry object
2573 * @return EINA_TRUE upon success, EINA_FALSE upon failure
2578 elm_entry_cursor_prev(Evas_Object *obj)
2580 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2581 Widget_Data *wd = elm_widget_data_get(obj);
2582 if (!wd) return EINA_FALSE;
2583 return edje_object_part_text_cursor_prev(wd->ent, "elm.text", EDJE_CURSOR_MAIN);
2587 * This moves the cursor one line up within the entry.
2589 * @param obj The entry object
2590 * @return EINA_TRUE upon success, EINA_FALSE upon failure
2595 elm_entry_cursor_up(Evas_Object *obj)
2597 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2598 Widget_Data *wd = elm_widget_data_get(obj);
2599 if (!wd) return EINA_FALSE;
2600 return edje_object_part_text_cursor_up(wd->ent, "elm.text", EDJE_CURSOR_MAIN);
2604 * This moves the cursor one line down within the entry.
2606 * @param obj The entry object
2607 * @return EINA_TRUE upon success, EINA_FALSE upon failure
2612 elm_entry_cursor_down(Evas_Object *obj)
2614 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2615 Widget_Data *wd = elm_widget_data_get(obj);
2616 if (!wd) return EINA_FALSE;
2617 return edje_object_part_text_cursor_down(wd->ent, "elm.text", EDJE_CURSOR_MAIN);
2621 * This moves the cursor to the beginning of the entry.
2623 * @param obj The entry object
2628 elm_entry_cursor_begin_set(Evas_Object *obj)
2630 ELM_CHECK_WIDTYPE(obj, widtype);
2631 Widget_Data *wd = elm_widget_data_get(obj);
2633 edje_object_part_text_cursor_begin_set(wd->ent, "elm.text", EDJE_CURSOR_MAIN);
2637 * This moves the cursor to the end of the entry.
2639 * @param obj The entry object
2644 elm_entry_cursor_end_set(Evas_Object *obj)
2646 ELM_CHECK_WIDTYPE(obj, widtype);
2647 Widget_Data *wd = elm_widget_data_get(obj);
2649 edje_object_part_text_cursor_end_set(wd->ent, "elm.text", EDJE_CURSOR_MAIN);
2653 * This moves the cursor to the beginning of the current line.
2655 * @param obj The entry object
2660 elm_entry_cursor_line_begin_set(Evas_Object *obj)
2662 ELM_CHECK_WIDTYPE(obj, widtype);
2663 Widget_Data *wd = elm_widget_data_get(obj);
2665 edje_object_part_text_cursor_line_begin_set(wd->ent, "elm.text", EDJE_CURSOR_MAIN);
2669 * This moves the cursor to the end of the current line.
2671 * @param obj The entry object
2676 elm_entry_cursor_line_end_set(Evas_Object *obj)
2678 ELM_CHECK_WIDTYPE(obj, widtype);
2679 Widget_Data *wd = elm_widget_data_get(obj);
2681 edje_object_part_text_cursor_line_end_set(wd->ent, "elm.text", EDJE_CURSOR_MAIN);
2685 * This begins a selection within the entry as though
2686 * the user were holding down the mouse button to make a selection.
2688 * @param obj The entry object
2693 elm_entry_cursor_selection_begin(Evas_Object *obj)
2695 ELM_CHECK_WIDTYPE(obj, widtype);
2696 Widget_Data *wd = elm_widget_data_get(obj);
2698 edje_object_part_text_select_begin(wd->ent, "elm.text");
2702 * This ends a selection within the entry as though
2703 * the user had just released the mouse button while making a selection.
2705 * @param obj The entry object
2710 elm_entry_cursor_selection_end(Evas_Object *obj)
2712 ELM_CHECK_WIDTYPE(obj, widtype);
2713 Widget_Data *wd = elm_widget_data_get(obj);
2715 edje_object_part_text_select_extend(wd->ent, "elm.text");
2719 * TODO: fill this in
2721 * @param obj The entry object
2722 * @return TODO: fill this in
2727 elm_entry_cursor_is_format_get(const Evas_Object *obj)
2729 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2730 Widget_Data *wd = elm_widget_data_get(obj);
2731 if (!wd) return EINA_FALSE;
2732 return edje_object_part_text_cursor_is_format_get(wd->ent, "elm.text", EDJE_CURSOR_MAIN);
2736 * This returns whether the cursor is visible.
2738 * @param obj The entry object
2739 * @return If true, the cursor is visible.
2744 elm_entry_cursor_is_visible_format_get(const Evas_Object *obj)
2746 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2747 Widget_Data *wd = elm_widget_data_get(obj);
2748 if (!wd) return EINA_FALSE;
2749 return edje_object_part_text_cursor_is_visible_format_get(wd->ent, "elm.text", EDJE_CURSOR_MAIN);
2753 * TODO: fill this in
2755 * @param obj The entry object
2756 * @return TODO: fill this in
2761 elm_entry_cursor_content_get(const Evas_Object *obj)
2763 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
2764 Widget_Data *wd = elm_widget_data_get(obj);
2765 if (!wd) return NULL;
2766 return edje_object_part_text_cursor_content_get(wd->ent, "elm.text", EDJE_CURSOR_MAIN);
2770 * This executes a "cut" action on the selected text in the entry.
2772 * @param obj The entry object
2777 elm_entry_selection_cut(Evas_Object *obj)
2779 ELM_CHECK_WIDTYPE(obj, widtype);
2780 Widget_Data *wd = elm_widget_data_get(obj);
2782 _cut(obj, NULL, NULL);
2786 * This executes a "copy" action on the selected text in the entry.
2788 * @param obj The entry object
2793 elm_entry_selection_copy(Evas_Object *obj)
2795 ELM_CHECK_WIDTYPE(obj, widtype);
2796 Widget_Data *wd = elm_widget_data_get(obj);
2798 _copy(obj, NULL, NULL);
2802 * This executes a "paste" action in the entry.
2804 * @param obj The entry object
2809 elm_entry_selection_paste(Evas_Object *obj)
2811 ELM_CHECK_WIDTYPE(obj, widtype);
2812 Widget_Data *wd = elm_widget_data_get(obj);
2814 _paste(obj, NULL, NULL);
2818 * This clears and frees the items in a entry's contextual (right click) menu.
2820 * @param obj The entry object
2825 elm_entry_context_menu_clear(Evas_Object *obj)
2827 ELM_CHECK_WIDTYPE(obj, widtype);
2828 Widget_Data *wd = elm_widget_data_get(obj);
2829 Elm_Entry_Context_Menu_Item *it;
2831 EINA_LIST_FREE(wd->items, it)
2833 eina_stringshare_del(it->label);
2834 eina_stringshare_del(it->icon_file);
2835 eina_stringshare_del(it->icon_group);
2841 * This adds an item to the entry's contextual menu.
2843 * @param obj The entry object
2844 * @param label The item's text label
2845 * @param icon_file The item's icon file
2846 * @param icon_type The item's icon type
2847 * @param func The callback to execute when the item is clicked
2848 * @param data The data to associate with the item for related functions
2853 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)
2855 ELM_CHECK_WIDTYPE(obj, widtype);
2856 Widget_Data *wd = elm_widget_data_get(obj);
2857 Elm_Entry_Context_Menu_Item *it;
2859 it = calloc(1, sizeof(Elm_Entry_Context_Menu_Item));
2861 wd->items = eina_list_append(wd->items, it);
2863 it->label = eina_stringshare_add(label);
2864 it->icon_file = eina_stringshare_add(icon_file);
2865 it->icon_type = icon_type;
2867 it->data = (void *)data;
2871 * This disables the entry's contextual (right click) menu.
2873 * @param obj The entry object
2874 * @param disabled If true, the menu is disabled
2879 elm_entry_context_menu_disabled_set(Evas_Object *obj, Eina_Bool disabled)
2881 ELM_CHECK_WIDTYPE(obj, widtype);
2882 Widget_Data *wd = elm_widget_data_get(obj);
2884 if (wd->context_menu == !disabled) return;
2885 wd->context_menu = !disabled;
2889 * This returns whether the entry's contextual (right click) menu is disabled.
2891 * @param obj The entry object
2892 * @return If true, the menu is disabled
2897 elm_entry_context_menu_disabled_get(const Evas_Object *obj)
2899 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2900 Widget_Data *wd = elm_widget_data_get(obj);
2901 if (!wd) return EINA_FALSE;
2902 return !wd->context_menu;
2906 * This appends a custom item provider to the list for that entry
2908 * This appends the given callback. The list is walked from beginning to end
2909 * with each function called given the item href string in the text. If the
2910 * function returns an object handle other than NULL (it should create an
2911 * and object to do this), then this object is used to replace that item. If
2912 * not the next provider is called until one provides an item object, or the
2913 * default provider in entry does.
2915 * @param obj The entry object
2916 * @param func The function called to provide the item object
2917 * @param data The data passed to @p func
2922 elm_entry_item_provider_append(Evas_Object *obj, Evas_Object *(*func) (void *data, Evas_Object *entry, const char *item), void *data)
2924 ELM_CHECK_WIDTYPE(obj, widtype);
2925 Widget_Data *wd = elm_widget_data_get(obj);
2928 Elm_Entry_Item_Provider *ip = calloc(1, sizeof(Elm_Entry_Item_Provider));
2932 wd->item_providers = eina_list_append(wd->item_providers, ip);
2936 * This prepends a custom item provider to the list for that entry
2938 * This prepends the given callback. See elm_entry_item_provider_append() for
2941 * @param obj The entry object
2942 * @param func The function called to provide the item object
2943 * @param data The data passed to @p func
2948 elm_entry_item_provider_prepend(Evas_Object *obj, Evas_Object *(*func) (void *data, Evas_Object *entry, const char *item), void *data)
2950 ELM_CHECK_WIDTYPE(obj, widtype);
2951 Widget_Data *wd = elm_widget_data_get(obj);
2954 Elm_Entry_Item_Provider *ip = calloc(1, sizeof(Elm_Entry_Item_Provider));
2958 wd->item_providers = eina_list_prepend(wd->item_providers, ip);
2962 * This removes a custom item provider to the list for that entry
2964 * This removes the given callback. See elm_entry_item_provider_append() for
2967 * @param obj The entry object
2968 * @param func The function called to provide the item object
2969 * @param data The data passed to @p func
2974 elm_entry_item_provider_remove(Evas_Object *obj, Evas_Object *(*func) (void *data, Evas_Object *entry, const char *item), void *data)
2976 ELM_CHECK_WIDTYPE(obj, widtype);
2977 Widget_Data *wd = elm_widget_data_get(obj);
2979 Elm_Entry_Item_Provider *ip;
2982 EINA_LIST_FOREACH(wd->item_providers, l, ip)
2984 if ((ip->func == func) && (ip->data == data))
2986 wd->item_providers = eina_list_remove_list(wd->item_providers, l);
2994 * This converts a markup (HTML-like) string into UTF-8.
2996 * @param s The string (in markup) to be converted
2997 * @return The converted string (in UTF-8)
3002 elm_entry_markup_to_utf8(const char *s)
3004 char *ss = _mkup_to_text(s);
3005 if (!ss) ss = strdup("");
3010 * This converts a UTF-8 string into markup (HTML-like).
3012 * @param s The string (in UTF-8) to be converted
3013 * @return The converted string (in markup)
3018 elm_entry_utf8_to_markup(const char *s)
3020 char *ss = _text_to_mkup(s);
3021 if (!ss) ss = strdup("");
3026 * Get the input method context in the entry widget
3028 * @param obj The entry object
3029 * @return The input method context
3033 EAPI Ecore_IMF_Context *elm_entry_imf_context_get(Evas_Object *obj)
3035 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
3036 Widget_Data *wd = elm_widget_data_get(obj);
3037 if (!wd || !wd->ent) return NULL;
3039 return edje_object_part_text_imf_context_get(wd->ent, "elm.text");
3043 * Set whether entry should enable the return key on soft keyboard automatically
3045 * @param obj The entry object
3046 * @param on If true, entry enables the return key on soft keyboard automatically.
3051 elm_entry_autoenable_returnkey_set(Evas_Object *obj, Eina_Bool on)
3053 ELM_CHECK_WIDTYPE(obj, widtype);
3054 Widget_Data *wd = elm_widget_data_get(obj);
3057 wd->autoreturnkey = on;
3058 _check_enable_returnkey(obj);
3062 * Set whether entry should support auto capitalization
3064 * @param obj The entry object
3065 * @param on If true, entry suports auto capitalization.
3070 elm_entry_autocapitalization_set(Evas_Object *obj, Eina_Bool autocap)
3072 ELM_CHECK_WIDTYPE(obj, widtype);
3073 Widget_Data *wd = elm_widget_data_get(obj);
3077 wd->autocapital = EINA_FALSE;
3079 wd->autocapital = autocap;
3081 if (wd->input_panel_layout == ELM_INPUT_PANEL_LAYOUT_URL ||
3082 wd->input_panel_layout == ELM_INPUT_PANEL_LAYOUT_EMAIL)
3083 wd->autocapital = EINA_FALSE;
3085 edje_object_part_text_autocapitalization_set(wd->ent, "elm.text", wd->autocapital);
3089 * Set whether entry should support auto period
3091 * @param obj The entry object
3092 * @param on If true, entry suports auto period.
3097 elm_entry_autoperiod_set(Evas_Object *obj, Eina_Bool autoperiod)
3099 ELM_CHECK_WIDTYPE(obj, widtype);
3100 Widget_Data *wd = elm_widget_data_get(obj);
3104 wd->autoperiod = EINA_FALSE;
3106 wd->autoperiod = autoperiod;
3108 if (wd->input_panel_layout == ELM_INPUT_PANEL_LAYOUT_URL ||
3109 wd->input_panel_layout == ELM_INPUT_PANEL_LAYOUT_EMAIL)
3110 wd->autoperiod = EINA_FALSE;
3112 edje_object_part_text_autoperiod_set(wd->ent, "elm.text", wd->autoperiod);
3116 * Set the font size on the entry object
3118 * @param obj The entry object
3119 * @param size font size
3124 elm_entry_fontsize_set(Evas_Object *obj, int fontsize)
3126 ELM_CHECK_WIDTYPE(obj, widtype);
3127 Widget_Data *wd = elm_widget_data_get(obj);
3128 Eina_Strbuf *fontbuf = NULL;
3133 t = eina_stringshare_add(elm_entry_entry_get(obj));
3134 fontbuf = eina_strbuf_new();
3135 eina_strbuf_append_printf(fontbuf, "%d", fontsize);
3137 if (fontsize == 0) removeflag = 1; // remove fontsize tag
3139 if (_stringshare_key_value_replace(&t, "font_size", eina_strbuf_string_get(fontbuf), removeflag) == 0)
3141 elm_entry_entry_set(obj, t);
3145 eina_strbuf_free(fontbuf);
3146 eina_stringshare_del(t);
3150 * Set the text align on the entry object
3152 * @param obj The entry object
3153 * @param align align mode
3158 elm_entry_text_align_set(Evas_Object *obj, const char *alignmode)
3160 ELM_CHECK_WIDTYPE(obj, widtype);
3161 Widget_Data *wd = elm_widget_data_get(obj);
3166 t = eina_stringshare_add(elm_entry_entry_get(obj));
3168 if (len <= 0) return;
3170 if (_stringshare_key_value_replace(&t, "align", alignmode, 0) == 0)
3171 elm_entry_entry_set(obj, t);
3175 eina_stringshare_del(t);
3179 * Set the text color on the entry object
3181 * @param obj The entry object
3182 * @param r Red property background color of The entry object
3183 * @param g Green property background color of The entry object
3184 * @param b Blue property background color of The entry object
3185 * @param a Alpha property background alpha of The entry object
3190 elm_entry_text_color_set(Evas_Object *obj, unsigned int r, unsigned int g, unsigned int b, unsigned int a)
3192 ELM_CHECK_WIDTYPE(obj, widtype);
3193 Widget_Data *wd = elm_widget_data_get(obj);
3194 Eina_Strbuf *colorbuf = NULL;
3199 t = eina_stringshare_add(elm_entry_entry_get(obj));
3201 if (len <= 0) return;
3202 colorbuf = eina_strbuf_new();
3203 eina_strbuf_append_printf(colorbuf, "#%02X%02X%02X%02X", r, g, b, a);
3205 if (_stringshare_key_value_replace(&t, "color", eina_strbuf_string_get(colorbuf), 0) == 0)
3207 elm_entry_entry_set(obj, t);
3211 eina_strbuf_free(colorbuf);
3212 eina_stringshare_del(t);
3217 * Set background color of the entry
3219 * @param obj The entry object
3220 * @param r Red property background color of The entry object
3221 * @param g Green property background color of The entry object
3222 * @param b Blue property background color of The entry object
3223 * @param a Alpha property background alpha of The entry object
3227 elm_entry_background_color_set(Evas_Object *obj, unsigned int r, unsigned int g, unsigned int b, unsigned int a)
3229 ELM_CHECK_WIDTYPE(obj, widtype);
3230 Widget_Data *wd = elm_widget_data_get(obj);
3231 evas_object_color_set(wd->bg, r, g, b, a);
3233 if (wd->bgcolor == EINA_FALSE)
3236 edje_object_part_swallow(wd->ent, "entry.swallow.background", wd->bg);
3241 * Set the ellipsis behavior of the entry
3243 * @param obj The entry object
3244 * @param ellipsis To ellipsis text or not
3248 elm_entry_ellipsis_set(Evas_Object *obj, Eina_Bool ellipsis)
3250 ELM_CHECK_WIDTYPE(obj, widtype);
3251 Widget_Data *wd = elm_widget_data_get(obj);
3252 if (wd->ellipsis == ellipsis) return;
3253 wd->ellipsis = ellipsis;
3259 * This sets the attribute to show the input panel automatically.
3261 * @param obj The entry object
3262 * @param enabled If true, the input panel is appeared when entry is clicked or has a focus
3267 elm_entry_input_panel_enabled_set(Evas_Object *obj, Eina_Bool enabled)
3269 ELM_CHECK_WIDTYPE(obj, widtype);
3270 Widget_Data *wd = elm_widget_data_get(obj);
3273 wd->input_panel_enable = enabled;
3274 edje_object_part_text_input_panel_enabled_set(wd->ent, "elm.text", enabled);
3278 * Set the input panel layout of the entry
3280 * @param obj The entry object
3281 * @param layout the layout to set
3286 elm_entry_input_panel_layout_set(Evas_Object *obj, Elm_Input_Panel_Layout layout)
3288 ELM_CHECK_WIDTYPE(obj, widtype);
3289 Widget_Data *wd = elm_widget_data_get(obj);
3292 Ecore_IMF_Context *ic = elm_entry_imf_context_get(obj);
3295 wd->input_panel_layout = layout;
3297 ecore_imf_context_input_panel_layout_set(ic, (Ecore_IMF_Input_Panel_Layout)layout);
3300 /* vim:set ts=8 sw=3 sts=3 expandtab cino=>5n-2f0^-2{2(0W1st0 :*/