Elementary migration revision 69832
[framework/uifw/elementary.git] / src / lib / elm_object_item.h
1 typedef void (*Elm_Object_Item_Smart_Cb) (void *data, Elm_Object_Item *it, void *event_info);
2
3 /**
4  * Get the widget object's handle which contains a given item
5  *
6  * @param it The Elementary object item
7  * @return The widget object
8  *
9  * @note This returns the widget object itself that an item belongs to.
10  * @note Every elm_object_item supports this API
11  * @ingroup General
12  */
13 EAPI Evas_Object                 *elm_object_item_widget_get(const Elm_Object_Item *it);
14
15 /**
16  * Set a content of an object item
17  *
18  * @param it The Elementary object item
19  * @param part The content part name to set (NULL for the default content)
20  * @param content The new content of the object item
21  *
22  * This sets a new object to an item as a content object. If any object was
23  * already set as a content object in the same part, previous object will be
24  * deleted automatically.
25  *
26  * @note Elementary object items may have many contents
27  *
28  * @ingroup General
29  */
30 EAPI void                         elm_object_item_part_content_set(Elm_Object_Item *it, const char *part, Evas_Object *content);
31
32 #define elm_object_item_content_set(it, content) elm_object_item_part_content_set((it), NULL, (content))
33
34 /**
35  * Get a content of an object item
36  *
37  * @param it The Elementary object item
38  * @param part The content part name to unset (NULL for the default content)
39  * @return content of the object item or NULL for any error
40  *
41  * @note Elementary object items may have many contents
42  *
43  * @ingroup General
44  */
45 EAPI Evas_Object                 *elm_object_item_part_content_get(const Elm_Object_Item *it, const char *part);
46
47 #define elm_object_item_content_get(it) elm_object_item_part_content_get((it), NULL)
48
49 /**
50  * Unset a content of an object item
51  *
52  * @param it The Elementary object item
53  * @param part The content part name to unset (NULL for the default content)
54  *
55  * @note Elementary object items may have many contents
56  *
57  * @ingroup General
58  */
59 EAPI Evas_Object                 *elm_object_item_part_content_unset(Elm_Object_Item *it, const char *part);
60
61 #define elm_object_item_content_unset(it) elm_object_item_part_content_unset((it), NULL)
62
63 /**
64  * Set a label of an object item
65  *
66  * @param it The Elementary object item
67  * @param part The text part name to set (NULL for the default label)
68  * @param label The new text of the label
69  *
70  * @note Elementary object items may have many labels
71  *
72  * @ingroup General
73  */
74 EAPI void                         elm_object_item_part_text_set(Elm_Object_Item *it, const char *part, const char *label);
75
76 #define elm_object_item_text_set(it, label) elm_object_item_part_text_set((it), NULL, (label))
77
78 /**
79  * Get a label of an object item
80  *
81  * @param it The Elementary object item
82  * @param part The text part name to get (NULL for the default label)
83  * @return text of the label or NULL for any error
84  *
85  * @note Elementary object items may have many labels
86  *
87  * @ingroup General
88  */
89 EAPI const char                  *elm_object_item_part_text_get(const Elm_Object_Item *it, const char *part);
90
91 #define elm_object_item_text_get(it) elm_object_item_part_text_get((it), NULL)
92
93 /**
94  * Set the text to read out when in accessibility mode
95  *
96  * @param it The object item which is to be described
97  * @param txt The text that describes the widget to people with poor or no vision
98  *
99  * @ingroup General
100  */
101 EAPI void                         elm_object_item_access_info_set(Elm_Object_Item *it, const char *txt);
102
103 /**
104  * Get the data associated with an object item
105  * @param it The Elementary object item
106  * @return The data associated with @p it
107  *
108  * @note Every elm_object_item supports this API
109  * @ingroup General
110  */
111 EAPI void                        *elm_object_item_data_get(const Elm_Object_Item *it);
112
113 /**
114  * Set the data associated with an object item
115  * @param it The Elementary object item
116  * @param data The data to be associated with @p it
117  *
118  * @note Every elm_object_item supports this API
119  * @ingroup General
120  */
121 EAPI void                         elm_object_item_data_set(Elm_Object_Item *it, void *data);
122
123 /**
124  * Send a signal to the edje object of the widget item.
125  *
126  * This function sends a signal to the edje object of the obj item. An
127  * edje program can respond to a signal by specifying matching
128  * 'signal' and 'source' fields.
129  *
130  * @param it The Elementary object item
131  * @param emission The signal's name.
132  * @param source The signal's source.
133  * @ingroup General
134  */
135 EAPI void                         elm_object_item_signal_emit(Elm_Object_Item *it, const char *emission, const char *source);
136
137 /**
138  * Set the disabled state of an widget item.
139  *
140  * @param it The Elementary object item
141  * @param disabled The state to put in in: @c EINA_TRUE for
142  *        disabled, @c EINA_FALSE for enabled
143  *
144  * Elementary object item can be @b disabled, in which state they won't
145  * receive input and, in general, will be themed differently from
146  * their normal state, usually greyed out. Useful for contexts
147  * where you don't want your users to interact with some of the
148  * parts of you interface.
149  *
150  * This sets the state for the widget item, either disabling it or
151  * enabling it back.
152  *
153  * @ingroup Styles
154  */
155 EAPI void                         elm_object_item_disabled_set(Elm_Object_Item *it, Eina_Bool disabled);
156
157 /**
158  * Get the disabled state of an widget item.
159  *
160  * @param it The Elementary object item
161  * @return @c EINA_TRUE, if the widget item is disabled, @c EINA_FALSE
162  *            if it's enabled (or on errors)
163  *
164  * This gets the state of the widget, which might be enabled or disabled.
165  *
166  * @ingroup Styles
167  */
168 EAPI Eina_Bool                    elm_object_item_disabled_get(const Elm_Object_Item *it);
169
170 /**
171  * @brief Set the function to be called when an item from the widget is
172  * freed.
173  *
174  * @param it The item to set the callback on
175  * @param del_cb The function called
176  *
177  * That function will receive these parameters:
178  * @li void * item data
179  * @li Evas_Object * widget object
180  * @li Elm_Object_Item * widget item
181  *
182  * @note Every elm_object_item supports this API
183  *
184  * @see elm_object_item_del()
185  * @ingroup General
186  */
187 EAPI void                         elm_object_item_del_cb_set(Elm_Object_Item *it, Evas_Smart_Cb del_cb);
188
189 /**
190  * Delete the given item.
191  *
192  * @param it The item to be deleted.
193  *
194  * @ingroup General
195  */
196 EAPI void                       elm_object_item_del(Elm_Object_Item *it);
197
198 /**
199  * Set the text to be shown in a given object item's tooltips.
200  *
201  * @param it Target item.
202  * @param text The text to set in the content.
203  *
204  * Setup the text as tooltip to object. The item can have only one tooltip,
205  * so any previous tooltip data - set with this function or
206  * elm_object_item_tooltip_content_cb_set() - is removed.
207  *
208  * @see elm_object_tooltip_text_set() for more details.
209  *
210  * @ingroup General
211  */
212 EAPI void                         elm_object_item_tooltip_text_set(Elm_Object_Item *it, const char *text);
213
214 /**
215  * @brief Disable size restrictions on an object's tooltip
216  * @param it The tooltip's anchor object
217  * @param disable If EINA_TRUE, size restrictions are disabled
218  * @return EINA_FALSE on failure, EINA_TRUE on success
219  *
220  * This function allows a tooltip to expand beyond its parent window's canvas.
221  * It will instead be limited only by the size of the display.
222  */
223 EAPI Eina_Bool                    elm_object_item_tooltip_window_mode_set(Elm_Object_Item *it, Eina_Bool disable);
224
225 /**
226  * @brief Retrieve size restriction state of an object's tooltip
227  * @param it The tooltip's anchor object
228  * @return If EINA_TRUE, size restrictions are disabled
229  *
230  * This function returns whether a tooltip is allowed to expand beyond
231  * its parent window's canvas.
232  * It will instead be limited only by the size of the display.
233  */
234 EAPI Eina_Bool                    elm_object_item_tooltip_window_mode_get(const Elm_Object_Item *it);
235
236 /**
237  * Set the content to be shown in the tooltip item.
238  *
239  * Setup the tooltip to item. The item can have only one tooltip,
240  * so any previous tooltip data is removed. @p func(with @p data) will
241  * be called every time that need show the tooltip and it should
242  * return a valid Evas_Object. This object is then managed fully by
243  * tooltip system and is deleted when the tooltip is gone.
244  *
245  * @param it the object item being attached a tooltip.
246  * @param func the function used to create the tooltip contents.
247  * @param data what to provide to @a func as callback data/context.
248  * @param del_cb called when data is not needed anymore, either when
249  *        another callback replaces @a func, the tooltip is unset with
250  *        elm_object_item_tooltip_unset() or the owner @a item
251  *        dies. This callback receives as the first parameter the
252  *        given @a data, and @c event_info is the item.
253  *
254  * @see elm_object_tooltip_content_cb_set() for more details.
255  *
256  * @ingroup General
257  */
258 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);
259
260 /**
261  * Unset tooltip from item.
262  *
263  * @param it object item to remove previously set tooltip.
264  *
265  * Remove tooltip from item. The callback provided as del_cb to
266  * elm_object_item_tooltip_content_cb_set() will be called to notify
267  * it is not used anymore.
268  *
269  * @see elm_object_tooltip_unset() for more details.
270  * @see elm_object_item_tooltip_content_cb_set()
271  *
272  * @ingroup General
273  */
274 EAPI void                         elm_object_item_tooltip_unset(Elm_Object_Item *it);
275
276 /**
277  * Sets a different style for this item tooltip.
278  *
279  * @note before you set a style you should define a tooltip with
280  *       elm_object_item_tooltip_content_cb_set() or
281  *       elm_object_item_tooltip_text_set()
282  *
283  * @param it object item with tooltip already set.
284  * @param style the theme style to use (default, transparent, ...)
285  *
286  * @see elm_object_tooltip_style_set() for more details.
287  *
288  * @ingroup General
289  */
290 EAPI void                         elm_object_item_tooltip_style_set(Elm_Object_Item *it, const char *style);
291
292 /**
293  * Get the style for this item tooltip.
294  *
295  * @param it object item with tooltip already set.
296  * @return style the theme style in use, defaults to "default". If the
297  *         object does not have a tooltip set, then NULL is returned.
298  *
299  * @see elm_object_tooltip_style_get() for more details.
300  * @see elm_object_item_tooltip_style_set()
301  *
302  * @ingroup General
303  */
304 EAPI const char                  *elm_object_item_tooltip_style_get(const Elm_Object_Item *it);
305
306 /**
307   * Set the type of mouse pointer/cursor decoration to be shown,
308   * when the mouse pointer is over the given item
309   *
310   * @param it item to customize cursor on
311   * @param cursor the cursor type's name
312   *
313   * This function works analogously as elm_object_cursor_set(), but
314   * here the cursor's changing area is restricted to the item's
315   * area, and not the whole widget's. Note that that item cursors
316   * have precedence over widget cursors, so that a mouse over an
317   * item with custom cursor set will always show @b that cursor.
318   *
319   * If this function is called twice for an object, a previously set
320   * cursor will be unset on the second call.
321   *
322   * @see elm_object_cursor_set()
323   * @see elm_object_item_cursor_get()
324   * @see elm_object_item_cursor_unset()
325   *
326   * @ingroup General
327   */
328 EAPI void                         elm_object_item_cursor_set(Elm_Object_Item *it, const char *cursor);
329
330 /*
331  * Get the type of mouse pointer/cursor decoration set to be shown,
332  * when the mouse pointer is over the given item
333  *
334  * @param it item with custom cursor set
335  * @return the cursor type's name or @c NULL, if no custom cursors
336  * were set to @p item (and on errors)
337  *
338  * @see elm_object_cursor_get()
339  * @see elm_object_item_cursor_set()
340  * @see elm_object_item_cursor_unset()
341  *
342  * @ingroup General
343  */
344 EAPI const char                  *elm_object_item_cursor_get(const Elm_Object_Item *it);
345
346 /**
347  * Unset any custom mouse pointer/cursor decoration set to be
348  * shown, when the mouse pointer is over the given
349  * item, thus making it show the @b default cursor again.
350  *
351  * @param it the item
352  *
353  * Use this call to undo any custom settings on this item's cursor
354  * decoration, bringing it back to defaults (no custom style set).
355  *
356  * @see elm_object_cursor_unset()
357  * @see elm_object_item_cursor_set()
358  *
359  * @ingroup General
360  */
361 EAPI void                         elm_object_item_cursor_unset(Elm_Object_Item *it);
362
363 /**
364  * Set a different @b style for a given custom cursor set for an
365  * item.
366  *
367  * @param it item with custom cursor set
368  * @param style the <b>theme style</b> to use (e.g. @c "default",
369  * @c "transparent", etc)
370  *
371  * This function only makes sense when one is using custom mouse
372  * cursor decorations <b>defined in a theme file</b>, which can have,
373  * given a cursor name/type, <b>alternate styles</b> on it. It
374  * works analogously as elm_object_cursor_style_set(), but here
375  * applies only to item objects.
376  *
377  * @warning Before you set a cursor style you should have defined a
378  *       custom cursor previously on the item, with
379  *       elm_object_item_cursor_set()
380  *
381  * @see elm_object_item_cursor_engine_only_set()
382  * @see elm_object_item_cursor_style_get()
383  *
384  * @ingroup General
385  */
386 EAPI void                         elm_object_item_cursor_style_set(Elm_Object_Item *it, const char *style);
387
388 /**
389  * Get the current @b style set for a given item's custom
390  * cursor
391  *
392  * @param it item with custom cursor set.
393  * @return style the cursor style in use. If the object does not
394  *         have a cursor set, then @c NULL is returned.
395  *
396  * @see elm_object_item_cursor_style_set() for more details
397  *
398  * @ingroup General
399  */
400 EAPI const char                  *elm_object_item_cursor_style_get(const Elm_Object_Item *it);
401
402 /**
403  * Set if the (custom)cursor for a given item should be
404  * searched in its theme, also, or should only rely on the
405  * rendering engine.
406  *
407  * @param it item with custom (custom) cursor already set on
408  * @param engine_only Use @c EINA_TRUE to have cursors looked for
409  * only on those provided by the rendering engine, @c EINA_FALSE to
410  * have them searched on the widget's theme, as well.
411  *
412  * @note This call is of use only if you've set a custom cursor
413  * for items, with elm_object_item_cursor_set().
414  *
415  * @note By default, cursors will only be looked for between those
416  * provided by the rendering engine.
417  *
418  * @ingroup General
419  */
420 EAPI void                         elm_object_item_cursor_engine_only_set(Elm_Object_Item *it, Eina_Bool engine_only);
421
422 /**
423  * Get if the (custom) cursor for a given item is being
424  * searched in its theme, also, or is only relying on the rendering
425  * engine.
426  *
427  * @param it an object item
428  * @return @c EINA_TRUE, if cursors are being looked for only on
429  * those provided by the rendering engine, @c EINA_FALSE if they
430  * are being searched on the widget's theme, as well.
431  *
432  * @see elm_object_item_cursor_engine_only_set(), for more details
433  *
434  * @ingroup General
435  */
436 EAPI Eina_Bool                    elm_object_item_cursor_engine_only_get(const Elm_Object_Item *it);
437
438 /**
439  * Add (register) a callback function to the smart event specified by @p event
440  * on the elm_object_item @p it.
441  *
442  * @param it an object item
443  * @param event the event's name string
444  * @param func the callback function
445  * @param data user data to be passed to the callback function
446  *
447  * Smart callbacks look very similar to Evas Smart callbacks, but are
448  * implemented as elementary object item's custom ones.
449  *
450  * This function adds a function callback to an elementary object item  when the
451  * event named @p event occurs in it. The function is @p func.
452  *
453  * A smart callback function must have the Elm_Object_Item_Smart_Cb prototype
454  * definition. The first parameter (@p data) in this definition will be a user
455  * specific data. The second parameter @p it is a handle to the object item on
456  * which event occurred. The third parameter, @p event_info, is a pointer to
457  * data which is totally dependent on the elementary object item's
458  * implementation and semantic for the given event.
459  *
460  * @see elm_object_item_smart_callback_del()
461  *
462  * @ingroup General
463  */
464 //Don't use this APIs
465 //EAPI void                         elm_object_item_smart_callback_add(Elm_Object_Item *it, const char *event, Elm_Object_Item_Smart_Cb func, const void *data);
466
467 /**
468  * Delete (unregister) a callback function from the smart event specified by @p
469  * event on the elementary object item @p it.
470  *
471  * @param it an object item
472  * @param event the event's name string
473  * @param func the callback function
474  * @return data user data.
475  *
476  * This function removes <b>the first</b> added smart callback on the item @p it
477  * matching the event name @p event and the registered function pointer @p func.
478  * If the removal is successful it will also return the data pointer that was
479  * passed to elm_object_item_smart_callback_add() (that will be the same as the
480  * parameter) when the callback(s) was(were) added to the item. If not
481  * successful @c NULL will be returned.
482  *
483  * @see elm_object_item_smart_callback_add()
484  *
485  * @ingroup General
486  */
487 //Don't use this APIs
488 //EAPI void                        *elm_object_item_smart_callback_del(Elm_Object_Item *it, const char *event, Elm_Object_Item_Smart_Cb func);