2 * @defgroup Focus Focus
5 * An Elementary application has, at all times, one (and only one)
6 * @b focused object. This is what determines where the input
7 * events go to within the application's window. Also, focused
8 * objects can be decorated differently, in order to signal to the
9 * user where the input is, at a given moment.
11 * Elementary applications also have the concept of <b>focus
12 * chain</b>: one can cycle through all the windows' focusable
13 * objects by input (tab key) or programmatically. The default
14 * focus chain for an application is the one define by the order in
15 * which the widgets where added in code. One will cycle through
16 * top level widgets, and, for each one containing sub-objects, cycle
17 * through them all, before returning to the level
18 * above. Elementary also allows one to set @b custom focus chains
19 * for their applications.
21 * Besides the focused decoration a widget may exhibit, when it
22 * gets focus, Elementary has a @b global focus highlight object
23 * that can be enabled for a window. If one chooses to do so, this
24 * extra highlight effect will surround the current focused object,
27 * @note Some Elementary widgets are @b unfocusable, after
28 * creation, by their very nature: they are not meant to be
29 * interacted with input events, but are there just for visual
32 * @ref general_functions_example_page "This" example contemplates
33 * some of these functions.
37 * Get the whether an Elementary object has the focus or not.
39 * @param obj The Elementary object to get the information from
40 * @return @c EINA_TRUE, if the object is focused, @c EINA_FALSE if
41 * not (and on errors).
43 * @see elm_object_focus_set()
47 EAPI Eina_Bool elm_object_focus_get(const Evas_Object *obj);
50 * Set/unset focus to a given Elementary object.
52 * @param obj The Elementary object to operate on.
53 * @param focus @c EINA_TRUE Set focus to a given object,
54 * @c EINA_FALSE Unset focus to a given object.
56 * @note When you set focus to this object, if it can handle focus, will
57 * take the focus away from the one who had it previously and will, for
58 * now on, be the one receiving input events. Unsetting focus will remove
59 * the focus from @p obj, passing it back to the previous element in the
62 * @see elm_object_focus_get(), elm_object_focus_custom_chain_get()
66 EAPI void elm_object_focus_set(Evas_Object *obj, Eina_Bool focus);
69 * Set the ability for an Elementary object to be focused
71 * @param obj The Elementary object to operate on
72 * @param enable @c EINA_TRUE if the object can be focused, @c
73 * EINA_FALSE if not (and on errors)
75 * This sets whether the object @p obj is able to take focus or
76 * not. Unfocusable objects do nothing when programmatically
77 * focused, being the nearest focusable parent object the one
78 * really getting focus. Also, when they receive mouse input, they
79 * will get the event, but not take away the focus from where it
84 EAPI void elm_object_focus_allow_set(Evas_Object *obj, Eina_Bool enable);
87 * Get whether an Elementary object is focusable or not
89 * @param obj The Elementary object to operate on
90 * @return @c EINA_TRUE if the object is allowed to be focused, @c
91 * EINA_FALSE if not (and on errors)
93 * @note Objects which are meant to be interacted with by input
94 * events are created able to be focused, by default. All the
99 EAPI Eina_Bool elm_object_focus_allow_get(const Evas_Object *obj);
102 * Set custom focus chain.
104 * This function overwrites any previous custom focus chain within
105 * the list of objects. The previous list will be deleted and this list
106 * will be managed by elementary. After it is set, don't modify it.
108 * @note On focus cycle, only will be evaluated children of this container.
110 * @param obj The container object
111 * @param objs Chain of objects to pass focus
114 EAPI void elm_object_focus_custom_chain_set(Evas_Object *obj, Eina_List *objs);
117 * Unset a custom focus chain on a given Elementary widget
119 * @param obj The container object to remove focus chain from
121 * Any focus chain previously set on @p obj (for its child objects)
122 * is removed entirely after this call.
126 EAPI void elm_object_focus_custom_chain_unset(Evas_Object *obj);
129 * Get custom focus chain
131 * @param obj The container object
134 EAPI const Eina_List *elm_object_focus_custom_chain_get(const Evas_Object *obj);
137 * Append object to custom focus chain.
139 * @note If relative_child equal to NULL or not in custom chain, the object
140 * will be added in end.
142 * @note On focus cycle, only will be evaluated children of this container.
144 * @param obj The container object
145 * @param child The child to be added in custom chain
146 * @param relative_child The relative object to position the child
149 EAPI void elm_object_focus_custom_chain_append(Evas_Object *obj, Evas_Object *child, Evas_Object *relative_child);
152 * Prepend object to custom focus chain.
154 * @note If relative_child equal to NULL or not in custom chain, the object
155 * will be added in begin.
157 * @note On focus cycle, only will be evaluated children of this container.
159 * @param obj The container object
160 * @param child The child to be added in custom chain
161 * @param relative_child The relative object to position the child
164 EAPI void elm_object_focus_custom_chain_prepend(Evas_Object *obj, Evas_Object *child, Evas_Object *relative_child);
167 * Give focus to next object in object tree.
169 * Give focus to next object in focus chain of one object sub-tree.
170 * If the last object of chain already have focus, the focus will go to the
171 * first object of chain.
173 * @param obj The object root of sub-tree
174 * @param dir Direction to move the focus
178 EAPI void elm_object_focus_next(Evas_Object *obj, Elm_Focus_Direction dir);
181 * Make the elementary object and its children to be focusable
184 * @param obj The Elementary object to operate on
185 * @param focusable @c EINA_TRUE for focusable,
186 * @c EINA_FALSE for unfocusable.
188 * This sets whether the object @p obj and its children objects
189 * are able to take focus or not. If the tree is set as unfocusable,
190 * newest focused object which is not in this tree will get focus.
191 * This API can be helpful for an object to be deleted.
192 * When an object will be deleted soon, it and its children may not
193 * want to get focus (by focus reverting or by other focus controls).
194 * Then, just use this API before deleting.
196 * @see elm_object_tree_focus_allow_get()
201 EAPI void elm_object_tree_focus_allow_set(Evas_Object *obj, Eina_Bool focusable);
204 * Get whether an Elementary object and its children are focusable or not.
206 * @param obj The Elementary object to get the information from
207 * @return @c EINA_TRUE, if the tree is focusable,
208 * @c EINA_FALSE if not (and on errors).
210 * @see elm_object_tree_focus_allow_set()
214 EAPI Eina_Bool elm_object_tree_focus_allow_get(const Evas_Object *obj);