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 * @param enable Enable highlight if EINA_TRUE, disable otherwise
48 * Set whether to show or not the highlight on focused objects
51 EAPI void elm_focus_highlight_enabled_set(Eina_Bool enable);
54 * Get the enable status of the highlight animation
56 * @return The focus hilight mode set
58 * Get whether the focus highlight, if enabled, will animate its switch from
59 * one object to the next
63 EAPI Eina_Bool elm_focus_highlight_animate_get(void);
66 * Set the enable status of the highlight animation
68 * @param animate Enable animation if EINA_TRUE, disable otherwise
70 * Set whether the focus highlight, if enabled, will animate its switch from
71 * one object to the next
75 EAPI void elm_focus_highlight_animate_set(Eina_Bool animate);
78 * Get the whether an Elementary object has the focus or not.
80 * @param obj The Elementary object to get the information from
81 * @return @c EINA_TRUE, if the object is focused, @c EINA_FALSE if
82 * not (and on errors).
84 * @see elm_object_focus_set()
88 EAPI Eina_Bool elm_object_focus_get(const Evas_Object *obj);
91 * Set/unset focus to a given Elementary object.
93 * @param obj The Elementary object to operate on.
94 * @param focus @c EINA_TRUE Set focus to a given object,
95 * @c EINA_FALSE Unset focus to a given object.
97 * @note When you set focus to this object, if it can handle focus, will
98 * take the focus away from the one who had it previously and will, for
99 * now on, be the one receiving input events. Unsetting focus will remove
100 * the focus from @p obj, passing it back to the previous element in the
103 * @see elm_object_focus_get(), elm_object_focus_custom_chain_get()
107 EAPI void elm_object_focus_set(Evas_Object *obj, Eina_Bool focus);
110 * Set the ability for an Element object to be focused
112 * @param obj The Elementary object to operate on
113 * @param enable @c EINA_TRUE if the object can be focused, @c
114 * EINA_FALSE if not (and on errors)
116 * This sets whether the object @p obj is able to take focus or
117 * not. Unfocusable objects do nothing when programmatically
118 * focused, being the nearest focusable parent object the one
119 * really getting focus. Also, when they receive mouse input, they
120 * will get the event, but not take away the focus from where it
125 EAPI void elm_object_focus_allow_set(Evas_Object *obj, Eina_Bool enable);
128 * Get whether an Elementary object is focusable or not
130 * @param obj The Elementary object to operate on
131 * @return @c EINA_TRUE if the object is allowed to be focused, @c
132 * EINA_FALSE if not (and on errors)
134 * @note Objects which are meant to be interacted with by input
135 * events are created able to be focused, by default. All the
140 EAPI Eina_Bool elm_object_focus_allow_get(const Evas_Object *obj);
143 * Set custom focus chain.
145 * This function overwrites any previous custom focus chain within
146 * the list of objects. The previous list will be deleted and this list
147 * will be managed by elementary. After it is set, don't modify it.
149 * @note On focus cycle, only will be evaluated children of this container.
151 * @param obj The container object
152 * @param objs Chain of objects to pass focus
155 EAPI void elm_object_focus_custom_chain_set(Evas_Object *obj, Eina_List *objs);
158 * Unset a custom focus chain on a given Elementary widget
160 * @param obj The container object to remove focus chain from
162 * Any focus chain previously set on @p obj (for its child objects)
163 * is removed entirely after this call.
167 EAPI void elm_object_focus_custom_chain_unset(Evas_Object *obj);
170 * Get custom focus chain
172 * @param obj The container object
175 EAPI const Eina_List *elm_object_focus_custom_chain_get(const Evas_Object *obj);
178 * Append object to custom focus chain.
180 * @note If relative_child equal to NULL or not in custom chain, the object
181 * will be added in end.
183 * @note On focus cycle, only will be evaluated children of this container.
185 * @param obj The container object
186 * @param child The child to be added in custom chain
187 * @param relative_child The relative object to position the child
190 EAPI void elm_object_focus_custom_chain_append(Evas_Object *obj, Evas_Object *child, Evas_Object *relative_child);
193 * Prepend object to custom focus chain.
195 * @note If relative_child equal to NULL or not in custom chain, the object
196 * will be added in begin.
198 * @note On focus cycle, only will be evaluated children of this container.
200 * @param obj The container object
201 * @param child The child to be added in custom chain
202 * @param relative_child The relative object to position the child
205 EAPI void elm_object_focus_custom_chain_prepend(Evas_Object *obj, Evas_Object *child, Evas_Object *relative_child);
208 * Give focus to next object in object tree.
210 * Give focus to next object in focus chain of one object sub-tree.
211 * If the last object of chain already have focus, the focus will go to the
212 * first object of chain.
214 * @param obj The object root of sub-tree
215 * @param dir Direction to cycle the focus
219 EAPI void elm_object_focus_cycle(Evas_Object *obj, Elm_Focus_Direction dir);
222 * Give focus to near object in one direction.
224 * Give focus to near object in direction of one object.
225 * If none focusable object in given direction, the focus will not change.
227 * @param obj The reference object
228 * @param x Horizontal component of direction to focus
229 * @param y Vertical component of direction to focus
233 EAPI void elm_object_focus_direction_go(Evas_Object *obj, int x, int y);
236 * Make the elementary object and its children to be unfocusable
239 * @param obj The Elementary object to operate on
240 * @param tree_unfocusable @c EINA_TRUE for unfocusable,
241 * @c EINA_FALSE for focusable.
243 * This sets whether the object @p obj and its children objects
244 * are able to take focus or not. If the tree is set as unfocusable,
245 * newest focused object which is not in this tree will get focus.
246 * This API can be helpful for an object to be deleted.
247 * When an object will be deleted soon, it and its children may not
248 * want to get focus (by focus reverting or by other focus controls).
249 * Then, just use this API before deleting.
251 * @see elm_object_tree_unfocusable_get()
255 EAPI void elm_object_tree_unfocusable_set(Evas_Object *obj, Eina_Bool tree_unfocusable);
258 * Get whether an Elementary object and its children are unfocusable or not.
260 * @param obj The Elementary object to get the information from
261 * @return @c EINA_TRUE, if the tree is unfocussable,
262 * @c EINA_FALSE if not (and on errors).
264 * @see elm_object_tree_unfocusable_set()
268 EAPI Eina_Bool elm_object_tree_unfocusable_get(const Evas_Object *obj);