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: (transfer full): a AtkObject* representing the referred to
145 atk_table_ref_at (AtkTable
*table
,
149 AtkTableIface
*iface
;
151 g_return_val_if_fail (ATK_IS_TABLE (table
), NULL
);
152 g_return_val_if_fail (row
>= 0, NULL
);
153 g_return_val_if_fail (column
>= 0, NULL
);
155 iface
= ATK_TABLE_GET_IFACE (table
);
158 return (iface
->ref_at
) (table
, row
, column
);
164 * atk_table_get_index_at:
165 * @table: a GObject instance that implements AtkTableIface
166 * @row: a #gint representing a row in @table
167 * @column: a #gint representing a column in @table
169 * Gets a #gint representing the index at the specified @row and @column.
171 * Returns: a #gint representing the index at specified position.
172 * The value -1 is returned if the object at row,column is not a child
173 * of table or table does not implement this interface.
176 atk_table_get_index_at (AtkTable
*table
,
180 AtkTableIface
*iface
;
182 g_return_val_if_fail (ATK_IS_TABLE (table
), -1);
183 g_return_val_if_fail (row
>= 0, -1);
184 g_return_val_if_fail (column
>= 0, -1);
186 iface
= ATK_TABLE_GET_IFACE (table
);
188 if (iface
->get_index_at
)
189 return (iface
->get_index_at
) (table
, row
, column
);
195 * atk_table_get_row_at_index:
196 * @table: a GObject instance that implements AtkTableInterface
197 * @index_: a #gint representing an index in @table
199 * Gets a #gint representing the row at the specified @index_.
201 * Returns: a gint representing the row at the specified index,
202 * or -1 if the table does not implement this interface
205 atk_table_get_row_at_index (AtkTable
*table
,
208 AtkTableIface
*iface
;
210 g_return_val_if_fail (ATK_IS_TABLE (table
), -1);
212 iface
= ATK_TABLE_GET_IFACE (table
);
214 if (iface
->get_row_at_index
)
215 return (iface
->get_row_at_index
) (table
, index
);
221 * atk_table_get_column_at_index:
222 * @table: a GObject instance that implements AtkTableInterface
223 * @index_: a #gint representing an index in @table
225 * Gets a #gint representing the column at the specified @index_.
227 * Returns: a gint representing the column at the specified index,
228 * or -1 if the table does not implement this interface
231 atk_table_get_column_at_index (AtkTable
*table
,
234 AtkTableIface
*iface
;
236 g_return_val_if_fail (ATK_IS_TABLE (table
), 0);
238 iface
= ATK_TABLE_GET_IFACE (table
);
240 if (iface
->get_column_at_index
)
241 return (iface
->get_column_at_index
) (table
, index
);
247 * atk_table_get_caption:
248 * @table: a GObject instance that implements AtkTableInterface
250 * Gets the caption for the @table.
252 * Returns: (transfer none): a AtkObject* representing the table caption, or
253 * %NULL if value does not implement this interface.
256 atk_table_get_caption (AtkTable
*table
)
258 AtkTableIface
*iface
;
260 g_return_val_if_fail (ATK_IS_TABLE (table
), NULL
);
262 iface
= ATK_TABLE_GET_IFACE (table
);
264 if (iface
->get_caption
)
265 return (iface
->get_caption
) (table
);
271 * atk_table_get_n_columns:
272 * @table: a GObject instance that implements AtkTableIface
274 * Gets the number of columns in the table.
276 * Returns: a gint representing the number of columns, or 0
277 * if value does not implement this interface.
280 atk_table_get_n_columns (AtkTable
*table
)
282 AtkTableIface
*iface
;
284 g_return_val_if_fail (ATK_IS_TABLE (table
), 0);
286 iface
= ATK_TABLE_GET_IFACE (table
);
288 if (iface
->get_n_columns
)
289 return (iface
->get_n_columns
) (table
);
295 * atk_table_get_column_description:
296 * @table: a GObject instance that implements AtkTableIface
297 * @column: a #gint representing a column in @table
299 * Gets the description text of the specified @column in the table
301 * Returns: a gchar* representing the column description, or %NULL
302 * if value does not implement this interface.
304 G_CONST_RETURN gchar
*
305 atk_table_get_column_description (AtkTable
*table
,
308 AtkTableIface
*iface
;
310 g_return_val_if_fail (ATK_IS_TABLE (table
), NULL
);
312 iface
= ATK_TABLE_GET_IFACE (table
);
314 if (iface
->get_column_description
)
315 return (iface
->get_column_description
) (table
, column
);
321 * atk_table_get_column_extent_at:
322 * @table: a GObject instance that implements AtkTableIface
323 * @row: a #gint representing a row in @table
324 * @column: a #gint representing a column in @table
326 * Gets the number of columns occupied by the accessible object
327 * at the specified @row and @column in the @table.
329 * Returns: a gint representing the column extent at specified position, or 0
330 * if value does not implement this interface.
333 atk_table_get_column_extent_at (AtkTable
*table
,
337 AtkTableIface
*iface
;
339 g_return_val_if_fail (ATK_IS_TABLE (table
), 0);
341 iface
= ATK_TABLE_GET_IFACE (table
);
343 if (iface
->get_column_extent_at
)
344 return (iface
->get_column_extent_at
) (table
, row
, column
);
350 * atk_table_get_column_header:
351 * @table: a GObject instance that implements AtkTableIface
352 * @column: a #gint representing a column in the table
354 * Gets the column header of a specified column in an accessible table.
356 * Returns: (transfer none): a AtkObject* representing the specified column
357 * header, or %NULL if value does not implement this interface.
360 atk_table_get_column_header (AtkTable
*table
, gint column
)
362 AtkTableIface
*iface
;
364 g_return_val_if_fail (ATK_IS_TABLE (table
), NULL
);
366 iface
= ATK_TABLE_GET_IFACE (table
);
368 if (iface
->get_column_header
)
369 return (iface
->get_column_header
) (table
, column
);
375 * atk_table_get_n_rows:
376 * @table: a GObject instance that implements AtkTableIface
378 * Gets the number of rows in the table.
380 * Returns: a gint representing the number of rows, or 0
381 * if value does not implement this interface.
384 atk_table_get_n_rows (AtkTable
*table
)
386 AtkTableIface
*iface
;
388 g_return_val_if_fail (ATK_IS_TABLE (table
), 0);
390 iface
= ATK_TABLE_GET_IFACE (table
);
392 if (iface
->get_n_rows
)
393 return (iface
->get_n_rows
) (table
);
399 * atk_table_get_row_description:
400 * @table: a GObject instance that implements AtkTableIface
401 * @row: a #gint representing a row in @table
403 * Gets the description text of the specified row in the table
405 * Returns: a gchar* representing the row description, or %NULL
406 * if value does not implement this interface.
408 G_CONST_RETURN gchar
*
409 atk_table_get_row_description (AtkTable
*table
,
412 AtkTableIface
*iface
;
414 g_return_val_if_fail (ATK_IS_TABLE (table
), NULL
);
416 iface
= ATK_TABLE_GET_IFACE (table
);
418 if (iface
->get_row_description
)
419 return (iface
->get_row_description
) (table
, row
);
425 * atk_table_get_row_extent_at:
426 * @table: a GObject instance that implements AtkTableIface
427 * @row: a #gint representing a row in @table
428 * @column: a #gint representing a column in @table
430 * Gets the number of rows occupied by the accessible object
431 * at a specified @row and @column in the @table.
433 * Returns: a gint representing the row extent at specified position, or 0
434 * if value does not implement this interface.
437 atk_table_get_row_extent_at (AtkTable
*table
,
441 AtkTableIface
*iface
;
443 g_return_val_if_fail (ATK_IS_TABLE (table
), 0);
445 iface
= ATK_TABLE_GET_IFACE (table
);
447 if (iface
->get_row_extent_at
)
448 return (iface
->get_row_extent_at
) (table
, row
, column
);
454 * atk_table_get_row_header:
455 * @table: a GObject instance that implements AtkTableIface
456 * @row: a #gint representing a row in the table
458 * Gets the row header of a specified row in an accessible table.
460 * Returns: (transfer none): a AtkObject* representing the specified row
461 * header, or %NULL if value does not implement this interface.
464 atk_table_get_row_header (AtkTable
*table
, gint row
)
466 AtkTableIface
*iface
;
468 g_return_val_if_fail (ATK_IS_TABLE (table
), NULL
);
470 iface
= ATK_TABLE_GET_IFACE (table
);
472 if (iface
->get_row_header
)
473 return (iface
->get_row_header
) (table
, row
);
479 * atk_table_get_summary:
480 * @table: a GObject instance that implements AtkTableIface
482 * Gets the summary description of the table.
484 * Returns: (transfer full): a AtkObject* representing a summary description
485 * of the table, or zero if value does not implement this interface.
488 atk_table_get_summary (AtkTable
*table
)
490 AtkTableIface
*iface
;
492 g_return_val_if_fail (ATK_IS_TABLE (table
), NULL
);
494 iface
= ATK_TABLE_GET_IFACE (table
);
496 if (iface
->get_summary
)
497 return (iface
->get_summary
) (table
);
503 * atk_table_get_selected_rows:
504 * @table: a GObject instance that implements AtkTableIface
505 * @selected: a #gint** that is to contain the selected row numbers
507 * Gets the selected rows of the table by initializing **selected with
508 * the selected row numbers. This array should be freed by the caller.
510 * Returns: a gint representing the number of selected rows,
511 * or zero if value does not implement this interface.
514 atk_table_get_selected_rows (AtkTable
*table
, gint
**selected
)
516 AtkTableIface
*iface
;
518 g_return_val_if_fail (ATK_IS_TABLE (table
), 0);
520 iface
= ATK_TABLE_GET_IFACE (table
);
522 if (iface
->get_selected_rows
)
523 return (iface
->get_selected_rows
) (table
, selected
);
529 * atk_table_get_selected_columns:
530 * @table: a GObject instance that implements AtkTableIface
531 * @selected: a #gint** that is to contain the selected columns numbers
533 * Gets the selected columns of the table by initializing **selected with
534 * the selected column numbers. This array should be freed by the caller.
536 * Returns: a gint representing the number of selected columns,
537 * or %0 if value does not implement this interface.
540 atk_table_get_selected_columns (AtkTable
*table
, gint
**selected
)
542 AtkTableIface
*iface
;
544 g_return_val_if_fail (ATK_IS_TABLE (table
), 0);
546 iface
= ATK_TABLE_GET_IFACE (table
);
548 if (iface
->get_selected_columns
)
549 return (iface
->get_selected_columns
) (table
, selected
);
555 * atk_table_is_column_selected:
556 * @table: a GObject instance that implements AtkTableIface
557 * @column: a #gint representing a column in @table
559 * Gets a boolean value indicating whether the specified @column
562 * Returns: a gboolean representing if the column is selected, or 0
563 * if value does not implement this interface.
566 atk_table_is_column_selected (AtkTable
*table
,
569 AtkTableIface
*iface
;
571 g_return_val_if_fail (ATK_IS_TABLE (table
), FALSE
);
573 iface
= ATK_TABLE_GET_IFACE (table
);
575 if (iface
->is_column_selected
)
576 return (iface
->is_column_selected
) (table
, column
);
582 * atk_table_is_row_selected:
583 * @table: a GObject instance that implements AtkTableIface
584 * @row: a #gint representing a row in @table
586 * Gets a boolean value indicating whether the specified @row
589 * Returns: a gboolean representing if the row is selected, or 0
590 * if value does not implement this interface.
593 atk_table_is_row_selected (AtkTable
*table
,
596 AtkTableIface
*iface
;
598 g_return_val_if_fail (ATK_IS_TABLE (table
), FALSE
);
600 iface
= ATK_TABLE_GET_IFACE (table
);
602 if (iface
->is_row_selected
)
603 return (iface
->is_row_selected
) (table
, row
);
609 * atk_table_is_selected:
610 * @table: a GObject instance that implements AtkTableIface
611 * @row: a #gint representing a row in @table
612 * @column: a #gint representing a column in @table
614 * Gets a boolean value indicating whether the accessible object
615 * at the specified @row and @column is selected
617 * Returns: a gboolean representing if the cell is selected, or 0
618 * if value does not implement this interface.
621 atk_table_is_selected (AtkTable
*table
,
625 AtkTableIface
*iface
;
627 g_return_val_if_fail (ATK_IS_TABLE (table
), FALSE
);
629 iface
= ATK_TABLE_GET_IFACE (table
);
631 if (iface
->is_selected
)
632 return (iface
->is_selected
) (table
, row
, column
);
638 * atk_table_add_row_selection:
639 * @table: a GObject instance that implements AtkTableIface
640 * @row: a #gint representing a row in @table
642 * Adds the specified @row to the selection.
644 * Returns: a gboolean representing if row was successfully added to selection,
645 * or 0 if value does not implement this interface.
648 atk_table_add_row_selection (AtkTable
*table
,
651 AtkTableIface
*iface
;
653 g_return_val_if_fail (ATK_IS_TABLE (table
), FALSE
);
655 iface
= ATK_TABLE_GET_IFACE (table
);
657 if (iface
->add_row_selection
)
658 return (iface
->add_row_selection
) (table
, row
);
663 * atk_table_remove_row_selection:
664 * @table: a GObject instance that implements AtkTableIface
665 * @row: a #gint representing a row in @table
667 * Removes the specified @row from the selection.
669 * Returns: a gboolean representing if the row was successfully removed from
670 * the selection, or 0 if value does not implement this interface.
673 atk_table_remove_row_selection (AtkTable
*table
,
676 AtkTableIface
*iface
;
678 g_return_val_if_fail (ATK_IS_TABLE (table
), FALSE
);
680 iface
= ATK_TABLE_GET_IFACE (table
);
682 if (iface
->remove_row_selection
)
683 return (iface
->remove_row_selection
) (table
, row
);
688 * atk_table_add_column_selection:
689 * @table: a GObject instance that implements AtkTableIface
690 * @column: a #gint representing a column in @table
692 * Adds the specified @column to the selection.
694 * Returns: a gboolean representing if the column was successfully added to
695 * the selection, or 0 if value does not implement this interface.
698 atk_table_add_column_selection (AtkTable
*table
,
701 AtkTableIface
*iface
;
703 g_return_val_if_fail (ATK_IS_TABLE (table
), FALSE
);
705 iface
= ATK_TABLE_GET_IFACE (table
);
707 if (iface
->add_column_selection
)
708 return (iface
->add_column_selection
) (table
, column
);
713 * atk_table_remove_column_selection:
714 * @table: a GObject instance that implements AtkTableIface
715 * @column: a #gint representing a column in @table
717 * Adds the specified @column to the selection.
719 * Returns: a gboolean representing if the column was successfully removed from
720 * the selection, or 0 if value does not implement this interface.
723 atk_table_remove_column_selection (AtkTable
*table
,
726 AtkTableIface
*iface
;
728 g_return_val_if_fail (ATK_IS_TABLE (table
), FALSE
);
730 iface
= ATK_TABLE_GET_IFACE (table
);
732 if (iface
->remove_column_selection
)
733 return (iface
->remove_column_selection
) (table
, column
);
739 * atk_table_set_caption:
740 * @table: a GObject instance that implements AtkTableIface
741 * @caption: a #AtkObject representing the caption to set for @table
743 * Sets the caption for the table.
746 atk_table_set_caption (AtkTable
*table
,
749 AtkTableIface
*iface
;
751 g_return_if_fail (ATK_IS_TABLE (table
));
753 iface
= ATK_TABLE_GET_IFACE (table
);
755 if (iface
->set_caption
)
756 (iface
->set_caption
) (table
, caption
);
760 * atk_table_set_column_description:
761 * @table: a GObject instance that implements AtkTableIface
762 * @column: a #gint representing a column in @table
763 * @description: a #gchar representing the description text
764 * to set for the specified @column of the @table
766 * Sets the description text for the specified @column of the @table.
769 atk_table_set_column_description (AtkTable
*table
,
771 const gchar
*description
)
773 AtkTableIface
*iface
;
775 g_return_if_fail (ATK_IS_TABLE (table
));
777 iface
= ATK_TABLE_GET_IFACE (table
);
779 if (iface
->set_column_description
)
780 (iface
->set_column_description
) (table
, column
, description
);
784 * atk_table_set_column_header:
785 * @table: a GObject instance that implements AtkTableIface
786 * @column: a #gint representing a column in @table
787 * @header: an #AtkTable
789 * Sets the specified column header to @header.
792 atk_table_set_column_header (AtkTable
*table
,
796 AtkTableIface
*iface
;
798 g_return_if_fail (ATK_IS_TABLE (table
));
800 iface
= ATK_TABLE_GET_IFACE (table
);
802 if (iface
->set_column_header
)
803 (iface
->set_column_header
) (table
, column
, header
);
807 * atk_table_set_row_description:
808 * @table: a GObject instance that implements AtkTableIface
809 * @row: a #gint representing a row in @table
810 * @description: a #gchar representing the description text
811 * to set for the specified @row of @table
813 * Sets the description text for the specified @row of @table.
816 atk_table_set_row_description (AtkTable
*table
,
818 const gchar
*description
)
820 AtkTableIface
*iface
;
822 g_return_if_fail (ATK_IS_TABLE (table
));
824 iface
= ATK_TABLE_GET_IFACE (table
);
826 if (iface
->set_row_description
)
827 (iface
->set_row_description
) (table
, row
, description
);
831 * atk_table_set_row_header:
832 * @table: a GObject instance that implements AtkTableIface
833 * @row: a #gint representing a row in @table
834 * @header: an #AtkTable
836 * Sets the specified row header to @header.
839 atk_table_set_row_header (AtkTable
*table
,
843 AtkTableIface
*iface
;
845 g_return_if_fail (ATK_IS_TABLE (table
));
847 iface
= ATK_TABLE_GET_IFACE (table
);
849 if (iface
->set_row_header
)
850 (iface
->set_row_header
) (table
, row
, header
);
854 * atk_table_set_summary:
855 * @table: a GObject instance that implements AtkTableIface
856 * @accessible: an #AtkObject representing the summary description
859 * Sets the summary description of the table.
862 atk_table_set_summary (AtkTable
*table
,
863 AtkObject
*accessible
)
865 AtkTableIface
*iface
;
867 g_return_if_fail (ATK_IS_TABLE (table
));
869 iface
= ATK_TABLE_GET_IFACE (table
);
871 if (iface
->set_summary
)
872 (iface
->set_summary
) (table
, accessible
);