add object_item_tooltip api
[framework/uifw/elementary.git] / src / lib / elm_object_item.h
1 /**
2  * Get the widget object's handle which contains a given item
3  *
4  * @param it The Elementary object item
5  * @return The widget object
6  *
7  * @note This returns the widget object itself that an item belongs to.
8  * @note Every elm_object_item supports this API
9  * @ingroup General
10  */
11 EAPI Evas_Object                 *elm_object_item_object_get(const Elm_Object_Item *it);
12
13 /**
14  * Set a content of an object item
15  *
16  * @param it The Elementary object item
17  * @param part The content part name to set (NULL for the default content)
18  * @param content The new content of the object item
19  *
20  * @note Elementary object items may have many contents
21  *
22  * @ingroup General
23  */
24 EAPI void                         elm_object_item_part_content_set(Elm_Object_Item *it, const char *part, Evas_Object *content);
25
26 #define elm_object_item_content_set(it, content) elm_object_item_part_content_set((it), NULL, (content))
27
28 /**
29  * Get a content of an object item
30  *
31  * @param it The Elementary object item
32  * @param part The content part name to unset (NULL for the default content)
33  * @return content of the object item or NULL for any error
34  *
35  * @note Elementary object items may have many contents
36  *
37  * @ingroup General
38  */
39 EAPI Evas_Object                 *elm_object_item_part_content_get(const Elm_Object_Item *it, const char *part);
40
41 #define elm_object_item_content_get(it) elm_object_item_part_content_get((it), NULL)
42
43 /**
44  * Unset a content of an object item
45  *
46  * @param it The Elementary object item
47  * @param part The content part name to unset (NULL for the default content)
48  *
49  * @note Elementary object items may have many contents
50  *
51  * @ingroup General
52  */
53 EAPI Evas_Object                 *elm_object_item_part_content_unset(Elm_Object_Item *it, const char *part);
54
55 #define elm_object_item_content_unset(it) elm_object_item_part_content_unset((it), NULL)
56
57 /**
58  * Set a label of an object item
59  *
60  * @param it The Elementary object item
61  * @param part The text part name to set (NULL for the default label)
62  * @param label The new text of the label
63  *
64  * @note Elementary object items may have many labels
65  *
66  * @ingroup General
67  */
68 EAPI void                         elm_object_item_part_text_set(Elm_Object_Item *it, const char *part, const char *label);
69
70 #define elm_object_item_text_set(it, label) elm_object_item_part_text_set((it), NULL, (label))
71
72 /**
73  * Get a label of an object item
74  *
75  * @param it The Elementary object item
76  * @param part The text part name to get (NULL for the default label)
77  * @return text of the label or NULL for any error
78  *
79  * @note Elementary object items may have many labels
80  *
81  * @ingroup General
82  */
83 EAPI const char                  *elm_object_item_part_text_get(const Elm_Object_Item *it, const char *part);
84
85 #define elm_object_item_text_get(it) elm_object_item_part_text_get((it), NULL)
86
87 /**
88  * Set the text to read out when in accessibility mode
89  *
90  * @param it The object item which is to be described
91  * @param txt The text that describes the widget to people with poor or no vision
92  *
93  * @ingroup General
94  */
95 EAPI void                         elm_object_item_access_info_set(Elm_Object_Item *it, const char *txt);
96
97 /**
98  * Get the data associated with an object item
99  * @param it The Elementary object item
100  * @return The data associated with @p it
101  *
102  * @note Every elm_object_item supports this API
103  * @ingroup General
104  */
105 EAPI void                        *elm_object_item_data_get(const Elm_Object_Item *it);
106
107 /**
108  * Set the data associated with an object item
109  * @param it The Elementary object item
110  * @param data The data to be associated with @p it
111  *
112  * @note Every elm_object_item supports this API
113  * @ingroup General
114  */
115 EAPI void                         elm_object_item_data_set(Elm_Object_Item *it, void *data);
116
117 /**
118  * Send a signal to the edje object of the widget item.
119  *
120  * This function sends a signal to the edje object of the obj item. An
121  * edje program can respond to a signal by specifying matching
122  * 'signal' and 'source' fields.
123  *
124  * @param it The Elementary object item
125  * @param emission The signal's name.
126  * @param source The signal's source.
127  * @ingroup General
128  */
129 EAPI void                         elm_object_item_signal_emit(Elm_Object_Item *it, const char *emission, const char *source);
130
131 /**
132  * Set the disabled state of an widget item.
133  *
134  * @param obj The Elementary object item
135  * @param disabled The state to put in in: @c EINA_TRUE for
136  *        disabled, @c EINA_FALSE for enabled
137  *
138  * Elementary object item can be @b disabled, in which state they won't
139  * receive input and, in general, will be themed differently from
140  * their normal state, usually greyed out. Useful for contexts
141  * where you don't want your users to interact with some of the
142  * parts of you interface.
143  *
144  * This sets the state for the widget item, either disabling it or
145  * enabling it back.
146  *
147  * @ingroup Styles
148  */
149 EAPI void                         elm_object_item_disabled_set(Elm_Object_Item *it, Eina_Bool disabled);
150
151 /**
152  * Get the disabled state of an widget item.
153  *
154  * @param obj The Elementary object
155  * @return @c EINA_TRUE, if the widget item is disabled, @c EINA_FALSE
156  *            if it's enabled (or on errors)
157  *
158  * This gets the state of the widget, which might be enabled or disabled.
159  *
160  * @ingroup Styles
161  */
162 EAPI Eina_Bool                    elm_object_item_disabled_get(const Elm_Object_Item *it);
163
164 /**
165  * @brief Set the function to be called when an item from the widget is
166  * freed.
167  *
168  * @param it The item to set the callback on
169  * @param func The function called
170  *
171  * That function will receive these parameters:
172  * @li void * item data
173  * @li Evas_Object * widget object
174  * @li Elm_Object_Item * widget item
175  *
176  * @note Every elm_object_item supports this API
177  *
178  * @see elm_object_item_del()
179  * @ingroup General
180  */
181 EAPI void                         elm_object_item_del_cb_set(Elm_Object_Item *it, Evas_Smart_Cb del_cb);
182
183
184 // XXX: One more API is to be added.
185 //EAPI void                       elm_object_item_del(Elm_Object_Item *it);
186
187
188 /**
189  * Set the text to be shown in a given object item's tooltips.
190  *
191  * @param item Target item.
192  * @param text The text to set in the content.
193  *
194  * Setup the text as tooltip to object. The item can have only one tooltip,
195  * so any previous tooltip data - set with this function or
196  * elm_object_item_tooltip_content_cb_set() - is removed.
197  *
198  * @see elm_object_tooltip_text_set() for more details.
199  *
200  * @ingroup General
201  */
202 EAPI void                         elm_object_item_tooltip_text_set(Elm_Object_Item *item, const char *text);
203
204 /**
205  * @brief Disable size restrictions on an object's tooltip
206  * @param item The tooltip's anchor object
207  * @param disable If EINA_TRUE, size restrictions are disabled
208  * @return EINA_FALSE on failure, EINA_TRUE on success
209  *
210  * This function allows a tooltip to expand beyond its parant window's canvas.
211  * It will instead be limited only by the size of the display.
212  */
213 EAPI Eina_Bool                    elm_object_item_tooltip_window_mode_set(Elm_Object_Item *item, Eina_Bool disable);
214
215 /**
216  * @brief Retrieve size restriction state of an object's tooltip
217  * @param obj The tooltip's anchor object
218  * @return If EINA_TRUE, size restrictions are disabled
219  *
220  * This function returns whether a tooltip is allowed to expand beyond
221  * its parant window's canvas.
222  * It will instead be limited only by the size of the display.
223  */
224 EAPI Eina_Bool                    elm_object_item_tooltip_window_mode_get(const Elm_Object_Item *item);
225
226 /**
227  * Set the content to be shown in the tooltip item.
228  *
229  * Setup the tooltip to item. The item can have only one tooltip,
230  * so any previous tooltip data is removed. @p func(with @p data) will
231  * be called every time that need show the tooltip and it should
232  * return a valid Evas_Object. This object is then managed fully by
233  * tooltip system and is deleted when the tooltip is gone.
234  *
235  * @param item the object item being attached a tooltip.
236  * @param func the function used to create the tooltip contents.
237  * @param data what to provide to @a func as callback data/context.
238  * @param del_cb called when data is not needed anymore, either when
239  *        another callback replaces @a func, the tooltip is unset with
240  *        elm_object_item_tooltip_unset() or the owner @a item
241  *        dies. This callback receives as the first parameter the
242  *        given @a data, and @c event_info is the item.
243  *
244  * @see elm_object_tooltip_content_cb_set() for more details.
245  *
246  * @ingroup General
247  */
248 EAPI void                         elm_object_item_tooltip_content_cb_set(Elm_Object_Item *item, Elm_Tooltip_Item_Content_Cb func, const void *data, Evas_Smart_Cb del_cb);
249
250 /**
251  * Unset tooltip from item.
252  *
253  * @param item object item to remove previously set tooltip.
254  *
255  * Remove tooltip from item. The callback provided as del_cb to
256  * elm_object_item_tooltip_content_cb_set() will be called to notify
257  * it is not used anymore.
258  *
259  * @see elm_object_tooltip_unset() for more details.
260  * @see elm_object_item_tooltip_content_cb_set()
261  *
262  * @ingroup General
263  */
264 EAPI void                         elm_object_item_tooltip_unset(Elm_Object_Item *item);
265
266 /**
267  * Sets a different style for this item tooltip.
268  *
269  * @note before you set a style you should define a tooltip with
270  *       elm_object_item_tooltip_content_cb_set() or
271  *       elm_object_item_tooltip_text_set()
272  *
273  * @param item object item with tooltip already set.
274  * @param style the theme style to use (default, transparent, ...)
275  *
276  * @see elm_object_tooltip_style_set() for more details.
277  *
278  * @ingroup General
279  */
280 EAPI void                         elm_object_item_tooltip_style_set(Elm_Object_Item *item, const char *style);
281
282 /**
283  * Get the style for this item tooltip.
284  *
285  * @param item object item with tooltip already set.
286  * @return style the theme style in use, defaults to "default". If the
287  *         object does not have a tooltip set, then NULL is returned.
288  *
289  * @see elm_object_tooltip_style_get() for more details.
290  * @see elm_object_item_tooltip_style_set()
291  *
292  * @ingroup General
293  */
294 EAPI const char                  *elm_object_item_tooltip_style_get(const Elm_Object_Item *item);