2 * AT-SPI - Assistive Technology Service Provider Interface
3 * (Gnome Accessibility Project; http://developer.gnome.org/projects/gap)
5 * Copyright 2001, 2002 Sun Microsystems Inc.,
6 * Copyright 2001, 2002 Ximian, Inc.
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either
11 * version 2 of the License, or (at your option) any later version.
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Library General Public License for more details.
18 * You should have received a copy of the GNU Library General Public
19 * License along with this library; if not, write to the
20 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
21 * Boston, MA 02111-1307, USA.
24 #include <stdlib.h> /* for malloc */
25 #include "atspi-private.h"
28 * atspi_table_get_caption:
29 * @obj: a pointer to the #AtspiTable implementor on which to operate.
31 * Get an accessible representation of the caption for an #AtspiTable.
33 * Returns: (transfer full): an #Accessible object that serves as the table's
37 atspi_table_get_caption (AtspiTable *obj, GError **error)
40 AtspiAccessible *retval = NULL;
42 g_return_val_if_fail (obj != NULL, NULL);
44 _atspi_dbus_get_property (obj, atspi_interface_table, "Caption", error, "(so)", &retval);
49 * atspi_table_get_summary:
50 * @obj: a pointer to the #AtspiTable implementor on which to operate.
52 * Get an accessible object which summarizes the contents of an #AtspiTable.
54 * Returns: (transfer full): an #AtspiAccessible object that serves as the
55 * table's summary (often a reduced #AtspiTable).
58 atspi_table_get_summary (AtspiTable *obj, GError **error)
60 AtspiAccessible *retval;
62 g_return_val_if_fail (obj != NULL, NULL);
64 _atspi_dbus_get_property (obj, atspi_interface_table, "Summary", error, "(so)", &retval);
70 * atspi_table_get_n_rows:
71 * @obj: a pointer to the #AtspiTable implementor on which to operate.
73 * Get the number of rows in an #AtspiTable,
74 * exclusive of any rows that are programmatically hidden, but inclusive
75 * of rows that may be outside of the current scrolling window or viewport.
77 * Returns: an integer indicating the number of rows in the table.
80 atspi_table_get_n_rows (AtspiTable *obj, GError **error)
82 dbus_int32_t retval = -1;
84 g_return_val_if_fail (obj != NULL, -1);
86 _atspi_dbus_get_property (obj, atspi_interface_table, "NRows", error, "i", &retval);
92 * atspi_table_get_n_columns:
93 * @obj: a pointer to the #AtspiTable implementor on which to operate.
95 * Get the number of columns in an #AtspiTable,
96 * exclusive of any columns that are programmatically hidden, but inclusive
97 * of columns that may be outside of the current scrolling window or viewport.
99 * Returns: an integer indicating the number of columns in the table.
102 atspi_table_get_n_columns (AtspiTable *obj, GError **error)
104 dbus_int32_t retval = -1;
106 g_return_val_if_fail (obj != NULL, -1);
108 _atspi_dbus_get_property (obj, atspi_interface_table, "NColumns", error, "i", &retval);
114 * atspi_table_get_accessible_at:
115 * @obj: a pointer to the #AtspiTable implementor on which to operate.
116 * @row: the specified table row, zero-indexed.
117 * @column: the specified table column, zero-indexed.
119 * Get the table cell at the specified row and column indices.
120 * To get the accessible object at a particular (x, y) screen coordinate,
121 * use #atspi_component_get_accessible_at_point ().
123 * Returns: (transfer full): an #AtspiAccessible object representing the
124 * specified table cell.
127 atspi_table_get_accessible_at (AtspiTable *obj,
132 dbus_int32_t d_row = row, d_column = column;
133 AtspiAccessible *retval;
136 g_return_val_if_fail (obj != NULL, NULL);
138 reply = _atspi_dbus_call_partial (obj, atspi_interface_table, "GetAccessibleAt", error, "ii", row, column);
140 return _atspi_dbus_return_accessible_from_message (reply);
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.
149 * Get the 1-D child index corresponding to the specified 2-D row and column indices.
150 * To get the accessible object at a particular (x, y) screen coordinate,
151 * use #Accessible_getAccessibleAtPoint ().
152 * @see #atspi_table_getRowAtIndex(), #atspi_table_getColumnAtIndex()
154 * Returns: a long integer which serves as the index of a specified cell in the
155 * table, in a form usable by #Accessible_getChildAtIndex().
158 atspi_table_get_index_at (AtspiTable *obj,
163 dbus_int32_t d_row = row, d_column = column;
164 dbus_int32_t retval = -1;
166 g_return_val_if_fail (obj != NULL, -1);
168 _atspi_dbus_call (obj, atspi_interface_table, "GetIndexAt", error, "ii=>i", d_row, d_column, &retval);
174 * atspi_table_get_row_at_index:
175 * @obj: a pointer to the #AtspiTable implementor on which to operate.
176 * @index: the specified child index, zero-indexed.
178 * Get the table row index occupied by the child at a particular 1-D child index.
180 * @see #atspi_table_get_indexAt(), #atspi_table_get_columnAtIndex()
182 * Returns: a long integer indicating the first row spanned by the child of a
183 * table, at the specified 1-D (zero-offset) @index.
186 atspi_table_get_row_at_index (AtspiTable *obj,
190 dbus_int32_t d_index = index;
191 dbus_int32_t retval = -1;
193 g_return_val_if_fail (obj != NULL, -1);
195 _atspi_dbus_call (obj, atspi_interface_table, "GetRowAtIndex", error, "i=>i", d_index, &retval);
201 * atspi_table_get_column_at_index:
202 * @obj: a pointer to the #AtspiTable implementor on which to operate.
203 * @index: the specified child index, zero-indexed.
205 * Get the table column index occupied by the child at a particular 1-D child index.
207 * @see #atspi_table_getIndexAt(), #atspi_table_getRowAtIndex()
209 * Returns: a long integer indicating the first column spanned by the child of a
210 * table, at the specified 1-D (zero-offset) @index.
213 atspi_table_get_column_at_index (AtspiTable *obj,
217 dbus_int32_t d_index = index;
218 dbus_int32_t retval = -1;
220 g_return_val_if_fail (obj != NULL, -1);
222 _atspi_dbus_call (obj, atspi_interface_table, "GetColumnAtIndex", error, "i=>i", d_index, &retval);
228 * atspi_table_get_row_description:
229 * @obj: a pointer to the #AtspiTable implementor on which to operate.
230 * @row: the specified table row, zero-indexed.
232 * Get a text description of a particular table row. This differs from
233 * atspi_table_get_row_header, which returns an #AtspiAccessible.
235 * Returns: a UTF-8 string describing the specified table row, if available.
238 atspi_table_get_row_description (AtspiTable *obj,
242 dbus_int32_t d_row = row;
245 g_return_val_if_fail (obj != NULL, NULL);
247 _atspi_dbus_call (obj, atspi_interface_table, "GetRowDescription", error, "i=>s", d_row, &retval);
253 * atspi_table_get_column_description:
254 * @obj: a pointer to the #AtspiTable implementor on which to operate.
255 * @column: the specified table column, zero-indexed.
257 * Get a text description of a particular table column. This differs from
258 * atspi_table_get_column_header, which returns an #Accessible.
260 * Returns: a UTF-8 string describing the specified table column, if available.
263 atspi_table_get_column_description (AtspiTable *obj,
264 gint column, GError **error)
266 dbus_int32_t d_column = column;
269 g_return_val_if_fail (obj != NULL, NULL);
271 _atspi_dbus_call (obj, atspi_interface_table, "GetColumnDescription", error, "i=>s", d_column, &retval);
277 * atspi_table_get_row_extent_at:
278 * @obj: a pointer to the #AtspiTable implementor on which to operate.
279 * @row: the specified table row, zero-indexed.
280 * @column: the specified table column, zero-indexed.
282 * Get the number of rows spanned by the table cell at the specific row and column.
283 * (some tables can have cells which span multiple rows and/or columns).
285 * Returns: a long integer indicating the number of rows spanned by the specified cell.
288 atspi_table_get_row_extent_at (AtspiTable *obj,
293 dbus_int32_t d_row = row, d_column = column;
294 dbus_int32_t retval = -1;
296 g_return_val_if_fail (obj != NULL, -1);
298 _atspi_dbus_call (obj, atspi_interface_table, "GetRowExtentAt", error, "ii=>i", d_row, d_column, &retval);
304 * atspi_table_get_column_extent_at:
305 * @obj: a pointer to the #AtspiTable implementor on which to operate.
306 * @row: the specified table row, zero-indexed.
307 * @column: the specified table column, zero-indexed.
309 * Get the number of columns spanned by the table cell at the specific row and column.
310 * (some tables can have cells which span multiple rows and/or columns).
312 * Returns: a long integer indicating the number of columns spanned by the specified cell.
315 atspi_table_get_column_extent_at (AtspiTable *obj,
320 dbus_int32_t d_row = row, d_column = column;
321 dbus_int32_t retval = -1;
323 g_return_val_if_fail (obj != NULL, -1);
325 _atspi_dbus_call (obj, atspi_interface_table, "GetColumnExtentAt", error, "ii=>i", d_row, d_column, &retval);
331 * atspi_table_get_row_header:
332 * @obj: a pointer to the #AtspiTable implementor on which to operate.
333 * @row: the specified table row, zero-indexed.
335 * Get the header associated with a table row, if available. This differs from
336 * atspi_table_get_row_description, which returns a string.
338 * Returns: (transfer full): a #Accessible representatin of the specified
339 * table row, if available.
342 atspi_table_get_row_header (AtspiTable *obj,
346 dbus_int32_t d_row = row;
349 g_return_val_if_fail (obj != NULL, NULL);
351 reply = _atspi_dbus_call_partial (obj, atspi_interface_table, "GetRowHeader", error, "i", d_row);
353 return _atspi_dbus_return_accessible_from_message (reply);
357 * atspi_table_get_column_header:
358 * @obj: a pointer to the #AtspiTable implementor on which to operate.
359 * @column: the specified table column, zero-indexed.
361 * Get the header associated with a table column, if available. This differs from
362 * atspi_table_get_column_description, which returns a string.
364 * Returns: (transfer full): a #AtspiAccessible representation of the
365 * specified table column, if available.
368 atspi_table_get_column_header (AtspiTable *obj,
372 dbus_int32_t d_column = column;
375 g_return_val_if_fail (obj != NULL, NULL);
377 reply = _atspi_dbus_call_partial (obj, atspi_interface_table, "GetColumnHeader", error, "i", &d_column);
379 return _atspi_dbus_return_accessible_from_message (reply);
383 * atspi_table_get_n_selected_rows:
384 * @obj: a pointer to the #AtspiTable implementor on which to operate.
386 * Query a table to find out how many rows are currently selected. Not all tables
387 * support row selection.
389 * Returns: a long integer indicating the number of rows currently selected.
392 atspi_table_get_n_selected_rows (AtspiTable *obj, GError **error)
394 dbus_int32_t retval = -1;
396 g_return_val_if_fail (obj != NULL, -1);
398 _atspi_dbus_get_property (obj, atspi_interface_table, "NSelectedRows", error, "i", &retval);
404 * atspi_table_get_selected_rows:
405 * @obj: a pointer to the #AtspiTable implementor on which to operate.
407 * Query a table for a list of indices of rows which are currently selected.
409 * Returns: (element-type gint) (transfer full): an array of integers,
410 * specifying which rows are currently selected.
413 atspi_table_get_selected_rows (AtspiTable *obj,
418 g_return_val_if_fail (obj != NULL, 0);
420 _atspi_dbus_call (obj, atspi_interface_table, "GetSelectedRows", error, "=>ai", &rows);
426 * atspi_table_get_selected_columns:
427 * @obj: a pointer to the #AtspiTable implementor on which to operate.
429 * Query a table for a list of indices of columns which are currently selected.
431 * Returns: (element-type gint) (transfer full): an array of integers,
432 * specifying which columns are currently selected.
435 atspi_table_get_selected_columns (AtspiTable *obj,
438 GArray *columns = NULL;
440 g_return_val_if_fail (obj != NULL, 0);
442 _atspi_dbus_call (obj, atspi_interface_table, "GetSelectedColumns", error, "=>ai", &columns);
448 * atspi_table_get_n_selected_columns:
449 * @obj: a pointer to the #AtspiTable implementor on which to operate.
451 * Query a table to find out how many columns are currently selected. Not all tables
452 * support column selection.
454 * Returns: a long integer indicating the number of columns currently selected.
457 atspi_table_get_n_selected_columns (AtspiTable *obj, GError **error)
459 dbus_int32_t retval = -1;
461 g_return_val_if_fail (obj != NULL, -1);
463 _atspi_dbus_get_property (obj, atspi_interface_table, "NSelectedColumns", error, "i", &retval);
469 * atspi_table_is_row_selected:
470 * @obj: a pointer to the #AtspiTable implementor on which to operate.
471 * @row: the zero-indexed row number of the row being queried.
473 * Determine whether a table row is selected. Not all tables support row selection.
475 * Returns: #TRUE if the specified row is currently selected, #FALSE if not.
478 atspi_table_is_row_selected (AtspiTable *obj,
482 dbus_int32_t d_row = row;
483 dbus_bool_t retval = FALSE;
485 g_return_val_if_fail (obj != NULL, FALSE);
487 _atspi_dbus_call (obj, atspi_interface_table, "IsRowSelected", error, "i=>b", d_row, &retval);
493 * atspi_table_is_column_selected:
494 * @obj: a pointer to the #AtspiTable implementor on which to operate.
495 * @column: the zero-indexed column number of the column being queried.
497 * Determine whether specified table column is selected.
498 * Not all tables support column selection.
500 * Returns: #TRUE if the specified column is currently selected, #FALSE if not.
503 atspi_table_is_column_selected (AtspiTable *obj,
507 dbus_int32_t d_column = column;
508 dbus_bool_t retval = FALSE;
510 g_return_val_if_fail (obj != NULL, FALSE);
512 _atspi_dbus_call (obj, atspi_interface_table, "IsColumnSelected", error, "i=>b", d_column, &retval);
518 * atspi_table_add_row_selection:
519 * @obj: a pointer to the #AtspiTable implementor on which to operate.
520 * @row: the zero-indexed row number of the row being selected.
522 * Select the specified row, adding it to the current row selection.
523 * Not all tables support row selection.
525 * Returns: #TRUE if the specified row was successfully selected, #FALSE if not.
528 atspi_table_add_row_selection (AtspiTable *obj,
532 dbus_int32_t d_row = row;
533 dbus_bool_t retval = FALSE;
535 g_return_val_if_fail (obj != NULL, FALSE);
537 _atspi_dbus_call (obj, atspi_interface_table, "AddRowSelection", error, "i=>b", d_row, &retval);
543 * atspi_table_add_column_selection:
544 * @obj: a pointer to the #AtspiTable implementor on which to operate.
545 * @column: the zero-indexed column number of the column being selected.
547 * Select the specified column, adding it to the current column selection.
548 * Not all tables support column selection.
550 * Returns: #TRUE if the specified column was successfully selected, #FALSE if not.
553 atspi_table_add_column_selection (AtspiTable *obj,
557 dbus_int32_t d_column = column;
558 dbus_bool_t retval = FALSE;
560 g_return_val_if_fail (obj != NULL, FALSE);
562 _atspi_dbus_call (obj, atspi_interface_table, "AddColumnSelection", error, "i=>b", d_column, &retval);
568 * atspi_table_remove_row_selection:
569 * @obj: a pointer to the #AtspiTable implementor on which to operate.
570 * @row: the zero-indexed number of the row being deselected.
572 * De-select the specified row, removing it to the current row selection.
573 * Not all tables support row selection.
575 * Returns: #TRUE if the specified row was successfully de-selected, #FALSE if not.
578 atspi_table_remove_row_selection (AtspiTable *obj,
582 dbus_int32_t d_row = row;
583 dbus_bool_t retval = FALSE;
585 g_return_val_if_fail (obj != NULL, FALSE);
587 _atspi_dbus_call (obj, atspi_interface_table, "RemoveRowSelection", error, "i=>b", d_row, &retval);
593 * atspi_table_remove_column_selection:
594 * @obj: a pointer to the #AtspiTable implementor on which to operate.
595 * @column: the zero-indexed column number of the column being de-selected.
597 * De-select the specified column, removing it to the current column selection.
598 * Not all tables support column selection.
600 * Returns: #TRUE if the specified column was successfully de-selected, #FALSE if not.
603 atspi_table_remove_column_selection (AtspiTable *obj,
607 dbus_int32_t d_column = column;
608 dbus_bool_t retval = FALSE;
610 g_return_val_if_fail (obj != NULL, FALSE);
612 _atspi_dbus_call (obj, atspi_interface_table, "RemoveColumnSelection", error, "i=>b", d_column, &retval);
618 * atspi_table_get_row_column_extents_at_index:
619 * @obj: a pointer to the #AtspiTable implementor on which to operate.
620 * @index: the index of the Table child whose row/column
621 * extents are requested.
622 * @row: back-filled with the first table row associated with
623 * the cell with child index \c index.
624 * @col: back-filled with the first table column associated
625 * with the cell with child index \c index.
626 * @row_extents: back-filled with the number of table rows
627 * across which child \c i extends.
628 * @col_extents: back-filled with the number of table columns
629 * across which child \c i extends.
630 * @is_selected: a boolean which is back-filled with \c True
631 * if the child at index \c i corresponds to a selected table cell,
632 * \c False otherwise.
634 * Given a child index, determine the row and column indices and
635 * extents, and whether the cell is currently selected. If
636 * the child at \c index is not a cell (for instance, if it is
637 * a summary, caption, etc.), \c False is returned.
640 * If the Table child at index '6' extends across columns 5 and 6 of
641 * row 2 of a Table instance, and is currently selected, then
643 * retval = table::getRowColumnExtentsAtIndex (6, row, col,
648 * will return True, and after the call
649 * row, col, row_extents, col_extents,
650 * and \c is_selected will contain 2, 5, 1, 2, and
651 * True, respectively.
653 * Returns: \c True if the index is associated with a valid table
654 * cell, \c False if the index does not correspond to a cell. If
655 * \c False is returned, the values of the out parameters are
659 atspi_table_get_row_column_extents_at_index (AtspiTable *obj,
660 gint index, gint *row, gint *col,
661 gint *row_extents, gint *col_extents,
662 gboolean *is_selected, GError **error)
664 dbus_int32_t d_index = index;
665 dbus_bool_t retval = FALSE;
666 dbus_int32_t d_row = 0, d_col = 0, d_row_extents = 0, d_col_extents = 0;
667 dbus_bool_t d_is_selected = FALSE;
669 g_return_val_if_fail (obj != NULL, FALSE);
671 _atspi_dbus_call (obj, atspi_interface_table, "GetRowColumnExtentsAtIndex", error, "i=>iiiibb", d_index, &d_row, &d_col, &d_row_extents, &d_col_extents, &d_is_selected, &retval);
674 *row_extents = d_row_extents;;
675 *col_extents = d_col_extents;
676 *is_selected = d_is_selected;;
683 * atspi_table_is_selected:
684 * @obj: a pointer to the #AtspiTable implementor on which to operate.
685 * @row: the zero-indexed row of the cell being queried.
686 * @column: the zero-indexed column of the cell being queried.
688 * Determine whether the cell at a specific row and column is selected.
690 * Returns: #TRUE if the specified cell is currently selected, #FALSE if not.
693 atspi_table_is_selected (AtspiTable *obj,
698 dbus_int32_t d_row = row, d_column = column;
699 dbus_bool_t retval = FALSE;
701 g_return_val_if_fail (obj != NULL, FALSE);
703 _atspi_dbus_call (obj, atspi_interface_table, "IsSelected", error, "ii=>b", d_row, d_column, &retval);
709 atspi_table_base_init (AtspiTable *klass)
714 atspi_table_get_type (void)
716 static GType type = 0;
719 static const GTypeInfo tinfo =
722 (GBaseInitFunc) atspi_table_base_init,
723 (GBaseFinalizeFunc) NULL,
726 type = g_type_register_static (G_TYPE_INTERFACE, "AtspiTable", &tinfo, 0);