aboutsummaryrefslogtreecommitdiffstats
path: root/a11y
diff options
context:
space:
mode:
authorChris Toshok <toshok@src.gnome.org>2002-11-30 15:54:16 +0800
committerChris Toshok <toshok@src.gnome.org>2002-11-30 15:54:16 +0800
commit9ec429940d65bc472569f9cdd21a3953112ffb0d (patch)
tree17f9132b66a62f25e250de4164500a876edf52bb /a11y
parentbf795a3e81169f1391ac332dbf057243ab0a7992 (diff)
downloadgsoc2013-evolution-9ec429940d65bc472569f9cdd21a3953112ffb0d.tar
gsoc2013-evolution-9ec429940d65bc472569f9cdd21a3953112ffb0d.tar.gz
gsoc2013-evolution-9ec429940d65bc472569f9cdd21a3953112ffb0d.tar.bz2
gsoc2013-evolution-9ec429940d65bc472569f9cdd21a3953112ffb0d.tar.lz
gsoc2013-evolution-9ec429940d65bc472569f9cdd21a3953112ffb0d.tar.xz
gsoc2013-evolution-9ec429940d65bc472569f9cdd21a3953112ffb0d.tar.zst
gsoc2013-evolution-9ec429940d65bc472569f9cdd21a3953112ffb0d.zip
gal a11y work from clahey
svn path=/trunk/; revision=18959
Diffstat (limited to 'a11y')
-rw-r--r--a11y/e-table/.cvsignore4
-rw-r--r--a11y/e-table/gal-a11y-e-cell-registry.c132
-rw-r--r--a11y/e-table/gal-a11y-e-cell-registry.h58
-rw-r--r--a11y/e-table/gal-a11y-e-cell-text.c482
-rw-r--r--a11y/e-table/gal-a11y-e-cell-text.h48
-rw-r--r--a11y/e-table/gal-a11y-e-cell.c239
-rw-r--r--a11y/e-table/gal-a11y-e-cell.h61
-rw-r--r--a11y/e-table/gal-a11y-e-table-factory.c83
-rw-r--r--a11y/e-table/gal-a11y-e-table-factory.h36
-rw-r--r--a11y/e-table/gal-a11y-e-table-item.c456
-rw-r--r--a11y/e-table/gal-a11y-e-table-item.h43
-rw-r--r--a11y/e-table/gal-a11y-e-table.c156
-rw-r--r--a11y/e-table/gal-a11y-e-table.h43
-rw-r--r--a11y/e-text/.cvsignore4
-rw-r--r--a11y/e-text/gal-a11y-e-text-factory.c88
-rw-r--r--a11y/e-text/gal-a11y-e-text-factory.h36
-rw-r--r--a11y/e-text/gal-a11y-e-text.c526
-rw-r--r--a11y/e-text/gal-a11y-e-text.h40
-rw-r--r--a11y/gal-a11y-util.c31
-rw-r--r--a11y/gal-a11y-util.h21
20 files changed, 2587 insertions, 0 deletions
diff --git a/a11y/e-table/.cvsignore b/a11y/e-table/.cvsignore
new file mode 100644
index 0000000000..5b48d3f593
--- /dev/null
+++ b/a11y/e-table/.cvsignore
@@ -0,0 +1,4 @@
+.libs
+Makefile.in
+Makefile
+*.la
diff --git a/a11y/e-table/gal-a11y-e-cell-registry.c b/a11y/e-table/gal-a11y-e-cell-registry.c
new file mode 100644
index 0000000000..7110179554
--- /dev/null
+++ b/a11y/e-table/gal-a11y-e-cell-registry.c
@@ -0,0 +1,132 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * Authors:
+ * Christopher James Lahey <clahey@ximian.com>
+ *
+ * Copyright (C) 2002 Ximian, Inc.
+ */
+
+#include <config.h>
+#include "gal-a11y-e-cell-registry.h"
+#include "gal-a11y-e-cell.h"
+
+static GObjectClass *parent_class;
+static GalA11yECellRegistry *default_registry;
+#define PARENT_TYPE (G_TYPE_OBJECT)
+
+struct _GalA11yECellRegistryPrivate {
+ GHashTable *table;
+};
+
+/* Static functions */
+
+static void
+gal_a11y_e_cell_registry_finalize (GObject *obj)
+{
+ GalA11yECellRegistry *registry = GAL_A11Y_E_CELL_REGISTRY (obj);
+
+ g_hash_table_destroy (registry->priv->table);
+ g_free (registry->priv);
+}
+
+static void
+gal_a11y_e_cell_registry_class_init (GalA11yECellRegistryClass *klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+ parent_class = g_type_class_ref (PARENT_TYPE);
+
+ object_class->finalize = gal_a11y_e_cell_registry_finalize;
+}
+
+static void
+gal_a11y_e_cell_registry_init (GalA11yECellRegistry *registry)
+{
+ registry->priv = g_new (GalA11yECellRegistryPrivate, 1);
+ registry->priv->table = g_hash_table_new (NULL, NULL);
+}
+
+/**
+ * gal_a11y_e_cell_registry_get_type:
+ * @void:
+ *
+ * Registers the &GalA11yECellRegistry class if necessary, and returns the type ID
+ * associated to it.
+ *
+ * Return value: The type ID of the &GalA11yECellRegistry class.
+ **/
+GType
+gal_a11y_e_cell_registry_get_type (void)
+{
+ static GType type = 0;
+
+ if (!type) {
+ GTypeInfo info = {
+ sizeof (GalA11yECellRegistryClass),
+ (GBaseInitFunc) NULL,
+ (GBaseFinalizeFunc) NULL,
+ (GClassInitFunc) gal_a11y_e_cell_registry_class_init,
+ (GClassFinalizeFunc) NULL,
+ NULL, /* class_data */
+ sizeof (GalA11yECellRegistry),
+ 0,
+ (GInstanceInitFunc) gal_a11y_e_cell_registry_init,
+ NULL /* value_cell */
+ };
+
+ type = g_type_register_static (PARENT_TYPE, "GalA11yECellRegistry", &info, 0);
+ }
+
+ return type;
+}
+
+static void
+init_default_registry (void)
+{
+ if (default_registry == NULL) {
+ default_registry = g_object_new (gal_a11y_e_cell_registry_get_type(), NULL);
+ }
+}
+
+
+AtkObject *
+gal_a11y_e_cell_registry_get_object (GalA11yECellRegistry *registry,
+ ETableItem *item,
+ ECellView *cell_view,
+ AtkObject *parent,
+ int model_col,
+ int view_col,
+ int row)
+{
+ GalA11yECellRegistryFunc func = NULL;
+ GType type;
+
+ if (registry == NULL) {
+ init_default_registry ();
+ registry = default_registry;
+ }
+
+ type = GTK_OBJECT_TYPE (cell_view->ecell);
+ while (func == NULL && type != 0) {
+ func = g_hash_table_lookup (registry->priv->table, GINT_TO_POINTER (type));
+ type = g_type_parent (type);
+ }
+
+ if (func)
+ return func (item, cell_view, parent, model_col, view_col, row);
+ else
+ return gal_a11y_e_cell_new (item, cell_view, parent, model_col, view_col, row);
+}
+
+void
+gal_a11y_e_cell_registry_add_cell_type (GalA11yECellRegistry *registry,
+ GType type,
+ GalA11yECellRegistryFunc func)
+{
+ if (registry == NULL) {
+ init_default_registry ();
+ registry = default_registry;
+ }
+
+ g_hash_table_insert (registry->priv->table, GINT_TO_POINTER (type), func);
+}
diff --git a/a11y/e-table/gal-a11y-e-cell-registry.h b/a11y/e-table/gal-a11y-e-cell-registry.h
new file mode 100644
index 0000000000..eecd41139c
--- /dev/null
+++ b/a11y/e-table/gal-a11y-e-cell-registry.h
@@ -0,0 +1,58 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * Authors:
+ * Christopher James Lahey <clahey@ximian.com>
+ *
+ * Copyright (C) 2001 Chris Lahey
+ */
+
+#ifndef __GAL_A11Y_E_CELL_REGISTRY_H__
+#define __GAL_A11Y_E_CELL_REGISTRY_H__
+
+#include <glib-object.h>
+#include <atk/atkobject.h>
+#include <gal/e-table/e-table-item.h>
+#include <gal/e-table/e-cell.h>
+
+#define GAL_A11Y_TYPE_E_CELL_REGISTRY (gal_a11y_e_cell_registry_get_type ())
+#define GAL_A11Y_E_CELL_REGISTRY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GAL_A11Y_TYPE_E_CELL_REGISTRY, GalA11yECellRegistry))
+#define GAL_A11Y_E_CELL_REGISTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GAL_A11Y_TYPE_E_CELL_REGISTRY, GalA11yECellRegistryClass))
+#define GAL_A11Y_IS_E_CELL_REGISTRY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GAL_A11Y_TYPE_E_CELL_REGISTRY))
+#define GAL_A11Y_IS_E_CELL_REGISTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GAL_A11Y_TYPE_E_CELL_REGISTRY))
+
+typedef struct _GalA11yECellRegistry GalA11yECellRegistry;
+typedef struct _GalA11yECellRegistryClass GalA11yECellRegistryClass;
+typedef struct _GalA11yECellRegistryPrivate GalA11yECellRegistryPrivate;
+
+typedef AtkObject *(*GalA11yECellRegistryFunc) (ETableItem *item,
+ ECellView *cell_view,
+ AtkObject *parent,
+ int model_col,
+ int view_col,
+ int row);
+
+struct _GalA11yECellRegistry {
+ GObject object;
+
+ GalA11yECellRegistryPrivate *priv;
+};
+
+struct _GalA11yECellRegistryClass {
+ GObjectClass parent_class;
+};
+
+
+/* Standard Glib function */
+GType gal_a11y_e_cell_registry_get_type (void);
+AtkObject *gal_a11y_e_cell_registry_get_object (GalA11yECellRegistry *registry,
+ ETableItem *item,
+ ECellView *cell_view,
+ AtkObject *parent,
+ int model_col,
+ int view_col,
+ int row);
+void gal_a11y_e_cell_registry_add_cell_type (GalA11yECellRegistry *registry,
+ GType type,
+ GalA11yECellRegistryFunc func);
+
+#endif /* ! __GAL_A11Y_E_CELL_REGISTRY_H__ */
diff --git a/a11y/e-table/gal-a11y-e-cell-text.c b/a11y/e-table/gal-a11y-e-cell-text.c
new file mode 100644
index 0000000000..43dcc9f7a0
--- /dev/null
+++ b/a11y/e-table/gal-a11y-e-cell-text.c
@@ -0,0 +1,482 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * Authors:
+ * Christopher James Lahey <clahey@ximian.com>
+ *
+ * Copyright (C) 2002 Ximian, Inc.
+ */
+
+#include <config.h>
+#include "gal-a11y-e-cell-text.h"
+#include "gal-a11y-util.h"
+#include <gal/e-table/e-cell-text.h>
+#include <atk/atkobject.h>
+#include <atk/atktext.h>
+#include <atk/atkeditabletext.h>
+
+#define CS_CLASS(a11y) (G_TYPE_INSTANCE_GET_CLASS ((a11y), C_TYPE_STREAM, GalA11yECellTextClass))
+static AtkObjectClass *parent_class;
+#define PARENT_TYPE (gal_a11y_e_cell_get_type ())
+
+/* Static functions */
+static gchar *
+ect_get_text (AtkText *text,
+ gint start_offset,
+ gint end_offset)
+{
+ GalA11yECell *gaec = GAL_A11Y_E_CELL (text);
+ ECellText *ect = E_CELL_TEXT (gaec->cell_view->ecell);
+ char *ret_val;
+ char *full_text =
+ e_cell_text_get_text (ect, gaec->item->table_model, gaec->model_col, gaec->row);
+
+ if (end_offset == -1)
+ end_offset = strlen (full_text);
+ else
+ end_offset = g_utf8_offset_to_pointer (full_text, end_offset) - full_text;
+
+ start_offset = g_utf8_offset_to_pointer (full_text, start_offset) - full_text;
+
+ ret_val = g_strndup (full_text + start_offset, end_offset - start_offset);
+
+ e_cell_text_free_text (ect, full_text);
+
+ return ret_val;
+}
+
+static gchar *
+ect_get_text_after_offset (AtkText *text,
+ gint offset,
+ AtkTextBoundary boundary_type,
+ gint *start_offset,
+ gint *end_offset)
+{
+ /* Unimplemented */
+ return NULL;
+}
+
+static gchar *
+ect_get_text_at_offset (AtkText *text,
+ gint offset,
+ AtkTextBoundary boundary_type,
+ gint *start_offset,
+ gint *end_offset)
+{
+ /* Unimplemented */
+ return NULL;
+}
+
+static gunichar
+ect_get_character_at_offset (AtkText *text,
+ gint offset)
+{
+ GalA11yECell *gaec = GAL_A11Y_E_CELL (text);
+ ECellText *ect = E_CELL_TEXT (gaec->cell_view->ecell);
+ gunichar ret_val;
+ char *full_text;
+ char *at_offset;
+
+ full_text = e_cell_text_get_text (ect, gaec->item->table_model, gaec->model_col, gaec->row);
+ at_offset = g_utf8_offset_to_pointer (full_text, offset);
+ ret_val = g_utf8_get_char_validated (at_offset, -1);
+ e_cell_text_free_text (ect, full_text);
+
+ return ret_val;
+}
+
+
+static gchar*
+ect_get_text_before_offset (AtkText *text,
+ gint offset,
+ AtkTextBoundary boundary_type,
+ gint *start_offset,
+ gint *end_offset)
+{
+ /* Unimplemented */
+ return NULL;
+}
+
+
+static gint
+ect_get_caret_offset (AtkText *text)
+{
+ GalA11yECell *gaec = GAL_A11Y_E_CELL (text);
+ int start, end;
+ if (e_cell_text_get_selection (gaec->cell_view,
+ gaec->view_col, gaec->row,
+ &start, &end)
+ && start == end) {
+ char *full_text;
+ int ret_val;
+ ECellText *ect = E_CELL_TEXT (gaec->cell_view->ecell);
+
+ full_text = e_cell_text_get_text (ect, gaec->item->table_model, gaec->model_col, gaec->row);
+ ret_val = g_utf8_pointer_to_offset (full_text, full_text + start);
+ e_cell_text_free_text (ect, full_text);
+
+ return ret_val;
+ } else {
+ return -1;
+ }
+}
+
+
+static AtkAttributeSet*
+ect_get_run_attributes (AtkText *text,
+ gint offset,
+ gint *start_offset,
+ gint *end_offset)
+{
+ /* Unimplemented */
+ return NULL;
+}
+
+
+static AtkAttributeSet*
+ect_get_default_attributes (AtkText *text)
+{
+ /* Unimplemented */
+ return NULL;
+}
+
+
+static void
+ect_get_character_extents (AtkText *text,
+ gint offset,
+ gint *x,
+ gint *y,
+ gint *width,
+ gint *height,
+ AtkCoordType coords)
+{
+ /* Unimplemented */
+}
+
+
+static gint
+ect_get_character_count (AtkText *text)
+{
+ GalA11yECell *gaec = GAL_A11Y_E_CELL (text);
+ ECellText *ect = E_CELL_TEXT (gaec->cell_view->ecell);
+ int ret_val;
+
+ char *full_text = e_cell_text_get_text (ect, gaec->item->table_model, gaec->model_col, gaec->row);
+
+ ret_val = g_utf8_strlen (full_text, -1);
+ e_cell_text_free_text (ect, full_text);
+ return ret_val;
+}
+
+
+static gint
+ect_get_offset_at_point (AtkText *text,
+ gint x,
+ gint y,
+ AtkCoordType coords)
+{
+ /* Unimplemented */
+ return 0;
+}
+
+
+static gint
+ect_get_n_selections (AtkText *text)
+{
+ GalA11yECell *gaec = GAL_A11Y_E_CELL (text);
+ int selection_start, selection_end;
+ if (e_cell_text_get_selection (gaec->cell_view,
+ gaec->view_col, gaec->row,
+ &selection_start,
+ &selection_end) &&
+ selection_start != selection_end)
+ return 1;
+ return 0;
+}
+
+
+static gchar*
+ect_get_selection (AtkText *text,
+ gint selection_num,
+ gint *start_offset,
+ gint *end_offset)
+{
+ GalA11yECell *gaec = GAL_A11Y_E_CELL (text);
+ ECellText *ect = E_CELL_TEXT (gaec->cell_view->ecell);
+ int selection_start, selection_end;
+ if (selection_num == 0 &&
+ e_cell_text_get_selection (gaec->cell_view,
+ gaec->view_col, gaec->row,
+ &selection_start,
+ &selection_end) &&
+ selection_start != selection_end) {
+ char *ret_val;
+ char *full_text =
+ e_cell_text_get_text (ect, gaec->item->table_model, gaec->model_col, gaec->row);
+
+ ret_val = g_strndup (full_text + selection_start, selection_end - selection_start);
+
+ if (start_offset)
+ *start_offset = g_utf8_pointer_to_offset (full_text, full_text + selection_start);
+ if (end_offset)
+ *end_offset = g_utf8_pointer_to_offset (full_text, full_text + selection_end);
+
+ e_cell_text_free_text (ect, full_text);
+
+ return ret_val;
+ }
+ return NULL;
+}
+
+
+static gboolean
+ect_add_selection (AtkText *text,
+ gint start_offset,
+ gint end_offset)
+{
+ GalA11yECell *gaec = GAL_A11Y_E_CELL (text);
+ ECellText *ect = E_CELL_TEXT (gaec->cell_view->ecell);
+ int selection_start, selection_end;
+ if (e_cell_text_get_selection (gaec->cell_view,
+ gaec->view_col, gaec->row,
+ &selection_start,
+ &selection_end) &&
+ selection_start == selection_end &&
+ start_offset != end_offset) {
+ char *full_text;
+
+ full_text = e_cell_text_get_text (ect, gaec->item->table_model, gaec->model_col, gaec->row);
+ start_offset = g_utf8_offset_to_pointer (full_text, start_offset) - full_text;
+ end_offset = g_utf8_offset_to_pointer (full_text, end_offset) - full_text;
+ e_cell_text_free_text (ect, full_text);
+
+ return e_cell_text_set_selection (gaec->cell_view,
+ gaec->view_col, gaec->row,
+ start_offset, end_offset);
+ }
+ return FALSE;
+}
+
+
+static gboolean
+ect_remove_selection (AtkText *text,
+ gint selection_num)
+{
+ /* Unimplemented */
+ return FALSE;
+}
+
+
+static gboolean
+ect_set_selection (AtkText *text,
+ gint selection_num,
+ gint start_offset,
+ gint end_offset)
+{
+ /* Unimplemented */
+ return FALSE;
+}
+
+
+static gboolean
+ect_set_caret_offset (AtkText *text,
+ gint offset)
+{
+ GalA11yECell *gaec = GAL_A11Y_E_CELL (text);
+ ECellText *ect = E_CELL_TEXT (gaec->cell_view->ecell);
+ char *full_text;
+
+ full_text = e_cell_text_get_text (ect, gaec->item->table_model, gaec->model_col, gaec->row);
+ offset = g_utf8_offset_to_pointer (full_text, offset) - full_text;
+ e_cell_text_free_text (ect, full_text);
+
+ return e_cell_text_set_selection (gaec->cell_view,
+ gaec->view_col, gaec->row,
+ offset, offset);
+}
+
+static gboolean
+ect_set_run_attributes (AtkEditableText *text,
+ AtkAttributeSet *attrib_set,
+ gint start_offset,
+ gint end_offset)
+{
+ /* Unimplemented */
+ return FALSE;
+}
+
+static void
+ect_set_text_contents (AtkEditableText *text,
+ const gchar *string)
+{
+ GalA11yECell *gaec = GAL_A11Y_E_CELL (text);
+ ECellText *ect = E_CELL_TEXT (gaec->cell_view->ecell);
+
+ e_cell_text_set_value (ect, gaec->item->table_model, gaec->model_col, gaec->row, string);
+}
+
+static void
+ect_insert_text (AtkEditableText *text,
+ const gchar *string,
+ gint length,
+ gint *position)
+{
+ /* Utf8 unimplemented */
+ GalA11yECell *gaec = GAL_A11Y_E_CELL (text);
+ ECellText *ect = E_CELL_TEXT (gaec->cell_view->ecell);
+
+ char *full_text = e_cell_text_get_text (ect, gaec->item->table_model, gaec->model_col, gaec->row);
+ char *result = g_strdup_printf ("%.*s%.*s%s", *position, full_text, length, string, full_text + *position);
+
+ e_cell_text_set_value (ect, gaec->item->table_model, gaec->model_col, gaec->row, result);
+
+ *position += length;
+
+ g_free (result);
+ e_cell_text_free_text (ect, full_text);
+}
+
+static void
+ect_copy_text (AtkEditableText *text,
+ gint start_pos,
+ gint end_pos)
+{
+ /* Unimplemented */
+}
+
+static void
+ect_cut_text (AtkEditableText *text,
+ gint start_pos,
+ gint end_pos)
+{
+ /* Unimplemented */
+}
+
+static void
+ect_delete_text (AtkEditableText *text,
+ gint start_pos,
+ gint end_pos)
+{
+ /* Unimplemented */
+}
+
+static void
+ect_paste_text (AtkEditableText *text,
+ gint position)
+{
+ /* Unimplemented */
+}
+
+
+static void
+ect_atk_text_iface_init (AtkTextIface *iface)
+{
+ iface->get_text = ect_get_text;
+ iface->get_text_after_offset = ect_get_text_after_offset;
+ iface->get_text_at_offset = ect_get_text_at_offset;
+ iface->get_character_at_offset = ect_get_character_at_offset;
+ iface->get_text_before_offset = ect_get_text_before_offset;
+ iface->get_caret_offset = ect_get_caret_offset;
+ iface->get_run_attributes = ect_get_run_attributes;
+ iface->get_default_attributes = ect_get_default_attributes;
+ iface->get_character_extents = ect_get_character_extents;
+ iface->get_character_count = ect_get_character_count;
+ iface->get_offset_at_point = ect_get_offset_at_point;
+ iface->get_n_selections = ect_get_n_selections;
+ iface->get_selection = ect_get_selection;
+ iface->add_selection = ect_add_selection;
+ iface->remove_selection = ect_remove_selection;
+ iface->set_selection = ect_set_selection;
+ iface->set_caret_offset = ect_set_caret_offset;
+}
+
+static void
+ect_atk_editable_text_iface_init (AtkEditableTextIface *iface)
+{
+ iface->set_run_attributes = ect_set_run_attributes;
+ iface->set_text_contents = ect_set_text_contents;
+ iface->insert_text = ect_insert_text;
+ iface->copy_text = ect_copy_text;
+ iface->cut_text = ect_cut_text;
+ iface->delete_text = ect_delete_text;
+ iface->paste_text = ect_paste_text;
+}
+
+static void
+ect_class_init (GalA11yECellTextClass *klass)
+{
+ parent_class = g_type_class_ref (PARENT_TYPE);
+}
+
+static void
+ect_init (GalA11yECellText *a11y)
+{
+}
+
+/**
+ * gal_a11y_e_cell_text_get_type:
+ * @void:
+ *
+ * Registers the &GalA11yECellText class if necessary, and returns the type ID
+ * associated to it.
+ *
+ * Return value: The type ID of the &GalA11yECellText class.
+ **/
+GType
+gal_a11y_e_cell_text_get_type (void)
+{
+ static GType type = 0;
+
+ if (!type) {
+ GTypeInfo info = {
+ sizeof (GalA11yECellTextClass),
+ (GBaseInitFunc) NULL,
+ (GBaseFinalizeFunc) NULL,
+ (GClassInitFunc) ect_class_init,
+ (GClassFinalizeFunc) NULL,
+ NULL, /* class_data */
+ sizeof (GalA11yECellText),
+ 0,
+ (GInstanceInitFunc) ect_init,
+ NULL /* value_cell_text */
+ };
+
+ static const GInterfaceInfo atk_text_info = {
+ (GInterfaceInitFunc) ect_atk_text_iface_init,
+ (GInterfaceFinalizeFunc) NULL,
+ NULL
+ };
+
+ static const GInterfaceInfo atk_editable_text_info = {
+ (GInterfaceInitFunc) ect_atk_editable_text_iface_init,
+ (GInterfaceFinalizeFunc) NULL,
+ NULL
+ };
+
+ type = g_type_register_static (PARENT_TYPE, "GalA11yECellText", &info, 0);
+ g_type_add_interface_static (type, ATK_TYPE_TEXT, &atk_text_info);
+ g_type_add_interface_static (type, ATK_TYPE_EDITABLE_TEXT, &atk_editable_text_info);
+ }
+
+ return type;
+}
+AtkObject *
+gal_a11y_e_cell_text_new (ETableItem *item,
+ ECellView *cell_view,
+ AtkObject *parent,
+ int model_col,
+ int view_col,
+ int row)
+{
+ AtkObject *a11y;
+
+ a11y = g_object_new (gal_a11y_e_cell_text_get_type (), NULL);
+
+ gal_a11y_e_cell_construct (a11y,
+ item,
+ cell_view,
+ parent,
+ model_col,
+ view_col,
+ row);
+ return a11y;
+}
diff --git a/a11y/e-table/gal-a11y-e-cell-text.h b/a11y/e-table/gal-a11y-e-cell-text.h
new file mode 100644
index 0000000000..3d9a4447be
--- /dev/null
+++ b/a11y/e-table/gal-a11y-e-cell-text.h
@@ -0,0 +1,48 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * Authors:
+ * Christopher James Lahey <clahey@ximian.com>
+ *
+ * Copyright (C) 2001 Chris Lahey
+ */
+
+#ifndef __GAL_A11Y_E_CELL_TEXT_H__
+#define __GAL_A11Y_E_CELL_TEXT_H__
+
+#include <glib-object.h>
+#include <gal/e-table/e-table-item.h>
+#include <gal/e-table/e-cell-text.h>
+#include <a11y/e-table/gal-a11y-e-cell.h>
+
+#define GAL_A11Y_TYPE_E_CELL_TEXT (gal_a11y_e_cell_text_get_type ())
+#define GAL_A11Y_E_CELL_TEXT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GAL_A11Y_TYPE_E_CELL_TEXT, GalA11yECellText))
+#define GAL_A11Y_E_CELL_TEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GAL_A11Y_TYPE_E_CELL_TEXT, GalA11yECellTextClass))
+#define GAL_A11Y_IS_E_CELL_TEXT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GAL_A11Y_TYPE_E_CELL_TEXT))
+#define GAL_A11Y_IS_E_CELL_TEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GAL_A11Y_TYPE_E_CELL_TEXT))
+
+typedef struct _GalA11yECellText GalA11yECellText;
+typedef struct _GalA11yECellTextClass GalA11yECellTextClass;
+typedef struct _GalA11yECellTextPrivate GalA11yECellTextPrivate;
+
+/* This struct should actually be larger as this isn't what we derive from.
+ * The GalA11yECellTextPrivate comes right after the parent class structure.
+ **/
+struct _GalA11yECellText {
+ GalA11yECell object;
+};
+
+struct _GalA11yECellTextClass {
+ GalA11yECellClass parent_class;
+};
+
+
+/* Standard Glib function */
+GType gal_a11y_e_cell_text_get_type (void);
+AtkObject *gal_a11y_e_cell_text_new (ETableItem *item,
+ ECellView *cell_view,
+ AtkObject *parent,
+ int model_col,
+ int view_col,
+ int row);
+
+#endif /* ! __GAL_A11Y_E_CELL_TEXT_H__ */
diff --git a/a11y/e-table/gal-a11y-e-cell.c b/a11y/e-table/gal-a11y-e-cell.c
new file mode 100644
index 0000000000..ceac5d5817
--- /dev/null
+++ b/a11y/e-table/gal-a11y-e-cell.c
@@ -0,0 +1,239 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * Authors:
+ * Christopher James Lahey <clahey@ximian.com>
+ *
+ * Copyright (C) 2002 Ximian, Inc.
+ */
+
+#include <config.h>
+#include "gal-a11y-e-cell.h"
+#include "gal-a11y-util.h"
+#include <atk/atkobject.h>
+#include <atk/atkcomponent.h>
+
+#define CS_CLASS(a11y) (G_TYPE_INSTANCE_GET_CLASS ((a11y), C_TYPE_STREAM, GalA11yECellClass))
+static GObjectClass *parent_class;
+#define PARENT_TYPE (atk_object_get_type ())
+
+
+#if 0
+static void
+unref_item (gpointer user_data, GObject *obj_loc)
+{
+ GalA11yECell *a11y = GAL_A11Y_E_CELL (user_data);
+ a11y->item = NULL;
+ g_object_unref (a11y);
+}
+
+static void
+unref_cell (gpointer user_data, GObject *obj_loc)
+{
+ GalA11yECell *a11y = GAL_A11Y_E_CELL (user_data);
+ a11y->cell_view = NULL;
+ g_object_unref (a11y);
+}
+#endif
+
+static void
+eti_dispose (GObject *object)
+{
+ GalA11yECell *a11y = GAL_A11Y_E_CELL (object);
+
+#if 0
+ if (a11y->item)
+ g_object_unref (G_OBJECT (a11y->item)); /*, unref_item, a11y); */
+ if (a11y->cell_view)
+ g_object_unref (G_OBJECT (a11y->cell_view)); /*, unref_cell, a11y); */
+ if (a11y->parent)
+ g_object_unref (a11y->parent);
+#endif
+ a11y->item = NULL;
+ a11y->cell_view = NULL;
+ a11y->parent = NULL;
+ a11y->model_col = -1;
+ a11y->view_col = -1;
+ a11y->row = -1;
+
+ if (parent_class->dispose)
+ parent_class->dispose (object);
+}
+
+/* Static functions */
+static AtkObject*
+eti_get_parent (AtkObject *accessible)
+{
+ GalA11yECell *a11y = GAL_A11Y_E_CELL (accessible);
+ return a11y->parent;
+}
+
+static gint
+eti_get_index_in_parent (AtkObject *accessible)
+{
+ GalA11yECell *a11y = GAL_A11Y_E_CELL (accessible);
+
+ return a11y->row * a11y->item->cols + a11y->view_col;
+}
+
+
+/* Component IFace */
+static void
+eti_get_extents (AtkComponent *component,
+ gint *x,
+ gint *y,
+ gint *width,
+ gint *height,
+ AtkCoordType coord_type)
+{
+ GalA11yECell *a11y = GAL_A11Y_E_CELL (component);
+ int row;
+ int col;
+ int xval;
+ int yval;
+
+ row = a11y->row;
+ col = a11y->view_col;
+
+
+ e_table_item_get_cell_geometry (a11y->item,
+ &row,
+ &col,
+ &xval,
+ &yval,
+ width,
+ height);
+
+ atk_component_get_position (ATK_COMPONENT (a11y->parent),
+ x, y, coord_type);
+ if (x && *x != G_MININT)
+ *x += xval;
+ if (y && *y != G_MININT)
+ *y += yval;
+}
+
+/* Table IFace */
+
+static void
+eti_atk_component_iface_init (AtkComponentIface *iface)
+{
+ iface->get_extents = eti_get_extents;
+}
+
+static void
+eti_class_init (GalA11yECellClass *klass)
+{
+ AtkObjectClass *atk_object_class = ATK_OBJECT_CLASS (klass);
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+ parent_class = g_type_class_ref (PARENT_TYPE);
+
+ object_class->dispose = eti_dispose;
+
+ atk_object_class->get_parent = eti_get_parent;
+ atk_object_class->get_index_in_parent = eti_get_index_in_parent;
+}
+
+static void
+eti_init (GalA11yECell *a11y)
+{
+ a11y->item = NULL;
+ a11y->cell_view = NULL;
+ a11y->parent = NULL;
+ a11y->model_col = -1;
+ a11y->view_col = -1;
+ a11y->row = -1;
+}
+
+/**
+ * gal_a11y_e_cell_get_type:
+ * @void:
+ *
+ * Registers the &GalA11yECell class if necessary, and returns the type ID
+ * associated to it.
+ *
+ * Return value: The type ID of the &GalA11yECell class.
+ **/
+GType
+gal_a11y_e_cell_get_type (void)
+{
+ static GType type = 0;
+
+ if (!type) {
+ GTypeInfo info = {
+ sizeof (GalA11yECellClass),
+ (GBaseInitFunc) NULL,
+ (GBaseFinalizeFunc) NULL,
+ (GClassInitFunc) eti_class_init,
+ (GClassFinalizeFunc) NULL,
+ NULL, /* class_data */
+ sizeof (GalA11yECell),
+ 0,
+ (GInstanceInitFunc) eti_init,
+ NULL /* value_cell */
+ };
+
+ static const GInterfaceInfo atk_component_info = {
+ (GInterfaceInitFunc) eti_atk_component_iface_init,
+ (GInterfaceFinalizeFunc) NULL,
+ NULL
+ };
+
+ type = g_type_register_static (PARENT_TYPE, "GalA11yECell", &info, 0);
+ g_type_add_interface_static (type, ATK_TYPE_COMPONENT, &atk_component_info);
+ }
+
+ return type;
+}
+AtkObject *
+gal_a11y_e_cell_new (ETableItem *item,
+ ECellView *cell_view,
+ AtkObject *parent,
+ int model_col,
+ int view_col,
+ int row)
+{
+ AtkObject *a11y;
+
+ a11y = g_object_new (gal_a11y_e_cell_get_type (), NULL);
+
+ gal_a11y_e_cell_construct (a11y,
+ item,
+ cell_view,
+ parent,
+ model_col,
+ view_col,
+ row);
+ return a11y;
+}
+
+void
+gal_a11y_e_cell_construct (AtkObject *object,
+ ETableItem *item,
+ ECellView *cell_view,
+ AtkObject *parent,
+ int model_col,
+ int view_col,
+ int row)
+{
+ GalA11yECell *a11y = GAL_A11Y_E_CELL (object);
+ a11y->item = item;
+ a11y->cell_view = cell_view;
+ a11y->parent = parent;
+ a11y->model_col = model_col;
+ a11y->view_col = view_col;
+ a11y->row = row;
+
+#if 0
+ if (parent)
+ g_object_ref (parent);
+
+ if (item)
+ g_object_ref (G_OBJECT (item)); /*,
+ unref_item,
+ a11y);*/
+ if (cell_view)
+ g_object_ref (G_OBJECT (cell_view)); /*,
+ unref_cell,
+ a11y);*/
+#endif
+}
diff --git a/a11y/e-table/gal-a11y-e-cell.h b/a11y/e-table/gal-a11y-e-cell.h
new file mode 100644
index 0000000000..ff9e5162d8
--- /dev/null
+++ b/a11y/e-table/gal-a11y-e-cell.h
@@ -0,0 +1,61 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * Authors:
+ * Christopher James Lahey <clahey@ximian.com>
+ *
+ * Copyright (C) 2001 Chris Lahey
+ */
+
+#ifndef __GAL_A11Y_E_CELL_H__
+#define __GAL_A11Y_E_CELL_H__
+
+#include <glib-object.h>
+#include <gal/e-table/e-table-item.h>
+#include <gal/e-table/e-cell.h>
+
+#define GAL_A11Y_TYPE_E_CELL (gal_a11y_e_cell_get_type ())
+#define GAL_A11Y_E_CELL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GAL_A11Y_TYPE_E_CELL, GalA11yECell))
+#define GAL_A11Y_E_CELL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GAL_A11Y_TYPE_E_CELL, GalA11yECellClass))
+#define GAL_A11Y_IS_E_CELL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GAL_A11Y_TYPE_E_CELL))
+#define GAL_A11Y_IS_E_CELL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GAL_A11Y_TYPE_E_CELL))
+
+typedef struct _GalA11yECell GalA11yECell;
+typedef struct _GalA11yECellClass GalA11yECellClass;
+typedef struct _GalA11yECellPrivate GalA11yECellPrivate;
+
+/* This struct should actually be larger as this isn't what we derive from.
+ * The GalA11yECellPrivate comes right after the parent class structure.
+ **/
+struct _GalA11yECell {
+ AtkObject object;
+
+ ETableItem *item;
+ ECellView *cell_view;
+ AtkObject *parent;
+ int model_col;
+ int view_col;
+ int row;
+};
+
+struct _GalA11yECellClass {
+ AtkObjectClass parent_class;
+};
+
+
+/* Standard Glib function */
+GType gal_a11y_e_cell_get_type (void);
+AtkObject *gal_a11y_e_cell_new (ETableItem *item,
+ ECellView *cell_view,
+ AtkObject *parent,
+ int model_col,
+ int view_col,
+ int row);
+void gal_a11y_e_cell_construct (AtkObject *object,
+ ETableItem *item,
+ ECellView *cell_view,
+ AtkObject *parent,
+ int model_col,
+ int view_col,
+ int row);
+
+#endif /* ! __GAL_A11Y_E_CELL_H__ */
diff --git a/a11y/e-table/gal-a11y-e-table-factory.c b/a11y/e-table/gal-a11y-e-table-factory.c
new file mode 100644
index 0000000000..14eaca3d19
--- /dev/null
+++ b/a11y/e-table/gal-a11y-e-table-factory.c
@@ -0,0 +1,83 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * Authors:
+ * Christopher James Lahey <clahey@ximian.com>
+ *
+ * Copyright (C) 2002 Ximian, Inc.
+ */
+
+#include <config.h>
+#include "gal-a11y-e-table-factory.h"
+#include "gal-a11y-e-table.h"
+
+#define CS_CLASS(factory) (G_TYPE_INSTANCE_GET_CLASS ((factory), C_TYPE_STREAM, GalA11yETableFactoryClass))
+static AtkObjectFactoryClass *parent_class;
+#define PARENT_TYPE (ATK_TYPE_OBJECT_FACTORY)
+
+/* Static functions */
+
+static GType
+gal_a11y_e_table_factory_get_accessible_type (void)
+{
+ return GAL_A11Y_TYPE_E_TABLE;
+}
+
+static AtkObject*
+gal_a11y_e_table_factory_create_accessible (GObject *obj)
+{
+ AtkObject *accessible;
+
+ accessible = gal_a11y_e_table_new (obj);
+
+ return accessible;
+}
+
+static void
+gal_a11y_e_table_factory_class_init (GalA11yETableFactoryClass *klass)
+{
+ AtkObjectFactoryClass *factory_class = ATK_OBJECT_FACTORY_CLASS (klass);
+
+ parent_class = g_type_class_ref (PARENT_TYPE);
+
+ factory_class->create_accessible = gal_a11y_e_table_factory_create_accessible;
+ factory_class->get_accessible_type = gal_a11y_e_table_factory_get_accessible_type;
+}
+
+static void
+gal_a11y_e_table_factory_init (GalA11yETableFactory *factory)
+{
+}
+
+/**
+ * gal_a11y_e_table_factory_get_type:
+ * @void:
+ *
+ * Registers the &GalA11yETableFactory class if necessary, and returns the type ID
+ * associated to it.
+ *
+ * Return value: The type ID of the &GalA11yETableFactory class.
+ **/
+GType
+gal_a11y_e_table_factory_get_type (void)
+{
+ static GType type = 0;
+
+ if (!type) {
+ GTypeInfo info = {
+ sizeof (GalA11yETableFactoryClass),
+ (GBaseInitFunc) NULL,
+ (GBaseFinalizeFunc) NULL,
+ (GClassInitFunc) gal_a11y_e_table_factory_class_init,
+ (GClassFinalizeFunc) NULL,
+ NULL, /* class_data */
+ sizeof (GalA11yETableFactory),
+ 0,
+ (GInstanceInitFunc) gal_a11y_e_table_factory_init,
+ NULL /* value_table */
+ };
+
+ type = g_type_register_static (PARENT_TYPE, "GalA11yETableFactory", &info, 0);
+ }
+
+ return type;
+}
diff --git a/a11y/e-table/gal-a11y-e-table-factory.h b/a11y/e-table/gal-a11y-e-table-factory.h
new file mode 100644
index 0000000000..eb8eb55414
--- /dev/null
+++ b/a11y/e-table/gal-a11y-e-table-factory.h
@@ -0,0 +1,36 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * Authors:
+ * Christopher James Lahey <clahey@ximian.com>
+ *
+ * Copyright (C) 2001 Chris Lahey
+ */
+
+#ifndef __GAL_A11Y_E_TABLE_FACTORY_H__
+#define __GAL_A11Y_E_TABLE_FACTORY_H__
+
+#include <glib-object.h>
+#include <atk/atkobjectfactory.h>
+
+#define GAL_A11Y_TYPE_E_TABLE_FACTORY (gal_a11y_e_table_factory_get_type ())
+#define GAL_A11Y_E_TABLE_FACTORY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GAL_A11Y_TYPE_E_TABLE_FACTORY, GalA11yETableFactory))
+#define GAL_A11Y_E_TABLE_FACTORY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GAL_A11Y_TYPE_E_TABLE_FACTORY, GalA11yETableFactoryClass))
+#define GAL_A11Y_IS_E_TABLE_FACTORY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GAL_A11Y_TYPE_E_TABLE_FACTORY))
+#define GAL_A11Y_IS_E_TABLE_FACTORY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GAL_A11Y_TYPE_E_TABLE_FACTORY))
+
+typedef struct _GalA11yETableFactory GalA11yETableFactory;
+typedef struct _GalA11yETableFactoryClass GalA11yETableFactoryClass;
+
+struct _GalA11yETableFactory {
+ AtkObject object;
+};
+
+struct _GalA11yETableFactoryClass {
+ AtkObjectClass parent_class;
+};
+
+
+/* Standard Glib function */
+GType gal_a11y_e_table_factory_get_type (void);
+
+#endif /* ! __GAL_A11Y_E_TABLE_FACTORY_H__ */
diff --git a/a11y/e-table/gal-a11y-e-table-item.c b/a11y/e-table/gal-a11y-e-table-item.c
new file mode 100644
index 0000000000..6ee060caba
--- /dev/null
+++ b/a11y/e-table/gal-a11y-e-table-item.c
@@ -0,0 +1,456 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * Authors:
+ * Christopher James Lahey <clahey@ximian.com>
+ *
+ * Copyright (C) 2002 Ximian, Inc.
+ */
+
+#include <config.h>
+#include "gal-a11y-e-table-item.h"
+#include "gal-a11y-e-cell-registry.h"
+#include "gal-a11y-util.h"
+#include <atk/atkobject.h>
+#include <atk/atktable.h>
+#include <atk/atkcomponent.h>
+#include <atk/atkobjectfactory.h>
+#include <atk/atkregistry.h>
+#include <atk/atkgobjectaccessible.h>
+
+#define CS_CLASS(a11y) (G_TYPE_INSTANCE_GET_CLASS ((a11y), C_TYPE_STREAM, GalA11yETableItemClass))
+static GObjectClass *parent_class;
+static AtkComponentIface *component_parent_iface;
+static GType parent_type;
+static gint priv_offset;
+static GQuark quark_accessible_object = 0;
+#define GET_PRIVATE(object) ((GalA11yETableItemPrivate *) (((char *) object) + priv_offset))
+#define PARENT_TYPE (parent_type)
+
+struct _GalA11yETableItemPrivate {
+ AtkObject *parent;
+ gint index_in_parent;
+};
+
+#if 0
+static void
+unref_accessible (gpointer user_data, GObject *obj_loc)
+{
+ GalA11yETableItem *a11y = GAL_A11Y_E_TABLE_ITEM (user_data);
+ GET_PRIVATE (a11y)->item = NULL;
+ g_object_unref (a11y);
+}
+#endif
+
+static void
+eti_dispose (GObject *object)
+{
+ GalA11yETableItem *a11y = GAL_A11Y_E_TABLE_ITEM (object);
+ GalA11yETableItemPrivate *priv = GET_PRIVATE (a11y);
+
+#if 0
+ if (priv->item)
+ g_object_weak_unref (G_OBJECT (priv->item), unref_accessible, a11y);
+
+ if (priv->parent)
+ g_object_unref (priv->parent);
+#endif
+ priv->parent = NULL;
+
+ if (parent_class->dispose)
+ parent_class->dispose (object);
+}
+
+/* Static functions */
+static AtkObject*
+eti_get_parent (AtkObject *accessible)
+{
+ GalA11yETableItem *a11y = GAL_A11Y_E_TABLE_ITEM (accessible);
+ return GET_PRIVATE (a11y)->parent;
+}
+
+static gint
+eti_get_n_children (AtkObject *accessible)
+{
+ return atk_table_get_n_columns (ATK_TABLE (accessible)) *
+ atk_table_get_n_rows (ATK_TABLE (accessible));
+}
+
+static AtkObject*
+eti_ref_child (AtkObject *accessible,
+ gint i)
+{
+ AtkTable *table = ATK_TABLE (accessible);
+ ETableItem *item = E_TABLE_ITEM (atk_gobject_accessible_get_object (ATK_GOBJECT_ACCESSIBLE (accessible)));
+
+ int col = i % item->cols;
+ int row = i / item->cols;
+
+ return atk_table_ref_at (table, row, col);
+}
+
+static gint
+eti_get_index_in_parent (AtkObject *accessible)
+{
+ GalA11yETableItem *a11y = GAL_A11Y_E_TABLE_ITEM (accessible);
+ return GET_PRIVATE (a11y)->index_in_parent;
+}
+
+static void
+eti_get_extents (AtkComponent *component,
+ gint *x,
+ gint *y,
+ gint *width,
+ gint *height,
+ AtkCoordType coord_type)
+{
+ ETableItem *item = E_TABLE_ITEM (atk_gobject_accessible_get_object (ATK_GOBJECT_ACCESSIBLE (component)));
+ double real_width;
+ double real_height;
+ int fake_width;
+ int fake_height;
+
+ if (component_parent_iface &&
+ component_parent_iface->get_extents)
+ component_parent_iface->get_extents (component,
+ x,
+ y,
+ &fake_width,
+ &fake_height,
+ coord_type);
+
+ gtk_object_get (GTK_OBJECT (item),
+ "width", &real_width,
+ "height", &real_height,
+ NULL);
+
+ if (width)
+ *width = real_width;
+ if (height)
+ *height = real_height;
+}
+
+static AtkObject*
+eti_ref_accessible_at_point (AtkComponent *component,
+ gint x,
+ gint y,
+ AtkCoordType coord_type)
+{
+ int row = -1;
+ int col = -1;
+ int x_origin, y_origin;
+ ETableItem *item = E_TABLE_ITEM (atk_gobject_accessible_get_object (ATK_GOBJECT_ACCESSIBLE (component)));
+
+ atk_component_get_position (component,
+ &x_origin,
+ &y_origin,
+ coord_type);
+ x -= x_origin;
+ y -= y_origin;
+
+ e_table_item_compute_location (item, &x, &y,
+ &row, &col);
+
+ if (row != -1 && col != -1) {
+ return atk_table_ref_at (ATK_TABLE (component), row, col);
+ } else {
+ return NULL;
+ }
+}
+
+
+/* Table IFace */
+
+static AtkObject*
+eti_ref_at (AtkTable *table,
+ gint row,
+ gint column)
+{
+ AtkObject* accessible = ATK_OBJECT (table);
+ ETableItem *item = E_TABLE_ITEM (atk_gobject_accessible_get_object (ATK_GOBJECT_ACCESSIBLE (table)));
+
+ if (column >= 0 &&
+ column < item->cols &&
+ row >= 0 &&
+ row < item->rows &&
+ item->cell_views_realized) {
+ ECellView *cell_view = item->cell_views[column];
+ ETableCol *ecol = e_table_header_get_column (item->header, column);
+ return gal_a11y_e_cell_registry_get_object (NULL,
+ item,
+ cell_view,
+ accessible,
+ ecol->col_idx,
+ column,
+ row);
+ }
+
+ return NULL;
+}
+
+static gint
+eti_get_index_at (AtkTable *table,
+ gint row,
+ gint column)
+{
+ ETableItem *item = E_TABLE_ITEM (atk_gobject_accessible_get_object (ATK_GOBJECT_ACCESSIBLE (table)));
+
+ return column + row * item->cols;
+}
+
+static gint
+eti_get_column_at_index (AtkTable *table,
+ gint index)
+{
+ ETableItem *item = E_TABLE_ITEM (atk_gobject_accessible_get_object (ATK_GOBJECT_ACCESSIBLE (table)));
+
+ return index % item->cols;
+}
+
+static gint
+eti_get_row_at_index (AtkTable *table,
+ gint index)
+{
+ ETableItem *item = E_TABLE_ITEM (atk_gobject_accessible_get_object (ATK_GOBJECT_ACCESSIBLE (table)));
+
+ return index / item->cols;
+}
+
+static gint
+eti_get_n_columns (AtkTable *table)
+{
+ ETableItem *item = E_TABLE_ITEM (atk_gobject_accessible_get_object (ATK_GOBJECT_ACCESSIBLE (table)));
+
+ return item->cols;
+}
+
+static gint
+eti_get_n_rows (AtkTable *table)
+{
+ ETableItem *item = E_TABLE_ITEM (atk_gobject_accessible_get_object (ATK_GOBJECT_ACCESSIBLE (table)));
+
+ return item->rows;
+}
+
+static gint
+eti_get_column_extent_at (AtkTable *table,
+ gint row,
+ gint column)
+{
+ ETableItem *item = E_TABLE_ITEM (atk_gobject_accessible_get_object (ATK_GOBJECT_ACCESSIBLE (table)));
+ int width;
+
+ e_table_item_get_cell_geometry (item,
+ &row,
+ &column,
+ NULL,
+ NULL,
+ &width,
+ NULL);
+
+ return width;
+}
+
+static gint
+eti_get_row_extent_at (AtkTable *table,
+ gint row,
+ gint column)
+{
+ ETableItem *item = E_TABLE_ITEM (atk_gobject_accessible_get_object (ATK_GOBJECT_ACCESSIBLE (table)));
+ int height;
+
+ e_table_item_get_cell_geometry (item,
+ &row,
+ &column,
+ NULL,
+ NULL,
+ NULL,
+ &height);
+
+ return height;
+}
+
+static AtkObject *
+eti_get_caption (AtkTable *table)
+{
+ /* Unimplemented */
+ return NULL;
+}
+
+static G_CONST_RETURN gchar *
+eti_get_column_description (AtkTable *table,
+ gint column)
+{
+ ETableItem *item = E_TABLE_ITEM (atk_gobject_accessible_get_object (ATK_GOBJECT_ACCESSIBLE (table)));
+ ETableCol *ecol = e_table_header_get_column (item->header, column);
+
+ return ecol->text;
+}
+
+static AtkObject *
+eti_get_column_header (AtkTable *table,
+ gint column)
+{
+ /* Unimplemented */
+ return NULL;
+}
+
+static G_CONST_RETURN gchar *
+eti_get_row_description (AtkTable *table,
+ gint row)
+{
+ /* Unimplemented */
+ return NULL;
+}
+
+static AtkObject *
+eti_get_row_header (AtkTable *table,
+ gint row)
+{
+ /* Unimplemented */
+ return NULL;
+}
+
+static AtkObject *
+eti_get_summary (AtkTable *table)
+{
+ /* Unimplemented */
+ return NULL;
+}
+
+static void
+eti_atk_table_iface_init (AtkTableIface *iface)
+{
+ iface->ref_at = eti_ref_at;
+ iface->get_index_at = eti_get_index_at;
+ iface->get_column_at_index = eti_get_column_at_index;
+ iface->get_row_at_index = eti_get_row_at_index;
+ iface->get_n_columns = eti_get_n_columns;
+ iface->get_n_rows = eti_get_n_rows;
+ iface->get_column_extent_at = eti_get_column_extent_at;
+ iface->get_row_extent_at = eti_get_row_extent_at;
+ iface->get_caption = eti_get_caption;
+ iface->get_column_description = eti_get_column_description;
+ iface->get_column_header = eti_get_column_header;
+ iface->get_row_description = eti_get_row_description;
+ iface->get_row_header = eti_get_row_header;
+ iface->get_summary = eti_get_summary;
+}
+
+static void
+eti_atk_component_iface_init (AtkComponentIface *iface)
+{
+ component_parent_iface = g_type_interface_peek_parent (iface);
+
+ iface->ref_accessible_at_point = eti_ref_accessible_at_point;
+ iface->get_extents = eti_get_extents;
+}
+
+static void
+eti_class_init (GalA11yETableItemClass *klass)
+{
+ AtkObjectClass *atk_object_class = ATK_OBJECT_CLASS (klass);
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+ quark_accessible_object = g_quark_from_static_string ("gtk-accessible-object");
+
+ parent_class = g_type_class_ref (PARENT_TYPE);
+
+ object_class->dispose = eti_dispose;
+
+ atk_object_class->get_parent = eti_get_parent;
+ atk_object_class->get_n_children = eti_get_n_children;
+ atk_object_class->ref_child = eti_ref_child;
+ atk_object_class->get_index_in_parent = eti_get_index_in_parent;
+}
+
+static void
+eti_init (GalA11yETableItem *a11y)
+{
+ GalA11yETableItemPrivate *priv;
+
+ priv = GET_PRIVATE (a11y);
+
+ priv->parent = NULL;
+ priv->index_in_parent = -1;
+}
+
+/**
+ * gal_a11y_e_table_item_get_type:
+ * @void:
+ *
+ * Registers the &GalA11yETableItem class if necessary, and returns the type ID
+ * associated to it.
+ *
+ * Return value: The type ID of the &GalA11yETableItem class.
+ **/
+GType
+gal_a11y_e_table_item_get_type (void)
+{
+ static GType type = 0;
+
+ if (!type) {
+ AtkObjectFactory *factory;
+
+ GTypeInfo info = {
+ sizeof (GalA11yETableItemClass),
+ (GBaseInitFunc) NULL,
+ (GBaseFinalizeFunc) NULL,
+ (GClassInitFunc) eti_class_init,
+ (GClassFinalizeFunc) NULL,
+ NULL, /* class_data */
+ sizeof (GalA11yETableItem),
+ 0,
+ (GInstanceInitFunc) eti_init,
+ NULL /* value_table_item */
+ };
+
+ static const GInterfaceInfo atk_component_info = {
+ (GInterfaceInitFunc) eti_atk_component_iface_init,
+ (GInterfaceFinalizeFunc) NULL,
+ NULL
+ };
+ static const GInterfaceInfo atk_table_info = {
+ (GInterfaceInitFunc) eti_atk_table_iface_init,
+ (GInterfaceFinalizeFunc) NULL,
+ NULL
+ };
+
+ factory = atk_registry_get_factory (atk_get_default_registry (), GNOME_TYPE_CANVAS_ITEM);
+ parent_type = atk_object_factory_get_accessible_type (factory);
+
+ type = gal_a11y_type_register_static_with_private (PARENT_TYPE, "GalA11yETableItem", &info, 0,
+ sizeof (GalA11yETableItemPrivate), &priv_offset);
+
+ g_type_add_interface_static (type, ATK_TYPE_COMPONENT, &atk_component_info);
+ g_type_add_interface_static (type, ATK_TYPE_TABLE, &atk_table_info);
+ }
+
+ return type;
+}
+
+AtkObject *
+gal_a11y_e_table_item_new (AtkObject *parent,
+ ETableItem *item,
+ int index_in_parent)
+{
+ GalA11yETableItem *a11y;
+
+ a11y = g_object_new (gal_a11y_e_table_item_get_type (), NULL);
+
+ atk_object_initialize (ATK_OBJECT (a11y), item);
+
+ GET_PRIVATE (a11y)->parent = parent;
+ GET_PRIVATE (a11y)->index_in_parent = index_in_parent;
+
+ if (parent)
+ g_object_ref (parent);
+
+#if 0
+ if (item)
+ g_object_weak_ref (G_OBJECT (item),
+ unref_accessible,
+ a11y);
+#endif
+
+ return ATK_OBJECT (a11y);
+}
diff --git a/a11y/e-table/gal-a11y-e-table-item.h b/a11y/e-table/gal-a11y-e-table-item.h
new file mode 100644
index 0000000000..795fa64499
--- /dev/null
+++ b/a11y/e-table/gal-a11y-e-table-item.h
@@ -0,0 +1,43 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * Authors:
+ * Christopher James Lahey <clahey@ximian.com>
+ *
+ * Copyright (C) 2001 Chris Lahey
+ */
+
+#ifndef __GAL_A11Y_E_TABLE_ITEM_H__
+#define __GAL_A11Y_E_TABLE_ITEM_H__
+
+#include <glib-object.h>
+#include <gal/e-table/e-table-item.h>
+
+#define GAL_A11Y_TYPE_E_TABLE_ITEM (gal_a11y_e_table_item_get_type ())
+#define GAL_A11Y_E_TABLE_ITEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GAL_A11Y_TYPE_E_TABLE_ITEM, GalA11yETableItem))
+#define GAL_A11Y_E_TABLE_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GAL_A11Y_TYPE_E_TABLE_ITEM, GalA11yETableItemClass))
+#define GAL_A11Y_IS_E_TABLE_ITEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GAL_A11Y_TYPE_E_TABLE_ITEM))
+#define GAL_A11Y_IS_E_TABLE_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GAL_A11Y_TYPE_E_TABLE_ITEM))
+
+typedef struct _GalA11yETableItem GalA11yETableItem;
+typedef struct _GalA11yETableItemClass GalA11yETableItemClass;
+typedef struct _GalA11yETableItemPrivate GalA11yETableItemPrivate;
+
+/* This struct should actually be larger as this isn't what we derive from.
+ * The GalA11yETableItemPrivate comes right after the parent class structure.
+ **/
+struct _GalA11yETableItem {
+ AtkObject object;
+};
+
+struct _GalA11yETableItemClass {
+ AtkObject parent_class;
+};
+
+
+/* Standard Glib function */
+GType gal_a11y_e_table_item_get_type (void);
+AtkObject *gal_a11y_e_table_item_new (AtkObject *parent,
+ ETableItem *item,
+ int index_in_parent);
+
+#endif /* ! __GAL_A11Y_E_TABLE_ITEM_H__ */
diff --git a/a11y/e-table/gal-a11y-e-table.c b/a11y/e-table/gal-a11y-e-table.c
new file mode 100644
index 0000000000..ae166d2c09
--- /dev/null
+++ b/a11y/e-table/gal-a11y-e-table.c
@@ -0,0 +1,156 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * Authors:
+ * Christopher James Lahey <clahey@ximian.com>
+ *
+ * Copyright (C) 2002 Ximian, Inc.
+ */
+
+#include <config.h>
+#include "gal-a11y-e-table.h"
+#include "gal-a11y-e-table-item.h"
+#include "gal-a11y-util.h"
+#include <gal/e-table/e-table.h>
+#include <gal/e-table/e-table-group.h>
+#include <gal/e-table/e-table-group-leaf.h>
+
+#define CS_CLASS(a11y) (G_TYPE_INSTANCE_GET_CLASS ((a11y), C_TYPE_STREAM, GalA11yETableClass))
+static AtkObjectClass *parent_class;
+static GType parent_type;
+static gint priv_offset;
+#define GET_PRIVATE(object) ((GalA11yETablePrivate *) (((char *) object) + priv_offset))
+#define PARENT_TYPE (parent_type)
+
+struct _GalA11yETablePrivate {
+ AtkObject *child_item;
+};
+
+/* Static functions */
+
+static void
+init_child_item (GalA11yETable *a11y)
+{
+ GalA11yETablePrivate *priv = GET_PRIVATE (a11y);
+ ETable *table = E_TABLE (GTK_ACCESSIBLE (a11y)->widget);
+ if (priv->child_item == NULL) {
+ priv->child_item = gal_a11y_e_table_item_new (ATK_OBJECT (a11y), E_TABLE_GROUP_LEAF (table->group)->item, 0);
+ }
+}
+
+static AtkObject*
+et_ref_accessible_at_point (AtkComponent *component,
+ gint x,
+ gint y,
+ AtkCoordType coord_type)
+{
+ GalA11yETable *a11y = GAL_A11Y_E_TABLE (component);
+ init_child_item (a11y);
+ return GET_PRIVATE (a11y)->child_item;
+}
+
+static gint
+et_get_n_children (AtkObject *accessible)
+{
+ return 1;
+}
+
+static AtkObject*
+et_ref_child (AtkObject *accessible,
+ gint i)
+{
+ GalA11yETable *a11y = GAL_A11Y_E_TABLE (accessible);
+ if (i != 0)
+ return NULL;
+ init_child_item (a11y);
+ g_object_ref (GET_PRIVATE (a11y)->child_item);
+ return GET_PRIVATE (a11y)->child_item;
+}
+
+static void
+et_class_init (GalA11yETableClass *klass)
+{
+ AtkObjectClass *atk_object_class = ATK_OBJECT_CLASS (klass);
+
+ parent_class = g_type_class_ref (PARENT_TYPE);
+
+ atk_object_class->get_n_children = et_get_n_children;
+ atk_object_class->ref_child = et_ref_child;
+}
+
+static void
+et_atk_component_iface_init (AtkComponentIface *iface)
+{
+ iface->ref_accessible_at_point = et_ref_accessible_at_point;
+}
+
+static void
+et_init (GalA11yETable *a11y)
+{
+ GalA11yETablePrivate *priv;
+
+ priv = GET_PRIVATE (a11y);
+
+ priv->child_item = NULL;
+}
+
+/**
+ * gal_a11y_e_table_get_type:
+ * @void:
+ *
+ * Registers the &GalA11yETable class if necessary, and returns the type ID
+ * associated to it.
+ *
+ * Return value: The type ID of the &GalA11yETable class.
+ **/
+GType
+gal_a11y_e_table_get_type (void)
+{
+ static GType type = 0;
+
+ if (!type) {
+ AtkObjectFactory *factory;
+
+ GTypeInfo info = {
+ sizeof (GalA11yETableClass),
+ (GBaseInitFunc) NULL,
+ (GBaseFinalizeFunc) NULL,
+ (GClassInitFunc) et_class_init,
+ (GClassFinalizeFunc) NULL,
+ NULL, /* class_data */
+ sizeof (GalA11yETable),
+ 0,
+ (GInstanceInitFunc) et_init,
+ NULL /* value_table */
+ };
+
+ static const GInterfaceInfo atk_component_info = {
+ (GInterfaceInitFunc) et_atk_component_iface_init,
+ (GInterfaceFinalizeFunc) NULL,
+ NULL
+ };
+
+ factory = atk_registry_get_factory (atk_get_default_registry (), GTK_TYPE_WIDGET);
+ parent_type = atk_object_factory_get_accessible_type (factory);
+
+ type = gal_a11y_type_register_static_with_private (PARENT_TYPE, "GalA11yETable", &info, 0,
+ sizeof (GalA11yETablePrivate), &priv_offset);
+ g_type_add_interface_static (type, ATK_TYPE_COMPONENT, &atk_component_info);
+ }
+
+ return type;
+}
+
+AtkObject *
+gal_a11y_e_table_new (GObject *widget)
+{
+ GalA11yETable *a11y;
+ ETable *table;
+
+ table = E_TABLE (widget);
+
+ a11y = g_object_new (gal_a11y_e_table_get_type (), NULL);
+
+ GTK_ACCESSIBLE (a11y)->widget = GTK_WIDGET (widget);
+
+ return ATK_OBJECT (a11y);
+}
diff --git a/a11y/e-table/gal-a11y-e-table.h b/a11y/e-table/gal-a11y-e-table.h
new file mode 100644
index 0000000000..0a0901e3bc
--- /dev/null
+++ b/a11y/e-table/gal-a11y-e-table.h
@@ -0,0 +1,43 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * Authors:
+ * Christopher James Lahey <clahey@ximian.com>
+ *
+ * Copyright (C) 2001 Chris Lahey
+ */
+
+#ifndef __GAL_A11Y_E_TABLE_H__
+#define __GAL_A11Y_E_TABLE_H__
+
+#include <glib-object.h>
+#include <atk/atkobject.h>
+#include <atk/atkcomponent.h>
+#include <gtk/gtkaccessible.h>
+
+#define GAL_A11Y_TYPE_E_TABLE (gal_a11y_e_table_get_type ())
+#define GAL_A11Y_E_TABLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GAL_A11Y_TYPE_E_TABLE, GalA11yETable))
+#define GAL_A11Y_E_TABLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GAL_A11Y_TYPE_E_TABLE, GalA11yETableClass))
+#define GAL_A11Y_IS_E_TABLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GAL_A11Y_TYPE_E_TABLE))
+#define GAL_A11Y_IS_E_TABLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GAL_A11Y_TYPE_E_TABLE))
+
+typedef struct _GalA11yETable GalA11yETable;
+typedef struct _GalA11yETableClass GalA11yETableClass;
+typedef struct _GalA11yETablePrivate GalA11yETablePrivate;
+
+/* This struct should actually be larger as this isn't what we derive from.
+ * The GalA11yETablePrivate comes right after the parent class structure.
+ **/
+struct _GalA11yETable {
+ GtkAccessible object;
+};
+
+struct _GalA11yETableClass {
+ GtkAccessibleClass parent_class;
+};
+
+
+/* Standard Glib function */
+GType gal_a11y_e_table_get_type (void);
+AtkObject *gal_a11y_e_table_new (GObject *table);
+
+#endif /* ! __GAL_A11Y_E_TABLE_H__ */
diff --git a/a11y/e-text/.cvsignore b/a11y/e-text/.cvsignore
new file mode 100644
index 0000000000..5b48d3f593
--- /dev/null
+++ b/a11y/e-text/.cvsignore
@@ -0,0 +1,4 @@
+.libs
+Makefile.in
+Makefile
+*.la
diff --git a/a11y/e-text/gal-a11y-e-text-factory.c b/a11y/e-text/gal-a11y-e-text-factory.c
new file mode 100644
index 0000000000..574315b335
--- /dev/null
+++ b/a11y/e-text/gal-a11y-e-text-factory.c
@@ -0,0 +1,88 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * Authors:
+ * Christopher James Lahey <clahey@ximian.com>
+ *
+ * Copyright (C) 2002 Ximian, Inc.
+ */
+
+#include <config.h>
+#include "gal/e-text/e-text.h"
+#include "gal-a11y-e-text-factory.h"
+#include "gal-a11y-e-text.h"
+
+#define CS_CLASS(factory) (G_TYPE_INSTANCE_GET_CLASS ((factory), C_TYPE_STREAM, GalA11yETextFactoryClass))
+static AtkObjectFactoryClass *parent_class;
+#define PARENT_TYPE (ATK_TYPE_OBJECT_FACTORY)
+
+/* Static functions */
+
+static GType
+gal_a11y_e_text_factory_get_accessible_type (void)
+{
+ return GAL_A11Y_TYPE_E_TEXT;
+}
+
+static AtkObject*
+gal_a11y_e_text_factory_create_accessible (GObject *obj)
+{
+ AtkObject *atk_object;
+
+ g_return_val_if_fail (E_IS_TEXT (obj), NULL);
+
+ atk_object = g_object_new (GAL_A11Y_TYPE_E_TEXT, NULL);
+ atk_object_initialize (atk_object, obj);
+ atk_object->role = ATK_ROLE_UNKNOWN;
+
+ return atk_object;
+}
+
+static void
+gal_a11y_e_text_factory_class_init (GalA11yETextFactoryClass *klass)
+{
+ AtkObjectFactoryClass *factory_class = ATK_OBJECT_FACTORY_CLASS (klass);
+
+ parent_class = g_type_class_ref (PARENT_TYPE);
+
+ factory_class->create_accessible = gal_a11y_e_text_factory_create_accessible;
+ factory_class->get_accessible_type = gal_a11y_e_text_factory_get_accessible_type;
+}
+
+static void
+gal_a11y_e_text_factory_init (GalA11yETextFactory *factory)
+{
+}
+
+/**
+ * gal_a11y_e_text_factory_get_type:
+ * @void:
+ *
+ * Registers the &GalA11yETextFactory class if necessary, and returns the type ID
+ * associated to it.
+ *
+ * Return value: The type ID of the &GalA11yETextFactory class.
+ **/
+GType
+gal_a11y_e_text_factory_get_type (void)
+{
+ static GType type = 0;
+
+ if (!type) {
+ GTypeInfo info = {
+ sizeof (GalA11yETextFactoryClass),
+ (GBaseInitFunc) NULL,
+ (GBaseFinalizeFunc) NULL,
+ (GClassInitFunc) gal_a11y_e_text_factory_class_init,
+ (GClassFinalizeFunc) NULL,
+ NULL, /* class_data */
+ sizeof (GalA11yETextFactory),
+ 0,
+ (GInstanceInitFunc) gal_a11y_e_text_factory_init,
+ NULL /* value_text */
+ };
+
+ type = g_type_register_static (PARENT_TYPE, "GalA11yETextFactory", &info, 0);
+ }
+
+ return type;
+}
diff --git a/a11y/e-text/gal-a11y-e-text-factory.h b/a11y/e-text/gal-a11y-e-text-factory.h
new file mode 100644
index 0000000000..2b945dbd94
--- /dev/null
+++ b/a11y/e-text/gal-a11y-e-text-factory.h
@@ -0,0 +1,36 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * Authors:
+ * Christopher James Lahey <clahey@ximian.com>
+ *
+ * Copyright (C) 2001 Chris Lahey
+ */
+
+#ifndef __GAL_A11Y_E_TEXT_FACTORY_H__
+#define __GAL_A11Y_E_TEXT_FACTORY_H__
+
+#include <glib-object.h>
+#include <atk/atkobjectfactory.h>
+
+#define GAL_A11Y_TYPE_E_TEXT_FACTORY (gal_a11y_e_text_factory_get_type ())
+#define GAL_A11Y_E_TEXT_FACTORY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GAL_A11Y_TYPE_E_TEXT_FACTORY, GalA11yETextFactory))
+#define GAL_A11Y_E_TEXT_FACTORY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GAL_A11Y_TYPE_E_TEXT_FACTORY, GalA11yETextFactoryClass))
+#define GAL_A11Y_IS_E_TEXT_FACTORY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GAL_A11Y_TYPE_E_TEXT_FACTORY))
+#define GAL_A11Y_IS_E_TEXT_FACTORY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GAL_A11Y_TYPE_E_TEXT_FACTORY))
+
+typedef struct _GalA11yETextFactory GalA11yETextFactory;
+typedef struct _GalA11yETextFactoryClass GalA11yETextFactoryClass;
+
+struct _GalA11yETextFactory {
+ AtkObject object;
+};
+
+struct _GalA11yETextFactoryClass {
+ AtkObjectClass parent_class;
+};
+
+
+/* Standard Glib function */
+GType gal_a11y_e_text_factory_get_type (void);
+
+#endif /* ! __GAL_A11Y_E_TEXT_FACTORY_H__ */
diff --git a/a11y/e-text/gal-a11y-e-text.c b/a11y/e-text/gal-a11y-e-text.c
new file mode 100644
index 0000000000..ce32e86fc2
--- /dev/null
+++ b/a11y/e-text/gal-a11y-e-text.c
@@ -0,0 +1,526 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * Authors:
+ * Christopher James Lahey <clahey@ximian.com>
+ *
+ * Copyright (C) 2002 Ximian, Inc.
+ */
+
+#include <config.h>
+#include "gal-a11y-e-text.h"
+#include "gal-a11y-util.h"
+#include <atk/atkobject.h>
+#include <atk/atktable.h>
+#include <atk/atkcomponent.h>
+#include <atk/atkobjectfactory.h>
+#include <atk/atkregistry.h>
+#include <atk/atkgobjectaccessible.h>
+#include "gal/e-text/e-text.h"
+#include <gtk/gtkmain.h>
+
+#define CS_CLASS(a11y) (G_TYPE_INSTANCE_GET_CLASS ((a11y), C_TYPE_STREAM, GalA11yETextClass))
+static GObjectClass *parent_class;
+static AtkComponentIface *component_parent_iface;
+static GType parent_type;
+static gint priv_offset;
+static GQuark quark_accessible_object = 0;
+#define GET_PRIVATE(object) ((GalA11yETextPrivate *) (((char *) object) + priv_offset))
+#define PARENT_TYPE (parent_type)
+
+struct _GalA11yETextPrivate {
+ int dummy;
+};
+
+static void
+et_dispose (GObject *object)
+{
+ if (parent_class->dispose)
+ parent_class->dispose (object);
+}
+
+/* Static functions */
+
+static void
+et_get_extents (AtkComponent *component,
+ gint *x,
+ gint *y,
+ gint *width,
+ gint *height,
+ AtkCoordType coord_type)
+{
+ EText *item = E_TEXT (atk_gobject_accessible_get_object (ATK_GOBJECT_ACCESSIBLE (component)));
+ double real_width;
+ double real_height;
+ int fake_width;
+ int fake_height;
+
+ if (component_parent_iface &&
+ component_parent_iface->get_extents)
+ component_parent_iface->get_extents (component,
+ x,
+ y,
+ &fake_width,
+ &fake_height,
+ coord_type);
+
+ gtk_object_get (GTK_OBJECT (item),
+ "text_width", &real_width,
+ "text_height", &real_height,
+ NULL);
+
+ if (width)
+ *width = real_width;
+ if (height)
+ *height = real_height;
+}
+
+static const gchar *
+et_get_full_text (AtkText *text)
+{
+ EText *etext = E_TEXT (atk_gobject_accessible_get_object (ATK_GOBJECT_ACCESSIBLE (text)));
+ ETextModel *model;
+ const char *full_text;
+
+ gtk_object_get (GTK_OBJECT (etext),
+ "model", &model,
+ NULL);
+
+ full_text = e_text_model_get_text (model);
+
+ return full_text;
+}
+
+static void
+et_set_full_text (AtkEditableText *text,
+ const char *full_text)
+{
+ EText *etext = E_TEXT (atk_gobject_accessible_get_object (ATK_GOBJECT_ACCESSIBLE (text)));
+ ETextModel *model;
+
+ gtk_object_get (GTK_OBJECT (etext),
+ "model", &model,
+ NULL);
+
+ e_text_model_set_text (model, full_text);
+}
+
+static gchar *
+et_get_text (AtkText *text,
+ gint start_offset,
+ gint end_offset)
+{
+ const char *full_text = et_get_full_text (text);
+
+ if (end_offset == -1)
+ end_offset = strlen (full_text);
+ else
+ end_offset = g_utf8_offset_to_pointer (full_text, end_offset) - full_text;
+
+ start_offset = g_utf8_offset_to_pointer (full_text, start_offset) - full_text;
+
+ return g_strndup (full_text + start_offset, end_offset - start_offset);
+}
+
+static gchar *
+et_get_text_after_offset (AtkText *text,
+ gint offset,
+ AtkTextBoundary boundary_type,
+ gint *start_offset,
+ gint *end_offset)
+{
+ /* Unimplemented */
+ return NULL;
+}
+
+static gchar *
+et_get_text_at_offset (AtkText *text,
+ gint offset,
+ AtkTextBoundary boundary_type,
+ gint *start_offset,
+ gint *end_offset)
+{
+ /* Unimplemented */
+ return NULL;
+}
+
+static gunichar
+et_get_character_at_offset (AtkText *text,
+ gint offset)
+{
+ const char *full_text = et_get_full_text (text);
+ char *at_offset;
+
+ at_offset = g_utf8_offset_to_pointer (full_text, offset);
+ return g_utf8_get_char_validated (at_offset, -1);
+}
+
+
+static gchar*
+et_get_text_before_offset (AtkText *text,
+ gint offset,
+ AtkTextBoundary boundary_type,
+ gint *start_offset,
+ gint *end_offset)
+{
+ /* Unimplemented */
+ return NULL;
+}
+
+
+static gint
+et_get_caret_offset (AtkText *text)
+{
+ EText *etext = E_TEXT (atk_gobject_accessible_get_object (ATK_GOBJECT_ACCESSIBLE (text)));
+ const char *full_text = et_get_full_text (text);
+ int offset;
+
+ gtk_object_get (GTK_OBJECT (etext),
+ "cursor_pos", &offset,
+ NULL);
+ offset = g_utf8_pointer_to_offset (full_text, full_text + offset);
+ return offset;
+}
+
+
+static AtkAttributeSet*
+et_get_run_attributes (AtkText *text,
+ gint offset,
+ gint *start_offset,
+ gint *end_offset)
+{
+ /* Unimplemented */
+ return NULL;
+}
+
+
+static AtkAttributeSet*
+et_get_default_attributes (AtkText *text)
+{
+ /* Unimplemented */
+ return NULL;
+}
+
+
+static void
+et_get_character_extents (AtkText *text,
+ gint offset,
+ gint *x,
+ gint *y,
+ gint *width,
+ gint *height,
+ AtkCoordType coords)
+{
+ /* Unimplemented */
+}
+
+
+static gint
+et_get_character_count (AtkText *text)
+{
+ const char *full_text = et_get_full_text (text);
+
+ return g_utf8_strlen (full_text, -1);
+}
+
+
+static gint
+et_get_offset_at_point (AtkText *text,
+ gint x,
+ gint y,
+ AtkCoordType coords)
+{
+ /* Unimplemented */
+ return 0;
+}
+
+
+static gint
+et_get_n_selections (AtkText *text)
+{
+ EText *etext = E_TEXT (atk_gobject_accessible_get_object (ATK_GOBJECT_ACCESSIBLE (text)));
+ if (etext->selection_start !=
+ etext->selection_end)
+ return 1;
+ return 0;
+}
+
+
+static gchar*
+et_get_selection (AtkText *text,
+ gint selection_num,
+ gint *start_offset,
+ gint *end_offset)
+{
+ EText *etext = E_TEXT (atk_gobject_accessible_get_object (ATK_GOBJECT_ACCESSIBLE (text)));
+ if (selection_num == 0 &&
+ etext->selection_start != etext->selection_end) {
+ const char *full_text = et_get_full_text (text);
+
+ if (start_offset)
+ *start_offset = g_utf8_pointer_to_offset (full_text, full_text + etext->selection_start);
+ if (end_offset)
+ *end_offset = g_utf8_pointer_to_offset (full_text, full_text + etext->selection_end);
+
+ return g_strndup (full_text + etext->selection_start, etext->selection_end - etext->selection_start);
+ }
+ return NULL;
+}
+
+
+static gboolean
+et_add_selection (AtkText *text,
+ gint start_offset,
+ gint end_offset)
+{
+ EText *etext = E_TEXT (atk_gobject_accessible_get_object (ATK_GOBJECT_ACCESSIBLE (text)));
+ if (etext->selection_start == etext->selection_end &&
+ start_offset != end_offset) {
+ ETextEventProcessorCommand command;
+ const char *full_text = et_get_full_text (text);
+ ETextEventProcessor *tep;
+
+ start_offset = g_utf8_offset_to_pointer (full_text, start_offset) - full_text;
+ end_offset = g_utf8_offset_to_pointer (full_text, end_offset) - full_text;
+
+ gtk_object_get (GTK_OBJECT (etext),
+ "tep", &tep,
+ NULL);
+
+ command.time = gtk_get_current_event_time ();
+
+ command.action = E_TEP_MOVE;
+ command.position = E_TEP_VALUE;
+ command.value = start_offset;
+ g_signal_emit_by_name (tep, "command", 0, &command);
+
+ command.action = E_TEP_SELECT;
+ command.value = end_offset;
+ g_signal_emit_by_name (tep, "command", 0, &command);
+ return TRUE;
+ }
+ return FALSE;
+}
+
+
+static gboolean
+et_remove_selection (AtkText *text,
+ gint selection_num)
+{
+ /* Unimplemented */
+ return FALSE;
+}
+
+
+static gboolean
+et_set_selection (AtkText *text,
+ gint selection_num,
+ gint start_offset,
+ gint end_offset)
+{
+ /* Unimplemented */
+ return FALSE;
+}
+
+
+static gboolean
+et_set_caret_offset (AtkText *text,
+ gint offset)
+{
+ EText *etext = E_TEXT (atk_gobject_accessible_get_object (ATK_GOBJECT_ACCESSIBLE (text)));
+ const char *full_text = et_get_full_text (text);
+
+ offset = g_utf8_offset_to_pointer (full_text, offset) - full_text;
+ gtk_object_set (GTK_OBJECT (etext),
+ "cursor_pos", &offset,
+ NULL);
+ return TRUE;
+}
+
+static gboolean
+et_set_run_attributes (AtkEditableText *text,
+ AtkAttributeSet *attrib_set,
+ gint start_offset,
+ gint end_offset)
+{
+ /* Unimplemented */
+ return FALSE;
+}
+
+static void
+et_set_text_contents (AtkEditableText *text,
+ const gchar *string)
+{
+ et_set_full_text (text, string);
+}
+
+static void
+et_insert_text (AtkEditableText *text,
+ const gchar *string,
+ gint length,
+ gint *position)
+{
+ /* Utf8 unimplemented */
+
+ const char *full_text = et_get_full_text (ATK_TEXT (text));
+ char *result = g_strdup_printf ("%.*s%.*s%s", *position, full_text, length, string, full_text + *position);
+
+ et_set_full_text (text, result);
+
+ *position += length;
+
+ g_free (result);
+}
+
+static void
+et_copy_text (AtkEditableText *text,
+ gint start_pos,
+ gint end_pos)
+{
+ /* Unimplemented */
+}
+
+static void
+et_cut_text (AtkEditableText *text,
+ gint start_pos,
+ gint end_pos)
+{
+ /* Unimplemented */
+}
+
+static void
+et_delete_text (AtkEditableText *text,
+ gint start_pos,
+ gint end_pos)
+{
+ /* Unimplemented */
+}
+
+static void
+et_paste_text (AtkEditableText *text,
+ gint position)
+{
+ /* Unimplemented */
+}
+
+
+static void
+et_atk_component_iface_init (AtkComponentIface *iface)
+{
+ iface->get_extents = et_get_extents;
+}
+
+static void
+et_atk_text_iface_init (AtkTextIface *iface)
+{
+ iface->get_text = et_get_text;
+ iface->get_text_after_offset = et_get_text_after_offset;
+ iface->get_text_at_offset = et_get_text_at_offset;
+ iface->get_character_at_offset = et_get_character_at_offset;
+ iface->get_text_before_offset = et_get_text_before_offset;
+ iface->get_caret_offset = et_get_caret_offset;
+ iface->get_run_attributes = et_get_run_attributes;
+ iface->get_default_attributes = et_get_default_attributes;
+ iface->get_character_extents = et_get_character_extents;
+ iface->get_character_count = et_get_character_count;
+ iface->get_offset_at_point = et_get_offset_at_point;
+ iface->get_n_selections = et_get_n_selections;
+ iface->get_selection = et_get_selection;
+ iface->add_selection = et_add_selection;
+ iface->remove_selection = et_remove_selection;
+ iface->set_selection = et_set_selection;
+ iface->set_caret_offset = et_set_caret_offset;
+}
+
+static void
+et_atk_editable_text_iface_init (AtkEditableTextIface *iface)
+{
+ iface->set_run_attributes = et_set_run_attributes;
+ iface->set_text_contents = et_set_text_contents;
+ iface->insert_text = et_insert_text;
+ iface->copy_text = et_copy_text;
+ iface->cut_text = et_cut_text;
+ iface->delete_text = et_delete_text;
+ iface->paste_text = et_paste_text;
+}
+
+static void
+et_class_init (GalA11yETextClass *klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+ quark_accessible_object = g_quark_from_static_string ("gtk-accessible-object");
+
+ parent_class = g_type_class_ref (PARENT_TYPE);
+
+ object_class->dispose = et_dispose;
+}
+
+static void
+et_init (GalA11yEText *a11y)
+{
+#if 0
+ GalA11yETextPrivate *priv;
+
+ priv = GET_PRIVATE (a11y);
+#endif
+}
+
+/**
+ * gal_a11y_e_text_get_type:
+ * @void:
+ *
+ * Registers the &GalA11yEText class if necessary, and returns the type ID
+ * associated to it.
+ *
+ * Return value: The type ID of the &GalA11yEText class.
+ **/
+GType
+gal_a11y_e_text_get_type (void)
+{
+ static GType type = 0;
+
+ if (!type) {
+ AtkObjectFactory *factory;
+
+ GTypeInfo info = {
+ sizeof (GalA11yETextClass),
+ (GBaseInitFunc) NULL,
+ (GBaseFinalizeFunc) NULL,
+ (GClassInitFunc) et_class_init,
+ (GClassFinalizeFunc) NULL,
+ NULL, /* class_data */
+ sizeof (GalA11yEText),
+ 0,
+ (GInstanceInitFunc) et_init,
+ NULL /* value_text */
+ };
+
+ static const GInterfaceInfo atk_component_info = {
+ (GInterfaceInitFunc) et_atk_component_iface_init,
+ (GInterfaceFinalizeFunc) NULL,
+ NULL
+ };
+ static const GInterfaceInfo atk_text_info = {
+ (GInterfaceInitFunc) et_atk_text_iface_init,
+ (GInterfaceFinalizeFunc) NULL,
+ NULL
+ };
+ static const GInterfaceInfo atk_editable_text_info = {
+ (GInterfaceInitFunc) et_atk_editable_text_iface_init,
+ (GInterfaceFinalizeFunc) NULL,
+ NULL
+ };
+
+ factory = atk_registry_get_factory (atk_get_default_registry (), GNOME_TYPE_CANVAS_ITEM);
+ parent_type = atk_object_factory_get_accessible_type (factory);
+
+ type = gal_a11y_type_register_static_with_private (PARENT_TYPE, "GalA11yEText", &info, 0,
+ sizeof (GalA11yETextPrivate), &priv_offset);
+
+ g_type_add_interface_static (type, ATK_TYPE_COMPONENT, &atk_component_info);
+ g_type_add_interface_static (type, ATK_TYPE_TEXT, &atk_text_info);
+ g_type_add_interface_static (type, ATK_TYPE_EDITABLE_TEXT, &atk_editable_text_info);
+ }
+
+ return type;
+}
diff --git a/a11y/e-text/gal-a11y-e-text.h b/a11y/e-text/gal-a11y-e-text.h
new file mode 100644
index 0000000000..66d2d6283b
--- /dev/null
+++ b/a11y/e-text/gal-a11y-e-text.h
@@ -0,0 +1,40 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * Authors:
+ * Christopher James Lahey <clahey@ximian.com>
+ *
+ * Copyright (C) 2001 Chris Lahey
+ */
+
+#ifndef __GAL_A11Y_E_TEXT_H__
+#define __GAL_A11Y_E_TEXT_H__
+
+#include <glib-object.h>
+#include <gal/e-table/e-table-item.h>
+
+#define GAL_A11Y_TYPE_E_TEXT (gal_a11y_e_text_get_type ())
+#define GAL_A11Y_E_TEXT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GAL_A11Y_TYPE_E_TEXT, GalA11yEText))
+#define GAL_A11Y_E_TEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GAL_A11Y_TYPE_E_TEXT, GalA11yETextClass))
+#define GAL_A11Y_IS_E_TEXT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GAL_A11Y_TYPE_E_TEXT))
+#define GAL_A11Y_IS_E_TEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GAL_A11Y_TYPE_E_TEXT))
+
+typedef struct _GalA11yEText GalA11yEText;
+typedef struct _GalA11yETextClass GalA11yETextClass;
+typedef struct _GalA11yETextPrivate GalA11yETextPrivate;
+
+/* This struct should actually be larger as this isn't what we derive from.
+ * The GalA11yETextPrivate comes right after the parent class structure.
+ **/
+struct _GalA11yEText {
+ AtkObject object;
+};
+
+struct _GalA11yETextClass {
+ AtkObject parent_class;
+};
+
+
+/* Standard Glib function */
+GType gal_a11y_e_text_get_type (void);
+
+#endif /* ! __GAL_A11Y_E_TEXT_H__ */
diff --git a/a11y/gal-a11y-util.c b/a11y/gal-a11y-util.c
new file mode 100644
index 0000000000..0cf7c69dbb
--- /dev/null
+++ b/a11y/gal-a11y-util.c
@@ -0,0 +1,31 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * Authors:
+ * Christopher James Lahey <clahey@ximian.com>
+ *
+ * Copyright (C) 2002 Ximian, Inc.
+ */
+
+#include <config.h>
+#include "gal-a11y-util.h"
+
+GType
+gal_a11y_type_register_static_with_private (GType parent_type,
+ const gchar *type_name,
+ GTypeInfo *info,
+ GTypeFlags flags,
+ gint priv_size,
+ gint *priv_offset)
+{
+ GTypeQuery query;
+
+ g_type_query (parent_type, &query);
+
+ info->class_size = query.class_size;
+ info->instance_size = query.instance_size + priv_size;
+
+ if (priv_offset)
+ *priv_offset = query.instance_size;
+
+ return g_type_register_static (parent_type, type_name, info, flags);
+}
diff --git a/a11y/gal-a11y-util.h b/a11y/gal-a11y-util.h
new file mode 100644
index 0000000000..b7f742b122
--- /dev/null
+++ b/a11y/gal-a11y-util.h
@@ -0,0 +1,21 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * Authors:
+ * Christopher James Lahey <clahey@ximian.com>
+ *
+ * Copyright (C) 2001 Chris Lahey
+ */
+
+#ifndef __GAL_A11Y_UTIL_H__
+#define __GAL_A11Y_UTIL_H__
+
+#include <glib-object.h>
+
+GType gal_a11y_type_register_static_with_private (GType parent_type,
+ const gchar *type_name,
+ GTypeInfo *info,
+ GTypeFlags flags,
+ int priv_size,
+ gint *priv_offset);
+
+#endif /* ! __GAL_A11Y_UTIL_H__ */