[at-spi2-core/gi] Add table interface
- From: Mike Gorse <mgorse src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [at-spi2-core/gi] Add table interface
- Date: Fri, 19 Nov 2010 18:41:28 +0000 (UTC)
commit 763653e95fe6fca98dffb96b791dd5b94777e971
Author: Mike Gorse <mgorse novell com>
Date: Fri Nov 19 13:43:40 2010 -0500
Add table interface
atspi/Makefile.am | 2 +
atspi/atspi-accessible.c | 24 ++-
atspi/atspi-accessible.h | 2 +
atspi/atspi-misc-private.h | 4 +-
atspi/atspi-misc.c | 69 ++++-
atspi/atspi-table.c | 730 ++++++++++++++++++++++++++++++++++++++++++++
atspi/atspi-table.h | 100 ++++++
atspi/atspi-types.h | 2 +-
atspi/atspi.h | 1 +
9 files changed, 917 insertions(+), 17 deletions(-)
---
diff --git a/atspi/Makefile.am b/atspi/Makefile.am
index fc8e401..327a623 100644
--- a/atspi/Makefile.am
+++ b/atspi/Makefile.am
@@ -35,6 +35,8 @@ libatspi_la_SOURCES = \
atspi-registry.h \
atspi-stateset.c \
atspi-stateset.h \
+ atspi-table.c \
+ atspi-table.h \
atspi-text.c \
atspi-text.h \
atspi-types.h
diff --git a/atspi/atspi-accessible.c b/atspi/atspi-accessible.c
index 4dae651..43da7dd 100644
--- a/atspi/atspi-accessible.c
+++ b/atspi/atspi-accessible.c
@@ -29,8 +29,20 @@ atspi_component_interface_init (AtspiComponent *component)
{
}
+static void
+atspi_table_interface_init (AtspiTable *table)
+{
+}
+
+static void
+atspi_text_interface_init (AtspiText *text)
+{
+}
+
G_DEFINE_TYPE_WITH_CODE (AtspiAccessible, atspi_accessible, G_TYPE_OBJECT,
- G_IMPLEMENT_INTERFACE (ATSPI_TYPE_COMPONENT, atspi_component_interface_init))
+ G_IMPLEMENT_INTERFACE (ATSPI_TYPE_COMPONENT, atspi_component_interface_init)
+ G_IMPLEMENT_INTERFACE (ATSPI_TYPE_TABLE, atspi_table_interface_init)
+ G_IMPLEMENT_INTERFACE (ATSPI_TYPE_TEXT, atspi_text_interface_init))
static void
atspi_accessible_init (AtspiAccessible *accessible)
@@ -913,6 +925,7 @@ atspi_accessible_get_streamable_content (AtspiAccessible *accessible)
return (_atspi_accessible_is_a (accessible, atspi_interface_streamable_content) ?
accessible : NULL);
}
+#endif
/**
* atspi_accessible_get_table:
@@ -920,16 +933,15 @@ atspi_accessible_get_streamable_content (AtspiAccessible *accessible)
*
* Get the #AtspiTable interface for an #AtspiAccessible.
*
- * Returns: a pointer to an #AtspiTable interface instance, or
+ * Returns: (transfer full): a pointer to an #AtspiTable interface instance, or
* NULL if @obj does not implement #AtspiTable.
**/
AtspiTable *
-atspi_accessible_get_table (AtspiAccessible *accessible)
+atspi_accessible_get_table (AtspiAccessible *obj)
{
- return (_atspi_accessible_is_a (accessible, atspi_interface_table) ?
- accessible : NULL);
+ return (_atspi_accessible_is_a (obj, atspi_interface_table) ?
+ g_object_ref (ATSPI_TABLE (obj)) : NULL);
}
-#endif
/**
* atspi_accessible_get_text:
diff --git a/atspi/atspi-accessible.h b/atspi/atspi-accessible.h
index 8d70707..de37bf8 100644
--- a/atspi/atspi-accessible.h
+++ b/atspi/atspi-accessible.h
@@ -97,5 +97,7 @@ AtspiAccessible * atspi_accessible_get_host_application (AtspiAccessible *obj, G
AtspiComponent * atspi_accessible_get_component (AtspiAccessible *obj);
+AtspiTable * atspi_accessible_get_table (AtspiAccessible *obj);
+
AtspiText * atspi_accessible_get_text (AtspiAccessible *obj);
#endif /* _ATSPI_ACCESSIBLE_H_ */
diff --git a/atspi/atspi-misc-private.h b/atspi/atspi-misc-private.h
index 6df407c..c491029 100644
--- a/atspi/atspi-misc-private.h
+++ b/atspi/atspi-misc-private.h
@@ -121,7 +121,9 @@ dbus_bool_t _atspi_dbus_call (gpointer obj, const char *interface, const char *m
DBusMessage *_atspi_dbus_call_partial (gpointer obj, const char *interface, const char *method, GError **error, const char *type, ...);
-dbus_bool_t _atspi_dbus_get_property (AtspiAccessible *obj, const char *interface, const char *name, GError **error, const char *type, void *data);
+DBusMessage *_atspi_dbus_call_partial_va (gpointer obj, const char *interface, const char *method, GError **error, const char *type, va_list args);
+
+dbus_bool_t _atspi_dbus_get_property (gpointer obj, const char *interface, const char *name, GError **error, const char *type, void *data);
DBusMessage * _atspi_dbus_send_with_reply_and_block (DBusMessage *message);
diff --git a/atspi/atspi-misc.c b/atspi/atspi-misc.c
index 1dbd6fd..f770b27 100644
--- a/atspi/atspi-misc.c
+++ b/atspi/atspi-misc.c
@@ -829,6 +829,23 @@ atspi_exit (void)
return leaked;
}
+static AtspiAccessible *
+_atspi_dbus_get_remote_object (gpointer obj,
+ const char *interface,
+ const char *method,
+ GError **error,
+ const char *type,
+ va_list args)
+{
+ DBusMessage *reply;
+
+ reply = _atspi_dbus_call_partial_va (obj, interface, method, error, type, args);
+ if (!reply)
+ return NULL;
+
+ return _atspi_dbus_return_accessible_from_message (reply);
+}
+
dbus_bool_t
_atspi_dbus_call (gpointer obj, const char *interface, const char *method, GError **error, const char *type, ...)
{
@@ -837,8 +854,11 @@ _atspi_dbus_call (gpointer obj, const char *interface, const char *method, GErro
DBusError err;
AtspiAccessible *accessible = ATSPI_ACCESSIBLE (obj);
- dbus_error_init (&err);
va_start (args, type);
+ if (!strcmp (type + strcspn (type, "="), "=>(so)"))
+ return _atspi_dbus_get_remote_object (obj, interface, method, error, type, args);
+
+ dbus_error_init (&err);
retval = dbind_method_call_reentrant_va (_atspi_bus(), accessible->app->bus_name, accessible->path, interface, method, &err, type, args);
va_end (args);
if (dbus_error_is_set (&err))
@@ -850,10 +870,27 @@ _atspi_dbus_call (gpointer obj, const char *interface, const char *method, GErro
}
DBusMessage *
-_atspi_dbus_call_partial (gpointer obj, const char *interface, const char *method, GError **error, const char *type, ...)
+_atspi_dbus_call_partial (gpointer obj,
+ const char *interface,
+ const char *method,
+ GError **error,
+ const char *type, ...)
{
- AtspiAccessible *accessible = ATSPI_ACCESSIBLE (obj);
va_list args;
+
+ va_start (args, type);
+ return _atspi_dbus_call_partial_va (obj, interface, method, error, type, args);
+}
+
+DBusMessage *
+_atspi_dbus_call_partial_va (gpointer obj,
+ const char *interface,
+ const char *method,
+ GError **error,
+ const char *type,
+ va_list args)
+{
+ AtspiAccessible *accessible = ATSPI_ACCESSIBLE (obj);
dbus_bool_t retval;
DBusError err;
DBusMessage *msg = NULL, *reply = NULL;
@@ -861,7 +898,6 @@ _atspi_dbus_call_partial (gpointer obj, const char *interface, const char *metho
const char *p;
dbus_error_init (&err);
- va_start (args, type);
msg = dbus_message_new_method_call (accessible->app->bus_name, accessible->path, interface, method);
if (!msg)
@@ -883,14 +919,21 @@ out:
}
dbus_bool_t
-_atspi_dbus_get_property (AtspiAccessible *obj, const char *interface, const char *name, GError **error, const char *type, void *data)
+_atspi_dbus_get_property (gpointer obj, const char *interface, const char *name, GError **error, const char *type, void *data)
{
DBusMessage *message, *reply;
DBusMessageIter iter, iter_variant;
DBusError err;
dbus_bool_t retval = FALSE;
+ AtspiAccessible *accessible = ATSPI_ACCESSIBLE (obj);
- message = dbus_message_new_method_call (obj->app->bus_name, obj->path, "org.freedesktop.DBus.Properties", "Get");
+ if (!accessible)
+ return NULL;
+
+ message = dbus_message_new_method_call (accessible->app->bus_name,
+ accessible->path,
+ "org.freedesktop.DBus.Properties",
+ "Get");
if (!message)
{
// TODO: throw exception
@@ -912,9 +955,17 @@ _atspi_dbus_get_property (AtspiAccessible *obj, const char *interface, const cha
g_warning ("atspi_dbus_get_property: Wrong type: expected %s, got %c\n", type, dbus_message_iter_get_arg_type (&iter_variant));
goto done;
}
- dbus_message_iter_get_basic (&iter_variant, data);
- dbus_message_unref (reply);
- if (type[0] == 's') *(char **)data = g_strdup (*(char **)data);
+ if (!strcmp (type, "(so)"))
+ {
+ *((AtspiAccessible **)data) = _atspi_dbus_return_accessible_from_iter (&iter_variant);
+ }
+ else
+ {
+ dbus_message_iter_get_basic (&iter_variant, data);
+ dbus_message_unref (reply);
+ if (type [0] == 's')
+ *(char **)data = g_strdup (*(char **)data);
+ }
retval = TRUE;
done:
return retval;
diff --git a/atspi/atspi-table.c b/atspi/atspi-table.c
new file mode 100644
index 0000000..08c6aef
--- /dev/null
+++ b/atspi/atspi-table.c
@@ -0,0 +1,730 @@
+/*
+ * 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 <stdlib.h> /* 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;
+ AtspiAccessible *retval = NULL;
+
+ g_return_val_if_fail (obj != NULL, NULL);
+
+ !_atspi_dbus_call (obj, atspi_interface_table, "GetRowHeader", error, "i=>(so)", d_row, &retval);
+
+ return retval;
+}
+
+/**
+ * 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;
+ AtspiAccessible *retval = NULL;
+
+ g_return_val_if_fail (obj != NULL, NULL);
+
+ !_atspi_dbus_call (obj, atspi_interface_table, "GetColumnHeader", error, "i=>(so)", d_column, &retval);
+
+ return retval;
+}
+
+/**
+ * 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;
+}
diff --git a/atspi/atspi-table.h b/atspi/atspi-table.h
new file mode 100644
index 0000000..fb18d57
--- /dev/null
+++ b/atspi/atspi-table.h
@@ -0,0 +1,100 @@
+/*
+ * AT-SPI - Assistive Technology Service Provider Interface
+ * (Gnome Accessibility Project; http://developer.gnome.org/projects/gap)
+ *
+ * Copyright 2002 Ximian, Inc.
+ * 2002 Sun Microsystems 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.
+ */
+
+#ifndef _ATSPI_TABLE_H_
+#define _ATSPI_TABLE_H_
+
+#include "glib-object.h"
+
+#include "atspi-constants.h"
+
+#include "atspi-types.h"
+
+#define ATSPI_TYPE_TABLE (atspi_table_get_type ())
+#define ATSPI_IS_TABLE(obj) G_TYPE_CHECK_INSTANCE_TYPE ((obj), ATSPI_TYPE_TABLE)
+#define ATSPI_TABLE(obj) G_TYPE_CHECK_INSTANCE_CAST ((obj), ATSPI_TYPE_TABLE, AtspiTable)
+#define ATSPI_TABLE_GET_IFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), ATSPI_TYPE_TABLE, AtspiTable))
+
+GType atspi_table_get_type ();
+
+struct _AtspiTable
+{
+ GTypeInterface parent;
+};
+
+AtspiAccessible * atspi_table_get_caption (AtspiTable *obj, GError **error);
+
+AtspiAccessible * atspi_table_get_summary (AtspiTable *obj, GError **error);
+
+gint atspi_table_get_n_rows (AtspiTable *obj, GError **error);
+
+gint atspi_table_get_n_columns (AtspiTable *obj, GError **error);
+
+AtspiAccessible * atspi_table_get_accessible_at (AtspiTable *obj, gint row, gint column, GError **error);
+
+gint atspi_table_get_index_at (AtspiTable *obj, gint row, gint column, GError **error);
+
+gint atspi_table_get_row_at_index (AtspiTable *obj, gint index, GError **error);
+
+gint atspi_table_get_column_at_index (AtspiTable *obj, gint index, GError **error);
+
+gchar * atspi_table_get_row_description (AtspiTable *obj, gint row, GError **error);
+
+gchar * atspi_table_get_column_description (AtspiTable *obj, gint column, GError **error);
+
+gint
+atspi_table_get_row_extent_at (AtspiTable *obj, gint row, gint column, GError **error);
+
+gint
+atspi_table_get_column_extent_at (AtspiTable *obj, gint row, gint column, GError **error);
+
+AtspiAccessible * atspi_table_get_row_header (AtspiTable *obj, gint row, GError **error);
+
+AtspiAccessible * atspi_table_get_column_header (AtspiTable *obj, gint column, GError **error);
+
+gint atspi_table_get_n_selected_rows (AtspiTable *obj, GError **error);
+
+GArray *atspi_table_get_selected_rows (AtspiTable *obj, GError **error);
+
+GArray * atspi_table_get_selected_columns (AtspiTable *obj, GError **error);
+
+gint atspi_table_get_n_selected_columns (AtspiTable *obj, GError **error);
+
+gboolean atspi_table_is_row_selected (AtspiTable *obj, gint row, GError **error);
+
+gboolean atspi_table_is_column_selected (AtspiTable *obj, gint column, GError **error);
+
+gboolean atspi_table_add_row_selection (AtspiTable *obj, gint row, GError **error);
+
+gboolean atspi_table_add_column_selection (AtspiTable *obj, gint column, GError **error);
+
+gboolean atspi_table_remove_row_selection (AtspiTable *obj, gint row, GError **error);
+
+gboolean atspi_table_remove_column_selection (AtspiTable *obj, gint column, GError **error);
+
+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);
+
+gboolean atspi_table_is_selected (AtspiTable *obj, gint row, gint column, GError **error);
+
+#endif /* _ATSPI_TABLE_H_ */
diff --git a/atspi/atspi-types.h b/atspi/atspi-types.h
index 0dc4f1a..40eaa47 100644
--- a/atspi/atspi-types.h
+++ b/atspi/atspi-types.h
@@ -37,7 +37,7 @@ typedef struct _AtspiAccessible AtspiDocument;
typedef struct _AtspiAccessible AtspiEditableText;
typedef struct _AtspiAccessible AtspiHypertext;
typedef struct _AtspiAccessible AtspiSelection;
-typedef struct _AtspiAccessible AtspiTable;
+typedef struct _AtspiTable AtspiTable;
typedef struct _AtspiText AtspiText;
typedef struct _AtspiAccessible AtspiValue;
diff --git a/atspi/atspi.h b/atspi/atspi.h
index c5d8fac..aa341ff 100644
--- a/atspi/atspi.h
+++ b/atspi/atspi.h
@@ -34,6 +34,7 @@
#include "atspi-event-listener.h"
#include "atspi-misc.h"
#include "atspi-registry.h"
+#include "atspi-table.h"
#include "atspi-text.h"
#endif
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]