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 containing 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
40 * @see elm_focus_highlight_enabled_set()
43 EAPI Eina_Bool elm_focus_highlight_enabled_get(void);
46 * Set the enable status of the focus highlight
48 * @param enable Enable highlight if EINA_TRUE, disable otherwise
50 * Set whether to show or not the highlight on focused objects
52 * Note that it will take effect only to Elementary windows created after
59 EAPI void elm_focus_highlight_enabled_set(Eina_Bool enable);
62 * Get the enable status of the highlight animation
64 * @return The focus highlight mode set
66 * Get whether the focus highlight, if enabled, will animate its switch from
67 * one object to the next
71 EAPI Eina_Bool elm_focus_highlight_animate_get(void);
74 * Set the enable status of the highlight animation
76 * @param animate Enable animation if EINA_TRUE, disable otherwise
78 * Set whether the focus highlight, if enabled, will animate its switch from
79 * one object to the next
81 * Note that it will take effect only to Elementary windows created after
88 EAPI void elm_focus_highlight_animate_set(Eina_Bool animate);
91 * Get the whether an Elementary object has the focus or not.
93 * @param obj The Elementary object to get the information from
94 * @return @c EINA_TRUE, if the object is focused, @c EINA_FALSE if
95 * not (and on errors).
97 * @see elm_object_focus_set()
101 EAPI Eina_Bool elm_object_focus_get(const Evas_Object *obj);
104 * Set/unset focus to a given Elementary object.
106 * @param obj The Elementary object to operate on.
107 * @param focus @c EINA_TRUE Set focus to a given object,
108 * @c EINA_FALSE Unset focus to a given object.
110 * @note When you set focus to this object, if it can handle focus, will
111 * take the focus away from the one who had it previously and will, for
112 * now on, be the one receiving input events. Unsetting focus will remove
113 * the focus from @p obj, passing it back to the previous element in the
116 * @see elm_object_focus_get(), elm_object_focus_custom_chain_get()
120 EAPI void elm_object_focus_set(Evas_Object *obj, Eina_Bool focus);
123 * Set the ability for an Elmentary object to be focused
125 * @param obj The Elementary object to operate on
126 * @param enable @c EINA_TRUE if the object can be focused, @c
127 * EINA_FALSE if not (and on errors)
129 * This sets whether the object @p obj is able to take focus or
130 * not. Unfocusable objects do nothing when programmatically
131 * focused, being the nearest focusable parent object the one
132 * really getting focus. Also, when they receive mouse input, they
133 * will get the event, but not take away the focus from where it
138 EAPI void elm_object_focus_allow_set(Evas_Object *obj, Eina_Bool enable);
141 * Get whether an Elementary object is focusable or not
143 * @param obj The Elementary object to operate on
144 * @return @c EINA_TRUE if the object is allowed to be focused, @c
145 * EINA_FALSE if not (and on errors)
147 * @note Objects which are meant to be interacted with by input
148 * events are created able to be focused, by default. All the
153 EAPI Eina_Bool elm_object_focus_allow_get(const Evas_Object *obj);
156 * Set custom focus chain.
158 * This function overwrites any previous custom focus chain within
159 * the list of objects. The previous list will be deleted and this list
160 * will be managed by elementary. After it is set, don't modify it.
162 * @note On focus cycle, only will be evaluated children of this container.
164 * @param obj The container object
165 * @param objs Chain of objects to pass focus
168 EAPI void elm_object_focus_custom_chain_set(Evas_Object *obj, Eina_List *objs);
171 * Unset a custom focus chain on a given Elementary widget
173 * @param obj The container object to remove focus chain from
175 * Any focus chain previously set on @p obj (for its child objects)
176 * is removed entirely after this call.
180 EAPI void elm_object_focus_custom_chain_unset(Evas_Object *obj);
183 * Get custom focus chain
185 * @param obj The container object
188 EAPI const Eina_List *elm_object_focus_custom_chain_get(const Evas_Object *obj);
191 * Append object to custom focus chain.
193 * @note If relative_child equal to NULL or not in custom chain, the object
194 * will be added in end.
196 * @note On focus cycle, only will be evaluated children of this container.
198 * @param obj The container object
199 * @param child The child to be added in custom chain
200 * @param relative_child The relative object to position the child
203 EAPI void elm_object_focus_custom_chain_append(Evas_Object *obj, Evas_Object *child, Evas_Object *relative_child);
206 * Prepend object to custom focus chain.
208 * @note If relative_child equal to NULL or not in custom chain, the object
209 * will be added in begin.
211 * @note On focus cycle, only will be evaluated children of this container.
213 * @param obj The container object
214 * @param child The child to be added in custom chain
215 * @param relative_child The relative object to position the child
218 EAPI void elm_object_focus_custom_chain_prepend(Evas_Object *obj, Evas_Object *child, Evas_Object *relative_child);
221 * Give focus to next object in object tree.
223 * Give focus to next object in focus chain of one object sub-tree.
224 * If the last object of chain already have focus, the focus will go to the
225 * first object of chain.
227 * @param obj The object root of sub-tree
228 * @param dir Direction to cycle the focus
232 //XXX: How about elm_object_focus_move()? focus_next() ?
233 EAPI void elm_object_focus_cycle(Evas_Object *obj, Elm_Focus_Direction dir);
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()
256 //XXX: How about elm_object_tree_focus_allow_set()?
257 EAPI void elm_object_tree_unfocusable_set(Evas_Object *obj, Eina_Bool tree_unfocusable);
260 * Get whether an Elementary object and its children are unfocusable or not.
262 * @param obj The Elementary object to get the information from
263 * @return @c EINA_TRUE, if the tree is unfocussable,
264 * @c EINA_FALSE if not (and on errors).
266 * @see elm_object_tree_unfocusable_set()
270 //XXX: How about elm_object_tree_focus_allow_get()?
271 EAPI Eina_Bool elm_object_tree_unfocusable_get(const Evas_Object *obj);