summaryrefslogtreecommitdiff
path: root/legacy/elementary/src/lib/elm_interface_atspi_accessible.c
diff options
context:
space:
mode:
authorLukasz Stanislawski <l.stanislaws@samsung.com>2014-04-21 12:46:11 +0900
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>2014-04-21 12:46:12 +0900
commitc3b541bcda817cf936bae2f6424a5f6e872d6d48 (patch)
tree9a71a9a21686dcae8d6fb63651bd82869ae8b818 /legacy/elementary/src/lib/elm_interface_atspi_accessible.c
parent0312fd5b3d96dde990b37197e4bfa28bf648d8a3 (diff)
atspi: refactor atspi_object class into mixins.
Summary: Allow to create ATSPI aware objects only by attaching Atspi interface to Eo object. Apply protected rule to all methods, properties which should not be available to app developer. Remove public atspi header from Elementary.h. Make Elm_Widget inherit from Atspi interfaces, Elm_Win inherits additional Atspi_Window interface. Unified file names - all atspi related objects/interfaces can be found under elm_atspi_* and elm_interface_atspi_*. Test Plan: build&install, out-off tree example compilation with gcc and g++, Orca screen reader tests on Ubuntu 12.04. Reviewers: raster, seoz, tasn, JackDanielZ Differential Revision: https://phab.enlightenment.org/D718
Diffstat (limited to '')
-rw-r--r--legacy/elementary/src/lib/elm_interface_atspi_accessible.c267
1 files changed, 267 insertions, 0 deletions
diff --git a/legacy/elementary/src/lib/elm_interface_atspi_accessible.c b/legacy/elementary/src/lib/elm_interface_atspi_accessible.c
new file mode 100644
index 0000000000..1670b4ca55
--- /dev/null
+++ b/legacy/elementary/src/lib/elm_interface_atspi_accessible.c
@@ -0,0 +1,267 @@
1#ifdef HAVE_CONFIG_H
2 #include "elementary_config.h"
3#endif
4
5#include <Elementary.h>
6#include "elm_widget.h"
7#include "elm_priv.h"
8
9#define ELM_INTERFACE_ATSPI_ACCESSIBLE_PROTECTED
10
11#include "elm_interface_atspi_accessible.h"
12#include "elm_interface_atspi_accessible.eo.h"
13
14
15const char* Atspi_Name[] = {
16 "invalid",
17 "accelerator label",
18 "alert",
19 "animation",
20 "arrow",
21 "calendar",
22 "canvas",
23 "check box",
24 "check menu item",
25 "color chooser",
26 "column header",
27 "combo box",
28 "dateeditor",
29 "desktop icon",
30 "desktop frame",
31 "dial",
32 "dialog",
33 "directory pane",
34 "drawing area",
35 "file chooser",
36 "filler",
37 "focus traversable",
38 "font chooser",
39 "frame",
40 "glass pane",
41 "html container",
42 "icon",
43 "image",
44 "internal frame",
45 "label",
46 "layered pane",
47 "list",
48 "list item",
49 "menu",
50 "menu bar",
51 "menu item",
52 "option pane",
53 "page tab",
54 "page tab list",
55 "panel",
56 "password text",
57 "popup menu",
58 "progress bar",
59 "push button",
60 "radio button",
61 "radio menu item",
62 "root pane",
63 "row header",
64 "scroll bar",
65 "scroll pane",
66 "separator",
67 "slider",
68 "spin button",
69 "split pane",
70 "status bar",
71 "table",
72 "table cell",
73 "table column header",
74 "table row header",
75 "tearoff menu item",
76 "terminal",
77 "text",
78 "toggle button",
79 "tool bar",
80 "tool tip",
81 "tree",
82 "tree table",
83 "unknown",
84 "viewport",
85 "window",
86 "extended",
87 "header",
88 "footer",
89 "paragraph",
90 "ruler",
91 "application",
92 "autocomplete",
93 "editbar",
94 "embedded",
95 "entry",
96 "chart",
97 "caption",
98 "document frame",
99 "heading",
100 "page",
101 "section",
102 "redundant object",
103 "form",
104 "link",
105 "input method window",
106 "table row",
107 "tree item",
108 "document spreadsheet",
109 "document presentation",
110 "document text",
111 "document web",
112 "document email",
113 "comment",
114 "list box",
115 "grouping",
116 "image map",
117 "notification",
118 "info bar",
119 "last defined"
120};
121
122
123EOLIAN static int
124_elm_interface_atspi_accessible_index_in_parent_get(Eo *obj, void *pd EINA_UNUSED)
125{
126 Eina_List *l, *children = NULL;
127 Eo *chld, *parent = NULL;
128 int ret = 0;
129
130 eo_do(obj, parent = elm_interface_atspi_accessible_parent_get());
131 if (!parent) return -1;
132
133 eo_do(parent, children = elm_interface_atspi_accessible_children_get());
134 if (!children) return -1;
135
136 EINA_LIST_FOREACH(children, l, chld)
137 {
138 if (obj == chld)
139 break;
140 ret++;
141 }
142 if (ret == (int)eina_list_count(children))
143 {
144 ERR("Object %s not present in its AT-SPI parents (%s) children list! This should never happen.", eo_class_name_get(eo_class_get(obj)), eo_class_name_get(eo_class_get(parent)));
145 return -1;
146 }
147 return ret;
148}
149
150EOLIAN static Eo *
151_elm_interface_atspi_accessible_parent_get(Eo *obj EINA_UNUSED, void *pd EINA_UNUSED)
152{
153 Eo *parent = NULL;
154
155 /* By default using Eo_Base object hierarchy */
156 eo_do(obj, parent = eo_parent_get());
157 if (!parent) return NULL;
158
159 return eo_isa(parent, ELM_INTERFACE_ATSPI_ACCESSIBLE_CLASS) ? parent : NULL;
160}
161
162EOLIAN static void
163_elm_interface_atspi_accessible_parent_set(Eo *obj, void *priv EINA_UNUSED, Eo *new_parent EINA_UNUSED)
164{
165 WRN("The %s object does not implement the \"accessible_parent_set\" function.",
166 eo_class_name_get(eo_class_get(obj)));
167}
168
169EOLIAN void
170_elm_interface_atspi_accessible_attributes_get(Eo *obj EINA_UNUSED, void *pd EINA_UNUSED)
171{
172 WRN("The %s object does not implement the \"accessible_attributes_set\" function.",
173 eo_class_name_get(eo_class_get(obj)));
174}
175
176EOLIAN static Elm_Atspi_Role
177_elm_interface_atspi_accessible_role_get(Eo *obj EINA_UNUSED, void *pd EINA_UNUSED)
178{
179 return ELM_ATSPI_ROLE_UNKNOWN;
180}
181
182EOLIAN static void
183_elm_interface_atspi_accessible_role_set(Eo *obj EINA_UNUSED, void *pd EINA_UNUSED, Elm_Atspi_Role role EINA_UNUSED)
184{
185 WRN("The %s object does not implement the \"accessible_role_set\" function.",
186 eo_class_name_get(eo_class_get(obj)));
187}
188
189EOLIAN const char *
190_elm_interface_atspi_accessible_role_name_get(Eo *obj EINA_UNUSED, void *pd EINA_UNUSED)
191{
192 Elm_Atspi_Role role;
193
194 eo_do(obj, role = elm_interface_atspi_accessible_role_get());
195
196 return role > ELM_ATSPI_ROLE_LAST_DEFINED ? "" : Atspi_Name[role];
197}
198
199EOLIAN const char *
200_elm_interface_atspi_accessible_name_get(Eo *obj EINA_UNUSED, void *pd EINA_UNUSED)
201{
202 WRN("The %s object does not implement the \"accessible_name_get\" function.",
203 eo_class_name_get(eo_class_get(obj)));
204 return NULL;
205}
206
207EOLIAN static void
208_elm_interface_atspi_accessible_name_set(Eo *obj, void *pd EINA_UNUSED, const char *val EINA_UNUSED)
209{
210 WRN("The %s object does not implement the \"accessible_name_set\" function.",
211 eo_class_name_get(eo_class_get(obj)));
212}
213
214const char * _elm_interface_atspi_accessible_description_get(Eo *obj EINA_UNUSED, void *pd EINA_UNUSED)
215{
216 WRN("The %s object does not implement the \"accessible_description_get\" function.",
217 eo_class_name_get(eo_class_get(obj)));
218 return NULL;
219}
220
221EOLIAN static void
222_elm_interface_atspi_accessible_description_set(Eo *obj, void *pd EINA_UNUSED, const char *val EINA_UNUSED)
223{
224 WRN("The %s object does not implement the \"accessible_description_set\" function.",
225 eo_class_name_get(eo_class_get(obj)));
226}
227
228EOLIAN static const char *
229_elm_interface_atspi_accessible_localized_role_name_get(Eo *obj EINA_UNUSED, void *pd EINA_UNUSED)
230{
231 const char *ret = NULL;
232 eo_do(obj, ret = elm_interface_atspi_accessible_role_name_get());
233#ifdef ENABLE_NLS
234 ret = gettext(ret);
235#endif
236 return ret;
237}
238
239EOLIAN static Eina_List *
240_elm_interface_atspi_accessible_children_get(Eo *obj EINA_UNUSED, void *pd EINA_UNUSED)
241{
242 Eina_List *children = NULL;
243 Eina_Iterator *iter = NULL;
244 Eo *chld;
245
246 // By default use Eo_Base object hierarchy
247 eo_do(obj, iter = eo_children_iterator_new());
248 if (!iter) return NULL;
249
250 EINA_ITERATOR_FOREACH(iter, chld)
251 {
252 if (eo_isa(chld, ELM_INTERFACE_ATSPI_ACCESSIBLE_CLASS))
253 children = eina_list_append(children, chld);
254 }
255 eina_iterator_free(iter);
256
257 return children;
258}
259
260EOLIAN static Elm_Atspi_State_Set
261_elm_interface_atspi_accessible_state_set_get(Eo *obj EINA_UNUSED, void *pd EINA_UNUSED)
262{
263 Elm_Atspi_State_Set ret = 0;
264 return ret;
265}
266
267#include "elm_interface_atspi_accessible.eo.c"