2 * @defgroup Focus Focus
4 * An Elementary application has, at all times, one (and only one)
5 * @b focused object. This is what determines where the input
6 * events go to within the application's window. Also, focused
7 * objects can be decorated differently, in order to signal to the
8 * user where the input is, at a given moment.
10 * Elementary applications also have the concept of <b>focus
11 * chain</b>: one can cycle through all the windows' focusable
12 * objects by input (tab key) or programmatically. The default
13 * focus chain for an application is the one define by the order in
14 * which the widgets where added in code. One will cycle through
15 * top level widgets, and, for each one containg sub-objects, cycle
16 * through them all, before returning to the level
17 * above. Elementary also allows one to set @b custom focus chains
18 * for their applications.
20 * Besides the focused decoration a widget may exhibit, when it
21 * gets focus, Elementary has a @b global focus highlight object
22 * that can be enabled for a window. If one chooses to do so, this
23 * extra highlight effect will surround the current focused object,
26 * @note Some Elementary widgets are @b unfocusable, after
27 * creation, by their very nature: they are not meant to be
28 * interacted with input events, but are there just for visual
31 * @ref general_functions_example_page "This" example contemplates
32 * some of these functions.
36 * Get the enable status of the focus highlight
38 * This gets whether the highlight on focused objects is enabled or not
41 EAPI Eina_Bool elm_focus_highlight_enabled_get(void);
44 * Set the enable status of the focus highlight
46 * Set whether to show or not the highlight on focused objects
47 * @param enable Enable highlight if EINA_TRUE, disable otherwise
50 EAPI void elm_focus_highlight_enabled_set(Eina_Bool enable);
53 * Get the enable status of the highlight animation
55 * Get whether the focus highlight, if enabled, will animate its switch from
56 * one object to the next
59 EAPI Eina_Bool elm_focus_highlight_animate_get(void);
62 * Set the enable status of the highlight animation
64 * Set whether the focus highlight, if enabled, will animate its switch from
65 * one object to the next
66 * @param animate Enable animation if EINA_TRUE, disable otherwise
69 EAPI void elm_focus_highlight_animate_set(Eina_Bool animate);
72 * Get the whether an Elementary object has the focus or not.
74 * @param obj The Elementary object to get the information from
75 * @return @c EINA_TRUE, if the object is focused, @c EINA_FALSE if
76 * not (and on errors).
78 * @see elm_object_focus_set()
82 EAPI Eina_Bool elm_object_focus_get(const Evas_Object *obj) EINA_ARG_NONNULL(1);
85 * Set/unset focus to a given Elementary object.
87 * @param obj The Elementary object to operate on.
88 * @param enable @c EINA_TRUE Set focus to a given object,
89 * @c EINA_FALSE Unset focus to a given object.
91 * @note When you set focus to this object, if it can handle focus, will
92 * take the focus away from the one who had it previously and will, for
93 * now on, be the one receiving input events. Unsetting focus will remove
94 * the focus from @p obj, passing it back to the previous element in the
97 * @see elm_object_focus_get(), elm_object_focus_custom_chain_get()
101 EAPI void elm_object_focus_set(Evas_Object *obj, Eina_Bool focus) EINA_ARG_NONNULL(1);
104 * Make a given Elementary object the focused one.
106 * @param obj The Elementary object to make focused.
108 * @note This object, if it can handle focus, will take the focus
109 * away from the one who had it previously and will, for now on, be
110 * the one receiving input events.
112 * @see elm_object_focus_get()
113 * @deprecated use elm_object_focus_set() instead.
117 EINA_DEPRECATED EAPI void elm_object_focus(Evas_Object *obj) EINA_ARG_NONNULL(1);
120 * Remove the focus from an Elementary object
122 * @param obj The Elementary to take focus from
124 * This removes the focus from @p obj, passing it back to the
125 * previous element in the focus chain list.
127 * @see elm_object_focus() and elm_object_focus_custom_chain_get()
128 * @deprecated use elm_object_focus_set() instead.
132 EINA_DEPRECATED EAPI void elm_object_unfocus(Evas_Object *obj) EINA_ARG_NONNULL(1);
135 * Set the ability for an Element object to be focused
137 * @param obj The Elementary object to operate on
138 * @param enable @c EINA_TRUE if the object can be focused, @c
139 * EINA_FALSE if not (and on errors)
141 * This sets whether the object @p obj is able to take focus or
142 * not. Unfocusable objects do nothing when programmatically
143 * focused, being the nearest focusable parent object the one
144 * really getting focus. Also, when they receive mouse input, they
145 * will get the event, but not take away the focus from where it
150 EAPI void elm_object_focus_allow_set(Evas_Object *obj, Eina_Bool enable) EINA_ARG_NONNULL(1);
153 * Get whether an Elementary object is focusable or not
155 * @param obj The Elementary object to operate on
156 * @return @c EINA_TRUE if the object is allowed to be focused, @c
157 * EINA_FALSE if not (and on errors)
159 * @note Objects which are meant to be interacted with by input
160 * events are created able to be focused, by default. All the
165 EAPI Eina_Bool elm_object_focus_allow_get(const Evas_Object *obj) EINA_ARG_NONNULL(1);
168 * Set custom focus chain.
170 * This function overwrites any previous custom focus chain within
171 * the list of objects. The previous list will be deleted and this list
172 * will be managed by elementary. After it is set, don't modify it.
174 * @note On focus cycle, only will be evaluated children of this container.
176 * @param obj The container object
177 * @param objs Chain of objects to pass focus
180 EAPI void elm_object_focus_custom_chain_set(Evas_Object *obj, Eina_List *objs) EINA_ARG_NONNULL(1);
183 * Unset a custom focus chain on a given Elementary widget
185 * @param obj The container object to remove focus chain from
187 * Any focus chain previously set on @p obj (for its child objects)
188 * is removed entirely after this call.
192 EAPI void elm_object_focus_custom_chain_unset(Evas_Object *obj) EINA_ARG_NONNULL(1);
195 * Get custom focus chain
197 * @param obj The container object
200 EAPI const Eina_List *elm_object_focus_custom_chain_get(const Evas_Object *obj) EINA_ARG_NONNULL(1);
203 * Append object to custom focus chain.
205 * @note If relative_child equal to NULL or not in custom chain, the object
206 * will be added in end.
208 * @note On focus cycle, only will be evaluated children of this container.
210 * @param obj The container object
211 * @param child The child to be added in custom chain
212 * @param relative_child The relative object to position the child
215 EAPI void elm_object_focus_custom_chain_append(Evas_Object *obj, Evas_Object *child, Evas_Object *relative_child) EINA_ARG_NONNULL(1, 2);
218 * Prepend object to custom focus chain.
220 * @note If relative_child equal to NULL or not in custom chain, the object
221 * will be added in begin.
223 * @note On focus cycle, only will be evaluated children of this container.
225 * @param obj The container object
226 * @param child The child to be added in custom chain
227 * @param relative_child The relative object to position the child
230 EAPI void elm_object_focus_custom_chain_prepend(Evas_Object *obj, Evas_Object *child, Evas_Object *relative_child) EINA_ARG_NONNULL(1, 2);
233 * Give focus to next object in object tree.
235 * Give focus to next object in focus chain of one object sub-tree.
236 * If the last object of chain already have focus, the focus will go to the
237 * first object of chain.
239 * @param obj The object root of sub-tree
240 * @param dir Direction to cycle the focus
244 EAPI void elm_object_focus_cycle(Evas_Object *obj, Elm_Focus_Direction dir) EINA_ARG_NONNULL(1);
247 * Give focus to near object in one direction.
249 * Give focus to near object in direction of one object.
250 * If none focusable object in given direction, the focus will not change.
252 * @param obj The reference object
253 * @param x Horizontal component of direction to focus
254 * @param y Vertical component of direction to focus
258 EAPI void elm_object_focus_direction_go(Evas_Object *obj, int x, int y) EINA_ARG_NONNULL(1);
261 * Make the elementary object and its children to be unfocusable
264 * @param obj The Elementary object to operate on
265 * @param tree_unfocusable @c EINA_TRUE for unfocusable,
266 * @c EINA_FALSE for focusable.
268 * This sets whether the object @p obj and its children objects
269 * are able to take focus or not. If the tree is set as unfocusable,
270 * newest focused object which is not in this tree will get focus.
271 * This API can be helpful for an object to be deleted.
272 * When an object will be deleted soon, it and its children may not
273 * want to get focus (by focus reverting or by other focus controls).
274 * Then, just use this API before deleting.
276 * @see elm_object_tree_unfocusable_get()
280 EAPI void elm_object_tree_unfocusable_set(Evas_Object *obj, Eina_Bool tree_unfocusable) EINA_ARG_NONNULL(1);
283 * Get whether an Elementary object and its children are unfocusable or not.
285 * @param obj The Elementary object to get the information from
286 * @return @c EINA_TRUE, if the tree is unfocussable,
287 * @c EINA_FALSE if not (and on errors).
289 * @see elm_object_tree_unfocusable_set()
293 EAPI Eina_Bool elm_object_tree_unfocusable_get(const Evas_Object *obj) EINA_ARG_NONNULL(1);