Initialize Tizen 2.3
[framework/uifw/elementary.git] / mobile / src / lib / elm_object_item.h
1 /**
2  * @typedef Elm_Object_Item_Signal_Cb
3  *
4  * Elm_Object_Item Signal Callback functions' prototype definition. @c data
5  * will have the auxiliary data pointer at the time the callback registration.
6  * @c it will be a pointer the Elm_Object_Item that have the edje object where
7  * the signal comes from. @c emission will identify the exact signal's emission
8  * string and @c source the exact signal's source one.
9  *
10  * @see elm_object_item_signal_callback_add()
11  * @since 1.8
12  *
13  * @ingroup General
14  */
15 typedef void                  (*Elm_Object_Item_Signal_Cb)(void *data, Elm_Object_Item *it, const char *emission, const char *source);
16
17 /**
18  * Get the widget object's handle which contains a given item
19  *
20  * @param it The Elementary object item
21  * @return The widget object
22  *
23  * @note This returns the widget object itself that an item belongs to.
24  * @note Every elm_object_item supports this API
25  * @ingroup General
26  */
27 EAPI Evas_Object                 *elm_object_item_widget_get(const Elm_Object_Item *it);
28
29 /**
30  * Set a content of an object item
31  *
32  * @param it The Elementary object item
33  * @param part The content part name to set (NULL for the default content)
34  * @param content The new content of the object item
35  *
36  * This sets a new object to an item as a content object. If any object was
37  * already set as a content object in the same part, previous object will be
38  * deleted automatically.
39  *
40  * @note Elementary object items may have many contents
41  *
42  * @ingroup General
43  */
44 EAPI void                         elm_object_item_part_content_set(Elm_Object_Item *it, const char *part, Evas_Object *content);
45
46 #define elm_object_item_content_set(it, content) elm_object_item_part_content_set((it), NULL, (content))
47
48 /**
49  * Get a content of an object item
50  *
51  * @param it The Elementary object item
52  * @param part The content part name to unset (NULL for the default content)
53  * @return content of the object item or NULL for any error
54  *
55  * @note Elementary object items may have many contents
56  *
57  * @ingroup General
58  */
59 EAPI Evas_Object                 *elm_object_item_part_content_get(const Elm_Object_Item *it, const char *part);
60
61 #define elm_object_item_content_get(it) elm_object_item_part_content_get((it), NULL)
62
63 /**
64  * Unset a content of an object item
65  *
66  * @param it The Elementary object item
67  * @param part The content part name to unset (NULL for the default content)
68  *
69  * @note Elementary object items may have many contents
70  *
71  * @ingroup General
72  */
73 EAPI Evas_Object                 *elm_object_item_part_content_unset(Elm_Object_Item *it, const char *part);
74
75 #define elm_object_item_content_unset(it) elm_object_item_part_content_unset((it), NULL)
76
77 /**
78  * Set a label of an object item
79  *
80  * @param it The Elementary object item
81  * @param part The text part name to set (NULL for the default label)
82  * @param label The new text of the label
83  *
84  * @note Elementary object items may have many labels
85  *
86  * @ingroup General
87  */
88 EAPI void                         elm_object_item_part_text_set(Elm_Object_Item *it, const char *part, const char *label);
89
90 /**
91  * Macro to set a label of an object item.
92  *
93  * @param it The Elementary object item.
94  * @param label The new text of the label.
95  *
96  * @note Elementary object items may have many labels.
97  *
98  * @ingroup General
99  */
100 #define elm_object_item_text_set(it, label) elm_object_item_part_text_set((it), NULL, (label))
101
102 /**
103  * Get a label of an object item
104  *
105  * @param it The Elementary object item
106  * @param part The text part name to get (NULL for the default label)
107  * @return text of the label or NULL for any error
108  *
109  * @note Elementary object items may have many labels
110  *
111  * @ingroup General
112  */
113 EAPI const char                  *elm_object_item_part_text_get(const Elm_Object_Item *it, const char *part);
114
115 #define elm_object_item_text_get(it) elm_object_item_part_text_get((it), NULL)
116
117 /**
118  * Set the text for an object item's part, marking it as translatable.
119  *
120  * The string to set as @p text must be the original one. Do not pass the
121  * return of @c gettext() here. Elementary will translate the string
122  * internally and set it on the object item using
123  * elm_object_item_part_text_set(), also storing the original string so that it
124  * can be automatically translated when the language is changed with
125  * elm_language_set(). The @p domain will be stored along to find the
126  * translation in the correct catalog. It can be NULL, in which case it will use
127  * whatever domain was set by the application with @c textdomain(). This is
128  * useful in case you are building a library on top of Elementary that will have
129  * its own translatable strings, that should not be mixed with those of programs
130  * using the library.
131  *
132  * @param it The object item containing the text part
133  * @param part The name of the part to set
134  * @param domain The translation domain to use
135  * @param text The original, non-translated text to set
136  *
137  * @ingroup General
138  * @since 1.8
139  */
140 EAPI void      elm_object_item_domain_translatable_part_text_set(Elm_Object_Item *it, const char *part, const char *domain, const char *text);
141
142 #define elm_object_item_domain_translatable_text_set(it, domain, text) elm_object_item_domain_translatable_part_text_set((it), NULL, (domain), (text))
143
144 #define elm_object_item_translatable_text_set(it, text) elm_object_item_domain_translatable_part_text_set((it), NULL, NULL, (text))
145
146 #define elm_object_item_translatable_part_text_set(it, part, text) elm_object_item_domain_translatable_part_text_set((it), (part), NULL, (text))
147
148 /**
149  * Gets the original string set as translatable for an object item.
150  *
151  * When setting translated strings, the function elm_object_item_part_text_get()
152  * will return the translation returned by @c gettext(). To get the original
153  * string use this function.
154  *
155  * @param it The object item.
156  * @param part The name of the part that was set
157  *
158  * @return The original, untranslated string
159  *
160  * @ingroup General
161  * @since 1.8
162  */
163 EAPI const char *elm_object_item_translatable_part_text_get(const Elm_Object_Item *it, const char *part);
164
165 #define elm_object_item_translatable_text_get(it) elm_object_item_translatable_part_text_get((it), NULL)
166
167 /**
168  * Mark the part text to be transltable or not.
169  *
170  * Once you mark the part text to be translatable, the text will be translated
171  * internally regardless of elm_object_item_part_text_set() and
172  * elm_object_item_domain_translatable_part_text_set(). In other case, if you
173  * set the Elementary policy that all text will be translatable in default, you
174  * can set the part text to not be translated by calling this API.
175  *
176  * @param it The object item containing the text part
177  * @param part The part name of the translatable text
178  * @param domain The translation domain to use
179  * @param translatable @c EINA_TRUE, the part text will be translated
180  *        internally. @c EINA_FALSE, otherwise.
181  *
182  * @see elm_object_item_domain_translatable_part_text_set()
183  * @see elm_object_item_part_text_set()
184  * @see elm_policy()
185  *
186  * @since 1.8
187  *
188  * @ingroup General
189  */
190 EAPI void elm_object_item_domain_part_text_translatable_set(Elm_Object_Item *it, const char *part, const char *domain, Eina_Bool translatable);
191
192 #define elm_object_item_part_text_translatable_set(it, part, translatable) elm_object_item_domain_part_text_translatable_set((it), (part), NULL, (translatable))
193
194 #define elm_object_item_domain_text_translatable_set(it, domain, translatable) elm_object_item_domain_part_text_translatable_set((it), NULL, (domain), (translatable))
195
196 /**
197  * Set the text to read out when in accessibility mode
198  *
199  * @param it The object item which is to be described
200  * @param txt The text that describes the widget to people with poor or no vision
201  *
202  * @ingroup General
203  */
204 EAPI void                         elm_object_item_access_info_set(Elm_Object_Item *it, const char *txt);
205
206 /**
207  * @brief Register object item as an accessible object.
208  * @since 1.8
209  *
210  * @param item The elementary object item
211  * @return Accessible object of the object item or NULL for any error
212  *
213  * @ingroup General
214  */
215 EAPI Evas_Object                 *elm_object_item_access_register(Elm_Object_Item *item);
216
217 /**
218  * @brief Register a part on an object item as an accessible object.
219  * @since 1.8
220  *
221  * @param item The elementary object item
222  * @param part The part name to set
223  * @return Accessible object of the object item or NULL for any error
224  *
225  * @ingroup General
226  */
227 EAPI Evas_Object                 *elm_object_item_part_access_register(Elm_Object_Item *item, const char *part);
228
229 /**
230  * @brief Unregister accessible object of the object item.
231  * @since 1.8
232  *
233  * @param item The elementary object item
234  *
235  * @ingroup General
236  */
237 EAPI void                         elm_object_item_access_unregister(Elm_Object_Item *item);
238
239 /**
240  * @brief Get an accessible object of the object item.
241  * @since 1.8
242  *
243  * @param item The elementary object item
244  * @return Accessible object of the object item or NULL for any error
245  *
246  * @ingroup General
247  */
248 EAPI Evas_Object                 *elm_object_item_access_object_get(const Elm_Object_Item *item);
249
250 /**
251  * @brief Set highlight order
252  * @since 1.8
253  *
254  * @param item The container object item
255  * @param objs Order of objects to pass highlight
256  *
257  * @ingroup General
258  */
259 EAPI void                         elm_object_item_access_order_set(Elm_Object_Item *item, Eina_List *objs);
260
261 /**
262  * @brief Get highlight order
263  * @since 1.8
264  *
265  * @param item The container object item
266  * @return Order of objects to pass highlight
267  *
268  * @ingroup General
269  */
270 EAPI const Eina_List              *elm_object_item_access_order_get(const Elm_Object_Item *item);
271
272 /**
273  * @brief Unset highlight order
274  * @since 1.8
275  *
276  * @param item The container object item
277  *
278  * @ingroup General
279  */
280 EAPI void                         elm_object_item_access_order_unset(Elm_Object_Item *item);
281
282 /**
283  * Get the data associated with an object item
284  * @param it The Elementary object item
285  * @return The data associated with @p it
286  *
287  * @note Every elm_object_item supports this API
288  * @ingroup General
289  */
290 EAPI void                        *elm_object_item_data_get(const Elm_Object_Item *it);
291
292 /**
293  * Set the data associated with an object item
294  * @param it The Elementary object item
295  * @param data The data to be associated with @p it
296  *
297  * @note Every elm_object_item supports this API
298  * @ingroup General
299  */
300 EAPI void                         elm_object_item_data_set(Elm_Object_Item *it, void *data);
301
302 /**
303  * Send a signal to the edje object of the widget item.
304  *
305  * This function sends a signal to the edje object of the obj item. An
306  * edje program can respond to a signal by specifying matching
307  * 'signal' and 'source' fields.
308  *
309  * @param it The Elementary object item
310  * @param emission The signal's name.
311  * @param source The signal's source.
312  * @ingroup General
313  */
314 EAPI void                         elm_object_item_signal_emit(Elm_Object_Item *it, const char *emission, const char *source);
315
316 /**
317  * Add a callback for a signal emitted by object item edje.
318  *
319  * This function connects a callback function to a signal emitted by the
320  * edje object of the object item.
321  * Globs can occur in either the emission or source name.
322  *
323  * @param it The elementary object item
324  * @param emission The signal's name.
325  * @param source The signal's source.
326  * @param func The callback function to be executed when the signal is
327  * emitted.
328  * @param data A pointer to data to pass to the callback function.
329  * @since 1.8
330  *
331  * @ingroup General
332  */
333 EAPI void                         elm_object_item_signal_callback_add(Elm_Object_Item *it, const char *emission, const char *source, Elm_Object_Item_Signal_Cb func, void *data);
334
335 /**
336  * Remove a signal-triggered callback from a object item edje object.
337  *
338  * @param it The elementary object item
339  * @param emission The signal's name.
340  * @param source The signal's source.
341  * @param func The callback function to be executed when the signal is
342  * emitted.
343  * @return The data pointer of the signal callback or @c NULL, on
344  * errors.
345  *
346  * This function removes the @b last callback, previously attached to
347  * a signal emitted by an underlying Edje object of @a it, whose
348  * parameters @a emission, @a source and @c func match exactly with
349  * those passed to a previous call to
350  * elm_object_item_signal_callback_add(). The data pointer that was passed
351  * to this call will be returned.
352  *
353  * @see elm_object_item_signal_callback_add()
354  * @since 1.8
355  *
356  * @ingroup General
357  */
358 EAPI void                        *elm_object_item_signal_callback_del(Elm_Object_Item *it, const char *emission, const char *source, Elm_Object_Item_Signal_Cb func);
359
360 /**
361  * Set the disabled state of an widget item.
362  *
363  * @param it The Elementary object item
364  * @param disabled The state to put in in: @c EINA_TRUE for
365  *        disabled, @c EINA_FALSE for enabled
366  *
367  * Elementary object item can be @b disabled, in which state they won't
368  * receive input and, in general, will be themed differently from
369  * their normal state, usually greyed out. Useful for contexts
370  * where you don't want your users to interact with some of the
371  * parts of you interface.
372  *
373  * This sets the state for the widget item, either disabling it or
374  * enabling it back.
375  *
376  * @ingroup Styles
377  */
378 EAPI void                         elm_object_item_disabled_set(Elm_Object_Item *it, Eina_Bool disabled);
379
380 /**
381  * Get the disabled state of an widget item.
382  *
383  * @param it The Elementary object item
384  * @return @c EINA_TRUE, if the widget item is disabled, @c EINA_FALSE
385  *            if it's enabled (or on errors)
386  *
387  * This gets the state of the widget, which might be enabled or disabled.
388  *
389  * @ingroup Styles
390  */
391 EAPI Eina_Bool                    elm_object_item_disabled_get(const Elm_Object_Item *it);
392
393 /**
394  * @brief Set the function to be called when an item from the widget is
395  * freed.
396  *
397  * @param it The item to set the callback on
398  * @param del_cb The function called
399  *
400  * That function will receive these parameters:
401  * @li void * item data
402  * @li Evas_Object * widget object
403  * @li Elm_Object_Item * widget item
404  *
405  * @note Every elm_object_item supports this API
406  *
407  * @see elm_object_item_del()
408  * @ingroup General
409  */
410 EAPI void                         elm_object_item_del_cb_set(Elm_Object_Item *it, Evas_Smart_Cb del_cb);
411
412 /**
413  * Delete the given item.
414  *
415  * @param it The item to be deleted.
416  *
417  * @ingroup General
418  */
419 EAPI void                       elm_object_item_del(Elm_Object_Item *it);
420
421 /**
422  * Set the text to be shown in a given object item's tooltips.
423  *
424  * @param it Target item.
425  * @param text The text to set in the content.
426  *
427  * Setup the text as tooltip to object. The item can have only one tooltip,
428  * so any previous tooltip data - set with this function or
429  * elm_object_item_tooltip_content_cb_set() - is removed.
430  *
431  * @see elm_object_tooltip_text_set() for more details.
432  *
433  * @ingroup General
434  */
435 EAPI void                         elm_object_item_tooltip_text_set(Elm_Object_Item *it, const char *text);
436
437 /**
438  * @brief Disable size restrictions on an object's tooltip
439  * @param it The tooltip's anchor object
440  * @param disable If EINA_TRUE, size restrictions are disabled
441  * @return EINA_FALSE on failure, EINA_TRUE on success
442  *
443  * This function allows a tooltip to expand beyond its parent window's canvas.
444  * It will instead be limited only by the size of the display.
445  */
446 EAPI Eina_Bool                    elm_object_item_tooltip_window_mode_set(Elm_Object_Item *it, Eina_Bool disable);
447
448 /**
449  * @brief Retrieve size restriction state of an object's tooltip
450  * @param it The tooltip's anchor object
451  * @return If EINA_TRUE, size restrictions are disabled
452  *
453  * This function returns whether a tooltip is allowed to expand beyond
454  * its parent window's canvas.
455  * It will instead be limited only by the size of the display.
456  */
457 EAPI Eina_Bool                    elm_object_item_tooltip_window_mode_get(const Elm_Object_Item *it);
458
459 /**
460  * Set the content to be shown in the tooltip item.
461  *
462  * Setup the tooltip to item. The item can have only one tooltip,
463  * so any previous tooltip data is removed. @p func(with @p data) will
464  * be called every time that need show the tooltip and it should
465  * return a valid Evas_Object. This object is then managed fully by
466  * tooltip system and is deleted when the tooltip is gone.
467  *
468  * @param it the object item being attached a tooltip.
469  * @param func the function used to create the tooltip contents.
470  * @param data what to provide to @a func as callback data/context.
471  * @param del_cb called when data is not needed anymore, either when
472  *        another callback replaces @a func, the tooltip is unset with
473  *        elm_object_item_tooltip_unset() or the owner @a item
474  *        dies. This callback receives as the first parameter the
475  *        given @a data, and @c event_info is the item.
476  *
477  * @see elm_object_tooltip_content_cb_set() for more details.
478  *
479  * @ingroup General
480  */
481 EAPI void                         elm_object_item_tooltip_content_cb_set(Elm_Object_Item *it, Elm_Tooltip_Item_Content_Cb func, const void *data, Evas_Smart_Cb del_cb);
482
483 /**
484  * Unset tooltip from item.
485  *
486  * @param it object item to remove previously set tooltip.
487  *
488  * Remove tooltip from item. The callback provided as del_cb to
489  * elm_object_item_tooltip_content_cb_set() will be called to notify
490  * it is not used anymore.
491  *
492  * @see elm_object_tooltip_unset() for more details.
493  * @see elm_object_item_tooltip_content_cb_set()
494  *
495  * @ingroup General
496  */
497 EAPI void                         elm_object_item_tooltip_unset(Elm_Object_Item *it);
498
499 /**
500  * Sets a different style for this item tooltip.
501  *
502  * @note before you set a style you should define a tooltip with
503  *       elm_object_item_tooltip_content_cb_set() or
504  *       elm_object_item_tooltip_text_set()
505  *
506  * @param it object item with tooltip already set.
507  * @param style the theme style to use (default, transparent, ...)
508  *
509  * @see elm_object_tooltip_style_set() for more details.
510  *
511  * @ingroup General
512  */
513 EAPI void                         elm_object_item_tooltip_style_set(Elm_Object_Item *it, const char *style);
514
515 /**
516  * Get the style for this item tooltip.
517  *
518  * @param it object item with tooltip already set.
519  * @return style the theme style in use, defaults to "default". If the
520  *         object does not have a tooltip set, then NULL is returned.
521  *
522  * @see elm_object_tooltip_style_get() for more details.
523  * @see elm_object_item_tooltip_style_set()
524  *
525  * @ingroup General
526  */
527 EAPI const char                  *elm_object_item_tooltip_style_get(const Elm_Object_Item *it);
528
529 /**
530   * Set the type of mouse pointer/cursor decoration to be shown,
531   * when the mouse pointer is over the given item
532   *
533   * @param it item to customize cursor on
534   * @param cursor the cursor type's name
535   *
536   * This function works analogously as elm_object_cursor_set(), but
537   * here the cursor's changing area is restricted to the item's
538   * area, and not the whole widget's. Note that that item cursors
539   * have precedence over widget cursors, so that a mouse over an
540   * item with custom cursor set will always show @b that cursor.
541   *
542   * If this function is called twice for an object, a previously set
543   * cursor will be unset on the second call.
544   *
545   * @see elm_object_cursor_set()
546   * @see elm_object_item_cursor_get()
547   * @see elm_object_item_cursor_unset()
548   *
549   * @ingroup General
550   */
551 EAPI void                         elm_object_item_cursor_set(Elm_Object_Item *it, const char *cursor);
552
553 /*
554  * Get the type of mouse pointer/cursor decoration set to be shown,
555  * when the mouse pointer is over the given item
556  *
557  * @param it item with custom cursor set
558  * @return the cursor type's name or @c NULL, if no custom cursors
559  * were set to @p item (and on errors)
560  *
561  * @see elm_object_cursor_get()
562  * @see elm_object_item_cursor_set()
563  * @see elm_object_item_cursor_unset()
564  *
565  * @ingroup General
566  */
567 EAPI const char                  *elm_object_item_cursor_get(const Elm_Object_Item *it);
568
569 /**
570  * Unset any custom mouse pointer/cursor decoration set to be
571  * shown, when the mouse pointer is over the given
572  * item, thus making it show the @b default cursor again.
573  *
574  * @param it the item
575  *
576  * Use this call to undo any custom settings on this item's cursor
577  * decoration, bringing it back to defaults (no custom style set).
578  *
579  * @see elm_object_cursor_unset()
580  * @see elm_object_item_cursor_set()
581  *
582  * @ingroup General
583  */
584 EAPI void                         elm_object_item_cursor_unset(Elm_Object_Item *it);
585
586 /**
587  * Set a different @b style for a given custom cursor set for an
588  * item.
589  *
590  * @param it item with custom cursor set
591  * @param style the <b>theme style</b> to use (e.g. @c "default",
592  * @c "transparent", etc)
593  *
594  * This function only makes sense when one is using custom mouse
595  * cursor decorations <b>defined in a theme file</b>, which can have,
596  * given a cursor name/type, <b>alternate styles</b> on it. It
597  * works analogously as elm_object_cursor_style_set(), but here
598  * applies only to item objects.
599  *
600  * @warning Before you set a cursor style you should have defined a
601  *       custom cursor previously on the item, with
602  *       elm_object_item_cursor_set()
603  *
604  * @see elm_object_item_cursor_engine_only_set()
605  * @see elm_object_item_cursor_style_get()
606  *
607  * @ingroup General
608  */
609 EAPI void                         elm_object_item_cursor_style_set(Elm_Object_Item *it, const char *style);
610
611 /**
612  * Get the current @b style set for a given item's custom
613  * cursor
614  *
615  * @param it item with custom cursor set.
616  * @return style the cursor style in use. If the object does not
617  *         have a cursor set, then @c NULL is returned.
618  *
619  * @see elm_object_item_cursor_style_set() for more details
620  *
621  * @ingroup General
622  */
623 EAPI const char                  *elm_object_item_cursor_style_get(const Elm_Object_Item *it);
624
625 /**
626  * Set if the (custom)cursor for a given item should be
627  * searched in its theme, also, or should only rely on the
628  * rendering engine.
629  *
630  * @param it item with custom (custom) cursor already set on
631  * @param engine_only Use @c EINA_TRUE to have cursors looked for
632  * only on those provided by the rendering engine, @c EINA_FALSE to
633  * have them searched on the widget's theme, as well.
634  *
635  * @note This call is of use only if you've set a custom cursor
636  * for items, with elm_object_item_cursor_set().
637  *
638  * @note By default, cursors will only be looked for between those
639  * provided by the rendering engine.
640  *
641  * @ingroup General
642  */
643 EAPI void                         elm_object_item_cursor_engine_only_set(Elm_Object_Item *it, Eina_Bool engine_only);
644
645 /**
646  * Get if the (custom) cursor for a given item is being
647  * searched in its theme, also, or is only relying on the rendering
648  * engine.
649  *
650  * @param it an object item
651  * @return @c EINA_TRUE, if cursors are being looked for only on
652  * those provided by the rendering engine, @c EINA_FALSE if they
653  * are being searched on the widget's theme, as well.
654  *
655  * @see elm_object_item_cursor_engine_only_set(), for more details
656  *
657  * @ingroup General
658  */
659 EAPI Eina_Bool                    elm_object_item_cursor_engine_only_get(const Elm_Object_Item *it);