}
static void
+atspi_table_cell_interface_init (AtspiTableCell *cell)
+{
+}
+
+static void
atspi_text_interface_init (AtspiText *text)
{
}
G_IMPLEMENT_INTERFACE (ATSPI_TYPE_IMAGE, atspi_image_interface_init)
G_IMPLEMENT_INTERFACE (ATSPI_TYPE_SELECTION, atspi_selection_interface_init)
G_IMPLEMENT_INTERFACE (ATSPI_TYPE_TABLE, atspi_table_interface_init)
+ G_IMPLEMENT_INTERFACE (ATSPI_TYPE_TABLE_CELL, atspi_table_cell_interface_init)
G_IMPLEMENT_INTERFACE (ATSPI_TYPE_TEXT, atspi_text_interface_init)
G_IMPLEMENT_INTERFACE (ATSPI_TYPE_VALUE, atspi_value_interface_init))
}
/**
+ * atspi_accessible_is_table_cell:
+ * @obj: a pointer to the #AtspiAccessible instance to query.
+ *
+ * Query whether the specified #AtspiAccessible implements the
+ * #AtspiTableCell interface.
+ *
+ * Returns: #TRUE if @obj implements the #AtspiTable interface,
+ * #FALSE otherwise.
+**/
+gboolean
+atspi_accessible_is_table_cell (AtspiAccessible *obj)
+{
+ return _atspi_accessible_is_a (obj,
+ atspi_interface_table_cell);
+}
+
+/**
* atspi_accessible_is_streamable_content:
* @obj: a pointer to the #AtspiAccessible instance to query.
*
}
/**
+ * atspi_accessible_get_table_cell:
+ * @obj: a pointer to the #AtspiAccessible instance to query.
+ *
+ * Gets the #AtspiTableCell interface for an #AtspiAccessible.
+ *
+ * Returns: (transfer full): a pointer to an #AtspiTableCell interface instance,
+ * or NULL if @obj does not implement #AtspiTable.
+ **/
+AtspiTableCell *
+atspi_accessible_get_table_cell (AtspiAccessible *obj)
+{
+ return (_atspi_accessible_is_a (obj, atspi_interface_table_cell) ?
+ g_object_ref (ATSPI_TABLE_CELL (obj)) : NULL);
+}
+
+/**
* atspi_accessible_get_text:
* @obj: a pointer to the #AtspiAccessible instance to query.
*
append_const_val (ret, "Selection");
if (atspi_accessible_is_table (obj))
append_const_val (ret, "Table");
+ if (atspi_accessible_is_table_cell (obj))
+ append_const_val (ret, "TableCell");
if (atspi_accessible_is_text (obj))
append_const_val (ret, "Text");
if (atspi_accessible_is_value (obj))
--- /dev/null
+/*
+ * 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.
+ * Copyright 2013 SUSE LLC.
+ *
+ * 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"
+
+static GPtrArray *
+get_object_array_and_unref (DBusMessage *reply)
+{
+ DBusMessageIter iter, iter_array;
+ GPtrArray *array;
+
+ if (!reply)
+ return NULL;
+
+ if (strcmp (dbus_message_get_signature (reply), "(so)") != 0)
+ {
+ dbus_message_unref (reply);
+ return NULL;
+ }
+
+ array = g_ptr_array_new ();
+
+ dbus_message_iter_init (reply, &iter);
+ dbus_message_iter_recurse (&iter, &iter_array);
+ while (dbus_message_iter_get_arg_type (&iter_array) != DBUS_TYPE_INVALID)
+ {
+ AtspiAccessible *accessible = _atspi_dbus_return_accessible_from_iter (&iter_array);
+ g_ptr_array_add (array, accessible);
+ }
+ dbus_message_unref (reply);
+ return array;
+}
+
+/**
+ * atspi_table_cell_get_column_span:
+ * @obj: a GObject instance that implements AtspiTableCellIface
+ *
+ * Returns the number of columns occupied by this cell accessible.
+ *
+ * Returns: a gint representing the number of columns occupied by this cell,
+ * or 0 if the cell does not implement this method.
+ */
+gint
+atspi_table_cell_get_column_span (AtspiTableCell *obj, GError *error)
+{
+ dbus_int32_t retval = -1;
+
+ g_return_val_if_fail (obj != NULL, -1);
+
+ _atspi_dbus_get_property (obj, atspi_interface_table_cell, "ColumnSpan",
+ error, "i", &retval);
+
+ return retval;
+}
+
+/**
+ * atspi_table_cell_get_column_header_cells:
+ * @obj: a GObject instance that implements AtspiTableCellIface
+ *
+ * Returns the column headers as an array of cell accessibles.
+ *
+ * Returns: (element-type AtspiAccessible) (transfer full): a GPtrArray of
+ * AtspiAccessibles representing the column header cells.
+ */
+GPtrArray *
+atspi_table_cell_get_column_header_cells (AtspiTableCell *obj, GError **error)
+{
+ DBusMessage *reply;
+
+ g_return_val_if_fail (obj != NULL, NULL);
+
+ reply = _atspi_dbus_call_partial (obj, atspi_interface_table_cell, "GetColumnHeaderCells", error, "");
+
+ return get_object_array_and_unref (reply);
+}
+
+/**
+ * atspi_table_cell_get_column_index:
+ * @obj: a GObject instance that implements AtspiTableCellIface
+ *
+ * Translates this cell accessible into the corresponding column index.
+ *
+ * Returns: the column index for this cell, or -1 if unimplemented.
+ */
+gint
+atspi_table_cell_get_column_index (AtspiTableCell *obj, GError **error)
+{
+ dbus_int32_t retval = -1;
+
+ g_return_val_if_fail (obj != NULL, -1);
+
+ _atspi_dbus_get_property (obj, atspi_interface_table_cell, "ColumnIndex",
+ error, "i", &retval);
+
+ return retval;
+}
+
+/**
+ * atspi_table_cell_get_row_span:
+ * @obj: a GObject instance that implements AtspiTableCellIface
+ *
+ * Returns the number of rows occupied by this cell accessible.
+ *
+ * Returns: a gint representing the number of rows occupied by this cell,
+ * or 0 if the cell does not implement this method.
+ */
+gint
+atspi_table_cell_get_row_span (AtspiTableCell *obj, GError **error)
+{
+ dbus_int32_t retval = -1;
+
+ g_return_val_if_fail (obj != NULL, -1);
+
+ _atspi_dbus_get_property (obj, atspi_interface_table_cell, "RowSpan",
+ error, "i", &retval);
+
+ return retval;
+}
+
+/**
+ * atspi_table_cell_get_row_header_cells:
+ * @obj: a GObject instance that implements AtspiTableCellIface
+ *
+ * Returns the row headers as an array of cell accessibles.
+ *
+ * Returns: (element-type AtspiAccessible) (transfer full): a GPtrArray of
+ * AtspiAccessibles representing the row header cells.
+ * */
+GPtrArray *
+atspi_table_cell_get_row_header_cells (AtspiTableCell *obj, GError **error)
+{
+ DBusMessage *reply;
+
+ g_return_val_if_fail (obj != NULL, NULL);
+
+ reply = _atspi_dbus_call_partial (obj, atspi_interface_table_cell, "GetRowHeaderCells", error, "");
+
+ return get_object_array_and_unref (reply);
+}
+
+/**
+ * atspi_table_cell_get_position:
+ * @obj: a GObject instance that implements AtspiTableCellIface
+ * @row: (out): the row of the given cell.
+ * @column: (out): the column of the given cell.
+ *
+ * Retrieves the tabular position of this cell.
+ *
+ * Returns: TRUE if successful, FALSE otherwise.
+ */
+gint
+atspi_table_cell_get_position (AtspiTableCell *obj,
+ gint *row,
+ gint *column,
+ GError *error)
+{
+ DBusMessage *reply;
+ DBusMessageIter iter, iter_struct, iter_variant;
+ dbus_int32_t d_row = -1, d_column = -1;
+
+ g_return_val_if_fail (obj != NULL, -1);
+
+ reply = _atspi_dbus_call_partial (obj, "org.freedesktop.DBuss.Properties",
+ "Get", atspi_interface_table_cell,
+ "Position");
+
+ dbus_message_iter_init (reply, &iter);
+
+ /* TODO: Return error here */
+ if (dbus_message_iter_get_arg_type (&iter) != 'v')
+ return FALSE;
+
+ dbus_message_iter_recurse (&iter, &iter_variant);
+ /* TODO: Also report error here */
+ if (strcmp (dbus_message_iter_get_signature (&iter_variant), "(ii)") != 0)
+ return FALSE;
+
+ dbus_message_iter_recurse (&iter_variant, &iter_struct);
+ dbus_message_iter_get_basic (&iter_struct, &d_row);
+ if (row)
+ *row = d_row;
+ dbus_message_iter_next (&iter_struct);
+ dbus_message_iter_get_basic (&iter_struct, &d_column);
+ if (column)
+ *column = d_column;
+ dbus_message_unref (reply);
+ return TRUE;
+}
+
+/**
+ * atspi_table_cell_get_row_column_span:
+ * @obj: a GObject instance that implements AtspiTableCellIface
+ * @row: (out): the row index of the given cell.
+ * @column: (out): the column index of the given cell.
+ * @row_span: (out): the number of rows occupied by this cell.
+ * @column_span: (out): the number of columns occupied by this cell.
+ *
+ * Gets the row and column indexes and extents of this cell accessible.
+ */
+void
+atspi_table_cell_get_row_column_span (AtspiTableCell *obj,
+ gint *row,
+ gint *column,
+ gint *row_span,
+ gint *column_span,
+ GError **error)
+{
+ dbus_int32_t d_row = 0, d_column = 0, d_row_span = 0, d_column_span = 0;
+
+ if (row)
+ *row = -1;
+ if (column)
+ *column = -1;
+ if (row_span)
+ *row_span = -1;
+ if (column_span)
+ *column_span = -1;
+
+ g_return_if_fail (obj != NULL);
+
+ _atspi_dbus_call (obj, atspi_interface_table_cell, "GetRowColumnSpan",
+ error, "=>iiii", &d_row, &d_column,
+ &d_row_span, &d_column_span);
+
+ if (row)
+ *row = d_row;
+ if (column)
+ *column = d_column;
+ if (row_span)
+ *row_span = d_row_span;
+ if (column_span)
+ *column_span = d_column_span;
+}
+
+/**
+ * atspi_table_cell_get_table:
+ * @obj: a GObject instance that implements AtspiTableCellIface
+ *
+ * Returns a reference to the accessible of the containing table.
+ *
+ * Returns: (transfer full): the AtspiAccessible for the containing table.
+ */
+AtspiAccessible *
+atspi_table_cell_get_table (AtspiTableCell *obj, GError **error)
+{
+ AtspiAccessible *retval = NULL;
+
+ g_return_val_if_fail (obj != NULL, NULL);
+
+ _atspi_dbus_get_property (obj, atspi_interface_table_cell, "Table",
+ error, "(so)", &retval);
+
+ return retval;
+}
+
+static void
+atspi_table_cell_base_init (AtspiTableCell *klass)
+{
+}
+
+GType
+atspi_table_cell_get_type (void)
+{
+ static GType type = 0;
+
+ if (!type) {
+ static const GTypeInfo tinfo =
+ {
+ sizeof (AtspiTableCell),
+ (GBaseInitFunc) atspi_table_cell_base_init,
+ (GBaseFinalizeFunc) NULL,
+ };
+
+ type = g_type_register_static (G_TYPE_INTERFACE, "AtspiTableCell", &tinfo, 0);
+
+ }
+ return type;
+}
--- /dev/null
+/*
+ * AT-SPI - Assistive Technology Service Provider Interface
+ * (Gnome Accessibility Project; http://developer.gnome.org/projects/gap)
+ *
+ * Copyright 2002 Ximian, Inc.
+ * 2002 Sun Microsystems Inc.
+ * Copyright 2010, 2011 Novell, 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_CELL_H_
+#define _ATSPI_TABLE_CELL_H_
+
+#include "glib-object.h"
+
+#include "atspi-constants.h"
+
+#include "atspi-types.h"
+
+G_BEGIN_DECLS
+
+#define ATSPI_TYPE_TABLE_CELL (atspi_table_cell_get_type ())
+#define ATSPI_IS_TABLE_CELL(obj) G_TYPE_CHECK_INSTANCE_TYPE ((obj), ATSPI_TYPE_TABLE_CELL)
+#define ATSPI_TABLE_CELL(obj) G_TYPE_CHECK_INSTANCE_CAST ((obj), ATSPI_TYPE_TABLE_CELL, AtspiTableCell)
+#define ATSPI_TABLE_CELL_GET_IFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), ATSPI_TYPE_TABLE_CELL, AtspiTableCell))
+
+GType atspi_table_cell_get_type ();
+
+struct _AtspiTableCell
+{
+ GTypeInterface parent;
+};
+
+gint atspi_table_cell_get_column_span (AtspiTableCell *obj, GError *error);
+
+GPtrArray *atspi_table_cell_get_column_header_cells (AtspiTableCell *obj,
+ GError **error);
+
+gint atspi_table_cell_get_column_index (AtspiTableCell *obj, GError **error);
+
+gint atspi_table_cell_get_row_span (AtspiTableCell *obj, GError **error);
+
+GPtrArray *atspi_table_cell_get_row_header_cells (AtspiTableCell *obj,
+ GError **error);
+
+gint atspi_table_cell_get_row_index (AtspiTableCell *obj, GError **error);
+
+void atspi_table_cell_get_row_column_span (AtspiTableCell *obj,
+ gint *row,
+ gint *column,
+ gint *row_span,
+ gint *column_span,
+ GError **error);
+
+AtspiAccessible *atspi_table_cell_get_table (AtspiTableCell *obj,
+ GError **error);
+G_END_DECLS
+
+#endif /* _ATSPI_TABLE_CELL_H_ */