2 * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
4 #include <Elementary.h>
8 * @defgroup Scrolled_Entry Scrolled_Entry
11 * A scrolled entry is a convenience widget which shows
12 * a box that the user can enter text into. Unlike an
13 * @ref Entry widget, scrolled entries scroll with user
14 * input so that the window will not expand if the length
15 * of text inside the entry exceeds the initial size of the
18 * Signals that you can add callbacks for are:
19 * - "changed" - The text within the entry was changed
20 * - "activated" - The entry has received focus and the cursor
21 * - "press" - The entry has been clicked
22 * - "longpressed" - The entry has been clicked for a couple seconds
23 * - "clicked" - The entry has been clicked
24 * - "clicked,double" - The entry has been double clicked
25 * - "focused" - The entry has received focus
26 * - "unfocused" - The entry has lost focus
27 * - "selection,paste" - A paste action has occurred
28 * - "selection,copy" - A copy action has occurred
29 * - "selection,cut" - A cut action has occurred
30 * - "selection,start" - A selection has begun
31 * - "selection,changed" - The selection has changed
32 * - "selection,cleared" - The selection has been cleared
33 * - "cursor,changed" - The cursor has changed
34 * - "anchor,clicked" - The anchor has been clicked
37 typedef struct _Widget_Data Widget_Data;
41 Evas_Object *scroller;
43 Elm_Scroller_Policy policy_h, policy_v;
44 Eina_Bool single_line : 1;
47 static const char *widtype = NULL;
49 static const char SIG_CHANGED[] = "changed";
50 static const char SIG_ACTIVATED[] = "activated";
51 static const char SIG_PRESS[] = "press";
52 static const char SIG_LONGPRESSED[] = "longpressed";
53 static const char SIG_CLICKED[] = "clicked";
54 static const char SIG_CLICKED_DOUBLE[] = "clicked,double";
55 static const char SIG_FOCUSED[] = "focused";
56 static const char SIG_UNFOCUSED[] = "unfocused";
57 static const char SIG_SELECTION_PASTE[] = "selection,paste";
58 static const char SIG_SELECTION_COPY[] = "selection,copy";
59 static const char SIG_SELECTION_CUT[] = "selection,cut";
60 static const char SIG_SELECTION_START[] = "selection,start";
61 static const char SIG_SELECTION_CHANGED[] = "selection,changed";
62 static const char SIG_SELECTION_CLEARED[] = "selection,cleared";
63 static const char SIG_CURSOR_CHANGED[] = "cursor,changed";
64 static const char SIG_ANCHOR_CLICKED[] = "anchor,clicked";
65 static const Evas_Smart_Cb_Description _signals[] = {
69 {SIG_LONGPRESSED, ""},
71 {SIG_CLICKED_DOUBLE, ""},
74 {SIG_SELECTION_PASTE, ""},
75 {SIG_SELECTION_COPY, ""},
76 {SIG_SELECTION_CUT, ""},
77 {SIG_SELECTION_START, ""},
78 {SIG_SELECTION_CHANGED, ""},
79 {SIG_SELECTION_CLEARED, ""},
80 {SIG_CURSOR_CHANGED, ""},
81 {SIG_ANCHOR_CLICKED, ""},
86 _del_hook(Evas_Object *obj)
88 Widget_Data *wd = elm_widget_data_get(obj);
94 _theme_hook(Evas_Object *obj)
96 Widget_Data *wd = elm_widget_data_get(obj);
98 elm_object_style_set(wd->entry, elm_widget_style_get(obj));
99 elm_object_style_set(wd->scroller, elm_widget_style_get(obj));
103 _sizing_eval(Evas_Object *obj)
105 Widget_Data *wd = elm_widget_data_get(obj);
106 Evas_Coord minw, minh;
108 evas_object_size_hint_min_get(wd->scroller, &minw, &minh);
109 evas_object_size_hint_min_set(obj, minw, minh);
111 evas_object_size_hint_max_set(obj, -1, minh);
113 evas_object_size_hint_max_set(obj, -1, -1);
117 _on_focus_hook(void *data __UNUSED__, Evas_Object *obj)
119 Widget_Data *wd = elm_widget_data_get(obj);
121 if (elm_widget_focus_get(obj))
122 elm_widget_focus_steal(wd->entry);
126 _disable_hook(Evas_Object *obj)
128 Widget_Data *wd = elm_widget_data_get(obj);
130 elm_object_disabled_set(wd->entry, elm_widget_disabled_get(obj));
134 _entry_changed(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
137 evas_object_smart_callback_call(data, SIG_CHANGED, NULL);
141 _entry_activated(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
143 evas_object_smart_callback_call(data, SIG_ACTIVATED, NULL);
147 _entry_press(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
149 evas_object_smart_callback_call(data, SIG_PRESS, NULL);
153 _entry_clicked(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
155 evas_object_smart_callback_call(data, SIG_CLICKED, NULL);
159 _entry_clicked_double(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
161 evas_object_smart_callback_call(data, SIG_CLICKED_DOUBLE, NULL);
165 _entry_cursor_changed(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
167 evas_object_smart_callback_call(data, SIG_CURSOR_CHANGED, NULL);
171 _entry_anchor_clicked(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
173 evas_object_smart_callback_call(data, SIG_ANCHOR_CLICKED, NULL);
177 _entry_selection_start(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
179 evas_object_smart_callback_call(data, SIG_SELECTION_START, NULL);
183 _entry_selection_changed(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
185 evas_object_smart_callback_call(data, SIG_SELECTION_CHANGED, NULL);
189 _entry_selection_cleared(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
191 evas_object_smart_callback_call(data, SIG_SELECTION_CLEARED, NULL);
195 _entry_selection_paste(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
197 evas_object_smart_callback_call(data, SIG_SELECTION_PASTE, NULL);
201 _entry_selection_copy(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
203 evas_object_smart_callback_call(data, SIG_SELECTION_COPY, NULL);
207 _entry_selection_cut(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
209 evas_object_smart_callback_call(data, SIG_SELECTION_CUT, NULL);
213 _entry_longpressed(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
215 evas_object_smart_callback_call(data, SIG_LONGPRESSED, NULL);
219 _entry_focused(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
221 evas_object_smart_callback_call(data, SIG_FOCUSED, NULL);
225 _entry_unfocused(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
227 evas_object_smart_callback_call(data, SIG_UNFOCUSED, NULL);
232 * This adds a scrolled entry to @p parent object.
234 * @param parent The parent object
235 * @return The new object or NULL if it cannot be created
237 * @ingroup Scrolled_Entry
240 elm_scrolled_entry_add(Evas_Object *parent)
246 wd = ELM_NEW(Widget_Data);
247 e = evas_object_evas_get(parent);
248 obj = elm_widget_add(e);
249 ELM_SET_WIDTYPE(widtype, "scrolled_entry");
250 elm_widget_type_set(obj, "scrolled_entry");
251 elm_widget_sub_object_add(parent, obj);
252 elm_widget_on_focus_hook_set(obj, _on_focus_hook, NULL);
253 elm_widget_data_set(obj, wd);
254 elm_widget_del_hook_set(obj, _del_hook);
255 elm_widget_disable_hook_set(obj, _disable_hook);
256 elm_widget_can_focus_set(obj, 1);
257 elm_widget_theme_hook_set(obj, _theme_hook);
259 wd->scroller = elm_scroller_add(parent);
260 elm_widget_resize_object_set(obj, wd->scroller);
261 elm_scroller_bounce_set(wd->scroller, 0, 0);
263 wd->entry = elm_entry_add(parent);
264 evas_object_size_hint_weight_set(wd->entry, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
265 evas_object_size_hint_align_set(wd->entry, EVAS_HINT_FILL, EVAS_HINT_FILL);
266 elm_scroller_content_set(wd->scroller, wd->entry);
267 evas_object_show(wd->entry);
269 evas_object_smart_callback_add(wd->entry, "changed", _entry_changed, obj);
270 evas_object_smart_callback_add(wd->entry, "activated", _entry_activated, obj);
271 evas_object_smart_callback_add(wd->entry, "press", _entry_press, obj);
272 evas_object_smart_callback_add(wd->entry, "clicked", _entry_clicked, obj);
273 evas_object_smart_callback_add(wd->entry, "clicked,double", _entry_clicked_double, obj);
274 evas_object_smart_callback_add(wd->entry, "cursor,changed", _entry_cursor_changed, obj);
275 evas_object_smart_callback_add(wd->entry, "anchor,clicked", _entry_anchor_clicked, obj);
276 evas_object_smart_callback_add(wd->entry, "selection,start", _entry_selection_start, obj);
277 evas_object_smart_callback_add(wd->entry, "selection,changed", _entry_selection_changed, obj);
278 evas_object_smart_callback_add(wd->entry, "selection,cleared", _entry_selection_cleared, obj);
279 evas_object_smart_callback_add(wd->entry, "selection,paste", _entry_selection_paste, obj);
280 evas_object_smart_callback_add(wd->entry, "selection,copy", _entry_selection_copy, obj);
281 evas_object_smart_callback_add(wd->entry, "selection,cut", _entry_selection_cut, obj);
282 evas_object_smart_callback_add(wd->entry, "longpressed", _entry_longpressed, obj);
283 evas_object_smart_callback_add(wd->entry, "focused", _entry_focused, obj);
284 evas_object_smart_callback_add(wd->entry, "unfocused", _entry_unfocused, obj);
288 // TODO: convert Elementary to subclassing of Evas_Smart_Class
289 // TODO: and save some bytes, making descriptions per-class and not instance!
290 evas_object_smart_callbacks_descriptions_set(obj, _signals);
295 * This sets the scrolled entry object not to line wrap. All input will
296 * be on a single line, and the entry box will scroll with user input.
298 * @param obj The scrolled entry object
299 * @param single_line If true, the text in the scrolled entry
300 * will be on a single line.
302 * @ingroup Scrolled_Entry
305 elm_scrolled_entry_single_line_set(Evas_Object *obj, Eina_Bool single_line)
307 ELM_CHECK_WIDTYPE(obj, widtype);
308 Widget_Data *wd = elm_widget_data_get(obj);
310 if (wd->single_line == single_line) return;
311 elm_entry_single_line_set(wd->entry, single_line);
312 wd->single_line = single_line;
315 elm_scroller_policy_set(wd->scroller, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_OFF);
316 elm_scroller_content_min_limit(wd->scroller, 0, 1);
320 elm_scroller_policy_set(wd->scroller, wd->policy_h, wd->policy_v);
321 elm_scroller_content_min_limit(wd->scroller, 0, 0);
327 * This returns true if the scrolled entry has been set to single line mode.
328 * See also elm_scrolled_entry_single_line_set().
330 * @param obj The scrolled entry object
331 * @return single_line If true, the text in the scrolled entry is set to display
334 * @ingroup Scrolled_Entry
337 elm_scrolled_entry_single_line_get(const Evas_Object *obj)
339 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
340 Widget_Data *wd = elm_widget_data_get(obj);
341 if (!wd) return EINA_FALSE;
342 return elm_entry_single_line_get(wd->entry);
347 * This sets the scrolled entry object to password mode. All text entered
348 * and/or displayed within the widget will be replaced with asterisks (*).
350 * @param obj The scrolled entry object
351 * @param password If true, password mode is enabled.
353 * @ingroup Scrolled_Entry
356 elm_scrolled_entry_password_set(Evas_Object *obj, Eina_Bool password)
358 ELM_CHECK_WIDTYPE(obj, widtype);
359 Widget_Data *wd = elm_widget_data_get(obj);
361 elm_entry_password_set(wd->entry, password);
365 * This returns whether password mode is enabled.
366 * See also elm_scrolled_entry_password_set().
368 * @param obj The scrolled entry object
369 * @return If true, the scrolled entry is set to display all characters
372 * @ingroup Scrolled_Entry
375 elm_scrolled_entry_password_get(const Evas_Object *obj)
377 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
378 Widget_Data *wd = elm_widget_data_get(obj);
379 if (!wd) return EINA_FALSE;
380 return elm_entry_password_get(wd->entry);
385 * This sets the text displayed within the scrolled entry to @p entry.
387 * @param obj The scrolled entry object
388 * @param entry The text to be displayed
390 * @ingroup Scrolled_Entry
393 elm_scrolled_entry_entry_set(Evas_Object *obj, const char *entry)
395 ELM_CHECK_WIDTYPE(obj, widtype);
396 Widget_Data *wd = elm_widget_data_get(obj);
398 elm_entry_entry_set(wd->entry, entry);
402 * This returns the text currently shown in object @p entry.
403 * See also elm_scrolled_entry_entry_set().
405 * @param obj The scrolled entry object
406 * @return The currently displayed text or NULL on failure
408 * @ingroup Scrolled_Entry
411 elm_scrolled_entry_entry_get(const Evas_Object *obj)
413 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
414 Widget_Data *wd = elm_widget_data_get(obj);
415 if (!wd) return NULL;
416 return elm_entry_entry_get(wd->entry);
420 * This returns all selected text within the scrolled entry.
422 * @param obj The scrolled entry object
423 * @return The selected text within the scrolled entry or NULL on failure
425 * @ingroup Scrolled_Entry
428 elm_scrolled_entry_selection_get(const Evas_Object *obj)
430 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
431 Widget_Data *wd = elm_widget_data_get(obj);
432 if (!wd) return NULL;
433 return elm_entry_selection_get(wd->entry);
437 * This inserts text in @p entry at the beginning of the scrolled entry
440 * @param obj The scrolled entry object
441 * @param entry The text to insert
443 * @ingroup Scrolled_Entry
446 elm_scrolled_entry_entry_insert(Evas_Object *obj, const char *entry)
448 ELM_CHECK_WIDTYPE(obj, widtype);
449 Widget_Data *wd = elm_widget_data_get(obj);
451 elm_entry_entry_insert(wd->entry, entry);
455 * This enables word line wrapping in the scrolled entry object. It is the opposite
456 * of elm_scrolled_entry_single_line_set(). Additionally, setting this disables
457 * character line wrapping.
458 * See also elm_scrolled_entry_line_char_wrap_set().
460 * @param obj The scrolled entry object
461 * @param wrap If true, the scrolled entry will be wrapped once it reaches the end
462 * of the object. Wrapping will occur at the end of the word before the end of the
465 * @ingroup Scrolled_Entry
468 elm_scrolled_entry_line_wrap_set(Evas_Object *obj, Eina_Bool wrap)
470 ELM_CHECK_WIDTYPE(obj, widtype);
471 Widget_Data *wd = elm_widget_data_get(obj);
473 elm_entry_line_wrap_set(wd->entry, wrap);
477 * This enables character line wrapping in the scrolled entry object. It is the opposite
478 * of elm_scrolled_entry_single_line_set(). Additionally, setting this disables
479 * word line wrapping.
480 * See also elm_scrolled_entry_line_wrap_set().
482 * @param obj The scrolled entry object
483 * @param wrap If true, the scrolled entry will be wrapped once it reaches the end
484 * of the object. Wrapping will occur immediately upon reaching the end of the object.
486 * @ingroup Scrolled_Entry
489 elm_scrolled_entry_line_char_wrap_set(Evas_Object *obj, Eina_Bool wrap)
491 ELM_CHECK_WIDTYPE(obj, widtype);
492 Widget_Data *wd = elm_widget_data_get(obj);
494 elm_entry_line_char_wrap_set(wd->entry, wrap);
498 * This sets the editable attribute of the scrolled entry.
500 * @param obj The scrolled entry object
501 * @param editable If true, the scrolled entry will be editable by the user.
502 * If false, it will be set to the disabled state.
504 * @ingroup Scrolled_Entry
507 elm_scrolled_entry_editable_set(Evas_Object *obj, Eina_Bool editable)
509 ELM_CHECK_WIDTYPE(obj, widtype);
510 Widget_Data *wd = elm_widget_data_get(obj);
512 elm_entry_editable_set(wd->entry, editable);
516 * This gets the editable attribute of the scrolled entry.
517 * See also elm_scrolled_entry_editable_set().
519 * @param obj The scrolled entry object
520 * @return If true, the scrolled entry is editable by the user.
521 * If false, it is not editable by the user
523 * @ingroup Scrolled_Entry
526 elm_scrolled_entry_editable_get(const Evas_Object *obj)
528 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
529 Widget_Data *wd = elm_widget_data_get(obj);
530 if (!wd) return EINA_FALSE;
531 return elm_entry_editable_get(wd->entry);
536 * This drops any existing text selection within the scrolled entry.
538 * @param obj The scrolled entry object
540 * @ingroup Scrolled_Entry
543 elm_scrolled_entry_select_none(Evas_Object *obj)
545 ELM_CHECK_WIDTYPE(obj, widtype);
546 Widget_Data *wd = elm_widget_data_get(obj);
548 elm_entry_select_none(wd->entry);
552 * This selects all text within the scrolled entry.
554 * @param obj The scrolled entry object
556 * @ingroup Scrolled_Entry
559 elm_scrolled_entry_select_all(Evas_Object *obj)
561 ELM_CHECK_WIDTYPE(obj, widtype);
562 Widget_Data *wd = elm_widget_data_get(obj);
564 elm_entry_select_all(wd->entry);
568 * This moves the cursor one place to the right within the entry.
570 * @param obj The scrolled entry object
571 * @return EINA_TRUE upon success, EINA_FALSE upon failure
573 * @ingroup Scrolled_Entry
576 elm_scrolled_entry_cursor_next(Evas_Object *obj)
578 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
579 Widget_Data *wd = elm_widget_data_get(obj);
580 if (!wd) return EINA_FALSE;
581 return elm_entry_cursor_next(wd->entry);
585 * This moves the cursor one place to the left within the entry.
587 * @param obj The scrolled entry object
588 * @return EINA_TRUE upon success, EINA_FALSE upon failure
590 * @ingroup Scrolled_Entry
593 elm_scrolled_entry_cursor_prev(Evas_Object *obj)
595 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
596 Widget_Data *wd = elm_widget_data_get(obj);
597 if (!wd) return EINA_FALSE;
598 return elm_entry_cursor_prev(wd->entry);
602 * This moves the cursor one line up within the entry.
604 * @param obj The scrolled entry object
605 * @return EINA_TRUE upon success, EINA_FALSE upon failure
607 * @ingroup Scrolled_Entry
610 elm_scrolled_entry_cursor_up(Evas_Object *obj)
612 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
613 Widget_Data *wd = elm_widget_data_get(obj);
614 if (!wd) return EINA_FALSE;
615 return elm_entry_cursor_up(wd->entry);
619 * This moves the cursor one line down within the entry.
621 * @param obj The scrolled entry object
622 * @return EINA_TRUE upon success, EINA_FALSE upon failure
624 * @ingroup Scrolled_Entry
627 elm_scrolled_entry_cursor_down(Evas_Object *obj)
629 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
630 Widget_Data *wd = elm_widget_data_get(obj);
631 if (!wd) return EINA_FALSE;
632 return elm_entry_cursor_down(wd->entry);
636 * This moves the cursor to the beginning of the entry.
638 * @param obj The scrolled entry object
640 * @ingroup Scrolled_Entry
643 elm_scrolled_entry_cursor_begin_set(Evas_Object *obj)
645 ELM_CHECK_WIDTYPE(obj, widtype);
646 Widget_Data *wd = elm_widget_data_get(obj);
648 elm_entry_cursor_begin_set(wd->entry);
652 * This moves the cursor to the end of the entry.
654 * @param obj The scrolled entry object
656 * @ingroup Scrolled_Entry
659 elm_scrolled_entry_cursor_end_set(Evas_Object *obj)
661 ELM_CHECK_WIDTYPE(obj, widtype);
662 Widget_Data *wd = elm_widget_data_get(obj);
664 elm_entry_cursor_end_set(wd->entry);
668 * This moves the cursor to the beginning of the current line.
670 * @param obj The scrolled entry object
672 * @ingroup Scrolled_Entry
675 elm_scrolled_entry_cursor_line_begin_set(Evas_Object *obj)
677 ELM_CHECK_WIDTYPE(obj, widtype);
678 Widget_Data *wd = elm_widget_data_get(obj);
680 elm_entry_cursor_line_begin_set(wd->entry);
684 * This moves the cursor to the end of the current line.
686 * @param obj The scrolled entry object
688 * @ingroup Scrolled_Entry
691 elm_scrolled_entry_cursor_line_end_set(Evas_Object *obj)
693 ELM_CHECK_WIDTYPE(obj, widtype);
694 Widget_Data *wd = elm_widget_data_get(obj);
696 elm_entry_cursor_line_end_set(wd->entry);
700 * This begins a selection within the scrolled entry as though
701 * the user were holding down the mouse button to make a selection.
703 * @param obj The scrolled entry object
705 * @ingroup Scrolled_Entry
708 elm_scrolled_entry_cursor_selection_begin(Evas_Object *obj)
710 ELM_CHECK_WIDTYPE(obj, widtype);
711 Widget_Data *wd = elm_widget_data_get(obj);
713 elm_entry_cursor_selection_begin(wd->entry);
717 * This ends a selection within the scrolled entry as though
718 * the user had just released the mouse button while making a selection.
720 * @param obj The scrolled entry object
722 * @ingroup Scrolled_Entry
725 elm_scrolled_entry_cursor_selection_end(Evas_Object *obj)
727 ELM_CHECK_WIDTYPE(obj, widtype);
728 Widget_Data *wd = elm_widget_data_get(obj);
730 elm_entry_cursor_selection_end(wd->entry);
736 * @param obj The scrolled entry object
737 * @return TODO: fill this in
739 * @ingroup Scrolled_Entry
742 elm_scrolled_entry_cursor_is_format_get(const Evas_Object *obj)
744 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
745 Widget_Data *wd = elm_widget_data_get(obj);
746 if (!wd) return EINA_FALSE;
747 return elm_entry_cursor_is_format_get(wd->entry);
751 * This returns whether the cursor is visible.
753 * @param obj The scrolled entry object
754 * @return If true, the cursor is visible.
756 * @ingroup Scrolled_Entry
759 elm_scrolled_entry_cursor_is_visible_format_get(const Evas_Object *obj)
761 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
762 Widget_Data *wd = elm_widget_data_get(obj);
763 if (!wd) return EINA_FALSE;
764 return elm_entry_cursor_is_visible_format_get(wd->entry);
770 * @param obj The scrolled entry object
771 * @return TODO: fill this in
773 * @ingroup Scrolled_Entry
776 elm_scrolled_entry_cursor_content_get(const Evas_Object *obj)
778 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
779 Widget_Data *wd = elm_widget_data_get(obj);
780 if (!wd) return NULL;
781 return elm_entry_cursor_content_get(wd->entry);
785 * This executes a "cut" action on the selected text in the scrolled entry.
787 * @param obj The scrolled entry object
789 * @ingroup Scrolled_Entry
792 elm_scrolled_entry_selection_cut(Evas_Object *obj)
794 ELM_CHECK_WIDTYPE(obj, widtype);
795 Widget_Data *wd = elm_widget_data_get(obj);
797 elm_entry_selection_cut(wd->entry);
801 * This executes a "copy" action on the selected text in the scrolled entry.
803 * @param obj The scrolled entry object
805 * @ingroup Scrolled_Entry
808 elm_scrolled_entry_selection_copy(Evas_Object *obj)
810 ELM_CHECK_WIDTYPE(obj, widtype);
811 Widget_Data *wd = elm_widget_data_get(obj);
813 elm_entry_selection_copy(wd->entry);
817 * This executes a "paste" action in the scrolled entry.
819 * @param obj The scrolled entry object
821 * @ingroup Scrolled_Entry
824 elm_scrolled_entry_selection_paste(Evas_Object *obj)
826 ELM_CHECK_WIDTYPE(obj, widtype);
827 Widget_Data *wd = elm_widget_data_get(obj);
829 elm_entry_selection_paste(wd->entry);
833 * This clears and frees the items in a scrolled entry's contextual (right click) menu.
835 * @param obj The scrolled entry object
837 * @ingroup Scrolled_Entry
840 elm_scrolled_entry_context_menu_clear(Evas_Object *obj)
842 ELM_CHECK_WIDTYPE(obj, widtype);
843 Widget_Data *wd = elm_widget_data_get(obj);
845 elm_entry_context_menu_clear(wd->entry);
849 * This adds an item to the scrolled entry's contextual menu.
851 * @param obj The scrolled entry object
852 * @param label The item's text label
853 * @param icon_file The item's icon file
854 * @param icon_type The item's icon type
855 * @param func The callback to execute when the item is clicked
856 * @param data The data to associate with the item for related functions
858 * @ingroup Scrolled_Entry
861 elm_scrolled_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)
863 ELM_CHECK_WIDTYPE(obj, widtype);
864 Widget_Data *wd = elm_widget_data_get(obj);
866 elm_entry_context_menu_item_add(wd->entry, label, icon_file, icon_type, func, data);
870 * This disables the scrolled entry's contextual (right click) menu.
872 * @param obj The scrolled entry object
873 * @param disabled If true, the menu is disabled
875 * @ingroup Scrolled_Entry
878 elm_scrolled_entry_context_menu_disabled_set(Evas_Object *obj, Eina_Bool disabled)
880 ELM_CHECK_WIDTYPE(obj, widtype);
881 Widget_Data *wd = elm_widget_data_get(obj);
883 elm_entry_context_menu_disabled_set(wd->entry, disabled);
887 * This returns whether the scrolled entry's contextual (right click) menu is disabled.
889 * @param obj The scrolled entry object
890 * @return If true, the menu is disabled
892 * @ingroup Scrolled_Entry
895 elm_scrolled_entry_context_menu_disabled_get(const Evas_Object *obj)
897 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
898 Widget_Data *wd = elm_widget_data_get(obj);
899 if (!wd) return EINA_FALSE;
900 return elm_entry_context_menu_disabled_get(wd->entry);
904 * This sets the scrolled entry's scrollbar policy (ie. enabling/disabling them).
906 * @param obj The scrolled entry object
907 * @param h The horizontal scrollbar policy to apply
908 * @param v The vertical scrollbar policy to apply
910 * @ingroup Scrolled_Entry
913 elm_scrolled_entry_scrollbar_policy_set(Evas_Object *obj, Elm_Scroller_Policy h, Elm_Scroller_Policy v)
915 ELM_CHECK_WIDTYPE(obj, widtype);
916 Widget_Data *wd = elm_widget_data_get(obj);
920 elm_scroller_policy_set(wd->scroller, h, v);
924 * This enables/disables bouncing within the entry.
926 * @param obj The scrolled entry object
927 * @param h The horizontal bounce state
928 * @param v The vertical bounce state
930 * @ingroup Scrolled_Entry
933 elm_scrolled_entry_bounce_set(Evas_Object *obj, Eina_Bool h_bounce, Eina_Bool v_bounce)
935 ELM_CHECK_WIDTYPE(obj, widtype);
936 Widget_Data *wd = elm_widget_data_get(obj);
938 elm_scroller_bounce_set(wd->scroller, h_bounce, v_bounce);
941 * This set's the maximum bytes that can be added in to scrolled entry.
943 * @param obj The scrolled entry object
944 * @param max_no_of_bytes Maximum number of bytes scrolled entry can have.
946 * @ingroup Scrolled_Entry
949 elm_scrolled_entry_maximum_bytes_set(Evas_Object *obj, int max_no_of_bytes)
951 ELM_CHECK_WIDTYPE(obj, widtype);
952 Widget_Data *wd = elm_widget_data_get(obj);
954 elm_entry_maximum_bytes_set(wd->entry,max_no_of_bytes);
958 * This set's the scrolled entry in password mode with out masking the last character entered by user,
959 * and later masking the character after 2 seconds.
961 * @param obj The scrolled entry object
962 * @param show_last_character The show_last_character flag (1 for "password mode along with showing last character"
965 * @ingroup Scrolled_Entry
968 elm_scrolled_entry_password_show_last_character_set(Evas_Object *obj, Eina_Bool show_last_character)
970 ELM_CHECK_WIDTYPE(obj, widtype);
971 Widget_Data *wd = elm_widget_data_get(obj);
973 elm_entry_password_show_last_character_set(wd->entry, show_last_character);
977 * Get the input method context in the scrolled entry widget
979 * @param obj The scrolled entry object
980 * @return The input method context
982 * @ingroup Scrolled_Entry
984 EAPI Ecore_IMF_Context *elm_scrolled_entry_imf_context_get(Evas_Object *obj)
986 ELM_CHECK_WIDTYPE(obj, widtype);
987 Widget_Data *wd = elm_widget_data_get(obj);
988 if (!wd || !wd->entry) return NULL;
990 return elm_entry_imf_context_get(wd->entry);
994 * This sets the attribute to show the input panel automatically.
996 * @param obj The scrolled entry object
997 * @param enabled If true, the input panel is appeared when entry is clicked or has a focus
999 * @ingroup Scrolled_Entry
1002 elm_scrolled_entry_input_panel_enabled_set(Evas_Object *obj, Eina_Bool enabled)
1004 ELM_CHECK_WIDTYPE(obj, widtype);
1005 Widget_Data *wd = elm_widget_data_get(obj);
1006 if (!wd || !wd->entry) return;
1008 elm_entry_input_panel_enabled_set(wd->entry, enabled);
1012 * Set the input panel layout of the scrolled entry
1014 * @param obj The scrolled entry object
1015 * @param layout the layout to set
1017 * @ingroup Scrolled_Entry
1020 elm_scrolled_entry_input_panel_layout_set(Evas_Object *obj, Elm_Input_Panel_Layout layout)
1022 ELM_CHECK_WIDTYPE(obj, widtype);
1023 Widget_Data *wd = elm_widget_data_get(obj);
1024 if (!wd || !wd->entry) return;
1026 elm_entry_input_panel_layout_set(wd->entry, layout);