/* * AT-SPI - Assistive Technology Service Provider Interface * (Gnome Accessibility Project; http://developer.gnome.org/projects/gap) * * Copyright 2001, 2002 Sun Microsystems Inc., * Copyright 2001, 2002 Ximian, Inc. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library 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 * Library General Public License for more details. * * You should have received a copy of the GNU Library 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 /* for malloc */ #include "atspi-private.h" /** * atspi_table_get_caption: * @obj: a pointer to the #AtspiTable implementor on which to operate. * * Get an accessible representation of the caption for an #AtspiTable. * * Returns: (transfer full): an #Accessible object that serves as the table's * caption. **/ AtspiAccessible * atspi_table_get_caption (AtspiTable *obj, GError **error) { char *path; AtspiAccessible *retval = NULL; g_return_val_if_fail (obj != NULL, NULL); _atspi_dbus_get_property (obj, atspi_interface_table, "Caption", error, "(so)", &retval); return retval; } /** * atspi_table_get_summary: * @obj: a pointer to the #AtspiTable implementor on which to operate. * * Get an accessible object which summarizes the contents of an #AtspiTable. * * Returns: (transfer full): an #AtspiAccessible object that serves as the * table's summary (often a reduced #AtspiTable). **/ AtspiAccessible * atspi_table_get_summary (AtspiTable *obj, GError **error) { AtspiAccessible *retval; g_return_val_if_fail (obj != NULL, NULL); _atspi_dbus_get_property (obj, atspi_interface_table, "Summary", error, "(so)", &retval); return retval; } /** * atspi_table_get_n_rows: * @obj: a pointer to the #AtspiTable implementor on which to operate. * * Get the number of rows in an #AtspiTable, * exclusive of any rows that are programmatically hidden, but inclusive * of rows that may be outside of the current scrolling window or viewport. * * Returns: an integer indicating the number of rows in the table. **/ gint atspi_table_get_n_rows (AtspiTable *obj, GError **error) { dbus_int32_t retval = -1; g_return_val_if_fail (obj != NULL, -1); _atspi_dbus_get_property (obj, atspi_interface_table, "NRows", error, "i", &retval); return retval; } /** * atspi_table_get_n_columns: * @obj: a pointer to the #AtspiTable implementor on which to operate. * * Get the number of columns in an #AtspiTable, * exclusive of any columns that are programmatically hidden, but inclusive * of columns that may be outside of the current scrolling window or viewport. * * Returns: an integer indicating the number of columns in the table. **/ gint atspi_table_get_n_columns (AtspiTable *obj, GError **error) { dbus_int32_t retval = -1; g_return_val_if_fail (obj != NULL, -1); _atspi_dbus_get_property (obj, atspi_interface_table, "NColumns", error, "i", &retval); return retval; } /** * atspi_table_get_accessible_at: * @obj: a pointer to the #AtspiTable implementor on which to operate. * @row: the specified table row, zero-indexed. * @column: the specified table column, zero-indexed. * * Get the table cell at the specified row and column indices. * To get the accessible object at a particular (x, y) screen coordinate, * use #atspi_component_get_accessible_at_point (). * * Returns: (transfer full): an #AtspiAccessible object representing the * specified table cell. **/ AtspiAccessible * atspi_table_get_accessible_at (AtspiTable *obj, gint row, gint column, GError **error) { dbus_int32_t d_row = row, d_column = column; AtspiAccessible *retval; DBusMessage *reply; g_return_val_if_fail (obj != NULL, NULL); reply = _atspi_dbus_call_partial (obj, atspi_interface_table, "GetAccessibleAt", error, "ii", row, column); return _atspi_dbus_return_accessible_from_message (reply); } /** * atspi_table_get_index_at: * @obj: a pointer to the #AtspiTable implementor on which to operate. * @row: the specified table row, zero-indexed. * @column: the specified table column, zero-indexed. * * Get the 1-D child index corresponding to the specified 2-D row and column indices. * To get the accessible object at a particular (x, y) screen coordinate, * use #Accessible_getAccessibleAtPoint (). * @see #atspi_table_getRowAtIndex(), #atspi_table_getColumnAtIndex() * * Returns: a long integer which serves as the index of a specified cell in the * table, in a form usable by #Accessible_getChildAtIndex(). **/ gint atspi_table_get_index_at (AtspiTable *obj, gint row, gint column, GError **error) { dbus_int32_t d_row = row, d_column = column; dbus_int32_t retval = -1; g_return_val_if_fail (obj != NULL, -1); _atspi_dbus_call (obj, atspi_interface_table, "GetIndexAt", error, "ii=>i", d_row, d_column, &retval); return retval; } /** * atspi_table_get_row_at_index: * @obj: a pointer to the #AtspiTable implementor on which to operate. * @index: the specified child index, zero-indexed. * * Get the table row index occupied by the child at a particular 1-D child index. * * @see #atspi_table_get_indexAt(), #atspi_table_get_columnAtIndex() * * Returns: a long integer indicating the first row spanned by the child of a * table, at the specified 1-D (zero-offset) @index. **/ gint atspi_table_get_row_at_index (AtspiTable *obj, gint index, GError **error) { dbus_int32_t d_index = index; dbus_int32_t retval = -1; g_return_val_if_fail (obj != NULL, -1); _atspi_dbus_call (obj, atspi_interface_table, "GetRowAtIndex", error, "i=>i", d_index, &retval); return retval; } /** * atspi_table_get_column_at_index: * @obj: a pointer to the #AtspiTable implementor on which to operate. * @index: the specified child index, zero-indexed. * * Get the table column index occupied by the child at a particular 1-D child index. * * @see #atspi_table_getIndexAt(), #atspi_table_getRowAtIndex() * * Returns: a long integer indicating the first column spanned by the child of a * table, at the specified 1-D (zero-offset) @index. **/ gint atspi_table_get_column_at_index (AtspiTable *obj, gint index, GError **error) { dbus_int32_t d_index = index; dbus_int32_t retval = -1; g_return_val_if_fail (obj != NULL, -1); _atspi_dbus_call (obj, atspi_interface_table, "GetColumnAtIndex", error, "i=>i", d_index, &retval); return retval; } /** * atspi_table_get_row_description: * @obj: a pointer to the #AtspiTable implementor on which to operate. * @row: the specified table row, zero-indexed. * * Get a text description of a particular table row. This differs from * atspi_table_get_row_header, which returns an #AtspiAccessible. * * Returns: a UTF-8 string describing the specified table row, if available. **/ gchar * atspi_table_get_row_description (AtspiTable *obj, gint row, GError **error) { dbus_int32_t d_row = row; char *retval = NULL; g_return_val_if_fail (obj != NULL, NULL); _atspi_dbus_call (obj, atspi_interface_table, "GetRowDescription", error, "i=>s", d_row, &retval); return retval; } /** * atspi_table_get_column_description: * @obj: a pointer to the #AtspiTable implementor on which to operate. * @column: the specified table column, zero-indexed. * * Get a text description of a particular table column. This differs from * atspi_table_get_column_header, which returns an #Accessible. * * Returns: a UTF-8 string describing the specified table column, if available. **/ gchar * atspi_table_get_column_description (AtspiTable *obj, gint column, GError **error) { dbus_int32_t d_column = column; char *retval = NULL; g_return_val_if_fail (obj != NULL, NULL); _atspi_dbus_call (obj, atspi_interface_table, "GetColumnDescription", error, "i=>s", d_column, &retval); return retval; } /** * atspi_table_get_row_extent_at: * @obj: a pointer to the #AtspiTable implementor on which to operate. * @row: the specified table row, zero-indexed. * @column: the specified table column, zero-indexed. * * Get the number of rows spanned by the table cell at the specific row and column. * (some tables can have cells which span multiple rows and/or columns). * * Returns: a long integer indicating the number of rows spanned by the specified cell. **/ gint atspi_table_get_row_extent_at (AtspiTable *obj, gint row, gint column, GError **error) { dbus_int32_t d_row = row, d_column = column; dbus_int32_t retval = -1; g_return_val_if_fail (obj != NULL, -1); _atspi_dbus_call (obj, atspi_interface_table, "GetRowExtentAt", error, "ii=>i", d_row, d_column, &retval); return retval; } /** * atspi_table_get_column_extent_at: * @obj: a pointer to the #AtspiTable implementor on which to operate. * @row: the specified table row, zero-indexed. * @column: the specified table column, zero-indexed. * * Get the number of columns spanned by the table cell at the specific row and column. * (some tables can have cells which span multiple rows and/or columns). * * Returns: a long integer indicating the number of columns spanned by the specified cell. **/ gint atspi_table_get_column_extent_at (AtspiTable *obj, gint row, gint column, GError **error) { dbus_int32_t d_row = row, d_column = column; dbus_int32_t retval = -1; g_return_val_if_fail (obj != NULL, -1); _atspi_dbus_call (obj, atspi_interface_table, "GetColumnExtentAt", error, "ii=>i", d_row, d_column, &retval); return retval; } /** * atspi_table_get_row_header: * @obj: a pointer to the #AtspiTable implementor on which to operate. * @row: the specified table row, zero-indexed. * * Get the header associated with a table row, if available. This differs from * atspi_table_get_row_description, which returns a string. * * Returns: (transfer full): a #Accessible representatin of the specified * table row, if available. **/ AtspiAccessible * atspi_table_get_row_header (AtspiTable *obj, gint row, GError **error) { dbus_int32_t d_row = row; DBusMessage *reply; g_return_val_if_fail (obj != NULL, NULL); reply = _atspi_dbus_call_partial (obj, atspi_interface_table, "GetRowHeader", error, "i", d_row); return _atspi_dbus_return_accessible_from_message (reply); } /** * atspi_table_get_column_header: * @obj: a pointer to the #AtspiTable implementor on which to operate. * @column: the specified table column, zero-indexed. * * Get the header associated with a table column, if available. This differs from * atspi_table_get_column_description, which returns a string. * * Returns: (transfer full): a #AtspiAccessible representation of the * specified table column, if available. **/ AtspiAccessible * atspi_table_get_column_header (AtspiTable *obj, gint column, GError **error) { dbus_int32_t d_column = column; DBusMessage *reply; g_return_val_if_fail (obj != NULL, NULL); reply = _atspi_dbus_call_partial (obj, atspi_interface_table, "GetColumnHeader", error, "i", &d_column); return _atspi_dbus_return_accessible_from_message (reply); } /** * atspi_table_get_n_selected_rows: * @obj: a pointer to the #AtspiTable implementor on which to operate. * * Query a table to find out how many rows are currently selected. Not all tables * support row selection. * * Returns: a long integer indicating the number of rows currently selected. **/ gint atspi_table_get_n_selected_rows (AtspiTable *obj, GError **error) { dbus_int32_t retval = -1; g_return_val_if_fail (obj != NULL, -1); _atspi_dbus_get_property (obj, atspi_interface_table, "NSelectedRows", error, "i", &retval); return retval; } /** * atspi_table_get_selected_rows: * @obj: a pointer to the #AtspiTable implementor on which to operate. * * Query a table for a list of indices of rows which are currently selected. * * Returns: (element-type gint) (transfer full): an array of integers, * specifying which rows are currently selected. **/ GArray * atspi_table_get_selected_rows (AtspiTable *obj, GError **error) { GArray *rows = NULL; g_return_val_if_fail (obj != NULL, 0); _atspi_dbus_call (obj, atspi_interface_table, "GetSelectedRows", error, "=>ai", &rows); return rows; } /** * atspi_table_get_selected_columns: * @obj: a pointer to the #AtspiTable implementor on which to operate. * * Query a table for a list of indices of columns which are currently selected. * * Returns: (element-type gint) (transfer full): an array of integers, * specifying which columns are currently selected. **/ GArray * atspi_table_get_selected_columns (AtspiTable *obj, GError **error) { GArray *columns = NULL; g_return_val_if_fail (obj != NULL, 0); _atspi_dbus_call (obj, atspi_interface_table, "GetSelectedColumns", error, "=>ai", &columns); return columns; } /** * atspi_table_get_n_selected_columns: * @obj: a pointer to the #AtspiTable implementor on which to operate. * * Query a table to find out how many columns are currently selected. Not all tables * support column selection. * * Returns: a long integer indicating the number of columns currently selected. **/ gint atspi_table_get_n_selected_columns (AtspiTable *obj, GError **error) { dbus_int32_t retval = -1; g_return_val_if_fail (obj != NULL, -1); _atspi_dbus_get_property (obj, atspi_interface_table, "NSelectedColumns", error, "i", &retval); return retval; } /** * atspi_table_is_row_selected: * @obj: a pointer to the #AtspiTable implementor on which to operate. * @row: the zero-indexed row number of the row being queried. * * Determine whether a table row is selected. Not all tables support row selection. * * Returns: #TRUE if the specified row is currently selected, #FALSE if not. **/ gboolean atspi_table_is_row_selected (AtspiTable *obj, gint row, GError **error) { dbus_int32_t d_row = row; dbus_bool_t retval = FALSE; g_return_val_if_fail (obj != NULL, FALSE); _atspi_dbus_call (obj, atspi_interface_table, "IsRowSelected", error, "i=>b", d_row, &retval); return retval; } /** * atspi_table_is_column_selected: * @obj: a pointer to the #AtspiTable implementor on which to operate. * @column: the zero-indexed column number of the column being queried. * * Determine whether specified table column is selected. * Not all tables support column selection. * * Returns: #TRUE if the specified column is currently selected, #FALSE if not. **/ gboolean atspi_table_is_column_selected (AtspiTable *obj, gint column, GError **error) { dbus_int32_t d_column = column; dbus_bool_t retval = FALSE; g_return_val_if_fail (obj != NULL, FALSE); _atspi_dbus_call (obj, atspi_interface_table, "IsColumnSelected", error, "i=>b", d_column, &retval); return retval; } /** * atspi_table_add_row_selection: * @obj: a pointer to the #AtspiTable implementor on which to operate. * @row: the zero-indexed row number of the row being selected. * * Select the specified row, adding it to the current row selection. * Not all tables support row selection. * * Returns: #TRUE if the specified row was successfully selected, #FALSE if not. **/ gboolean atspi_table_add_row_selection (AtspiTable *obj, gint row, GError **error) { dbus_int32_t d_row = row; dbus_bool_t retval = FALSE; g_return_val_if_fail (obj != NULL, FALSE); _atspi_dbus_call (obj, atspi_interface_table, "AddRowSelection", error, "i=>b", d_row, &retval); return retval; } /** * atspi_table_add_column_selection: * @obj: a pointer to the #AtspiTable implementor on which to operate. * @column: the zero-indexed column number of the column being selected. * * Select the specified column, adding it to the current column selection. * Not all tables support column selection. * * Returns: #TRUE if the specified column was successfully selected, #FALSE if not. **/ gboolean atspi_table_add_column_selection (AtspiTable *obj, gint column, GError **error) { dbus_int32_t d_column = column; dbus_bool_t retval = FALSE; g_return_val_if_fail (obj != NULL, FALSE); _atspi_dbus_call (obj, atspi_interface_table, "AddColumnSelection", error, "i=>b", d_column, &retval); return retval; } /** * atspi_table_remove_row_selection: * @obj: a pointer to the #AtspiTable implementor on which to operate. * @row: the zero-indexed number of the row being deselected. * * De-select the specified row, removing it to the current row selection. * Not all tables support row selection. * * Returns: #TRUE if the specified row was successfully de-selected, #FALSE if not. **/ gboolean atspi_table_remove_row_selection (AtspiTable *obj, gint row, GError **error) { dbus_int32_t d_row = row; dbus_bool_t retval = FALSE; g_return_val_if_fail (obj != NULL, FALSE); _atspi_dbus_call (obj, atspi_interface_table, "RemoveRowSelection", error, "i=>b", d_row, &retval); return retval; } /** * atspi_table_remove_column_selection: * @obj: a pointer to the #AtspiTable implementor on which to operate. * @column: the zero-indexed column number of the column being de-selected. * * De-select the specified column, removing it to the current column selection. * Not all tables support column selection. * * Returns: #TRUE if the specified column was successfully de-selected, #FALSE if not. **/ gboolean atspi_table_remove_column_selection (AtspiTable *obj, gint column, GError **error) { dbus_int32_t d_column = column; dbus_bool_t retval = FALSE; g_return_val_if_fail (obj != NULL, FALSE); _atspi_dbus_call (obj, atspi_interface_table, "RemoveColumnSelection", error, "i=>b", d_column, &retval); return retval; } /** * atspi_table_get_row_column_extents_at_index: * @obj: a pointer to the #AtspiTable implementor on which to operate. * @index: the index of the Table child whose row/column * extents are requested. * @row: back-filled with the first table row associated with * the cell with child index \c index. * @col: back-filled with the first table column associated * with the cell with child index \c index. * @row_extents: back-filled with the number of table rows * across which child \c i extends. * @col_extents: back-filled with the number of table columns * across which child \c i extends. * @is_selected: a boolean which is back-filled with \c True * if the child at index \c i corresponds to a selected table cell, * \c False otherwise. * * Given a child index, determine the row and column indices and * extents, and whether the cell is currently selected. If * the child at \c index is not a cell (for instance, if it is * a summary, caption, etc.), \c False is returned. * * Example: * If the Table child at index '6' extends across columns 5 and 6 of * row 2 of a Table instance, and is currently selected, then * * retval = table::getRowColumnExtentsAtIndex (6, row, col, * row_extents, * col_extents, * is_selected); * * will return True, and after the call * row, col, row_extents, col_extents, * and \c is_selected will contain 2, 5, 1, 2, and * True, respectively. * * Returns: \c True if the index is associated with a valid table * cell, \c False if the index does not correspond to a cell. If * \c False is returned, the values of the out parameters are * undefined. **/ gboolean atspi_table_get_row_column_extents_at_index (AtspiTable *obj, gint index, gint *row, gint *col, gint *row_extents, gint *col_extents, gboolean *is_selected, GError **error) { dbus_int32_t d_index = index; dbus_bool_t retval = FALSE; dbus_int32_t d_row = 0, d_col = 0, d_row_extents = 0, d_col_extents = 0; dbus_bool_t d_is_selected = FALSE; g_return_val_if_fail (obj != NULL, FALSE); _atspi_dbus_call (obj, atspi_interface_table, "GetRowColumnExtentsAtIndex", error, "i=>iiiibb", d_index, &d_row, &d_col, &d_row_extents, &d_col_extents, &d_is_selected, &retval); *col = d_col; *row_extents = d_row_extents;; *col_extents = d_col_extents; *is_selected = d_is_selected;; return retval; } /** * atspi_table_is_selected: * @obj: a pointer to the #AtspiTable implementor on which to operate. * @row: the zero-indexed row of the cell being queried. * @column: the zero-indexed column of the cell being queried. * * Determine whether the cell at a specific row and column is selected. * * Returns: #TRUE if the specified cell is currently selected, #FALSE if not. **/ gboolean atspi_table_is_selected (AtspiTable *obj, gint row, gint column, GError **error) { dbus_int32_t d_row = row, d_column = column; dbus_bool_t retval = FALSE; g_return_val_if_fail (obj != NULL, FALSE); _atspi_dbus_call (obj, atspi_interface_table, "IsSelected", error, "ii=>b", d_row, d_column, &retval); return retval; } static void atspi_table_base_init (AtspiTable *klass) { } GType atspi_table_get_type (void) { static GType type = 0; if (!type) { static const GTypeInfo tinfo = { sizeof (AtspiTable), (GBaseInitFunc) atspi_table_base_init, (GBaseFinalizeFunc) NULL, }; type = g_type_register_static (G_TYPE_INTERFACE, "AtspiTable", &tinfo, 0); } return type; }