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