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
);
152 iface
= ATK_TABLE_GET_IFACE (table
);
155 return (iface
->ref_at
) (table
, row
, column
);
161 * atk_table_get_index_at:
162 * @table: a GObject instance that implements AtkTableIface
163 * @row: a #gint representing a row in @table
164 * @column: a #gint representing a column in @table
166 * Gets a #gint representing the index at the specified @row and @column.
167 * The value -1 is returned if the object at row,column is not a child
168 * of table or table does not implement this interface.
170 * Returns: a #gint representing the index at specified position
173 atk_table_get_index_at (AtkTable
*table
,
177 AtkTableIface
*iface
;
179 g_return_val_if_fail (ATK_IS_TABLE (table
), -1);
180 g_return_val_if_fail (row
>= 0, -1);
181 g_return_val_if_fail (column
>= 0, -1);
183 iface
= ATK_TABLE_GET_IFACE (table
);
185 if (iface
->get_index_at
)
186 return (iface
->get_index_at
) (table
, row
, column
);
192 * atk_table_get_row_at_index:
193 * @table: a GObject instance that implements AtkTableInterface
194 * @index_: a #gint representing an index in @table
196 * Gets a #gint representing the row at the specified @index_, or -1
197 * if the table does not implement this interface
199 * Returns: a gint representing the row at the specified index.
202 atk_table_get_row_at_index (AtkTable
*table
,
205 AtkTableIface
*iface
;
207 g_return_val_if_fail (ATK_IS_TABLE (table
), -1);
209 iface
= ATK_TABLE_GET_IFACE (table
);
211 if (iface
->get_row_at_index
)
212 return (iface
->get_row_at_index
) (table
, index
);
218 * atk_table_get_column_at_index:
219 * @table: a GObject instance that implements AtkTableInterface
220 * @index_: a #gint representing an index in @table
222 * Gets a #gint representing the column at the specified @index_, or -1
223 * if the table does not implement this interface
225 * Returns: a gint representing the column at the specified index.
228 atk_table_get_column_at_index (AtkTable
*table
,
231 AtkTableIface
*iface
;
233 g_return_val_if_fail (ATK_IS_TABLE (table
), 0);
235 iface
= ATK_TABLE_GET_IFACE (table
);
237 if (iface
->get_column_at_index
)
238 return (iface
->get_column_at_index
) (table
, index
);
244 * atk_table_get_caption:
245 * @table: a GObject instance that implements AtkTableInterface
247 * Gets the caption for the @table.
249 * Returns: a AtkObject* representing the table caption, or %NULL
250 * if value does not implement this interface.
253 atk_table_get_caption (AtkTable
*table
)
255 AtkTableIface
*iface
;
257 g_return_val_if_fail (ATK_IS_TABLE (table
), NULL
);
259 iface
= ATK_TABLE_GET_IFACE (table
);
261 if (iface
->get_caption
)
262 return (iface
->get_caption
) (table
);
268 * atk_table_get_n_columns:
269 * @table: a GObject instance that implements AtkTableIface
271 * Gets the number of columns in the table.
273 * Returns: a gint representing the number of columns, or 0
274 * if value does not implement this interface.
277 atk_table_get_n_columns (AtkTable
*table
)
279 AtkTableIface
*iface
;
281 g_return_val_if_fail (ATK_IS_TABLE (table
), 0);
283 iface
= ATK_TABLE_GET_IFACE (table
);
285 if (iface
->get_n_columns
)
286 return (iface
->get_n_columns
) (table
);
292 * atk_table_get_column_description:
293 * @table: a GObject instance that implements AtkTableIface
294 * @column: a #gint representing a column in @table
296 * Gets the description text of the specified @column in the table
298 * Returns: a gchar* representing the column description, or %NULL
299 * if value does not implement this interface.
301 G_CONST_RETURN gchar
*
302 atk_table_get_column_description (AtkTable
*table
,
305 AtkTableIface
*iface
;
307 g_return_val_if_fail (ATK_IS_TABLE (table
), NULL
);
309 iface
= ATK_TABLE_GET_IFACE (table
);
311 if (iface
->get_column_description
)
312 return (iface
->get_column_description
) (table
, column
);
318 * atk_table_get_column_extent_at:
319 * @table: a GObject instance that implements AtkTableIface
320 * @row: a #gint representing a row in @table
321 * @column: a #gint representing a column in @table
323 * Gets the number of columns occupied by the accessible object
324 * at the specified @row and @column in the @table.
326 * Returns: a gint representing the column extent at specified position, or 0
327 * if value does not implement this interface.
330 atk_table_get_column_extent_at (AtkTable
*table
,
334 AtkTableIface
*iface
;
336 g_return_val_if_fail (ATK_IS_TABLE (table
), 0);
338 iface
= ATK_TABLE_GET_IFACE (table
);
340 if (iface
->get_column_extent_at
)
341 return (iface
->get_column_extent_at
) (table
, row
, column
);
347 * atk_table_get_column_header:
348 * @table: a GObject instance that implements AtkTableIface
349 * @column: a #gint representing a column in the table
351 * Gets the column header of a specified column in an accessible table.
353 * Returns: a AtkObject* representing the specified column header, or
354 * %NULL if value does not implement this interface.
357 atk_table_get_column_header (AtkTable
*table
, gint column
)
359 AtkTableIface
*iface
;
361 g_return_val_if_fail (ATK_IS_TABLE (table
), NULL
);
363 iface
= ATK_TABLE_GET_IFACE (table
);
365 if (iface
->get_column_header
)
366 return (iface
->get_column_header
) (table
, column
);
372 * atk_table_get_n_rows:
373 * @table: a GObject instance that implements AtkTableIface
375 * Gets the number of rows in the table.
377 * Returns: a gint representing the number of rows, or 0
378 * if value does not implement this interface.
381 atk_table_get_n_rows (AtkTable
*table
)
383 AtkTableIface
*iface
;
385 g_return_val_if_fail (ATK_IS_TABLE (table
), 0);
387 iface
= ATK_TABLE_GET_IFACE (table
);
389 if (iface
->get_n_rows
)
390 return (iface
->get_n_rows
) (table
);
396 * atk_table_get_row_description:
397 * @table: a GObject instance that implements AtkTableIface
398 * @row: a #gint representing a row in @table
400 * Gets the description text of the specified row in the table
402 * Returns: a gchar* representing the row description, or %NULL
403 * if value does not implement this interface.
405 G_CONST_RETURN gchar
*
406 atk_table_get_row_description (AtkTable
*table
,
409 AtkTableIface
*iface
;
411 g_return_val_if_fail (ATK_IS_TABLE (table
), NULL
);
413 iface
= ATK_TABLE_GET_IFACE (table
);
415 if (iface
->get_row_description
)
416 return (iface
->get_row_description
) (table
, row
);
422 * atk_table_get_row_extent_at:
423 * @table: a GObject instance that implements AtkTableIface
424 * @row: a #gint representing a row in @table
425 * @column: a #gint representing a column in @table
427 * Gets the number of rows occupied by the accessible object
428 * at a specified @row and @column in the @table.
430 * Returns: a gint representing the row extent at specified position, or 0
431 * if value does not implement this interface.
434 atk_table_get_row_extent_at (AtkTable
*table
,
438 AtkTableIface
*iface
;
440 g_return_val_if_fail (ATK_IS_TABLE (table
), 0);
442 iface
= ATK_TABLE_GET_IFACE (table
);
444 if (iface
->get_row_extent_at
)
445 return (iface
->get_row_extent_at
) (table
, row
, column
);
451 * atk_table_get_row_header:
452 * @table: a GObject instance that implements AtkTableIface
453 * @row: a #gint representing a row in the table
455 * Gets the row header of a specified row in an accessible table.
457 * Returns: a AtkObject* representing the specified row header, or
458 * %NULL if value does not implement this interface.
461 atk_table_get_row_header (AtkTable
*table
, gint row
)
463 AtkTableIface
*iface
;
465 g_return_val_if_fail (ATK_IS_TABLE (table
), NULL
);
467 iface
= ATK_TABLE_GET_IFACE (table
);
469 if (iface
->get_row_header
)
470 return (iface
->get_row_header
) (table
, row
);
476 * atk_table_get_summary:
477 * @table: a GObject instance that implements AtkTableIface
479 * Gets the summary description of the table.
481 * Returns: a AtkObject* representing a summary description of the table,
482 * or zero if value does not implement this interface.
485 atk_table_get_summary (AtkTable
*table
)
487 AtkTableIface
*iface
;
489 g_return_val_if_fail (ATK_IS_TABLE (table
), NULL
);
491 iface
= ATK_TABLE_GET_IFACE (table
);
493 if (iface
->get_summary
)
494 return (iface
->get_summary
) (table
);
500 * atk_table_get_selected_rows:
501 * @table: a GObject instance that implements AtkTableIface
502 * @selected: a #gint** that is to contain the selected row numbers
504 * Gets the selected rows of the table by initializing **selected with
505 * the selected row numbers. This array should be freed by the caller.
507 * Returns: a gint representing the number of selected rows,
508 * or zero if value does not implement this interface.
511 atk_table_get_selected_rows (AtkTable
*table
, gint
**selected
)
513 AtkTableIface
*iface
;
515 g_return_val_if_fail (ATK_IS_TABLE (table
), 0);
517 iface
= ATK_TABLE_GET_IFACE (table
);
519 if (iface
->get_selected_rows
)
520 return (iface
->get_selected_rows
) (table
, selected
);
526 * atk_table_get_selected_columns:
527 * @table: a GObject instance that implements AtkTableIface
528 * @selected: a #gint** that is to contain the selected columns numbers
530 * Gets the selected columns of the table by initializing **selected with
531 * the selected column numbers. This array should be freed by the caller.
533 * Returns: a gint representing the number of selected columns,
534 * or %0 if value does not implement this interface.
537 atk_table_get_selected_columns (AtkTable
*table
, gint
**selected
)
539 AtkTableIface
*iface
;
541 g_return_val_if_fail (ATK_IS_TABLE (table
), 0);
543 iface
= ATK_TABLE_GET_IFACE (table
);
545 if (iface
->get_selected_columns
)
546 return (iface
->get_selected_columns
) (table
, selected
);
552 * atk_table_is_column_selected:
553 * @table: a GObject instance that implements AtkTableIface
554 * @column: a #gint representing a column in @table
556 * Gets a boolean value indicating whether the specified @column
559 * Returns: a gboolean representing if the column is selected, or 0
560 * if value does not implement this interface.
563 atk_table_is_column_selected (AtkTable
*table
,
566 AtkTableIface
*iface
;
568 g_return_val_if_fail (ATK_IS_TABLE (table
), FALSE
);
570 iface
= ATK_TABLE_GET_IFACE (table
);
572 if (iface
->is_column_selected
)
573 return (iface
->is_column_selected
) (table
, column
);
579 * atk_table_is_row_selected:
580 * @table: a GObject instance that implements AtkTableIface
581 * @row: a #gint representing a row in @table
583 * Gets a boolean value indicating whether the specified @row
586 * Returns: a gboolean representing if the row is selected, or 0
587 * if value does not implement this interface.
590 atk_table_is_row_selected (AtkTable
*table
,
593 AtkTableIface
*iface
;
595 g_return_val_if_fail (ATK_IS_TABLE (table
), FALSE
);
597 iface
= ATK_TABLE_GET_IFACE (table
);
599 if (iface
->is_row_selected
)
600 return (iface
->is_row_selected
) (table
, row
);
606 * atk_table_is_selected:
607 * @table: a GObject instance that implements AtkTableIface
608 * @row: a #gint representing a row in @table
609 * @column: a #gint representing a column in @table
611 * Gets a boolean value indicating whether the accessible object
612 * at the specified @row and @column is selected
614 * Returns: a gboolean representing if the cell is selected, or 0
615 * if value does not implement this interface.
618 atk_table_is_selected (AtkTable
*table
,
622 AtkTableIface
*iface
;
624 g_return_val_if_fail (ATK_IS_TABLE (table
), FALSE
);
626 iface
= ATK_TABLE_GET_IFACE (table
);
628 if (iface
->is_selected
)
629 return (iface
->is_selected
) (table
, row
, column
);
635 * atk_table_add_row_selection:
636 * @table: a GObject instance that implements AtkTableIface
637 * @row: a #gint representing a row in @table
639 * Adds the specified @row to the selection.
641 * Returns: a gboolean representing if row was successfully added to selection,
642 * or 0 if value does not implement this interface.
645 atk_table_add_row_selection (AtkTable
*table
,
648 AtkTableIface
*iface
;
650 g_return_val_if_fail (ATK_IS_TABLE (table
), FALSE
);
652 iface
= ATK_TABLE_GET_IFACE (table
);
654 if (iface
->add_row_selection
)
655 return (iface
->add_row_selection
) (table
, row
);
660 * atk_table_remove_row_selection:
661 * @table: a GObject instance that implements AtkTableIface
662 * @row: a #gint representing a row in @table
664 * Removes the specified @row from the selection.
666 * Returns: a gboolean representing if the row was successfully removed from
667 * the selection, or 0 if value does not implement this interface.
670 atk_table_remove_row_selection (AtkTable
*table
,
673 AtkTableIface
*iface
;
675 g_return_val_if_fail (ATK_IS_TABLE (table
), FALSE
);
677 iface
= ATK_TABLE_GET_IFACE (table
);
679 if (iface
->remove_row_selection
)
680 return (iface
->remove_row_selection
) (table
, row
);
685 * atk_table_add_column_selection:
686 * @table: a GObject instance that implements AtkTableIface
687 * @column: a #gint representing a column in @table
689 * Adds the specified @column to the selection.
691 * Returns: a gboolean representing if the column was successfully added to
692 * the selection, or 0 if value does not implement this interface.
695 atk_table_add_column_selection (AtkTable
*table
,
698 AtkTableIface
*iface
;
700 g_return_val_if_fail (ATK_IS_TABLE (table
), FALSE
);
702 iface
= ATK_TABLE_GET_IFACE (table
);
704 if (iface
->add_column_selection
)
705 return (iface
->add_column_selection
) (table
, column
);
710 * atk_table_remove_column_selection:
711 * @table: a GObject instance that implements AtkTableIface
712 * @column: a #gint representing a column in @table
714 * Adds the specified @column to the selection.
716 * Returns: a gboolean representing if the column was successfully removed from
717 * the selection, or 0 if value does not implement this interface.
720 atk_table_remove_column_selection (AtkTable
*table
,
723 AtkTableIface
*iface
;
725 g_return_val_if_fail (ATK_IS_TABLE (table
), FALSE
);
727 iface
= ATK_TABLE_GET_IFACE (table
);
729 if (iface
->remove_column_selection
)
730 return (iface
->remove_column_selection
) (table
, column
);
736 * atk_table_set_caption:
737 * @table: a GObject instance that implements AtkTableIface
738 * @caption: a #AtkObject representing the caption to set for @table
740 * Sets the caption for the table.
743 atk_table_set_caption (AtkTable
*table
,
746 AtkTableIface
*iface
;
748 g_return_if_fail (ATK_IS_TABLE (table
));
750 iface
= ATK_TABLE_GET_IFACE (table
);
752 if (iface
->set_caption
)
753 (iface
->set_caption
) (table
, caption
);
757 * atk_table_set_column_description:
758 * @table: a GObject instance that implements AtkTableIface
759 * @column: a #gint representing a column in @table
760 * @description: a #gchar representing the description text
761 * to set for the specified @column of the @table
763 * Sets the description text for the specified @column of the @table.
766 atk_table_set_column_description (AtkTable
*table
,
768 const gchar
*description
)
770 AtkTableIface
*iface
;
772 g_return_if_fail (ATK_IS_TABLE (table
));
774 iface
= ATK_TABLE_GET_IFACE (table
);
776 if (iface
->set_column_description
)
777 (iface
->set_column_description
) (table
, column
, description
);
781 * atk_table_set_column_header:
782 * @table: a GObject instance that implements AtkTableIface
783 * @column: a #gint representing a column in @table
784 * @header: an #AtkTable
786 * Sets the specified column header to @header.
789 atk_table_set_column_header (AtkTable
*table
,
793 AtkTableIface
*iface
;
795 g_return_if_fail (ATK_IS_TABLE (table
));
797 iface
= ATK_TABLE_GET_IFACE (table
);
799 if (iface
->set_column_header
)
800 (iface
->set_column_header
) (table
, column
, header
);
804 * atk_table_set_row_description:
805 * @table: a GObject instance that implements AtkTableIface
806 * @row: a #gint representing a row in @table
807 * @description: a #gchar representing the description text
808 * to set for the specified @row of @table
810 * Sets the description text for the specified @row of @table.
813 atk_table_set_row_description (AtkTable
*table
,
815 const gchar
*description
)
817 AtkTableIface
*iface
;
819 g_return_if_fail (ATK_IS_TABLE (table
));
821 iface
= ATK_TABLE_GET_IFACE (table
);
823 if (iface
->set_row_description
)
824 (iface
->set_row_description
) (table
, row
, description
);
828 * atk_table_set_row_header:
829 * @table: a GObject instance that implements AtkTableIface
830 * @row: a #gint representing a row in @table
831 * @header: an #AtkTable
833 * Sets the specified row header to @header.
836 atk_table_set_row_header (AtkTable
*table
,
840 AtkTableIface
*iface
;
842 g_return_if_fail (ATK_IS_TABLE (table
));
844 iface
= ATK_TABLE_GET_IFACE (table
);
846 if (iface
->set_row_header
)
847 (iface
->set_row_header
) (table
, row
, header
);
851 * atk_table_set_summary:
852 * @table: a GObject instance that implements AtkTableIface
853 * @accessible: an #AtkObject representing the summary description
856 * Sets the summary description of the table.
859 atk_table_set_summary (AtkTable
*table
,
860 AtkObject
*accessible
)
862 AtkTableIface
*iface
;
864 g_return_if_fail (ATK_IS_TABLE (table
));
866 iface
= ATK_TABLE_GET_IFACE (table
);
868 if (iface
->set_summary
)
869 (iface
->set_summary
) (table
, accessible
);