diff options
Diffstat (limited to 'a11y')
37 files changed, 0 insertions, 6114 deletions
diff --git a/a11y/e-table/.cvsignore b/a11y/e-table/.cvsignore deleted file mode 100644 index 5b48d3f593..0000000000 --- a/a11y/e-table/.cvsignore +++ /dev/null @@ -1,4 +0,0 @@ -.libs -Makefile.in -Makefile -*.la diff --git a/a11y/e-table/gal-a11y-e-cell-popup.c b/a11y/e-table/gal-a11y-e-cell-popup.c deleted file mode 100644 index 88325e726e..0000000000 --- a/a11y/e-table/gal-a11y-e-cell-popup.c +++ /dev/null @@ -1,146 +0,0 @@ -/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* vim:expandtab:shiftwidth=8:tabstop=8: - */ -/* Evolution Accessibility: gal-a11y-e-cell-popup.h - * - * Copyright (C) 2003 Ximian, Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. - * - * This program 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 - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * - * Author: Yang Wu <yang.wu@sun.com> Sun Microsystem Inc., 2003 - * - */ - -#include <config.h> -#include <gal/e-table/e-cell-popup.h> -#include "gal-a11y-e-cell-popup.h" -#include "gal-a11y-util.h" -#include <atk/atkobject.h> -#include <gdk/gdkkeysyms.h> -#include <gtk/gtkwidget.h> - -static AtkObjectClass *parent_class = NULL; -#define PARENT_TYPE (gal_a11y_e_cell_get_type ()) - -static void gal_a11y_e_cell_popup_class_init (GalA11yECellPopupClass *klass); -static void popup_cell_action (GalA11yECell *cell); - -/** - * gal_a11y_e_cell_popup_get_type: - * @void: - * - * Registers the &GalA11yECellPopup class if necessary, and returns the type ID - * associated to it. - * - * Return value: The type ID of the &GalA11yECellPopup class. - **/ -GType -gal_a11y_e_cell_popup_get_type (void) -{ - static GType type = 0; - - if (!type) { - GTypeInfo info = { - sizeof (GalA11yECellPopupClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) gal_a11y_e_cell_popup_class_init, - (GClassFinalizeFunc) NULL, - NULL, /* class_data */ - sizeof (GalA11yECellPopup), - 0, - (GInstanceInitFunc) NULL, - NULL /* value_cell_popup */ - }; - - type = g_type_register_static (PARENT_TYPE, "GalA11yECellPopup", &info, 0); - gal_a11y_e_cell_type_add_action_interface (type); - } - - return type; -} - -static void -gal_a11y_e_cell_popup_class_init (GalA11yECellPopupClass *klass) -{ - AtkObjectClass *class = ATK_OBJECT_CLASS (klass); - - parent_class = g_type_class_ref (PARENT_TYPE); -} - -AtkObject * -gal_a11y_e_cell_popup_new (ETableItem *item, - ECellView *cell_view, - AtkObject *parent, - int model_col, - int view_col, - int row) -{ - AtkObject *a11y; - GalA11yECell *cell; - ECellPopup *popupcell; - ECellView* child_view = NULL; - - popupcell= E_CELL_POPUP(cell_view->ecell); - - if (popupcell && popupcell->popup_cell_view) - child_view = popupcell->popup_cell_view->child_view; - - if (child_view && child_view->ecell) { - a11y = gal_a11y_e_cell_registry_get_object (NULL, - item, - child_view, - parent, - model_col, - view_col, - row); - } else { - a11y = g_object_new (GAL_A11Y_TYPE_E_CELL_POPUP, NULL); - gal_a11y_e_cell_construct (a11y, - item, - cell_view, - parent, - model_col, - view_col, - row); - } - g_return_val_if_fail (a11y != NULL, NULL); - cell = GAL_A11Y_E_CELL(a11y); - gal_a11y_e_cell_add_action (cell, - "popup", /* action name*/ - "popup a child", /* action description */ - "<Alt>Down", /* action keybinding */ - popup_cell_action); - - a11y->role = ATK_ROLE_TABLE_CELL; - return a11y; -} - -static void -popup_cell_action (GalA11yECell *cell) -{ - ECellPopup *ecp; - gint finished; - GdkEvent event; - - event.key.type = GDK_KEY_PRESS; - event.key.window = GTK_LAYOUT(GNOME_CANVAS_ITEM(cell->item)->canvas)->bin_window;; - event.key.send_event = TRUE; - event.key.time = GDK_CURRENT_TIME; - event.key.state = GDK_MOD1_MASK; - event.key.keyval = GDK_Down; - - g_signal_emit_by_name (cell->item, "event", &event, &finished); -} diff --git a/a11y/e-table/gal-a11y-e-cell-popup.h b/a11y/e-table/gal-a11y-e-cell-popup.h deleted file mode 100644 index 5809f9b4f4..0000000000 --- a/a11y/e-table/gal-a11y-e-cell-popup.h +++ /dev/null @@ -1,64 +0,0 @@ -/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* vim:expandtab:shiftwidth=8:tabstop=8: - */ -/* Evolution Accessibility: gal-a11y-e-cell-popup.h - * - * Copyright (C) 2003 Ximian, Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. - * - * This program 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 - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * - * Author: Yang Wu <yang.wu@sun.com> Sun Microsystem Inc., 2003 - * - */ - -#ifndef __GAL_A11Y_E_CELL_POPUP_H__ -#define __GAL_A11Y_E_CELL_POPUP_H__ - -#include <glib-object.h> -#include <gal/e-table/e-table-item.h> -#include <a11y/e-table/gal-a11y-e-cell.h> -#include <atk/atkgobjectaccessible.h> - -#define GAL_A11Y_TYPE_E_CELL_POPUP (gal_a11y_e_cell_popup_get_type ()) -#define GAL_A11Y_E_CELL_POPUP(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GAL_A11Y_TYPE_E_CELL_POPUP, GalA11yECellPopup)) -#define GAL_A11Y_E_CELL_POPUP_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GAL_A11Y_TYPE_E_CELL_POPUP, GalA11yECellPopupClass)) -#define GAL_A11Y_IS_E_CELL_POPUP(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GAL_A11Y_TYPE_E_CELL_POPUP)) -#define GAL_A11Y_IS_E_CELL_POPUP_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GAL_A11Y_TYPE_E_CELL_POPUP)) - -typedef struct _GalA11yECellPopup GalA11yECellPopup; -typedef struct _GalA11yECellPopupClass GalA11yECellPopupClass; - -/* This struct should actually be larger as this isn't what we derive from. - * The GalA11yECellPopupPrivate comes right after the parent class structure. - **/ -struct _GalA11yECellPopup { - GalA11yECell object; -}; - -struct _GalA11yECellPopupClass { - GalA11yECellClass parent_class; -}; - - -/* Standard Glib function */ -GType gal_a11y_e_cell_popup_get_type (void); -AtkObject *gal_a11y_e_cell_popup_new (ETableItem *item, - ECellView *cell_view, - AtkObject *parent, - int model_col, - int view_col, - int row); - -#endif /* ! __GAL_A11Y_E_CELL_POPUP_H__ */ diff --git a/a11y/e-table/gal-a11y-e-cell-registry.c b/a11y/e-table/gal-a11y-e-cell-registry.c deleted file mode 100644 index 7110179554..0000000000 --- a/a11y/e-table/gal-a11y-e-cell-registry.c +++ /dev/null @@ -1,132 +0,0 @@ -/* -*- 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 deleted file mode 100644 index eecd41139c..0000000000 --- a/a11y/e-table/gal-a11y-e-cell-registry.h +++ /dev/null @@ -1,58 +0,0 @@ -/* -*- 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 deleted file mode 100644 index e23d1f2feb..0000000000 --- a/a11y/e-table/gal-a11y-e-cell-text.c +++ /dev/null @@ -1,567 +0,0 @@ -/* -*- 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> -#include <atk/atkaction.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 G_CONST_RETURN gchar* -ect_get_name (AtkObject * a11y) -{ - GalA11yECell *gaec = GAL_A11Y_E_CELL (a11y); - ECellText *ect = E_CELL_TEXT (gaec->cell_view->ecell); - return e_cell_text_get_text (ect, gaec->item->table_model, gaec->model_col, gaec->row); -} - -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); - gchar *ret_val; - gchar *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; - gchar *at_offset; - gchar *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); - ECellText *ect = E_CELL_TEXT (gaec->cell_view->ecell); - gint start, end; - - if (e_cell_text_get_selection (gaec->cell_view, - gaec->view_col, gaec->row, - &start, &end)) { - gchar *full_text = e_cell_text_get_text (ect, gaec->item->table_model, gaec->model_col, gaec->row); - end = g_utf8_pointer_to_offset (full_text, full_text + end); - e_cell_text_free_text (ect, full_text); - - return end; - } - 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); - gint ret_val; - - gchar *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); - gint 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); - gchar *ret_val; - gint 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) { - gint real_start, real_end, len; - gchar *full_text = e_cell_text_get_text (ect, gaec->item->table_model, gaec->model_col, gaec->row); - len = strlen (full_text); - real_start = MIN (selection_start, selection_end); - real_end = MAX (selection_start, selection_end); - real_start = MIN (MAX (0, real_start), len); - real_end = MIN (MAX (0, real_end), len); - - ret_val = g_strndup (full_text + real_start, real_end - real_start); - - real_start = g_utf8_pointer_to_offset (full_text, full_text + real_start); - real_end = g_utf8_pointer_to_offset (full_text, full_text + real_end); - - if (start_offset) - *start_offset = real_start; - if (end_offset) - *end_offset = real_end; - e_cell_text_free_text (ect, full_text); - } else { - if (start_offset) - *start_offset = 0; - if (end_offset) - *end_offset = 0; - ret_val = NULL; - } - - return ret_val; -} - - -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); - - if (start_offset != end_offset) { - gint real_start, real_end, len; - gchar *full_text = - e_cell_text_get_text (ect, gaec->item->table_model, gaec->model_col, gaec->row); - - len = g_utf8_strlen (full_text, -1); - if (end_offset == -1) - end_offset = len; - - real_start = MIN (start_offset, end_offset); - real_end = MAX (start_offset, end_offset); - - real_start = MIN (MAX (0, real_start), len); - real_end = MIN (MAX (0, real_end), len); - - real_start = g_utf8_offset_to_pointer (full_text, real_start) - full_text; - real_end = g_utf8_offset_to_pointer (full_text, real_end) - full_text; - e_cell_text_free_text (ect, full_text); - - if (e_cell_text_set_selection (gaec->cell_view, - gaec->view_col, gaec->row, - real_start, real_end)) { - g_signal_emit_by_name (ATK_OBJECT(text), "text_selection_changed"); - return TRUE; - } - } - - return FALSE; -} - - -static gboolean -ect_remove_selection (AtkText *text, - gint selection_num) -{ - GalA11yECell *gaec = GAL_A11Y_E_CELL (text); - ECellText *ect = E_CELL_TEXT (gaec->cell_view->ecell); - gint 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 - && e_cell_text_set_selection (gaec->cell_view, - gaec->view_col, gaec->row, - selection_end, selection_end)) { - g_signal_emit_by_name (ATK_OBJECT(text), "text_selection_changed"); - return TRUE; - } - else - return FALSE; -} - - -static gboolean -ect_set_selection (AtkText *text, - gint selection_num, - gint start_offset, - gint end_offset) -{ - if (selection_num == 0) { - atk_text_add_selection (text, start_offset, end_offset); - return TRUE; - } - else - 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); - gchar *full_text; - gint len; - - full_text = e_cell_text_get_text (ect, gaec->item->table_model, gaec->model_col, gaec->row); - - len = g_utf8_strlen (full_text, -1); - if (offset == -1) - offset = len; - else - offset = MIN (MAX (0, offset), len); - - 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); - e_table_item_enter_edit (gaec->item, gaec->view_col, gaec->row); -} - -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); - - gchar *full_text = e_cell_text_get_text (ect, gaec->item->table_model, gaec->model_col, gaec->row); - gchar *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) -{ - GalA11yECell *gaec = GAL_A11Y_E_CELL (text); - if (start_pos != end_pos - && atk_text_set_selection (text, 0, start_pos, end_pos)) - e_cell_text_copy_clipboard (gaec->cell_view, - gaec->view_col, gaec->row); -} - -static void -ect_delete_text (AtkEditableText *text, - gint start_pos, - gint end_pos) -{ - GalA11yECell *gaec = GAL_A11Y_E_CELL (text); - if (start_pos != end_pos - && atk_text_set_selection (text, 0, start_pos, end_pos)) - e_cell_text_delete_selection (gaec->cell_view, - gaec->view_col, gaec->row); -} - -static void -ect_cut_text (AtkEditableText *text, - gint start_pos, - gint end_pos) -{ - ect_copy_text (text, start_pos, end_pos); - ect_delete_text (text, start_pos, end_pos); -} - -static void -ect_paste_text (AtkEditableText *text, - gint position) -{ - GalA11yECell *gaec = GAL_A11Y_E_CELL (text); - - e_table_item_enter_edit (gaec->item, gaec->view_col, gaec->row); - - if (atk_text_set_caret_offset (text, position)) - e_cell_text_paste_clipboard (gaec->cell_view, - gaec->view_col, gaec->row); -} - -static void -ect_do_action_edit (AtkAction *action) -{ - GalA11yECell *a11y = GAL_A11Y_E_CELL (action); - e_table_item_enter_edit (a11y->item, a11y->view_col, a11y->row); -} - -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) -{ - AtkObjectClass *a11y = ATK_OBJECT_CLASS (klass); - parent_class = g_type_class_ref (PARENT_TYPE); - a11y->get_name = ect_get_name; -} - -static void -ect_init (GalA11yECellText *a11y) -{ - gal_a11y_e_cell_add_action (a11y, - "edit", - "begin editing this cell", - NULL, - (ACTION_FUNC)ect_do_action_edit); -} - -/** - * 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); - gal_a11y_e_cell_type_add_action_interface (type); - } - - 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 deleted file mode 100644 index 3d9a4447be..0000000000 --- a/a11y/e-table/gal-a11y-e-cell-text.h +++ /dev/null @@ -1,48 +0,0 @@ -/* -*- 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-toggle.c b/a11y/e-table/gal-a11y-e-cell-toggle.c deleted file mode 100644 index f3b5bf2879..0000000000 --- a/a11y/e-table/gal-a11y-e-cell-toggle.c +++ /dev/null @@ -1,163 +0,0 @@ -#include <gtk/gtk.h> -#include "gal-a11y-e-cell-toggle.h" -#include <gal/e-table/e-cell-toggle.h> -#include <gal/e-table/e-table-model.h> - -#define PARENT_TYPE (gal_a11y_e_cell_get_type ()) -static GObjectClass *parent_class; - -static void gal_a11y_e_cell_toggle_class_init (GalA11yECellToggleClass *klass); - -static void -gal_a11y_e_cell_toggle_dispose (GObject *object) -{ - GalA11yECellToggle *a11y = GAL_A11Y_E_CELL_TOGGLE (object); - - ETableModel *e_table_model = GAL_A11Y_E_CELL (a11y)->item->table_model; - - if (e_table_model) - g_signal_handler_disconnect (e_table_model, a11y->model_id); - - if (parent_class->dispose) - parent_class->dispose (object); -} - -GType -gal_a11y_e_cell_toggle_get_type (void) -{ - static GType type = 0; - - if (!type) - { - static const GTypeInfo tinfo = - { - sizeof (GalA11yECellToggleClass), - (GBaseInitFunc) NULL, /* base init */ - (GBaseFinalizeFunc) NULL, /* base finalize */ - (GClassInitFunc) gal_a11y_e_cell_toggle_class_init, /* class init */ - (GClassFinalizeFunc) NULL, /* class finalize */ - NULL, /* class data */ - sizeof (GalA11yECellToggle), /* instance size */ - 0, /* nb preallocs */ - NULL, /* instance init */ - NULL /* value table */ - }; - - - type = g_type_register_static (GAL_A11Y_TYPE_E_CELL, - "GalA11yECellToggle", &tinfo, 0); - gal_a11y_e_cell_type_add_action_interface (type); - - } - return type; -} - - -static void -gal_a11y_e_cell_toggle_class_init (GalA11yECellToggleClass *klass) -{ - GObjectClass *object_class = G_OBJECT_CLASS (klass); - - object_class->dispose = gal_a11y_e_cell_toggle_dispose; - parent_class = g_type_class_ref (PARENT_TYPE); -} - -static void -toggle_cell_action (GalA11yECell *cell) -{ - ECellToggle * ect; - gint finished; - GdkEventButton event; - gint x, y, width, height; - gint row, col; - - row = cell->row; - col = cell->view_col; - - e_table_item_get_cell_geometry (cell->item, &row, &col, - &x, &y, &width, &height); - - event.x = x + width / 2 + (int)(GNOME_CANVAS_ITEM (cell->item)->x1); - event.y = y + height / 2 + (int)(GNOME_CANVAS_ITEM (cell->item)->y1); - - event.type = GDK_BUTTON_PRESS; - event.window = GTK_LAYOUT(GNOME_CANVAS_ITEM(cell->item)->canvas)->bin_window; - event.button = 1; - event.send_event = TRUE; - event.time = GDK_CURRENT_TIME; - event.axes = NULL; - - g_signal_emit_by_name (cell->item, "event", &event, &finished); -} - -static void -model_change_cb (ETableModel *etm, - gint row, - gint col, - GalA11yECell *cell) -{ - gint value; - - if (col == cell->model_col && row == cell->row) { - - value = GPOINTER_TO_INT ( - e_table_model_value_at (cell->cell_view->e_table_model, - cell->model_col, cell->row)); - if (value) - gal_a11y_e_cell_add_state (cell, ATK_STATE_CHECKED, TRUE); - else - gal_a11y_e_cell_remove_state (cell, ATK_STATE_CHECKED, TRUE); - } -} - - -AtkObject* -gal_a11y_e_cell_toggle_new (ETableItem *item, - ECellView *cell_view, - AtkObject *parent, - int model_col, - int view_col, - int row) -{ - AtkObject *a11y; - GalA11yECell *cell; - GalA11yECellToggle *toggle_cell; - gint value; - - a11y = ATK_OBJECT(g_object_new (GAL_A11Y_TYPE_E_CELL_TOGGLE, NULL)); - - g_return_val_if_fail (a11y != NULL, NULL); - - cell = GAL_A11Y_E_CELL(a11y); - toggle_cell = GAL_A11Y_E_CELL_TOGGLE(a11y); - a11y->role = ATK_ROLE_TABLE_CELL; - - gal_a11y_e_cell_construct (a11y, - item, - cell_view, - parent, - model_col, - view_col, - row); - - gal_a11y_e_cell_add_action (cell, - "toggle", /* action name*/ - "toggle the cell", /* action description */ - NULL, /* action keybinding */ - toggle_cell_action); - - toggle_cell->model_id = g_signal_connect (item->table_model, - "model_cell_changed", - (GCallback) model_change_cb, - a11y); - - value = GPOINTER_TO_INT ( - e_table_model_value_at (cell->cell_view->e_table_model, - cell->model_col, cell->row)); - if (value) - gal_a11y_e_cell_add_state (cell, ATK_STATE_CHECKED, FALSE); - else - gal_a11y_e_cell_remove_state (cell, ATK_STATE_CHECKED, FALSE); - - return a11y; -} diff --git a/a11y/e-table/gal-a11y-e-cell-toggle.h b/a11y/e-table/gal-a11y-e-cell-toggle.h deleted file mode 100644 index 06f9448e02..0000000000 --- a/a11y/e-table/gal-a11y-e-cell-toggle.h +++ /dev/null @@ -1,47 +0,0 @@ -#ifndef __GAL_A11Y_E_CELL_TOGGLE_H__ -#define __GAL_A11Y_E_CELL_TOGGLE_H__ - -#include <atk/atk.h> -#include "gal-a11y-e-cell.h" -#include "gal-a11y-e-cell-toggle.h" - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -#define GAL_A11Y_TYPE_E_CELL_TOGGLE (gal_a11y_e_cell_toggle_get_type ()) -#define GAL_A11Y_E_CELL_TOGGLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GAL_A11Y_TYPE_E_CELL_TOGGLE, GalA11yECellToggle)) -#define GAL_A11Y_E_CELL_TOGGLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GAL_A11Y_E_CELL_TOGGLE, GalA11yECellToggleClass)) -#define GAL_A11Y_IS_E_CELL_TOGGLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GAL_A11Y_TYPE_E_CELL_TOGGLE)) -#define GAL_A11Y_IS_E_CELL_TOGGLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GAL_A11Y_TYPE_E_CELL_TOGGLE)) -#define GAL_A11Y_E_CELL_TOGGLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GAL_A11Y_TYPE_E_CELL_TOGGLE, GalA11yECellToggleClass)) - -typedef struct _GalA11yECellToggle GalA11yECellToggle; -typedef struct _GalA11yECellToggleClass GalA11yECellToggleClass; - -struct _GalA11yECellToggle -{ - GalA11yECell parent; - gint model_id; -}; - -GType gal_a11y_e_cell_toggle_get_type (void); - -struct _GalA11yECellToggleClass -{ - GalA11yECellClass parent_class; -}; - -AtkObject *gal_a11y_e_cell_toggle_new (ETableItem *item, - ECellView *cell_view, - AtkObject *parent, - int model_col, - int view_col, - int row); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - - -#endif /* __GAL_A11Y_E_CELL_TOGGLE_H__ */ diff --git a/a11y/e-table/gal-a11y-e-cell-tree.c b/a11y/e-table/gal-a11y-e-cell-tree.c deleted file mode 100644 index e6ff75667b..0000000000 --- a/a11y/e-table/gal-a11y-e-cell-tree.c +++ /dev/null @@ -1,209 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * Authors: - * Tim Wo <tim.wo@sun.com>, Sun Microsystem Inc. 2003. - * - * Copyright (C) 2002 Ximian, Inc. - */ - -#include <config.h> -#include <atk/atk.h> -#include "gal-a11y-e-cell-tree.h" -#include "gal-a11y-util.h" -#include "gal/e-table/e-cell-tree.h" -#include "gal/e-table/e-table.h" -#include "gal/e-table/e-tree-table-adapter.h" - -#define CS_CLASS(a11y) (G_TYPE_INSTANCE_GET_CLASS ((a11y), C_TYPE_STREAM, GalA11yECellTreeClass)) -static AtkObjectClass *a11y_parent_class; -#define A11Y_PARENT_TYPE (gal_a11y_e_cell_get_type ()) - -static void -ectr_model_row_changed_cb (ETableModel *etm, - gint row, - GalA11yECell *a11y) -{ - ETreePath node; - ETreeModel *tree_model; - ETreeTableAdapter *tree_table_adapter; - - g_return_if_fail (a11y); - if (a11y->row != row) - return; - - node = e_table_model_value_at (etm, -1, a11y->row); - tree_model = e_table_model_value_at (etm, -2, a11y->row); - tree_table_adapter = e_table_model_value_at (etm, -3, a11y->row); - - if (e_tree_model_node_is_expandable (tree_model, node)) { - gboolean is_exp = e_tree_table_adapter_node_is_expanded (tree_table_adapter, node); - if (is_exp) - gal_a11y_e_cell_add_state (a11y, ATK_STATE_EXPANDED, TRUE); - else - gal_a11y_e_cell_remove_state (a11y, ATK_STATE_EXPANDED, TRUE); - } -} - -static void -ectr_subcell_weak_ref (GalA11yECellTree *a11y, - GalA11yECell *subcell_a11y) -{ - g_signal_handler_disconnect (GAL_A11Y_E_CELL (a11y)->item->table_model, - a11y->model_row_changed_id); - g_object_unref (a11y); -} - -static void -ectr_do_action_expand (AtkAction *action) -{ - GalA11yECell *a11y; - ETableModel *table_model; - ETreePath node; - ETreeModel *tree_model; - ETreeTableAdapter *tree_table_adapter; - - a11y = GAL_A11Y_E_CELL (action); - table_model = a11y->item->table_model; - node = e_table_model_value_at (table_model, -1, a11y->row); - tree_model = e_table_model_value_at (table_model, -2, a11y->row); - tree_table_adapter = e_table_model_value_at (table_model, -3, a11y->row); - - if (e_tree_model_node_is_expandable (tree_model, node)) { - e_tree_table_adapter_node_set_expanded (tree_table_adapter, - node, - TRUE); - gal_a11y_e_cell_add_state (a11y, ATK_STATE_EXPANDED, TRUE); - } -} - -static void -ectr_do_action_collapse (AtkAction *action) -{ - GalA11yECell *a11y; - ETableModel *table_model; - ETreePath node; - ETreeModel *tree_model; - ETreeTableAdapter *tree_table_adapter; - - a11y = GAL_A11Y_E_CELL (action); - table_model = a11y->item->table_model; - node = e_table_model_value_at (table_model, -1, a11y->row); - tree_model = e_table_model_value_at (table_model, -2, a11y->row); - tree_table_adapter = e_table_model_value_at (table_model, -3, a11y->row); - - if (e_tree_model_node_is_expandable (tree_model, node)) { - e_tree_table_adapter_node_set_expanded (tree_table_adapter, - node, - FALSE); - gal_a11y_e_cell_remove_state (a11y, ATK_STATE_EXPANDED, TRUE); - } -} - -static void -ectr_class_init (GalA11yECellTreeClass *klass) -{ - a11y_parent_class = g_type_class_ref (A11Y_PARENT_TYPE); -} - -static void -ectr_init (GalA11yECellTree *a11y) -{ -} - -GType -gal_a11y_e_cell_tree_get_type (void) -{ - static GType type = 0; - - if (!type) { - GTypeInfo info = { - sizeof (GalA11yECellTreeClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) ectr_class_init, - (GClassFinalizeFunc) NULL, - NULL, /* class_data */ - sizeof (GalA11yECellTree), - 0, - (GInstanceInitFunc) ectr_init, - NULL /* value_cell_text */ - }; - - type = g_type_register_static (A11Y_PARENT_TYPE, "GalA11yECellTree", &info, 0); - gal_a11y_e_cell_type_add_action_interface (type); - } - - return type; -} - -AtkObject * -gal_a11y_e_cell_tree_new (ETableItem *item, - ECellView *cell_view, - AtkObject *parent, - int model_col, - int view_col, - int row) -{ - AtkObject *subcell_a11y; - GalA11yECellTree *a11y; - GtkWidget *e_table; - - ETreePath node; - ETreeModel *tree_model; - ETreeTableAdapter *tree_table_adapter; - - ECellView *subcell_view; - subcell_view = e_cell_tree_view_get_subcell_view (cell_view); - - if (subcell_view->ecell) { - subcell_a11y = gal_a11y_e_cell_registry_get_object (NULL, - item, - subcell_view, - parent, - model_col, - view_col, - row); - gal_a11y_e_cell_add_action (subcell_a11y, - "expand", - "expands the row in the ETree containing this cell", - NULL, - (ACTION_FUNC)ectr_do_action_expand); - - gal_a11y_e_cell_add_action (subcell_a11y, - "collapse", - "collapses the row in the ETree containing this cell", - NULL, - (ACTION_FUNC)ectr_do_action_collapse); - - /* init AtkStates for the cell's a11y object */ - node = e_table_model_value_at (item->table_model, -1, row); - tree_model = e_table_model_value_at (item->table_model, -2, row); - tree_table_adapter = e_table_model_value_at (item->table_model, -3, row); - if (e_tree_model_node_is_expandable (tree_model, node)) { - gal_a11y_e_cell_add_state (subcell_a11y, ATK_STATE_EXPANDABLE, FALSE); - if (e_tree_table_adapter_node_is_expanded (tree_table_adapter, node)) - gal_a11y_e_cell_add_state (subcell_a11y, ATK_STATE_EXPANDED, FALSE); - } - } - else - subcell_a11y = NULL; - - /* create a companion a11y object, this object has type GalA11yECellTree - and it connects to some signals to determine whether a tree cell is - expanded or collapsed */ - a11y = g_object_new (gal_a11y_e_cell_tree_get_type (), NULL); - gal_a11y_e_cell_construct (a11y, - item, - cell_view, - parent, - model_col, - view_col, - row); - a11y->model_row_changed_id = - g_signal_connect (item->table_model, "model_row_changed", - G_CALLBACK (ectr_model_row_changed_cb), - subcell_a11y); - g_object_weak_ref (subcell_a11y, ectr_subcell_weak_ref, a11y); - - return subcell_a11y; -} diff --git a/a11y/e-table/gal-a11y-e-cell-tree.h b/a11y/e-table/gal-a11y-e-cell-tree.h deleted file mode 100644 index 355670b5a4..0000000000 --- a/a11y/e-table/gal-a11y-e-cell-tree.h +++ /dev/null @@ -1,50 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * Authors: - * Tim Wo <tim.wo@sun.com>, Sun Microsystem Inc. 2003. - * - * Copyright (C) 2002 Ximian, Inc. - */ - -#ifndef __GAL_A11Y_E_CELL_TREE_H__ -#define __GAL_A11Y_E_CELL_TREE_H__ - -#include <glib-object.h> -#include <gal/e-table/e-table-item.h> -#include <gal/e-table/e-cell-tree.h> -#include "gal-a11y-e-cell.h" - -#define GAL_A11Y_TYPE_E_CELL_TREE (gal_a11y_e_cell_tree_get_type ()) -#define GAL_A11Y_E_CELL_TREE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GAL_A11Y_TYPE_E_CELL_TREE, GalA11yECellTree)) -#define GAL_A11Y_E_CELL_TREE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GAL_A11Y_TYPE_E_CELL_TREE, GalA11yECellTreeClass)) -#define GAL_A11Y_IS_E_CELL_TREE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GAL_A11Y_TYPE_E_CELL_TREE)) -#define GAL_A11Y_IS_E_CELL_TREE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GAL_A11Y_TYPE_E_CELL_TREE)) - -typedef struct _GalA11yECellTree GalA11yECellTree; -typedef struct _GalA11yECellTreeClass GalA11yECellTreeClass; -typedef struct _GalA11yECellTreePrivate GalA11yECellTreePrivate; - -/* This struct should actually be larger as this isn't what we derive from. - * The GalA11yECellTreePrivate comes right after the parent class structure. - **/ -struct _GalA11yECellTree { - GalA11yECell object; - - int model_row_changed_id; -}; - -struct _GalA11yECellTreeClass { - GalA11yECellClass parent_class; -}; - - -/* Standard Glib function */ -GType gal_a11y_e_cell_tree_get_type (void); -AtkObject *gal_a11y_e_cell_tree_new (ETableItem *item, - ECellView *cell_view, - AtkObject *parent, - int model_col, - int view_col, - int row); - -#endif /* ! __GAL_A11Y_E_CELL_TREE_H__ */ diff --git a/a11y/e-table/gal-a11y-e-cell.c b/a11y/e-table/gal-a11y-e-cell.c deleted file mode 100644 index 34a7429cd5..0000000000 --- a/a11y/e-table/gal-a11y-e-cell.c +++ /dev/null @@ -1,551 +0,0 @@ -/* -*- 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-table/e-table.h" -#include "gal-a11y-e-cell.h" -#include "gal-a11y-util.h" -#include <atk/atkobject.h> -#include <atk/atkcomponent.h> -#include <atk/atkaction.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 - - if (a11y->state_set) - g_object_unref (a11y->state_set); - - if (parent_class->dispose) - parent_class->dispose (object); -} - -/* Static functions */ -static AtkStateSet * -eti_ref_state_set (AtkObject *accessible) -{ - GalA11yECell *cell = GAL_A11Y_E_CELL (accessible); - g_return_val_if_fail (cell->state_set, NULL); - - g_object_ref(cell->state_set); - return cell->state_set; -} - -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; -} - -static gboolean -eti_grab_focus (AtkComponent *component) -{ - GalA11yECell *a11y; - gint view_row; - GtkWidget *e_table, *toplevel; - - a11y = GAL_A11Y_E_CELL (component); - e_table = gtk_widget_get_parent (GNOME_CANVAS_ITEM (a11y->item)->canvas); - view_row = e_table_view_to_model_row (E_TABLE (e_table), a11y->row); - - e_selection_model_select_single_row (a11y->item->selection, view_row); - e_selection_model_change_cursor (a11y->item->selection, view_row, a11y->view_col); - - gtk_widget_grab_focus (e_table); - toplevel = gtk_widget_get_toplevel (e_table); - if (GTK_WIDGET_TOPLEVEL (toplevel)) - gtk_window_present (toplevel); -} - -/* Table IFace */ - -static void -eti_atk_component_iface_init (AtkComponentIface *iface) -{ - iface->get_extents = eti_get_extents; - iface->grab_focus = eti_grab_focus; -} - -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; - atk_object_class->ref_state_set = eti_ref_state_set; -} - -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; - - a11y->state_set = atk_state_set_new (); - atk_state_set_add_state (a11y->state_set, ATK_STATE_TRANSIENT); - atk_state_set_add_state (a11y->state_set, ATK_STATE_ENABLED); -} - - -static ActionInfo * -_gal_a11y_e_cell_get_action_info (GalA11yECell *cell, - gint index) -{ - GList *list_node; - - g_return_val_if_fail (GAL_A11Y_IS_E_CELL (cell), NULL); - if (cell->action_list == NULL) - return NULL; - list_node = g_list_nth (cell->action_list, index); - if (!list_node) - return NULL; - return (ActionInfo *) (list_node->data); -} - -static void -_gal_a11y_e_cell_destroy_action_info (gpointer action_info, - gpointer user_data) -{ - ActionInfo *info = (ActionInfo *)action_info; - - g_return_if_fail (info != NULL); - g_free (info->name); - g_free (info->description); - g_free (info->keybinding); - g_free (info); -} - - -gboolean -gal_a11y_e_cell_add_action ( GalA11yECell * cell, - const gchar *action_name, - const gchar *action_description, - const gchar *action_keybinding, - ACTION_FUNC action_func) -{ - ActionInfo *info; - g_return_val_if_fail (GAL_A11Y_IS_E_CELL (cell), FALSE); - info = g_new (ActionInfo, 1); - - if (action_name != NULL) - info->name = g_strdup (action_name); - else - info->name = NULL; - - if (action_description != NULL) - info->description = g_strdup (action_description); - else - info->description = NULL; - if (action_keybinding != NULL) - info->keybinding = g_strdup (action_keybinding); - else - info->keybinding = NULL; - info->do_action_func = action_func; - - cell->action_list = g_list_append (cell->action_list, (gpointer) info); - return TRUE; -} - -gboolean -gal_a11y_e_cell_remove_action (GalA11yECell *cell, - gint action_index) -{ - GList *list_node; - - g_return_val_if_fail (GAL_A11Y_IS_E_CELL (cell), FALSE); - list_node = g_list_nth (cell->action_list, action_index); - if (!list_node) - return FALSE; - g_return_val_if_fail (list_node->data != NULL, FALSE); - _gal_a11y_e_cell_destroy_action_info (list_node->data, NULL); - cell->action_list = g_list_remove_link (cell->action_list, list_node); - - return TRUE; -} - -gboolean -gal_a11y_e_cell_remove_action_by_name (GalA11yECell *cell, - const gchar *action_name) -{ - GList *list_node; - gboolean action_found= FALSE; - - g_return_val_if_fail (GAL_A11Y_IS_E_CELL (cell), FALSE); - for (list_node = cell->action_list; list_node && !action_found; - list_node = list_node->next) { - if (!g_strcasecmp (((ActionInfo *)(list_node->data))->name, action_name)) { - action_found = TRUE; - break; - } - } - - g_return_val_if_fail (action_found, FALSE); - _gal_a11y_e_cell_destroy_action_info (list_node->data, NULL); - cell->action_list = g_list_remove_link (cell->action_list, list_node); - - return TRUE; -} - -static gint -gal_a11y_e_cell_action_get_n_actions (AtkAction *action) -{ - GalA11yECell *cell = GAL_A11Y_E_CELL(action); - if (cell->action_list != NULL) - return g_list_length (cell->action_list); - else - return 0; -} - -static G_CONST_RETURN gchar * -gal_a11y_e_cell_action_get_name (AtkAction *action, - gint index) -{ - GalA11yECell *cell = GAL_A11Y_E_CELL(action); - ActionInfo *info = _gal_a11y_e_cell_get_action_info (cell, index); - - if (info == NULL) - return NULL; - return info->name; -} - -static G_CONST_RETURN gchar * -gal_a11y_e_cell_action_get_description (AtkAction *action, - gint index) -{ - GalA11yECell *cell = GAL_A11Y_E_CELL(action); - ActionInfo *info = _gal_a11y_e_cell_get_action_info (cell, index); - - if (info == NULL) - return NULL; - return info->description; -} - -static gboolean -gal_a11y_e_cell_action_set_description (AtkAction *action, - gint index, - const gchar *desc) -{ - GalA11yECell *cell = GAL_A11Y_E_CELL(action); - ActionInfo *info = _gal_a11y_e_cell_get_action_info (cell, index); - - if (info == NULL) - return FALSE; - g_free (info->description); - info->description = g_strdup (desc); - return TRUE; -} - -static G_CONST_RETURN gchar * -gal_a11y_e_cell_action_get_keybinding (AtkAction *action, - gint index) -{ - GalA11yECell *cell = GAL_A11Y_E_CELL(action); - ActionInfo *info = _gal_a11y_e_cell_get_action_info (cell, index); - if (info == NULL) - return NULL; - - return info->keybinding; -} - -static gboolean -idle_do_action (gpointer data) -{ - GalA11yECell *cell; - - cell = GAL_A11Y_E_CELL (data); - cell->action_idle_handler = 0; - cell->action_func (cell); - - return FALSE; -} - -static gboolean -gal_a11y_e_cell_action_do_action (AtkAction *action, - gint index) -{ - GalA11yECell *cell = GAL_A11Y_E_CELL(action); - ActionInfo *info = _gal_a11y_e_cell_get_action_info (cell, index); - - if (info == NULL) - return FALSE; - g_return_val_if_fail (info->do_action_func, FALSE); - if (cell->action_idle_handler) - return FALSE; - cell->action_func = info->do_action_func; - cell->action_idle_handler = g_idle_add (idle_do_action, cell); - - return TRUE; -} - -static void -gal_a11y_e_cell_atk_action_interface_init (AtkActionIface *iface) -{ - g_return_if_fail (iface != NULL); - - iface->get_n_actions = gal_a11y_e_cell_action_get_n_actions; - iface->do_action = gal_a11y_e_cell_action_do_action; - iface->get_name = gal_a11y_e_cell_action_get_name; - iface->get_description = gal_a11y_e_cell_action_get_description; - iface->set_description = gal_a11y_e_cell_action_set_description; - iface->get_keybinding = gal_a11y_e_cell_action_get_keybinding; -} - -void -gal_a11y_e_cell_type_add_action_interface (GType type) -{ - static const GInterfaceInfo atk_action_info = - { - (GInterfaceInitFunc) gal_a11y_e_cell_atk_action_interface_init, - (GInterfaceFinalizeFunc) NULL, - NULL - }; - - g_type_add_interface_static (type, ATK_TYPE_ACTION, - &atk_action_info); -} - -gboolean -gal_a11y_e_cell_add_state (GalA11yECell *cell, - AtkStateType state_type, - gboolean emit_signal) -{ - if (!atk_state_set_contains_state (cell->state_set, state_type)) { - gboolean rc; - - rc = atk_state_set_add_state (cell->state_set, state_type); - /* - * The signal should only be generated if the value changed, - * not when the cell is set up. So states that are set - * initially should pass FALSE as the emit_signal argument. - */ - - if (emit_signal) { - atk_object_notify_state_change (ATK_OBJECT (cell), state_type, TRUE); - /* If state_type is ATK_STATE_VISIBLE, additional - notification */ - if (state_type == ATK_STATE_VISIBLE) - g_signal_emit_by_name (cell, "visible_data_changed"); - } - - return rc; - } - else - return FALSE; -} - -gboolean -gal_a11y_e_cell_remove_state (GalA11yECell *cell, - AtkStateType state_type, - gboolean emit_signal) -{ - if (atk_state_set_contains_state (cell->state_set, state_type)) { - gboolean rc; - - rc = atk_state_set_remove_state (cell->state_set, state_type); - /* - * The signal should only be generated if the value changed, - * not when the cell is set up. So states that are set - * initially should pass FALSE as the emit_signal argument. - */ - - if (emit_signal) { - atk_object_notify_state_change (ATK_OBJECT (cell), state_type, FALSE); - /* If state_type is ATK_STATE_VISIBLE, additional notification */ - if (state_type == ATK_STATE_VISIBLE) - g_signal_emit_by_name (cell, "visible_data_changed"); - } - - return rc; - } - else - return FALSE; -} - -/** - * 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; - ATK_OBJECT (a11y) ->role = ATK_ROLE_TABLE_CELL; - -#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 deleted file mode 100644 index 53a6c0089d..0000000000 --- a/a11y/e-table/gal-a11y-e-cell.h +++ /dev/null @@ -1,99 +0,0 @@ -/* -*- 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; -typedef struct _ActionInfo ActionInfo; -typedef void (*ACTION_FUNC) (GalA11yECell *cell); - - -/* 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; - AtkStateSet *state_set; - GList *action_list; - gint action_idle_handler; - ACTION_FUNC action_func; -}; - -struct _GalA11yECellClass { - AtkObjectClass parent_class; -}; - -struct _ActionInfo { - gchar *name; - gchar *description; - gchar *keybinding; - ACTION_FUNC do_action_func; -}; - - - -/* 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); - -void gal_a11y_e_cell_type_add_action_interface (GType type); - -gboolean gal_a11y_e_cell_add_action (GalA11yECell *cell, - const gchar *action_name, - const gchar *action_description, - const gchar *action_keybinding, - ACTION_FUNC action_func); - -gboolean gal_a11y_e_cell_remove_action (GalA11yECell *cell, - gint action_id); - -gboolean gal_a11y_e_cell_remove_action_by_name (GalA11yECell *cell, - const gchar *action_name); - -gboolean gal_a11y_e_cell_add_state (GalA11yECell *cell, - AtkStateType state_type, - gboolean emit_signal); - -gboolean gal_a11y_e_cell_remove_state (GalA11yECell *cell, - AtkStateType state_type, - gboolean emit_signal); - - -#endif /* ! __GAL_A11Y_E_CELL_H__ */ diff --git a/a11y/e-table/gal-a11y-e-table-click-to-add-factory.c b/a11y/e-table/gal-a11y-e-table-click-to-add-factory.c deleted file mode 100644 index 4efc179200..0000000000 --- a/a11y/e-table/gal-a11y-e-table-click-to-add-factory.c +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Authors: Yuedong Du <yuedong.du@sun.com> - * - * Copyright (C) 2003 Ximian, Inc. - */ - -#include <config.h> -#include "gal-a11y-e-table-click-to-add-factory.h" -#include "gal-a11y-e-table-click-to-add.h" -#include "gal-a11y-e-table.h" -#include <gal/e-table/e-table.h> -#include <gal/e-table/e-table-click-to-add.h> -#include <atk/atk.h> - - -#define CS_CLASS(factory) (G_TYPE_INSTANCE_GET_CLASS ((factory), C_TYPE_STREAM, GalA11yETableClickToAddFactoryClass)) -static AtkObjectFactoryClass *parent_class; -#define PARENT_TYPE (ATK_TYPE_OBJECT_FACTORY) - -/* Static functions */ - -static GType -gal_a11y_e_table_click_to_add_factory_get_accessible_type (void) -{ - return GAL_A11Y_TYPE_E_TABLE_CLICK_TO_ADD; -} - -static AtkObject* -gal_a11y_e_table_click_to_add_factory_create_accessible (GObject *obj) -{ - AtkObject * atk_object; - - g_return_if_fail (E_IS_TABLE_CLICK_TO_ADD(obj)); - - atk_object = gal_a11y_e_table_click_to_add_new (obj); - - return atk_object; -} - -static void -gal_a11y_e_table_click_to_add_factory_class_init (GalA11yETableClickToAddFactoryClass *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_click_to_add_factory_create_accessible; - factory_class->get_accessible_type = gal_a11y_e_table_click_to_add_factory_get_accessible_type; -} - -static void -gal_a11y_e_table_click_to_add_factory_init (GalA11yETableClickToAddFactory *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_click_to_add_factory_get_type (void) -{ - static GType type = 0; - - if (!type) { - GTypeInfo info = { - sizeof (GalA11yETableClickToAddFactoryClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) gal_a11y_e_table_click_to_add_factory_class_init, - (GClassFinalizeFunc) NULL, - NULL, /* class_data */ - sizeof (GalA11yETableClickToAddFactory), - 0, - (GInstanceInitFunc) gal_a11y_e_table_click_to_add_factory_init, - NULL /* value_table */ - }; - - type = g_type_register_static (PARENT_TYPE, "GalA11yETableClickToAddFactory", &info, 0); - } - - return type; -} diff --git a/a11y/e-table/gal-a11y-e-table-click-to-add-factory.h b/a11y/e-table/gal-a11y-e-table-click-to-add-factory.h deleted file mode 100644 index d75453a780..0000000000 --- a/a11y/e-table/gal-a11y-e-table-click-to-add-factory.h +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Authors: * Yuedong Du <yuedong.du@sun.com> - * - * Copyright (C) 2003 Ximian, Inc. - */ - -#ifndef __GAL_A11Y_E_TABLE_CLICK_TO_ADD_FACTORY_H__ -#define __GAL_A11Y_E_TABLE_CLICK_TO_ADD_FACTORY_H__ - -#include <glib-object.h> -#include <atk/atkobjectfactory.h> - -#define GAL_A11Y_TYPE_E_TABLE_CLICK_TO_ADD_FACTORY (gal_a11y_e_table_item_factory_get_type ()) -#define GAL_A11Y_E_TABLE_CLICK_TO_ADD_FACTORY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GAL_A11Y_TYPE_E_TABLE_CLICK_TO_ADD_FACTORY, GalA11yETableClickToAddFactory)) -#define GAL_A11Y_E_TABLE_CLICK_TO_ADD_FACTORY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GAL_A11Y_TYPE_E_TABLE_CLICK_TO_ADD_FACTORY, GalA11yETableClickToAddFactoryClass)) -#define GAL_A11Y_IS_E_TABLE_CLICK_TO_ADD_FACTORY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GAL_A11Y_TYPE_E_TABLE_CLICK_TO_ADD_FACTORY)) -#define GAL_A11Y_IS_E_TABLE_CLICK_TO_ADD_FACTORY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GAL_A11Y_TYPE_E_TABLE_CLICK_TO_ADD_FACTORY)) - -typedef struct _GalA11yETableClickToAddFactory GalA11yETableClickToAddFactory; -typedef struct _GalA11yETableClickToAddFactoryClass GalA11yETableClickToAddFactoryClass; - -struct _GalA11yETableClickToAddFactory { - AtkObject object; -}; - -struct _GalA11yETableClickToAddFactoryClass { - AtkObjectClass parent_class; -}; - - -/* Standard Glib function */ -GType gal_a11y_e_table_click_to_add_factory_get_type (void); - -#endif diff --git a/a11y/e-table/gal-a11y-e-table-click-to-add.c b/a11y/e-table/gal-a11y-e-table-click-to-add.c deleted file mode 100644 index 1b55d526df..0000000000 --- a/a11y/e-table/gal-a11y-e-table-click-to-add.c +++ /dev/null @@ -1,270 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * Yuedong Du <yuedong.du@sun.com> - * - * Copyright (C) 2002 Ximian, Inc. - */ - -#include <config.h> -#include "gal-a11y-util.h" -#include "gal-a11y-e-table-click-to-add.h" -#include <gal/e-table/e-table-group.h> -#include <gal/e-table/e-table-group-leaf.h> -#include <gal/e-table/e-table-click-to-add.h> -#include <atk/atkcomponent.h> -#include <atk/atkaction.h> - -static AtkObjectClass *parent_class; -static GType parent_type; -static gint priv_offset; -#define GET_PRIVATE(object) ((GalA11yETableClickToAddPrivate *) (((char *) object) + priv_offset)) -#define PARENT_TYPE (parent_type) - -struct _GalA11yETableClickToAddPrivate { - gpointer rect; - gpointer row; -}; - - -static gint -etcta_get_n_actions (AtkAction *action) -{ - return 1; -} - -static G_CONST_RETURN gchar* -etcta_get_description (AtkAction *action, - gint i) -{ - if (i == 0) - return "click to add"; - - return NULL; -} - -static G_CONST_RETURN gchar* -etcta_action_get_name (AtkAction *action, gint i) -{ - if (i == 0) - return "click"; - - return NULL; -} - - -static gboolean -idle_do_action (gpointer data) -{ - GdkEventButton event; - ETableClickToAdd * etcta; - gint x, y, width, height, finished; - - g_return_val_if_fail ( data!= NULL, FALSE); - - etcta = atk_gobject_accessible_get_object (ATK_OBJECT(data)); - g_return_val_if_fail (etcta, FALSE); - - event.x = 0; - event.y = 0; - - event.type = GDK_BUTTON_PRESS; - event.window = GTK_LAYOUT(GNOME_CANVAS_ITEM(etcta)->canvas)->bin_window; - event.button = 1; - event.send_event = TRUE; - event.time = GDK_CURRENT_TIME; - event.axes = NULL; - - g_signal_emit_by_name (etcta, "event", &event, &finished); - - return FALSE; -} - -static gboolean -etcta_do_action (AtkAction * action, gint i) -{ - g_return_val_if_fail (i == 0, FALSE); - - g_idle_add (idle_do_action, action); - - return TRUE; -} - -static void -atk_action_interface_init (AtkActionIface *iface) -{ - g_return_if_fail (iface != NULL); - - iface->do_action = etcta_do_action; - iface->get_n_actions = etcta_get_n_actions; - iface->get_description = etcta_get_description; - iface->get_name = etcta_action_get_name; -} - - -static G_CONST_RETURN gchar * -etcta_get_name (AtkObject *obj) -{ - g_return_val_if_fail (GAL_A11Y_IS_E_TABLE_CLICK_TO_ADD (obj), NULL); - - return "click to add"; -} - -static gint -etcta_get_n_children (AtkObject *accessible) -{ - return 1; -} - -static AtkObject* -etcta_ref_child (AtkObject *accessible, - gint i) -{ - AtkObject * atk_obj = NULL; - ETableClickToAdd * etcta; - - if ( i != 0 ) - return NULL; - - etcta = E_TABLE_CLICK_TO_ADD(atk_gobject_accessible_get_object (ATK_GOBJECT_ACCESSIBLE (accessible))); - - g_return_if_fail (etcta); - - if (etcta->rect) { - atk_obj = atk_gobject_accessible_for_object (G_OBJECT(etcta->rect)); - } else if (etcta->row) { - atk_obj = atk_gobject_accessible_for_object (G_OBJECT(etcta->row)); - } - - g_object_ref (atk_obj); - - return atk_obj; -} - -static void -etcta_class_init (GalA11yETableClickToAddClass *klass) -{ - AtkObjectClass *atk_object_class = ATK_OBJECT_CLASS (klass); - - parent_class = g_type_class_ref (PARENT_TYPE); - - atk_object_class->get_name = etcta_get_name; - atk_object_class->get_n_children = etcta_get_n_children; - atk_object_class->ref_child = etcta_ref_child; -} - -static void -etcta_init (GalA11yETableClickToAdd *a11y) -{ -} - -/** - * gal_a11y_e_table_click_to_add_get_type: - * @void: - * - * Registers the &GalA11yETableClickToAdd class if necessary, and returns the type ID - * associated to it. - * - * Return value: The type ID of the &GalA11yETableClickToAdd class. - **/ -GType -gal_a11y_e_table_click_to_add_get_type (void) -{ - static GType type = 0; - - if (!type) { - AtkObjectFactory *factory; - - GTypeInfo info = { - sizeof (GalA11yETableClickToAddClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) etcta_class_init, - (GClassFinalizeFunc) NULL, - NULL, /* class_data */ - sizeof (GalA11yETableClickToAdd), - 0, - (GInstanceInitFunc) etcta_init, - NULL /* value_table */ - }; - - static const GInterfaceInfo atk_action_info = { - (GInterfaceInitFunc) atk_action_interface_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, - "GalA11yETableClickToAdd", &info, 0, - sizeof(GalA11yETableClickToAddPrivate), &priv_offset); - - g_type_add_interface_static (type, ATK_TYPE_ACTION, &atk_action_info); - - } - - return type; -} - -static gboolean -etcta_event (GnomeCanvasItem *item, GdkEvent *e, gpointer data) -{ - ETableClickToAdd *etcta = E_TABLE_CLICK_TO_ADD (item); - GalA11yETableClickToAdd *a11y; - GalA11yETableClickToAddPrivate *priv; - - g_return_val_if_fail (item, TRUE); - - g_return_val_if_fail (GAL_A11Y_IS_E_TABLE_CLICK_TO_ADD(data), FALSE); - a11y = GAL_A11Y_E_TABLE_CLICK_TO_ADD (data); - - priv = GET_PRIVATE (a11y); - - /* rect replaced by row. */ - if (etcta->rect == NULL && priv->rect != NULL) { - g_signal_emit_by_name (a11y, "children_changed::remove", 0, NULL, NULL); - - } - /* row inserted, and/or replaced by a new row. */ - if (etcta->row != NULL && priv->row == NULL) { - g_signal_emit_by_name (a11y, "children_changed::add", 0, NULL, NULL); - } else if (etcta->row != NULL && priv->row != NULL && etcta->row != priv->row) { - g_signal_emit_by_name (a11y, "children_changed::remove", 0, NULL, NULL); - g_signal_emit_by_name (a11y, "children_changed::add", 0, NULL, NULL); - } - - - priv->rect = etcta->rect; - priv->row = etcta->row; - - return TRUE; -} - -AtkObject * -gal_a11y_e_table_click_to_add_new (GObject *widget) -{ - GalA11yETableClickToAdd *a11y; - ETableClickToAdd * etcta; - GalA11yETableClickToAddPrivate *priv; - gint id; - - g_return_if_fail (widget != NULL); - - a11y = g_object_new (gal_a11y_e_table_click_to_add_get_type (), NULL); - priv = GET_PRIVATE (a11y); - - etcta = E_TABLE_CLICK_TO_ADD(widget); - - - atk_object_initialize (ATK_OBJECT (a11y), etcta); - - priv->rect = etcta->rect; - priv->row = etcta->row; - - - g_signal_connect_after (G_OBJECT(widget), "event", - G_CALLBACK (etcta_event), a11y); - - return ATK_OBJECT (a11y); -} diff --git a/a11y/e-table/gal-a11y-e-table-click-to-add.h b/a11y/e-table/gal-a11y-e-table-click-to-add.h deleted file mode 100644 index 98e3aa9b80..0000000000 --- a/a11y/e-table/gal-a11y-e-table-click-to-add.h +++ /dev/null @@ -1,35 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ - -#ifndef __GAL_A11Y_E_TABLE_CLICK_TO_ADD_H__ -#define __GAL_A11Y_E_TABLE_CLICK_TO_ADD_H__ - -#include <glib-object.h> -#include <gal/e-table/e-table-item.h> -#include <atk/atkgobjectaccessible.h> - -#define GAL_A11Y_TYPE_E_TABLE_CLICK_TO_ADD (gal_a11y_e_table_click_to_add_get_type ()) -#define GAL_A11Y_E_TABLE_CLICK_TO_ADD(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GAL_A11Y_TYPE_E_TABLE_CLICK_TO_ADD, GalA11yETableClickToAdd)) -#define GAL_A11Y_E_TABLE_CLICK_TO_ADD_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GAL_A11Y_TYPE_E_TABLE_CLICK_TO_ADD, GalA11yETableClickToAddClass)) -#define GAL_A11Y_IS_E_TABLE_CLICK_TO_ADD(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GAL_A11Y_TYPE_E_TABLE_CLICK_TO_ADD)) -#define GAL_A11Y_IS_E_TABLE_CLICK_TO_ADD_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GAL_A11Y_TYPE_E_TABLE_CLICK_TO_ADD)) - -typedef struct _GalA11yETableClickToAdd GalA11yETableClickToAdd; -typedef struct _GalA11yETableClickToAddClass GalA11yETableClickToAddClass; -typedef struct _GalA11yETableClickToAddPrivate GalA11yETableClickToAddPrivate; - -/* This struct should actually be larger as this isn't what we derive from. - * The GalA11yETableClickToAddPrivate comes right after the parent class structure. - **/ -struct _GalA11yETableClickToAdd { - AtkGObjectAccessible parent; -}; - -struct _GalA11yETableClickToAddClass { - AtkGObjectAccessibleClass parent_class; -}; - -/* Standard Glib function */ -GType gal_a11y_e_table_click_to_add_get_type (void); -AtkObject *gal_a11y_e_table_click_to_add_new (GObject *widget); - -#endif /* ! __GAL_A11Y_E_TABLE_CLICK_TO_ADD_H__ */ diff --git a/a11y/e-table/gal-a11y-e-table-factory.c b/a11y/e-table/gal-a11y-e-table-factory.c deleted file mode 100644 index 14eaca3d19..0000000000 --- a/a11y/e-table/gal-a11y-e-table-factory.c +++ /dev/null @@ -1,83 +0,0 @@ -/* -*- 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 deleted file mode 100644 index eb8eb55414..0000000000 --- a/a11y/e-table/gal-a11y-e-table-factory.h +++ /dev/null @@ -1,36 +0,0 @@ -/* -*- 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-factory.c b/a11y/e-table/gal-a11y-e-table-item-factory.c deleted file mode 100644 index 320af6d9a0..0000000000 --- a/a11y/e-table/gal-a11y-e-table-item-factory.c +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Authors: Yuedong Du <yuedong.du@sun.com> - * - * Copyright (C) 2003 Ximian, Inc. - */ - -#include <config.h> -#include "gal-a11y-e-table-item-factory.h" -#include "gal-a11y-e-table-item.h" -#include "gal-a11y-e-table.h" -#include <gal/e-table/e-table.h> -#include <gal/e-table/e-tree.h> -#include <atk/atk.h> - - -#define CS_CLASS(factory) (G_TYPE_INSTANCE_GET_CLASS ((factory), C_TYPE_STREAM, GalA11yETableItemFactoryClass)) -static AtkObjectFactoryClass *parent_class; -#define PARENT_TYPE (ATK_TYPE_OBJECT_FACTORY) - -/* Static functions */ - -static GType -gal_a11y_e_table_item_factory_get_accessible_type (void) -{ - return GAL_A11Y_TYPE_E_TABLE_ITEM; -} - -static AtkObject* -gal_a11y_e_table_item_factory_create_accessible (GObject *obj) -{ - AtkObject *accessible; - ETableItem * eti; - GnomeCanvas * gc; - GtkWidget * table; - - g_return_if_fail (E_IS_TABLE_ITEM(obj)); - accessible = gal_a11y_e_table_item_new(NULL, obj, 0); - - return accessible; -} - -static void -gal_a11y_e_table_item_factory_class_init (GalA11yETableItemFactoryClass *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_item_factory_create_accessible; - factory_class->get_accessible_type = gal_a11y_e_table_item_factory_get_accessible_type; -} - -static void -gal_a11y_e_table_item_factory_init (GalA11yETableItemFactory *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_item_factory_get_type (void) -{ - static GType type = 0; - - if (!type) { - GTypeInfo info = { - sizeof (GalA11yETableItemFactoryClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) gal_a11y_e_table_item_factory_class_init, - (GClassFinalizeFunc) NULL, - NULL, /* class_data */ - sizeof (GalA11yETableItemFactory), - 0, - (GInstanceInitFunc) gal_a11y_e_table_item_factory_init, - NULL /* value_table */ - }; - - type = g_type_register_static (PARENT_TYPE, "GalA11yETableItemFactory", &info, 0); - } - - return type; -} diff --git a/a11y/e-table/gal-a11y-e-table-item-factory.h b/a11y/e-table/gal-a11y-e-table-item-factory.h deleted file mode 100644 index cbbff9fb18..0000000000 --- a/a11y/e-table/gal-a11y-e-table-item-factory.h +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Authors: * Yuedong Du <yuedong.du@sun.com> - * - * Copyright (C) 2003 Ximian, Inc. - */ - -#ifndef __GAL_A11Y_E_TABLE_ITEM_FACTORY_H__ -#define __GAL_A11Y_E_TABLE_ITEM_FACTORY_H__ - -#include <glib-object.h> -#include <atk/atkobjectfactory.h> - -#define GAL_A11Y_TYPE_E_TABLE_ITEM_FACTORY (gal_a11y_e_table_item_factory_get_type ()) -#define GAL_A11Y_E_TABLE_ITEM_FACTORY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GAL_A11Y_TYPE_E_TABLE_ITEM_FACTORY, GalA11yETableItemFactory)) -#define GAL_A11Y_E_TABLE_ITEM_FACTORY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GAL_A11Y_TYPE_E_TABLE_ITEM_FACTORY, GalA11yETableItemFactoryClass)) -#define GAL_A11Y_IS_E_TABLE_ITEM_FACTORY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GAL_A11Y_TYPE_E_TABLE_ITEM_FACTORY)) -#define GAL_A11Y_IS_E_TABLE_ITEM_FACTORY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GAL_A11Y_TYPE_E_TABLE_ITEM_FACTORY)) - -typedef struct _GalA11yETableItemFactory GalA11yETableItemFactory; -typedef struct _GalA11yETableItemFactoryClass GalA11yETableItemFactoryClass; - -struct _GalA11yETableItemFactory { - AtkObject object; -}; - -struct _GalA11yETableItemFactoryClass { - AtkObjectClass parent_class; -}; - - -/* Standard Glib function */ -GType gal_a11y_e_table_item_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 deleted file mode 100644 index fcfa1cc0e6..0000000000 --- a/a11y/e-table/gal-a11y-e-table-item.c +++ /dev/null @@ -1,1285 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * Authors: - * Christopher James Lahey <clahey@ximian.com> - * Bolian Yin <bolian.yin@sun.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-e-cell.h" -#include "gal-a11y-util.h" -#include <gal/e-table/e-table-subset.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; - gint cols; - gint rows; - gpointer *cell_data; - int selection_change_id; - int cursor_change_id; - ETableCol ** columns; - ESelectionModel *selection; -}; - -static gboolean gal_a11y_e_table_item_ref_selection (GalA11yETableItem *a11y, - ESelectionModel *selection); -static gboolean gal_a11y_e_table_item_unref_selection (GalA11yETableItem *a11y); - -#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 - -inline static gint -view_to_model_row(ETableItem *eti, int row) -{ - if (eti->uses_source_model) { - ETableSubset *etss = E_TABLE_SUBSET(eti->table_model); - if (row >= 0 && row < etss->n_map) { - eti->row_guess = row; - return etss->map_table[row]; - } else - return -1; - } else - return row; -} - -inline static gint -view_to_model_col(ETableItem *eti, int col) -{ - ETableCol *ecol = e_table_header_get_column (eti->header, col); - return ecol ? ecol->col_idx : -1; -} - -inline static GObject * -eti_a11y_get_gobject (AtkObject *accessible) -{ - return atk_gobject_accessible_get_object (ATK_GOBJECT_ACCESSIBLE (accessible)); -} - -static void -eti_dispose (GObject *object) -{ - gint i,j; - GalA11yETableItem *a11y = GAL_A11Y_E_TABLE_ITEM (object); - GalA11yETableItemPrivate *priv = GET_PRIVATE (a11y); - - priv->parent = NULL; - - if ( priv->cell_data != NULL ) { - g_free(priv->cell_data); - priv->cell_data = NULL; - } - - if (priv->columns) { - g_free(priv->columns); - priv->columns = NULL; - } - - if (parent_class->dispose) - parent_class->dispose (object); - if (priv->selection) - gal_a11y_e_table_item_unref_selection (a11y); -} - -/* Static functions */ -static AtkObject * -eti_get_parent (AtkObject *accessible) -{ - AtkGObjectAccessible *atk_gobj; - GalA11yETableItem *a11y; - - g_return_val_if_fail (GAL_A11Y_IS_E_TABLE_ITEM (accessible), NULL); - if (!eti_a11y_get_gobject (accessible)) - /* defunct */ - return NULL; - - a11y = GAL_A11Y_E_TABLE_ITEM (accessible); - return GET_PRIVATE (a11y)->parent; -} - -static gint -eti_get_n_children (AtkObject *accessible) -{ - AtkGObjectAccessible *atk_gobj; - - g_return_val_if_fail (GAL_A11Y_IS_E_TABLE_ITEM (accessible), 0); - if (!eti_a11y_get_gobject (accessible)) - return 0; - - 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 index) -{ - AtkGObjectAccessible *atk_gobj; - ETableItem *item; - gint col, row; - - g_return_val_if_fail (GAL_A11Y_IS_E_TABLE_ITEM (accessible), NULL); - item = E_TABLE_ITEM (eti_a11y_get_gobject (accessible)); - if (!item) - return NULL; - - if (index < item->cols) { - AtkObject *child; - - /* A column header is required */ - child = atk_table_get_column_header (ATK_TABLE (accessible), index); - if (child) - g_object_ref (child); - return child; - } - - index -= item->cols; - col = index % item->cols; - row = index / item->cols; - - return atk_table_ref_at (ATK_TABLE (accessible), row, col); -} - -static gint -eti_get_index_in_parent (AtkObject *accessible) -{ - AtkGObjectAccessible *atk_gobj; - GalA11yETableItem *a11y; - - g_return_val_if_fail (GAL_A11Y_IS_E_TABLE_ITEM (accessible), -1); - if (!eti_a11y_get_gobject (accessible)) - return -1; - - 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; - double real_width; - double real_height; - int fake_width; - int fake_height; - - item = E_TABLE_ITEM (eti_a11y_get_gobject (ATK_OBJECT (component))); - if (!item) - return; - - 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; - - item = E_TABLE_ITEM (eti_a11y_get_gobject (ATK_OBJECT (component))); - if (!item) - return; - - 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; - } -} - - -static void -cell_destroyed (gpointer data) -{ - AtkObject *parent; - gint index, n_cols; - GalA11yETableItem * item; - GalA11yECell * cell; - - g_return_if_fail (GAL_A11Y_IS_E_CELL (data)); - cell = GAL_A11Y_E_CELL (data); - - item = atk_gobject_accessible_for_object (GAL_A11Y_E_CELL(data)->item); - - g_return_if_fail (item && GAL_A11Y_IS_E_TABLE_ITEM (item)); - - g_return_if_fail (cell->row < GET_PRIVATE(item)->rows && cell->view_col < GET_PRIVATE(item)->cols); - - index = cell->row * cell->item->cols + cell->view_col; - - if (GET_PRIVATE (item)->cell_data && GET_PRIVATE (item)->cell_data [index] == data) - GET_PRIVATE (item)->cell_data [index] = NULL; -} - -/* atk table */ -static AtkObject* -eti_ref_at (AtkTable *table, gint row, gint column) -{ - ETableItem *item; - AtkObject* ret; - - item = E_TABLE_ITEM (eti_a11y_get_gobject (ATK_OBJECT (table))); - if (!item) - return NULL; - - 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); - gpointer * cell_data; - - cell_data = GET_PRIVATE (table)->cell_data; - - if (cell_data[row*item->cols + column] == NULL) { - ret = gal_a11y_e_cell_registry_get_object (NULL, - item, - cell_view, - ATK_OBJECT (table), - ecol->col_idx, - column, - row); - cell_data[row*item->cols + column] = ret; - if (ATK_IS_OBJECT (ret)) - g_object_weak_ref (G_OBJECT (ret), - (GWeakNotify) cell_destroyed, - ret); - - else - ret = NULL; - } else { - ret = (AtkObject *) cell_data[row*item->cols + column]; - if (ATK_IS_OBJECT (ret)) { - g_object_ref (ret); - } else { - ret = NULL; - } - } - - - return ret; - } - - return NULL; -} - -static gint -eti_get_index_at (AtkTable *table, gint row, gint column) -{ - ETableItem *item; - - item = E_TABLE_ITEM (eti_a11y_get_gobject (ATK_OBJECT (table))); - if (!item) - return -1; - - return column + row * item->cols; -} - -static gint -eti_get_column_at_index (AtkTable *table, gint index) -{ - ETableItem *item; - - item = E_TABLE_ITEM (eti_a11y_get_gobject (ATK_OBJECT (table))); - if (!item) - return -1; - - return index % item->cols; -} - -static gint -eti_get_row_at_index (AtkTable *table, gint index) -{ - ETableItem *item; - - item = E_TABLE_ITEM (eti_a11y_get_gobject (ATK_OBJECT (table))); - if (!item) - return -1; - - return index / item->cols; -} - -static gint -eti_get_n_columns (AtkTable *table) -{ - ETableItem *item; - - item = E_TABLE_ITEM (eti_a11y_get_gobject (ATK_OBJECT (table))); - if (!item) - return -1; - - return item->cols; -} - -static gint -eti_get_n_rows (AtkTable *table) -{ - ETableItem *item; - - item = E_TABLE_ITEM (eti_a11y_get_gobject (ATK_OBJECT (table))); - if (!item) - return -1; - - return item->rows; -} - -static gint -eti_get_column_extent_at (AtkTable *table, - gint row, - gint column) -{ - ETableItem *item; - int width; - - item = E_TABLE_ITEM (eti_a11y_get_gobject (ATK_OBJECT (table))); - if (!item) - return -1; - - 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; - int height; - - item = E_TABLE_ITEM (eti_a11y_get_gobject (ATK_OBJECT (table))); - if (!item) - return -1; - - 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; - ETableCol *ecol; - - item = E_TABLE_ITEM (eti_a11y_get_gobject (ATK_OBJECT (table))); - if (!item) - return NULL; - - ecol = e_table_header_get_column (item->header, column); - - return ecol->text; -} - -static AtkObject * -eti_get_column_header (AtkTable *table, gint column) -{ - ETableItem *item; - ETableCol *ecol; - AtkObject *atk_obj = NULL; - ECell *ecell; - - item = E_TABLE_ITEM (eti_a11y_get_gobject (ATK_OBJECT (table))); - if (!item) - return NULL; - - ecol = e_table_header_get_column (item->header, column); - ecell = ecol->ecell; - if (ecell) - atk_obj = atk_gobject_accessible_for_object (G_OBJECT (ecell)); - return atk_obj; -} - -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 gboolean -table_is_row_selected (AtkTable *table, gint row) -{ - ETableItem *item; - - item = E_TABLE_ITEM (eti_a11y_get_gobject (ATK_OBJECT (table))); - if (!item) - return FALSE; - - return e_selection_model_is_row_selected(item->selection, row); -} - -static gboolean -table_is_selected (AtkTable *table, gint row, gint column) -{ - return table_is_row_selected (table, row); -} - -static gint -table_get_selected_rows (AtkTable *table, gint **rows_selected) -{ - ETableItem *item; - gint n_selected, row, index_selected; - - item = E_TABLE_ITEM (eti_a11y_get_gobject (ATK_OBJECT (table))); - if (!item) - return 0; - - n_selected = e_selection_model_selected_count (item->selection); - if (rows_selected) { - *rows_selected = (gint *) g_malloc (n_selected * sizeof (gint)); - - index_selected = 0; - for (row = 0; row < item->rows && index_selected < n_selected; ++row) { - if (atk_table_is_row_selected (table, row)) { - (*rows_selected)[index_selected] = row; - ++index_selected; - } - } - } - return n_selected; -} - -static gboolean -table_add_row_selection (AtkTable *table, gint row) -{ - ETableItem *item; - gint cursor_row, cursor_col, row_count; - GdkModifierType state = GDK_CONTROL_MASK; - ESelectionModel *selection; - - item = E_TABLE_ITEM (eti_a11y_get_gobject (ATK_OBJECT (table))); - if (!item) - return FALSE; - - if (table_is_row_selected (table, row)) - return TRUE; - e_selection_model_toggle_single_row (item->selection, - view_to_model_row (item, row)); - - return TRUE; -} - -static gboolean -table_remove_row_selection (AtkTable *table, gint row) -{ - ETableItem *item; - - item = E_TABLE_ITEM (eti_a11y_get_gobject (ATK_OBJECT (table))); - if (!item) - return FALSE; - - if (!atk_table_is_row_selected (table, row)) - return TRUE; - e_selection_model_toggle_single_row (item->selection, row); - return TRUE; -} - -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; - - iface->is_row_selected = table_is_row_selected; - iface->is_selected = table_is_selected; - iface->get_selected_rows = table_get_selected_rows; - iface->add_row_selection = table_add_row_selection; - iface->remove_row_selection = table_remove_row_selection; -} - -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_rows_inserted (ETableModel * model, int row, int count, - AtkObject * table_item) -{ - gint n_cols,n_rows,i,j; - gint size; - gpointer *cell_data; - ETableItem *item = E_TABLE_ITEM (atk_gobject_accessible_get_object (ATK_GOBJECT_ACCESSIBLE (table_item))); - GalA11yETableItem * item_a11y; - gint old_nrows; - - g_return_if_fail (table_item); - item_a11y = GAL_A11Y_E_TABLE_ITEM (table_item); - - n_cols = atk_table_get_n_columns (ATK_TABLE(table_item)); - n_rows = atk_table_get_n_rows (ATK_TABLE(table_item)); - - old_nrows = GET_PRIVATE(item_a11y)->rows; - - g_return_if_fail (n_cols > 0 && n_rows > 0); - g_return_if_fail (old_nrows == n_rows - count); - - cell_data = GET_PRIVATE(table_item)->cell_data; - GET_PRIVATE(table_item)->cell_data = g_realloc (cell_data, (n_rows*n_cols) * sizeof(gpointer)); - cell_data = GET_PRIVATE(table_item)->cell_data; - - GET_PRIVATE(table_item)->rows = n_rows; - - /* If rows are insert in the middle of a table. */ - if (row + count < n_rows ) { - memmove(&cell_data[(row+count)*n_cols], &cell_data[row*n_cols], - (old_nrows-row)*n_cols*sizeof(gpointer)); - - /* Update cell's index. */ - for (i = row + count; i < n_rows; i ++) { - for (j = 0; j < n_cols; j ++) - if (cell_data[i*n_cols + j] != NULL) { - AtkObject * a11y; - - a11y = ATK_OBJECT(cell_data[i*n_cols + j]); - GAL_A11Y_E_CELL(a11y)->row = i; - } - } - } - - /* Clear cache for the new added rows. */ - for (i = row ; i < row+count; i ++) - for (j = 0 ; j < n_cols; j ++) - cell_data [i*n_cols + j] = NULL; - - g_signal_emit_by_name (table_item, "row-inserted", row, - count, NULL); - - for (i = row; i < (row + count); i ++) { - for (j = 0; j < n_cols; j ++) { - g_signal_emit_by_name (table_item, - "children_changed::add", - ( (i*n_cols) + j), NULL, NULL); - } - } - - g_signal_emit_by_name (table_item, "visible-data-changed"); -} - -static void -eti_rows_deleted (ETableModel * model, int row, int count, - AtkObject * table_item) -{ - gint i,j, n_rows, n_cols, old_nrows; - gpointer *cell_data; - ETableItem *item = E_TABLE_ITEM (atk_gobject_accessible_get_object (ATK_GOBJECT_ACCESSIBLE (table_item))); - - n_rows = atk_table_get_n_rows (ATK_TABLE(table_item)); - n_cols = atk_table_get_n_columns (ATK_TABLE(table_item)); - - cell_data = GET_PRIVATE(table_item)->cell_data; - old_nrows = GET_PRIVATE(table_item)->rows; - - g_return_if_fail ( row+count <= old_nrows); - g_return_if_fail (old_nrows == n_rows + count); - GET_PRIVATE(table_item)->rows = n_rows; - - /* DEFUNCT the deleted cells. */ - for (i = row; i < row+count; i ++) { - for (j = 0; j < n_cols; j ++) { - if (cell_data[i*n_cols + j] != NULL) { - AtkObject * a11y; - - a11y = ATK_OBJECT(cell_data[i*n_cols + j]); - gal_a11y_e_cell_add_state (GAL_A11Y_E_CELL(a11y), ATK_STATE_DEFUNCT, TRUE); - cell_data[i*n_cols + j] = NULL; - } - } - } - - /* If more rows left, update the a11y object. */ - if (old_nrows > row + count) { - - /* Remove the defunct cells in cache. */ - memmove (&cell_data[row*n_cols], &cell_data[(row+count)*n_cols], - ( old_nrows-row-count)*n_cols*sizeof(gpointer)); - - GET_PRIVATE(table_item)->cell_data = g_realloc (cell_data, n_rows*n_cols*sizeof(gpointer)); - cell_data = GET_PRIVATE(table_item)->cell_data; - - /* Update index of cells below the deleted rows. */ - for (i = row; i < n_rows; i ++) { - for (j = 0; j < n_cols; j ++) { - if (cell_data[i*n_cols + j] != NULL) { - AtkObject * a11y; - - a11y = ATK_OBJECT(cell_data[i*n_cols + j]); - GAL_A11Y_E_CELL(a11y)->row = i; - } - } - } - } - - g_signal_emit_by_name (table_item, "row-deleted", row, - count, NULL); - - for (i = row; i < (row + count); i ++) { - for (j = 0; j < n_cols; j ++) { - g_signal_emit_by_name (table_item, - "children_changed::remove", - ( (i*n_cols) + j), NULL, NULL); - } - } - g_signal_emit_by_name (table_item, "visible-data-changed"); -} - -enum { - ETI_HEADER_UNCHANGED = 0, - ETI_HEADER_REORDERED, - ETI_HEADER_NEW_ADDED, - ETI_HEADER_REMOVED, -}; - -/* - * 1. Check what actually happened: column reorder, remove or add - * 2. Update cache - * 3. Emit signals - */ -static void -eti_header_structure_changed (ETableHeader *eth, AtkObject *a11y) -{ - - gboolean reorder_found=FALSE, added_found=FALSE, removed_found=FALSE; - GalA11yETableItem * a11y_item; - ETableCol ** cols, **prev_cols; - GalA11yETableItemPrivate *priv; - gint *state = NULL, *prev_state = NULL, *reorder = NULL; - gint i,j,n_rows,n_cols, prev_n_cols; - gpointer * cell_data, * tmp; - - a11y_item = GAL_A11Y_E_TABLE_ITEM (a11y); - priv = GET_PRIVATE (a11y_item); - - g_return_if_fail (priv && priv->cell_data); - cell_data = priv->cell_data ; - - /* Assume rows do not changed. */ - n_rows = priv->rows; - - prev_n_cols = priv->cols; - prev_cols = priv->columns; - - cols = e_table_header_get_columns (eth); - n_cols = eth->col_count; - - g_return_if_fail (cols && prev_cols && n_cols > 0); - - /* Init to ETI_HEADER_UNCHANGED. */ - state = g_malloc0 (sizeof (gint) * n_cols); - prev_state = g_malloc0 (sizeof (gint) * prev_n_cols); - reorder = g_malloc0 (sizeof (gint) * n_cols); - - /* Compare with previously saved column headers. */ - for ( i = 0 ; i < n_cols && cols[i]; i ++ ) { - for ( j = 0 ; j < prev_n_cols && prev_cols[j]; j ++ ) { - if ( prev_cols [j] == cols[i] && i != j ) { - - reorder_found = TRUE; - state [i] = ETI_HEADER_REORDERED; - reorder [i] = j; - - break; - } else if (prev_cols[j] == cols[i]) { - /* OK, this column is not changed. */ - break; - } - } - - /* cols[i] is new added column. */ - if ( j == prev_n_cols ) { - gint row; - - added_found = TRUE; - state[i] = ETI_HEADER_NEW_ADDED; - } - } - - /* Now try to find if there are removed columns. */ - for (i = 0 ; i < prev_n_cols && prev_cols[i]; i ++) { - for (j = 0 ; j < n_cols && cols[j]; j ++) - if ( prev_cols [j] == cols[i] ) - break; - - /* Removed columns found. */ - if ( j == n_cols ) { - removed_found = TRUE; - prev_state[j] = ETI_HEADER_REMOVED; - } - } - - /* If nothing interesting just return. */ - if (!reorder_found && !added_found && !removed_found) - return; - - /* Now update our cache. */ - tmp = g_malloc0 (n_rows*n_cols*sizeof(gpointer)); - g_return_if_fail (tmp); - - for (i = 0 ; i < n_rows; i ++) { - for ( j = 0 ; j < n_cols; j ++ ) { - if ( state[j] == ETI_HEADER_REORDERED ) { - tmp [i*n_cols+j] = cell_data[i*prev_n_cols+reorder[j]]; - if (tmp[i*n_cols+j] && ATK_IS_OBJECT(tmp[i*n_cols+j])) { - GAL_A11Y_E_CELL(tmp[i*n_cols+j])->view_col = j; - } - } else if (state[j] == ETI_HEADER_UNCHANGED) { - tmp [i*n_cols+j] = cell_data[i*prev_n_cols+j]; - } /* else: new added, keep NULL. */ - } - } - - g_free (cell_data); - priv->cell_data = tmp; - - /* Emit signals */ - if (reorder_found) - g_signal_emit_by_name (G_OBJECT(a11y_item), "column_reordered"); - - - if (removed_found) { - for (i = 0; i < prev_n_cols; i ++ ) { - if (prev_state[i] == ETI_HEADER_REMOVED) { - g_signal_emit_by_name (G_OBJECT(a11y_item), "column-deleted", i, 1); - for (j = 0 ; j < n_rows; j ++) - g_signal_emit_by_name (G_OBJECT(a11y_item), "children_changed::remove", (j*prev_n_cols+i), NULL, NULL); - } - } - } - - if (added_found) { - for ( i = 0; i < n_cols; i ++ ) { - if (state[i] == ETI_HEADER_NEW_ADDED) { - g_signal_emit_by_name (G_OBJECT(a11y_item), "column-inserted", i, 1); - for (j = 0 ; j < n_rows; j ++) - g_signal_emit_by_name (G_OBJECT(a11y_item), "children_changed::add", (j*n_cols+i), NULL, NULL); - } - } - } - - priv->cols = n_cols; - - g_free (state); - g_free (reorder); - g_free (prev_state); - - g_free (priv->columns); - priv->columns = cols; -} - - -static void -eti_real_initialize (AtkObject *obj, - gpointer data) -{ - ETableItem * eti; - ETableModel * model; - - ATK_OBJECT_CLASS (parent_class)->initialize (obj, data); - eti = E_TABLE_ITEM (data); - - model = eti->table_model; - - g_signal_connect (model, "model-rows-inserted", - G_CALLBACK (eti_rows_inserted), - obj); - g_signal_connect (model, "model-rows-deleted", - G_CALLBACK (eti_rows_deleted), - obj); - g_signal_connect (G_OBJECT (eti->header), "structure_change", - G_CALLBACK (eti_header_structure_changed), obj); - -} - -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; - atk_object_class->initialize = eti_real_initialize; -} - -static void -eti_init (GalA11yETableItem *a11y) -{ - GalA11yETableItemPrivate *priv; - - priv = GET_PRIVATE (a11y); - - priv->parent = NULL; - priv->index_in_parent = -1; - priv->selection_change_id = 0; - priv->cursor_change_id = 0; - priv->selection = NULL; -} - -/* atk selection */ - -static void atk_selection_interface_init (AtkSelectionIface *iface); -static gboolean selection_add_selection (AtkSelection *selection, - gint i); -static gboolean selection_clear_selection (AtkSelection *selection); -static AtkObject* selection_ref_selection (AtkSelection *selection, - gint i); -static gint selection_get_selection_count (AtkSelection *selection); -static gboolean selection_is_child_selected (AtkSelection *selection, - gint i); - -/* callbacks */ -static void eti_a11y_selection_model_removed_cb (ETableItem *eti, - ESelectionModel *selection, - gpointer data); -static void eti_a11y_selection_model_added_cb (ETableItem *eti, - ESelectionModel *selection, - gpointer data); -static void eti_a11y_selection_changed_cb (ESelectionModel *selection, - GalA11yETableItem *a11y); -static void eti_a11y_cursor_changed_cb (ESelectionModel *selection, - int row, int col, - GalA11yETableItem *a11y); - -/** - * 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 - }; - - static const GInterfaceInfo atk_selection_info = { - (GInterfaceInitFunc) atk_selection_interface_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); - g_type_add_interface_static (type, ATK_TYPE_SELECTION, &atk_selection_info); - } - - return type; -} - -AtkObject * -gal_a11y_e_table_item_new (AtkObject *parent, - ETableItem *item, - int index_in_parent) -{ - GalA11yETableItem *a11y; - int n; - - 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; - - g_return_val_if_fail (item->cols >= 0 && item->rows >= 0, NULL); - /* Initialize cell data. */ - n = item->cols * item->rows; - GET_PRIVATE (a11y)->cols = item->cols; - GET_PRIVATE (a11y)->rows = item->rows; - if (n > 0) { - GET_PRIVATE (a11y)->cell_data = g_malloc0(n*sizeof(gpointer)); - /* memory error. */ - if ( GET_PRIVATE (a11y)->cell_data == NULL) - return NULL; - } else - GET_PRIVATE (a11y)->cell_data = NULL; - - - GET_PRIVATE (a11y)->columns = e_table_header_get_columns (item->header); - if ( GET_PRIVATE (a11y)->columns == NULL) - return NULL; - - if (item) { - g_signal_connect (G_OBJECT(item), "selection_model_removed", - G_CALLBACK (eti_a11y_selection_model_removed_cb), NULL); - g_signal_connect (G_OBJECT(item), "selection_model_added", - G_CALLBACK (eti_a11y_selection_model_added_cb), NULL); - if (item->selection) - gal_a11y_e_table_item_ref_selection (a11y, - item->selection); - } - 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); -} - -static gboolean -gal_a11y_e_table_item_ref_selection (GalA11yETableItem *a11y, - ESelectionModel *selection) -{ - GalA11yETableItemPrivate *priv; - - g_return_val_if_fail (a11y && selection, FALSE); - - priv = GET_PRIVATE (a11y); - priv->selection_change_id = g_signal_connect ( - G_OBJECT(selection), "selection_changed", - G_CALLBACK (eti_a11y_selection_changed_cb), a11y); - priv->cursor_change_id = g_signal_connect ( - G_OBJECT(selection), "cursor_changed", - G_CALLBACK (eti_a11y_cursor_changed_cb), a11y); - - priv->selection = selection; - g_object_ref (selection); - - return TRUE; -} - -static gboolean -gal_a11y_e_table_item_unref_selection (GalA11yETableItem *a11y) -{ - GalA11yETableItemPrivate *priv; - - g_return_val_if_fail (a11y, FALSE); - - priv = GET_PRIVATE (a11y); - - g_return_val_if_fail (priv->selection_change_id != 0, FALSE); - g_return_val_if_fail (priv->cursor_change_id != 0, FALSE); - - - g_signal_handler_disconnect (priv->selection, - priv->selection_change_id); - g_signal_handler_disconnect (priv->selection, - priv->cursor_change_id); - priv->cursor_change_id = 0; - priv->selection_change_id = 0; - - g_object_unref (priv->selection); - priv->selection = NULL; - - return TRUE; -} - -/* callbacks */ - -static void -eti_a11y_selection_model_removed_cb (ETableItem *eti, ESelectionModel *selection, - gpointer data) -{ - AtkObject *atk_obj; - GalA11yETableItem *a11y; - - g_return_if_fail (E_IS_TABLE_ITEM (eti)); - g_return_if_fail (E_IS_SELECTION_MODEL (selection)); - - atk_obj = atk_gobject_accessible_for_object (G_OBJECT (eti)); - a11y = GAL_A11Y_E_TABLE_ITEM (atk_obj); - - if (selection == GET_PRIVATE (a11y)->selection) - gal_a11y_e_table_item_unref_selection (a11y); -} - -static void -eti_a11y_selection_model_added_cb (ETableItem *eti, ESelectionModel *selection, - gpointer data) -{ - AtkObject *atk_obj; - GalA11yETableItem *a11y; - - g_return_if_fail (E_IS_TABLE_ITEM (eti)); - g_return_if_fail (E_IS_SELECTION_MODEL (selection)); - - atk_obj = atk_gobject_accessible_for_object (G_OBJECT (eti)); - a11y = GAL_A11Y_E_TABLE_ITEM (atk_obj); - - if (GET_PRIVATE (a11y)->selection) - gal_a11y_e_table_item_unref_selection (a11y); - gal_a11y_e_table_item_ref_selection (a11y, selection); -} - -static void -eti_a11y_selection_changed_cb (ESelectionModel *selection, GalA11yETableItem *a11y) -{ - g_return_if_fail (GAL_A11Y_IS_E_TABLE_ITEM (a11y)); - - g_signal_emit_by_name (a11y, "selection_changed"); -} - -static void -eti_a11y_cursor_changed_cb (ESelectionModel *selection, - int row, int col, GalA11yETableItem *a11y) -{ - AtkObject * cell; - g_return_if_fail (GAL_A11Y_IS_E_TABLE_ITEM (a11y)); - - g_signal_emit_by_name (a11y, "selection_changed"); - - cell = atk_table_ref_at (ATK_TABLE (a11y), row, col); - if (ATK_IS_OBJECT (cell)) - g_signal_emit_by_name (a11y, - "active-descendant-changed", - cell); -} - -/* atk selection */ - -static void atk_selection_interface_init (AtkSelectionIface *iface) -{ - g_return_if_fail (iface != NULL); - iface->add_selection = selection_add_selection; - iface->clear_selection = selection_clear_selection; - iface->ref_selection = selection_ref_selection; - iface->get_selection_count = selection_get_selection_count; - iface->is_child_selected = selection_is_child_selected; -} - -static gboolean -selection_add_selection (AtkSelection *selection, gint index) -{ - AtkTable *table; - gint row, col; - ETableItem *item; - - item = E_TABLE_ITEM (eti_a11y_get_gobject (ATK_OBJECT (selection))); - if (!item) - return FALSE; - - table = ATK_TABLE (selection); - - row = atk_table_get_row_at_index (table, index); - atk_table_add_row_selection (table, row); - - col = atk_table_get_column_at_index (table, index); - e_selection_model_change_cursor (item->selection, - view_to_model_row (item, row), - view_to_model_col (item, col)); - e_selection_model_cursor_changed (item->selection, - view_to_model_row (item, row), - view_to_model_col (item, col)); - e_selection_model_cursor_activated (item->selection, - view_to_model_row (item, row), - view_to_model_col (item, col)); - return TRUE; -} - -static gboolean -selection_clear_selection (AtkSelection *selection) -{ - ETableItem *item; - - item = E_TABLE_ITEM (eti_a11y_get_gobject (ATK_OBJECT (selection))); - if (!item) - return FALSE; - - e_selection_model_clear (item->selection); - return TRUE; -} - -static AtkObject * -selection_ref_selection (AtkSelection *selection, gint index) -{ - AtkTable *table; - gint row, col; - - table = ATK_TABLE (selection); - row = atk_table_get_row_at_index (table, index); - col = atk_table_get_column_at_index (table, index); - if (!atk_table_is_row_selected (table, row)) - return NULL; - - return atk_table_ref_at (table, row, col); -} - -static gint -selection_get_selection_count (AtkSelection *selection) -{ - AtkTable *table; - gint n_selected; - - table = ATK_TABLE (selection); - n_selected = atk_table_get_selected_rows (table, NULL); - if (n_selected > 0) - n_selected *= atk_table_get_n_columns (table); - return n_selected; -} - -static gboolean -selection_is_child_selected (AtkSelection *selection, gint i) -{ - gint row; - - row = atk_table_get_row_at_index (ATK_TABLE (selection), i); - return atk_table_is_row_selected (ATK_TABLE (selection), row); -} diff --git a/a11y/e-table/gal-a11y-e-table-item.h b/a11y/e-table/gal-a11y-e-table-item.h deleted file mode 100644 index f3a447131d..0000000000 --- a/a11y/e-table/gal-a11y-e-table-item.h +++ /dev/null @@ -1,44 +0,0 @@ -/* -*- 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> -#include <atk/atkgobjectaccessible.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 { - AtkGObjectAccessible parent; -}; - -struct _GalA11yETableItemClass { - AtkGObjectAccessibleClass 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 deleted file mode 100644 index 8f4f246e70..0000000000 --- a/a11y/e-table/gal-a11y-e-table.c +++ /dev/null @@ -1,185 +0,0 @@ -/* -*- 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> -#include <gal/e-table/e-table-click-to-add.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 = atk_gobject_accessible_for_object (G_OBJECT(E_TABLE_GROUP_LEAF (table->group)->item)); - priv->child_item->role = ATK_ROLE_TABLE; - } -} - -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) -{ - GalA11yETable *a11y = GAL_A11Y_E_TABLE (accessible); - ETable * et; - - et = E_TABLE(GTK_ACCESSIBLE (a11y)->widget); - if (et && et->use_click_to_add) { - return 2; - } - - return 1; -} - -static AtkObject* -et_ref_child (AtkObject *accessible, - gint i) -{ - GalA11yETable *a11y = GAL_A11Y_E_TABLE (accessible); - ETable * et; - - et = E_TABLE(GTK_ACCESSIBLE (a11y)->widget); - - if (i == 0) { - init_child_item (a11y); - g_object_ref (GET_PRIVATE (a11y)->child_item); - return GET_PRIVATE (a11y)->child_item; - } else if (i == 1) { - AtkObject * accessible; - ETableClickToAdd * etcta; - - if (et && et->use_click_to_add && et->click_to_add) { - etcta = E_TABLE_CLICK_TO_ADD(et->click_to_add); - if (etcta->rect) { - accessible = atk_gobject_accessible_for_object (G_OBJECT(etcta)); - } else { - accessible = atk_gobject_accessible_for_object (G_OBJECT(etcta->row)); - } - return accessible; - } - } - - return NULL; -} - -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 deleted file mode 100644 index 0a0901e3bc..0000000000 --- a/a11y/e-table/gal-a11y-e-table.h +++ /dev/null @@ -1,43 +0,0 @@ -/* -*- 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-table/gal-a11y-e-tree-factory.c b/a11y/e-table/gal-a11y-e-tree-factory.c deleted file mode 100644 index 2fa34c5fbc..0000000000 --- a/a11y/e-table/gal-a11y-e-tree-factory.c +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Authors: Yuedong Du <yuedong.du@sun.com> - * - * Copyright (C) 2003 Ximian, Inc. - */ - -#include <config.h> -#include "gal-a11y-e-tree-factory.h" -#include "gal-a11y-e-tree.h" - -#define CS_CLASS(factory) (G_TYPE_INSTANCE_GET_CLASS ((factory), C_TYPE_STREAM, GalA11yETreeFactoryClass)) -static AtkObjectFactoryClass *parent_class; -#define PARENT_TYPE (ATK_TYPE_OBJECT_FACTORY) - -/* Static functions */ - -static GType -gal_a11y_e_tree_factory_get_accessible_type (void) -{ - return GAL_A11Y_TYPE_E_TREE; -} - -static AtkObject* -gal_a11y_e_tree_factory_create_accessible (GObject *obj) -{ - AtkObject *accessible; - - accessible = gal_a11y_e_tree_new (obj); - - return accessible; -} - -static void -gal_a11y_e_tree_factory_class_init (GalA11yETreeFactoryClass *klass) -{ - AtkObjectFactoryClass *factory_class = ATK_OBJECT_FACTORY_CLASS (klass); - - parent_class = g_type_class_ref (PARENT_TYPE); - - factory_class->create_accessible = gal_a11y_e_tree_factory_create_accessible; - factory_class->get_accessible_type = gal_a11y_e_tree_factory_get_accessible_type; -} - -static void -gal_a11y_e_tree_factory_init (GalA11yETreeFactory *factory) -{ -} - -/** - * gal_a11y_e_tree_factory_get_type: - * @void: - * - * Registers the &GalA11yETreeFactory class if necessary, and returns the type ID - * associated to it. - * - * Return value: The type ID of the &GalA11yETreeFactory class. - **/ -GType -gal_a11y_e_tree_factory_get_type (void) -{ - static GType type = 0; - - if (!type) { - GTypeInfo info = { - sizeof (GalA11yETreeFactoryClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) gal_a11y_e_tree_factory_class_init, - (GClassFinalizeFunc) NULL, - NULL, /* class_data */ - sizeof (GalA11yETreeFactory), - 0, - (GInstanceInitFunc) gal_a11y_e_tree_factory_init, - NULL /* value_tree */ - }; - - type = g_type_register_static (PARENT_TYPE, "GalA11yETreeFactory", &info, 0); - } - - return type; -} diff --git a/a11y/e-table/gal-a11y-e-tree-factory.h b/a11y/e-table/gal-a11y-e-tree-factory.h deleted file mode 100644 index 434e526db9..0000000000 --- a/a11y/e-table/gal-a11y-e-tree-factory.h +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Authors: Yuedong Du <yuedong.du@ximian.com> - * - * Copyright (C) 2003 Ximian, Inc. - */ - -#ifndef __GAL_A11Y_E_TREE_FACTORY_H__ -#define __GAL_A11Y_E_TREE_FACTORY_H__ - -#include <glib-object.h> -#include <atk/atkobjectfactory.h> - -#define GAL_A11Y_TYPE_E_TREE_FACTORY (gal_a11y_e_table_factory_get_type ()) -#define GAL_A11Y_E_TREE_FACTORY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GAL_A11Y_TYPE_E_TREE_FACTORY, GalA11yETreeFactory)) -#define GAL_A11Y_E_TREE_FACTORY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GAL_A11Y_TYPE_E_TREE_FACTORY, GalA11yETreeFactoryClass)) -#define GAL_A11Y_IS_E_TREE_FACTORY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GAL_A11Y_TYPE_E_TREE_FACTORY)) -#define GAL_A11Y_IS_E_TREE_FACTORY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GAL_A11Y_TYPE_E_TREE_FACTORY)) - -typedef struct _GalA11yETreeFactory GalA11yETreeFactory; -typedef struct _GalA11yETreeFactoryClass GalA11yETreeFactoryClass; - -struct _GalA11yETreeFactory { - AtkObject object; -}; - -struct _GalA11yETreeFactoryClass { - AtkObjectClass parent_class; -}; - - -/* Standard Glib function */ -GType gal_a11y_e_tree_factory_get_type (void); - -#endif /* ! __GAL_A11Y_E_TREE_FACTORY_H__ */ diff --git a/a11y/e-table/gal-a11y-e-tree.c b/a11y/e-table/gal-a11y-e-tree.c deleted file mode 100644 index dc7755c6f2..0000000000 --- a/a11y/e-table/gal-a11y-e-tree.c +++ /dev/null @@ -1,159 +0,0 @@ -/* - * Authors: Yuedong Du <yuedong.du@sun.com> - * - * Copyright (C) 2003 Ximian, Inc. - */ - -#include <config.h> -#include "gal-a11y-e-tree.h" -#include "gal-a11y-util.h" -#include <gal/e-table/e-tree.h> -#include <gal/e-table/e-table-item.h> - -#define CS_CLASS(a11y) (G_TYPE_INSTANCE_GET_CLASS ((a11y), C_TYPE_STREAM, GalA11yETreeClass)) -static AtkObjectClass *parent_class; -static GType parent_type; -static gint priv_offset; -#define GET_PRIVATE(object) ((GalA11yETreePrivate *) (((char *) object) + priv_offset)) -#define PARENT_TYPE (parent_type) - -struct _GalA11yETreePrivate { - AtkObject *child_item; -}; - -/* Static functions */ - -static void -init_child_item (GalA11yETree *a11y) -{ - GalA11yETreePrivate *priv = GET_PRIVATE (a11y); - ETree *tree = E_TREE (GTK_ACCESSIBLE (a11y)->widget); - ETableItem * eti; - - g_return_if_fail (tree); - eti = e_tree_get_item (tree); - if (priv->child_item == NULL) { - priv->child_item = gal_a11y_e_table_item_new (ATK_OBJECT (a11y),eti, 0); - g_return_if_fail (priv->child_item); - priv->child_item->role = ATK_ROLE_TREE_TABLE; - } -} - -static AtkObject* -et_ref_accessible_at_point (AtkComponent *component, - gint x, - gint y, - AtkCoordType coord_type) -{ - GalA11yETree *a11y = GAL_A11Y_E_TREE (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) -{ - GalA11yETree *a11y = GAL_A11Y_E_TREE (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 (GalA11yETreeClass *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 (GalA11yETree *a11y) -{ - GalA11yETreePrivate *priv; - - priv = GET_PRIVATE (a11y); - - priv->child_item = NULL; -} - -/** - * gal_a11y_e_tree_get_type: - * @void: - * - * Registers the &GalA11yETree class if necessary, and returns the type ID - * associated to it. - * - * Return value: The type ID of the &GalA11yETree class. - **/ -GType -gal_a11y_e_tree_get_type (void) -{ - static GType type = 0; - - if (!type) { - AtkObjectFactory *factory; - - GTypeInfo info = { - sizeof (GalA11yETreeClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) et_class_init, - (GClassFinalizeFunc) NULL, - NULL, /* class_data */ - sizeof (GalA11yETree), - 0, - (GInstanceInitFunc) et_init, - NULL /* value_tree */ - }; - - 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, "GalA11yETree", &info, 0, - sizeof (GalA11yETreePrivate), &priv_offset); - g_type_add_interface_static (type, ATK_TYPE_COMPONENT, &atk_component_info); - } - - return type; -} - -AtkObject * -gal_a11y_e_tree_new (GObject *widget) -{ - GalA11yETree *a11y; - ETree *tree; - AtkObject * item; - - tree = E_TREE (widget); - - a11y = g_object_new (gal_a11y_e_tree_get_type (), NULL); - - GTK_ACCESSIBLE (a11y)->widget = GTK_WIDGET (widget); - - return ATK_OBJECT (a11y); -} diff --git a/a11y/e-table/gal-a11y-e-tree.h b/a11y/e-table/gal-a11y-e-tree.h deleted file mode 100644 index 65b8deb6cf..0000000000 --- a/a11y/e-table/gal-a11y-e-tree.h +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Authors: Yuedong Du <yuedong.du@sun.com> - * - * Copyright (C) 2003 Ximian, Inc. - */ - -#ifndef __GAL_A11Y_E_TREE_H__ -#define __GAL_A11Y_E_TREE_H__ - -#include <glib-object.h> -#include <atk/atkobject.h> -#include <atk/atkcomponent.h> -#include <gtk/gtkaccessible.h> - -#define GAL_A11Y_TYPE_E_TREE (gal_a11y_e_tree_get_type ()) -#define GAL_A11Y_E_TREE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GAL_A11Y_TYPE_E_TREE, GalA11yETree)) -#define GAL_A11Y_E_TREE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GAL_A11Y_TYPE_E_TREE, GalA11yETreeClass)) -#define GAL_A11Y_IS_E_TREE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GAL_A11Y_TYPE_E_TREE)) -#define GAL_A11Y_IS_E_TREE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GAL_A11Y_TYPE_E_TREE)) - -typedef struct _GalA11yETree GalA11yETree; -typedef struct _GalA11yETreeClass GalA11yETreeClass; -typedef struct _GalA11yETreePrivate GalA11yETreePrivate; - -/* This struct should actually be larger as this isn't what we derive from. - * The GalA11yETablePrivate comes right after the parent class structure. - **/ -struct _GalA11yETree { - GtkAccessible object; -}; - -struct _GalA11yETreeClass { - GtkAccessibleClass parent_class; -}; - - -/* Standard Glib function */ -GType gal_a11y_e_tree_get_type (void); -AtkObject *gal_a11y_e_tree_new (GObject *tree); - -#endif /* ! __GAL_A11Y_E_TREE_H__ */ diff --git a/a11y/e-text/.cvsignore b/a11y/e-text/.cvsignore deleted file mode 100644 index 5b48d3f593..0000000000 --- a/a11y/e-text/.cvsignore +++ /dev/null @@ -1,4 +0,0 @@ -.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 deleted file mode 100644 index 24e3c28116..0000000000 --- a/a11y/e-text/gal-a11y-e-text-factory.c +++ /dev/null @@ -1,87 +0,0 @@ -/* -*- 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); - - 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 deleted file mode 100644 index 56a8d29ab9..0000000000 --- a/a11y/e-text/gal-a11y-e-text-factory.h +++ /dev/null @@ -1,36 +0,0 @@ -/* -*- 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 { - AtkObjectFactory object; -}; - -struct _GalA11yETextFactoryClass { - AtkObjectFactoryClass 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 deleted file mode 100644 index be7835e17d..0000000000 --- a/a11y/e-text/gal-a11y-e-text.c +++ /dev/null @@ -1,1121 +0,0 @@ -/* -*- 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 "gal/e-text/e-text-model-repos.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) -{ - gint start, end, real_start, real_end, len; - const char *full_text = et_get_full_text (text); - if (full_text == NULL) - return; - len = g_utf8_strlen (full_text, -1); - - start = MIN (MAX (0, start_offset), len); - end = MIN (MAX (-1, end_offset), len); - - if (end_offset == -1) - end = strlen (full_text); - else - end = g_utf8_offset_to_pointer (full_text, end) - full_text; - - start = g_utf8_offset_to_pointer (full_text, start) - full_text; - - real_start = MIN (start, end); - real_end = MAX (start, end); - - return g_strndup (full_text + real_start, real_end - real_start); -} - -static gboolean -is_a_seperator (gunichar c) -{ - return g_unichar_ispunct(c) || g_unichar_isspace(c); -} - -static gint -find_word_start (const char *text, - gint begin_offset, - gint step) -{ - gint offset; - char *at_offset; - gunichar current, previous; - gint len; - - offset = begin_offset; - len = g_utf8_strlen (text, -1); - - while (offset > 0 && offset < len) { - at_offset = g_utf8_offset_to_pointer (text, offset); - current = g_utf8_get_char_validated (at_offset, -1); - at_offset = g_utf8_offset_to_pointer (text, offset-1); - previous = g_utf8_get_char_validated (at_offset, -1); - if ((! is_a_seperator (current)) && is_a_seperator (previous)) - break; - offset += step; - } - - return offset; -} - -static gint -find_word_end (const char *text, - gint begin_offset, - gint step) -{ - gint offset; - char *at_offset; - gunichar current, previous; - gint len; - - offset = begin_offset; - len = g_utf8_strlen (text, -1); - - while (offset > 0 && offset < len) { - at_offset = g_utf8_offset_to_pointer (text, offset); - current = g_utf8_get_char_validated (at_offset, -1); - at_offset = g_utf8_offset_to_pointer (text, offset-1); - previous = g_utf8_get_char_validated (at_offset, -1); - if (is_a_seperator (current) && (! is_a_seperator (previous))) - break; - offset += step; - } - - return offset; -} - -static gint -find_sentence_start (const char *text, - gint begin_offset, - gint step) -{ - gint offset, last_word_end, len; - char *at_offset; - gunichar ch; - int i; - - offset = find_word_start (text, begin_offset, step); - len = g_utf8_strlen (text, -1); - - while (offset>0 && offset <len) { - last_word_end = find_word_end (text, offset - 1, -1); - if (last_word_end == 0) - break; - for (i = last_word_end; i < offset; i++) { - at_offset = g_utf8_offset_to_pointer (text, i); - ch = g_utf8_get_char_validated (at_offset, -1); - if (ch == '.' || ch == '!' || ch == '?') - return offset; - } - - offset = find_word_start (text, offset + step, step); - } - - return offset; -} - -static gint -find_sentence_end (const char *text, - gint begin_offset, - gint step) -{ - gint offset; - char *at_offset; - gunichar previous; - gint len; - - offset = begin_offset; - len = g_utf8_strlen (text, -1); - - while (offset > 0 && offset < len) { - at_offset = g_utf8_offset_to_pointer (text, offset - 1); - previous = g_utf8_get_char_validated (at_offset, -1); - if (previous == '.' || previous == '!' || previous == '?') - break; - offset += step; - } - - return offset; -} - -static gint -find_line_start (const char *text, - gint begin_offset, - gint step) -{ - gint offset; - char *at_offset; - gunichar previous; - gint len; - - offset = begin_offset; - len = g_utf8_strlen (text, -1); - - while (offset > 0 && offset < len) { - at_offset = g_utf8_offset_to_pointer (text, offset - 1); - previous = g_utf8_get_char_validated (at_offset, -1); - if (previous == '\n' || previous == '\r') - break; - offset += step; - } - - return offset; -} - -static gint -find_line_end (const char *text, - gint begin_offset, - gint step) -{ - gint offset; - char *at_offset; - gunichar current; - gint len; - - offset = begin_offset; - len = g_utf8_strlen (text, -1); - - while (offset >= 0 && offset < len) { - at_offset = g_utf8_offset_to_pointer (text, offset); - current = g_utf8_get_char_validated (at_offset, -1); - if (current == '\n' || current == '\r') - break; - offset += step; - } - - return offset; -} - -static gchar * -et_get_text_after_offset (AtkText *text, - gint offset, - AtkTextBoundary boundary_type, - gint *start_offset, - gint *end_offset) -{ - gint start, end, len; - const char *full_text = et_get_full_text (text); - g_return_val_if_fail (full_text, NULL); - - switch (boundary_type) - { - case ATK_TEXT_BOUNDARY_CHAR: - start = offset + 1; - end = offset + 2; - break; - case ATK_TEXT_BOUNDARY_WORD_START: - start = find_word_start (full_text, offset + 1, 1); - end = find_word_start (full_text, start + 1, 1); - break; - case ATK_TEXT_BOUNDARY_WORD_END: - start = find_word_end (full_text, offset + 1, 1); - end = find_word_end (full_text, start + 1, 1); - break; - case ATK_TEXT_BOUNDARY_SENTENCE_START: - start = find_sentence_start (full_text, offset + 1, 1); - end = find_sentence_start (full_text, start + 1, 1); - break; - case ATK_TEXT_BOUNDARY_SENTENCE_END: - start = find_sentence_end (full_text, offset + 1, 1); - end = find_sentence_end (full_text, start + 1, 1); - break; - case ATK_TEXT_BOUNDARY_LINE_START: - start = find_line_start (full_text, offset + 1, 1); - end = find_line_start (full_text, start + 1, 1); - break; - case ATK_TEXT_BOUNDARY_LINE_END: - start = find_line_end (full_text, offset + 1, 1); - end = find_line_end (full_text, start + 1, 1); - break; - defalut: - return NULL; - } - - len = g_utf8_strlen (full_text, -1); - if (start_offset) - *start_offset = MIN (MAX (0, start), len); - if (end_offset) - *end_offset = MIN (MAX (0, end), len); - return et_get_text (text, start, end); -} - -static gchar * -et_get_text_at_offset (AtkText *text, - gint offset, - AtkTextBoundary boundary_type, - gint *start_offset, - gint *end_offset) -{ - gint start, end, len; - const char *full_text = et_get_full_text (text); - g_return_val_if_fail (full_text, NULL); - - switch (boundary_type) - { - case ATK_TEXT_BOUNDARY_CHAR: - start = offset; - end = offset + 1; - break; - case ATK_TEXT_BOUNDARY_WORD_START: - start = find_word_start (full_text, offset - 1, -1); - end = find_word_start (full_text, offset, 1); - break; - case ATK_TEXT_BOUNDARY_WORD_END: - start = find_word_end (full_text, offset, -1); - end = find_word_end (full_text, offset + 1, 1); - break; - case ATK_TEXT_BOUNDARY_SENTENCE_START: - start = find_sentence_start (full_text, offset - 1, -1); - end = find_sentence_start (full_text, offset, 1); - break; - case ATK_TEXT_BOUNDARY_SENTENCE_END: - start = find_sentence_end (full_text, offset, -1); - end = find_sentence_end (full_text, offset + 1, 1); - break; - case ATK_TEXT_BOUNDARY_LINE_START: - start = find_line_start (full_text, offset - 1, -1); - end = find_line_start (full_text, offset, 1); - break; - case ATK_TEXT_BOUNDARY_LINE_END: - start = find_line_end (full_text, offset, -1); - end = find_line_end (full_text, offset + 1, 1); - break; - defalut: - return NULL; - } - - len = g_utf8_strlen (full_text, -1); - if (start_offset) - *start_offset = MIN (MAX (0, start), len); - if (end_offset) - *end_offset = MIN (MAX (0, end), len); - return et_get_text (text, start, end); -} - -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) -{ - gint start, end, len; - const char *full_text = et_get_full_text (text); - g_return_val_if_fail (full_text, NULL); - - switch (boundary_type) - { - case ATK_TEXT_BOUNDARY_CHAR: - start = offset - 1; - end = offset; - break; - case ATK_TEXT_BOUNDARY_WORD_START: - end = find_word_start (full_text, offset - 1, -1); - start = find_word_start (full_text, end - 1, -1) ; - break; - case ATK_TEXT_BOUNDARY_WORD_END: - end = find_word_end (full_text, offset, -1); - start = find_word_end (full_text, end - 1, -1); - break; - case ATK_TEXT_BOUNDARY_SENTENCE_START: - end = find_sentence_start (full_text, offset, -1); - start = find_sentence_start (full_text, end - 1, -1); - break; - case ATK_TEXT_BOUNDARY_SENTENCE_END: - end = find_sentence_end (full_text, offset, -1); - start = find_sentence_end (full_text, end - 1, -1); - break; - case ATK_TEXT_BOUNDARY_LINE_START: - end = find_line_start (full_text, offset, -1); - start = find_line_start (full_text, end - 1, -1); - break; - case ATK_TEXT_BOUNDARY_LINE_END: - end = find_line_end (full_text, offset, -1); - start = find_line_end (full_text, end - 1, -1); - break; - default: - return NULL; - } - - len = g_utf8_strlen (full_text, -1); - if (start_offset) - *start_offset = MIN (MAX (0, start), len); - if (end_offset) - *end_offset = MIN (MAX (0, end), len); - return et_get_text (text, start, end); -} - -static gint -et_get_caret_offset (AtkText *text) -{ - GObject *obj; - EText *etext; - int offset; - - g_return_val_if_fail (ATK_IS_GOBJECT_ACCESSIBLE(text), -1); - obj = atk_gobject_accessible_get_object (ATK_GOBJECT_ACCESSIBLE (text)); - if (obj == NULL) - return -1; - - g_return_val_if_fail (E_IS_TEXT (obj), -1); - etext = E_TEXT (obj); - - gtk_object_get (GTK_OBJECT (etext), - "cursor_pos", &offset, - NULL); - 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) -{ - GObject *obj; - EText *etext; - GnomeCanvas *canvas; - gint x_widget, y_widget, x_window, y_window; - GdkWindow *window; - GtkWidget *widget; - int index; - int trailing; - PangoRectangle pango_pos; - - g_return_if_fail (ATK_IS_GOBJECT_ACCESSIBLE(text)); - obj = atk_gobject_accessible_get_object (ATK_GOBJECT_ACCESSIBLE (text)); - if (obj == NULL) - return; - g_return_if_fail (E_IS_TEXT (obj)); - etext = E_TEXT(obj); - canvas = GNOME_CANVAS_ITEM(etext)->canvas; - widget = GTK_WIDGET(canvas); - window = widget->window; - gdk_window_get_origin (window, &x_widget, &y_widget); - - pango_layout_index_to_pos (etext->layout, offset, &pango_pos); - pango_pos.x = PANGO_PIXELS (pango_pos.x); - pango_pos.y = PANGO_PIXELS (pango_pos.y); - pango_pos.width = (pango_pos.width + PANGO_SCALE / 2) / PANGO_SCALE; - pango_pos.height = (pango_pos.height + PANGO_SCALE / 2) / PANGO_SCALE; - - *x = pango_pos.x + x_widget; - *y = pango_pos.y + y_widget; - - *width = pango_pos.width; - *height = pango_pos.height; - - if (etext->draw_borders) { - *x += 3; /*BORDER_INDENT;*/ - *y += 3; /*BORDER_INDENT;*/ - } - - *x += etext->xofs; - *y += etext->yofs; - - if (etext->editing) { - *x -= etext->xofs_edit; - *y -= etext->yofs_edit; - } - - *x += etext->cx; - *y += etext->cy; - - if (coords == ATK_XY_WINDOW) { - window = gdk_window_get_toplevel (window); - gdk_window_get_origin (window, &x_window, &y_window); - *x -= x_window; - *y -= y_window; - } - else if (coords == ATK_XY_SCREEN) { - } - else { - *x = 0; - *y = 0; - *height = 0; - *width = 0; - } -} - - -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) -{ - GObject *obj; - EText *etext; - GnomeCanvas *canvas; - gint x_widget, y_widget, x_window, y_window; - GdkWindow *window; - GtkWidget *widget; - int index; - int trailing; - - g_return_val_if_fail (ATK_IS_GOBJECT_ACCESSIBLE(text), -1); - obj = atk_gobject_accessible_get_object (ATK_GOBJECT_ACCESSIBLE (text)); - if (obj == NULL) - return -1; - g_return_val_if_fail (E_IS_TEXT (obj), -1); - etext = E_TEXT(obj); - canvas = GNOME_CANVAS_ITEM(etext)->canvas; - widget = GTK_WIDGET(canvas); - window = widget->window; - gdk_window_get_origin (window, &x_widget, &y_widget); - - if (coords == ATK_XY_SCREEN) { - x = x - x_widget; - y = y - y_widget; - } - else if (coords == ATK_XY_WINDOW) { - window = gdk_window_get_toplevel (window); - gdk_window_get_origin (window, &x_window, &y_window); - x = x - x_widget + x_window; - y = y - y_widget + y_window; - } - else - return -1; - - if (etext->draw_borders) { - x -= 3; /*BORDER_INDENT;*/ - y -= 3; /*BORDER_INDENT;*/ - } - - x -= etext->xofs; - y -= etext->yofs; - - if (etext->editing) { - x += etext->xofs_edit; - y += etext->yofs_edit; - } - - x -= etext->cx; - y -= etext->cy; - - pango_layout_xy_to_index (etext->layout, - x * PANGO_SCALE - PANGO_SCALE / 2, - y * PANGO_SCALE - PANGO_SCALE / 2, - &index, - &trailing); - - return g_utf8_pointer_to_offset (etext->text, etext->text + index + trailing); -} - - -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) -{ - gint start, end, real_start, real_end, len; - EText *etext; - if (selection_num == 0) { - const char *full_text = et_get_full_text (text); - if (full_text == NULL) - return NULL; - len = g_utf8_strlen (full_text, -1); - etext = E_TEXT (atk_gobject_accessible_get_object (ATK_GOBJECT_ACCESSIBLE (text))); - start = MIN (etext->selection_start, etext->selection_end); - end = MAX (etext->selection_start, etext->selection_end); - start = MIN (MAX (0, start), len); - end = MIN (MAX (0, end), len); - if (start != end) { - if (start_offset) - *start_offset = start; - if (end_offset) - *end_offset = end; - real_start = g_utf8_offset_to_pointer (full_text, start) - full_text; - real_end = g_utf8_offset_to_pointer (full_text, end) - full_text; - return g_strndup (full_text + real_start, real_end - real_start); - } - } - - return NULL; -} - - -static gboolean -et_add_selection (AtkText *text, - gint start_offset, - gint end_offset) -{ - GObject *obj; - EText *etext; - - g_return_val_if_fail (ATK_IS_GOBJECT_ACCESSIBLE (text), FALSE); - obj = atk_gobject_accessible_get_object (ATK_GOBJECT_ACCESSIBLE (text)); - if (obj == NULL) - return FALSE; - g_return_val_if_fail (E_IS_TEXT (obj), FALSE); - etext = E_TEXT (obj); - - g_return_val_if_fail (start_offset >= 0, FALSE); - g_return_val_if_fail (start_offset >= -1, FALSE); - if (end_offset == -1) - end_offset = et_get_character_count (text); - - if (start_offset != end_offset) { - gint real_start, real_end; - real_start = MIN (start_offset, end_offset); - real_end = MAX (start_offset, end_offset); - etext->selection_start = real_start; - etext->selection_end = real_end; - - gnome_canvas_item_grab_focus (GNOME_CANVAS_ITEM (etext)); - gnome_canvas_item_request_update (GNOME_CANVAS_ITEM (etext)); - - g_signal_emit_by_name (ATK_OBJECT (text), "text_selection_changed"); - - return TRUE; - } - - return FALSE; -} - - -static gboolean -et_remove_selection (AtkText *text, - gint selection_num) -{ - GObject *obj; - EText *etext; - - g_return_val_if_fail (ATK_IS_GOBJECT_ACCESSIBLE (text), FALSE); - obj = atk_gobject_accessible_get_object (ATK_GOBJECT_ACCESSIBLE (text)); - if (obj == NULL) - return FALSE; - g_return_val_if_fail (E_IS_TEXT (obj), FALSE); - etext = E_TEXT (obj); - - if (selection_num == 0 - && etext->selection_start != etext->selection_end) { - etext->selection_end = etext->selection_start; - g_signal_emit_by_name (ATK_OBJECT(text), "text_selection_changed"); - return TRUE; - } - - return FALSE; -} - - -static gboolean -et_set_selection (AtkText *text, - gint selection_num, - gint start_offset, - gint end_offset) -{ - GObject *obj; - EText *etext; - int offset; - - g_return_val_if_fail (ATK_IS_GOBJECT_ACCESSIBLE (text), FALSE); - obj = atk_gobject_accessible_get_object (ATK_GOBJECT_ACCESSIBLE (text)); - if (obj == NULL) - return FALSE; - g_return_val_if_fail (E_IS_TEXT (obj), FALSE); - etext = E_TEXT (obj); - if (selection_num == 0) - return et_add_selection (text, start_offset, end_offset); - return FALSE; -} - - -static gboolean -et_set_caret_offset (AtkText *text, - gint offset) -{ - GObject *obj; - EText *etext; - - g_return_val_if_fail (ATK_IS_GOBJECT_ACCESSIBLE (text), FALSE); - obj = atk_gobject_accessible_get_object (ATK_GOBJECT_ACCESSIBLE (text)); - if (obj == NULL) - return FALSE; - - g_return_val_if_fail (E_IS_TEXT (obj), FALSE); - etext = E_TEXT (obj); - - if (offset < -1) - return FALSE; - else { - ETextEventProcessorCommand command; - - if (offset == -1) - offset = et_get_character_count (text); - - command.action = E_TEP_MOVE; - command.position = E_TEP_VALUE; - command.value = offset; - command.time = GDK_CURRENT_TIME; - g_signal_emit_by_name (etext->tep, "command", &command); - 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 */ - char *result; - - const char *full_text = et_get_full_text (ATK_TEXT (text)); - if (full_text == NULL) - return; - - 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) -{ - GObject *obj; - EText *etext; - - g_return_if_fail (ATK_IS_GOBJECT_ACCESSIBLE (text)); - obj = atk_gobject_accessible_get_object (ATK_GOBJECT_ACCESSIBLE (text)); - if (obj == NULL) - return; - - g_return_if_fail (E_IS_TEXT (obj)); - etext = E_TEXT (obj); - - if (start_pos != end_pos) { - etext->selection_start = start_pos; - etext->selection_end = end_pos; - e_text_copy_clipboard (etext); - } -} - -static void -et_delete_text (AtkEditableText *text, - gint start_pos, - gint end_pos) -{ - GObject *obj; - EText *etext; - - g_return_if_fail (ATK_IS_GOBJECT_ACCESSIBLE(text)); - obj = atk_gobject_accessible_get_object (ATK_GOBJECT_ACCESSIBLE (text)); - if (obj == NULL) - return; - - g_return_if_fail (E_IS_TEXT (obj)); - etext = E_TEXT (obj); - - etext->selection_start = start_pos; - etext->selection_end = end_pos; - - e_text_delete_selection (etext); -} - -static void -et_cut_text (AtkEditableText *text, - gint start_pos, - gint end_pos) -{ - et_copy_text (text, start_pos, end_pos); - et_delete_text (text, start_pos, end_pos); -} - -static void -et_paste_text (AtkEditableText *text, - gint position) -{ - GObject *obj; - EText *etext; - - g_return_if_fail (ATK_IS_GOBJECT_ACCESSIBLE (text)); - obj = atk_gobject_accessible_get_object (ATK_GOBJECT_ACCESSIBLE (text)); - if (obj == NULL) - return; - - g_return_if_fail (E_IS_TEXT (obj)); - etext = E_TEXT (obj); - - gtk_object_set (GTK_OBJECT (etext), - "cursor_pos", position, - NULL); - e_text_paste_clipboard (etext); -} - -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_reposition_cb (ETextModel *model, - ETextModelReposFn fn, - gpointer repos_data, - gpointer user_data) -{ - AtkObject *accessible; - AtkText *text; - - accessible = ATK_OBJECT (user_data); - text = ATK_TEXT (accessible); - - if (fn == e_repos_delete_shift) { - EReposDeleteShift *info = (EReposDeleteShift *) repos_data; - g_signal_emit_by_name (text, "text-changed::delete", info->pos, info->len); - } - else if (fn == e_repos_insert_shift) { - EReposInsertShift *info = (EReposInsertShift *) repos_data; - g_signal_emit_by_name (text, "text-changed::insert", info->pos, info->len); - } -} - -static void -_et_command_cb (ETextEventProcessor *tep, - ETextEventProcessorCommand *command, - gpointer user_data) -{ - AtkObject *accessible; - AtkText *text; - - accessible = ATK_OBJECT (user_data); - text = ATK_TEXT (accessible); - - switch (command->action) { - case E_TEP_MOVE: - g_signal_emit_by_name (text, "text-caret-moved", et_get_caret_offset (text)); - break; - case E_TEP_SELECT: - g_signal_emit_by_name (text, "text-selection-changed"); - break; - } -} - -static void -et_real_initialize (AtkObject *obj, - gpointer data) -{ - GalA11yEText *a11y; - EText *etext; - - ATK_OBJECT_CLASS (parent_class)->initialize (obj, data); - - g_return_if_fail (GAL_A11Y_IS_E_TEXT (obj)); - g_return_if_fail (E_IS_TEXT (data)); - - a11y = GAL_A11Y_E_TEXT (obj); - etext = E_TEXT (data); - - /* Set up signal callbacks */ - g_signal_connect (etext->model, "reposition", - G_CALLBACK (_et_reposition_cb), obj); - - g_signal_connect_after (etext->tep, "command", - (GCallback) _et_command_cb, obj); - - obj->role = ATK_ROLE_TEXT; -} - -static void -et_class_init (GalA11yETextClass *klass) -{ - GObjectClass *object_class = G_OBJECT_CLASS (klass); - AtkObjectClass *atk_class = ATK_OBJECT_CLASS (klass); - - quark_accessible_object = g_quark_from_static_string ("gtk-accessible-object"); - parent_class = g_type_class_ref (PARENT_TYPE); - component_parent_iface = g_type_interface_peek(parent_class, ATK_TYPE_COMPONENT); - object_class->dispose = et_dispose; - atk_class->initialize = et_real_initialize; -} - -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 deleted file mode 100644 index 66d2d6283b..0000000000 --- a/a11y/e-text/gal-a11y-e-text.h +++ /dev/null @@ -1,40 +0,0 @@ -/* -*- 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-factory.h b/a11y/gal-a11y-factory.h deleted file mode 100644 index 22da85eca8..0000000000 --- a/a11y/gal-a11y-factory.h +++ /dev/null @@ -1,94 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* GAL A11Y - * gal-a11y-factory.h - * - * Copyright 2003 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. - * - * Authors: - * Gilbert Fang <gilbert.fang@sun.com>, Sun Microsystem Inc. 2003. - * - * This file is mainly from the gailfactory.h of GAIL. - */ - -#ifndef _GAL_A11Y_FACTORY_H__ -#define _GAL_A11Y_FACTORY_H__ - -#include <glib-object.h> -#include <atk/atkobject.h> -#include <atk/atkobjectfactory.h> - -#define GAL_A11Y_FACTORY(type, type_as_function, opt_create_accessible) \ - \ -static GType \ -type_as_function ## _factory_get_accessible_type (void) \ -{ \ - return type; \ -} \ - \ -static AtkObject* \ -type_as_function ## _factory_create_accessible (GObject *obj) \ -{ \ - GtkWidget *widget; \ - AtkObject *accessible; \ - \ - g_return_val_if_fail (GTK_IS_WIDGET (obj), NULL); \ - \ - widget = GTK_WIDGET (obj); \ - \ - accessible = opt_create_accessible (widget); \ - \ - return accessible; \ -} \ - \ -static void \ -type_as_function ## _factory_class_init (AtkObjectFactoryClass *klass) \ -{ \ - klass->create_accessible = type_as_function ## _factory_create_accessible; \ - klass->get_accessible_type = type_as_function ## _factory_get_accessible_type;\ -} \ - \ -static GType \ -type_as_function ## _factory_get_type (void) \ -{ \ - static GType t = 0; \ - \ - if (!t) \ - { \ - char *name; \ - static const GTypeInfo tinfo = \ - { \ - sizeof (AtkObjectFactoryClass), \ - NULL, NULL, (GClassInitFunc) type_as_function ## _factory_class_init, \ - NULL, NULL, sizeof (AtkObjectFactory), 0, NULL, NULL \ - }; \ - \ - name = g_strconcat (g_type_name (type), "Factory", NULL); \ - t = g_type_register_static ( \ - ATK_TYPE_OBJECT_FACTORY, name, &tinfo, 0); \ - g_free (name); \ - } \ - \ - return t; \ -} - -#define GAL_A11Y_WIDGET_SET_FACTORY(widget_type, type_as_function) \ - atk_registry_set_factory_type (atk_get_default_registry (), \ - widget_type, \ - type_as_function ## _factory_get_type ()) - -#endif /* _GAL_A11Y_FACTORY_H__ */ diff --git a/a11y/gal-a11y-util.c b/a11y/gal-a11y-util.c deleted file mode 100644 index 0cf7c69dbb..0000000000 --- a/a11y/gal-a11y-util.c +++ /dev/null @@ -1,31 +0,0 @@ -/* -*- 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 deleted file mode 100644 index b7f742b122..0000000000 --- a/a11y/gal-a11y-util.h +++ /dev/null @@ -1,21 +0,0 @@ -/* -*- 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__ */ |