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_newc ("row_inserted",
76 G_STRUCT_OFFSET (AtkTableIface, model_changed),
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_newc ("column_inserted",
85 G_STRUCT_OFFSET (AtkTableIface, model_changed),
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_newc ("row_deleted",
94 G_STRUCT_OFFSET (AtkTableIface, model_changed),
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_newc ("column_deleted",
103 G_STRUCT_OFFSET (AtkTableIface, model_changed),
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_newc ("row_reordered",
112 G_STRUCT_OFFSET (AtkTableIface, model_changed),
113 (GSignalAccumulator) NULL, NULL,
114 atk_marshal_VOID__INT_INT,
117 atk_table_signals[COLUMN_REORDERED] =
118 g_signal_newc ("column_reordered",
121 G_STRUCT_OFFSET (AtkTableIface, model_changed),
122 (GSignalAccumulator) NULL, NULL,
123 atk_marshal_VOID__INT_INT,
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 *obj,
145 AtkTableIface *iface;
147 g_return_val_if_fail (obj != NULL, NULL);
148 g_return_val_if_fail (ATK_IS_TABLE (obj), NULL);
150 iface = ATK_TABLE_GET_IFACE (obj);
153 return (iface->ref_at) (obj, row, column);
159 * atk_table_get_index_at:
160 * @table: a GObject instance that implements AtkTableIface
161 * @row: a #gint representing a row in @table
162 * @column: a #gint representing a column in @table
164 * Gets a #gint representing the index at the specified @row and @column,
165 * or 0 if value does not implement this interface.
166 * Note: callers should not rely on %NULL or on a zero value for
167 * indication of whether AtkSelectionIface is implemented, they should
168 * use type checking/interface checking macros or the
169 * atk_get_accessible_table() convenience method.
171 * Returns: a #gint representing the index at specified position, or 0
172 * if value does not implement this interface.
175 atk_table_get_index_at (AtkTable *obj,
179 AtkTableIface *iface;
181 g_return_val_if_fail (obj != NULL, 0);
182 g_return_val_if_fail (ATK_IS_TABLE (obj), 0);
184 iface = ATK_TABLE_GET_IFACE (obj);
186 if (iface->get_index_at)
187 return (iface->get_index_at) (obj, row, column);
193 * atk_table_get_row_at_index:
194 * @table: a GObject instance that implements AtkTableInterface
195 * @index: a #gint representing an index in @table
197 * Gets a #gint representing the row at the specified @index, or 0
198 * if the value does not implement this interface
199 * Note: callers should not rely on %NULL or on a zero value for
200 * indication of whether AtkSelectionIface is implemented, they should
201 * use type checking/interface checking macros or the
202 * atk_get_accessible_table() convenience method.
204 * Returns: a gint representing the row at the specified index, or 0
205 * if value does not implement this interface.
208 atk_table_get_row_at_index (AtkTable *obj,
211 AtkTableIface *iface;
213 g_return_val_if_fail (obj != NULL, 0);
214 g_return_val_if_fail (ATK_IS_TABLE (obj), 0);
216 iface = ATK_TABLE_GET_IFACE (obj);
218 if (iface->get_row_at_index)
219 return (iface->get_row_at_index) (obj, index);
225 * atk_table_get_column_at_index:
226 * @table: a GObject instance that implements AtkTableInterface
227 * @index: a #gint representing an index in @table
229 * Gets a #gint representing the column at the specified @index, or 0
230 * if the value does not implement this interface
231 * Note: callers should not rely on %NULL or on a zero value for
232 * indication of whether AtkSelectionIface is implemented, they should
233 * use type checking/interface checking macros or the
234 * atk_get_accessible_table() convenience method.
236 * Returns: a gint representing the column at the specified index, or 0
237 * if value does not implement this interface.
240 atk_table_get_column_at_index (AtkTable *obj,
243 AtkTableIface *iface;
245 g_return_val_if_fail (obj != NULL, 0);
246 g_return_val_if_fail (ATK_IS_TABLE (obj), 0);
248 iface = ATK_TABLE_GET_IFACE (obj);
250 if (iface->get_column_at_index)
251 return (iface->get_column_at_index) (obj, index);
257 * atk_table_get_caption:
258 * @table: a GObject instance that implements AtkTableInterface
260 * Gets the caption for the @table.
261 * Note: callers should not rely on %NULL or on a zero value for
262 * indication of whether AtkSelectionIface is implemented, they should
263 * use type checking/interface checking macros or the
264 * atk_get_accessible_table() convenience method.
266 * Returns: a gchar* representing the table caption, or %NULL
267 * if value does not implement this interface.
270 atk_table_get_caption (AtkTable *obj)
272 AtkTableIface *iface;
274 g_return_val_if_fail (obj != NULL, NULL);
275 g_return_val_if_fail (ATK_IS_TABLE (obj), NULL);
277 iface = ATK_TABLE_GET_IFACE (obj);
279 if (iface->get_caption)
280 return (iface->get_caption) (obj);
286 * atk_table_get_n_columns:
287 * @table: a GObject instance that implements AtkTableIface
289 * Gets the number of columns in the table.
290 * Note: callers should not rely on %NULL or on a zero value for
291 * indication of whether AtkSelectionIface is implemented, they should
292 * use type checking/interface checking macros or the
293 * atk_get_accessible_table() convenience method.
295 * Returns: a gint representing the number of columns, or 0
296 * if value does not implement this interface.
299 atk_table_get_n_columns (AtkTable *obj)
301 AtkTableIface *iface;
303 g_return_val_if_fail (obj != NULL, 0);
304 g_return_val_if_fail (ATK_IS_TABLE (obj), 0);
306 iface = ATK_TABLE_GET_IFACE (obj);
308 if (iface->get_n_columns)
309 return (iface->get_n_columns) (obj);
315 * atk_table_get_column_description:
316 * @table: a GObject instance that implements AtkTableIface
317 * @column: a #gint representing a column in @table
319 * Gets the description text of the specified @column in the table
320 * Note: callers should not rely on %NULL or on a zero value for
321 * indication of whether AtkSelectionIface is implemented, they should
322 * use type checking/interface checking macros or the
323 * atk_get_accessible_table() convenience method.
325 * Returns: a gchar* representing the column description, or %NULL
326 * if value does not implement this interface.
329 atk_table_get_column_description (AtkTable *obj,
332 AtkTableIface *iface;
334 g_return_val_if_fail (obj != NULL, NULL);
335 g_return_val_if_fail (ATK_IS_TABLE (obj), NULL);
337 iface = ATK_TABLE_GET_IFACE (obj);
339 if (iface->get_column_description)
340 return (iface->get_column_description) (obj, column);
346 * atk_table_get_column_extent_at:
347 * @table: a GObject instance that implements AtkTableIface
348 * @row: a #gint representing a row in @table
349 * @column: a #gint representing a column in @table
351 * Gets the number of columns occupied by the accessible object
352 * at the specified @row and @column in the @table.
353 * Note: callers should not rely on %NULL or on a zero value for
354 * indication of whether AtkSelectionIface is implemented, they should
355 * use type checking/interface checking macros or the
356 * atk_get_accessible_table() convenience method.
358 * Returns: a gint representing the column extent at specified position, or 0
359 * if value does not implement this interface.
362 atk_table_get_column_extent_at (AtkTable *obj,
366 AtkTableIface *iface;
368 g_return_val_if_fail (obj != NULL, 0);
369 g_return_val_if_fail (ATK_IS_TABLE (obj), 0);
371 iface = ATK_TABLE_GET_IFACE (obj);
373 if (iface->get_column_extent_at)
374 return (iface->get_column_extent_at) (obj, row, column);
380 * atk_table_get_column_header:
381 * @table: a GObject instance that implements AtkTableIface
382 * @column: a #gint representing a column in the table
384 * Gets the column header of a specified column in an accessible table.
385 * Note: callers should not rely on %NULL or on a zero value for
386 * indication of whether AtkSelectionIface is implemented, they should
387 * use type checking/interface checking macros or the
388 * atk_get_accessible_table() convenience method.
390 * Returns: a AtkObject* representing the specified column header, or
391 * %NULL if value does not implement this interface.
394 atk_table_get_column_header (AtkTable *obj, gint column)
396 AtkTableIface *iface;
398 g_return_val_if_fail (obj != NULL, NULL);
399 g_return_val_if_fail (ATK_IS_TABLE (obj), NULL);
401 iface = ATK_TABLE_GET_IFACE (obj);
403 if (iface->get_column_header)
404 return (iface->get_column_header) (obj, column);
410 * atk_table_get_n_rows:
411 * @table: a GObject instance that implements AtkTableIface
413 * Gets the number of rows in the table.
414 * Note: callers should not rely on %NULL or on a zero value for
415 * indication of whether AtkSelectionIface is implemented, they should
416 * use type checking/interface checking macros or the
417 * atk_get_accessible_table() convenience method.
419 * Returns: a gint representing the number of rows, or 0
420 * if value does not implement this interface.
423 atk_table_get_n_rows (AtkTable *obj)
425 AtkTableIface *iface;
427 g_return_val_if_fail (obj != NULL, 0);
428 g_return_val_if_fail (ATK_IS_TABLE (obj), 0);
430 iface = ATK_TABLE_GET_IFACE (obj);
432 if (iface->get_n_rows)
433 return (iface->get_n_rows) (obj);
439 * atk_table_get_row_description:
440 * @table: a GObject instance that implements AtkTableIface
441 * @r: a #gint representing a row in @table
443 * Gets the description text of the specified row in the table
444 * Note: callers should not rely on %NULL or on a zero value for
445 * indication of whether AtkSelectionIface is implemented, they should
446 * use type checking/interface checking macros or the
447 * atk_get_accessible_table() convenience method.
449 * Returns: a gchar* representing the row description, or %NULL
450 * if value does not implement this interface.
453 atk_table_get_row_description (AtkTable *obj,
456 AtkTableIface *iface;
458 g_return_val_if_fail (obj != NULL, NULL);
459 g_return_val_if_fail (ATK_IS_TABLE (obj), NULL);
461 iface = ATK_TABLE_GET_IFACE (obj);
463 if (iface->get_row_description)
464 return (iface->get_row_description) (obj, row);
470 * atk_table_get_row_extent_at:
471 * @table: a GObject instance that implements AtkTableIface
472 * @row: a #gint representing a row in @table
473 * @column: a #gint representing a column in @table
475 * Gets the number of rows occupied by the accessible object
476 * at a specified @row and @column in the @table.
477 * Note: callers should not rely on %NULL or on a zero value for
478 * indication of whether AtkSelectionIface is implemented, they should
479 * use type checking/interface checking macros or the
480 * atk_get_accessible_table() convenience method.
482 * Returns: a gint representing the row extent at specified position, or 0
483 * if value does not implement this interface.
486 atk_table_get_row_extent_at (AtkTable *obj,
490 AtkTableIface *iface;
492 g_return_val_if_fail (obj != NULL, 0);
493 g_return_val_if_fail (ATK_IS_TABLE (obj), 0);
495 iface = ATK_TABLE_GET_IFACE (obj);
497 if (iface->get_row_extent_at)
498 return (iface->get_row_extent_at) (obj, row, column);
504 * atk_table_get_row_header:
505 * @table: a GObject instance that implements AtkTableIface
506 * @row: a #gint representing a row in the table
508 * Gets the row header of a specified row in an accessible table.
509 * Note: callers should not rely on %NULL or on a zero value for
510 * indication of whether AtkSelectionIface is implemented, they should
511 * use type checking/interface checking macros or the
512 * atk_get_accessible_table() convenience method.
514 * Returns: a AtkObject* representing the specified row header, or
515 * %NULL if value does not implement this interface.
518 atk_table_get_row_header (AtkTable *obj, gint row)
520 AtkTableIface *iface;
522 g_return_val_if_fail (obj != NULL, NULL);
523 g_return_val_if_fail (ATK_IS_TABLE (obj), NULL);
525 iface = ATK_TABLE_GET_IFACE (obj);
527 if (iface->get_row_header)
528 return (iface->get_row_header) (obj, row);
534 * atk_table_get_summary:
535 * @table: a GObject instance that implements AtkTableIface
537 * Gets the summary description of the table.
538 * Note: callers should not rely on %NULL or on a zero value for
539 * indication of whether AtkSelectionIface is implemented, they should
540 * use type checking/interface checking macros or the
541 * atk_get_accessible_table() convenience method.
543 * Returns: a AtkObject* representing a sumary description of the table,
544 * or %NULL if value does not implement this interface.
547 atk_table_get_summary (AtkTable *obj)
549 AtkTableIface *iface;
551 g_return_val_if_fail (obj != NULL, NULL);
552 g_return_val_if_fail (ATK_IS_TABLE (obj), NULL);
554 iface = ATK_TABLE_GET_IFACE (obj);
556 if (iface->get_summary)
557 return (iface->get_summary) (obj);
563 * atk_table_get_selected_rows:
564 * @table: a GObject instance that implements AtkTableIface
566 * Gets the selected rows of the table.
567 * Note: callers should not rely on %NULL or on a zero value for
568 * indication of whether AtkSelectionIface is implemented, they should
569 * use type checking/interface checking macros or the
570 * atk_get_accessible_table() convenience method.
572 * Returns: a gint* representing the selected rows,
573 * or %NULL if value does not implement this interface.
576 atk_table_get_selected_rows (AtkTable *obj)
578 AtkTableIface *iface;
580 g_return_val_if_fail (obj != NULL, NULL);
581 g_return_val_if_fail (ATK_IS_TABLE (obj), NULL);
583 iface = ATK_TABLE_GET_IFACE (obj);
585 if (iface->get_selected_rows)
586 return (iface->get_selected_rows) (obj);
592 * atk_table_get_selected_columns:
593 * @table: a GObject instance that implements AtkTableIface
595 * Gets the selected columns of the table.
596 * Note: callers should not rely on %NULL or on a zero value for
597 * indication of whether AtkSelectionIface is implemented, they should
598 * use type checking/interface checking macros or the
599 * atk_get_accessible_table() convenience method.
601 * Returns: a gint* representing the selected columns,
602 * or %NULL if value does not implement this interface.
606 atk_table_get_selected_columns (AtkTable *obj)
608 AtkTableIface *iface;
610 g_return_val_if_fail (obj != NULL, NULL);
611 g_return_val_if_fail (ATK_IS_TABLE (obj), NULL);
613 iface = ATK_TABLE_GET_IFACE (obj);
615 if (iface->get_selected_columns)
616 return (iface->get_selected_columns) (obj);
622 * atk_table_is_column_selected:
623 * @table: a GObject instance that implements AtkTableIface
624 * @column: a #gint representing a column in @table
626 * Gets a boolean value indicating whether the specified @column
628 * Note: callers should not rely on %NULL or on a zero value for
629 * indication of whether AtkSelectionIface is implemented, they should
630 * use type checking/interface checking macros or the
631 * atk_get_accessible_table() convenience method.
633 * Returns: a gboolean representing if the column is selected, or 0
634 * if value does not implement this interface.
637 atk_table_is_column_selected (AtkTable *obj,
640 AtkTableIface *iface;
642 g_return_val_if_fail (obj != NULL, FALSE);
643 g_return_val_if_fail (ATK_IS_TABLE (obj), FALSE);
645 iface = ATK_TABLE_GET_IFACE (obj);
647 if (iface->is_column_selected)
648 return (iface->is_column_selected) (obj, column);
654 * atk_table_is_row_selected:
655 * @table: a GObject instance that implements AtkTableIface
656 * @row: a #gint representing a row in @table
658 * Gets a boolean value indicating whether the specified @row
660 * Note: callers should not rely on %NULL or on a zero value for
661 * indication of whether AtkSelectionIface is implemented, they should
662 * use type checking/interface checking macros or the
663 * atk_get_accessible_table() convenience method.
665 * Returns: a gboolean representing if the row is selected, or 0
666 * if value does not implement this interface.
669 atk_table_is_row_selected (AtkTable *obj,
672 AtkTableIface *iface;
674 g_return_val_if_fail (obj != NULL, FALSE);
675 g_return_val_if_fail (ATK_IS_TABLE (obj), FALSE);
677 iface = ATK_TABLE_GET_IFACE (obj);
679 if (iface->is_row_selected)
680 return (iface->is_row_selected) (obj, row);
686 * atk_table_is_selected:
687 * @table: a GObject instance that implements AtkTableIface
688 * @row: a #gint representing a row in @table
689 * @column: a #gint representing a column in @table
691 * Gets a boolean value indicating whether the acessible object
692 * at the specified @row and @column is selected
693 * Note: callers should not rely on %NULL or on a zero value for
694 * indication of whether AtkSelectionIface is implemented, they should
695 * use type checking/interface checking macros or the
696 * atk_get_accessible_table() convenience method.
698 * Returns: a gboolean representing if the cell is selected, or 0
699 * if value does not implement this interface.
702 atk_table_is_selected (AtkTable *obj,
706 AtkTableIface *iface;
708 g_return_val_if_fail (obj != NULL, FALSE);
709 g_return_val_if_fail (ATK_IS_TABLE (obj), FALSE);
711 iface = ATK_TABLE_GET_IFACE (obj);
713 if (iface->is_selected)
714 return (iface->is_selected) (obj, row, column);
720 * atk_table_set_caption:
721 * @table: a GObject instance that implements AtkTableIface
722 * @caption: a #gchar representing the caption to set for @table
724 * Sets the caption for the table.
727 atk_table_set_caption (AtkTable *obj,
730 AtkTableIface *iface;
732 g_return_if_fail (obj != NULL);
733 g_return_if_fail (ATK_IS_TABLE (obj));
735 iface = ATK_TABLE_GET_IFACE (obj);
737 if (iface->set_caption)
738 (iface->set_caption) (obj, caption);
742 * atk_table_set_column_description:
743 * @table: a GObject instance that implements AtkTableIface
744 * @column: a #gint representing a column in @table
745 * @description: a #gchar representing the description text
746 * to set for the specified @column of the @table
748 * Sets the description text for the specified @column of the @table.
751 atk_table_set_column_description (AtkTable *obj,
755 AtkTableIface *iface;
757 g_return_if_fail (obj != NULL);
758 g_return_if_fail (ATK_IS_TABLE (obj));
760 iface = ATK_TABLE_GET_IFACE (obj);
762 if (iface->set_column_description)
763 (iface->set_column_description) (obj, column, description);
767 * atk_table_set_column_header:
768 * @table: a GObject instance that implements AtkTableIface
769 * @column: a #gint representing a column in @table
770 * @header: an #AtkTable
772 * Sets the specified column header to @header
775 atk_table_set_column_header (AtkTable *obj,
779 AtkTableIface *iface;
781 g_return_if_fail (obj != NULL);
782 g_return_if_fail (ATK_IS_TABLE (obj));
784 iface = ATK_TABLE_GET_IFACE (obj);
786 if (iface->set_column_header)
787 (iface->set_column_header) (obj, column, header);
791 * atk_table_set_row_description:
792 * @table: a GObject instance that implements AtkTableIface
793 * @row: a #gint representing a row in @table
794 * @description: a #gchar representing the description text
795 * to set for the specified @row of @table
797 * Sets the description text for the specified @row of @table.
800 atk_table_set_row_description (AtkTable *obj,
804 AtkTableIface *iface;
806 g_return_if_fail (obj != NULL);
807 g_return_if_fail (ATK_IS_TABLE (obj));
809 iface = ATK_TABLE_GET_IFACE (obj);
811 if (iface->set_row_description)
812 (iface->set_row_description) (obj, row, description);
816 * atk_table_set_row_header:
817 * @table: a GObject instance that implements AtkTableIface
818 * @row: a #gint representing a row in @table
819 * @header: an #AtkTable
821 * Sets the specified row header to @header
824 atk_table_set_row_header (AtkTable *obj,
828 AtkTableIface *iface;
830 g_return_if_fail (obj != NULL);
831 g_return_if_fail (ATK_IS_TABLE (obj));
833 iface = ATK_TABLE_GET_IFACE (obj);
835 if (iface->set_row_header)
836 (iface->set_row_header) (obj, row, header);
840 * atk_table_set_summary:
841 * @table: a GObject instance that implements AtkTableIface
842 * @accessible: an #AtkObject representing the summary description
845 * Sets the summary description of the table
848 atk_table_set_summary (AtkTable *obj,
849 AtkObject *accessible)
851 AtkTableIface *iface;
853 g_return_if_fail (obj != NULL);
854 g_return_if_fail (ATK_IS_TABLE (obj));
856 iface = ATK_TABLE_GET_IFACE (obj);
858 if (iface->set_summary)
859 (iface->set_summary) (obj, accessible);