1 /*******************************************************************************
2  * Copyright (c) 2000, 2018 IBM Corporation and others. All rights reserved.
3  * The contents of this file are made available under the terms
4  * of the GNU Lesser General Public License (LGPL) Version 2.1 that
5  * accompanies this distribution (lgpl-v21.txt).  The LGPL is also
6  * available at http://www.gnu.org/licenses/lgpl.html.  If the version
7  * of the LGPL at http://www.gnu.org is different to the version of
8  * the LGPL accompanying this distribution and there is any conflict
9  * between the two license versions, the terms of the LGPL accompanying
10  * this distribution shall govern.
11  *
12  * Contributors:
13  *     IBM Corporation - initial API and implementation
14  *******************************************************************************/
15 package org.eclipse.swt.internal.accessibility.gtk;
16 
17 
18 import org.eclipse.swt.internal.*;
19 import org.eclipse.swt.internal.gtk.*;
20 
21 public class ATK extends OS {
22 	static {
23 		Library.loadLibrary("swt-atk");
24 	}
25 
26 	/** Constants */
27 	public static final int ATK_RELATION_NULL = 0;
28 	public static final int ATK_RELATION_CONTROLLED_BY = 1;
29 	public static final int ATK_RELATION_CONTROLLER_FOR = 2;
30 	public static final int ATK_RELATION_LABEL_FOR = 3;
31 	public static final int ATK_RELATION_LABELLED_BY = 4;
32 	public static final int ATK_RELATION_MEMBER_OF = 5;
33 	public static final int ATK_RELATION_NODE_CHILD_OF = 6;
34 	public static final int ATK_RELATION_FLOWS_TO = 7;
35 	public static final int ATK_RELATION_FLOWS_FROM = 8;
36 	public static final int ATK_RELATION_SUBWINDOW_OF = 9;
37 	public static final int ATK_RELATION_EMBEDS = 10;
38 	public static final int ATK_RELATION_EMBEDDED_BY = 11;
39 	public static final int ATK_RELATION_POPUP_FOR = 12;
40 	public static final int ATK_RELATION_PARENT_WINDOW_OF = 13;
41 	public static final int ATK_RELATION_DESCRIBED_BY = 14;
42 	public static final int ATK_RELATION_DESCRIPTION_FOR = 15;
43 	public static final int ATK_ROLE_ALERT = 2;
44 	public static final int ATK_ROLE_ANIMATION = 3;
45 	public static final int ATK_ROLE_CALENDAR = 4;
46 	public static final int ATK_ROLE_CANVAS = 6;
47 	public static final int ATK_ROLE_CHECK_BOX = 7;
48 	public static final int ATK_ROLE_CHECK_MENU_ITEM = 8;
49 	public static final int ATK_ROLE_COMBO_BOX = 11;
50 	public static final int ATK_ROLE_DATE_EDITOR = 12;
51 	public static final int ATK_ROLE_DIALOG = 16;
52 	public static final int ATK_ROLE_DRAWING_AREA = 18;
53 	public static final int ATK_ROLE_WINDOW = 68;
54 	public static final int ATK_ROLE_LABEL = 28;
55 	public static final int ATK_ROLE_LIST = 30;
56 	public static final int ATK_ROLE_LIST_ITEM = 31;
57 	public static final int ATK_ROLE_MENU = 32;
58 	public static final int ATK_ROLE_MENU_BAR = 33;
59 	public static final int ATK_ROLE_MENU_ITEM = 34;
60 	public static final int ATK_ROLE_PAGE_TAB = 36;
61 	public static final int ATK_ROLE_PAGE_TAB_LIST = 37;
62 	public static final int ATK_ROLE_PANEL = 38;
63 	public static final int ATK_ROLE_PROGRESS_BAR = 41;
64 	public static final int ATK_ROLE_PUSH_BUTTON = 42;
65 	public static final int ATK_ROLE_RADIO_BUTTON = 43;
66 	public static final int ATK_ROLE_RADIO_MENU_ITEM = 44;
67 	public static final int ATK_ROLE_SCROLL_BAR = 47;
68 	public static final int ATK_ROLE_SEPARATOR = 49;
69 	public static final int ATK_ROLE_SLIDER = 50;
70 	public static final int ATK_ROLE_SPIN_BUTTON = 52;
71 	public static final int ATK_ROLE_STATUSBAR = 53;
72 	public static final int ATK_ROLE_TABLE = 54;
73 	public static final int ATK_ROLE_TABLE_CELL = 55;
74 	public static final int ATK_ROLE_TABLE_COLUMN_HEADER = 56;
75 	public static final int ATK_ROLE_TABLE_ROW_HEADER = 57;
76 	public static final int ATK_ROLE_TEXT = 60;
77 	public static final int ATK_ROLE_TOOL_BAR = 62;
78 	public static final int ATK_ROLE_TOOL_TIP = 63;
79 	public static final int ATK_ROLE_TREE = 64;
80 	public static final int ATK_ROLE_HEADER = 69;
81 	public static final int ATK_ROLE_FOOTER = 70;
82 	public static final int ATK_ROLE_PARAGRAPH = 71;
83 	public static final int ATK_ROLE_FORM = 85;
84 	public static final int ATK_ROLE_HEADING = 81;
85 	public static final int ATK_ROLE_DOCUMENT_FRAME = 80;
86 	public static final int ATK_ROLE_TABLE_ROW = 88; //since atk 2.1.0
87 	public static final int ATK_ROLE_IMAGE = 26;
88 	public static final int ATK_ROLE_PAGE = 82;
89 	public static final int ATK_ROLE_SECTION = 83;
90 	public static final int ATK_ROLE_UNKNOWN = 66;
91 	public static final int ATK_STATE_ACTIVE = 1;
92 	public static final int ATK_STATE_ARMED = 2;
93 	public static final int ATK_STATE_BUSY = 3;
94 	public static final int ATK_STATE_CHECKED = 4;
95 	public static final int ATK_STATE_DEFUNCT = 5;
96 	public static final int ATK_STATE_EDITABLE = 6;
97 	public static final int ATK_STATE_ENABLED = 7;
98 	public static final int ATK_STATE_EXPANDED = 9;
99 	public static final int ATK_STATE_FOCUSABLE = 10;
100 	public static final int ATK_STATE_FOCUSED = 11;
101 	public static final int ATK_STATE_MULTI_LINE = 15;
102 	public static final int ATK_STATE_MULTISELECTABLE = 16;
103 	public static final int ATK_STATE_PRESSED = 18;
104 	public static final int ATK_STATE_RESIZABLE = 19;
105 	public static final int ATK_STATE_SELECTABLE = 20;
106 	public static final int ATK_STATE_SELECTED = 21;
107 	public static final int ATK_STATE_SHOWING = 23;
108 	public static final int ATK_STATE_SINGLE_LINE = 24;
109 	public static final int ATK_STATE_TRANSIENT = 26;
110 	public static final int ATK_STATE_REQUIRED = 32;
111 	public static final int ATK_STATE_INVALID_ENTRY = 33;
112 	public static final int ATK_STATE_SUPPORTS_AUTOCOMPLETION = 34;
113 	public static final int ATK_STATE_VISIBLE = 28;
114 	public static final int ATK_TEXT_BOUNDARY_CHAR = 0;
115 	public static final int ATK_TEXT_BOUNDARY_WORD_START = 1;
116 	public static final int ATK_TEXT_BOUNDARY_WORD_END = 2;
117 	public static final int ATK_TEXT_BOUNDARY_SENTENCE_START = 3;
118 	public static final int ATK_TEXT_BOUNDARY_SENTENCE_END = 4;
119 	public static final int ATK_TEXT_BOUNDARY_LINE_START = 5;
120 	public static final int ATK_TEXT_BOUNDARY_LINE_END = 6;
121 	/* TODO_a11y: use the ATK_TEXT_GRANULARITY_* constants once
122 	 * Orca is updated to use the new API.
123 	 */
124 	public static final int ATK_TEXT_GRANULARITY_CHAR = 0;
125 	public static final int ATK_TEXT_GRANULARITY_WORD = 1;
126 	public static final int ATK_TEXT_GRANULARITY_SENTENCE = 2;
127 	public static final int ATK_TEXT_GRANULARITY_LINE = 3;
128 	public static final int ATK_TEXT_GRANULARITY_PARAGRAPH = 4;
129 	public static final int ATK_TEXT_CLIP_NONE = 0;
130 	public static final int ATK_TEXT_CLIP_MIN = 1;
131 	public static final int ATK_TEXT_CLIP_MAX = 2;
132 	public static final int ATK_TEXT_CLIP_BOTH = 3;
133 	public static final int ATK_TEXT_ATTR_LEFT_MARGIN = 1;
134 	public static final int ATK_TEXT_ATTR_RIGHT_MARGIN = 2;
135 	public static final int ATK_TEXT_ATTR_INDENT = 3;
136 	public static final int ATK_TEXT_ATTR_INVISIBLE = 4;
137 	public static final int ATK_TEXT_ATTR_EDITABLE = 5;
138 	public static final int ATK_TEXT_ATTR_PIXELS_ABOVE_LINES = 6;
139 	public static final int ATK_TEXT_ATTR_PIXELS_BELOW_LINES = 7;
140 	public static final int ATK_TEXT_ATTR_PIXELS_INSIDE_WRAP = 8;
141 	public static final int ATK_TEXT_ATTR_BG_FULL_HEIGHT = 9;
142 	public static final int ATK_TEXT_ATTR_RISE = 10;
143 	public static final int ATK_TEXT_ATTR_UNDERLINE = 11;
144 	public static final int ATK_TEXT_ATTR_STRIKETHROUGH = 12;
145 	public static final int ATK_TEXT_ATTR_SIZE = 13;
146 	public static final int ATK_TEXT_ATTR_SCALE = 14;
147 	public static final int ATK_TEXT_ATTR_WEIGHT = 15;
148 	public static final int ATK_TEXT_ATTR_LANGUAGE = 16;
149 	public static final int ATK_TEXT_ATTR_FAMILY_NAME = 17;
150 	public static final int ATK_TEXT_ATTR_BG_COLOR = 18;
151 	public static final int ATK_TEXT_ATTR_FG_COLOR = 19;
152 	public static final int ATK_TEXT_ATTR_BG_STIPPLE = 20;
153 	public static final int ATK_TEXT_ATTR_FG_STIPPLE = 21;
154 	public static final int ATK_TEXT_ATTR_WRAP_MODE = 22;
155 	public static final int ATK__TEXT_ATTR_DIRECTION = 23;
156 	public static final int ATK_TEXT_ATTR_JUSTIFICATION = 24;
157 	public static final int ATK_TEXT_ATTR_STRETCH = 25;
158 	public static final int ATK_TEXT_ATTR_VARIANT = 26;
159 	public static final int ATK_TEXT_ATTR_STYLE = 27;
160 	public static final int ATK_XY_WINDOW = 1;
161 
162 	/** Signals */
163 	public static final byte[] selection_changed = OS.ascii ("selection_changed");
164 	public static final byte[] text_changed_insert = OS.ascii ("text_changed::insert");
165 	public static final byte[] text_changed_delete = OS.ascii ("text_changed::delete");
166 	public static final byte[] text_caret_moved = OS.ascii ("text_caret_moved");
167 	public static final byte[] text_selection_changed = OS.ascii ("text_selection_changed");
168 	public static final byte[] load_complete = OS.ascii ("load-complete");
169 	public static final byte[] load_stopped = OS.ascii ("load-stopped");
170 	public static final byte[] reload = OS.ascii ("reload");
171 	public static final byte[] bounds_changed = OS.ascii ("bounds-changed");
172 	public static final byte[] link_activated = OS.ascii ("link-activated");
173 	public static final byte[] link_selected = OS.ascii ("link-selected");
174 	public static final byte[] attributes_changed = OS.ascii ("attributes-changed");
175 	public static final byte[] text_attributes_changed = OS.ascii ("text-attributes-changed");
176 	public static final byte[] column_deleted = OS.ascii ("column-deleted");
177 	public static final byte[] column_inserted = OS.ascii ("column-inserted");
178 	public static final byte[] row_deleted = OS.ascii ("row-deleted");
179 	public static final byte[] row_inserted = OS.ascii ("row-inserted");
180 	public static final byte[] focus_event = OS.ascii ("focus-event");
181 
182 	/** Properties */
183 	public static final byte[] accessible_name = OS.ascii ("accessible-name");
184 	public static final byte[] accessible_description = OS.ascii ("accessible-description");
185 	public static final byte[] accessible_value = OS.ascii ("accessible-value");
186 	public static final byte[] end_index = OS.ascii ("end-index");
187 	public static final byte[] number_of_anchors = OS.ascii ("number-of-anchors");
188 	public static final byte[] selected_link = OS.ascii ("selected-link");
189 	public static final byte[] start_index = OS.ascii ("start-index");
190 	public static final byte[] accessible_hypertext_nlinks = OS.ascii ("accessible-hypertext-nlinks");
191 	public static final byte[] accessible_table_caption_object = OS.ascii ("accessible-table-caption-object");
192 	public static final byte[] accessible_table_column_description = OS.ascii ("accessible-table-column-description");
193 	public static final byte[] accessible_table_column_header = OS.ascii ("accessible-table-column-header");
194 	public static final byte[] accessible_table_row_description = OS.ascii ("accessible-table-row-description");
195 	public static final byte[] accessible_table_row_header = OS.ascii ("accessible-table-row-header");
196 	public static final byte[] accessible_table_summary = OS.ascii ("accessible-table-summary");
197 
198 /** 64 bit */
AtkAttribute_sizeof()199 public static final native int AtkAttribute_sizeof ();
AtkTextRange_sizeof()200 public static final native int AtkTextRange_sizeof ();
AtkTextRectangle_sizeof()201 public static final native int AtkTextRectangle_sizeof ();
202 
203 /** Natives */
204 
205 /** @method flags=const */
ATK_TYPE_ACTION()206 public static final native long ATK_TYPE_ACTION ();
207 /** @method flags=const */
ATK_TYPE_COMPONENT()208 public static final native long ATK_TYPE_COMPONENT ();
209 /** @method flags=const */
ATK_TYPE_EDITABLE_TEXT()210 public static final native long ATK_TYPE_EDITABLE_TEXT ();
211 /** @method flags=const */
ATK_TYPE_HYPERTEXT()212 public static final native long ATK_TYPE_HYPERTEXT ();
213 /** @method flags=const */
ATK_TYPE_SELECTION()214 public static final native long ATK_TYPE_SELECTION ();
215 /** @method flags=const */
ATK_TYPE_TABLE()216 public static final native long ATK_TYPE_TABLE ();
217 /** @method flags=const */
ATK_TYPE_TEXT()218 public static final native long ATK_TYPE_TEXT ();
219 /** @method flags=const */
ATK_TYPE_VALUE()220 public static final native long ATK_TYPE_VALUE ();
ATK_ACTION_GET_IFACE(long obj)221 public static final native long ATK_ACTION_GET_IFACE(long obj);
ATK_COMPONENT_GET_IFACE(long atkHandle)222 public static final native long ATK_COMPONENT_GET_IFACE(long atkHandle);
ATK_SELECTION_GET_IFACE(long obj)223 public static final native long ATK_SELECTION_GET_IFACE(long obj);
ATK_EDITABLE_TEXT_GET_IFACE(long handle)224 public static final native long ATK_EDITABLE_TEXT_GET_IFACE(long handle);
ATK_HYPERTEXT_GET_IFACE(long handle)225 public static final native long ATK_HYPERTEXT_GET_IFACE(long handle);
ATK_TABLE_GET_IFACE(long handle)226 public static final native long ATK_TABLE_GET_IFACE(long handle);
ATK_TEXT_GET_IFACE(long handle)227 public static final native long ATK_TEXT_GET_IFACE(long handle);
ATK_VALUE_GET_IFACE(long handle)228 public static final native long ATK_VALUE_GET_IFACE(long handle);
229 /** @param accessible cast=(AtkObject *) */
atk_object_notify_state_change(long accessible, int state, boolean value)230 public static final native void atk_object_notify_state_change(long accessible, int state, boolean value);
231 /**
232  * @param object cast=(AtkObject *)
233  * @param relationship cast=(AtkRelationType)
234  * @param target cast=(AtkObject *)
235  */
atk_object_add_relationship(long object, int relationship, long target)236 public static final native boolean atk_object_add_relationship(long object, int relationship, long target);
237 /**
238  * @param object cast=(AtkObject *)
239  * @param relationship cast=(AtkRelationType)
240  * @param target cast=(AtkObject *)
241  */
atk_object_remove_relationship(long object, int relationship, long target)242 public static final native boolean atk_object_remove_relationship(long object, int relationship, long target);
243 /**
244  * @param set cast=(AtkStateSet *)
245  * @param type cast=(AtkStateType)
246  */
atk_state_set_add_state(long set, int type)247 public static final native boolean atk_state_set_add_state(long set, int type);
atk_text_attribute_get_name(int attr)248 public static final native long atk_text_attribute_get_name(int attr);
atk_text_attribute_get_value(int attr, int index)249 public static final native long atk_text_attribute_get_value(int attr, int index);
call(long function, long arg0)250 public static final native long call(long function, long arg0);
call(long function, long arg0, long arg1)251 public static final native long call(long function, long arg0, long arg1);
call(long function, long arg0, long arg1, long arg2)252 public static final native long call(long function, long arg0, long arg1, long arg2);
call(long function, long arg0, long arg1, long arg2, long arg3, long arg4)253 public static final native long call(long function, long arg0, long arg1, long arg2, long arg3, long arg4);
memmove(AtkActionIface dest, long src)254 public static final native void memmove (AtkActionIface dest, long src);
memmove(AtkComponentIface dest, long src)255 public static final native void memmove (AtkComponentIface dest, long src);
memmove(AtkEditableTextIface dest, long src)256 public static final native void memmove (AtkEditableTextIface dest, long src);
memmove(AtkHypertextIface dest, long src)257 public static final native void memmove (AtkHypertextIface dest, long src);
memmove(AtkObjectClass dest, long src)258 public static final native void memmove (AtkObjectClass dest, long src);
memmove(AtkSelectionIface dest, long src)259 public static final native void memmove (AtkSelectionIface dest, long src);
memmove(AtkTableIface dest, long src)260 public static final native void memmove (AtkTableIface dest, long src);
memmove(AtkTextIface dest, long src)261 public static final native void memmove (AtkTextIface dest, long src);
memmove(AtkValueIface dest, long src)262 public static final native void memmove (AtkValueIface dest, long src);
263 /**
264  * @param dest cast=(void *)
265  * @param src cast=(const void *),flags=no_out
266  * @param size cast=(size_t)
267  */
memmove(long dest, AtkTextRectangle src, int size)268 public static final native void memmove (long dest, AtkTextRectangle src, int size);
269 /**
270  * @param dest cast=(void *)
271  * @param src cast=(const void *),flags=no_out
272  * @param size cast=(size_t)
273  */
memmove(AtkTextRectangle dest, long src, int size)274 public static final native void memmove (AtkTextRectangle dest, long src, int size);
275 /**
276  * @param dest cast=(void *)
277  * @param src cast=(const void *),flags=no_out
278  * @param size cast=(size_t)
279  */
memmove(long dest, AtkTextRange src, int size)280 public static final native void memmove (long dest, AtkTextRange src, int size);
281 /**
282  * @param dest cast=(void *)
283  * @param src cast=(const void *),flags=no_out
284  * @param size cast=(size_t)
285  */
memmove(AtkTextRange dest, long src, int size)286 public static final native void memmove (AtkTextRange dest, long src, int size);
287 /**
288  * @param dest cast=(void *)
289  * @param src cast=(const void *),flags=no_out
290  * @param size cast=(size_t)
291  */
memmove(long dest, AtkAttribute src, int size)292 public static final native void memmove (long dest, AtkAttribute src, int size);
293 /**
294  * @param dest cast=(void *)
295  * @param src cast=(const void *),flags=no_out
296  * @param size cast=(size_t)
297  */
memmove(AtkAttribute dest, long src, int size)298 public static final native void memmove (AtkAttribute dest, long src, int size);
299 }
300