1 /**
2  * @defgroup Access Access
3  * @ingroup Elementary
4  *
5  * WARNING! this API is not finalized. It is unstable. - do not use it if
6  * you want no breaks in future.
7  *
8  * TODO: description
9  *
10  */
11 
12 enum _Elm_Access_Info_Type
13 {
14    ELM_ACCESS_INFO_FIRST = -1,
15    ELM_ACCESS_INFO,         /* next read is info - this is
16                              * normally label */
17    ELM_ACCESS_TYPE,         /* when reading out widget or item
18                              * this is read first */
19    ELM_ACCESS_STATE,        /* if there is a state (eg checkbox)
20                              * then read state out */
21    ELM_ACCESS_CONTEXT_INFO, /* to give contextual information */
22    ELM_ACCESS_INFO_LAST
23 };
24 
25 /**
26  * @since 1.8
27  * @typedef Elm_Access_Info_Type
28  */
29 typedef enum _Elm_Access_Info_Type Elm_Access_Info_Type;
30 
31 /**
32  * @enum _Elm_Access_Action_Type
33  * Enum of supported access action types.
34  */
35 enum _Elm_Access_Action_Type
36 {
37    ELM_ACCESS_ACTION_FIRST = -1,
38 
39    ELM_ACCESS_ACTION_HIGHLIGHT, /* highlight an object */
40    ELM_ACCESS_ACTION_UNHIGHLIGHT, /* unhighlight an object */
41    ELM_ACCESS_ACTION_HIGHLIGHT_NEXT, /* set highlight to next object */
42    ELM_ACCESS_ACTION_HIGHLIGHT_PREV, /* set highlight to previous object */
43    ELM_ACCESS_ACTION_ACTIVATE, /* activate a highlight object */
44    ELM_ACCESS_ACTION_SCROLL, /* scroll if one of highlight object parents
45                               * is scrollable */
46    ELM_ACCESS_ACTION_UP, /* change value up of highlight object */
47    ELM_ACCESS_ACTION_DOWN, /* change value down of highlight object */
48    ELM_ACCESS_ACTION_BACK, /* go back to a previous view
49                               ex: pop naviframe item */
50    ELM_ACCESS_ACTION_READ, /* highlight an object */
51 
52    ELM_ACCESS_ACTION_LAST
53 };
54 
55 /**
56  * @since 1.8
57  * @typedef Elm_Access_Action_Type
58  */
59 typedef enum _Elm_Access_Action_Type Elm_Access_Action_Type;
60 
61 struct _Elm_Access_Action_Info
62 {
63    Evas_Coord   x;
64    Evas_Coord   y;
65    unsigned int mouse_type; /* 0: mouse down
66                                1: mouse move
67                                2: mouse up   */
68 
69    Elm_Access_Action_Type action_type;
70    Elm_Access_Action_Type action_by;
71    Eina_Bool              highlight_cycle : 1;
72 };
73 
74 /**
75  * @since 1.8
76  * @typedef Elm_Access_Action_Info
77  */
78 typedef struct _Elm_Access_Action_Info Elm_Access_Action_Info;
79 
80 enum _Elm_Highlight_Direction
81 {
82    ELM_HIGHLIGHT_DIR_FIRST = -1,
83    ELM_HIGHLIGHT_DIR_NEXT,
84    ELM_HIGHLIGHT_DIR_PREVIOUS
85 };
86 
87 /**
88  * @since 1.8
89  * @typedef Elm_Highlight_Direction
90  */
91 typedef enum _Elm_Highlight_Direction Elm_Highlight_Direction;
92 
93 /**
94  * @since 1.8
95  * @typedef Elm_Access_Action_Cb
96  *
97  * User callback to make access object do specific action
98  *
99  * @param data user data
100  * @param action_info information to classify the action
101  * Returns @c EINA_TRUE on success, @c EINA FALSE otherwise
102  *
103  */
104 typedef Eina_Bool (*Elm_Access_Action_Cb)(void *data, Evas_Object *obj, Elm_Access_Action_Info *action_info);
105 
106 typedef char *(*Elm_Access_Info_Cb)(void *data, Evas_Object *obj);
107 typedef void (*Elm_Access_Activate_Cb)(void *data, Evas_Object *part_obj, Elm_Object_Item *item);
108 
109 
110 /**
111  * @brief Register evas object as an accessible object.
112  * @since 1.8
113  *
114  * @param obj The evas object to register as an accessible object.
115  * @param parent The elementary object which is used for creating
116  * accessible object.
117  *
118  * @ingroup Access
119  */
120 EAPI Evas_Object *elm_access_object_register(Evas_Object *obj, Evas_Object *parent);
121 
122 /**
123  * @brief Unregister accessible object.
124  * @since 1.8
125  *
126  * @param obj The Evas object to unregister accessible object.
127  *
128  * @ingroup Access
129  */
130 EAPI void elm_access_object_unregister(Evas_Object *obj);
131 
132 /**
133  * @brief Get an accessible object of the evas object.
134  * @since 1.8
135  *
136  * @param obj The evas object.
137  * @return Accessible object of the evas object or NULL for any error
138  *
139  * @ingroup Access
140  */
141 EAPI Evas_Object *elm_access_object_get(const Evas_Object *obj);
142 
143 /**
144  * @brief Set text to give information for specific type.
145  * @since 1.8
146  *
147  * @param obj Accessible object.
148  * @param type The type of content that will be read
149  * @param text The text information that will be read
150  *
151  * @see elm_access_info_cb_set
152  * @ingroup Access
153  */
154 EAPI void elm_access_info_set(Evas_Object *obj, int type, const char *text);
155 
156 /**
157  * @brief Set text to give information for specific type.
158  * @since 1.8
159  *
160  * @param obj Accessible object.
161  * @param type The type of content that will be read
162  *
163  * @see elm_access_info_cb_set
164  * @ingroup Access
165  */
166 EAPI char *elm_access_info_get(const Evas_Object *obj, int type);
167 
168 /**
169  * @brief Set content callback to give information for specific type.
170  * @since 1.8
171  *
172  * @param obj Accessible object.
173  * @param type The type of content that will be read
174  * @param func The function to be called when the content is read
175  * @param data The data pointer to be passed to @p func
176  *
177  * The type would be one of ELM_ACCESS_TYPE, ELM_ACCESS_INFO,
178  * ELM_ACCESS_STATE, ELM_ACCESS_CONTEXT_INFO.
179  *
180  * In the case of button widget, the content of ELM_ACCESS_TYPE would be
181  * "button". The label of button such as "ok", "cancel" is for ELM_ACCESS_INFO.
182  * If the button is disabled, content of ELM_ACCESS_STATE would be "disabled".
183  * And if there is contextual information, use ELM_ACCESS_CONTEXT_INFO.
184  *
185  * @ingroup Access
186  */
187 EAPI void elm_access_info_cb_set(Evas_Object *obj, int type, Elm_Access_Info_Cb func, const void *data);
188 
189 /**
190  * @brief Set activate callback to activate highlight object.
191  * @since 1.8
192  *
193  * @param obj Accessible object.
194  * @param func The function to be called when the activate gesture is detected
195  * @param data The data pointer to be passed to @p func
196  *
197  * @ingroup Access
198  */
199 EAPI void elm_access_activate_cb_set(Evas_Object *obj, Elm_Access_Activate_Cb func, void *data);
200 
201 /**
202  * @brief Read out text information directly.
203  * @since 1.8
204  *
205  * @param text The text information that will be read
206  *
207  * This function will not free the @p text internally.
208  *
209  * @ingroup Access
210  */
211 EAPI void elm_access_say(const char *text);
212 
213 /**
214  * @brief Give the highlight to the object directly.
215  * @since 1.8
216  *
217  * @param obj The object that will have the highlight and its information be read.
218  *
219  * The object should be an elementary object or an access object.
220  *
221  * @see elm_access_object_get
222  * @ingroup Access
223  */
224 EAPI void elm_access_highlight_set(Evas_Object* obj);
225 
226 /**
227  * @brief Do the accessibility action base on given object.
228  * @since 1.8
229  *
230  * @param obj The object that could be an any object. it would be useful to use a container widget.
231  * @param type The type of accessibility action.
232  * @param action_info The action information of action @p type to give more specific information.
233  *
234  * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise
235  *
236  * The return value would be useful, when the @p type is ELM_ACCESS_ACTION_HIGHLIGHT_NEXT
237  * or ELM_ACCESS_ACTION_HIGHLIGHT_PREV. If there is no way to give a highlight,
238  * @c EINA_FALSE will be returned.
239  *
240  * @ingroup Access
241  */
242 EAPI Eina_Bool elm_access_action(Evas_Object *obj, const Elm_Access_Action_Type type, Elm_Access_Action_Info *action_info);
243 
244 /**
245  * @brief Set a callback function to a given accessibility action type
246  * @since 1.8
247  *
248  * @param obj The object to attach a callback to
249  * @param type The type of accessibility action.
250  * @param cb The callback function to be called when the accessibility action is triggered.
251  * @param data The data pointer to be passed to @p cb
252  *
253  * @ingroup Access
254  */
255 EAPI void elm_access_action_cb_set(Evas_Object *obj, const Elm_Access_Action_Type type, const Elm_Access_Action_Cb cb, const void *data);
256 
257 /**
258  * @brief Set the next access object for highlight.
259  * @since 1.8
260  *
261  * @param obj  The object is previous access object of next for highlight.
262  * @param dir  Access direction same as Focus direction
263  * @param next The object is next access object of obj for highlight.
264  *
265  * Currently focus chain is used for access highlight chain. Use this API to
266  * customize highlight chain. If highlight chain is already established, you can
267  * change one object's highlight chain and do not break the other object's
268  * highlight chain.
269  *
270  * @ingroup Access
271  */
272 EAPI void
273 elm_access_highlight_next_set(Evas_Object *obj, Elm_Highlight_Direction dir, Evas_Object *next);
274