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"
34 static void atk_table_base_init (gpointer
*g_class
);
36 static guint atk_table_signals
[LAST_SIGNAL
] = { 0 };
39 atk_table_get_type (void)
41 static GType type
= 0;
46 sizeof (AtkTableIface
),
47 (GBaseInitFunc
) atk_table_base_init
,
48 (GBaseFinalizeFunc
) NULL
,
52 type
= g_type_register_static (G_TYPE_INTERFACE
, "AtkTable", &tinfo
, 0);
60 atk_table_base_init (gpointer
*g_class
)
62 static gboolean initialized
= FALSE
;
66 atk_table_signals
[ROW_INSERTED
] =
67 g_signal_new ("row_inserted",
70 G_STRUCT_OFFSET (AtkTableIface
, row_inserted
),
71 (GSignalAccumulator
) NULL
, NULL
,
72 atk_marshal_VOID__INT_INT
,
74 2, G_TYPE_INT
, G_TYPE_INT
);
75 atk_table_signals
[COLUMN_INSERTED
] =
76 g_signal_new ("column_inserted",
79 G_STRUCT_OFFSET (AtkTableIface
, column_inserted
),
80 (GSignalAccumulator
) NULL
, NULL
,
81 atk_marshal_VOID__INT_INT
,
83 2, G_TYPE_INT
, G_TYPE_INT
);
84 atk_table_signals
[ROW_DELETED
] =
85 g_signal_new ("row_deleted",
88 G_STRUCT_OFFSET (AtkTableIface
, row_deleted
),
89 (GSignalAccumulator
) NULL
, NULL
,
90 atk_marshal_VOID__INT_INT
,
92 2, G_TYPE_INT
, G_TYPE_INT
);
93 atk_table_signals
[COLUMN_DELETED
] =
94 g_signal_new ("column_deleted",
97 G_STRUCT_OFFSET (AtkTableIface
, column_deleted
),
98 (GSignalAccumulator
) NULL
, NULL
,
99 atk_marshal_VOID__INT_INT
,
101 2, G_TYPE_INT
, G_TYPE_INT
);
102 atk_table_signals
[ROW_REORDERED
] =
103 g_signal_new ("row_reordered",
106 G_STRUCT_OFFSET (AtkTableIface
, row_reordered
),
107 (GSignalAccumulator
) NULL
, NULL
,
108 g_cclosure_marshal_VOID__VOID
,
111 atk_table_signals
[COLUMN_REORDERED
] =
112 g_signal_new ("column_reordered",
115 G_STRUCT_OFFSET (AtkTableIface
, column_reordered
),
116 (GSignalAccumulator
) NULL
, NULL
,
117 g_cclosure_marshal_VOID__VOID
,
120 atk_table_signals
[MODEL_CHANGED
] =
121 g_signal_new ("model_changed",
124 G_STRUCT_OFFSET (AtkTableIface
, model_changed
),
125 (GSignalAccumulator
) NULL
, NULL
,
126 g_cclosure_marshal_VOID__VOID
,
135 * @table: a GObject instance that implements AtkTableIface
136 * @row: a #gint representing a row in @table
137 * @column: a #gint representing a column in @table
139 * Get a reference to the table cell at @row, @column.
141 * Returns: a AtkObject* representing the referred to accessible
144 atk_table_ref_at (AtkTable
*table
,
148 AtkTableIface
*iface
;
150 g_return_val_if_fail (ATK_IS_TABLE (table
), NULL
);
151 g_return_val_if_fail (row
>= 0, NULL
);
152 g_return_val_if_fail (column
>= 0, NULL
);
154 iface
= ATK_TABLE_GET_IFACE (table
);
157 return (iface
->ref_at
) (table
, row
, column
);
163 * atk_table_get_index_at:
164 * @table: a GObject instance that implements AtkTableIface
165 * @row: a #gint representing a row in @table
166 * @column: a #gint representing a column in @table
168 * Gets a #gint representing the index at the specified @row and @column.
170 * Returns: a #gint representing the index at specified position.
171 * The value -1 is returned if the object at row,column is not a child
172 * of table or table does not implement this interface.
175 atk_table_get_index_at (AtkTable
*table
,
179 AtkTableIface
*iface
;
181 g_return_val_if_fail (ATK_IS_TABLE (table
), -1);
182 g_return_val_if_fail (row
>= 0, -1);
183 g_return_val_if_fail (column
>= 0, -1);
185 iface
= ATK_TABLE_GET_IFACE (table
);
187 if (iface
->get_index_at
)
188 return (iface
->get_index_at
) (table
, row
, column
);
194 * atk_table_get_row_at_index:
195 * @table: a GObject instance that implements AtkTableInterface
196 * @index_: a #gint representing an index in @table
198 * Gets a #gint representing the row at the specified @index_.
200 * Returns: a gint representing the row at the specified index,
201 * or -1 if the table does not implement this interface
204 atk_table_get_row_at_index (AtkTable
*table
,
207 AtkTableIface
*iface
;
209 g_return_val_if_fail (ATK_IS_TABLE (table
), -1);
211 iface
= ATK_TABLE_GET_IFACE (table
);
213 if (iface
->get_row_at_index
)
214 return (iface
->get_row_at_index
) (table
, index
);
220 * atk_table_get_column_at_index:
221 * @table: a GObject instance that implements AtkTableInterface
222 * @index_: a #gint representing an index in @table
224 * Gets a #gint representing the column at the specified @index_.
226 * Returns: a gint representing the column at the specified index,
227 * or -1 if the table does not implement this interface
230 atk_table_get_column_at_index (AtkTable
*table
,
233 AtkTableIface
*iface
;
235 g_return_val_if_fail (ATK_IS_TABLE (table
), 0);
237 iface
= ATK_TABLE_GET_IFACE (table
);
239 if (iface
->get_column_at_index
)
240 return (iface
->get_column_at_index
) (table
, index
);
246 * atk_table_get_caption:
247 * @table: a GObject instance that implements AtkTableInterface
249 * Gets the caption for the @table.
251 * Returns: a AtkObject* representing the table caption, or %NULL
252 * if value does not implement this interface.
255 atk_table_get_caption (AtkTable
*table
)
257 AtkTableIface
*iface
;
259 g_return_val_if_fail (ATK_IS_TABLE (table
), NULL
);
261 iface
= ATK_TABLE_GET_IFACE (table
);
263 if (iface
->get_caption
)
264 return (iface
->get_caption
) (table
);
270 * atk_table_get_n_columns:
271 * @table: a GObject instance that implements AtkTableIface
273 * Gets the number of columns in the table.
275 * Returns: a gint representing the number of columns, or 0
276 * if value does not implement this interface.
279 atk_table_get_n_columns (AtkTable
*table
)
281 AtkTableIface
*iface
;
283 g_return_val_if_fail (ATK_IS_TABLE (table
), 0);
285 iface
= ATK_TABLE_GET_IFACE (table
);
287 if (iface
->get_n_columns
)
288 return (iface
->get_n_columns
) (table
);
294 * atk_table_get_column_description:
295 * @table: a GObject instance that implements AtkTableIface
296 * @column: a #gint representing a column in @table
298 * Gets the description text of the specified @column in the table
300 * Returns: a gchar* representing the column description, or %NULL
301 * if value does not implement this interface.
303 G_CONST_RETURN gchar
*
304 atk_table_get_column_description (AtkTable
*table
,
307 AtkTableIface
*iface
;
309 g_return_val_if_fail (ATK_IS_TABLE (table
), NULL
);
311 iface
= ATK_TABLE_GET_IFACE (table
);
313 if (iface
->get_column_description
)
314 return (iface
->get_column_description
) (table
, column
);
320 * atk_table_get_column_extent_at:
321 * @table: a GObject instance that implements AtkTableIface
322 * @row: a #gint representing a row in @table
323 * @column: a #gint representing a column in @table
325 * Gets the number of columns occupied by the accessible object
326 * at the specified @row and @column in the @table.
328 * Returns: a gint representing the column extent at specified position, or 0
329 * if value does not implement this interface.
332 atk_table_get_column_extent_at (AtkTable
*table
,
336 AtkTableIface
*iface
;
338 g_return_val_if_fail (ATK_IS_TABLE (table
), 0);
340 iface
= ATK_TABLE_GET_IFACE (table
);
342 if (iface
->get_column_extent_at
)
343 return (iface
->get_column_extent_at
) (table
, row
, column
);
349 * atk_table_get_column_header:
350 * @table: a GObject instance that implements AtkTableIface
351 * @column: a #gint representing a column in the table
353 * Gets the column header of a specified column in an accessible table.
355 * Returns: a AtkObject* representing the specified column header, or
356 * %NULL if value does not implement this interface.
359 atk_table_get_column_header (AtkTable
*table
, gint column
)
361 AtkTableIface
*iface
;
363 g_return_val_if_fail (ATK_IS_TABLE (table
), NULL
);
365 iface
= ATK_TABLE_GET_IFACE (table
);
367 if (iface
->get_column_header
)
368 return (iface
->get_column_header
) (table
, column
);
374 * atk_table_get_n_rows:
375 * @table: a GObject instance that implements AtkTableIface
377 * Gets the number of rows in the table.
379 * Returns: a gint representing the number of rows, or 0
380 * if value does not implement this interface.
383 atk_table_get_n_rows (AtkTable
*table
)
385 AtkTableIface
*iface
;
387 g_return_val_if_fail (ATK_IS_TABLE (table
), 0);
389 iface
= ATK_TABLE_GET_IFACE (table
);
391 if (iface
->get_n_rows
)
392 return (iface
->get_n_rows
) (table
);
398 * atk_table_get_row_description:
399 * @table: a GObject instance that implements AtkTableIface
400 * @row: a #gint representing a row in @table
402 * Gets the description text of the specified row in the table
404 * Returns: a gchar* representing the row description, or %NULL
405 * if value does not implement this interface.
407 G_CONST_RETURN gchar
*
408 atk_table_get_row_description (AtkTable
*table
,
411 AtkTableIface
*iface
;
413 g_return_val_if_fail (ATK_IS_TABLE (table
), NULL
);
415 iface
= ATK_TABLE_GET_IFACE (table
);
417 if (iface
->get_row_description
)
418 return (iface
->get_row_description
) (table
, row
);
424 * atk_table_get_row_extent_at:
425 * @table: a GObject instance that implements AtkTableIface
426 * @row: a #gint representing a row in @table
427 * @column: a #gint representing a column in @table
429 * Gets the number of rows occupied by the accessible object
430 * at a specified @row and @column in the @table.
432 * Returns: a gint representing the row extent at specified position, or 0
433 * if value does not implement this interface.
436 atk_table_get_row_extent_at (AtkTable
*table
,
440 AtkTableIface
*iface
;
442 g_return_val_if_fail (ATK_IS_TABLE (table
), 0);
444 iface
= ATK_TABLE_GET_IFACE (table
);
446 if (iface
->get_row_extent_at
)
447 return (iface
->get_row_extent_at
) (table
, row
, column
);
453 * atk_table_get_row_header:
454 * @table: a GObject instance that implements AtkTableIface
455 * @row: a #gint representing a row in the table
457 * Gets the row header of a specified row in an accessible table.
459 * Returns: a AtkObject* representing the specified row header, or
460 * %NULL if value does not implement this interface.
463 atk_table_get_row_header (AtkTable
*table
, gint row
)
465 AtkTableIface
*iface
;
467 g_return_val_if_fail (ATK_IS_TABLE (table
), NULL
);
469 iface
= ATK_TABLE_GET_IFACE (table
);
471 if (iface
->get_row_header
)
472 return (iface
->get_row_header
) (table
, row
);
478 * atk_table_get_summary:
479 * @table: a GObject instance that implements AtkTableIface
481 * Gets the summary description of the table.
483 * Returns: a AtkObject* representing a summary description of the table,
484 * or zero if value does not implement this interface.
487 atk_table_get_summary (AtkTable
*table
)
489 AtkTableIface
*iface
;
491 g_return_val_if_fail (ATK_IS_TABLE (table
), NULL
);
493 iface
= ATK_TABLE_GET_IFACE (table
);
495 if (iface
->get_summary
)
496 return (iface
->get_summary
) (table
);
502 * atk_table_get_selected_rows:
503 * @table: a GObject instance that implements AtkTableIface
504 * @selected: a #gint** that is to contain the selected row numbers
506 * Gets the selected rows of the table by initializing **selected with
507 * the selected row numbers. This array should be freed by the caller.
509 * Returns: a gint representing the number of selected rows,
510 * or zero if value does not implement this interface.
513 atk_table_get_selected_rows (AtkTable
*table
, gint
**selected
)
515 AtkTableIface
*iface
;
517 g_return_val_if_fail (ATK_IS_TABLE (table
), 0);
519 iface
= ATK_TABLE_GET_IFACE (table
);
521 if (iface
->get_selected_rows
)
522 return (iface
->get_selected_rows
) (table
, selected
);
528 * atk_table_get_selected_columns:
529 * @table: a GObject instance that implements AtkTableIface
530 * @selected: a #gint** that is to contain the selected columns numbers
532 * Gets the selected columns of the table by initializing **selected with
533 * the selected column numbers. This array should be freed by the caller.
535 * Returns: a gint representing the number of selected columns,
536 * or %0 if value does not implement this interface.
539 atk_table_get_selected_columns (AtkTable
*table
, gint
**selected
)
541 AtkTableIface
*iface
;
543 g_return_val_if_fail (ATK_IS_TABLE (table
), 0);
545 iface
= ATK_TABLE_GET_IFACE (table
);
547 if (iface
->get_selected_columns
)
548 return (iface
->get_selected_columns
) (table
, selected
);
554 * atk_table_is_column_selected:
555 * @table: a GObject instance that implements AtkTableIface
556 * @column: a #gint representing a column in @table
558 * Gets a boolean value indicating whether the specified @column
561 * Returns: a gboolean representing if the column is selected, or 0
562 * if value does not implement this interface.
565 atk_table_is_column_selected (AtkTable
*table
,
568 AtkTableIface
*iface
;
570 g_return_val_if_fail (ATK_IS_TABLE (table
), FALSE
);
572 iface
= ATK_TABLE_GET_IFACE (table
);
574 if (iface
->is_column_selected
)
575 return (iface
->is_column_selected
) (table
, column
);
581 * atk_table_is_row_selected:
582 * @table: a GObject instance that implements AtkTableIface
583 * @row: a #gint representing a row in @table
585 * Gets a boolean value indicating whether the specified @row
588 * Returns: a gboolean representing if the row is selected, or 0
589 * if value does not implement this interface.
592 atk_table_is_row_selected (AtkTable
*table
,
595 AtkTableIface
*iface
;
597 g_return_val_if_fail (ATK_IS_TABLE (table
), FALSE
);
599 iface
= ATK_TABLE_GET_IFACE (table
);
601 if (iface
->is_row_selected
)
602 return (iface
->is_row_selected
) (table
, row
);
608 * atk_table_is_selected:
609 * @table: a GObject instance that implements AtkTableIface
610 * @row: a #gint representing a row in @table
611 * @column: a #gint representing a column in @table
613 * Gets a boolean value indicating whether the accessible object
614 * at the specified @row and @column is selected
616 * Returns: a gboolean representing if the cell is selected, or 0
617 * if value does not implement this interface.
620 atk_table_is_selected (AtkTable
*table
,
624 AtkTableIface
*iface
;
626 g_return_val_if_fail (ATK_IS_TABLE (table
), FALSE
);
628 iface
= ATK_TABLE_GET_IFACE (table
);
630 if (iface
->is_selected
)
631 return (iface
->is_selected
) (table
, row
, column
);
637 * atk_table_add_row_selection:
638 * @table: a GObject instance that implements AtkTableIface
639 * @row: a #gint representing a row in @table
641 * Adds the specified @row to the selection.
643 * Returns: a gboolean representing if row was successfully added to selection,
644 * or 0 if value does not implement this interface.
647 atk_table_add_row_selection (AtkTable
*table
,
650 AtkTableIface
*iface
;
652 g_return_val_if_fail (ATK_IS_TABLE (table
), FALSE
);
654 iface
= ATK_TABLE_GET_IFACE (table
);
656 if (iface
->add_row_selection
)
657 return (iface
->add_row_selection
) (table
, row
);
662 * atk_table_remove_row_selection:
663 * @table: a GObject instance that implements AtkTableIface
664 * @row: a #gint representing a row in @table
666 * Removes the specified @row from the selection.
668 * Returns: a gboolean representing if the row was successfully removed from
669 * the selection, or 0 if value does not implement this interface.
672 atk_table_remove_row_selection (AtkTable
*table
,
675 AtkTableIface
*iface
;
677 g_return_val_if_fail (ATK_IS_TABLE (table
), FALSE
);
679 iface
= ATK_TABLE_GET_IFACE (table
);
681 if (iface
->remove_row_selection
)
682 return (iface
->remove_row_selection
) (table
, row
);
687 * atk_table_add_column_selection:
688 * @table: a GObject instance that implements AtkTableIface
689 * @column: a #gint representing a column in @table
691 * Adds the specified @column to the selection.
693 * Returns: a gboolean representing if the column was successfully added to
694 * the selection, or 0 if value does not implement this interface.
697 atk_table_add_column_selection (AtkTable
*table
,
700 AtkTableIface
*iface
;
702 g_return_val_if_fail (ATK_IS_TABLE (table
), FALSE
);
704 iface
= ATK_TABLE_GET_IFACE (table
);
706 if (iface
->add_column_selection
)
707 return (iface
->add_column_selection
) (table
, column
);
712 * atk_table_remove_column_selection:
713 * @table: a GObject instance that implements AtkTableIface
714 * @column: a #gint representing a column in @table
716 * Adds the specified @column to the selection.
718 * Returns: a gboolean representing if the column was successfully removed from
719 * the selection, or 0 if value does not implement this interface.
722 atk_table_remove_column_selection (AtkTable
*table
,
725 AtkTableIface
*iface
;
727 g_return_val_if_fail (ATK_IS_TABLE (table
), FALSE
);
729 iface
= ATK_TABLE_GET_IFACE (table
);
731 if (iface
->remove_column_selection
)
732 return (iface
->remove_column_selection
) (table
, column
);
738 * atk_table_set_caption:
739 * @table: a GObject instance that implements AtkTableIface
740 * @caption: a #AtkObject representing the caption to set for @table
742 * Sets the caption for the table.
745 atk_table_set_caption (AtkTable
*table
,
748 AtkTableIface
*iface
;
750 g_return_if_fail (ATK_IS_TABLE (table
));
752 iface
= ATK_TABLE_GET_IFACE (table
);
754 if (iface
->set_caption
)
755 (iface
->set_caption
) (table
, caption
);
759 * atk_table_set_column_description:
760 * @table: a GObject instance that implements AtkTableIface
761 * @column: a #gint representing a column in @table
762 * @description: a #gchar representing the description text
763 * to set for the specified @column of the @table
765 * Sets the description text for the specified @column of the @table.
768 atk_table_set_column_description (AtkTable
*table
,
770 const gchar
*description
)
772 AtkTableIface
*iface
;
774 g_return_if_fail (ATK_IS_TABLE (table
));
776 iface
= ATK_TABLE_GET_IFACE (table
);
778 if (iface
->set_column_description
)
779 (iface
->set_column_description
) (table
, column
, description
);
783 * atk_table_set_column_header:
784 * @table: a GObject instance that implements AtkTableIface
785 * @column: a #gint representing a column in @table
786 * @header: an #AtkTable
788 * Sets the specified column header to @header.
791 atk_table_set_column_header (AtkTable
*table
,
795 AtkTableIface
*iface
;
797 g_return_if_fail (ATK_IS_TABLE (table
));
799 iface
= ATK_TABLE_GET_IFACE (table
);
801 if (iface
->set_column_header
)
802 (iface
->set_column_header
) (table
, column
, header
);
806 * atk_table_set_row_description:
807 * @table: a GObject instance that implements AtkTableIface
808 * @row: a #gint representing a row in @table
809 * @description: a #gchar representing the description text
810 * to set for the specified @row of @table
812 * Sets the description text for the specified @row of @table.
815 atk_table_set_row_description (AtkTable
*table
,
817 const gchar
*description
)
819 AtkTableIface
*iface
;
821 g_return_if_fail (ATK_IS_TABLE (table
));
823 iface
= ATK_TABLE_GET_IFACE (table
);
825 if (iface
->set_row_description
)
826 (iface
->set_row_description
) (table
, row
, description
);
830 * atk_table_set_row_header:
831 * @table: a GObject instance that implements AtkTableIface
832 * @row: a #gint representing a row in @table
833 * @header: an #AtkTable
835 * Sets the specified row header to @header.
838 atk_table_set_row_header (AtkTable
*table
,
842 AtkTableIface
*iface
;
844 g_return_if_fail (ATK_IS_TABLE (table
));
846 iface
= ATK_TABLE_GET_IFACE (table
);
848 if (iface
->set_row_header
)
849 (iface
->set_row_header
) (table
, row
, header
);
853 * atk_table_set_summary:
854 * @table: a GObject instance that implements AtkTableIface
855 * @accessible: an #AtkObject representing the summary description
858 * Sets the summary description of the table.
861 atk_table_set_summary (AtkTable
*table
,
862 AtkObject
*accessible
)
864 AtkTableIface
*iface
;
866 g_return_if_fail (ATK_IS_TABLE (table
));
868 iface
= ATK_TABLE_GET_IFACE (table
);
870 if (iface
->set_summary
)
871 (iface
->set_summary
) (table
, accessible
);