1 /*
2 * AT-SPI - Assistive Technology Service Provider Interface
3 * (Gnome Accessibility Project; http://developer.gnome.org/projects/gap)
4 *
5 * Copyright 2001, 2002 Sun Microsystems Inc.,
6 * Copyright 2001, 2002 Ximian, Inc.
7 * Copyright 2010, 2011 Novell, Inc.
8 *
9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public
11 * License as published by the Free Software Foundation; either
12 * version 2.1 of the License, or (at your option) any later version.
13 *
14 * This library is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * Lesser General Public License for more details.
18 *
19 * You should have received a copy of the GNU Lesser General Public
20 * License along with this library; if not, write to the
21 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
22 * Boston, MA 02110-1301, USA.
23 */
24
25 #include <stdlib.h> /* for malloc */
26 #include "atspi-private.h"
27
28 /**
29 * atspi_table_get_caption:
30 * @obj: a pointer to the #AtspiTable implementor on which to operate.
31 *
32 * Gets an accessible representation of the caption for an #AtspiTable.
33 *
34 * Returns: (transfer full): an #AtspiAccessible object that serves as
35 * the table's caption.
36 *
37 **/
38 AtspiAccessible *
atspi_table_get_caption(AtspiTable * obj,GError ** error)39 atspi_table_get_caption (AtspiTable *obj, GError **error)
40 {
41 AtspiAccessible *retval = NULL;
42
43 g_return_val_if_fail (obj != NULL, NULL);
44
45 _atspi_dbus_get_property (obj, atspi_interface_table, "Caption", error, "(so)", &retval);
46 return retval;
47 }
48
49 /**
50 * atspi_table_get_summary:
51 * @obj: a pointer to the #AtspiTable implementor on which to operate.
52 *
53 * Gets an accessible object which summarizes the contents of an #AtspiTable.
54 *
55 * Returns: (transfer full): an #AtspiAccessible object that serves as the
56 * table's summary (often a reduced #AtspiTable).
57 **/
58 AtspiAccessible *
atspi_table_get_summary(AtspiTable * obj,GError ** error)59 atspi_table_get_summary (AtspiTable *obj, GError **error)
60 {
61 AtspiAccessible *retval;
62
63 g_return_val_if_fail (obj != NULL, NULL);
64
65 _atspi_dbus_get_property (obj, atspi_interface_table, "Summary", error, "(so)", &retval);
66
67 return retval;
68 }
69
70 /**
71 * atspi_table_get_n_rows:
72 * @obj: a pointer to the #AtspiTable implementor on which to operate.
73 *
74 * Gets the number of rows in an #AtspiTable,
75 * exclusive of any rows that are programmatically hidden, but inclusive
76 * of rows that may be outside of the current scrolling window or viewport.
77 *
78 * Returns: a #gint indicating the number of rows in the table.
79 **/
80 gint
atspi_table_get_n_rows(AtspiTable * obj,GError ** error)81 atspi_table_get_n_rows (AtspiTable *obj, GError **error)
82 {
83 dbus_int32_t retval = -1;
84
85 g_return_val_if_fail (obj != NULL, -1);
86
87 _atspi_dbus_get_property (obj, atspi_interface_table, "NRows", error, "i", &retval);
88
89 return retval;
90 }
91
92 /**
93 * atspi_table_get_n_columns:
94 * @obj: a pointer to the #AtspiTable implementor on which to operate.
95 *
96 * Gets the number of columns in an #AtspiTable,
97 * exclusive of any columns that are programmatically hidden, but inclusive
98 * of columns that may be outside of the current scrolling window or viewport.
99 *
100 * Returns: a #gint indicating the number of columns in the table.
101 **/
102 gint
atspi_table_get_n_columns(AtspiTable * obj,GError ** error)103 atspi_table_get_n_columns (AtspiTable *obj, GError **error)
104 {
105 dbus_int32_t retval = -1;
106
107 g_return_val_if_fail (obj != NULL, -1);
108
109 _atspi_dbus_get_property (obj, atspi_interface_table, "NColumns", error, "i", &retval);
110
111 return retval;
112 }
113
114 /**
115 * atspi_table_get_accessible_at:
116 * @obj: a pointer to the #AtspiTable implementor on which to operate.
117 * @row: the specified table row, zero-indexed.
118 * @column: the specified table column, zero-indexed.
119 *
120 * Gets the table cell at the specified row and column indices.
121 * To get the accessible object at a particular (x, y) screen
122 * coordinate, use #atspi_component_get_accessible_at_point.
123 *
124 * Returns: (transfer full): an #AtspiAccessible object representing the
125 * specified table cell.
126 **/
127 AtspiAccessible *
atspi_table_get_accessible_at(AtspiTable * obj,gint row,gint column,GError ** error)128 atspi_table_get_accessible_at (AtspiTable *obj,
129 gint row,
130 gint column,
131 GError **error)
132 {
133 dbus_int32_t d_row = row, d_column = column;
134 DBusMessage *reply;
135
136 g_return_val_if_fail (obj != NULL, NULL);
137
138 reply = _atspi_dbus_call_partial (obj, atspi_interface_table, "GetAccessibleAt", error, "ii", d_row, d_column);
139
140 return _atspi_dbus_return_accessible_from_message (reply);
141 }
142
143 /**
144 * atspi_table_get_index_at:
145 * @obj: a pointer to the #AtspiTable implementor on which to operate.
146 * @row: the specified table row, zero-indexed.
147 * @column: the specified table column, zero-indexed.
148 *
149 * Gets the 1-D child index corresponding to the specified 2-D row and
150 * column indices. To get the accessible object at a particular (x, y) screen
151 * coordinate, use #atspi_component_get_accessible_at_point.
152 *
153 * @see #atspi_table_get_row_at_index, #atspi_table_get_column_at_index
154 *
155 * Returns: a #gint which serves as the index of a specified cell in the
156 * table, in a form usable by #atspi_get_child_at_index.
157 **/
158 gint
atspi_table_get_index_at(AtspiTable * obj,gint row,gint column,GError ** error)159 atspi_table_get_index_at (AtspiTable *obj,
160 gint row,
161 gint column,
162 GError **error)
163 {
164 dbus_int32_t d_row = row, d_column = column;
165 dbus_int32_t retval = -1;
166
167 g_return_val_if_fail (obj != NULL, -1);
168
169 _atspi_dbus_call (obj, atspi_interface_table, "GetIndexAt", error, "ii=>i", d_row, d_column, &retval);
170
171 return retval;
172 }
173
174 /**
175 * atspi_table_get_row_at_index:
176 * @obj: a pointer to the #AtspiTable implementor on which to operate.
177 * @index: the specified child index, zero-indexed.
178 *
179 * Gets the table row index occupied by the child at a particular 1-D
180 * child index.
181 *
182 * @see #atspi_table_get_index_at, #atspi_table_get_column_at_index
183 *
184 * Returns: a #gint indicating the first row spanned by the child of a
185 * table, at the specified 1-D (zero-offset) @index.
186 **/
187 gint
atspi_table_get_row_at_index(AtspiTable * obj,gint index,GError ** error)188 atspi_table_get_row_at_index (AtspiTable *obj,
189 gint index,
190 GError **error)
191 {
192 dbus_int32_t d_index = index;
193 dbus_int32_t retval = -1;
194
195 g_return_val_if_fail (obj != NULL, -1);
196
197 _atspi_dbus_call (obj, atspi_interface_table, "GetRowAtIndex", error, "i=>i", d_index, &retval);
198
199 return retval;
200 }
201
202 /**
203 * atspi_table_get_column_at_index:
204 * @obj: a pointer to the #AtspiTable implementor on which to operate.
205 * @index: the specified child index, zero-indexed.
206 *
207 * Gets the table column index occupied by the child at a particular 1-D
208 * child index.
209 *
210 * @see #atspi_table_get_index_at, #atspi_table_get_row_at_index
211 *
212 * Returns: a #gint indicating the first column spanned by the child of a
213 * table, at the specified 1-D (zero-offset) @index.
214 **/
215 gint
atspi_table_get_column_at_index(AtspiTable * obj,gint index,GError ** error)216 atspi_table_get_column_at_index (AtspiTable *obj,
217 gint index,
218 GError **error)
219 {
220 dbus_int32_t d_index = index;
221 dbus_int32_t retval = -1;
222
223 g_return_val_if_fail (obj != NULL, -1);
224
225 _atspi_dbus_call (obj, atspi_interface_table, "GetColumnAtIndex", error, "i=>i", d_index, &retval);
226
227 return retval;
228 }
229
230 /**
231 * atspi_table_get_row_description:
232 * @obj: a pointer to the #AtspiTable implementor on which to operate.
233 * @row: the specified table row, zero-indexed.
234 *
235 * Gets a text description of a particular table row. This differs from
236 * #atspi_table_get_row_header, which returns an #AtspiAccessible.
237 *
238 * Returns: a UTF-8 string describing the specified table row, if available.
239 **/
240 gchar *
atspi_table_get_row_description(AtspiTable * obj,gint row,GError ** error)241 atspi_table_get_row_description (AtspiTable *obj,
242 gint row,
243 GError **error)
244 {
245 dbus_int32_t d_row = row;
246 char *retval = NULL;
247
248 g_return_val_if_fail (obj != NULL, NULL);
249
250 _atspi_dbus_call (obj, atspi_interface_table, "GetRowDescription", error, "i=>s", d_row, &retval);
251
252 return retval;
253 }
254
255 /**
256 * atspi_table_get_column_description:
257 * @obj: a pointer to the #AtspiTable implementor on which to operate.
258 * @column: the specified table column, zero-indexed.
259 *
260 * Gets a text description of a particular table column. This differs from
261 * #atspi_table_get_column_header, which returns an #Accessible.
262 *
263 * Returns: a UTF-8 string describing the specified table column, if available.
264 **/
265 gchar *
atspi_table_get_column_description(AtspiTable * obj,gint column,GError ** error)266 atspi_table_get_column_description (AtspiTable *obj,
267 gint column, GError **error)
268 {
269 dbus_int32_t d_column = column;
270 char *retval = NULL;
271
272 g_return_val_if_fail (obj != NULL, NULL);
273
274 _atspi_dbus_call (obj, atspi_interface_table, "GetColumnDescription", error, "i=>s", d_column, &retval);
275
276 return retval;
277 }
278
279 /**
280 * atspi_table_get_row_extent_at:
281 * @obj: a pointer to the #AtspiTable implementor on which to operate.
282 * @row: the specified table row, zero-indexed.
283 * @column: the specified table column, zero-indexed.
284 *
285 * Gets the number of rows spanned by the table cell at the specific row
286 * and column. (some tables can have cells which span multiple rows
287 * and/or columns).
288 * The returned values are meaningful only if the Table has both
289 * STATE_VISIBLE and STATE_SHOWING.
290 *
291 * Returns: a #gint indicating the number of rows spanned by the specified cell.
292 **/
293 gint
atspi_table_get_row_extent_at(AtspiTable * obj,gint row,gint column,GError ** error)294 atspi_table_get_row_extent_at (AtspiTable *obj,
295 gint row,
296 gint column,
297 GError **error)
298 {
299 dbus_int32_t d_row = row, d_column = column;
300 dbus_int32_t retval = -1;
301
302 g_return_val_if_fail (obj != NULL, -1);
303
304 _atspi_dbus_call (obj, atspi_interface_table, "GetRowExtentAt", error, "ii=>i", d_row, d_column, &retval);
305
306 return retval;
307 }
308
309 /**
310 * atspi_table_get_column_extent_at:
311 * @obj: a pointer to the #AtspiTable implementor on which to operate.
312 * @row: the specified table row, zero-indexed.
313 * @column: the specified table column, zero-indexed.
314 *
315 * Gets the number of columns spanned by the table cell at the specific
316 * row and column (some tables can have cells which span multiple
317 * rows and/or columns).
318 * The returned values are meaningful only if the Table has both
319 * STATE_VISIBLE and STATE_SHOWING.
320 *
321 * Returns: a #gint indicating the number of columns spanned by the specified cell.
322 **/
323 gint
atspi_table_get_column_extent_at(AtspiTable * obj,gint row,gint column,GError ** error)324 atspi_table_get_column_extent_at (AtspiTable *obj,
325 gint row,
326 gint column,
327 GError **error)
328 {
329 dbus_int32_t d_row = row, d_column = column;
330 dbus_int32_t retval = -1;
331
332 g_return_val_if_fail (obj != NULL, -1);
333
334 _atspi_dbus_call (obj, atspi_interface_table, "GetColumnExtentAt", error, "ii=>i", d_row, d_column, &retval);
335
336 return retval;
337 }
338
339 /**
340 * atspi_table_get_row_header:
341 * @obj: a pointer to the #AtspiTable implementor on which to operate.
342 * @row: the specified table row, zero-indexed.
343 *
344 * Gets the header associated with a table row, if available. This differs from
345 * #atspi_table_get_row_description, which returns a string.
346 *
347 * Returns: (transfer full): an #AtspiAccessible representation of the specified
348 * table row, if available.
349 **/
350 AtspiAccessible *
atspi_table_get_row_header(AtspiTable * obj,gint row,GError ** error)351 atspi_table_get_row_header (AtspiTable *obj,
352 gint row,
353 GError **error)
354 {
355 dbus_int32_t d_row = row;
356 DBusMessage *reply;
357
358 g_return_val_if_fail (obj != NULL, NULL);
359
360 reply = _atspi_dbus_call_partial (obj, atspi_interface_table, "GetRowHeader", error, "i", d_row);
361
362 return _atspi_dbus_return_accessible_from_message (reply);
363 }
364
365 /**
366 * atspi_table_get_column_header:
367 * @obj: a pointer to the #AtspiTable implementor on which to operate.
368 * @column: the specified table column, zero-indexed.
369 *
370 * Gets the header associated with a table column, if available.
371 * This differs from #atspi_table_get_column_description, which
372 * returns a string.
373 *
374 * Returns: (transfer full): an #AtspiAccessible representation of the
375 * specified table column, if available.
376 **/
377 AtspiAccessible *
atspi_table_get_column_header(AtspiTable * obj,gint column,GError ** error)378 atspi_table_get_column_header (AtspiTable *obj,
379 gint column,
380 GError **error)
381 {
382 dbus_int32_t d_column = column;
383 DBusMessage *reply;
384
385 g_return_val_if_fail (obj != NULL, NULL);
386
387 reply = _atspi_dbus_call_partial (obj, atspi_interface_table, "GetColumnHeader", error, "i", d_column);
388
389 return _atspi_dbus_return_accessible_from_message (reply);
390 }
391
392 /**
393 * atspi_table_get_n_selected_rows:
394 * @obj: a pointer to the #AtspiTable implementor on which to operate.
395 *
396 * Query a table to find out how many rows are currently selected.
397 * Not all tables support row selection.
398 *
399 * Returns: a #gint indicating the number of rows currently selected.
400 **/
401 gint
atspi_table_get_n_selected_rows(AtspiTable * obj,GError ** error)402 atspi_table_get_n_selected_rows (AtspiTable *obj, GError **error)
403 {
404 dbus_int32_t retval = -1;
405
406 g_return_val_if_fail (obj != NULL, -1);
407
408 _atspi_dbus_get_property (obj, atspi_interface_table, "NSelectedRows", error, "i", &retval);
409
410 return retval;
411 }
412
413 /**
414 * atspi_table_get_selected_rows:
415 * @obj: a pointer to the #AtspiTable implementor on which to operate.
416 *
417 * Queries a table for a list of indices of rows which are currently selected.
418 *
419 * Returns: (element-type gint) (transfer full): an array of #gint values,
420 * specifying which rows are currently selected.
421 **/
422 GArray *
atspi_table_get_selected_rows(AtspiTable * obj,GError ** error)423 atspi_table_get_selected_rows (AtspiTable *obj,
424 GError **error)
425 {
426 GArray *rows = NULL;
427
428 g_return_val_if_fail (obj != NULL, 0);
429
430 _atspi_dbus_call (obj, atspi_interface_table, "GetSelectedRows", error, "=>ai", &rows);
431
432 return rows;
433 }
434
435 /**
436 * atspi_table_get_selected_columns:
437 * @obj: a pointer to the #AtspiTable implementor on which to operate.
438 *
439 * Queries a table for a list of indices of columns which are currently
440 * selected.
441 *
442 * Returns: (element-type gint) (transfer full): an array of #gint values,
443 * specifying which columns are currently selected.
444 **/
445 GArray *
atspi_table_get_selected_columns(AtspiTable * obj,GError ** error)446 atspi_table_get_selected_columns (AtspiTable *obj,
447 GError **error)
448 {
449 GArray *columns = NULL;
450
451 g_return_val_if_fail (obj != NULL, 0);
452
453 _atspi_dbus_call (obj, atspi_interface_table, "GetSelectedColumns", error, "=>ai", &columns);
454
455 return columns;
456 }
457
458 /**
459 * atspi_table_get_n_selected_columns:
460 * @obj: a pointer to the #AtspiTable implementor on which to operate.
461 *
462 * Queries a table to find out how many columns are currently selected.
463 * Not all tables support column selection.
464 *
465 * Returns: a #gint indicating the number of columns currently selected.
466 **/
467 gint
atspi_table_get_n_selected_columns(AtspiTable * obj,GError ** error)468 atspi_table_get_n_selected_columns (AtspiTable *obj, GError **error)
469 {
470 dbus_int32_t retval = -1;
471
472 g_return_val_if_fail (obj != NULL, -1);
473
474 _atspi_dbus_get_property (obj, atspi_interface_table, "NSelectedColumns", error, "i", &retval);
475
476 return retval;
477 }
478
479 /**
480 * atspi_table_is_row_selected:
481 * @obj: a pointer to the #AtspiTable implementor on which to operate.
482 * @row: the zero-indexed row number of the row being queried.
483 *
484 * Determines whether a table row is selected. Not all tables support
485 * row selection.
486 *
487 * Returns: #TRUE if the specified row is currently selected, #FALSE if not.
488 **/
489 gboolean
atspi_table_is_row_selected(AtspiTable * obj,gint row,GError ** error)490 atspi_table_is_row_selected (AtspiTable *obj,
491 gint row,
492 GError **error)
493 {
494 dbus_int32_t d_row = row;
495 dbus_bool_t retval = FALSE;
496
497 g_return_val_if_fail (obj != NULL, FALSE);
498
499 _atspi_dbus_call (obj, atspi_interface_table, "IsRowSelected", error, "i=>b", d_row, &retval);
500
501 return retval;
502 }
503
504 /**
505 * atspi_table_is_column_selected:
506 * @obj: a pointer to the #AtspiTable implementor on which to operate.
507 * @column: the zero-indexed column number of the column being queried.
508 *
509 * Determines whether specified table column is selected.
510 * Not all tables support column selection.
511 *
512 * Returns: #TRUE if the specified column is currently selected, #FALSE if not.
513 **/
514 gboolean
atspi_table_is_column_selected(AtspiTable * obj,gint column,GError ** error)515 atspi_table_is_column_selected (AtspiTable *obj,
516 gint column,
517 GError **error)
518 {
519 dbus_int32_t d_column = column;
520 dbus_bool_t retval = FALSE;
521
522 g_return_val_if_fail (obj != NULL, FALSE);
523
524 _atspi_dbus_call (obj, atspi_interface_table, "IsColumnSelected", error, "i=>b", d_column, &retval);
525
526 return retval;
527 }
528
529 /**
530 * atspi_table_add_row_selection:
531 * @obj: a pointer to the #AtspiTable implementor on which to operate.
532 * @row: the zero-indexed row number of the row being selected.
533 *
534 * Selects the specified row, adding it to the current row selection.
535 * Not all tables support row selection.
536 *
537 * Returns: #TRUE if the specified row was successfully selected, #FALSE if not.
538 **/
539 gboolean
atspi_table_add_row_selection(AtspiTable * obj,gint row,GError ** error)540 atspi_table_add_row_selection (AtspiTable *obj,
541 gint row,
542 GError **error)
543 {
544 dbus_int32_t d_row = row;
545 dbus_bool_t retval = FALSE;
546
547 g_return_val_if_fail (obj != NULL, FALSE);
548
549 _atspi_dbus_call (obj, atspi_interface_table, "AddRowSelection", error, "i=>b", d_row, &retval);
550
551 return retval;
552 }
553
554 /**
555 * atspi_table_add_column_selection:
556 * @obj: a pointer to the #AtspiTable implementor on which to operate.
557 * @column: the zero-indexed column number of the column being selected.
558 *
559 * Selects the specified column, adding it to the current column selection.
560 * Not all tables support column selection.
561 *
562 * Returns: #TRUE if the specified column was successfully selected, #FALSE if not.
563 **/
564 gboolean
atspi_table_add_column_selection(AtspiTable * obj,gint column,GError ** error)565 atspi_table_add_column_selection (AtspiTable *obj,
566 gint column,
567 GError **error)
568 {
569 dbus_int32_t d_column = column;
570 dbus_bool_t retval = FALSE;
571
572 g_return_val_if_fail (obj != NULL, FALSE);
573
574 _atspi_dbus_call (obj, atspi_interface_table, "AddColumnSelection", error, "i=>b", d_column, &retval);
575
576 return retval;
577 }
578
579 /**
580 * atspi_table_remove_row_selection:
581 * @obj: a pointer to the #AtspiTable implementor on which to operate.
582 * @row: the zero-indexed number of the row being de-selected.
583 *
584 * De-selects the specified row, removing it from the current row selection.
585 * Not all tables support row selection.
586 *
587 * Returns: #TRUE if the specified row was successfully de-selected,
588 * #FALSE if not.
589 **/
590 gboolean
atspi_table_remove_row_selection(AtspiTable * obj,gint row,GError ** error)591 atspi_table_remove_row_selection (AtspiTable *obj,
592 gint row,
593 GError **error)
594 {
595 dbus_int32_t d_row = row;
596 dbus_bool_t retval = FALSE;
597
598 g_return_val_if_fail (obj != NULL, FALSE);
599
600 _atspi_dbus_call (obj, atspi_interface_table, "RemoveRowSelection", error, "i=>b", d_row, &retval);
601
602 return retval;
603 }
604
605 /**
606 * atspi_table_remove_column_selection:
607 * @obj: a pointer to the #AtspiTable implementor on which to operate.
608 * @column: the zero-indexed column number of the column being de-selected.
609 *
610 * De-selects the specified column, removing it from the current column
611 * selection.
612 * Not all tables support column selection.
613 *
614 * Returns: #TRUE if the specified column was successfully de-selected,
615 * #FALSE if not.
616 **/
617 gboolean
atspi_table_remove_column_selection(AtspiTable * obj,gint column,GError ** error)618 atspi_table_remove_column_selection (AtspiTable *obj,
619 gint column,
620 GError **error)
621 {
622 dbus_int32_t d_column = column;
623 dbus_bool_t retval = FALSE;
624
625 g_return_val_if_fail (obj != NULL, FALSE);
626
627 _atspi_dbus_call (obj, atspi_interface_table, "RemoveColumnSelection", error, "i=>b", d_column, &retval);
628
629 return retval;
630 }
631
632 /**
633 * atspi_table_get_row_column_extents_at_index:
634 * @obj: a pointer to the #AtspiTable implementor on which to operate.
635 * @index: the index of the #AtspiTable child whose row/column
636 * extents are requested.
637 * @row: (out): back-filled with the first table row associated with
638 * the cell with child index.
639 * @col: (out): back-filled with the first table column associated
640 * with the cell with child index.
641 * @row_extents: (out): back-filled with the number of table rows
642 * across which child i extends.
643 * @col_extents: (out): back-filled with the number of table columns
644 * across which child i extends.
645 * @is_selected: (out): a boolean which is back-filled with #TRUE
646 * if the child at index i corresponds to a selected table cell,
647 * #FALSE otherwise.
648 *
649 * Given a child index, determines the row and column indices and
650 * extents, and whether the cell is currently selected. If
651 * the child at index is not a cell (for instance, if it is
652 * a summary, caption, etc.), #FALSE is returned.
653 * The returned values are meaningful only if the Table has both
654 * STATE_VISIBLE and STATE_SHOWING.
655 *
656 * Example:
657 * If the #AtspiTable child at index '6' extends across columns 5 and 6 of
658 * row 2 of an #AtspiTable instance, and is currently selected, then
659 *
660 * retval = atspi_table_get_row_column_extents_at_index (table, 6,
661 * row, col,
662 * row_extents,
663 * col_extents,
664 * is_selected);
665 *
666 * will return #TRUE, and after the call
667 * row, col, row_extents, col_extents,
668 * and is_selected will contain 2, 5, 1, 2, and
669 * #TRUE, respectively.
670 *
671 * Returns: #TRUE if the index is associated with a valid table
672 * cell, #FALSE if the index does not correspond to a cell. If
673 * #FALSE is returned, the values of the out parameters are
674 * undefined.
675 **/
676 gboolean
atspi_table_get_row_column_extents_at_index(AtspiTable * obj,gint index,gint * row,gint * col,gint * row_extents,gint * col_extents,gboolean * is_selected,GError ** error)677 atspi_table_get_row_column_extents_at_index (AtspiTable *obj,
678 gint index, gint *row, gint *col,
679 gint *row_extents, gint *col_extents,
680 gboolean *is_selected, GError **error)
681 {
682 dbus_int32_t d_index = index;
683 dbus_bool_t retval = FALSE;
684 dbus_int32_t d_row = 0, d_col = 0, d_row_extents = 0, d_col_extents = 0;
685 dbus_bool_t d_is_selected = FALSE;
686
687 g_return_val_if_fail (obj != NULL, FALSE);
688
689 _atspi_dbus_call (obj, atspi_interface_table, "GetRowColumnExtentsAtIndex",
690 error, "i=>biiiib", d_index, &retval, &d_row, &d_col,
691 &d_row_extents, &d_col_extents, &d_is_selected);
692
693 *row = d_row;
694 *col = d_col;
695 *row_extents = d_row_extents;;
696 *col_extents = d_col_extents;
697 *is_selected = d_is_selected;;
698
699 return retval;
700 }
701
702
703 /**
704 * atspi_table_is_selected:
705 * @obj: a pointer to the #AtspiTable implementor on which to operate.
706 * @row: the zero-indexed row of the cell being queried.
707 * @column: the zero-indexed column of the cell being queried.
708 *
709 * Determines whether the cell at a specific row and column is selected.
710 *
711 * Returns: #TRUE if the specified cell is currently selected, #FALSE if not.
712 **/
713 gboolean
atspi_table_is_selected(AtspiTable * obj,gint row,gint column,GError ** error)714 atspi_table_is_selected (AtspiTable *obj,
715 gint row,
716 gint column,
717 GError **error)
718 {
719 dbus_int32_t d_row = row, d_column = column;
720 dbus_bool_t retval = FALSE;
721
722 g_return_val_if_fail (obj != NULL, FALSE);
723
724 _atspi_dbus_call (obj, atspi_interface_table, "IsSelected", error, "ii=>b", d_row, d_column, &retval);
725
726 return retval;
727 }
728
729 static void
atspi_table_base_init(AtspiTable * klass)730 atspi_table_base_init (AtspiTable *klass)
731 {
732 }
733
734 GType
atspi_table_get_type(void)735 atspi_table_get_type (void)
736 {
737 static GType type = 0;
738
739 if (!type) {
740 static const GTypeInfo tinfo =
741 {
742 sizeof (AtspiTable),
743 (GBaseInitFunc) atspi_table_base_init,
744 (GBaseFinalizeFunc) NULL,
745 };
746
747 type = g_type_register_static (G_TYPE_INTERFACE, "AtspiTable", &tinfo, 0);
748
749 }
750 return type;
751 }
752