1 /* ATK - Accessibility Toolkit
2 * Copyright 2001 Sun Microsystems Inc.
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the
16 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17 * Boston, MA 02111-1307, USA.
21 #include "atkmarshal.h"
33 struct _AtkTableIfaceClass
38 typedef struct _AtkTableIfaceClass AtkTableIfaceClass;
40 static void atk_table_base_init (gpointer *g_class);
42 static guint atk_table_signals[LAST_SIGNAL] = { 0 };
47 static GType type = 0;
52 sizeof (AtkTableIface),
53 (GBaseInitFunc) atk_table_base_init,
54 (GBaseFinalizeFunc) NULL,
58 type = g_type_register_static (G_TYPE_INTERFACE, "AtkTable", &tinfo, 0);
66 atk_table_base_init (gpointer *g_class)
68 static gboolean initialized = FALSE;
72 atk_table_signals[ROW_INSERTED] =
73 g_signal_new ("row_inserted",
76 G_STRUCT_OFFSET (AtkTableIface, row_inserted),
77 (GSignalAccumulator) NULL, NULL,
78 atk_marshal_VOID__INT_INT,
80 2, G_TYPE_INT, G_TYPE_INT);
81 atk_table_signals[COLUMN_INSERTED] =
82 g_signal_new ("column_inserted",
85 G_STRUCT_OFFSET (AtkTableIface, column_inserted),
86 (GSignalAccumulator) NULL, NULL,
87 atk_marshal_VOID__INT_INT,
89 2, G_TYPE_INT, G_TYPE_INT);
90 atk_table_signals[ROW_DELETED] =
91 g_signal_new ("row_deleted",
94 G_STRUCT_OFFSET (AtkTableIface, row_deleted),
95 (GSignalAccumulator) NULL, NULL,
96 atk_marshal_VOID__INT_INT,
98 2, G_TYPE_INT, G_TYPE_INT);
99 atk_table_signals[COLUMN_DELETED] =
100 g_signal_new ("column_deleted",
103 G_STRUCT_OFFSET (AtkTableIface, column_deleted),
104 (GSignalAccumulator) NULL, NULL,
105 atk_marshal_VOID__INT_INT,
107 2, G_TYPE_INT, G_TYPE_INT);
108 atk_table_signals[ROW_REORDERED] =
109 g_signal_new ("row_reordered",
112 G_STRUCT_OFFSET (AtkTableIface, row_reordered),
113 (GSignalAccumulator) NULL, NULL,
114 g_cclosure_marshal_VOID__VOID,
117 atk_table_signals[COLUMN_REORDERED] =
118 g_signal_new ("column_reordered",
121 G_STRUCT_OFFSET (AtkTableIface, column_reordered),
122 (GSignalAccumulator) NULL, NULL,
123 g_cclosure_marshal_VOID__VOID,
132 * @table: a GObject instance that implements AtkTableIface
133 * @row: a #gint representing a row in @table
134 * @column: a #gint representing a column in @table
136 * Get a reference to the table cell at @row, @column.
138 * Returns: a AtkObject* representing the referred to accessible
141 atk_table_ref_at (AtkTable *table,
145 AtkTableIface *iface;
147 g_return_val_if_fail (ATK_IS_TABLE (table), NULL);
149 iface = ATK_TABLE_GET_IFACE (table);
152 return (iface->ref_at) (table, row, column);
158 * atk_table_get_index_at:
159 * @table: a GObject instance that implements AtkTableIface
160 * @row: a #gint representing a row in @table
161 * @column: a #gint representing a column in @table
163 * Gets a #gint representing the index at the specified @row and @column.
164 * The value -1 is returned if the object at row,column is not a child
165 * of table or table does not implement this interface.
167 * Returns: a #gint representing the index at specified position
170 atk_table_get_index_at (AtkTable *table,
174 AtkTableIface *iface;
176 g_return_val_if_fail (ATK_IS_TABLE (table), -1);
177 g_return_val_if_fail (row >= 0, -1);
178 g_return_val_if_fail (column >= 0, -1);
180 iface = ATK_TABLE_GET_IFACE (table);
182 if (iface->get_index_at)
183 return (iface->get_index_at) (table, row, column);
189 * atk_table_get_row_at_index:
190 * @table: a GObject instance that implements AtkTableInterface
191 * @index: a #gint representing an index in @table
193 * Gets a #gint representing the row at the specified @index, or -1
194 * if the table does not implement this interface
196 * Returns: a gint representing the row at the specified index.
199 atk_table_get_row_at_index (AtkTable *table,
202 AtkTableIface *iface;
204 g_return_val_if_fail (ATK_IS_TABLE (table), -1);
206 iface = ATK_TABLE_GET_IFACE (table);
208 if (iface->get_row_at_index)
209 return (iface->get_row_at_index) (table, index);
215 * atk_table_get_column_at_index:
216 * @table: a GObject instance that implements AtkTableInterface
217 * @index: a #gint representing an index in @table
219 * Gets a #gint representing the column at the specified @index, or -1
220 * if the table does not implement this interface
222 * Returns: a gint representing the column at the specified index.
225 atk_table_get_column_at_index (AtkTable *table,
228 AtkTableIface *iface;
230 g_return_val_if_fail (ATK_IS_TABLE (table), 0);
232 iface = ATK_TABLE_GET_IFACE (table);
234 if (iface->get_column_at_index)
235 return (iface->get_column_at_index) (table, index);
241 * atk_table_get_caption:
242 * @table: a GObject instance that implements AtkTableInterface
244 * Gets the caption for the @table.
246 * Returns: a AtkObject* representing the table caption, or %NULL
247 * if value does not implement this interface.
250 atk_table_get_caption (AtkTable *table)
252 AtkTableIface *iface;
254 g_return_val_if_fail (ATK_IS_TABLE (table), NULL);
256 iface = ATK_TABLE_GET_IFACE (table);
258 if (iface->get_caption)
259 return (iface->get_caption) (table);
265 * atk_table_get_n_columns:
266 * @table: a GObject instance that implements AtkTableIface
268 * Gets the number of columns in the table.
270 * Returns: a gint representing the number of columns, or 0
271 * if value does not implement this interface.
274 atk_table_get_n_columns (AtkTable *table)
276 AtkTableIface *iface;
278 g_return_val_if_fail (ATK_IS_TABLE (table), 0);
280 iface = ATK_TABLE_GET_IFACE (table);
282 if (iface->get_n_columns)
283 return (iface->get_n_columns) (table);
289 * atk_table_get_column_description:
290 * @table: a GObject instance that implements AtkTableIface
291 * @column: a #gint representing a column in @table
293 * Gets the description text of the specified @column in the table
295 * Returns: a gchar* representing the column description, or %NULL
296 * if value does not implement this interface.
298 G_CONST_RETURN gchar*
299 atk_table_get_column_description (AtkTable *table,
302 AtkTableIface *iface;
304 g_return_val_if_fail (ATK_IS_TABLE (table), NULL);
306 iface = ATK_TABLE_GET_IFACE (table);
308 if (iface->get_column_description)
309 return (iface->get_column_description) (table, column);
315 * atk_table_get_column_extent_at:
316 * @table: a GObject instance that implements AtkTableIface
317 * @row: a #gint representing a row in @table
318 * @column: a #gint representing a column in @table
320 * Gets the number of columns occupied by the accessible object
321 * at the specified @row and @column in the @table.
323 * Returns: a gint representing the column extent at specified position, or 0
324 * if value does not implement this interface.
327 atk_table_get_column_extent_at (AtkTable *table,
331 AtkTableIface *iface;
333 g_return_val_if_fail (ATK_IS_TABLE (table), 0);
335 iface = ATK_TABLE_GET_IFACE (table);
337 if (iface->get_column_extent_at)
338 return (iface->get_column_extent_at) (table, row, column);
344 * atk_table_get_column_header:
345 * @table: a GObject instance that implements AtkTableIface
346 * @column: a #gint representing a column in the table
348 * Gets the column header of a specified column in an accessible table.
350 * Returns: a AtkObject* representing the specified column header, or
351 * %NULL if value does not implement this interface.
354 atk_table_get_column_header (AtkTable *table, gint column)
356 AtkTableIface *iface;
358 g_return_val_if_fail (ATK_IS_TABLE (table), NULL);
360 iface = ATK_TABLE_GET_IFACE (table);
362 if (iface->get_column_header)
363 return (iface->get_column_header) (table, column);
369 * atk_table_get_n_rows:
370 * @table: a GObject instance that implements AtkTableIface
372 * Gets the number of rows in the table.
374 * Returns: a gint representing the number of rows, or 0
375 * if value does not implement this interface.
378 atk_table_get_n_rows (AtkTable *table)
380 AtkTableIface *iface;
382 g_return_val_if_fail (ATK_IS_TABLE (table), 0);
384 iface = ATK_TABLE_GET_IFACE (table);
386 if (iface->get_n_rows)
387 return (iface->get_n_rows) (table);
393 * atk_table_get_row_description:
394 * @table: a GObject instance that implements AtkTableIface
395 * @row: a #gint representing a row in @table
397 * Gets the description text of the specified row in the table
399 * Returns: a gchar* representing the row description, or %NULL
400 * if value does not implement this interface.
402 G_CONST_RETURN gchar*
403 atk_table_get_row_description (AtkTable *table,
406 AtkTableIface *iface;
408 g_return_val_if_fail (ATK_IS_TABLE (table), NULL);
410 iface = ATK_TABLE_GET_IFACE (table);
412 if (iface->get_row_description)
413 return (iface->get_row_description) (table, row);
419 * atk_table_get_row_extent_at:
420 * @table: a GObject instance that implements AtkTableIface
421 * @row: a #gint representing a row in @table
422 * @column: a #gint representing a column in @table
424 * Gets the number of rows occupied by the accessible object
425 * at a specified @row and @column in the @table.
427 * Returns: a gint representing the row extent at specified position, or 0
428 * if value does not implement this interface.
431 atk_table_get_row_extent_at (AtkTable *table,
435 AtkTableIface *iface;
437 g_return_val_if_fail (ATK_IS_TABLE (table), 0);
439 iface = ATK_TABLE_GET_IFACE (table);
441 if (iface->get_row_extent_at)
442 return (iface->get_row_extent_at) (table, row, column);
448 * atk_table_get_row_header:
449 * @table: a GObject instance that implements AtkTableIface
450 * @row: a #gint representing a row in the table
452 * Gets the row header of a specified row in an accessible table.
454 * Returns: a AtkObject* representing the specified row header, or
455 * %NULL if value does not implement this interface.
458 atk_table_get_row_header (AtkTable *table, gint row)
460 AtkTableIface *iface;
462 g_return_val_if_fail (ATK_IS_TABLE (table), NULL);
464 iface = ATK_TABLE_GET_IFACE (table);
466 if (iface->get_row_header)
467 return (iface->get_row_header) (table, row);
473 * atk_table_get_summary:
474 * @table: a GObject instance that implements AtkTableIface
476 * Gets the summary description of the table.
478 * Returns: a AtkObject* representing a summary description of the table,
479 * or zero if value does not implement this interface.
482 atk_table_get_summary (AtkTable *table)
484 AtkTableIface *iface;
486 g_return_val_if_fail (ATK_IS_TABLE (table), NULL);
488 iface = ATK_TABLE_GET_IFACE (table);
490 if (iface->get_summary)
491 return (iface->get_summary) (table);
497 * atk_table_get_selected_rows:
498 * @table: a GObject instance that implements AtkTableIface
499 * @selected: a #gint** that is to contain the selected row numbers
501 * Gets the selected rows of the table by initializing **selected with
502 * the selected row numbers. This array should be freed by the caller.
504 * Returns: a gint representing the number of selected rows,
505 * or zero if value does not implement this interface.
508 atk_table_get_selected_rows (AtkTable *table, gint **selected)
510 AtkTableIface *iface;
512 g_return_val_if_fail (ATK_IS_TABLE (table), 0);
514 iface = ATK_TABLE_GET_IFACE (table);
516 if (iface->get_selected_rows)
517 return (iface->get_selected_rows) (table, selected);
523 * atk_table_get_selected_columns:
524 * @table: a GObject instance that implements AtkTableIface
525 * @selected: a #gint** that is to contain the selected columns numbers
527 * Gets the selected columns of the table by initializing **selected with
528 * the selected column numbers. This array should be freed by the caller.
530 * Returns: a gint representing the number of selected columns,
531 * or %0 if value does not implement this interface.
534 atk_table_get_selected_columns (AtkTable *table, gint **selected)
536 AtkTableIface *iface;
538 g_return_val_if_fail (ATK_IS_TABLE (table), 0);
540 iface = ATK_TABLE_GET_IFACE (table);
542 if (iface->get_selected_columns)
543 return (iface->get_selected_columns) (table, selected);
549 * atk_table_is_column_selected:
550 * @table: a GObject instance that implements AtkTableIface
551 * @column: a #gint representing a column in @table
553 * Gets a boolean value indicating whether the specified @column
556 * Returns: a gboolean representing if the column is selected, or 0
557 * if value does not implement this interface.
560 atk_table_is_column_selected (AtkTable *table,
563 AtkTableIface *iface;
565 g_return_val_if_fail (ATK_IS_TABLE (table), FALSE);
567 iface = ATK_TABLE_GET_IFACE (table);
569 if (iface->is_column_selected)
570 return (iface->is_column_selected) (table, column);
576 * atk_table_is_row_selected:
577 * @table: a GObject instance that implements AtkTableIface
578 * @row: a #gint representing a row in @table
580 * Gets a boolean value indicating whether the specified @row
583 * Returns: a gboolean representing if the row is selected, or 0
584 * if value does not implement this interface.
587 atk_table_is_row_selected (AtkTable *table,
590 AtkTableIface *iface;
592 g_return_val_if_fail (ATK_IS_TABLE (table), FALSE);
594 iface = ATK_TABLE_GET_IFACE (table);
596 if (iface->is_row_selected)
597 return (iface->is_row_selected) (table, row);
603 * atk_table_is_selected:
604 * @table: a GObject instance that implements AtkTableIface
605 * @row: a #gint representing a row in @table
606 * @column: a #gint representing a column in @table
608 * Gets a boolean value indicating whether the accessible object
609 * at the specified @row and @column is selected
611 * Returns: a gboolean representing if the cell is selected, or 0
612 * if value does not implement this interface.
615 atk_table_is_selected (AtkTable *table,
619 AtkTableIface *iface;
621 g_return_val_if_fail (ATK_IS_TABLE (table), FALSE);
623 iface = ATK_TABLE_GET_IFACE (table);
625 if (iface->is_selected)
626 return (iface->is_selected) (table, row, column);
632 * atk_table_add_row_selection:
633 * @table: a GObject instance that implements AtkTableIface
634 * @row: a #gint representing a row in @table
636 * Adds the specified @row to the selection.
638 * Returns: a gboolean representing if row was successfully added to selection,
639 * or 0 if value does not implement this interface.
642 atk_table_add_row_selection (AtkTable *table,
645 AtkTableIface *iface;
647 g_return_val_if_fail (ATK_IS_TABLE (table), FALSE);
649 iface = ATK_TABLE_GET_IFACE (table);
651 if (iface->add_row_selection)
652 return (iface->add_row_selection) (table, row);
657 * atk_table_remove_row_selection:
658 * @table: a GObject instance that implements AtkTableIface
659 * @row: a #gint representing a row in @table
661 * Removes the specified @row from the selection.
663 * Returns: a gboolean representing if the row was successfully removed from
664 * the selection, or 0 if value does not implement this interface.
667 atk_table_remove_row_selection (AtkTable *table,
670 AtkTableIface *iface;
672 g_return_val_if_fail (ATK_IS_TABLE (table), FALSE);
674 iface = ATK_TABLE_GET_IFACE (table);
676 if (iface->remove_row_selection)
677 return (iface->remove_row_selection) (table, row);
682 * atk_table_add_column_selection:
683 * @table: a GObject instance that implements AtkTableIface
684 * @column: a #gint representing a column in @table
686 * Adds the specified @column to the selection.
688 * Returns: a gboolean representing if the column was successfully added to
689 * the selection, or 0 if value does not implement this interface.
692 atk_table_add_column_selection (AtkTable *table,
695 AtkTableIface *iface;
697 g_return_val_if_fail (ATK_IS_TABLE (table), FALSE);
699 iface = ATK_TABLE_GET_IFACE (table);
701 if (iface->add_column_selection)
702 return (iface->add_column_selection) (table, column);
707 * atk_table_remove_column_selection:
708 * @table: a GObject instance that implements AtkTableIface
709 * @column: a #gint representing a column in @table
711 * Adds the specified @column to the selection.
713 * Returns: a gboolean representing if the column was successfully removed from
714 * the selection, or 0 if value does not implement this interface.
717 atk_table_remove_column_selection (AtkTable *table,
720 AtkTableIface *iface;
722 g_return_val_if_fail (ATK_IS_TABLE (table), FALSE);
724 iface = ATK_TABLE_GET_IFACE (table);
726 if (iface->remove_column_selection)
727 return (iface->remove_column_selection) (table, column);
733 * atk_table_set_caption:
734 * @table: a GObject instance that implements AtkTableIface
735 * @caption: a #AtkObject representing the caption to set for @table
737 * Sets the caption for the table.
740 atk_table_set_caption (AtkTable *table,
743 AtkTableIface *iface;
745 g_return_if_fail (ATK_IS_TABLE (table));
747 iface = ATK_TABLE_GET_IFACE (table);
749 if (iface->set_caption)
750 (iface->set_caption) (table, caption);
754 * atk_table_set_column_description:
755 * @table: a GObject instance that implements AtkTableIface
756 * @column: a #gint representing a column in @table
757 * @description: a #gchar representing the description text
758 * to set for the specified @column of the @table
760 * Sets the description text for the specified @column of the @table.
763 atk_table_set_column_description (AtkTable *table,
765 const gchar *description)
767 AtkTableIface *iface;
769 g_return_if_fail (ATK_IS_TABLE (table));
771 iface = ATK_TABLE_GET_IFACE (table);
773 if (iface->set_column_description)
774 (iface->set_column_description) (table, column, description);
778 * atk_table_set_column_header:
779 * @table: a GObject instance that implements AtkTableIface
780 * @column: a #gint representing a column in @table
781 * @header: an #AtkTable
783 * Sets the specified column header to @header.
786 atk_table_set_column_header (AtkTable *table,
790 AtkTableIface *iface;
792 g_return_if_fail (ATK_IS_TABLE (table));
794 iface = ATK_TABLE_GET_IFACE (table);
796 if (iface->set_column_header)
797 (iface->set_column_header) (table, column, header);
801 * atk_table_set_row_description:
802 * @table: a GObject instance that implements AtkTableIface
803 * @row: a #gint representing a row in @table
804 * @description: a #gchar representing the description text
805 * to set for the specified @row of @table
807 * Sets the description text for the specified @row of @table.
810 atk_table_set_row_description (AtkTable *table,
812 const gchar *description)
814 AtkTableIface *iface;
816 g_return_if_fail (ATK_IS_TABLE (table));
818 iface = ATK_TABLE_GET_IFACE (table);
820 if (iface->set_row_description)
821 (iface->set_row_description) (table, row, description);
825 * atk_table_set_row_header:
826 * @table: a GObject instance that implements AtkTableIface
827 * @row: a #gint representing a row in @table
828 * @header: an #AtkTable
830 * Sets the specified row header to @header.
833 atk_table_set_row_header (AtkTable *table,
837 AtkTableIface *iface;
839 g_return_if_fail (ATK_IS_TABLE (table));
841 iface = ATK_TABLE_GET_IFACE (table);
843 if (iface->set_row_header)
844 (iface->set_row_header) (table, row, header);
848 * atk_table_set_summary:
849 * @table: a GObject instance that implements AtkTableIface
850 * @accessible: an #AtkObject representing the summary description
853 * Sets the summary description of the table.
856 atk_table_set_summary (AtkTable *table,
857 AtkObject *accessible)
859 AtkTableIface *iface;
861 g_return_if_fail (ATK_IS_TABLE (table));
863 iface = ATK_TABLE_GET_IFACE (table);
865 if (iface->set_summary)
866 (iface->set_summary) (table, accessible);