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