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)
39 AtspiAccessible *retval = NULL;
41 g_return_val_if_fail (obj != NULL, NULL);
43 _atspi_dbus_get_property (obj, atspi_interface_table, "Caption", error, "(so)", &retval);
48 * atspi_table_get_summary:
49 * @obj: a pointer to the #AtspiTable implementor on which to operate.
51 * Get an accessible object which summarizes the contents of an #AtspiTable.
53 * Returns: (transfer full): an #AtspiAccessible object that serves as the
54 * table's summary (often a reduced #AtspiTable).
57 atspi_table_get_summary (AtspiTable *obj, GError **error)
59 AtspiAccessible *retval;
61 g_return_val_if_fail (obj != NULL, NULL);
63 _atspi_dbus_get_property (obj, atspi_interface_table, "Summary", error, "(so)", &retval);
69 * atspi_table_get_n_rows:
70 * @obj: a pointer to the #AtspiTable implementor on which to operate.
72 * Get the number of rows in an #AtspiTable,
73 * exclusive of any rows that are programmatically hidden, but inclusive
74 * of rows that may be outside of the current scrolling window or viewport.
76 * Returns: an integer indicating the number of rows in the table.
79 atspi_table_get_n_rows (AtspiTable *obj, GError **error)
81 dbus_int32_t retval = -1;
83 g_return_val_if_fail (obj != NULL, -1);
85 _atspi_dbus_get_property (obj, atspi_interface_table, "NRows", error, "i", &retval);
91 * atspi_table_get_n_columns:
92 * @obj: a pointer to the #AtspiTable implementor on which to operate.
94 * Get the number of columns in an #AtspiTable,
95 * exclusive of any columns that are programmatically hidden, but inclusive
96 * of columns that may be outside of the current scrolling window or viewport.
98 * Returns: an integer indicating the number of columns in the table.
101 atspi_table_get_n_columns (AtspiTable *obj, GError **error)
103 dbus_int32_t retval = -1;
105 g_return_val_if_fail (obj != NULL, -1);
107 _atspi_dbus_get_property (obj, atspi_interface_table, "NColumns", error, "i", &retval);
113 * atspi_table_get_accessible_at:
114 * @obj: a pointer to the #AtspiTable implementor on which to operate.
115 * @row: the specified table row, zero-indexed.
116 * @column: the specified table column, zero-indexed.
118 * Get the table cell at the specified row and column indices.
119 * To get the accessible object at a particular (x, y) screen coordinate,
120 * use #atspi_component_get_accessible_at_point ().
122 * Returns: (transfer full): an #AtspiAccessible object representing the
123 * specified table cell.
126 atspi_table_get_accessible_at (AtspiTable *obj,
131 dbus_int32_t d_row = row, d_column = column;
134 g_return_val_if_fail (obj != NULL, NULL);
136 reply = _atspi_dbus_call_partial (obj, atspi_interface_table, "GetAccessibleAt", error, "ii", d_row, d_column);
138 return _atspi_dbus_return_accessible_from_message (reply);
142 * atspi_table_get_index_at:
143 * @obj: a pointer to the #AtspiTable implementor on which to operate.
144 * @row: the specified table row, zero-indexed.
145 * @column: the specified table column, zero-indexed.
147 * Get the 1-D child index corresponding to the specified 2-D row and column indices.
148 * To get the accessible object at a particular (x, y) screen coordinate,
149 * use #Accessible_getAccessibleAtPoint ().
150 * @see #atspi_table_getRowAtIndex(), #atspi_table_getColumnAtIndex()
152 * Returns: a long integer which serves as the index of a specified cell in the
153 * table, in a form usable by #Accessible_getChildAtIndex().
156 atspi_table_get_index_at (AtspiTable *obj,
161 dbus_int32_t d_row = row, d_column = column;
162 dbus_int32_t retval = -1;
164 g_return_val_if_fail (obj != NULL, -1);
166 _atspi_dbus_call (obj, atspi_interface_table, "GetIndexAt", error, "ii=>i", d_row, d_column, &retval);
172 * atspi_table_get_row_at_index:
173 * @obj: a pointer to the #AtspiTable implementor on which to operate.
174 * @index: the specified child index, zero-indexed.
176 * Get the table row index occupied by the child at a particular 1-D child index.
178 * @see #atspi_table_get_indexAt(), #atspi_table_get_columnAtIndex()
180 * Returns: a long integer indicating the first row spanned by the child of a
181 * table, at the specified 1-D (zero-offset) @index.
184 atspi_table_get_row_at_index (AtspiTable *obj,
188 dbus_int32_t d_index = index;
189 dbus_int32_t retval = -1;
191 g_return_val_if_fail (obj != NULL, -1);
193 _atspi_dbus_call (obj, atspi_interface_table, "GetRowAtIndex", error, "i=>i", d_index, &retval);
199 * atspi_table_get_column_at_index:
200 * @obj: a pointer to the #AtspiTable implementor on which to operate.
201 * @index: the specified child index, zero-indexed.
203 * Get the table column index occupied by the child at a particular 1-D child index.
205 * @see #atspi_table_getIndexAt(), #atspi_table_getRowAtIndex()
207 * Returns: a long integer indicating the first column spanned by the child of a
208 * table, at the specified 1-D (zero-offset) @index.
211 atspi_table_get_column_at_index (AtspiTable *obj,
215 dbus_int32_t d_index = index;
216 dbus_int32_t retval = -1;
218 g_return_val_if_fail (obj != NULL, -1);
220 _atspi_dbus_call (obj, atspi_interface_table, "GetColumnAtIndex", error, "i=>i", d_index, &retval);
226 * atspi_table_get_row_description:
227 * @obj: a pointer to the #AtspiTable implementor on which to operate.
228 * @row: the specified table row, zero-indexed.
230 * Get a text description of a particular table row. This differs from
231 * atspi_table_get_row_header, which returns an #AtspiAccessible.
233 * Returns: a UTF-8 string describing the specified table row, if available.
236 atspi_table_get_row_description (AtspiTable *obj,
240 dbus_int32_t d_row = row;
243 g_return_val_if_fail (obj != NULL, NULL);
245 _atspi_dbus_call (obj, atspi_interface_table, "GetRowDescription", error, "i=>s", d_row, &retval);
251 * atspi_table_get_column_description:
252 * @obj: a pointer to the #AtspiTable implementor on which to operate.
253 * @column: the specified table column, zero-indexed.
255 * Get a text description of a particular table column. This differs from
256 * atspi_table_get_column_header, which returns an #Accessible.
258 * Returns: a UTF-8 string describing the specified table column, if available.
261 atspi_table_get_column_description (AtspiTable *obj,
262 gint column, GError **error)
264 dbus_int32_t d_column = column;
267 g_return_val_if_fail (obj != NULL, NULL);
269 _atspi_dbus_call (obj, atspi_interface_table, "GetColumnDescription", error, "i=>s", d_column, &retval);
275 * atspi_table_get_row_extent_at:
276 * @obj: a pointer to the #AtspiTable implementor on which to operate.
277 * @row: the specified table row, zero-indexed.
278 * @column: the specified table column, zero-indexed.
280 * Get the number of rows spanned by the table cell at the specific row and column.
281 * (some tables can have cells which span multiple rows and/or columns).
283 * Returns: a long integer indicating the number of rows spanned by the specified cell.
286 atspi_table_get_row_extent_at (AtspiTable *obj,
291 dbus_int32_t d_row = row, d_column = column;
292 dbus_int32_t retval = -1;
294 g_return_val_if_fail (obj != NULL, -1);
296 _atspi_dbus_call (obj, atspi_interface_table, "GetRowExtentAt", error, "ii=>i", d_row, d_column, &retval);
302 * atspi_table_get_column_extent_at:
303 * @obj: a pointer to the #AtspiTable implementor on which to operate.
304 * @row: the specified table row, zero-indexed.
305 * @column: the specified table column, zero-indexed.
307 * Get the number of columns spanned by the table cell at the specific row and column.
308 * (some tables can have cells which span multiple rows and/or columns).
310 * Returns: a long integer indicating the number of columns spanned by the specified cell.
313 atspi_table_get_column_extent_at (AtspiTable *obj,
318 dbus_int32_t d_row = row, d_column = column;
319 dbus_int32_t retval = -1;
321 g_return_val_if_fail (obj != NULL, -1);
323 _atspi_dbus_call (obj, atspi_interface_table, "GetColumnExtentAt", error, "ii=>i", d_row, d_column, &retval);
329 * atspi_table_get_row_header:
330 * @obj: a pointer to the #AtspiTable implementor on which to operate.
331 * @row: the specified table row, zero-indexed.
333 * Get the header associated with a table row, if available. This differs from
334 * atspi_table_get_row_description, which returns a string.
336 * Returns: (transfer full): a #Accessible representatin of the specified
337 * table row, if available.
340 atspi_table_get_row_header (AtspiTable *obj,
344 dbus_int32_t d_row = row;
347 g_return_val_if_fail (obj != NULL, NULL);
349 reply = _atspi_dbus_call_partial (obj, atspi_interface_table, "GetRowHeader", error, "i", d_row);
351 return _atspi_dbus_return_accessible_from_message (reply);
355 * atspi_table_get_column_header:
356 * @obj: a pointer to the #AtspiTable implementor on which to operate.
357 * @column: the specified table column, zero-indexed.
359 * Get the header associated with a table column, if available. This differs from
360 * atspi_table_get_column_description, which returns a string.
362 * Returns: (transfer full): a #AtspiAccessible representation of the
363 * specified table column, if available.
366 atspi_table_get_column_header (AtspiTable *obj,
370 dbus_int32_t d_column = column;
373 g_return_val_if_fail (obj != NULL, NULL);
375 reply = _atspi_dbus_call_partial (obj, atspi_interface_table, "GetColumnHeader", error, "i", &d_column);
377 return _atspi_dbus_return_accessible_from_message (reply);
381 * atspi_table_get_n_selected_rows:
382 * @obj: a pointer to the #AtspiTable implementor on which to operate.
384 * Query a table to find out how many rows are currently selected. Not all tables
385 * support row selection.
387 * Returns: a long integer indicating the number of rows currently selected.
390 atspi_table_get_n_selected_rows (AtspiTable *obj, GError **error)
392 dbus_int32_t retval = -1;
394 g_return_val_if_fail (obj != NULL, -1);
396 _atspi_dbus_get_property (obj, atspi_interface_table, "NSelectedRows", error, "i", &retval);
402 * atspi_table_get_selected_rows:
403 * @obj: a pointer to the #AtspiTable implementor on which to operate.
405 * Query a table for a list of indices of rows which are currently selected.
407 * Returns: (element-type gint) (transfer full): an array of integers,
408 * specifying which rows are currently selected.
411 atspi_table_get_selected_rows (AtspiTable *obj,
416 g_return_val_if_fail (obj != NULL, 0);
418 _atspi_dbus_call (obj, atspi_interface_table, "GetSelectedRows", error, "=>ai", &rows);
424 * atspi_table_get_selected_columns:
425 * @obj: a pointer to the #AtspiTable implementor on which to operate.
427 * Query a table for a list of indices of columns which are currently selected.
429 * Returns: (element-type gint) (transfer full): an array of integers,
430 * specifying which columns are currently selected.
433 atspi_table_get_selected_columns (AtspiTable *obj,
436 GArray *columns = NULL;
438 g_return_val_if_fail (obj != NULL, 0);
440 _atspi_dbus_call (obj, atspi_interface_table, "GetSelectedColumns", error, "=>ai", &columns);
446 * atspi_table_get_n_selected_columns:
447 * @obj: a pointer to the #AtspiTable implementor on which to operate.
449 * Query a table to find out how many columns are currently selected. Not all tables
450 * support column selection.
452 * Returns: a long integer indicating the number of columns currently selected.
455 atspi_table_get_n_selected_columns (AtspiTable *obj, GError **error)
457 dbus_int32_t retval = -1;
459 g_return_val_if_fail (obj != NULL, -1);
461 _atspi_dbus_get_property (obj, atspi_interface_table, "NSelectedColumns", error, "i", &retval);
467 * atspi_table_is_row_selected:
468 * @obj: a pointer to the #AtspiTable implementor on which to operate.
469 * @row: the zero-indexed row number of the row being queried.
471 * Determine whether a table row is selected. Not all tables support row selection.
473 * Returns: #TRUE if the specified row is currently selected, #FALSE if not.
476 atspi_table_is_row_selected (AtspiTable *obj,
480 dbus_int32_t d_row = row;
481 dbus_bool_t retval = FALSE;
483 g_return_val_if_fail (obj != NULL, FALSE);
485 _atspi_dbus_call (obj, atspi_interface_table, "IsRowSelected", error, "i=>b", d_row, &retval);
491 * atspi_table_is_column_selected:
492 * @obj: a pointer to the #AtspiTable implementor on which to operate.
493 * @column: the zero-indexed column number of the column being queried.
495 * Determine whether specified table column is selected.
496 * Not all tables support column selection.
498 * Returns: #TRUE if the specified column is currently selected, #FALSE if not.
501 atspi_table_is_column_selected (AtspiTable *obj,
505 dbus_int32_t d_column = column;
506 dbus_bool_t retval = FALSE;
508 g_return_val_if_fail (obj != NULL, FALSE);
510 _atspi_dbus_call (obj, atspi_interface_table, "IsColumnSelected", error, "i=>b", d_column, &retval);
516 * atspi_table_add_row_selection:
517 * @obj: a pointer to the #AtspiTable implementor on which to operate.
518 * @row: the zero-indexed row number of the row being selected.
520 * Select the specified row, adding it to the current row selection.
521 * Not all tables support row selection.
523 * Returns: #TRUE if the specified row was successfully selected, #FALSE if not.
526 atspi_table_add_row_selection (AtspiTable *obj,
530 dbus_int32_t d_row = row;
531 dbus_bool_t retval = FALSE;
533 g_return_val_if_fail (obj != NULL, FALSE);
535 _atspi_dbus_call (obj, atspi_interface_table, "AddRowSelection", error, "i=>b", d_row, &retval);
541 * atspi_table_add_column_selection:
542 * @obj: a pointer to the #AtspiTable implementor on which to operate.
543 * @column: the zero-indexed column number of the column being selected.
545 * Select the specified column, adding it to the current column selection.
546 * Not all tables support column selection.
548 * Returns: #TRUE if the specified column was successfully selected, #FALSE if not.
551 atspi_table_add_column_selection (AtspiTable *obj,
555 dbus_int32_t d_column = column;
556 dbus_bool_t retval = FALSE;
558 g_return_val_if_fail (obj != NULL, FALSE);
560 _atspi_dbus_call (obj, atspi_interface_table, "AddColumnSelection", error, "i=>b", d_column, &retval);
566 * atspi_table_remove_row_selection:
567 * @obj: a pointer to the #AtspiTable implementor on which to operate.
568 * @row: the zero-indexed number of the row being deselected.
570 * De-select the specified row, removing it to the current row selection.
571 * Not all tables support row selection.
573 * Returns: #TRUE if the specified row was successfully de-selected, #FALSE if not.
576 atspi_table_remove_row_selection (AtspiTable *obj,
580 dbus_int32_t d_row = row;
581 dbus_bool_t retval = FALSE;
583 g_return_val_if_fail (obj != NULL, FALSE);
585 _atspi_dbus_call (obj, atspi_interface_table, "RemoveRowSelection", error, "i=>b", d_row, &retval);
591 * atspi_table_remove_column_selection:
592 * @obj: a pointer to the #AtspiTable implementor on which to operate.
593 * @column: the zero-indexed column number of the column being de-selected.
595 * De-select the specified column, removing it to the current column selection.
596 * Not all tables support column selection.
598 * Returns: #TRUE if the specified column was successfully de-selected, #FALSE if not.
601 atspi_table_remove_column_selection (AtspiTable *obj,
605 dbus_int32_t d_column = column;
606 dbus_bool_t retval = FALSE;
608 g_return_val_if_fail (obj != NULL, FALSE);
610 _atspi_dbus_call (obj, atspi_interface_table, "RemoveColumnSelection", error, "i=>b", d_column, &retval);
616 * atspi_table_get_row_column_extents_at_index:
617 * @obj: a pointer to the #AtspiTable implementor on which to operate.
618 * @index: the index of the Table child whose row/column
619 * extents are requested.
620 * @row: back-filled with the first table row associated with
621 * the cell with child index \c index.
622 * @col: back-filled with the first table column associated
623 * with the cell with child index \c index.
624 * @row_extents: back-filled with the number of table rows
625 * across which child \c i extends.
626 * @col_extents: back-filled with the number of table columns
627 * across which child \c i extends.
628 * @is_selected: a boolean which is back-filled with \c True
629 * if the child at index \c i corresponds to a selected table cell,
630 * \c False otherwise.
632 * Given a child index, determine the row and column indices and
633 * extents, and whether the cell is currently selected. If
634 * the child at \c index is not a cell (for instance, if it is
635 * a summary, caption, etc.), \c False is returned.
638 * If the Table child at index '6' extends across columns 5 and 6 of
639 * row 2 of a Table instance, and is currently selected, then
641 * retval = table::getRowColumnExtentsAtIndex (6, row, col,
646 * will return True, and after the call
647 * row, col, row_extents, col_extents,
648 * and \c is_selected will contain 2, 5, 1, 2, and
649 * True, respectively.
651 * Returns: \c True if the index is associated with a valid table
652 * cell, \c False if the index does not correspond to a cell. If
653 * \c False is returned, the values of the out parameters are
657 atspi_table_get_row_column_extents_at_index (AtspiTable *obj,
658 gint index, gint *row, gint *col,
659 gint *row_extents, gint *col_extents,
660 gboolean *is_selected, GError **error)
662 dbus_int32_t d_index = index;
663 dbus_bool_t retval = FALSE;
664 dbus_int32_t d_row = 0, d_col = 0, d_row_extents = 0, d_col_extents = 0;
665 dbus_bool_t d_is_selected = FALSE;
667 g_return_val_if_fail (obj != NULL, FALSE);
669 _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);
672 *row_extents = d_row_extents;;
673 *col_extents = d_col_extents;
674 *is_selected = d_is_selected;;
681 * atspi_table_is_selected:
682 * @obj: a pointer to the #AtspiTable implementor on which to operate.
683 * @row: the zero-indexed row of the cell being queried.
684 * @column: the zero-indexed column of the cell being queried.
686 * Determine whether the cell at a specific row and column is selected.
688 * Returns: #TRUE if the specified cell is currently selected, #FALSE if not.
691 atspi_table_is_selected (AtspiTable *obj,
696 dbus_int32_t d_row = row, d_column = column;
697 dbus_bool_t retval = FALSE;
699 g_return_val_if_fail (obj != NULL, FALSE);
701 _atspi_dbus_call (obj, atspi_interface_table, "IsSelected", error, "ii=>b", d_row, d_column, &retval);
707 atspi_table_base_init (AtspiTable *klass)
712 atspi_table_get_type (void)
714 static GType type = 0;
717 static const GTypeInfo tinfo =
720 (GBaseInitFunc) atspi_table_base_init,
721 (GBaseFinalizeFunc) NULL,
724 type = g_type_register_static (G_TYPE_INTERFACE, "AtspiTable", &tinfo, 0);