📄 atktable.c
字号:
/* ATK - Accessibility Toolkit * Copyright 2001 Sun Microsystems Inc. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */#include "atktable.h"#include "atkmarshal.h"enum { ROW_INSERTED, ROW_DELETED, COLUMN_INSERTED, COLUMN_DELETED, ROW_REORDERED, COLUMN_REORDERED, MODEL_CHANGED, LAST_SIGNAL};static void atk_table_base_init (gpointer *g_class);static guint atk_table_signals[LAST_SIGNAL] = { 0 };GTypeatk_table_get_type (void){ static GType type = 0; if (!type) { GTypeInfo tinfo = { sizeof (AtkTableIface), (GBaseInitFunc) atk_table_base_init, (GBaseFinalizeFunc) NULL, }; type = g_type_register_static (G_TYPE_INTERFACE, "AtkTable", &tinfo, 0); } return type;}static voidatk_table_base_init (gpointer *g_class){ static gboolean initialized = FALSE; if (!initialized) { atk_table_signals[ROW_INSERTED] = g_signal_new ("row_inserted", ATK_TYPE_TABLE, G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (AtkTableIface, row_inserted), (GSignalAccumulator) NULL, NULL, atk_marshal_VOID__INT_INT, G_TYPE_NONE, 2, G_TYPE_INT, G_TYPE_INT); atk_table_signals[COLUMN_INSERTED] = g_signal_new ("column_inserted", ATK_TYPE_TABLE, G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (AtkTableIface, column_inserted), (GSignalAccumulator) NULL, NULL, atk_marshal_VOID__INT_INT, G_TYPE_NONE, 2, G_TYPE_INT, G_TYPE_INT); atk_table_signals[ROW_DELETED] = g_signal_new ("row_deleted", ATK_TYPE_TABLE, G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (AtkTableIface, row_deleted), (GSignalAccumulator) NULL, NULL, atk_marshal_VOID__INT_INT, G_TYPE_NONE, 2, G_TYPE_INT, G_TYPE_INT); atk_table_signals[COLUMN_DELETED] = g_signal_new ("column_deleted", ATK_TYPE_TABLE, G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (AtkTableIface, column_deleted), (GSignalAccumulator) NULL, NULL, atk_marshal_VOID__INT_INT, G_TYPE_NONE, 2, G_TYPE_INT, G_TYPE_INT); atk_table_signals[ROW_REORDERED] = g_signal_new ("row_reordered", ATK_TYPE_TABLE, G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (AtkTableIface, row_reordered), (GSignalAccumulator) NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0); atk_table_signals[COLUMN_REORDERED] = g_signal_new ("column_reordered", ATK_TYPE_TABLE, G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (AtkTableIface, column_reordered), (GSignalAccumulator) NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0); atk_table_signals[MODEL_CHANGED] = g_signal_new ("model_changed", ATK_TYPE_TABLE, G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (AtkTableIface, model_changed), (GSignalAccumulator) NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0); initialized = TRUE; }}/** * atk_table_ref_at: * @table: a GObject instance that implements AtkTableIface * @row: a #gint representing a row in @table * @column: a #gint representing a column in @table * * Get a reference to the table cell at @row, @column. * * Returns: a AtkObject* representing the referred to accessible **/AtkObject*atk_table_ref_at (AtkTable *table, gint row, gint column){ AtkTableIface *iface; g_return_val_if_fail (ATK_IS_TABLE (table), NULL); g_return_val_if_fail (row >= 0, NULL); g_return_val_if_fail (column >= 0, NULL); iface = ATK_TABLE_GET_IFACE (table); if (iface->ref_at) return (iface->ref_at) (table, row, column); else return NULL;}/** * atk_table_get_index_at: * @table: a GObject instance that implements AtkTableIface * @row: a #gint representing a row in @table * @column: a #gint representing a column in @table * * Gets a #gint representing the index at the specified @row and @column. * The value -1 is returned if the object at row,column is not a child * of table or table does not implement this interface. * * Returns: a #gint representing the index at specified position **/gintatk_table_get_index_at (AtkTable *table, gint row, gint column){ AtkTableIface *iface; g_return_val_if_fail (ATK_IS_TABLE (table), -1); g_return_val_if_fail (row >= 0, -1); g_return_val_if_fail (column >= 0, -1); iface = ATK_TABLE_GET_IFACE (table); if (iface->get_index_at) return (iface->get_index_at) (table, row, column); else return -1;}/** * atk_table_get_row_at_index: * @table: a GObject instance that implements AtkTableInterface * @index_: a #gint representing an index in @table * * Gets a #gint representing the row at the specified @index_, or -1 * if the table does not implement this interface * * Returns: a gint representing the row at the specified index. **/gintatk_table_get_row_at_index (AtkTable *table, gint index){ AtkTableIface *iface; g_return_val_if_fail (ATK_IS_TABLE (table), -1); iface = ATK_TABLE_GET_IFACE (table); if (iface->get_row_at_index) return (iface->get_row_at_index) (table, index); else return -1;}/** * atk_table_get_column_at_index: * @table: a GObject instance that implements AtkTableInterface * @index_: a #gint representing an index in @table * * Gets a #gint representing the column at the specified @index_, or -1 * if the table does not implement this interface * * Returns: a gint representing the column at the specified index. **/gintatk_table_get_column_at_index (AtkTable *table, gint index){ AtkTableIface *iface; g_return_val_if_fail (ATK_IS_TABLE (table), 0); iface = ATK_TABLE_GET_IFACE (table); if (iface->get_column_at_index) return (iface->get_column_at_index) (table, index); else return -1;}/** * atk_table_get_caption: * @table: a GObject instance that implements AtkTableInterface * * Gets the caption for the @table. * * Returns: a AtkObject* representing the table caption, or %NULL * if value does not implement this interface. **/AtkObject*atk_table_get_caption (AtkTable *table){ AtkTableIface *iface; g_return_val_if_fail (ATK_IS_TABLE (table), NULL); iface = ATK_TABLE_GET_IFACE (table); if (iface->get_caption) return (iface->get_caption) (table); else return NULL;}/** * atk_table_get_n_columns: * @table: a GObject instance that implements AtkTableIface * * Gets the number of columns in the table. * * Returns: a gint representing the number of columns, or 0 * if value does not implement this interface. **/gintatk_table_get_n_columns (AtkTable *table){ AtkTableIface *iface; g_return_val_if_fail (ATK_IS_TABLE (table), 0); iface = ATK_TABLE_GET_IFACE (table); if (iface->get_n_columns) return (iface->get_n_columns) (table); else return 0;}/** * atk_table_get_column_description: * @table: a GObject instance that implements AtkTableIface * @column: a #gint representing a column in @table * * Gets the description text of the specified @column in the table * * Returns: a gchar* representing the column description, or %NULL * if value does not implement this interface. **/G_CONST_RETURN gchar*atk_table_get_column_description (AtkTable *table, gint column){ AtkTableIface *iface; g_return_val_if_fail (ATK_IS_TABLE (table), NULL); iface = ATK_TABLE_GET_IFACE (table); if (iface->get_column_description) return (iface->get_column_description) (table, column); else return NULL;}/** * atk_table_get_column_extent_at: * @table: a GObject instance that implements AtkTableIface * @row: a #gint representing a row in @table * @column: a #gint representing a column in @table * * Gets the number of columns occupied by the accessible object * at the specified @row and @column in the @table. * * Returns: a gint representing the column extent at specified position, or 0 * if value does not implement this interface. **/gintatk_table_get_column_extent_at (AtkTable *table, gint row, gint column){ AtkTableIface *iface; g_return_val_if_fail (ATK_IS_TABLE (table), 0); iface = ATK_TABLE_GET_IFACE (table); if (iface->get_column_extent_at) return (iface->get_column_extent_at) (table, row, column); else return 0;}/** * atk_table_get_column_header: * @table: a GObject instance that implements AtkTableIface * @column: a #gint representing a column in the table * * Gets the column header of a specified column in an accessible table. * * Returns: a AtkObject* representing the specified column header, or * %NULL if value does not implement this interface. **/AtkObject*atk_table_get_column_header (AtkTable *table, gint column){ AtkTableIface *iface; g_return_val_if_fail (ATK_IS_TABLE (table), NULL); iface = ATK_TABLE_GET_IFACE (table); if (iface->get_column_header) return (iface->get_column_header) (table, column); else return NULL;}/** * atk_table_get_n_rows: * @table: a GObject instance that implements AtkTableIface * * Gets the number of rows in the table. * * Returns: a gint representing the number of rows, or 0 * if value does not implement this interface. **/gintatk_table_get_n_rows (AtkTable *table){ AtkTableIface *iface; g_return_val_if_fail (ATK_IS_TABLE (table), 0); iface = ATK_TABLE_GET_IFACE (table); if (iface->get_n_rows) return (iface->get_n_rows) (table); else return 0;}/** * atk_table_get_row_description: * @table: a GObject instance that implements AtkTableIface * @row: a #gint representing a row in @table * * Gets the description text of the specified row in the table * * Returns: a gchar* representing the row description, or %NULL * if value does not implement this interface. **/G_CONST_RETURN gchar*atk_table_get_row_description (AtkTable *table, gint row){ AtkTableIface *iface; g_return_val_if_fail (ATK_IS_TABLE (table), NULL); iface = ATK_TABLE_GET_IFACE (table); if (iface->get_row_description) return (iface->get_row_description) (table, row); else return NULL;}/** * atk_table_get_row_extent_at: * @table: a GObject instance that implements AtkTableIface * @row: a #gint representing a row in @table * @column: a #gint representing a column in @table * * Gets the number of rows occupied by the accessible object * at a specified @row and @column in the @table. * * Returns: a gint representing the row extent at specified position, or 0 * if value does not implement this interface. **/gintatk_table_get_row_extent_at (AtkTable *table, gint row,
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -