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