undeprecate elm_entry_entry_set/get
[framework/uifw/elementary.git] / src / lib / elm_entry.h
1 typedef enum
2 {
3    ELM_TEXT_FORMAT_PLAIN_UTF8,
4    ELM_TEXT_FORMAT_MARKUP_UTF8
5 } Elm_Text_Format;
6
7 /**
8  * Line wrapping types.
9  */
10 typedef enum
11 {
12    ELM_WRAP_NONE = 0, /**< No wrap - value is zero */
13    ELM_WRAP_CHAR, /**< Char wrap - wrap between characters */
14    ELM_WRAP_WORD, /**< Word wrap - wrap in allowed wrapping points (as defined in the unicode standard) */
15    ELM_WRAP_MIXED, /**< Mixed wrap - Word wrap, and if that fails, char wrap. */
16    ELM_WRAP_LAST
17 } Elm_Wrap_Type; /**< Type of word or character wrapping to use */
18
19 typedef enum
20 {
21    ELM_INPUT_PANEL_LAYOUT_NORMAL, /**< Default layout */
22    ELM_INPUT_PANEL_LAYOUT_NUMBER, /**< Number layout */
23    ELM_INPUT_PANEL_LAYOUT_EMAIL, /**< Email layout */
24    ELM_INPUT_PANEL_LAYOUT_URL, /**< URL layout */
25    ELM_INPUT_PANEL_LAYOUT_PHONENUMBER, /**< Phone Number layout */
26    ELM_INPUT_PANEL_LAYOUT_IP, /**< IP layout */
27    ELM_INPUT_PANEL_LAYOUT_MONTH, /**< Month layout */
28    ELM_INPUT_PANEL_LAYOUT_NUMBERONLY, /**< Number Only layout */
29    ELM_INPUT_PANEL_LAYOUT_INVALID // XXX: remove this so we can expand
30 } Elm_Input_Panel_Layout; /**< Type of input panel (virtual keyboard) to use */
31
32 typedef enum
33 {
34    ELM_AUTOCAPITAL_TYPE_NONE, /**< No auto-capitalization when typing */
35    ELM_AUTOCAPITAL_TYPE_WORD, /**< Autocapitalize each word typed */
36    ELM_AUTOCAPITAL_TYPE_SENTENCE, /**< Autocapitalize the start of each sentence */
37    ELM_AUTOCAPITAL_TYPE_ALLCHARACTER, /**< Autocapitalize all letters */
38 } Elm_Autocapital_Type; /**< Choose method of auto-capitalization */
39
40 /**
41  * @defgroup Entry Entry
42  *
43  * @image html img/widget/entry/preview-00.png
44  * @image latex img/widget/entry/preview-00.eps width=\textwidth
45  * @image html img/widget/entry/preview-01.png
46  * @image latex img/widget/entry/preview-01.eps width=\textwidth
47  * @image html img/widget/entry/preview-02.png
48  * @image latex img/widget/entry/preview-02.eps width=\textwidth
49  * @image html img/widget/entry/preview-03.png
50  * @image latex img/widget/entry/preview-03.eps width=\textwidth
51  *
52  * An entry is a convenience widget which shows a box that the user can
53  * enter text into. Entries by default don't scroll, so they grow to
54  * accomodate the entire text, resizing the parent window as needed. This
55  * can be changed with the elm_entry_scrollable_set() function.
56  *
57  * They can also be single line or multi line (the default) and when set
58  * to multi line mode they support text wrapping in any of the modes
59  * indicated by Elm_Wrap_Type.
60  *
61  * Other features include password mode, filtering of inserted text with
62  * elm_entry_text_filter_append() and related functions, inline "items" and
63  * formatted markup text.
64  *
65  * @section entry-markup Formatted text
66  *
67  * The markup tags supported by the Entry are defined by the theme, but
68  * even when writing new themes or extensions it's a good idea to stick to
69  * a sane default, to maintain coherency and avoid application breakages.
70  * Currently defined by the default theme are the following tags:
71  * @li \<br\>: Inserts a line break.
72  * @li \<ps\>: Inserts a paragraph separator. This is preferred over line
73  * breaks.
74  * @li \<tab\>: Inserts a tab.
75  * @li \<em\>...\</em\>: Emphasis. Sets the @em oblique style for the
76  * enclosed text.
77  * @li \<b\>...\</b\>: Sets the @b bold style for the enclosed text.
78  * @li \<link\>...\</link\>: Underlines the enclosed text.
79  * @li \<hilight\>...\</hilight\>: Hilights the enclosed text.
80  *
81  * @section entry-special Special markups
82  *
83  * Besides those used to format text, entries support two special markup
84  * tags used to insert clickable portions of text or items inlined within
85  * the text.
86  *
87  * @subsection entry-anchors Anchors
88  *
89  * Anchors are similar to HTML anchors. Text can be surrounded by \<a\> and
90  * \</a\> tags and an event will be generated when this text is clicked,
91  * like this:
92  *
93  * @code
94  * This text is outside <a href=anc-01>but this one is an anchor</a>
95  * @endcode
96  *
97  * The @c href attribute in the opening tag gives the name that will be
98  * used to identify the anchor and it can be any valid utf8 string.
99  *
100  * When an anchor is clicked, an @c "anchor,clicked" signal is emitted with
101  * an #Elm_Entry_Anchor_Info in the @c event_info parameter for the
102  * callback function. The same applies for "anchor,in" (mouse in), "anchor,out"
103  * (mouse out), "anchor,down" (mouse down), and "anchor,up" (mouse up) events on
104  * an anchor.
105  *
106  * @subsection entry-items Items
107  *
108  * Inlined in the text, any other @c Evas_Object can be inserted by using
109  * \<item\> tags this way:
110  *
111  * @code
112  * <item size=16x16 vsize=full href=emoticon/haha></item>
113  * @endcode
114  *
115  * Just like with anchors, the @c href identifies each item, but these need,
116  * in addition, to indicate their size, which is done using any one of
117  * @c size, @c absize or @c relsize attributes. These attributes take their
118  * value in the WxH format, where W is the width and H the height of the
119  * item.
120  *
121  * @li absize: Absolute pixel size for the item. Whatever value is set will
122  * be the item's size regardless of any scale value the object may have
123  * been set to. The final line height will be adjusted to fit larger items.
124  * @li size: Similar to @c absize, but it's adjusted to the scale value set
125  * for the object.
126  * @li relsize: Size is adjusted for the item to fit within the current
127  * line height.
128  *
129  * Besides their size, items are specificed a @c vsize value that affects
130  * how their final size and position are calculated. The possible values
131  * are:
132  * @li ascent: Item will be placed within the line's baseline and its
133  * ascent. That is, the height between the line where all characters are
134  * positioned and the highest point in the line. For @c size and @c absize
135  * items, the descent value will be added to the total line height to make
136  * them fit. @c relsize items will be adjusted to fit within this space.
137  * @li full: Items will be placed between the descent and ascent, or the
138  * lowest point in the line and its highest.
139  *
140  * The next image shows different configurations of items and how
141  * the previously mentioned options affect their sizes. In all cases,
142  * the green line indicates the ascent, blue for the baseline and red for
143  * the descent.
144  *
145  * @image html entry_item.png
146  * @image latex entry_item.eps width=\textwidth
147  *
148  * And another one to show how size differs from absize. In the first one,
149  * the scale value is set to 1.0, while the second one is using one of 2.0.
150  *
151  * @image html entry_item_scale.png
152  * @image latex entry_item_scale.eps width=\textwidth
153  *
154  * After the size for an item is calculated, the entry will request an
155  * object to place in its space. For this, the functions set with
156  * elm_entry_item_provider_append() and related functions will be called
157  * in order until one of them returns a @c non-NULL value. If no providers
158  * are available, or all of them return @c NULL, then the entry falls back
159  * to one of the internal defaults, provided the name matches with one of
160  * them.
161  *
162  * All of the following are currently supported:
163  *
164  * - emoticon/angry
165  * - emoticon/angry-shout
166  * - emoticon/crazy-laugh
167  * - emoticon/evil-laugh
168  * - emoticon/evil
169  * - emoticon/goggle-smile
170  * - emoticon/grumpy
171  * - emoticon/grumpy-smile
172  * - emoticon/guilty
173  * - emoticon/guilty-smile
174  * - emoticon/haha
175  * - emoticon/half-smile
176  * - emoticon/happy-panting
177  * - emoticon/happy
178  * - emoticon/indifferent
179  * - emoticon/kiss
180  * - emoticon/knowing-grin
181  * - emoticon/laugh
182  * - emoticon/little-bit-sorry
183  * - emoticon/love-lots
184  * - emoticon/love
185  * - emoticon/minimal-smile
186  * - emoticon/not-happy
187  * - emoticon/not-impressed
188  * - emoticon/omg
189  * - emoticon/opensmile
190  * - emoticon/smile
191  * - emoticon/sorry
192  * - emoticon/squint-laugh
193  * - emoticon/surprised
194  * - emoticon/suspicious
195  * - emoticon/tongue-dangling
196  * - emoticon/tongue-poke
197  * - emoticon/uh
198  * - emoticon/unhappy
199  * - emoticon/very-sorry
200  * - emoticon/what
201  * - emoticon/wink
202  * - emoticon/worried
203  * - emoticon/wtf
204  *
205  * Alternatively, an item may reference an image by its path, using
206  * the URI form @c file:///path/to/an/image.png and the entry will then
207  * use that image for the item.
208  *
209  * @section entry-files Loading and saving files
210  *
211  * Entries have convinience functions to load text from a file and save
212  * changes back to it after a short delay. The automatic saving is enabled
213  * by default, but can be disabled with elm_entry_autosave_set() and files
214  * can be loaded directly as plain text or have any markup in them
215  * recognized. See elm_entry_file_set() for more details.
216  *
217  * @section entry-signals Emitted signals
218  *
219  * This widget emits the following signals:
220  *
221  * @li "changed": The text within the entry was changed.
222  * @li "changed,user": The text within the entry was changed because of user interaction.
223  * @li "activated": The enter key was pressed on a single line entry.
224  * @li "press": A mouse button has been pressed on the entry.
225  * @li "longpressed": A mouse button has been pressed and held for a couple
226  * seconds.
227  * @li "clicked": The entry has been clicked (mouse press and release).
228  * @li "clicked,double": The entry has been double clicked.
229  * @li "clicked,triple": The entry has been triple clicked.
230  * @li "focused": The entry has received focus.
231  * @li "unfocused": The entry has lost focus.
232  * @li "selection,paste": A paste of the clipboard contents was requested.
233  * @li "selection,copy": A copy of the selected text into the clipboard was
234  * requested.
235  * @li "selection,cut": A cut of the selected text into the clipboard was
236  * requested.
237  * @li "selection,start": A selection has begun and no previous selection
238  * existed.
239  * @li "selection,changed": The current selection has changed.
240  * @li "selection,cleared": The current selection has been cleared.
241  * @li "cursor,changed": The cursor has changed position.
242  * @li "anchor,clicked": An anchor has been clicked. The event_info
243  * parameter for the callback will be an #Elm_Entry_Anchor_Info.
244  * @li "anchor,in": Mouse cursor has moved into an anchor. The event_info
245  * parameter for the callback will be an #Elm_Entry_Anchor_Info.
246  * @li "anchor,out": Mouse cursor has moved out of an anchor. The event_info
247  * parameter for the callback will be an #Elm_Entry_Anchor_Info.
248  * @li "anchor,up": Mouse button has been unpressed on an anchor. The event_info
249  * parameter for the callback will be an #Elm_Entry_Anchor_Info.
250  * @li "anchor,down": Mouse button has been pressed on an anchor. The event_info
251  * parameter for the callback will be an #Elm_Entry_Anchor_Info.
252  * @li "preedit,changed": The preedit string has changed.
253  * @li "language,changed": Program language changed.
254  *
255  * @section entry-examples
256  *
257  * An overview of the Entry API can be seen in @ref entry_example_01
258  *
259  * @{
260  */
261
262 /**
263  * @typedef Elm_Entry_Anchor_Info
264  *
265  * The info sent in the callback for the "anchor,clicked" signals emitted
266  * by entries.
267  */
268 typedef struct _Elm_Entry_Anchor_Info Elm_Entry_Anchor_Info;
269
270 /**
271  * @struct _Elm_Entry_Anchor_Info
272  *
273  * The info sent in the callback for the "anchor,clicked" signals emitted
274  * by entries.
275  */
276 struct _Elm_Entry_Anchor_Info
277 {
278    const char *name; /**< The name of the anchor, as stated in its href */
279    int         button; /**< The mouse button used to click on it */
280    Evas_Coord  x, /**< Anchor geometry, relative to canvas */
281                y, /**< Anchor geometry, relative to canvas */
282                w, /**< Anchor geometry, relative to canvas */
283                h; /**< Anchor geometry, relative to canvas */
284 };
285
286 /**
287  * @typedef Elm_Entry_Filter_Cb
288  * This callback type is used by entry filters to modify text.
289  * @param data The data specified as the last param when adding the filter
290  * @param entry The entry object
291  * @param text A pointer to the location of the text being filtered. This data can be modified,
292  * but any additional allocations must be managed by the user.
293  * @see elm_entry_text_filter_append
294  * @see elm_entry_text_filter_prepend
295  */
296 typedef void (*Elm_Entry_Filter_Cb)(void *data, Evas_Object *entry, char **text);
297
298 /**
299  * @typedef Elm_Entry_Change_Info
300  * This corresponds to Edje_Entry_Change_Info. Includes information about
301  * a change in the entry.
302  */
303 typedef Edje_Entry_Change_Info Elm_Entry_Change_Info;
304
305 /**
306  * This adds an entry to @p parent object.
307  *
308  * By default, entries are:
309  * @li not scrolled
310  * @li multi-line
311  * @li word wrapped
312  * @li autosave is enabled
313  *
314  * @param parent The parent object
315  * @return The new object or NULL if it cannot be created
316  */
317 EAPI Evas_Object       *elm_entry_add(Evas_Object *parent);
318
319 /**
320  * Sets the entry to single line mode.
321  *
322  * In single line mode, entries don't ever wrap when the text reaches the
323  * edge, and instead they keep growing horizontally. Pressing the @c Enter
324  * key will generate an @c "activate" event instead of adding a new line.
325  *
326  * When @p single_line is @c EINA_FALSE, line wrapping takes effect again
327  * and pressing enter will break the text into a different line
328  * without generating any events.
329  *
330  * @param obj The entry object
331  * @param single_line If true, the text in the entry
332  * will be on a single line.
333  */
334 EAPI void               elm_entry_single_line_set(Evas_Object *obj, Eina_Bool single_line);
335
336 /**
337  * Gets whether the entry is set to be single line.
338  *
339  * @param obj The entry object
340  * @return single_line If true, the text in the entry is set to display
341  * on a single line.
342  *
343  * @see elm_entry_single_line_set()
344  */
345 EAPI Eina_Bool          elm_entry_single_line_get(const Evas_Object *obj);
346
347 /**
348  * Sets the entry to password mode.
349  *
350  * In password mode, entries are implicitly single line and the display of
351  * any text in them is replaced with asterisks (*).
352  *
353  * @param obj The entry object
354  * @param password If true, password mode is enabled.
355  */
356 EAPI void               elm_entry_password_set(Evas_Object *obj, Eina_Bool password);
357
358 /**
359  * Gets whether the entry is set to password mode.
360  *
361  * @param obj The entry object
362  * @return If true, the entry is set to display all characters
363  * as asterisks (*).
364  *
365  * @see elm_entry_password_set()
366  */
367 EAPI Eina_Bool          elm_entry_password_get(const Evas_Object *obj);
368
369 /**
370  * This sets the text displayed within the entry to @p entry.
371  *
372  * @param obj The entry object
373  * @param entry The text to be displayed
374  *
375  * @note Using this function bypasses text filters
376  */
377 EAPI void               elm_entry_entry_set(Evas_Object *obj, const char *entry);
378
379 /**
380  * This returns the text currently shown in object @p entry.
381  * See also elm_entry_entry_set().
382  *
383  * @param obj The entry object
384  * @return The currently displayed text or NULL on failure
385  */
386 EAPI const char        *elm_entry_entry_get(const Evas_Object *obj);
387
388 /**
389  * Appends @p entry to the text of the entry.
390  *
391  * Adds the text in @p entry to the end of any text already present in the
392  * widget.
393  *
394  * The appended text is subject to any filters set for the widget.
395  *
396  * @param obj The entry object
397  * @param entry The text to be displayed
398  *
399  * @see elm_entry_text_filter_append()
400  */
401 EAPI void               elm_entry_entry_append(Evas_Object *obj, const char *entry);
402
403 /**
404  * Gets whether the entry is empty.
405  *
406  * Empty means no text at all. If there are any markup tags, like an item
407  * tag for which no provider finds anything, and no text is displayed, this
408  * function still returns EINA_FALSE.
409  *
410  * @param obj The entry object
411  * @return EINA_TRUE if the entry is empty, EINA_FALSE otherwise.
412  */
413 EAPI Eina_Bool          elm_entry_is_empty(const Evas_Object *obj);
414
415 /**
416  * Gets any selected text within the entry.
417  *
418  * If there's any selected text in the entry, this function returns it as
419  * a string in markup format. NULL is returned if no selection exists or
420  * if an error occurred.
421  *
422  * The returned value points to an internal string and should not be freed
423  * or modified in any way. If the @p entry object is deleted or its
424  * contents are changed, the returned pointer should be considered invalid.
425  *
426  * @param obj The entry object
427  * @return The selected text within the entry or NULL on failure
428  */
429 EAPI const char        *elm_entry_selection_get(const Evas_Object *obj);
430
431 /**
432  * Returns the actual textblock object of the entry.
433  *
434  * This function exposes the internal textblock object that actually
435  * contains and draws the text. This should be used for low-level
436  * manipulations that are otherwise not possible.
437  *
438  * Changing the textblock directly from here will not notify edje/elm to
439  * recalculate the textblock size automatically, so any modifications
440  * done to the textblock returned by this function should be followed by
441  * a call to elm_entry_calc_force().
442  *
443  * The return value is marked as const as an additional warning.
444  * One should not use the returned object with any of the generic evas
445  * functions (geometry_get/resize/move and etc), but only with the textblock
446  * functions; The former will either not work at all, or break the correct
447  * functionality.
448  *
449  * IMPORTANT: Many functions may change (i.e delete and create a new one)
450  * the internal textblock object. Do NOT cache the returned object, and try
451  * not to mix calls on this object with regular elm_entry calls (which may
452  * change the internal textblock object). This applies to all cursors
453  * returned from textblock calls, and all the other derivative values.
454  *
455  * @param obj The entry object
456  * @return The textblock object.
457  */
458 EAPI const Evas_Object *elm_entry_textblock_get(const Evas_Object *obj);
459
460 /**
461  * Forces calculation of the entry size and text layouting.
462  *
463  * This should be used after modifying the textblock object directly. See
464  * elm_entry_textblock_get() for more information.
465  *
466  * @param obj The entry object
467  *
468  * @see elm_entry_textblock_get()
469  */
470 EAPI void               elm_entry_calc_force(const Evas_Object *obj);
471
472 /**
473  * Inserts the given text into the entry at the current cursor position.
474  *
475  * This inserts text at the cursor position as if it was typed
476  * by the user (note that this also allows markup which a user
477  * can't just "type" as it would be converted to escaped text, so this
478  * call can be used to insert things like emoticon items or bold push/pop
479  * tags, other font and color change tags etc.)
480  *
481  * If any selection exists, it will be replaced by the inserted text.
482  *
483  * The inserted text is subject to any filters set for the widget.
484  *
485  * @param obj The entry object
486  * @param entry The text to insert
487  *
488  * @see elm_entry_text_filter_append()
489  */
490 EAPI void               elm_entry_entry_insert(Evas_Object *obj, const char *entry);
491
492 /**
493  * Set the line wrap type to use on multi-line entries.
494  *
495  * Sets the wrap type used by the entry to any of the specified in
496  * Elm_Wrap_Type. This tells how the text will be implicitly cut into a new
497  * line (without inserting a line break or paragraph separator) when it
498  * reaches the far edge of the widget.
499  *
500  * Note that this only makes sense for multi-line entries. A widget set
501  * to be single line will never wrap.
502  *
503  * @param obj The entry object
504  * @param wrap The wrap mode to use. See Elm_Wrap_Type for details on them
505  */
506 EAPI void               elm_entry_line_wrap_set(Evas_Object *obj, Elm_Wrap_Type wrap);
507
508 /**
509  * Gets the wrap mode the entry was set to use.
510  *
511  * @param obj The entry object
512  * @return Wrap type
513  *
514  * @see also elm_entry_line_wrap_set()
515  */
516 EAPI Elm_Wrap_Type      elm_entry_line_wrap_get(const Evas_Object *obj);
517
518 /**
519  * Sets if the entry is to be editable or not.
520  *
521  * By default, entries are editable and when focused, any text input by the
522  * user will be inserted at the current cursor position. But calling this
523  * function with @p editable as EINA_FALSE will prevent the user from
524  * inputting text into the entry.
525  *
526  * The only way to change the text of a non-editable entry is to use
527  * elm_object_text_set(), elm_entry_entry_insert() and other related
528  * functions.
529  *
530  * @param obj The entry object
531  * @param editable If EINA_TRUE, user input will be inserted in the entry,
532  * if not, the entry is read-only and no user input is allowed.
533  */
534 EAPI void               elm_entry_editable_set(Evas_Object *obj, Eina_Bool editable);
535
536 /**
537  * Gets whether the entry is editable or not.
538  *
539  * @param obj The entry object
540  * @return If true, the entry is editable by the user.
541  * If false, it is not editable by the user
542  *
543  * @see elm_entry_editable_set()
544  */
545 EAPI Eina_Bool          elm_entry_editable_get(const Evas_Object *obj);
546
547 /**
548  * This drops any existing text selection within the entry.
549  *
550  * @param obj The entry object
551  */
552 EAPI void               elm_entry_select_none(Evas_Object *obj);
553
554 /**
555  * This selects all text within the entry.
556  *
557  * @param obj The entry object
558  */
559 EAPI void               elm_entry_select_all(Evas_Object *obj);
560
561 /**
562  * This moves the cursor one place to the right within the entry.
563  *
564  * @param obj The entry object
565  * @return EINA_TRUE upon success, EINA_FALSE upon failure
566  */
567 EAPI Eina_Bool          elm_entry_cursor_next(Evas_Object *obj);
568
569 /**
570  * This moves the cursor one place to the left within the entry.
571  *
572  * @param obj The entry object
573  * @return EINA_TRUE upon success, EINA_FALSE upon failure
574  */
575 EAPI Eina_Bool          elm_entry_cursor_prev(Evas_Object *obj);
576
577 /**
578  * This moves the cursor one line up within the entry.
579  *
580  * @param obj The entry object
581  * @return EINA_TRUE upon success, EINA_FALSE upon failure
582  */
583 EAPI Eina_Bool          elm_entry_cursor_up(Evas_Object *obj);
584
585 /**
586  * This moves the cursor one line down within the entry.
587  *
588  * @param obj The entry object
589  * @return EINA_TRUE upon success, EINA_FALSE upon failure
590  */
591 EAPI Eina_Bool          elm_entry_cursor_down(Evas_Object *obj);
592
593 /**
594  * This moves the cursor to the beginning of the entry.
595  *
596  * @param obj The entry object
597  */
598 EAPI void               elm_entry_cursor_begin_set(Evas_Object *obj);
599
600 /**
601  * This moves the cursor to the end of the entry.
602  *
603  * @param obj The entry object
604  */
605 EAPI void               elm_entry_cursor_end_set(Evas_Object *obj);
606
607 /**
608  * This moves the cursor to the beginning of the current line.
609  *
610  * @param obj The entry object
611  */
612 EAPI void               elm_entry_cursor_line_begin_set(Evas_Object *obj);
613
614 /**
615  * This moves the cursor to the end of the current line.
616  *
617  * @param obj The entry object
618  */
619 EAPI void               elm_entry_cursor_line_end_set(Evas_Object *obj);
620
621 /**
622  * This begins a selection within the entry as though
623  * the user were holding down the mouse button to make a selection.
624  *
625  * @param obj The entry object
626  */
627 EAPI void               elm_entry_cursor_selection_begin(Evas_Object *obj);
628
629 /**
630  * This ends a selection within the entry as though
631  * the user had just released the mouse button while making a selection.
632  *
633  * @param obj The entry object
634  */
635 EAPI void               elm_entry_cursor_selection_end(Evas_Object *obj);
636
637 /**
638  * Gets whether a format node exists at the current cursor position.
639  *
640  * A format node is anything that defines how the text is rendered. It can
641  * be a visible format node, such as a line break or a paragraph separator,
642  * or an invisible one, such as bold begin or end tag.
643  * This function returns whether any format node exists at the current
644  * cursor position.
645  *
646  * @param obj The entry object
647  * @return EINA_TRUE if the current cursor position contains a format node,
648  * EINA_FALSE otherwise.
649  *
650  * @see elm_entry_cursor_is_visible_format_get()
651  */
652 EAPI Eina_Bool          elm_entry_cursor_is_format_get(const Evas_Object *obj);
653
654 /**
655  * Gets if the current cursor position holds a visible format node.
656  *
657  * @param obj The entry object
658  * @return EINA_TRUE if the current cursor is a visible format, EINA_FALSE
659  * if it's an invisible one or no format exists.
660  *
661  * @see elm_entry_cursor_is_format_get()
662  */
663 EAPI Eina_Bool          elm_entry_cursor_is_visible_format_get(const Evas_Object *obj);
664
665 /**
666  * Gets the character pointed by the cursor at its current position.
667  *
668  * This function returns a string with the utf8 character stored at the
669  * current cursor position.
670  * Only the text is returned, any format that may exist will not be part
671  * of the return value.
672  *
673  * @param obj The entry object
674  * @return The text pointed by the cursors.
675  */
676 EAPI const char        *elm_entry_cursor_content_get(const Evas_Object *obj);
677
678 /**
679  * This function returns the geometry of the cursor.
680  *
681  * It's useful if you want to draw something on the cursor (or where it is),
682  * or for example in the case of scrolled entry where you want to show the
683  * cursor.
684  *
685  * @param obj The entry object
686  * @param x returned geometry
687  * @param y returned geometry
688  * @param w returned geometry
689  * @param h returned geometry
690  * @return EINA_TRUE upon success, EINA_FALSE upon failure
691  */
692 EAPI Eina_Bool          elm_entry_cursor_geometry_get(const Evas_Object *obj, Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *h);
693
694 /**
695  * Sets the cursor position in the entry to the given value
696  *
697  * The value in @p pos is the index of the character position within the
698  * contents of the string as returned by elm_entry_cursor_pos_get().
699  *
700  * @param obj The entry object
701  * @param pos The position of the cursor
702  */
703 EAPI void               elm_entry_cursor_pos_set(Evas_Object *obj, int pos);
704
705 /**
706  * Retrieves the current position of the cursor in the entry
707  *
708  * @param obj The entry object
709  * @return The cursor position
710  */
711 EAPI int                elm_entry_cursor_pos_get(const Evas_Object *obj);
712
713 /**
714  * This executes a "cut" action on the selected text in the entry.
715  *
716  * @param obj The entry object
717  */
718 EAPI void               elm_entry_selection_cut(Evas_Object *obj);
719
720 /**
721  * This executes a "copy" action on the selected text in the entry.
722  *
723  * @param obj The entry object
724  */
725 EAPI void               elm_entry_selection_copy(Evas_Object *obj);
726
727 /**
728  * This executes a "paste" action in the entry.
729  *
730  * @param obj The entry object
731  */
732 EAPI void               elm_entry_selection_paste(Evas_Object *obj);
733
734 /**
735  * This clears and frees the items in a entry's contextual (longpress)
736  * menu.
737  *
738  * @param obj The entry object
739  *
740  * @see elm_entry_context_menu_item_add()
741  */
742 EAPI void               elm_entry_context_menu_clear(Evas_Object *obj);
743
744 /**
745  * This adds an item to the entry's contextual menu.
746  *
747  * A longpress on an entry will make the contextual menu show up, if this
748  * hasn't been disabled with elm_entry_context_menu_disabled_set().
749  * By default, this menu provides a few options like enabling selection mode,
750  * which is useful on embedded devices that need to be explicit about it,
751  * and when a selection exists it also shows the copy and cut actions.
752  *
753  * With this function, developers can add other options to this menu to
754  * perform any action they deem necessary.
755  *
756  * @param obj The entry object
757  * @param label The item's text label
758  * @param icon_file The item's icon file
759  * @param icon_type The item's icon type
760  * @param func The callback to execute when the item is clicked
761  * @param data The data to associate with the item for related functions
762  */
763 EAPI void               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);
764
765 /**
766  * This disables the entry's contextual (longpress) menu.
767  *
768  * @param obj The entry object
769  * @param disabled If true, the menu is disabled
770  */
771 EAPI void               elm_entry_context_menu_disabled_set(Evas_Object *obj, Eina_Bool disabled);
772
773 /**
774  * This returns whether the entry's contextual (longpress) menu is
775  * disabled.
776  *
777  * @param obj The entry object
778  * @return If true, the menu is disabled
779  */
780 EAPI Eina_Bool          elm_entry_context_menu_disabled_get(const Evas_Object *obj);
781
782 /**
783  * This appends a custom item provider to the list for that entry
784  *
785  * This appends the given callback. The list is walked from beginning to end
786  * with each function called given the item href string in the text. If the
787  * function returns an object handle other than NULL (it should create an
788  * object to do this), then this object is used to replace that item. If
789  * not the next provider is called until one provides an item object, or the
790  * default provider in entry does.
791  *
792  * @param obj The entry object
793  * @param func The function called to provide the item object
794  * @param data The data passed to @p func
795  *
796  * @see @ref entry-items
797  */
798 EAPI void               elm_entry_item_provider_append(Evas_Object *obj, Evas_Object * (*func)(void *data, Evas_Object * entry, const char *item), void *data);
799
800 /**
801  * This prepends a custom item provider to the list for that entry
802  *
803  * This prepends the given callback. See elm_entry_item_provider_append() for
804  * more information
805  *
806  * @param obj The entry object
807  * @param func The function called to provide the item object
808  * @param data The data passed to @p func
809  */
810 EAPI void               elm_entry_item_provider_prepend(Evas_Object *obj, Evas_Object * (*func)(void *data, Evas_Object * entry, const char *item), void *data);
811
812 /**
813  * This removes a custom item provider to the list for that entry
814  *
815  * This removes the given callback. See elm_entry_item_provider_append() for
816  * more information
817  *
818  * @param obj The entry object
819  * @param func The function called to provide the item object
820  * @param data The data passed to @p func
821  */
822 EAPI void               elm_entry_item_provider_remove(Evas_Object *obj, Evas_Object * (*func)(void *data, Evas_Object * entry, const char *item), void *data);
823
824 /**
825  * Append a filter function for text inserted in the entry
826  *
827  * Append the given callback to the list. This functions will be called
828  * whenever any text is inserted into the entry, with the text to be inserted
829  * as a parameter. The callback function is free to alter the text in any way
830  * it wants, but it must remember to free the given pointer and update it.
831  * If the new text is to be discarded, the function can free it and set its
832  * text parameter to NULL. This will also prevent any following filters from
833  * being called.
834  *
835  * @param obj The entry object
836  * @param func The function to use as text filter
837  * @param data User data to pass to @p func
838  */
839 EAPI void               elm_entry_text_filter_append(Evas_Object *obj, Elm_Entry_Filter_Cb func, void *data);
840
841 /**
842  * Prepend a filter function for text insdrted in the entry
843  *
844  * Prepend the given callback to the list. See elm_entry_text_filter_append()
845  * for more information
846  *
847  * @param obj The entry object
848  * @param func The function to use as text filter
849  * @param data User data to pass to @p func
850  */
851 EAPI void               elm_entry_text_filter_prepend(Evas_Object *obj, Elm_Entry_Filter_Cb func, void *data);
852
853 /**
854  * Remove a filter from the list
855  *
856  * Removes the given callback from the filter list. See
857  * elm_entry_text_filter_append() for more information.
858  *
859  * @param obj The entry object
860  * @param func The filter function to remove
861  * @param data The user data passed when adding the function
862  */
863 EAPI void               elm_entry_text_filter_remove(Evas_Object *obj, Elm_Entry_Filter_Cb func, void *data);
864
865 /**
866  * This converts a markup (HTML-like) string into UTF-8.
867  *
868  * The returned string is a malloc'ed buffer and it should be freed when
869  * not needed anymore.
870  *
871  * @param s The string (in markup) to be converted
872  * @return The converted string (in UTF-8). It should be freed.
873  */
874 EAPI char              *elm_entry_markup_to_utf8(const char *s)
875 EINA_MALLOC EINA_WARN_UNUSED_RESULT;
876
877 /**
878  * This converts a UTF-8 string into markup (HTML-like).
879  *
880  * The returned string is a malloc'ed buffer and it should be freed when
881  * not needed anymore.
882  *
883  * @param s The string (in UTF-8) to be converted
884  * @return The converted string (in markup). It should be freed.
885  */
886 EAPI char              *elm_entry_utf8_to_markup(const char *s)
887 EINA_MALLOC EINA_WARN_UNUSED_RESULT;
888
889 /**
890  * This sets the file (and implicitly loads it) for the text to display and
891  * then edit. All changes are written back to the file after a short delay if
892  * the entry object is set to autosave (which is the default).
893  *
894  * If the entry had any other file set previously, any changes made to it
895  * will be saved if the autosave feature is enabled, otherwise, the file
896  * will be silently discarded and any non-saved changes will be lost.
897  *
898  * @param obj The entry object
899  * @param file The path to the file to load and save
900  * @param format The file format
901  */
902 EAPI void               elm_entry_file_set(Evas_Object *obj, const char *file, Elm_Text_Format format);
903
904 /**
905  * Gets the file being edited by the entry.
906  *
907  * This function can be used to retrieve any file set on the entry for
908  * edition, along with the format used to load and save it.
909  *
910  * @param obj The entry object
911  * @param file The path to the file to load and save
912  * @param format The file format
913  */
914 EAPI void               elm_entry_file_get(const Evas_Object *obj, const char **file, Elm_Text_Format *format);
915
916 /**
917  * This function writes any changes made to the file set with
918  * elm_entry_file_set()
919  *
920  * @param obj The entry object
921  */
922 EAPI void               elm_entry_file_save(Evas_Object *obj);
923
924 /**
925  * This sets the entry object to 'autosave' the loaded text file or not.
926  *
927  * @param obj The entry object
928  * @param autosave Autosave the loaded file or not
929  *
930  * @see elm_entry_file_set()
931  */
932 EAPI void               elm_entry_autosave_set(Evas_Object *obj, Eina_Bool autosave);
933
934 /**
935  * This gets the entry object's 'autosave' status.
936  *
937  * @param obj The entry object
938  * @return Autosave the loaded file or not
939  *
940  * @see elm_entry_file_set()
941  */
942 EAPI Eina_Bool          elm_entry_autosave_get(const Evas_Object *obj);
943
944 /**
945  * Control pasting of text and images for the widget.
946  *
947  * Normally the entry allows both text and images to be pasted.  By setting
948  * textonly to be true, this prevents images from being pasted.
949  *
950  * Note this only changes the behaviour of text.
951  *
952  * @param obj The entry object
953  * @param textonly paste mode - EINA_TRUE is text only, EINA_FALSE is
954  * text+image+other.
955  */
956 EAPI void               elm_entry_cnp_textonly_set(Evas_Object *obj, Eina_Bool textonly);
957
958 /**
959  * Getting elm_entry text paste/drop mode.
960  *
961  * In textonly mode, only text may be pasted or dropped into the widget.
962  *
963  * @param obj The entry object
964  * @return If the widget only accepts text from pastes.
965  */
966 EAPI Eina_Bool          elm_entry_cnp_textonly_get(const Evas_Object *obj);
967
968 /**
969  * Enable or disable scrolling in entry
970  *
971  * Normally the entry is not scrollable unless you enable it with this call.
972  *
973  * @param obj The entry object
974  * @param scroll EINA_TRUE if it is to be scrollable, EINA_FALSE otherwise
975  */
976 EAPI void               elm_entry_scrollable_set(Evas_Object *obj, Eina_Bool scroll);
977
978 /**
979  * Get the scrollable state of the entry
980  *
981  * Normally the entry is not scrollable. This gets the scrollable state
982  * of the entry. See elm_entry_scrollable_set() for more information.
983  *
984  * @param obj The entry object
985  * @return The scrollable state
986  */
987 EAPI Eina_Bool          elm_entry_scrollable_get(const Evas_Object *obj);
988
989 /**
990  * This sets a widget to be displayed to the left of a scrolled entry.
991  *
992  * @param obj The scrolled entry object
993  * @param icon The widget to display on the left side of the scrolled
994  * entry.
995  *
996  * @note A previously set widget will be destroyed.
997  * @note If the object being set does not have minimum size hints set,
998  * it won't get properly displayed.
999  *
1000  * @see elm_entry_end_set()
1001  */
1002 EAPI void               elm_entry_icon_set(Evas_Object *obj, Evas_Object *icon);
1003
1004 /**
1005  * Gets the leftmost widget of the scrolled entry. This object is
1006  * owned by the scrolled entry and should not be modified.
1007  *
1008  * @param obj The scrolled entry object
1009  * @return the left widget inside the scroller
1010  */
1011 EAPI Evas_Object       *elm_entry_icon_get(const Evas_Object *obj);
1012
1013 /**
1014  * Unset the leftmost widget of the scrolled entry, unparenting and
1015  * returning it.
1016  *
1017  * @param obj The scrolled entry object
1018  * @return the previously set icon sub-object of this entry, on
1019  * success.
1020  *
1021  * @see elm_entry_icon_set()
1022  */
1023 EAPI Evas_Object       *elm_entry_icon_unset(Evas_Object *obj);
1024
1025 /**
1026  * Sets the visibility of the left-side widget of the scrolled entry,
1027  * set by elm_entry_icon_set().
1028  *
1029  * @param obj The scrolled entry object
1030  * @param setting EINA_TRUE if the object should be displayed,
1031  * EINA_FALSE if not.
1032  */
1033 EAPI void               elm_entry_icon_visible_set(Evas_Object *obj, Eina_Bool setting);
1034
1035 /**
1036  * This sets a widget to be displayed to the end of a scrolled entry.
1037  *
1038  * @param obj The scrolled entry object
1039  * @param end The widget to display on the right side of the scrolled
1040  * entry.
1041  *
1042  * @note A previously set widget will be destroyed.
1043  * @note If the object being set does not have minimum size hints set,
1044  * it won't get properly displayed.
1045  *
1046  * @see elm_entry_icon_set
1047  */
1048 EAPI void               elm_entry_end_set(Evas_Object *obj, Evas_Object *end);
1049
1050 /**
1051  * Gets the endmost widget of the scrolled entry. This object is owned
1052  * by the scrolled entry and should not be modified.
1053  *
1054  * @param obj The scrolled entry object
1055  * @return the right widget inside the scroller
1056  */
1057 EAPI Evas_Object       *elm_entry_end_get(const Evas_Object *obj);
1058
1059 /**
1060  * Unset the endmost widget of the scrolled entry, unparenting and
1061  * returning it.
1062  *
1063  * @param obj The scrolled entry object
1064  * @return the previously set icon sub-object of this entry, on
1065  * success.
1066  *
1067  * @see elm_entry_icon_set()
1068  */
1069 EAPI Evas_Object       *elm_entry_end_unset(Evas_Object *obj);
1070
1071 /**
1072  * Sets the visibility of the end widget of the scrolled entry, set by
1073  * elm_entry_end_set().
1074  *
1075  * @param obj The scrolled entry object
1076  * @param setting EINA_TRUE if the object should be displayed,
1077  * EINA_FALSE if not.
1078  */
1079 EAPI void               elm_entry_end_visible_set(Evas_Object *obj, Eina_Bool setting);
1080
1081 /**
1082  * This sets the scrolled entry's scrollbar policy (ie. enabling/disabling
1083  * them).
1084  *
1085  * Setting an entry to single-line mode with elm_entry_single_line_set()
1086  * will automatically disable the display of scrollbars when the entry
1087  * moves inside its scroller.
1088  *
1089  * @param obj The scrolled entry object
1090  * @param h The horizontal scrollbar policy to apply
1091  * @param v The vertical scrollbar policy to apply
1092  */
1093 EAPI void               elm_entry_scrollbar_policy_set(Evas_Object *obj, Elm_Scroller_Policy h, Elm_Scroller_Policy v);
1094
1095 /**
1096  * This enables/disables bouncing within the entry.
1097  *
1098  * This function sets whether the entry will bounce when scrolling reaches
1099  * the end of the contained entry.
1100  *
1101  * @param obj The scrolled entry object
1102  * @param h_bounce The horizontal bounce state
1103  * @param v_bounce The vertical bounce state
1104  */
1105 EAPI void               elm_entry_bounce_set(Evas_Object *obj, Eina_Bool h_bounce, Eina_Bool v_bounce);
1106
1107 /**
1108  * Get the bounce mode
1109  *
1110  * @param obj The Entry object
1111  * @param h_bounce Allow bounce horizontally
1112  * @param v_bounce Allow bounce vertically
1113  */
1114 EAPI void               elm_entry_bounce_get(const Evas_Object *obj, Eina_Bool *h_bounce, Eina_Bool *v_bounce);
1115
1116 /* pre-made filters for entries */
1117 /**
1118  * @typedef Elm_Entry_Filter_Limit_Size
1119  *
1120  * Data for the elm_entry_filter_limit_size() entry filter.
1121  */
1122 typedef struct _Elm_Entry_Filter_Limit_Size Elm_Entry_Filter_Limit_Size;
1123
1124 /**
1125  * @struct _Elm_Entry_Filter_Limit_Size
1126  *
1127  * Data for the elm_entry_filter_limit_size() entry filter.
1128  */
1129 struct _Elm_Entry_Filter_Limit_Size
1130 {
1131    int max_char_count;      /**< The maximum number of characters allowed. */
1132    int max_byte_count;      /**< The maximum number of bytes allowed*/
1133 };
1134
1135 /**
1136  * Filter inserted text based on user defined character and byte limits
1137  *
1138  * Add this filter to an entry to limit the characters that it will accept
1139  * based the the contents of the provided #Elm_Entry_Filter_Limit_Size.
1140  * The funtion works on the UTF-8 representation of the string, converting
1141  * it from the set markup, thus not accounting for any format in it.
1142  *
1143  * The user must create an #Elm_Entry_Filter_Limit_Size structure and pass
1144  * it as data when setting the filter. In it, it's possible to set limits
1145  * by character count or bytes (any of them is disabled if 0), and both can
1146  * be set at the same time. In that case, it first checks for characters,
1147  * then bytes.
1148  *
1149  * The function will cut the inserted text in order to allow only the first
1150  * number of characters that are still allowed. The cut is made in
1151  * characters, even when limiting by bytes, in order to always contain
1152  * valid ones and avoid half unicode characters making it in.
1153  *
1154  * This filter, like any others, does not apply when setting the entry text
1155  * directly with elm_object_text_set().
1156  */
1157 EAPI void elm_entry_filter_limit_size(void *data, Evas_Object *entry, char **text);
1158
1159 /**
1160  * @typedef Elm_Entry_Filter_Accept_Set
1161  *
1162  * Data for the elm_entry_filter_accept_set() entry filter.
1163  */
1164 typedef struct _Elm_Entry_Filter_Accept_Set Elm_Entry_Filter_Accept_Set;
1165
1166 /**
1167  * @struct _Elm_Entry_Filter_Accept_Set
1168  *
1169  * Data for the elm_entry_filter_accept_set() entry filter.
1170  */
1171 struct _Elm_Entry_Filter_Accept_Set
1172 {
1173    const char *accepted;      /**< Set of characters accepted in the entry. */
1174    const char *rejected;      /**< Set of characters rejected from the entry. */
1175 };
1176
1177 /**
1178  * Filter inserted text based on accepted or rejected sets of characters
1179  *
1180  * Add this filter to an entry to restrict the set of accepted characters
1181  * based on the sets in the provided #Elm_Entry_Filter_Accept_Set.
1182  * This structure contains both accepted and rejected sets, but they are
1183  * mutually exclusive.
1184  *
1185  * The @c accepted set takes preference, so if it is set, the filter will
1186  * only work based on the accepted characters, ignoring anything in the
1187  * @c rejected value. If @c accepted is @c NULL, then @c rejected is used.
1188  *
1189  * In both cases, the function filters by matching utf8 characters to the
1190  * raw markup text, so it can be used to remove formatting tags.
1191  *
1192  * This filter, like any others, does not apply when setting the entry text
1193  * directly with elm_object_text_set()
1194  */
1195 EAPI void                   elm_entry_filter_accept_set(void *data, Evas_Object *entry, char **text);
1196 /**
1197  * Set the input panel layout of the entry
1198  *
1199  * @param obj The entry object
1200  * @param layout layout type
1201  */
1202 EAPI void                   elm_entry_input_panel_layout_set(Evas_Object *obj, Elm_Input_Panel_Layout layout);
1203
1204 /**
1205  * Get the input panel layout of the entry
1206  *
1207  * @param obj The entry object
1208  * @return layout type
1209  *
1210  * @see elm_entry_input_panel_layout_set
1211  */
1212 EAPI Elm_Input_Panel_Layout elm_entry_input_panel_layout_get(Evas_Object *obj);
1213
1214 /**
1215  * Set the autocapitalization type on the immodule.
1216  *
1217  * @param obj The entry object
1218  * @param autocapital_type The type of autocapitalization
1219  */
1220 EAPI void                   elm_entry_autocapital_type_set(Evas_Object *obj, Elm_Autocapital_Type autocapital_type);
1221
1222 /**
1223  * Retrieve the autocapitalization type on the immodule.
1224  *
1225  * @param obj The entry object
1226  * @return autocapitalization type
1227  */
1228 EAPI Elm_Autocapital_Type   elm_entry_autocapital_type_get(Evas_Object *obj);
1229
1230 /**
1231  * Sets the attribute to show the input panel automatically.
1232  *
1233  * @param obj The entry object
1234  * @param enabled If true, the input panel is appeared when entry is clicked or has a focus
1235  */
1236 EAPI void                   elm_entry_input_panel_enabled_set(Evas_Object *obj, Eina_Bool enabled);
1237
1238 /**
1239  * Retrieve the attribute to show the input panel automatically.
1240  *
1241  * @param obj The entry object
1242  * @return EINA_TRUE if input panel will be appeared when the entry is clicked or has a focus, EINA_FALSE otherwise
1243  */
1244 EAPI Eina_Bool              elm_entry_input_panel_enabled_get(Evas_Object *obj);
1245
1246 /**
1247  * @}
1248  */