2 * AT-SPI - Assistive Technology Service Provider Interface
3 * (Gnome Accessibility Project; http://developer.gnome.org/projects/gap)
5 * Copyright 2001 Sun Microsystems Inc.
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Library General Public License for more details.
17 * You should have received a copy of the GNU Library General Public
18 * License along with this library; if not, write to the
19 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
20 * Boston, MA 02111-1307, USA.
23 #include <stdlib.h> /* for malloc */
24 #include <cspi/spi-private.h>
27 * AccessibleTable_ref:
28 * @obj: a pointer to the #AccessibleTable implementor on which to operate.
30 * Increment the reference count for an #AccessibleTable object.
33 AccessibleTable_ref (AccessibleTable *obj)
35 cspi_object_ref (obj);
39 * AccessibleTable_unref:
40 * @obj: a pointer to the #AccessibleTable implementor on which to operate.
42 * Decrement the reference count for an #AccessibleTable object.
45 AccessibleTable_unref (AccessibleTable *obj)
47 cspi_object_unref (obj);
51 * AccessibleTable_getCaption:
52 * @obj: a pointer to the #AccessibleTable implementor on which to operate.
54 * Get an accessible representation of the caption for an #AccessibleTable.
56 * Returns: an #Accessible object that serves as the table's caption.
59 AccessibleTable_getCaption (AccessibleTable *obj)
63 cspi_return_val_if_fail (obj != NULL, NULL);
65 retval = cspi_object_add (
66 Accessibility_Table__get_caption (CSPI_OBJREF (obj), cspi_ev ()));
67 cspi_return_val_if_ev ("getCaption", NULL);
72 * AccessibleTable_getSummary:
73 * @obj: a pointer to the #AccessibleTable implementor on which to operate.
75 * Get an accessible object which summarizes the contents of an #AccessibleTable.
77 * Returns: an #Accessible object that serves as the table's summary (often a
78 * reduced #AccessibleTable).
81 AccessibleTable_getSummary (AccessibleTable *obj)
85 cspi_return_val_if_fail (obj != NULL, NULL);
87 retval = cspi_object_add (
88 Accessibility_Table__get_summary (CSPI_OBJREF (obj), cspi_ev ()));
89 cspi_return_val_if_ev ("getSummary", NULL);
94 * AccessibleTable_getNRows:
95 * @obj: a pointer to the #AccessibleTable implementor on which to operate.
97 * Get the number of rows in an #AccessibleTable,
98 * exclusive of any rows that are programmatically hidden, but inclusive
99 * of rows that may be outside of the current scrolling window or viewport.
101 * Returns: a #long integer indicating the number of rows in the table.
104 AccessibleTable_getNRows (AccessibleTable *obj)
108 cspi_return_val_if_fail (obj != NULL, -1);
111 Accessibility_Table__get_nRows (CSPI_OBJREF (obj), cspi_ev ());
113 cspi_return_val_if_ev ("getNRows", -1);
120 * AccessibleTable_getNColumns:
121 * @obj: a pointer to the #AccessibleTable implementor on which to operate.
123 * Get the number of columns in an #AccessibleTable,
124 * exclusive of any columns that are programmatically hidden, but inclusive
125 * of columns that may be outside of the current scrolling window or viewport.
127 * Returns: a #long integer indicating the number of columns in the table.
130 AccessibleTable_getNColumns (AccessibleTable *obj)
134 cspi_return_val_if_fail (obj != NULL, -1);
137 Accessibility_Table__get_nColumns (CSPI_OBJREF (obj), cspi_ev ());
139 cspi_return_val_if_ev ("getNColumns", -1);
145 * AccessibleTable_getAccessibleAt:
146 * @obj: a pointer to the #AccessibleTable implementor on which to operate.
147 * @row: the specified table row, zero-indexed.
148 * @column: the specified table column, zero-indexed.
150 * Get the table cell at the specified row and column indices.
151 * To get the accessible object at a particular (x, y) screen coordinate,
152 * use #Accessible_getAccessibleAtPoint ().
154 * Returns: an #Accessible object representing the specified table cell.
157 AccessibleTable_getAccessibleAt (AccessibleTable *obj,
163 cspi_return_val_if_fail (obj != NULL, NULL);
165 retval = cspi_object_add (
166 Accessibility_Table_getAccessibleAt (
167 CSPI_OBJREF (obj), row,
168 column, cspi_ev ()));
169 cspi_return_val_if_ev ("getAccessibleAt", NULL);
174 * AccessibleTable_getIndexAt:
175 * @obj: a pointer to the #AccessibleTable implementor on which to operate.
176 * @row: the specified table row, zero-indexed.
177 * @column: the specified table column, zero-indexed.
179 * Get the 1-D child index corresponding to the specified 2-D row and column indices.
180 * To get the accessible object at a particular (x, y) screen coordinate,
181 * use #Accessible_getAccessibleAtPoint ().
182 * @see #AccessibleTable_getRowAtIndex(), #AccessibleTable_getColumnAtIndex()
184 * Returns: a long integer which serves as the index of a specified cell in the
185 * table, in a form usable by #Accessible_getChildAtIndex().
188 AccessibleTable_getIndexAt (AccessibleTable *obj,
194 cspi_return_val_if_fail (obj != NULL, -1);
197 Accessibility_Table_getIndexAt (
198 CSPI_OBJREF (obj), row,
201 cspi_return_val_if_ev ("getIndexAt", -1);
207 * AccessibleTable_getRowAtIndex:
208 * @obj: a pointer to the #AccessibleTable implementor on which to operate.
209 * @index: the specified child index, zero-indexed.
211 * Get the table row index occupied by the child at a particular 1-D child index.
213 * @see #AccessibleTable_getIndexAt(), #AccessibleTable_getColumnAtIndex()
215 * Returns: a long integer indicating the first row spanned by the child of a
216 * table, at the specified 1-D (zero-offset) @index.
219 AccessibleTable_getRowAtIndex (AccessibleTable *obj,
224 cspi_return_val_if_fail (obj != NULL, -1);
227 Accessibility_Table_getRowAtIndex (CSPI_OBJREF (obj),
230 cspi_return_val_if_ev ("getRowAtIndex", -1);
236 * AccessibleTable_getColumnAtIndex:
237 * @obj: a pointer to the #AccessibleTable implementor on which to operate.
238 * @index: the specified child index, zero-indexed.
240 * Get the table column index occupied by the child at a particular 1-D child index.
242 * @see #AccessibleTable_getIndexAt(), #AccessibleTable_getRowAtIndex()
244 * Returns: a long integer indicating the first column spanned by the child of a
245 * table, at the specified 1-D (zero-offset) @index.
248 AccessibleTable_getColumnAtIndex (AccessibleTable *obj,
253 cspi_return_val_if_fail (obj != NULL, -1);
256 Accessibility_Table_getColumnAtIndex (CSPI_OBJREF (obj),
259 cspi_return_val_if_ev ("getColumnAtIndex", -1);
265 * AccessibleTable_getRowDescription:
266 * @obj: a pointer to the #AccessibleTable implementor on which to operate.
267 * @row: the specified table row, zero-indexed.
269 * Get a text description of a particular table row. This differs from
270 * AccessibleTable_getRowHeader, which returns an #Accessible.
272 * Returns: a UTF-8 string describing the specified table row, if available.
275 AccessibleTable_getRowDescription (AccessibleTable *obj,
280 cspi_return_val_if_fail (obj != NULL, NULL);
283 Accessibility_Table_getRowDescription (CSPI_OBJREF (obj),
286 cspi_return_val_if_ev ("getRowDescription", NULL);
292 * AccessibleTable_getColumnDescription:
293 * @obj: a pointer to the #AccessibleTable implementor on which to operate.
294 * @column: the specified table column, zero-indexed.
296 * Get a text description of a particular table column. This differs from
297 * AccessibleTable_getColumnHeader, which returns an #Accessible.
299 * Returns: a UTF-8 string describing the specified table column, if available.
302 AccessibleTable_getColumnDescription (AccessibleTable *obj,
307 cspi_return_val_if_fail (obj != NULL, NULL);
310 Accessibility_Table_getColumnDescription (CSPI_OBJREF (obj),
313 cspi_return_val_if_ev ("getColumnDescription", NULL);
319 * AccessibleTable_getRowExtentAt:
320 * @obj: a pointer to the #AccessibleTable implementor on which to operate.
321 * @row: the specified table row, zero-indexed.
322 * @column: the specified table column, zero-indexed.
324 * Get the number of rows spanned by the table cell at the specific row and column.
325 * (some tables can have cells which span multiple rows and/or columns).
327 * Returns: a long integer indicating the number of rows spanned by the specified cell.
330 AccessibleTable_getRowExtentAt (AccessibleTable *obj,
336 cspi_return_val_if_fail (obj != NULL, -1);
339 Accessibility_Table_getRowExtentAt (
340 CSPI_OBJREF (obj), row,
343 cspi_return_val_if_ev ("getRowExtentAt", -1);
349 * AccessibleTable_getColumnExtentAt:
350 * @obj: a pointer to the #AccessibleTable implementor on which to operate.
351 * @row: the specified table row, zero-indexed.
352 * @column: the specified table column, zero-indexed.
354 * Get the number of columns spanned by the table cell at the specific row and column.
355 * (some tables can have cells which span multiple rows and/or columns).
357 * Returns: a long integer indicating the number of columns spanned by the specified cell.
360 AccessibleTable_getColumnExtentAt (AccessibleTable *obj,
366 cspi_return_val_if_fail (obj != NULL, -1);
369 Accessibility_Table_getColumnExtentAt (
370 CSPI_OBJREF (obj), row,
373 cspi_return_val_if_ev ("getColumnExtentAt", -1);
379 * AccessibleTable_getRowHeader:
380 * @obj: a pointer to the #AccessibleTable implementor on which to operate.
381 * @row: the specified table row, zero-indexed.
383 * Get the header associated with a table row, if available. This differs from
384 * AccessibleTable_getRowDescription, which returns a string.
386 * Returns: a #Accessible representatin of the specified table row, if available.
389 AccessibleTable_getRowHeader (AccessibleTable *obj,
394 cspi_return_val_if_fail (obj != NULL, NULL);
396 retval = cspi_object_add (
397 Accessibility_Table_getRowHeader (CSPI_OBJREF (obj),
399 cspi_return_val_if_ev ("getRowHeader", NULL);
405 * AccessibleTable_getColumnHeader:
406 * @obj: a pointer to the #AccessibleTable implementor on which to operate.
407 * @column: the specified table column, zero-indexed.
409 * Get the header associated with a table column, if available. This differs from
410 * AccessibleTable_getColumnDescription, which returns a string.
412 * Returns: a #Accessible representatin of the specified table column, if available.
415 AccessibleTable_getColumnHeader (AccessibleTable *obj,
420 cspi_return_val_if_fail (obj != NULL, NULL);
422 retval = cspi_object_add (
423 Accessibility_Table_getColumnHeader (CSPI_OBJREF (obj),
424 column, cspi_ev ()));
425 cspi_return_val_if_ev ("getColumnHeader", NULL);
431 * AccessibleTable_getNSelectedRows:
432 * @obj: a pointer to the #AccessibleTable implementor on which to operate.
434 * Query a table to find out how many rows are currently selected. Not all tables
435 * support row selection.
437 * Returns: a long integer indicating the number of rows currently selected.
440 AccessibleTable_getNSelectedRows (AccessibleTable *obj)
444 cspi_return_val_if_fail (obj != NULL, -1);
447 Accessibility_Table__get_nSelectedRows (CSPI_OBJREF (obj), cspi_ev ());
449 cspi_return_val_if_ev ("getNSelectedRows", -1);
455 cspi_long_seq_to_array (Accessibility_LongSeq *seq, long int **array)
460 if (!cspi_check_ev ("getSelectionItems"))
466 length = seq->_length;
468 j = *array = malloc (sizeof (long) * length);
470 for (i = 0; i < length; i++)
472 j[i] = seq->_buffer [i];
481 * AccessibleTable_getSelectedRows:
482 * @obj: a pointer to the #AccessibleTable implementor on which to operate.
483 * @selectedRows: a doubly indirected pointer which will be set to the address
484 * of an array of long integers, specifying which rows are currently selected.
486 * Query a table for a list of indices of rows which are currently selected.
488 * Returns: a long integer indicating the length of the array returned in @selectedRows.
491 AccessibleTable_getSelectedRows (AccessibleTable *obj,
492 long int **selectedRows)
494 Accessibility_LongSeq *rows;
496 *selectedRows = NULL;
498 cspi_return_val_if_fail (obj != NULL, 0);
500 rows = Accessibility_Table_getSelectedRows (CSPI_OBJREF (obj), cspi_ev ());
502 cspi_return_val_if_ev ("getSelectedRows", -1);
504 return cspi_long_seq_to_array (rows, selectedRows);
508 * AccessibleTable_getNSelectedColumns:
509 * @obj: a pointer to the #AccessibleTable implementor on which to operate.
511 * Query a table to find out how many columnss are currently selected. Not all tables
512 * support column selection.
514 * Returns: a long integer indicating the number of columns currently selected.
517 AccessibleTable_getNSelectedColumns (AccessibleTable *obj)
521 cspi_return_val_if_fail (obj != NULL, -1);
524 Accessibility_Table__get_nSelectedColumns (CSPI_OBJREF (obj), cspi_ev ());
526 cspi_return_val_if_ev ("getNSelectedColumns", -1);
532 * AccessibleTable_getSelectedColumns:
533 * @obj: a pointer to the #AccessibleTable implementor on which to operate.
534 * @selectedColumns: a doubly indirected pointer which will be set to the address
535 * of an array of long integers, specifying which columns are currently selected.
537 * Query a table for a list of indices of columns which are currently selected.
538 * Not all tables support column selection.
540 * Returns: a long integer indicating the length of the array returned in @selectedColumns.
543 AccessibleTable_getSelectedColumns (AccessibleTable *obj,
544 long int **selectedColumns)
546 Accessibility_LongSeq *columns;
548 *selectedColumns = NULL;
550 cspi_return_val_if_fail (obj != NULL, 0);
552 columns = Accessibility_Table_getSelectedColumns (CSPI_OBJREF (obj), cspi_ev ());
554 cspi_return_val_if_ev ("getSelectedColumns", -1);
555 return cspi_long_seq_to_array (columns, selectedColumns);
559 * AccessibleTable_isRowSelected:
560 * @obj: a pointer to the #AccessibleTable implementor on which to operate.
563 * Determine whether a table row is selected. Not all tables support row selection.
565 * Returns: #TRUE if the specified row is currently selected, #FALSE if not.
568 AccessibleTable_isRowSelected (AccessibleTable *obj,
573 cspi_return_val_if_fail (obj != NULL, FALSE);
576 Accessibility_Table_isRowSelected (CSPI_OBJREF (obj),
579 cspi_return_val_if_ev ("isRowSelected", FALSE);
585 * AccessibleTable_isColumnSelected:
586 * @obj: a pointer to the #AccessibleTable implementor on which to operate.
589 * Determine whether specified table column is selected.
590 * Not all tables support column selection.
592 * Returns: #TRUE if the specified column is currently selected, #FALSE if not.
595 AccessibleTable_isColumnSelected (AccessibleTable *obj,
600 cspi_return_val_if_fail (obj != NULL, FALSE);
603 Accessibility_Table_isColumnSelected (CSPI_OBJREF (obj),
606 cspi_return_val_if_ev ("isColumnSelected", FALSE);
612 * AccessibleTable_addRowSelection:
613 * @obj: a pointer to the #AccessibleTable implementor on which to operate.
616 * Select the specified row, adding it to the current row selection.
617 * Not all tables support row selection.
619 * Returns: #TRUE if the specified row was successfully selected, #FALSE if not.
622 AccessibleTable_addRowSelection (AccessibleTable *obj,
627 cspi_return_val_if_fail (obj != NULL, FALSE);
630 Accessibility_Table_addRowSelection (CSPI_OBJREF (obj),
633 cspi_return_val_if_ev ("addRowSelection", FALSE);
639 * AccessibleTable_addColumnSelection:
640 * @obj: a pointer to the #AccessibleTable implementor on which to operate.
643 * Select the specified column, adding it to the current column selection.
644 * Not all tables support column selection.
646 * Returns: #TRUE if the specified column was successfully selected, #FALSE if not.
649 AccessibleTable_addColumnSelection (AccessibleTable *obj,
654 cspi_return_val_if_fail (obj != NULL, FALSE);
657 Accessibility_Table_addColumnSelection (CSPI_OBJREF (obj),
660 cspi_return_val_if_ev ("addColumnSelection", FALSE);
666 * AccessibleTable_removeRowSelection:
667 * @obj: a pointer to the #AccessibleTable implementor on which to operate.
670 * De-select the specified row, removing it to the current row selection.
671 * Not all tables support row selection.
673 * Returns: #TRUE if the specified row was successfully de-selected, #FALSE if not.
676 AccessibleTable_removeRowSelection (AccessibleTable *obj,
681 cspi_return_val_if_fail (obj != NULL, FALSE);
684 Accessibility_Table_removeRowSelection (CSPI_OBJREF (obj),
687 cspi_return_val_if_ev ("removeRowSelection", FALSE);
693 * AccessibleTable_removeColumnSelection:
694 * @obj: a pointer to the #AccessibleTable implementor on which to operate.
697 * De-select the specified column, removing it to the current column selection.
698 * Not all tables support column selection.
700 * Returns: #TRUE if the specified column was successfully de-selected, #FALSE if not.
703 AccessibleTable_removeColumnSelection (AccessibleTable *obj,
708 cspi_return_val_if_fail (obj != NULL, FALSE);
711 Accessibility_Table_removeColumnSelection (CSPI_OBJREF (obj),
714 cspi_return_val_if_ev ("removeColumnSelection", FALSE);
720 * AccessibleTable_isSelected:
721 * @obj: a pointer to the #AccessibleTable implementor on which to operate.
725 * Determine whether the cell at a specific row and column is selected.
727 * Returns: #TRUE if the specified cell is currently selected, #FALSE if not.
730 AccessibleTable_isSelected (AccessibleTable *obj,
736 cspi_return_val_if_fail (obj != NULL, FALSE);
739 Accessibility_Table_isSelected (CSPI_OBJREF (obj),
743 cspi_return_val_if_ev ("isSelected", FALSE);