Remove deprecated API.
[framework/uifw/elementary.git] / src / lib / elm_object.h
1 /**
2  * Set a label of an object
3  *
4  * @param obj The Elementary object
5  * @param part The text part name to set (NULL for the default label)
6  * @param label The new text of the label
7  *
8  * @note Elementary objects may have many labels (e.g. Action Slider)
9  *
10  * @ingroup General
11  */
12 EAPI void                         elm_object_part_text_set(Evas_Object *obj, const char *part, const char *label);
13
14 #define elm_object_text_set(obj, label) elm_object_part_text_set((obj), NULL, (label))
15
16 /**
17  * Get a label of an object
18  *
19  * @param obj The Elementary object
20  * @param part The text part name to get (NULL for the default label)
21  * @return text of the label or NULL for any error
22  *
23  * @note Elementary objects may have many labels (e.g. Action Slider)
24  *
25  * @ingroup General
26  */
27 EAPI const char                  *elm_object_part_text_get(const Evas_Object *obj, const char *part);
28
29 #define elm_object_text_get(obj) elm_object_part_text_get((obj), NULL)
30
31 /**
32  * Set a content of an object
33  *
34  * @param obj The Elementary object
35  * @param part The content part name to set (NULL for the default content)
36  * @param content The new content of the object
37  *
38  * @note Elementary objects may have many contents
39  *
40  * @ingroup General
41  */
42 EAPI void                         elm_object_part_content_set(Evas_Object *obj, const char *part, Evas_Object *content);
43
44 #define elm_object_content_set(obj, content) elm_object_part_content_set((obj), NULL, (content))
45
46 /**
47  * Get a content of an object
48  *
49  * @param obj The Elementary object
50  * @param part The content part name to get (NULL for the default content)
51  * @return content of the object or NULL for any error
52  *
53  * @note Elementary objects may have many contents
54  *
55  * @ingroup General
56  */
57 EAPI Evas_Object                 *elm_object_part_content_get(const Evas_Object *obj, const char *part);
58
59 #define elm_object_content_get(obj) elm_object_part_content_get((obj), NULL)
60
61 /**
62  * Unset a content of an object
63  *
64  * @param obj The Elementary object
65  * @param part The content part name to unset (NULL for the default content)
66  *
67  * @note Elementary objects may have many contents
68  *
69  * @ingroup General
70  */
71 EAPI Evas_Object                 *elm_object_part_content_unset(Evas_Object *obj, const char *part);
72
73 #define elm_object_content_unset(obj) elm_object_part_content_unset((obj), NULL)
74
75 /**
76  * Set the text to read out when in accessibility mode
77  *
78  * @param obj The object which is to be described
79  * @param txt The text that describes the widget to people with poor or no vision
80  *
81  * @ingroup General
82  */
83 EAPI void                         elm_object_access_info_set(Evas_Object *obj, const char *txt);
84
85 /**
86  * Get a named object from the children
87  *
88  * @param obj The parent object whose children to look at
89  * @param name The name of the child to find
90  * @param recurse Set to the maximum number of levels to recurse (0 == none, 1 is only look at 1 level of children etc.)
91  * @return The found object of that name, or NULL if none is found
92  *
93  * This function searches the children (or recursively children of
94  * children and so on) of the given @p obj object looking for a child with
95  * the name of @p name. If the child is found the object is returned, or
96  * NULL is returned. You can set the name of an object with
97  * evas_object_name_set(). If the name is not unique within the child
98  * objects (or the tree is @p recurse is greater than 0) then it is
99  * undefined as to which child of that name is returned, so ensure the name
100  * is unique amongst children. If recurse is set to -1 it will recurse
101  * without limit.
102  *
103  * @ingroup General
104  */
105 EAPI Evas_Object                 *elm_object_name_find(const Evas_Object *obj, const char *name, int recurse);
106
107 /**
108  * @defgroup Styles Styles
109  *
110  * Widgets can have different styles of look. These generic API's
111  * set styles of widgets, if they support them (and if the theme(s)
112  * do).
113  *
114  * @ref general_functions_example_page "This" example contemplates
115  * some of these functions.
116  */
117
118 /**
119  * Set the style to use by a widget
120  *
121  * Sets the style name that will define the appearance of a widget. Styles
122  * vary from widget to widget and may also be defined by other themes
123  * by means of extensions and overlays.
124  *
125  * @param obj The Elementary widget to style
126  * @param style The style name to use
127  *
128  * @see elm_theme_extension_add()
129  * @see elm_theme_extension_del()
130  * @see elm_theme_overlay_add()
131  * @see elm_theme_overlay_del()
132  *
133  * @ingroup Styles
134  */
135 EAPI void         elm_object_style_set(Evas_Object *obj, const char *style);
136
137 /**
138  * Get the style used by the widget
139  *
140  * This gets the style being used for that widget. Note that the string
141  * pointer is only valid as long as the object is valid and the style doesn't
142  * change.
143  *
144  * @param obj The Elementary widget to query for its style
145  * @return The style name used
146  *
147  * @see elm_object_style_set()
148  *
149  * @ingroup Styles
150  */
151 EAPI const char  *elm_object_style_get(const Evas_Object *obj);
152
153 /**
154  * Set the disabled state of an Elementary object.
155  *
156  * @param obj The Elementary object to operate on
157  * @param disabled The state to put in in: @c EINA_TRUE for
158  *        disabled, @c EINA_FALSE for enabled
159  *
160  * Elementary objects can be @b disabled, in which state they won't
161  * receive input and, in general, will be themed differently from
162  * their normal state, usually greyed out. Useful for contexts
163  * where you don't want your users to interact with some of the
164  * parts of you interface.
165  *
166  * This sets the state for the widget, either disabling it or
167  * enabling it back.
168  *
169  * @ingroup Styles
170  */
171 EAPI void         elm_object_disabled_set(Evas_Object *obj, Eina_Bool disabled);
172
173 /**
174  * Get the disabled state of an Elementary object.
175  *
176  * @param obj The Elementary object to operate on
177  * @return @c EINA_TRUE, if the widget is disabled, @c EINA_FALSE
178  *            if it's enabled (or on errors)
179  *
180  * This gets the state of the widget, which might be enabled or disabled.
181  *
182  * @ingroup Styles
183  */
184 EAPI Eina_Bool    elm_object_disabled_get(const Evas_Object *obj);
185
186 /**
187  * @defgroup WidgetNavigation Widget Tree Navigation.
188  *
189  * These functions provide checks for if a Evas_Object is an Elementary widget,
190  * the possibility of getting a widget's parent, top level parent and getting a
191  * string representation of a widget's type.
192  */
193
194 /**
195  * Check if the given Evas Object is an Elementary widget.
196  *
197  * @param obj the object to query.
198  * @return @c EINA_TRUE if it is an elementary widget variant,
199  *         @c EINA_FALSE otherwise
200  * @ingroup WidgetNavigation
201  */
202 EAPI Eina_Bool    elm_object_widget_check(const Evas_Object *obj);
203
204 /**
205  * Get the first parent of the given object that is an Elementary
206  * widget.
207  *
208  * @param obj the Elementary object to query parent from.
209  * @return the parent object that is an Elementary widget, or @c
210  *         NULL, if it was not found.
211  *
212  * Use this to query for an object's parent widget.
213  *
214  * @note Most of Elementary users wouldn't be mixing non-Elementary
215  * smart objects in the objects tree of an application, as this is
216  * an advanced usage of Elementary with Evas. So, except for the
217  * application's window, which is the root of that tree, all other
218  * objects would have valid Elementary widget parents.
219  *
220  * @ingroup WidgetNavigation
221  */
222 EAPI Evas_Object *elm_object_parent_widget_get(const Evas_Object *obj);
223
224 /**
225  * Get the top level parent of an Elementary widget.
226  *
227  * @param obj The object to query.
228  * @return The top level Elementary widget, or @c NULL if parent cannot be
229  * found.
230  * @ingroup WidgetNavigation
231  */
232 EAPI Evas_Object *elm_object_top_widget_get(const Evas_Object *obj);
233
234 /**
235  * Get the string that represents this Elementary widget.
236  *
237  * @note Elementary is weird and exposes itself as a single
238  *       Evas_Object_Smart_Class of type "elm_widget", so
239  *       evas_object_type_get() always return that, making debug and
240  *       language bindings hard. This function tries to mitigate this
241  *       problem, but the solution is to change Elementary to use
242  *       proper inheritance.
243  *
244  * @param obj the object to query.
245  * @return Elementary widget name, or @c NULL if not a valid widget.
246  * @ingroup WidgetNavigation
247  */
248 EAPI const char  *elm_object_widget_type_get(const Evas_Object *obj);
249
250 /**
251  * Send a signal to the widget edje object.
252  *
253  * This function sends a signal to the edje object of the obj. An
254  * edje program can respond to a signal by specifying matching
255  * 'signal' and 'source' fields.
256  *
257  * @param obj The object
258  * @param emission The signal's name.
259  * @param source The signal's source.
260  * @ingroup General
261  */
262 EAPI void         elm_object_signal_emit(Evas_Object *obj, const char *emission, const char *source);
263
264 /**
265  * Add a callback for a signal emitted by widget edje object.
266  *
267  * This function connects a callback function to a signal emitted by the
268  * edje object of the obj.
269  * Globs can occur in either the emission or source name.
270  *
271  * @param obj The object
272  * @param emission The signal's name.
273  * @param source The signal's source.
274  * @param func The callback function to be executed when the signal is
275  * emitted.
276  * @param data A pointer to data to pass in to the callback function.
277  * @ingroup General
278  */
279 EAPI void         elm_object_signal_callback_add(Evas_Object *obj, const char *emission, const char *source, Edje_Signal_Cb func, void *data);
280
281 /**
282  * Remove a signal-triggered callback from a widget edje object.
283  *
284  * This function removes a callback, previously attached to a
285  * signal emitted by the edje object of the obj.  The parameters
286  * emission, source and func must match exactly those passed to a
287  * previous call to elm_object_signal_callback_add(). The data
288  * pointer that was passed to this call will be returned.
289  *
290  * @param obj The object
291  * @param emission The signal's name.
292  * @param source The signal's source.
293  * @param func The callback function to be executed when the signal is
294  * emitted.
295  * @return The data pointer
296  * @ingroup General
297  */
298 EAPI void        *elm_object_signal_callback_del(Evas_Object *obj, const char *emission, const char *source, Edje_Signal_Cb func);
299
300 /**
301  * Add a callback for input events (key up, key down, mouse wheel)
302  * on a given Elementary widget
303  *
304  * @param obj The widget to add an event callback on
305  * @param func The callback function to be executed when the event
306  * happens
307  * @param data Data to pass in to @p func
308  *
309  * Every widget in an Elementary interface set to receive focus,
310  * with elm_object_focus_allow_set(), will propagate @b all of its
311  * key up, key down and mouse wheel input events up to its parent
312  * object, and so on. All of the focusable ones in this chain which
313  * had an event callback set, with this call, will be able to treat
314  * those events. There are two ways of making the propagation of
315  * these event upwards in the tree of widgets to @b cease:
316  * - Just return @c EINA_TRUE on @p func. @c EINA_FALSE will mean
317  *   the event was @b not processed, so the propagation will go on.
318  * - The @c event_info pointer passed to @p func will contain the
319  *   event's structure and, if you OR its @c event_flags inner
320  *   value to @c EVAS_EVENT_FLAG_ON_HOLD, you're telling Elementary
321  *   one has already handled it, thus killing the event's
322  *   propagation, too.
323  *
324  * @note Your event callback will be issued on those events taking
325  * place only if no other child widget of @p obj has consumed the
326  * event already.
327  *
328  * @note Not to be confused with @c
329  * evas_object_event_callback_add(), which will add event callbacks
330  * per type on general Evas objects (no event propagation
331  * infrastructure taken in account).
332  *
333  * @note Not to be confused with @c
334  * elm_object_signal_callback_add(), which will add callbacks to @b
335  * signals coming from a widget's theme, not input events.
336  *
337  * @note Not to be confused with @c
338  * edje_object_signal_callback_add(), which does the same as
339  * elm_object_signal_callback_add(), but directly on an Edje
340  * object.
341  *
342  * @note Not to be confused with @c
343  * evas_object_smart_callback_add(), which adds callbacks to smart
344  * objects' <b>smart events</b>, and not input events.
345  *
346  * @see elm_object_event_callback_del()
347  *
348  * @ingroup General
349  */
350 EAPI void         elm_object_event_callback_add(Evas_Object *obj, Elm_Event_Cb func, const void *data);
351
352 /**
353  * Remove an event callback from a widget.
354  *
355  * This function removes a callback, previously attached to event emission
356  * by the @p obj.
357  * The parameters func and data must match exactly those passed to
358  * a previous call to elm_object_event_callback_add(). The data pointer that
359  * was passed to this call will be returned.
360  *
361  * @param obj The object
362  * @param func The callback function to be executed when the event is
363  * emitted.
364  * @param data Data to pass in to the callback function.
365  * @return The data pointer
366  * @ingroup General
367  */
368 EAPI void        *elm_object_event_callback_del(Evas_Object *obj, Elm_Event_Cb func, const void *data);