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 whether an Elementary object has the focus or not.
38 * @param obj The Elementary object to get the information from
39 * @return @c EINA_TRUE, if the object is focused, @c EINA_FALSE if
40 * not (and on errors).
42 * @see elm_object_focus_set()
46 EAPI Eina_Bool elm_object_focus_get(const Evas_Object *obj);
49 * Set/unset focus to a given Elementary object.
51 * @param obj The Elementary object to operate on.
52 * @param focus @c EINA_TRUE Set focus to a given object,
53 * @c EINA_FALSE Unset focus to a given object.
55 * @note When you set focus to this object, if it can handle focus, will
56 * take the focus away from the one who had it previously and will, for
57 * now on, be the one receiving input events. Unsetting focus will remove
58 * the focus from @p obj, passing it back to the previous element in the
61 * @see elm_object_focus_get(), elm_object_focus_custom_chain_get()
65 EAPI void elm_object_focus_set(Evas_Object *obj, Eina_Bool focus);
68 * Set the ability for an Elementary object to be focused
70 * @param obj The Elementary object to operate on
71 * @param enable @c EINA_TRUE if the object can be focused, @c
72 * EINA_FALSE if not (and on errors)
74 * This sets whether the object @p obj is able to take focus or
75 * not. Unfocusable objects do nothing when programmatically
76 * focused, being the nearest focusable parent object the one
77 * really getting focus. Also, when they receive mouse input, they
78 * will get the event, but not take away the focus from where it
83 EAPI void elm_object_focus_allow_set(Evas_Object *obj, Eina_Bool enable);
86 * Get whether an Elementary object is focusable or not
88 * @param obj The Elementary object to operate on
89 * @return @c EINA_TRUE if the object is allowed to be focused, @c
90 * EINA_FALSE if not (and on errors)
92 * @note Objects which are meant to be interacted with by input
93 * events are created able to be focused, by default. All the
98 EAPI Eina_Bool elm_object_focus_allow_get(const Evas_Object *obj);
101 * Set custom focus chain.
103 * This function overwrites any previous custom focus chain within
104 * the list of objects. The previous list will be deleted and this list
105 * will be managed by elementary. After it is set, don't modify it.
107 * @note On focus cycle, only will be evaluated children of this container.
109 * @param obj The container object
110 * @param objs Chain of objects to pass focus
113 EAPI void elm_object_focus_custom_chain_set(Evas_Object *obj, Eina_List *objs);
116 * Unset a custom focus chain on a given Elementary widget
118 * @param obj The container object to remove focus chain from
120 * Any focus chain previously set on @p obj (for its child objects)
121 * is removed entirely after this call.
125 EAPI void elm_object_focus_custom_chain_unset(Evas_Object *obj);
128 * Get custom focus chain
130 * @param obj The container object
133 EAPI const Eina_List *elm_object_focus_custom_chain_get(const Evas_Object *obj);
136 * Append object to custom focus chain.
138 * @note If relative_child equal to NULL or not in custom chain, the object
139 * will be added in end.
141 * @note On focus cycle, only will be evaluated children of this container.
143 * @param obj The container object
144 * @param child The child to be added in custom chain
145 * @param relative_child The relative object to position the child
148 EAPI void elm_object_focus_custom_chain_append(Evas_Object *obj, Evas_Object *child, Evas_Object *relative_child);
151 * Prepend object to custom focus chain.
153 * @note If relative_child equal to NULL or not in custom chain, the object
154 * will be added in begin.
156 * @note On focus cycle, only will be evaluated children of this container.
158 * @param obj The container object
159 * @param child The child to be added in custom chain
160 * @param relative_child The relative object to position the child
163 EAPI void elm_object_focus_custom_chain_prepend(Evas_Object *obj, Evas_Object *child, Evas_Object *relative_child);
166 * Give focus to next object in object tree.
168 * Give focus to next object in focus chain of one object sub-tree.
169 * If the last object of chain already have focus, the focus will go to the
170 * first object of chain.
172 * @param obj The object root of sub-tree
173 * @param dir Direction to move the focus
177 EAPI void elm_object_focus_next(Evas_Object *obj, Elm_Focus_Direction dir);
180 * Make the elementary object and its children to be focusable
183 * @param obj The Elementary object to operate on
184 * @param focusable @c EINA_TRUE for focusable,
185 * @c EINA_FALSE for unfocusable.
187 * This sets whether the object @p obj and its children objects
188 * are able to take focus or not. If the tree is set as unfocusable,
189 * newest focused object which is not in this tree will get focus.
190 * This API can be helpful for an object to be deleted.
191 * When an object will be deleted soon, it and its children may not
192 * want to get focus (by focus reverting or by other focus controls).
193 * Then, just use this API before deleting.
195 * @see elm_object_tree_focus_allow_get()
200 EAPI void elm_object_tree_focus_allow_set(Evas_Object *obj, Eina_Bool focusable);
203 * Get whether an Elementary object and its children are focusable or not.
205 * @param obj The Elementary object to get the information from
206 * @return @c EINA_TRUE, if the tree is focusable,
207 * @c EINA_FALSE if not (and on errors).
209 * @see elm_object_tree_focus_allow_set()
213 EAPI Eina_Bool elm_object_tree_focus_allow_get(const Evas_Object *obj);