bad0754432d307db934625a30ae3901f7b03588b
[framework/uifw/elementary.git] / 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 to read out when in accessibility mode
119  *
120  * @param it The object item which is to be described
121  * @param txt The text that describes the widget to people with poor or no vision
122  *
123  * @ingroup General
124  */
125 EAPI void                         elm_object_item_access_info_set(Elm_Object_Item *it, const char *txt);
126
127 /**
128  * @brief Register object item as an accessible object.
129  * @since 1.8
130  *
131  * @param item The elementary object item
132  * @return Accessible object of the object item or NULL for any error
133  *
134  * @ingroup General
135  */
136 EAPI Evas_Object                 *elm_object_item_access_register(Elm_Object_Item *item);
137
138 /**
139  * @brief Unregister accessible object of the object item.
140  * @since 1.8
141  *
142  * @param item The elementary object item
143  *
144  * @ingroup General
145  */
146 EAPI void                         elm_object_item_access_unregister(Elm_Object_Item *item);
147
148 /**
149  * @brief Get an accessible object of the object item.
150  * @since 1.8
151  *
152  * @param item The elementary object item
153  * @return Accessible object of the object item or NULL for any error
154  *
155  * @ingroup General
156  */
157 EAPI Evas_Object                 *elm_object_item_access_object_get(const Elm_Object_Item *item);
158
159 /**
160  * @brief Set highlight order
161  * @since 1.8
162  *
163  * @param item The container object item
164  * @param objs Order of objects to pass highlight
165  *
166  * @ingroup General
167  */
168 EAPI void                         elm_object_item_access_order_set(Elm_Object_Item *item, Eina_List *objs);
169
170 /**
171  * @brief Get highlight order
172  * @since 1.8
173  *
174  * @param item The container object item
175  * @return Order of objects to pass highlight
176  *
177  * @ingroup General
178  */
179 EAPI const Eina_List              *elm_object_item_access_order_get(const Elm_Object_Item *item);
180
181 /**
182  * @brief Unset highlight order
183  * @since 1.8
184  *
185  * @param item The container object item
186  *
187  * @ingroup General
188  */
189 EAPI void                         elm_object_item_access_order_unset(Elm_Object_Item *item);
190
191 /**
192  * Get the data associated with an object item
193  * @param it The Elementary object item
194  * @return The data associated with @p it
195  *
196  * @note Every elm_object_item supports this API
197  * @ingroup General
198  */
199 EAPI void                        *elm_object_item_data_get(const Elm_Object_Item *it);
200
201 /**
202  * Set the data associated with an object item
203  * @param it The Elementary object item
204  * @param data The data to be associated with @p it
205  *
206  * @note Every elm_object_item supports this API
207  * @ingroup General
208  */
209 EAPI void                         elm_object_item_data_set(Elm_Object_Item *it, void *data);
210
211 /**
212  * Send a signal to the edje object of the widget item.
213  *
214  * This function sends a signal to the edje object of the obj item. An
215  * edje program can respond to a signal by specifying matching
216  * 'signal' and 'source' fields.
217  *
218  * @param it The Elementary object item
219  * @param emission The signal's name.
220  * @param source The signal's source.
221  * @ingroup General
222  */
223 EAPI void                         elm_object_item_signal_emit(Elm_Object_Item *it, const char *emission, const char *source);
224
225 /**
226  * Add a callback for a signal emitted by object item edje.
227  *
228  * This function connects a callback function to a signal emitted by the
229  * edje object of the object item.
230  * Globs can occur in either the emission or source name.
231  *
232  * @param it The elementary object item
233  * @param emission The signal's name.
234  * @param source The signal's source.
235  * @param func The callback function to be executed when the signal is
236  * emitted.
237  * @param data A pointer to data to pass to the callback function.
238  * @since 1.8
239  *
240  * @ingroup General
241  */
242 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);
243
244 /**
245  * Remove a signal-triggered callback from a object item edje object.
246  *
247  * @param it The elementary object item
248  * @param emission The signal's name.
249  * @param source The signal's source.
250  * @param func The callback function to be executed when the signal is
251  * emitted.
252  * @return The data pointer of the signal callback or @c NULL, on
253  * errors.
254  *
255  * This function removes the @b last callback, previously attached to
256  * a signal emitted by an underlying Edje object of @a it, whose
257  * parameters @a emission, @a source and @c func match exactly with
258  * those passed to a previous call to
259  * elm_object_item_signal_callback_add(). The data pointer that was passed
260  * to this call will be returned.
261  *
262  * @see elm_object_item_signal_callback_add()
263  * @since 1.8
264  *
265  * @ingroup General
266  */
267 EAPI void                        *elm_object_item_signal_callback_del(Elm_Object_Item *it, const char *emission, const char *source, Elm_Object_Item_Signal_Cb func);
268
269 /**
270  * Set the disabled state of an widget item.
271  *
272  * @param it The Elementary object item
273  * @param disabled The state to put in in: @c EINA_TRUE for
274  *        disabled, @c EINA_FALSE for enabled
275  *
276  * Elementary object item can be @b disabled, in which state they won't
277  * receive input and, in general, will be themed differently from
278  * their normal state, usually greyed out. Useful for contexts
279  * where you don't want your users to interact with some of the
280  * parts of you interface.
281  *
282  * This sets the state for the widget item, either disabling it or
283  * enabling it back.
284  *
285  * @ingroup Styles
286  */
287 EAPI void                         elm_object_item_disabled_set(Elm_Object_Item *it, Eina_Bool disabled);
288
289 /**
290  * Get the disabled state of an widget item.
291  *
292  * @param it The Elementary object item
293  * @return @c EINA_TRUE, if the widget item is disabled, @c EINA_FALSE
294  *            if it's enabled (or on errors)
295  *
296  * This gets the state of the widget, which might be enabled or disabled.
297  *
298  * @ingroup Styles
299  */
300 EAPI Eina_Bool                    elm_object_item_disabled_get(const Elm_Object_Item *it);
301
302 /**
303  * @brief Set the function to be called when an item from the widget is
304  * freed.
305  *
306  * @param it The item to set the callback on
307  * @param del_cb The function called
308  *
309  * That function will receive these parameters:
310  * @li void * item data
311  * @li Evas_Object * widget object
312  * @li Elm_Object_Item * widget item
313  *
314  * @note Every elm_object_item supports this API
315  *
316  * @see elm_object_item_del()
317  * @ingroup General
318  */
319 EAPI void                         elm_object_item_del_cb_set(Elm_Object_Item *it, Evas_Smart_Cb del_cb);
320
321 /**
322  * Delete the given item.
323  *
324  * @param it The item to be deleted.
325  *
326  * @ingroup General
327  */
328 EAPI void                       elm_object_item_del(Elm_Object_Item *it);
329
330 /**
331  * Set the text to be shown in a given object item's tooltips.
332  *
333  * @param it Target item.
334  * @param text The text to set in the content.
335  *
336  * Setup the text as tooltip to object. The item can have only one tooltip,
337  * so any previous tooltip data - set with this function or
338  * elm_object_item_tooltip_content_cb_set() - is removed.
339  *
340  * @see elm_object_tooltip_text_set() for more details.
341  *
342  * @ingroup General
343  */
344 EAPI void                         elm_object_item_tooltip_text_set(Elm_Object_Item *it, const char *text);
345
346 /**
347  * @brief Disable size restrictions on an object's tooltip
348  * @param it The tooltip's anchor object
349  * @param disable If EINA_TRUE, size restrictions are disabled
350  * @return EINA_FALSE on failure, EINA_TRUE on success
351  *
352  * This function allows a tooltip to expand beyond its parent window's canvas.
353  * It will instead be limited only by the size of the display.
354  */
355 EAPI Eina_Bool                    elm_object_item_tooltip_window_mode_set(Elm_Object_Item *it, Eina_Bool disable);
356
357 /**
358  * @brief Retrieve size restriction state of an object's tooltip
359  * @param it The tooltip's anchor object
360  * @return If EINA_TRUE, size restrictions are disabled
361  *
362  * This function returns whether a tooltip is allowed to expand beyond
363  * its parent window's canvas.
364  * It will instead be limited only by the size of the display.
365  */
366 EAPI Eina_Bool                    elm_object_item_tooltip_window_mode_get(const Elm_Object_Item *it);
367
368 /**
369  * Set the content to be shown in the tooltip item.
370  *
371  * Setup the tooltip to item. The item can have only one tooltip,
372  * so any previous tooltip data is removed. @p func(with @p data) will
373  * be called every time that need show the tooltip and it should
374  * return a valid Evas_Object. This object is then managed fully by
375  * tooltip system and is deleted when the tooltip is gone.
376  *
377  * @param it the object item being attached a tooltip.
378  * @param func the function used to create the tooltip contents.
379  * @param data what to provide to @a func as callback data/context.
380  * @param del_cb called when data is not needed anymore, either when
381  *        another callback replaces @a func, the tooltip is unset with
382  *        elm_object_item_tooltip_unset() or the owner @a item
383  *        dies. This callback receives as the first parameter the
384  *        given @a data, and @c event_info is the item.
385  *
386  * @see elm_object_tooltip_content_cb_set() for more details.
387  *
388  * @ingroup General
389  */
390 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);
391
392 /**
393  * Unset tooltip from item.
394  *
395  * @param it object item to remove previously set tooltip.
396  *
397  * Remove tooltip from item. The callback provided as del_cb to
398  * elm_object_item_tooltip_content_cb_set() will be called to notify
399  * it is not used anymore.
400  *
401  * @see elm_object_tooltip_unset() for more details.
402  * @see elm_object_item_tooltip_content_cb_set()
403  *
404  * @ingroup General
405  */
406 EAPI void                         elm_object_item_tooltip_unset(Elm_Object_Item *it);
407
408 /**
409  * Sets a different style for this item tooltip.
410  *
411  * @note before you set a style you should define a tooltip with
412  *       elm_object_item_tooltip_content_cb_set() or
413  *       elm_object_item_tooltip_text_set()
414  *
415  * @param it object item with tooltip already set.
416  * @param style the theme style to use (default, transparent, ...)
417  *
418  * @see elm_object_tooltip_style_set() for more details.
419  *
420  * @ingroup General
421  */
422 EAPI void                         elm_object_item_tooltip_style_set(Elm_Object_Item *it, const char *style);
423
424 /**
425  * Get the style for this item tooltip.
426  *
427  * @param it object item with tooltip already set.
428  * @return style the theme style in use, defaults to "default". If the
429  *         object does not have a tooltip set, then NULL is returned.
430  *
431  * @see elm_object_tooltip_style_get() for more details.
432  * @see elm_object_item_tooltip_style_set()
433  *
434  * @ingroup General
435  */
436 EAPI const char                  *elm_object_item_tooltip_style_get(const Elm_Object_Item *it);
437
438 /**
439   * Set the type of mouse pointer/cursor decoration to be shown,
440   * when the mouse pointer is over the given item
441   *
442   * @param it item to customize cursor on
443   * @param cursor the cursor type's name
444   *
445   * This function works analogously as elm_object_cursor_set(), but
446   * here the cursor's changing area is restricted to the item's
447   * area, and not the whole widget's. Note that that item cursors
448   * have precedence over widget cursors, so that a mouse over an
449   * item with custom cursor set will always show @b that cursor.
450   *
451   * If this function is called twice for an object, a previously set
452   * cursor will be unset on the second call.
453   *
454   * @see elm_object_cursor_set()
455   * @see elm_object_item_cursor_get()
456   * @see elm_object_item_cursor_unset()
457   *
458   * @ingroup General
459   */
460 EAPI void                         elm_object_item_cursor_set(Elm_Object_Item *it, const char *cursor);
461
462 /*
463  * Get the type of mouse pointer/cursor decoration set to be shown,
464  * when the mouse pointer is over the given item
465  *
466  * @param it item with custom cursor set
467  * @return the cursor type's name or @c NULL, if no custom cursors
468  * were set to @p item (and on errors)
469  *
470  * @see elm_object_cursor_get()
471  * @see elm_object_item_cursor_set()
472  * @see elm_object_item_cursor_unset()
473  *
474  * @ingroup General
475  */
476 EAPI const char                  *elm_object_item_cursor_get(const Elm_Object_Item *it);
477
478 /**
479  * Unset any custom mouse pointer/cursor decoration set to be
480  * shown, when the mouse pointer is over the given
481  * item, thus making it show the @b default cursor again.
482  *
483  * @param it the item
484  *
485  * Use this call to undo any custom settings on this item's cursor
486  * decoration, bringing it back to defaults (no custom style set).
487  *
488  * @see elm_object_cursor_unset()
489  * @see elm_object_item_cursor_set()
490  *
491  * @ingroup General
492  */
493 EAPI void                         elm_object_item_cursor_unset(Elm_Object_Item *it);
494
495 /**
496  * Set a different @b style for a given custom cursor set for an
497  * item.
498  *
499  * @param it item with custom cursor set
500  * @param style the <b>theme style</b> to use (e.g. @c "default",
501  * @c "transparent", etc)
502  *
503  * This function only makes sense when one is using custom mouse
504  * cursor decorations <b>defined in a theme file</b>, which can have,
505  * given a cursor name/type, <b>alternate styles</b> on it. It
506  * works analogously as elm_object_cursor_style_set(), but here
507  * applies only to item objects.
508  *
509  * @warning Before you set a cursor style you should have defined a
510  *       custom cursor previously on the item, with
511  *       elm_object_item_cursor_set()
512  *
513  * @see elm_object_item_cursor_engine_only_set()
514  * @see elm_object_item_cursor_style_get()
515  *
516  * @ingroup General
517  */
518 EAPI void                         elm_object_item_cursor_style_set(Elm_Object_Item *it, const char *style);
519
520 /**
521  * Get the current @b style set for a given item's custom
522  * cursor
523  *
524  * @param it item with custom cursor set.
525  * @return style the cursor style in use. If the object does not
526  *         have a cursor set, then @c NULL is returned.
527  *
528  * @see elm_object_item_cursor_style_set() for more details
529  *
530  * @ingroup General
531  */
532 EAPI const char                  *elm_object_item_cursor_style_get(const Elm_Object_Item *it);
533
534 /**
535  * Set if the (custom)cursor for a given item should be
536  * searched in its theme, also, or should only rely on the
537  * rendering engine.
538  *
539  * @param it item with custom (custom) cursor already set on
540  * @param engine_only Use @c EINA_TRUE to have cursors looked for
541  * only on those provided by the rendering engine, @c EINA_FALSE to
542  * have them searched on the widget's theme, as well.
543  *
544  * @note This call is of use only if you've set a custom cursor
545  * for items, with elm_object_item_cursor_set().
546  *
547  * @note By default, cursors will only be looked for between those
548  * provided by the rendering engine.
549  *
550  * @ingroup General
551  */
552 EAPI void                         elm_object_item_cursor_engine_only_set(Elm_Object_Item *it, Eina_Bool engine_only);
553
554 /**
555  * Get if the (custom) cursor for a given item is being
556  * searched in its theme, also, or is only relying on the rendering
557  * engine.
558  *
559  * @param it an object item
560  * @return @c EINA_TRUE, if cursors are being looked for only on
561  * those provided by the rendering engine, @c EINA_FALSE if they
562  * are being searched on the widget's theme, as well.
563  *
564  * @see elm_object_item_cursor_engine_only_set(), for more details
565  *
566  * @ingroup General
567  */
568 EAPI Eina_Bool                    elm_object_item_cursor_engine_only_get(const Elm_Object_Item *it);