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