[evolution-patches] Seeking review for merging a11y patch to HEAD
- From: Gilbert Fang <gilbert fang sun com>
- To: Ettore Perazzoli <ettore ximian com>
- Cc: "evolution-patches ximian com" <evolution-patches ximian com>, "sceri-evolution-acc sun com" <sceri-evolution-acc sun com>
- Subject: [evolution-patches] Seeking review for merging a11y patch to HEAD
- Date: 18 Jul 2003 18:04:28 +0800
Hi, Ettore
As we agreed before, now it it the first time we want to merging our
a11y specific patch to HEAD.
Currently, the patches are not too many. They are :
=====
York
45119: checked in notify atk object when grab focus and cursor move
see attachment : gtkhtml.a11y.diff
the patch depend on the last patch of bug #44607. That patch ensure
cursor can navigate on every element in a mail.
And this patch expose focused atk object. After this patch gnopernicus
can read a mail when you navigate the mail using up/down arrow.
Most work locate in object.c, and the part in utils.c just check NULL
pointer and avoid crashes I met when debugging.
When the mail reader get focus or cursor move to a different object , we
atk_focus_tracker_notify() it.
Todo:
Need to complete atktext interface implementation,
======
Bolian
46435: ECalendar a11y dir setup. basic atk impl. for gnome-calendar and
e-day-view.
see attachment:a11y_setup_for_trunk.all
=======
Gilbert
46065 atk implementation for EPaned
46448 Program crash when use EPaned with GNOME_ACCESSIBILITY != 1
In fact, I merge the two patches into one because they actually finish
one thing.
EPaned is like GtkPaned, so I run-time inherited GalA11yEPaned from
GailContainer, which is also the super class of GailPaned. And the
implementation of GalA11yEPaned is more like what GailPaned does.
see attchment :merge.2003_07_18_15_18_51_bxm46065_bxm46448
I send all to you because I am not sure who in your side has expertise
to review them?
Thank you very much
Gilbert
Index: object.c
===================================================================
RCS file: /cvs/gnome/gtkhtml/a11y/object.c,v
retrieving revision 1.2
diff -u -r1.2 object.c
--- object.c 1 Nov 2002 15:34:27 -0000 1.2
+++ object.c 2 Jul 2003 03:45:38 -0000
@@ -146,6 +146,51 @@
{
}
+static AtkObject *
+gtk_html_a11y_get_focus_object (GtkWidget * widget)
+{
+ GtkHTML * html;
+ HTMLObject * htmlobj = NULL;
+ AtkObject *obj = NULL;
+
+ html = GTK_HTML(widget);
+ if (html->engine && html->engine->cursor)
+ htmlobj = html->engine->cursor->object;
+ if (htmlobj)
+ obj = html_utils_get_accessible (htmlobj, NULL);
+
+ return obj;
+}
+
+static void
+gtk_html_a11y_grab_focus_cb(GtkWidget * widget)
+{
+ AtkObject *focus_object, *obj;
+
+
+ focus_object = gtk_html_a11y_get_focus_object (widget);
+ obj = gtk_widget_get_accessible (widget);
+ g_object_set_data (obj, "gail-focus-object", focus_object);
+ atk_focus_tracker_notify (focus_object);
+
+}
+
+static void
+gtk_html_a11y_cursor_move_cb(GtkWidget *widget, GtkDirectionType dir_type, GtkHTMLCursorSkipType skip)
+{
+ AtkObject *focus_object, *obj;
+ static AtkObject * prev_object = NULL;
+
+ focus_object = gtk_html_a11y_get_focus_object (widget);
+ obj = gtk_widget_get_accessible (widget);
+
+ if (prev_object != focus_object) {
+ prev_object = focus_object;
+ g_object_set_data (obj, "gail-focus-object", focus_object);
+ atk_focus_tracker_notify (focus_object);
+ }
+}
+
AtkObject*
gtk_html_a11y_new (GtkWidget *widget)
{
@@ -160,6 +205,12 @@
atk_object_initialize (accessible, widget);
accessible->role = ATK_ROLE_HTML_CONTAINER;
+ g_signal_connect_after(widget, "grab_focus",
+ G_CALLBACK (gtk_html_a11y_grab_focus_cb),
+ NULL);
+ g_signal_connect_after(widget, "cursor_move",
+ G_CALLBACK(gtk_html_a11y_cursor_move_cb),
+ NULL);
/* printf ("created new gtkhtml accessible object\n"); */
Index: utils.c
===================================================================
RCS file: /cvs/gnome/gtkhtml/a11y/utils.c,v
retrieving revision 1.2
diff -u -r1.2 utils.c
--- utils.c 1 Nov 2002 15:34:27 -0000 1.2
+++ utils.c 2 Jul 2003 03:45:38 -0000
@@ -67,7 +67,8 @@
case HTML_TYPE_TEXTINPUT:
case HTML_TYPE_BUTTON:
case HTML_TYPE_CHECKBOX:
- accessible = gtk_widget_get_accessible (HTML_EMBEDDED (o)->widget);
+ if (HTML_EMBEDDED (o)-> widget)
+ accessible = gtk_widget_get_accessible (HTML_EMBEDDED (o)->widget);
break;
case HTML_TYPE_TEXTSLAVE: /* ignore */
break;
@@ -88,6 +89,8 @@
html_utils_get_accessible (HTMLObject *o, AtkObject *parent)
{
AtkObject *accessible;
+
+ g_return_val_if_failed(o != NULL, NULL);
accessible = html_object_get_data (o, ACCESSIBLE_ID);
Index: configure.in
===================================================================
RCS file: /cvs/gnome/evolution/configure.in,v
retrieving revision 1.592
diff -u -r1.592 configure.in
--- configure.in 30 Jun 2003 14:33:24 -0000 1.592
+++ configure.in 18 Jul 2003 06:37:59 -0000
@@ -251,6 +251,13 @@
dnl **************************************************
+dnl * Accessibility support
+dnl **************************************************
+PKG_CHECK_MODULES(A11Y, atk)
+AC_SUBST(A11Y_CFLAGS)
+AC_SUBST(A11Y_LIBS)
+
+dnl **************************************************
dnl * IPv6 support
dnl **************************************************
AC_ARG_ENABLE(ipv6, [ --enable-ipv6=[no/yes] Enable support for resolving IPv6 addresses.],,enable_ipv6=no)
@@ -1285,6 +1292,8 @@
AC_OUTPUT([ po/Makefile.in
Makefile
+a11y/Makefile
+a11y/calendar/Makefile
addressbook/Makefile
addressbook/gui/Makefile
addressbook/gui/component/Makefile
Index: Makefile.am
===================================================================
RCS file: /cvs/gnome/evolution/Makefile.am,v
retrieving revision 1.82
diff -u -r1.82 Makefile.am
--- Makefile.am 30 Jun 2003 14:33:24 -0000 1.82
+++ Makefile.am 18 Jul 2003 06:37:59 -0000
@@ -33,6 +33,7 @@
camel \
filter \
addressbook \
+ a11y \
calendar \
my-evolution \
art \
Index: calendar/gui/Makefile.am
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/Makefile.am,v
retrieving revision 1.268
diff -u -r1.268 Makefile.am
--- calendar/gui/Makefile.am 11 Jun 2003 04:09:29 -0000 1.268
+++ calendar/gui/Makefile.am 18 Jul 2003 06:44:49 -0000
@@ -73,6 +73,7 @@
-I$(top_srcdir)/addressbook/backend \
-I$(top_builddir)/addressbook/backend \
-I$(top_srcdir)/widgets \
+ -I$(top_srcdir)/a11y/calendar \
-DEVOLUTION_DATADIR=\""$(datadir)"\" \
-DEVOLUTION_GLADEDIR=\""$(gladedir)"\" \
-DEVOLUTION_ETSPECDIR=\""$(etspecdir)"\" \
@@ -188,6 +189,7 @@
$(top_builddir)/calendar/gui/dialogs/libcal-dialogs.la \
$(top_builddir)/widgets/e-timezone-dialog/libetimezonedialog.la \
$(top_builddir)/widgets/misc/libemiscwidgets.la \
+ $(top_builddir)/a11y/libevolution-a11y.la \
$(EVOLUTION_CALENDAR_LIBS)
libevolution_calendar_la_LDFLAGS = -avoid-version -module
Index: calendar/gui/e-day-view.c
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/e-day-view.c,v
retrieving revision 1.202
diff -u -r1.202 e-day-view.c
--- calendar/gui/e-day-view.c 16 Jul 2003 09:17:24 -0000 1.202
+++ calendar/gui/e-day-view.c 18 Jul 2003 06:45:06 -0000
@@ -29,6 +29,7 @@
#include <config.h>
#include "e-day-view.h"
+#include "ea-calendar.h"
#include <math.h>
#include <time.h>
@@ -539,6 +540,8 @@
/* clipboard atom */
if (!clipboard_atom)
clipboard_atom = gdk_atom_intern ("CLIPBOARD", FALSE);
+ /* init the accessibility support for e_day_view */
+ e_day_view_a11y_init ();
}
Index: calendar/gui/gnome-cal.c
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/gnome-cal.c,v
retrieving revision 1.246
diff -u -r1.246 gnome-cal.c
--- calendar/gui/gnome-cal.c 16 Jul 2003 23:15:03 -0000 1.246
+++ calendar/gui/gnome-cal.c 18 Jul 2003 06:45:10 -0000
@@ -57,6 +57,7 @@
#include "calendar-view-factory.h"
#include "tag-calendar.h"
#include "misc.h"
+#include "ea-calendar.h"
extern ECompEditorRegistry *comp_editor_registry;
@@ -353,6 +354,9 @@
"goto_date",1,
G_TYPE_ENUM,
GNOME_CAL_GOTO_SAME_DAY_OF_NEXT_WEEK);
+ /* init the accessibility support for gnome_calendar */
+ gnome_calendar_a11y_init ();
+
}
/* Callback used when the calendar query reports of an updated object */
@@ -3260,3 +3264,10 @@
return E_CALENDAR_TABLE (gcal->priv->todo);
}
+GtkWidget *
+gnome_calendar_get_e_calendar_widget (GnomeCalendar *gcal)
+{
+ g_return_val_if_fail (GNOME_IS_CALENDAR (gcal), NULL);
+
+ return GTK_WIDGET(gcal->priv->date_navigator);
+}
Index: calendar/gui/gnome-cal.h
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/gnome-cal.h,v
retrieving revision 1.84
diff -u -r1.84 gnome-cal.h
--- calendar/gui/gnome-cal.h 16 Jul 2003 23:15:04 -0000 1.84
+++ calendar/gui/gnome-cal.h 18 Jul 2003 06:45:11 -0000
@@ -124,6 +124,8 @@
gboolean range_selected, gboolean grab_focus);
GtkWidget *gnome_calendar_get_current_view_widget (GnomeCalendar *gcal);
+GtkWidget *gnome_calendar_get_e_calendar_widget (GnomeCalendar *gcal);
+
void gnome_calendar_setup_view_menus (GnomeCalendar *gcal, BonoboUIComponent *uic);
void gnome_calendar_discard_view_menus (GnomeCalendar *gcal);
Index: a11y/ChangeLog
===================================================================
RCS file: a11y/ChangeLog
diff -N a11y/ChangeLog
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ a11y/ChangeLog 18 Jul 2003 02:41:10 -0000 1.1.2.3
@@ -0,0 +1,26 @@
+2003-07-18 Gilbert Fang <gilbert fang sun com>
+
+ ** bug #44592 reopen, no need to do explicitly init for a11y.
+ * init.c: removed
+ * Makefile.am: remove init.c from building.
+
+2003-07-17 Bolian Yin <bolian yin sun com>
+ * init.c: init calendar a11y support
+ * Makefile.am: add calendar lib
+ New files are:
+ ea-factory.h
+ calendar/ea-calendar.c
+ calendar/ea-calendar.h
+ calendar/ea-day-view-event-factory.c
+ calendar/ea-day-view-event-factory.h
+ calendar/ea-day-view-event.c
+ calendar/ea-day-view-event.h
+ calendar/ea-day-view.c
+ calendar/ea-day-view.h
+ calendar/ea-gnome-calendar.c
+ calendar/ea-gnome-calendar.h
+
+2003-06-26 Gilbert Fang <gilbert fang sun com>
+
+ * init.c: Initial new file for libevolution-a11y.so framework.
+ * Makefile.am: Initial new file (bug #44592)
Index: a11y/Makefile.am
===================================================================
RCS file: a11y/Makefile.am
diff -N a11y/Makefile.am
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ a11y/Makefile.am 18 Jul 2003 02:41:10 -0000 1.1.2.7
@@ -0,0 +1,35 @@
+# Calendar IDL files
+
+CALENDAR_IDLS = $(top_srcdir)/calendar/idl/evolution-calendar.idl
+
+CALENDAR_IDL_GENERATED_H = evolution-calendar.h
+
+$(CALENDAR_IDL_GENERATED_H): $(CALENDAR_IDLS)
+ $(ORBIT_IDL) -I $(srcdir) $(IDL_INCLUDES) \
+ $(top_srcdir)/calendar/idl/evolution-calendar.idl
+
+SUBDIRS = calendar
+
+INCLUDES = \
+ -DPREFIX=\"$(prefix)\" \
+ -DSYSCONFDIR=\"$(sysconfdir)\" \
+ -DDATADIR=\"$(datadir)\" \
+ -DLIBDIR=\"$(libdir)\" \
+ -DG_LOG_DOMAIN=\"evolution-a11y\" \
+ -I$(top_srcdir) \
+ -DG_DISABLE_DEPRECATED \
+ -DLIBGNOME_DISABLE_DEPRECATED \
+ $(EVOLUTION_CALENDAR_CFLAGS) \
+ $(A11Y_CFLAGS)
+
+privlib_LTLIBRARIES = libevolution-a11y.la
+
+libevolution_a11y_la_SOURCES = \
+ $(CALENDAR_IDL_GENERATED_H)
+
+
+BUILT_SOURCES = $(CALENDAR_IDL_GENERATED_H)
+
+libevolution_a11y_la_LIBADD = \
+ $(A11Y_LIBS) \
+ $(top_builddir)/a11y/calendar/libevolution-calendar-a11y.la
Index: a11y/ea-factory.h
===================================================================
RCS file: a11y/ea-factory.h
diff -N a11y/ea-factory.h
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ a11y/ea-factory.h 16 Jul 2003 07:09:02 -0000 1.1.2.1
@@ -0,0 +1,94 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/* vim:expandtab:shiftwidth=4:tabstop=4:
+ */
+/* Evolution Accessibility: ea-factory.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: Bolian Yin <bolian yin sun com> Sun Microsystem Inc., 2003
+ *
+ */
+
+/* Evolution Accessibility
+*/
+
+#ifndef _EA_FACTORY_H__
+#define _EA_FACTORY_H__
+
+#include <glib-object.h>
+#include <atk/atkobject.h>
+
+#define EA_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 EA_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 /* _EA_FACTORY_H__ */
Index: a11y/init.c
===================================================================
RCS file: a11y/init.c
diff -N a11y/init.c
Index: a11y/calendar/Makefile.am
===================================================================
RCS file: a11y/calendar/Makefile.am
diff -N a11y/calendar/Makefile.am
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ a11y/calendar/Makefile.am 16 Jul 2003 07:09:02 -0000 1.1.2.1
@@ -0,0 +1,29 @@
+
+noinst_LTLIBRARIES = libevolution-calendar-a11y.la
+
+INCLUDES = \
+ -DG_LOG_DOMAIN=\"evolution-a11y\" \
+ -I$(top_srcdir)/shell \
+ -I$(top_srcdir)/calendar \
+ -I$(top_srcdir)/calendar/cal-client \
+ -I$(top_srcdir)/libical/src/libical \
+ -I$(top_srcdir)/calendar/gui \
+ -I$(top_srcdir)/widgets \
+ -I$(top_srcdir)/a11y \
+ -DEVOLUTION_DATADIR=\""$(datadir)"\" \
+ -DEVOLUTION_GLADEDIR=\""$(gladedir)"\" \
+ -DEVOLUTION_ETSPECDIR=\""$(etspecdir)"\" \
+ -DEVOLUTION_IMAGESDIR=\""$(imagesdir)"\" \
+ -DEVOLUTION_GALVIEWSDIR=\""$(viewsdir)"\" \
+ -DEVOLUTION_UIDIR=\""$(evolutionuidir)"\" \
+ -DG_DISABLE_DEPRECATED \
+ -DPREFIX=\""$(prefix)"\" \
+ $(A11Y_CFLAGS) \
+ $(EVOLUTION_CALENDAR_CFLAGS)
+
+libevolution_calendar_a11y_la_SOURCES = \
+ ea-calendar.c \
+ ea-day-view.c \
+ ea-day-view-event.c \
+ ea-day-view-event-factory.c \
+ ea-gnome-calendar.c
Index: a11y/calendar/ea-calendar.c
===================================================================
RCS file: a11y/calendar/ea-calendar.c
diff -N a11y/calendar/ea-calendar.c
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ a11y/calendar/ea-calendar.c 16 Jul 2003 07:09:02 -0000 1.1.2.1
@@ -0,0 +1,57 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/* vim:expandtab:shiftwidth=4:tabstop=4:
+ */
+/* Evolution Accessibility: ea-calendar.c
+ *
+ * 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: Bolian Yin <bolian yin sun com> Sun Microsystem Inc., 2003
+ *
+ */
+
+#include "ea-factory.h"
+#include "ea-calendar.h"
+
+#include "calendar/ea-day-view.h"
+#include "calendar/ea-day-view-event.h"
+#include "calendar/ea-gnome-calendar.h"
+
+EA_FACTORY (EA_TYPE_DAY_VIEW, ea_day_view, ea_day_view_new);
+EA_FACTORY (EA_TYPE_GNOME_CALENDAR, ea_gnome_calendar, ea_gnome_calendar_new);
+
+/* ea_calendar_init will register all the atk factories for calendar,
+ * other init's will register specific factories for their widgets
+ */
+void
+ea_calendar_init (void)
+{
+ EA_SET_FACTORY (gnome_calendar_get_type(), ea_gnome_calendar);
+ EA_SET_FACTORY (e_day_view_get_type(), ea_day_view);
+}
+
+void
+gnome_calendar_a11y_init (void)
+{
+ EA_SET_FACTORY (gnome_calendar_get_type(), ea_gnome_calendar);
+
+}
+
+void
+e_day_view_a11y_init (void)
+{
+ EA_SET_FACTORY (e_day_view_get_type(), ea_day_view);
+}
Index: a11y/calendar/ea-calendar.h
===================================================================
RCS file: a11y/calendar/ea-calendar.h
diff -N a11y/calendar/ea-calendar.h
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ a11y/calendar/ea-calendar.h 16 Jul 2003 07:09:02 -0000 1.1.2.1
@@ -0,0 +1,36 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/* vim:expandtab:shiftwidth=4:tabstop=4:
+ */
+/* Evolution Accessibility: ea-calendar.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: Bolian Yin <bolian yin sun com> Sun Microsystem Inc., 2003
+ *
+ */
+
+/* Evolution Accessibility
+*/
+
+#ifndef _EA_CALENDAR_H__
+#define _EA_CALENDAR_H__
+
+void ea_calendar_init (void);
+void gnome_calendar_a11y_init (void);
+void e_day_view_a11y_init (void);
+
+#endif /* _EA_CALENDAR_H__ */
Index: a11y/calendar/ea-day-view-event-factory.c
===================================================================
RCS file: a11y/calendar/ea-day-view-event-factory.c
diff -N a11y/calendar/ea-day-view-event-factory.c
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ a11y/calendar/ea-day-view-event-factory.c 16 Jul 2003 07:09:02 -0000 1.1.2.1
@@ -0,0 +1,83 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/* vim:expandtab:shiftwidth=4:tabstop=4:
+ */
+/* Evolution Accessibility: ea-day-view-event-factory.c
+ *
+ * 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: Bolian Yin <bolian yin sun com> Sun Microsystem Inc., 2003
+ *
+ */
+
+#include <gtk/gtk.h>
+#include "ea-day-view-event-factory.h"
+#include "ea-day-view-event.h"
+
+static void ea_day_view_event_factory_class_init (EaDayViewEventFactoryClass *klass);
+
+static AtkObject* ea_day_view_event_factory_create_accessible (GObject *obj);
+
+static GType ea_day_view_event_factory_get_accessible_type (void);
+
+GType
+ea_day_view_event_factory_get_type (void)
+{
+ static GType type = 0;
+
+ if (!type)
+ {
+ static const GTypeInfo tinfo =
+ {
+ sizeof (EaDayViewEventFactoryClass),
+ (GBaseInitFunc) NULL, /* base init */
+ (GBaseFinalizeFunc) NULL, /* base finalize */
+ (GClassInitFunc) ea_day_view_event_factory_class_init, /* class init */
+ (GClassFinalizeFunc) NULL, /* class finalize */
+ NULL, /* class data */
+ sizeof (EaDayViewEventFactory), /* instance size */
+ 0, /* nb preallocs */
+ (GInstanceInitFunc) NULL, /* instance init */
+ NULL /* value table */
+ };
+ type = g_type_register_static (
+ ATK_TYPE_OBJECT_FACTORY,
+ "EaDayViewEventFactory" , &tinfo, 0);
+ }
+
+ return type;
+}
+
+static void
+ea_day_view_event_factory_class_init (EaDayViewEventFactoryClass *klass)
+{
+ AtkObjectFactoryClass *class = ATK_OBJECT_FACTORY_CLASS (klass);
+
+ class->create_accessible = ea_day_view_event_factory_create_accessible;
+ class->get_accessible_type = ea_day_view_event_factory_get_accessible_type;
+}
+
+static AtkObject*
+ea_day_view_event_factory_create_accessible (GObject *obj)
+{
+ return ea_day_view_event_new (obj);
+}
+
+static GType
+ea_day_view_event_factory_get_accessible_type (void)
+{
+ return EA_TYPE_DAY_VIEW_EVENT;
+}
Index: a11y/calendar/ea-day-view-event-factory.h
===================================================================
RCS file: a11y/calendar/ea-day-view-event-factory.h
diff -N a11y/calendar/ea-day-view-event-factory.h
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ a11y/calendar/ea-day-view-event-factory.h 16 Jul 2003 07:09:02 -0000 1.1.2.1
@@ -0,0 +1,64 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/* vim:expandtab:shiftwidth=4:tabstop=4:
+ */
+/* Evolution Accessibility: ea-day-view-event-factory.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: Bolian Yin <bolian yin sun com> Sun Microsystem Inc., 2003
+ *
+ */
+
+#ifndef __EA_DAY_VIEW_EVENT_FACTORY_H__
+#define __EA_DAY_VIEW_EVENT_FACTORY_H__
+
+#include <atk/atkobjectfactory.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+#define EA_TYPE_DAY_VIEW_EVENT_FACTORY (ea_day_view_event_factory_get_type ())
+#define EA_DAY_VIEW_EVENT_FACTORY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EA_TYPE_DAY_VIEW_EVENT_FACTORY, EaDayViewEventFactory))
+#define EA_DAY_VIEW_EVENT_FACTORY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), EA_TYPE_DAY_VIEW_EVENT_FACTORY, EaDayViewEventFactoryClass))
+#define EA_IS_DAY_VIEW_EVENT_FACTORY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EA_TYPE_DAY_VIEW_EVENT_FACTORY))
+#define EA_IS_DAY_VIEW_EVENT_FACTORY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), EA_TYPE_DAY_VIEW_EVENT_FACTORY))
+#define EA_DAY_VIEW_EVENT_FACTORY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), EA_TYPE_DAY_VIEW_EVENT_FACTORY, EaDayViewEventFactoryClass))
+
+
+typedef struct _EaDayViewEventFactory EaDayViewEventFactory;
+typedef struct _EaDayViewEventFactoryClass EaDayViewEventFactoryClass;
+
+struct _EaDayViewEventFactory
+{
+ AtkObjectFactory parent;
+};
+
+struct _EaDayViewEventFactoryClass
+{
+ AtkObjectFactoryClass parent_class;
+};
+
+GType ea_day_view_event_factory_get_type(void);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+
+#endif /* __EA_DAY_VIEW_EVENT_FACTORY_H__ */
+
Index: a11y/calendar/ea-day-view-event.c
===================================================================
RCS file: a11y/calendar/ea-day-view-event.c
diff -N a11y/calendar/ea-day-view-event.c
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ a11y/calendar/ea-day-view-event.c 16 Jul 2003 07:09:02 -0000 1.1.2.1
@@ -0,0 +1,285 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/* vim:expandtab:shiftwidth=4:tabstop=4:
+ */
+/* Evolution Accessibility: ea-day-view.c
+ *
+ * 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: Bolian Yin <bolian yin sun com> Sun Microsystem Inc., 2003
+ *
+ */
+
+#include "ea-day-view-event.h"
+#include <gal/e-text/e-text.h>
+
+static void ea_day_view_event_class_init (EaDayViewEventClass *klass);
+
+static G_CONST_RETURN gchar* ea_day_view_event_get_name (AtkObject *accessible);
+static G_CONST_RETURN gchar* ea_day_view_event_get_description (AtkObject *accessible);
+static AtkObject* ea_day_view_event_get_parent (AtkObject *accessible);
+static AtkStateSet* ea_day_view_event_ref_state_set (AtkObject *accessible);
+static gint ea_day_view_event_get_index_in_parent (AtkObject *accessible);
+
+static void atk_component_interface_init (AtkComponentIface *iface);
+
+static void ea_day_view_event_get_extents (AtkComponent *component,
+ gint *x,
+ gint *y,
+ gint *width,
+ gint *height,
+ AtkCoordType coord_type);
+
+static void ea_day_view_event_real_initialize (AtkObject *obj,
+ gpointer data);
+
+static gpointer impl_inherit_class = NULL;
+
+GType
+ea_day_view_event_get_type (void)
+{
+ static GType type = 0;
+
+ if (!type) {
+ static const GTypeInfo tinfo = {
+ sizeof (EaDayViewEventClass),
+ (GBaseInitFunc) NULL, /* base init */
+ (GBaseFinalizeFunc) NULL, /* base finalize */
+ (GClassInitFunc) ea_day_view_event_class_init, /* class init */
+ (GClassFinalizeFunc) NULL, /* class finalize */
+ NULL, /* class data */
+ sizeof (EaDayViewEvent), /* instance size */
+ 0, /* nb preallocs */
+ (GInstanceInitFunc) NULL, /* instance init */
+ NULL /* value table */
+ };
+
+ static const GInterfaceInfo atk_component_info = {
+ (GInterfaceInitFunc) atk_component_interface_init,
+ (GInterfaceFinalizeFunc) NULL,
+ NULL
+ };
+
+ type = g_type_register_static (ATK_TYPE_GOBJECT_ACCESSIBLE,
+ "EaDayViewEvent", &tinfo, 0);
+ g_type_add_interface_static (type, ATK_TYPE_COMPONENT,
+ &atk_component_info);
+ }
+
+ return type;
+}
+
+static void
+ea_day_view_event_class_init (EaDayViewEventClass *klass)
+{
+ AtkObjectFactory *factory;
+ AtkRegistry *default_registry;
+ GType impl_inherit_type;
+ AtkObjectClass *class = ATK_OBJECT_CLASS (klass);
+
+ default_registry = atk_get_default_registry ();
+ factory = atk_registry_get_factory (default_registry,
+ E_TYPE_TEXT);
+ impl_inherit_type = atk_object_factory_get_accessible_type (factory);
+ impl_inherit_class = g_type_class_ref (impl_inherit_type);
+
+ /*
+ klass->notify_gtk = ea_day_view_event_real_notify_gtk;
+ klass->focus_gtk = ea_day_view_event_real_focus_gtk;
+
+ accessible_class->connect_widget_destroyed = ea_day_view_event_connect_widget_destroyed;
+ */
+
+ class->get_name = ea_day_view_event_get_name;
+ class->get_description = ea_day_view_event_get_description;
+ class->get_parent = ea_day_view_event_get_parent;
+ /*
+ class->ref_state_set = ea_day_view_event_ref_state_set;
+ */
+ class->get_index_in_parent = ea_day_view_event_get_index_in_parent;
+ class->initialize = ea_day_view_event_real_initialize;
+}
+
+static void
+ea_day_view_event_real_initialize (AtkObject *obj,
+ gpointer data)
+{
+ EaDayViewEvent *ea_event;
+
+ ea_event = EA_DAY_VIEW_EVENT (obj);
+ ea_event->event = (EDayViewEvent *) (data);
+
+ /* initialize the accessible object of e_text with
+ * the e_text of current event
+ */
+ ATK_OBJECT_CLASS (impl_inherit_class)->initialize (obj,
+ ea_event->event->canvas_item);
+
+ obj->role = ATK_ROLE_TEXT;
+}
+
+AtkObject*
+ea_day_view_event_new (GObject *obj)
+{
+ EDayViewEvent *event;
+ AtkObject *object;
+
+ event = (EDayViewEvent *)obj;
+ object = ATK_OBJECT(g_object_new (EA_TYPE_DAY_VIEW_EVENT, NULL));
+ atk_object_initialize (object, event);
+
+ printf ("a day view event created\n");
+
+ return object;
+}
+
+static G_CONST_RETURN gchar*
+ea_day_view_event_get_name (AtkObject *accessible)
+{
+ if (!accessible->name)
+ atk_object_set_name(accessible, "day view event");
+ return accessible->name;
+}
+
+static G_CONST_RETURN gchar*
+ea_day_view_event_get_description (AtkObject *accessible)
+{
+ if (!accessible->description)
+ atk_object_set_description(accessible,
+ "day view event");
+ return accessible->description;
+}
+
+static AtkObject*
+ea_day_view_event_get_parent (AtkObject *accessible)
+{
+ AtkGObjectAccessible *atk_gobj;
+ GObject *g_obj;
+ GnomeCanvasItem *canvas_item;
+ GnomeCanvas *canvas;
+ GtkWidget *day_view;
+
+ g_return_val_if_fail (EA_IS_DAY_VIEW_EVENT (accessible), NULL);
+ atk_gobj = ATK_GOBJECT_ACCESSIBLE (accessible);
+
+ g_obj = atk_gobject_accessible_get_object (atk_gobj);
+ if (g_obj == NULL)
+ /* Object is defunct */
+ return NULL;
+
+ /* canvas_item is the e_text for the event */
+ /* canvas_item->canvas is the ECanvas for day view */
+ /* parent of canvas_item->canvas is the EDayView, our target widget */
+ canvas_item = GNOME_CANVAS_ITEM (g_obj);
+ canvas = canvas_item->canvas;
+ day_view = gtk_widget_get_parent (GTK_WIDGET(canvas));
+ if (!E_IS_DAY_VIEW (day_view))
+ return NULL;
+
+ return gtk_widget_get_accessible (day_view);
+}
+
+static AtkStateSet*
+ea_day_view_event_ref_state_set (AtkObject *accessible)
+{
+ return ATK_OBJECT_CLASS (impl_inherit_class)->ref_state_set (accessible);
+}
+
+static gint
+ea_day_view_event_get_index_in_parent (AtkObject *accessible)
+{
+ GtkAccessible *ea_parent;
+ EaDayViewEvent *ea_event;
+ EDayView *day_view;
+
+ EDayViewEvent *event;
+ gint day, event_num;
+
+ g_return_val_if_fail (EA_IS_DAY_VIEW_EVENT (accessible), -1);
+ ea_event = EA_DAY_VIEW_EVENT (accessible);
+ if (!ea_event->event)
+ return -1;
+
+ ea_parent = GTK_ACCESSIBLE (atk_object_get_parent (accessible));
+ if (!ea_parent)
+ return -1;
+
+ day_view = E_DAY_VIEW (ea_parent->widget);
+
+ /* the long event comes first in the order */
+ for (event_num = day_view->long_events->len - 1; event_num >= 0;
+ event_num--) {
+ event = &g_array_index (day_view->long_events,
+ EDayViewEvent, event_num);
+ if (ea_event->event == event)
+ return event_num;
+
+ }
+
+ for (day = 0; day < day_view->days_shown; day++) {
+ for (event_num = day_view->events[day]->len - 1; event_num >= 0;
+ event_num--) {
+ event = &g_array_index (day_view->events[day],
+ EDayViewEvent, event_num);
+ if (ea_event->event == event)
+ return day_view->long_events->len + event_num;
+ }
+ }
+
+ return -1;
+}
+
+static void
+atk_component_interface_init (AtkComponentIface *iface)
+{
+ g_return_if_fail (iface != NULL);
+
+ /*
+ * Use default implementation for contains and get_position
+ */
+
+ /*
+ iface->add_focus_handler = ea_day_view_event_add_focus_handler;
+ */
+ iface->get_extents = ea_day_view_event_get_extents;
+
+ /*
+ iface->get_size = ea_day_view_event_get_size;
+ iface->get_layer = ea_day_view_event_get_layer;
+ iface->grab_focus = ea_day_view_event_grab_focus;
+ iface->remove_focus_handler = ea_day_view_event_remove_focus_handler;
+ iface->set_extents = ea_day_view_event_set_extents;
+ iface->set_position = ea_day_view_event_set_position;
+ iface->set_size = ea_day_view_event_set_size;
+ */
+}
+
+static void
+ea_day_view_event_get_extents (AtkComponent *component,
+ gint *x,
+ gint *y,
+ gint *width,
+ gint *height,
+ AtkCoordType coord_type)
+{
+ AtkComponentIface *atk_component_iface =
+ g_type_interface_peek (impl_inherit_class, ATK_TYPE_COMPONENT);
+
+ if (atk_component_iface)
+ atk_component_iface->get_extents(component, x, y, width, height,
+ coord_type);
+
+}
Index: a11y/calendar/ea-day-view-event.h
===================================================================
RCS file: a11y/calendar/ea-day-view-event.h
diff -N a11y/calendar/ea-day-view-event.h
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ a11y/calendar/ea-day-view-event.h 16 Jul 2003 07:09:02 -0000 1.1.2.1
@@ -0,0 +1,66 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/* vim:expandtab:shiftwidth=4:tabstop=4:
+ */
+/* Evolution Accessibility: ea-day-view-event.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: Bolian Yin <bolian yin sun com> Sun Microsystem Inc., 2003
+ *
+ */
+
+#ifndef __EA_DAY_VIEW_EVENT_H__
+#define __EA_DAY_VIEW_EVENT_H__
+
+#include <gtk/gtkaccessible.h>
+#include "ea-day-view.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+#define EA_TYPE_DAY_VIEW_EVENT (ea_day_view_event_get_type ())
+#define EA_DAY_VIEW_EVENT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EA_TYPE_DAY_VIEW_EVENT, EaDayViewEvent))
+#define EA_DAY_VIEW_EVENT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), EA_TYPE_DAY_VIEW_EVENT, EaDayViewEventClass))
+#define EA_IS_DAY_VIEW_EVENT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EA_TYPE_DAY_VIEW_EVENT))
+#define EA_IS_DAY_VIEW_EVENT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), EA_TYPE_DAY_VIEW_EVENT))
+#define EA_DAY_VIEW_EVENT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), EA_TYPE_DAY_VIEW_EVENT, EaDayViewEventClass))
+
+typedef struct _EaDayViewEvent EaDayViewEvent;
+typedef struct _EaDayViewEventClass EaDayViewEventClass;
+
+struct _EaDayViewEvent
+{
+ AtkGObjectAccessible parent;
+ EDayViewEvent *event;
+};
+
+GType ea_day_view_event_get_type (void);
+
+struct _EaDayViewEventClass
+{
+ AtkGObjectAccessibleClass parent_class;
+};
+
+AtkObject* ea_day_view_event_new (GObject *gobject);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+
+#endif /* __EA_DAY_VIEW_EVENT_H__ */
Index: a11y/calendar/ea-day-view.c
===================================================================
RCS file: a11y/calendar/ea-day-view.c
diff -N a11y/calendar/ea-day-view.c
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ a11y/calendar/ea-day-view.c 16 Jul 2003 07:09:02 -0000 1.1.2.1
@@ -0,0 +1,380 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/* vim:expandtab:shiftwidth=4:tabstop=4:
+ */
+/* Evolution Accessibility: ea-day-view.c
+ *
+ * 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: Bolian Yin <bolian yin sun com> Sun Microsystem Inc., 2003
+ *
+ */
+
+#include "ea-day-view.h"
+
+static void ea_day_view_class_init (EaDayViewClass *klass);
+
+static G_CONST_RETURN gchar* ea_day_view_get_name (AtkObject *accessible);
+static G_CONST_RETURN gchar* ea_day_view_get_description (AtkObject *accessible);
+static AtkObject* ea_day_view_get_parent (AtkObject *accessible);
+static gint ea_day_view_get_n_children (AtkObject *obj);
+static AtkObject* ea_day_view_ref_child (AtkObject *obj,
+ gint i);
+static AtkStateSet* ea_day_view_ref_state_set (AtkObject *accessible);
+static gint ea_day_view_get_index_in_parent (AtkObject *accessible);
+
+static void atk_component_interface_init (AtkComponentIface *iface);
+
+static void ea_day_view_get_extents (AtkComponent *component,
+ gint *x,
+ gint *y,
+ gint *width,
+ gint *height,
+ AtkCoordType coord_type);
+
+static void ea_day_view_real_initialize (AtkObject *obj,
+ gpointer data);
+
+static gpointer parent_class = NULL;
+
+GType
+ea_day_view_get_type (void)
+{
+ static GType type = 0;
+ AtkObjectFactory *factory;
+ GTypeQuery query;
+ GType derived_atk_type;
+
+ if (!type) {
+ static const GTypeInfo tinfo = {
+ sizeof (EaDayViewClass),
+ (GBaseInitFunc) NULL, /* base init */
+ (GBaseFinalizeFunc) NULL, /* base finalize */
+ (GClassInitFunc) ea_day_view_class_init, /* class init */
+ (GClassFinalizeFunc) NULL, /* class finalize */
+ NULL, /* class data */
+ sizeof (EaDayView), /* instance size */
+ 0, /* nb preallocs */
+ (GInstanceInitFunc) NULL, /* instance init */
+ NULL /* value table */
+ };
+
+ static const GInterfaceInfo atk_component_info = {
+ (GInterfaceInitFunc) atk_component_interface_init,
+ (GInterfaceFinalizeFunc) NULL,
+ NULL
+ };
+
+ /*
+ * Figure out the size of the class and instance
+ * we are run-time deriving from (GailWidget, in this case)
+ */
+
+ factory = atk_registry_get_factory (atk_get_default_registry (),
+ GTK_TYPE_WIDGET);
+ derived_atk_type = atk_object_factory_get_accessible_type (factory);
+ g_type_query (derived_atk_type, &query);
+
+ tinfo.class_size = query.class_size;
+ tinfo.instance_size = query.instance_size;
+
+ type = g_type_register_static (derived_atk_type,
+ "EaDayView", &tinfo, 0);
+
+
+ g_type_add_interface_static (type, ATK_TYPE_COMPONENT,
+ &atk_component_info);
+ }
+
+ return type;
+}
+
+static void
+ea_day_view_class_init (EaDayViewClass *klass)
+{
+ AtkObjectFactory *factory;
+ AtkRegistry *default_registry;
+ AtkObjectClass *class = ATK_OBJECT_CLASS (klass);
+
+ parent_class = g_type_class_peek_parent (klass);
+
+ /*
+ klass->notify_gtk = ea_day_view_real_notify_gtk;
+ klass->focus_gtk = ea_day_view_real_focus_gtk;
+
+ accessible_class->connect_widget_destroyed = ea_day_view_connect_widget_destroyed;
+ */
+
+ class->get_name = ea_day_view_get_name;
+ class->get_description = ea_day_view_get_description;
+ class->ref_state_set = ea_day_view_ref_state_set;
+
+ class->get_parent = ea_day_view_get_parent;
+ class->get_index_in_parent = ea_day_view_get_index_in_parent;
+ class->get_n_children = ea_day_view_get_n_children;
+ class->ref_child = ea_day_view_ref_child;
+
+ class->initialize = ea_day_view_real_initialize;
+}
+
+/**
+ * This function specifies the GtkWidget for which the EaDayView was created
+ * and specifies a handler to be called when the GtkWidget is destroyed.
+ **/
+static void
+ea_day_view_real_initialize (AtkObject *obj,
+ gpointer data)
+{
+ GtkAccessible *accessible;
+ GtkWidget *widget;
+
+ g_return_if_fail (GTK_IS_WIDGET (data));
+
+ widget = GTK_WIDGET (data);
+
+ accessible = GTK_ACCESSIBLE (obj);
+ accessible->widget = widget;
+ gtk_accessible_connect_widget_destroyed (accessible);
+ /*
+ g_signal_connect_after (widget,
+ "focus-in-event",
+ G_CALLBACK (ea_day_view_focus_gtk),
+ NULL);
+ g_signal_connect_after (widget,
+ "focus-out-event",
+ G_CALLBACK (ea_day_view_focus_gtk),
+ NULL);
+ g_signal_connect (widget,
+ "notify",
+ G_CALLBACK (ea_day_view_notify_gtk),
+ widget);
+ atk_component_add_focus_handler (ATK_COMPONENT (accessible),
+ ea_day_view_focus_event);
+ */
+ /*
+ * Add signal handlers for GTK signals required to support property changes
+ */
+ /*
+ g_signal_connect (widget,
+ "map",
+ G_CALLBACK (ea_day_view_map_gtk),
+ NULL);
+ g_signal_connect (widget,
+ "unmap",
+ G_CALLBACK (ea_day_view_map_gtk),
+ NULL);
+ g_object_set_data (G_OBJECT (obj), "atk-component-layer",
+ GINT_TO_POINTER (ATK_LAYER_WIDGET));
+ */
+ obj->role = ATK_ROLE_CANVAS;
+}
+
+AtkObject*
+ea_day_view_new (GtkWidget *widget)
+{
+ GObject *object;
+ AtkObject *accessible;
+
+ g_return_val_if_fail (GTK_IS_WIDGET (widget), NULL);
+
+ object = g_object_new (EA_TYPE_DAY_VIEW, NULL);
+
+ accessible = ATK_OBJECT (object);
+ atk_object_initialize (accessible, widget);
+
+ printf ("EA-day-view created\n");
+
+ return accessible;
+}
+
+static G_CONST_RETURN gchar*
+ea_day_view_get_name (AtkObject *accessible)
+{
+ EDayView *day_view;
+
+ g_return_val_if_fail (EA_IS_DAY_VIEW (accessible), NULL);
+
+ day_view = E_DAY_VIEW (GTK_ACCESSIBLE (accessible)->widget);
+
+ if (!accessible->name) {
+ GnomeCalendarViewType view_type;
+
+ view_type = gnome_calendar_get_view (day_view->calendar);
+
+ if (view_type == GNOME_CAL_WORK_WEEK_VIEW)
+ atk_object_set_name(accessible, "work week view");
+ else
+ atk_object_set_name(accessible, "day view view");
+ }
+ return accessible->name;
+}
+
+static G_CONST_RETURN gchar*
+ea_day_view_get_description (AtkObject *accessible)
+{
+ EDayView *day_view;
+
+ g_return_val_if_fail (EA_IS_DAY_VIEW (accessible), NULL);
+
+ day_view = E_DAY_VIEW (GTK_ACCESSIBLE (accessible)->widget);
+
+ if (!accessible->description) {
+ GnomeCalendarViewType view_type;
+
+ view_type = gnome_calendar_get_view (day_view->calendar);
+
+ if (view_type == GNOME_CAL_WORK_WEEK_VIEW)
+ atk_object_set_description(accessible,
+ "calendar view for a work week");
+ else
+ atk_object_set_description(accessible,
+ "calendar view for one or more days");
+ }
+ return accessible->description;
+}
+
+static AtkObject*
+ea_day_view_get_parent (AtkObject *accessible)
+{
+ EDayView *day_view;
+ GnomeCalendar *gnomeCalendar;
+
+ g_return_val_if_fail (EA_IS_DAY_VIEW (accessible), NULL);
+
+ day_view = E_DAY_VIEW (GTK_ACCESSIBLE (accessible)->widget);
+
+ gnomeCalendar = day_view->calendar;
+
+ return gtk_widget_get_accessible (GTK_WIDGET(gnomeCalendar));
+}
+
+static gint
+ea_day_view_get_n_children (AtkObject *accessible)
+{
+ EDayView *day_view;
+ gint day;
+ gint child_num = 0;
+
+ g_return_val_if_fail (EA_IS_DAY_VIEW (accessible), -1);
+
+ day_view = E_DAY_VIEW (GTK_ACCESSIBLE (accessible)->widget);
+
+ child_num += day_view->long_events->len;
+
+ for (day = 0; day < day_view->days_shown; day++) {
+ child_num += day_view->events[day]->len;
+ }
+
+ return child_num;
+}
+
+static AtkObject *
+ea_day_view_ref_child (AtkObject *accessible, gint i)
+{
+ EDayView *day_view;
+ gint child_num;
+ gint day;
+ AtkObject *atk_object = NULL;
+ EDayViewEvent *event = NULL;
+
+ g_return_val_if_fail (EA_IS_DAY_VIEW (accessible), NULL);
+
+ child_num = atk_object_get_n_accessible_children (accessible);
+ if (child_num <= 0 || i < 0 || i >= child_num)
+ return NULL;
+
+ day_view = E_DAY_VIEW (GTK_ACCESSIBLE (accessible)->widget);
+
+ /* a long event */
+ if (i < day_view->long_events->len) {
+ event = &g_array_index (day_view->long_events,
+ EDayViewEvent, i);
+ }
+ else {
+ i -= day_view->long_events->len;
+ day = 0;
+ while (i >= day_view->events[day]->len) {
+ i -= day_view->events[day]->len;
+ ++day;
+ }
+
+ event = &g_array_index (day_view->events[day],
+ EDayViewEvent, i);
+ }
+ printf ("child event for index=%d is %p\n", i, event);
+ if (event) {
+ /* event is not created as gobject???!!!
+ atk_object = atk_gobject_accessible_for_object (G_OBJECT (event));
+ */
+ atk_object = ea_day_view_event_new (event);
+ g_object_ref (atk_object);
+ }
+ return atk_object;
+}
+
+static AtkStateSet*
+ea_day_view_ref_state_set (AtkObject *accessible)
+{
+ return ATK_OBJECT_CLASS (parent_class)->ref_state_set (accessible);
+}
+
+static gint
+ea_day_view_get_index_in_parent (AtkObject *accessible)
+{
+ return 0;
+}
+
+static void
+atk_component_interface_init (AtkComponentIface *iface)
+{
+ g_return_if_fail (iface != NULL);
+
+ /*
+ * Use default implementation for contains and get_position
+ */
+
+ /*
+ iface->add_focus_handler = ea_day_view_add_focus_handler;
+ */
+ iface->get_extents = ea_day_view_get_extents;
+
+ /*
+ iface->get_size = ea_day_view_get_size;
+ iface->get_layer = ea_day_view_get_layer;
+ iface->grab_focus = ea_day_view_grab_focus;
+ iface->remove_focus_handler = ea_day_view_remove_focus_handler;
+ iface->set_extents = ea_day_view_set_extents;
+ iface->set_position = ea_day_view_set_position;
+ iface->set_size = ea_day_view_set_size;
+ */
+}
+
+static void
+ea_day_view_get_extents (AtkComponent *component,
+ gint *x,
+ gint *y,
+ gint *width,
+ gint *height,
+ AtkCoordType coord_type)
+{
+ AtkComponentIface *atk_component_iface =
+ g_type_interface_peek (parent_class, ATK_TYPE_COMPONENT);
+
+ if (atk_component_iface)
+ atk_component_iface->get_extents(component, x, y, width, height,
+ coord_type);
+
+}
Index: a11y/calendar/ea-day-view.h
===================================================================
RCS file: a11y/calendar/ea-day-view.h
diff -N a11y/calendar/ea-day-view.h
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ a11y/calendar/ea-day-view.h 16 Jul 2003 07:09:02 -0000 1.1.2.1
@@ -0,0 +1,78 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/* vim:expandtab:shiftwidth=4:tabstop=4:
+ */
+/* Evolution Accessibility: ea-day-view.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: Bolian Yin <bolian yin sun com> Sun Microsystem Inc., 2003
+ *
+ */
+
+#ifndef __EA_DAY_VIEW_H__
+#define __EA_DAY_VIEW_H__
+
+#include <gtk/gtkaccessible.h>
+#include "e-day-view.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+#define EA_TYPE_DAY_VIEW (ea_day_view_get_type ())
+#define EA_DAY_VIEW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EA_TYPE_DAY_VIEW, EaDayView))
+#define EA_DAY_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), EA_TYPE_DAY_VIEW, EaDayViewClass))
+#define EA_IS_DAY_VIEW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EA_TYPE_DAY_VIEW))
+#define EA_IS_DAY_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), EA_TYPE_DAY_VIEW))
+#define EA_DAY_VIEW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), EA_TYPE_DAY_VIEW, EaDayViewClass))
+
+typedef struct _EaDayView EaDayView;
+typedef struct _EaDayViewClass EaDayViewClass;
+
+struct _EaDayView
+{
+ GtkAccessible parent;
+};
+
+GType ea_day_view_get_type (void);
+
+struct _EaDayViewClass
+{
+ GtkAccessibleClass parent_class;
+
+ /*
+ * Signal handler for notify signal on GTK widget
+ */
+ void (*notify_gtk) (GObject *object,
+ GParamSpec *pspec);
+ /*
+ * Signal handler for focus_in_event and focus_out_event signal
+ * on GTK widget
+ */
+ gboolean (*focus_gtk) (GtkWidget *widget,
+ GdkEventFocus *event);
+
+};
+
+AtkObject* ea_day_view_new (GtkWidget *widget);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+
+#endif /* __EA_DAY_VIEW_H__ */
Index: a11y/calendar/ea-gnome-calendar.c
===================================================================
RCS file: a11y/calendar/ea-gnome-calendar.c
diff -N a11y/calendar/ea-gnome-calendar.c
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ a11y/calendar/ea-gnome-calendar.c 16 Jul 2003 07:09:02 -0000 1.1.2.1
@@ -0,0 +1,324 @@
+ /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/* vim:expandtab:shiftwidth=4:tabstop=4:
+ */
+/* Evolution Accessibility: ea-gnome-calendar.c
+ *
+ * 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: Bolian Yin <bolian yin sun com> Sun Microsystem Inc., 2003
+ *
+ */
+
+#include "ea-gnome-calendar.h"
+
+static void ea_gnome_calendar_class_init (EaGnomeCalendarClass *klass);
+
+static G_CONST_RETURN gchar* ea_gnome_calendar_get_name (AtkObject *accessible);
+static G_CONST_RETURN gchar* ea_gnome_calendar_get_description (AtkObject *accessible);
+static AtkObject* ea_gnome_calendar_get_parent (AtkObject *accessible);
+static gint ea_gnome_get_n_children (AtkObject* obj);
+static AtkObject * ea_gnome_ref_child (AtkObject *obj, gint i);
+
+static AtkStateSet* ea_gnome_calendar_ref_state_set (AtkObject *accessible);
+static gint ea_gnome_calendar_get_index_in_parent (AtkObject *accessible);
+
+static void atk_component_interface_init (AtkComponentIface *iface);
+
+static void ea_gnome_calendar_get_extents (AtkComponent *component,
+ gint *x,
+ gint *y,
+ gint *width,
+ gint *height,
+ AtkCoordType coord_type);
+
+static void ea_gnome_calendar_real_initialize (AtkObject *obj,
+ gpointer data);
+
+static gpointer parent_class = NULL;
+
+GType
+ea_gnome_calendar_get_type (void)
+{
+ static GType type = 0;
+ AtkObjectFactory *factory;
+ GTypeQuery query;
+ GType derived_atk_type;
+
+ if (!type) {
+ static const GTypeInfo tinfo = {
+ sizeof (EaGnomeCalendarClass),
+ (GBaseInitFunc) NULL, /* base init */
+ (GBaseFinalizeFunc) NULL, /* base finalize */
+ (GClassInitFunc) ea_gnome_calendar_class_init, /* class init */
+ (GClassFinalizeFunc) NULL, /* class finalize */
+ NULL, /* class data */
+ sizeof (EaGnomeCalendar), /* instance size */
+ 0, /* nb preallocs */
+ (GInstanceInitFunc) NULL, /* instance init */
+ NULL /* value table */
+ };
+
+ static const GInterfaceInfo atk_component_info = {
+ (GInterfaceInitFunc) atk_component_interface_init,
+ (GInterfaceFinalizeFunc) NULL,
+ NULL
+ };
+
+ /*
+ * Figure out the size of the class and instance
+ * we are run-time deriving from (GailWidget, in this case)
+ */
+
+ factory = atk_registry_get_factory (atk_get_default_registry (),
+ GTK_TYPE_WIDGET);
+ derived_atk_type = atk_object_factory_get_accessible_type (factory);
+ g_type_query (derived_atk_type, &query);
+ tinfo.class_size = query.class_size;
+ tinfo.instance_size = query.instance_size;
+
+ type = g_type_register_static (derived_atk_type,
+ "EaGnomeCalendar", &tinfo, 0);
+
+
+ g_type_add_interface_static (type, ATK_TYPE_COMPONENT,
+ &atk_component_info);
+ }
+
+ return type;
+}
+
+static void
+ea_gnome_calendar_class_init (EaGnomeCalendarClass *klass)
+{
+ AtkObjectFactory *factory;
+ AtkRegistry *default_registry;
+ AtkObjectClass *class = ATK_OBJECT_CLASS (klass);
+
+ parent_class = g_type_class_peek_parent (klass);
+
+ /*
+ klass->notify_gtk = ea_gnome_calendar_real_notify_gtk;
+ klass->focus_gtk = ea_gnome_calendar_real_focus_gtk;
+
+ accessible_class->connect_widget_destroyed =
+ ea_gnome_calendar_connect_widget_destroyed;
+ */
+
+ class->get_name = ea_gnome_calendar_get_name;
+ class->get_description = ea_gnome_calendar_get_description;
+
+ class->get_parent = ea_gnome_calendar_get_parent;
+ class->get_index_in_parent = ea_gnome_calendar_get_index_in_parent;
+ class->get_n_children = ea_gnome_get_n_children;
+ class->ref_child = ea_gnome_ref_child;
+
+ class->ref_state_set = ea_gnome_calendar_ref_state_set;
+ class->initialize = ea_gnome_calendar_real_initialize;
+}
+
+/**
+ * This function specifies the GtkWidget for which the EaGnomeCalendar
+ * was created and specifies a handler to be called when the GtkWidget is
+ * destroyed.
+ **/
+static void
+ea_gnome_calendar_real_initialize (AtkObject *obj,
+ gpointer data)
+{
+ GtkAccessible *accessible;
+ GtkWidget *widget;
+
+ g_return_if_fail (GTK_IS_WIDGET (data));
+
+ widget = GTK_WIDGET (data);
+
+ accessible = GTK_ACCESSIBLE (obj);
+ accessible->widget = widget;
+ gtk_accessible_connect_widget_destroyed (accessible);
+ /*
+ g_signal_connect_after (widget,
+ "focus-in-event",
+ G_CALLBACK (ea_gnome_calendar_focus_gtk),
+ NULL);
+ g_signal_connect_after (widget,
+ "focus-out-event",
+ G_CALLBACK (ea_gnome_calendar_focus_gtk),
+ NULL);
+ g_signal_connect (widget,
+ "notify",
+ G_CALLBACK (ea_gnome_calendar_notify_gtk),
+ widget);
+ atk_component_add_focus_handler (ATK_COMPONENT (accessible),
+ ea_gnome_calendar_focus_event);
+ */
+ /*
+ * Add signal handlers for GTK signals required to support property changes
+ */
+ /*
+ g_signal_connect (widget,
+ "map",
+ G_CALLBACK (ea_gnome_calendar_map_gtk),
+ NULL);
+ g_signal_connect (widget,
+ "unmap",
+ G_CALLBACK (ea_gnome_calendar_map_gtk),
+ NULL);
+ g_object_set_data (G_OBJECT (obj), "atk-component-layer",
+ GINT_TO_POINTER (ATK_LAYER_WIDGET));
+ */
+ obj->role = ATK_ROLE_FILLER;
+}
+
+AtkObject*
+ea_gnome_calendar_new (GtkWidget *widget)
+{
+ GObject *object;
+ AtkObject *accessible;
+
+ g_return_val_if_fail (GTK_IS_WIDGET (widget), NULL);
+
+ object = g_object_new (EA_TYPE_GNOME_CALENDAR, NULL);
+
+ accessible = ATK_OBJECT (object);
+ atk_object_initialize (accessible, widget);
+
+ printf ("EA-gnome-calendar created\n");
+
+ return accessible;
+}
+
+static G_CONST_RETURN gchar*
+ea_gnome_calendar_get_name (AtkObject *accessible)
+{
+ if (!accessible->name)
+ atk_object_set_name(accessible, "Gnome Calendar");
+ return accessible->name;
+}
+
+static G_CONST_RETURN gchar*
+ea_gnome_calendar_get_description (AtkObject *accessible)
+{
+ if (!accessible->description)
+ atk_object_set_description(accessible,
+ "Gnome Calendar");
+ return accessible->description;
+}
+
+static AtkObject*
+ea_gnome_calendar_get_parent (AtkObject *accessible)
+{
+ return ATK_OBJECT_CLASS (parent_class)->get_parent (accessible);
+}
+
+static gint
+ea_gnome_calendar_get_index_in_parent (AtkObject *accessible)
+{
+ return ATK_OBJECT_CLASS (parent_class)->get_index_in_parent (accessible);
+}
+
+static gint
+ea_gnome_get_n_children (AtkObject* obj)
+{
+ g_return_val_if_fail (EA_IS_GNOME_CALENDAR (obj), 0);
+
+ return 3;
+}
+
+static AtkObject *
+ea_gnome_ref_child (AtkObject *obj, gint i)
+{
+ AtkObject * child = NULL;
+ GnomeCalendar * calendarWidget;
+ GtkWidget *childWidget;
+
+ g_return_val_if_fail (EA_IS_GNOME_CALENDAR (obj), NULL);
+ if (i < 0 || i >2 )
+ return NULL;
+
+ calendarWidget = GTK_ACCESSIBLE (obj)->widget;
+
+ switch (i) {
+ case 0:
+ /* for the day/week view */
+ childWidget = gnome_calendar_get_current_view_widget (calendarWidget);
+ child = gtk_widget_get_accessible (childWidget);
+ atk_object_set_parent (child, obj);
+ break;
+ case 1:
+ /* for calendar */
+ childWidget = gnome_calendar_get_e_calendar_widget (calendarWidget);
+ child = gtk_widget_get_accessible (childWidget);
+ break;
+ case 2:
+ /* for todo list */
+ childWidget = gnome_calendar_get_task_pad (calendarWidget);
+ child = gtk_widget_get_accessible (childWidget);
+ break;
+ default:
+ break;
+ }
+ if (child)
+ g_object_ref(child);
+ return child;
+}
+
+static AtkStateSet*
+ea_gnome_calendar_ref_state_set (AtkObject *accessible)
+{
+ return ATK_OBJECT_CLASS (parent_class)->ref_state_set (accessible);
+}
+
+static void
+atk_component_interface_init (AtkComponentIface *iface)
+{
+ g_return_if_fail (iface != NULL);
+
+ /*
+ * Use default implementation for contains and get_position
+ */
+
+ /*
+ iface->add_focus_handler = ea_gnome_calendar_add_focus_handler;
+ */
+ iface->get_extents = ea_gnome_calendar_get_extents;
+
+ /*
+ iface->get_size = ea_gnome_calendar_get_size;
+ iface->get_layer = ea_gnome_calendar_get_layer;
+ iface->grab_focus = ea_gnome_calendar_grab_focus;
+ iface->remove_focus_handler = ea_gnome_calendar_remove_focus_handler;
+ iface->set_extents = ea_gnome_calendar_set_extents;
+ iface->set_position = ea_gnome_calendar_set_position;
+ iface->set_size = ea_gnome_calendar_set_size;
+ */
+}
+
+static void
+ea_gnome_calendar_get_extents (AtkComponent *component,
+ gint *x,
+ gint *y,
+ gint *width,
+ gint *height,
+ AtkCoordType coord_type)
+{
+ AtkComponentIface *atk_component_iface =
+ g_type_interface_peek (parent_class, ATK_TYPE_COMPONENT);
+
+ if (atk_component_iface)
+ atk_component_iface->get_extents(component, x, y, width, height, coord_type);
+
+}
Index: a11y/calendar/ea-gnome-calendar.h
===================================================================
RCS file: a11y/calendar/ea-gnome-calendar.h
diff -N a11y/calendar/ea-gnome-calendar.h
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ a11y/calendar/ea-gnome-calendar.h 16 Jul 2003 07:09:02 -0000 1.1.2.1
@@ -0,0 +1,78 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/* vim:expandtab:shiftwidth=4:tabstop=4:
+ */
+/* Evolution Accessibility: ea-gnome-calendar.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: Bolian Yin <bolian yin sun com> Sun Microsystem Inc., 2003
+ *
+ */
+
+#ifndef __EA_GNOME_CALENDAR_H__
+#define __EA_GNOME_CALENDAR_H__
+
+#include <gtk/gtkaccessible.h>
+#include "gnome-cal.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+#define EA_TYPE_GNOME_CALENDAR (ea_gnome_calendar_get_type ())
+#define EA_GNOME_CALENDAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EA_TYPE_GNOME_CALENDAR, EaGnomeCalendar))
+#define EA_GNOME_CALENDAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), EA_TYPE_GNOME_CALENDAR, EaGnomeCalendarClass))
+#define EA_IS_GNOME_CALENDAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EA_TYPE_GNOME_CALENDAR))
+#define EA_IS_GNOME_CALENDAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), EA_TYPE_GNOME_CALENDAR))
+#define EA_GNOME_CALENDAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), EA_TYPE_GNOME_CALENDAR, EaGnomeCalendarClass))
+
+typedef struct _EaGnomeCalendar EaGnomeCalendar;
+typedef struct _EaGnomeCalendarClass EaGnomeCalendarClass;
+
+struct _EaGnomeCalendar
+{
+ GtkAccessible parent;
+};
+
+GType ea_gnome_calendar_get_type (void);
+
+struct _EaGnomeCalendarClass
+{
+ GtkAccessibleClass parent_class;
+
+ /*
+ * Signal handler for notify signal on GTK widget
+ */
+ void (*notify_gtk) (GObject *object,
+ GParamSpec *pspec);
+ /*
+ * Signal handler for focus_in_event and focus_out_event signal on
+ * GTK widget
+ */
+ gboolean (*focus_gtk) (GtkWidget *widget,
+ GdkEventFocus *event);
+
+};
+
+AtkObject* ea_gnome_calendar_new (GtkWidget *widget);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+
+#endif /* __EA_GNOME_CALENDAR_H__ */
Index: gal-2.0.pc.in
===================================================================
RCS file: /cvs/gnome/gal/gal-2.0.pc.in,v
retrieving revision 1.4
diff -u -r1.4 gal-2.0.pc.in
--- gal-2.0.pc.in 21 Jan 2003 16:48:00 -0000 1.4
+++ gal-2.0.pc.in 18 Jul 2003 06:49:57 -0000
@@ -8,5 +8,5 @@
Version: @VERSION@
Requires: gtk+-2.0 libxml-2.0 libglade-2.0 libgnomeprint-2.2
-Libs: -L${libdir} -lgal-2.0
+Libs: -L${libdir} -lgal-2.0 -lgal-a11y
Cflags: -I${includedir}/gal-2.0
Index: configure.in
===================================================================
RCS file: /cvs/gnome/gal/configure.in,v
retrieving revision 1.270
diff -u -r1.270 configure.in
--- configure.in 25 Jun 2003 17:26:35 -0000 1.270
+++ configure.in 18 Jul 2003 06:50:00 -0000
@@ -286,6 +286,7 @@
gal/a11y/Makefile
gal/a11y/e-text/Makefile
gal/a11y/e-table/Makefile
+gal/a11y/e-paned/Makefile
gal/util/Makefile
gal/widgets/Makefile
gal/e-text/Makefile
Index: gal/Makefile.am
===================================================================
RCS file: /cvs/gnome/gal/gal/Makefile.am,v
retrieving revision 1.65
diff -u -r1.65 Makefile.am
--- gal/Makefile.am 3 May 2003 17:05:27 -0000 1.65
+++ gal/Makefile.am 18 Jul 2003 06:50:04 -0000
@@ -1,5 +1,5 @@
nonui_subdirs = util
-ui_subdirs = widgets e-paned e-table e-text menus shortcut-bar . a11y
+ui_subdirs = widgets e-paned e-table e-text menus shortcut-bar a11y .
SUBDIRS = $(nonui_subdirs) $(ui_subdirs)
@@ -17,4 +17,5 @@
e-text/libetext.la \
menus/libgalmenus.la \
shortcut-bar/libshortcut-bar.la \
+ a11y/libgal-a11y.la \
$(EXTRA_GNOME_LIBS)
Index: gal/a11y/Makefile.am
===================================================================
RCS file: /cvs/gnome/gal/gal/a11y/Makefile.am,v
retrieving revision 1.3
diff -u -r1.3 Makefile.am
--- gal/a11y/Makefile.am 3 May 2003 17:05:28 -0000 1.3
+++ gal/a11y/Makefile.am 18 Jul 2003 06:50:07 -0000
@@ -1,4 +1,4 @@
-SUBDIRS = e-table e-text
+SUBDIRS = e-table e-text e-paned
INCLUDES = \
-I$(top_srcdir) \
@@ -7,28 +7,29 @@
$(GNOME_BONOBO_CFLAGS) \
$(GNOME_INCLUDEDIR) \
$(ICONV_CFLAGS) \
- -DG_LOG_DOMAIN=\"gal-a11y\"
+ -DGTK_DISABLE_DEPRECATED=1 \
+ -DGDK_DISABLE_DEPRECATED=1 \
+ -DG_DISABLE_DEPRECATED=1 \
+ -DGNOME_DISABLE_DEPRECATED=1 \
+ -DG_LOG_DOMAIN=\"gal-a11y\"
-module_LTLIBRARIES = libgal-a11y-2.0.la
-moduledir = $(libdir)/gtk-2.0/modules
+lib_LTLIBRARIES = libgal-a11y.la
-libgal_a11y_2_0_la_LDFLAGS = \
- -rpath $(moduledir) -module -avoid-version -no-undefined \
+libgal_ally_la_LDFLAGS = \
+ -avoid-version -no-undefined \
@LDFLAGS@
-libgal_a11y_2_0_la_SOURCES = \
- gal-a11y-util.c \
- init.c
+libgal_a11y_la_SOURCES = \
+ gal-a11y-util.c
-libgal_a11y_2_0includedir = $(includedir)/gal-$(GAL_API_VERSION)/gal/a11y
+libgal_a11yincludedir = $(includedir)/gal-$(GAL_API_VERSION)/gal/a11y
-libgal_a11y_2_0include_HEADERS = \
+libgal_a11yinclude_HEADERS = \
gal-a11y-util.h
-libgal_a11y_2_0_la_LIBADD = \
- e-table/libgal-a11y-etable.la \
- e-text/libgal-a11y-etext.la \
- $(top_builddir)/gal/libgal-2.0.la \
+libgal_a11y_la_LIBADD = \
+ e-paned/libgal-a11y-epaned.la \
+ $(top_builddir)/gal/e-paned/libepaned.la \
$(EXTRA_GNOME_LIBS)
Index: gal/e-paned/e-paned.c
===================================================================
RCS file: /cvs/gnome/gal/gal/e-paned/e-paned.c,v
retrieving revision 1.10
diff -u -r1.10 e-paned.c
--- gal/e-paned/e-paned.c 16 Nov 2002 23:31:47 -0000 1.10
+++ gal/e-paned/e-paned.c 18 Jul 2003 06:50:10 -0000
@@ -51,9 +51,15 @@
*/
#include <gtk/gtkstyle.h>
+#include <gtk/gtk.h>
#include <gal/util/e-i18n.h>
#include <gal/util/e-util.h>
#include "e-paned.h"
+#include "gal/a11y/gal-a11y-factory.h"
+#include "gal/a11y/e-paned/gal-a11y-e-paned.h"
+
+GAL_A11Y_FACTORY(GAL_A11Y_TYPE_E_PANED, gal_a11y_e_paned, gal_a11y_e_paned_new)
+
enum {
PROP_0,
@@ -149,6 +155,8 @@
/*_( */"XXX blurb" /*)*/,
0, G_MAXUINT, 0,
G_PARAM_READWRITE));
+
+ GAL_A11Y_WIDGET_SET_FACTORY(E_TYPE_PANED, gal_a11y_e_paned);
}
static GtkType
--- /dev/null 2002-08-31 07:31:37.000000000 +0800
+++ gal/a11y/e-paned/Makefile.am 2003-07-18 15:14:02.000000000 +0800
@@ -0,0 +1,19 @@
+INCLUDES = \
+ -I$(top_srcdir) \
+ -I$(top_srcdir)/gal \
+ -I$(top_srcdir)/gal/a11y \
+ $(EXTRA_GNOME_CFLAGS) \
+ $(GNOME_BONOBO_CFLAGS) \
+ $(GNOME_INCLUDEDIR) \
+ $(ICONV_CFLAGS) \
+ -DG_LOG_DOMAIN=\"e-paned\"
+
+noinst_LTLIBRARIES = libgal-a11y-epaned.la
+
+libgal_a11y_epaned_la_SOURCES = \
+ gal-a11y-e-paned.c
+
+libgal_a11y_epanedincludedir = $(includedir)/gal-$(GAL_API_VERSION)/gal/a11y/e-paned
+
+libgal_a11y_epanedinclude_HEADERS = \
+ gal-a11y-e-paned.h
--- /dev/null 2002-08-31 07:31:37.000000000 +0800
+++ gal/a11y/e-paned/gal-a11y-e-paned.c 2003-07-18 15:14:14.000000000 +0800
@@ -0,0 +1,308 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/* GAL A11Y
+ * gal-a11y-e-paned.c
+ *
+ * Copyright 2003 Ximain Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser 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.
+ *
+ * Since EPaned is based on GtkPaned from Gtk+, GalA11yEPaned is corresponding
+ * based on GailPaned from Gail.
+ *
+ */
+
+#include <string.h>
+#include <stdio.h>
+#include <gtk/gtk.h>
+#include <gtk/gtkaccessible.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 <atk/atkaction.h>
+
+#include "gal/e-paned/e-paned.h"
+#include "gal/e-paned/e-hpaned.h"
+#include "gal/e-paned/e-vpaned.h"
+#include "gal-a11y-e-paned.h"
+#include "gal/a11y/gal-a11y-util.h"
+
+
+static GObjectClass *parent_class;
+static GType parent_type;
+static gint priv_offset;
+static GQuark quark_accessible_object = 0;
+
+#define GET_PRIVATE(object) ((GalA11yEPanedPrivate *) (((char *) object) + priv_offset))
+
+#define PARENT_TYPE (parent_type)
+
+struct _GalA11yEPanedPrivate {
+ int dummy;
+};
+
+static void gal_a11y_e_paned_class_init (GalA11yEPanedClass *klass);
+static void gal_a11y_e_paned_real_initialize (AtkObject *obj,
+ gpointer data);
+
+static AtkStateSet* gal_a11y_e_paned_ref_state_set (AtkObject *accessible);
+
+static void gal_a11y_e_paned_size_allocate_gtk (GtkWidget *widget,
+ GtkAllocation *allocation);
+
+static void atk_value_interface_init (AtkValueIface *iface);
+static void gal_a11y_e_paned_get_current_value (AtkValue *obj,
+ GValue *value);
+static void gal_a11y_e_paned_get_maximum_value (AtkValue *obj,
+ GValue *value);
+static void gal_a11y_e_paned_get_minimum_value (AtkValue *obj,
+ GValue *value);
+static gboolean gal_a11y_e_paned_set_current_value (AtkValue *obj,
+ const GValue *value);
+
+GType
+gal_a11y_e_paned_get_type (void)
+{
+ static GType type = 0;
+
+ if (!type)
+ {
+ static const GTypeInfo tinfo =
+ {
+ sizeof (GalA11yEPanedClass),
+ (GBaseInitFunc) NULL, /* base init */
+ (GBaseFinalizeFunc) NULL, /* base finalize */
+ (GClassInitFunc) gal_a11y_e_paned_class_init, /* class init */
+ (GClassFinalizeFunc) NULL, /* class finalize */
+ NULL, /* class data */
+ sizeof (GalA11yEPaned), /* instance size */
+ 0, /* nb preallocs */
+ (GInstanceInitFunc)NULL, /* instance init */
+ NULL /* value table */
+ };
+
+ static const GInterfaceInfo atk_value_info =
+ {
+ (GInterfaceInitFunc) atk_value_interface_init,
+ (GInterfaceFinalizeFunc) NULL,
+ NULL
+ };
+
+ AtkObjectFactory *factory;
+
+ factory = atk_registry_get_factory (atk_get_default_registry (), GTK_TYPE_CONTAINER);
+ parent_type = atk_object_factory_get_accessible_type (factory);
+
+ type = gal_a11y_type_register_static_with_private (PARENT_TYPE, "GalA11yEPaned", &tinfo, 0,
+ sizeof (GalA11yEPanedPrivate), &priv_offset);
+
+ g_type_add_interface_static (type, ATK_TYPE_VALUE,
+ &atk_value_info);
+ }
+
+ return type;
+}
+
+
+static void
+gal_a11y_e_paned_class_init (GalA11yEPanedClass *klass)
+{
+ GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
+ AtkObjectClass *class = ATK_OBJECT_CLASS (klass);
+
+ parent_class = g_type_class_ref (PARENT_TYPE);
+
+ class->ref_state_set = gal_a11y_e_paned_ref_state_set;
+ class->initialize = gal_a11y_e_paned_real_initialize;
+}
+
+static void
+gal_a11y_e_paned_real_initialize (AtkObject *obj,
+ gpointer data)
+{
+
+ g_return_if_fail (GTK_IS_WIDGET (data));
+
+ ATK_OBJECT_CLASS (parent_class)->initialize (obj, data);
+
+ g_signal_connect (data,
+ "size_allocate",
+ G_CALLBACK (gal_a11y_e_paned_size_allocate_gtk),
+ NULL);
+
+ obj->role = ATK_ROLE_SPLIT_PANE;
+}
+
+AtkObject*
+gal_a11y_e_paned_new (GtkWidget *widget)
+{
+ GObject *object;
+ AtkObject *accessible;
+
+ g_return_val_if_fail (GTK_IS_WIDGET (widget), NULL);
+
+ object = g_object_new (GAL_A11Y_TYPE_E_PANED, NULL);
+
+ accessible = ATK_OBJECT (object);
+ atk_object_initialize (accessible, widget);
+
+ return accessible;
+}
+
+static AtkStateSet*
+gal_a11y_e_paned_ref_state_set (AtkObject *accessible)
+{
+ AtkStateSet *state_set;
+ GtkWidget *widget;
+
+ g_return_val_if_fail (GTK_IS_ACCESSIBLE (accessible), NULL);
+
+ state_set = ATK_OBJECT_CLASS (parent_class)->ref_state_set (accessible);
+ widget = GTK_ACCESSIBLE (accessible)->widget;
+
+ if (widget == NULL)
+ return state_set;
+
+ if (E_IS_VPANED (widget))
+ atk_state_set_add_state (state_set, ATK_STATE_VERTICAL);
+ else if (E_IS_HPANED (widget))
+ atk_state_set_add_state (state_set, ATK_STATE_HORIZONTAL);
+
+ return state_set;
+}
+
+static void
+gal_a11y_e_paned_size_allocate_gtk (GtkWidget *widget,
+ GtkAllocation *allocation)
+{
+ AtkObject *obj = gtk_widget_get_accessible (widget);
+
+ g_object_notify (G_OBJECT (obj), "accessible-value");
+}
+
+static void
+atk_value_interface_init (AtkValueIface *iface)
+{
+ g_return_if_fail (iface != NULL);
+
+ iface->get_current_value = gal_a11y_e_paned_get_current_value;
+ iface->get_maximum_value = gal_a11y_e_paned_get_maximum_value;
+ iface->get_minimum_value = gal_a11y_e_paned_get_minimum_value;
+ iface->set_current_value = gal_a11y_e_paned_set_current_value;
+
+}
+
+static void
+gal_a11y_e_paned_get_current_value (AtkValue *obj,
+ GValue *value)
+{
+ GtkWidget* widget;
+ gint current_value;
+
+ memset (value, 0, sizeof (GValue));
+ g_value_init (value, G_TYPE_INT);
+
+ g_return_val_if_fail (GTK_IS_ACCESSIBLE (obj), NULL);
+
+ widget = GTK_ACCESSIBLE (obj)->widget;
+ if (widget == NULL)
+ /* State is defunct */
+ return;
+
+ current_value = e_paned_get_position (E_PANED (widget));
+
+ g_value_set_int (value,current_value);
+}
+
+static void
+gal_a11y_e_paned_get_maximum_value (AtkValue *obj,
+ GValue *value)
+{
+ GtkWidget* widget;
+ gint maximum_value;
+
+ memset (value, 0, sizeof (GValue));
+ g_value_init (value, G_TYPE_INT);
+ g_return_val_if_fail (GTK_IS_ACCESSIBLE (obj), NULL);
+
+ widget = GTK_ACCESSIBLE (obj)->widget;
+ if (widget == NULL)
+ /* State is defunct */
+ return;
+
+ maximum_value = E_PANED (widget)->max_position;
+ g_value_set_int (value, maximum_value);
+}
+
+static void
+gal_a11y_e_paned_get_minimum_value (AtkValue *obj,
+ GValue *value)
+{
+ GtkWidget* widget;
+ gint minimum_value;
+
+ memset (value, 0, sizeof (GValue));
+ g_value_init (value, G_TYPE_INT);
+ g_return_val_if_fail (GTK_IS_ACCESSIBLE (obj), NULL);
+
+ widget = GTK_ACCESSIBLE (obj)->widget;
+ if (widget == NULL)
+ /* State is defunct */
+ return;
+
+ minimum_value = E_PANED (widget)->min_position;
+ g_value_set_int (value, minimum_value);
+}
+
+/*
+ * Calling atk_value_set_current_value() is no guarantee that the value is
+ * acceptable; it is necessary to listen for accessible-value signals
+ * and check whether the current value has been changed or check what the
+ * maximum and minimum values are.
+ */
+
+static gboolean
+gal_a11y_e_paned_set_current_value (AtkValue *obj,
+ const GValue *value)
+{
+ GtkWidget* widget;
+ gint new_value;
+
+ g_return_val_if_fail (GTK_IS_ACCESSIBLE (obj), NULL);
+
+ widget = GTK_ACCESSIBLE (obj)->widget;
+ if (widget == NULL)
+ /* State is defunct */
+ return FALSE;
+
+ if (G_VALUE_HOLDS_INT (value))
+ {
+ new_value = g_value_get_int (value);
+ e_paned_set_position (E_PANED (widget), new_value);
+
+ return TRUE;
+ }
+ else
+ return FALSE;
+}
+
+
--- /dev/null 2002-08-31 07:31:37.000000000 +0800
+++ gal/a11y/e-paned/gal-a11y-e-paned.h 2003-07-18 15:14:02.000000000 +0800
@@ -0,0 +1,75 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/* GAL A11Y
+ * gal-a11y-e-paned.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.
+ *
+ * Since EPaned is based on GtkPaned from Gtk+, GalA11yEPaned is corresponding
+ * based on GailPaned from Gail.
+ *
+ */
+
+#ifndef __GAL_A11Y_E_PANED_H__
+#define __GAL_A11Y_E_PANED_H__
+
+#include <glib-object.h>
+#include <atk/atkobject.h>
+#include <atk/atkobjectfactory.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+#define GAL_A11Y_TYPE_E_PANED (gal_a11y_e_paned_get_type ())
+#define GAL_A11Y_E_PANED(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GAL_A11Y_TYPE_E_PANED, GalA11yEPaned))
+#define GAL_A11Y_E_PANED_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GAL_A11Y_TYPE_E_PANED, GalA11yEPanedClass))
+#define GAL_A11Y_IS_E_PANED(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GAL_A11Y_TYPE_E_PANED))
+#define GAL_A11Y_IS_E_PANED_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GAL_A11Y_TYPE_E_PANED))
+#define GAL_A11Y_E_PANED_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GAL_A11Y_TYPE_E_PANED, GalA11yEPanedClass))
+
+typedef struct _GalA11yEPaned GalA11yEPaned;
+typedef struct _GalA11yEPanedClass GalA11yEPanedClass;
+typedef struct _GalA11yEPanedPrivate GalA11yEPanedPrivate;
+
+/* This struct should actually be larger as this isn't what we derive from.
+ * The GalA11yEPanedPrivate comes right after the parent class structure.
+ **/
+struct _GalA11yEPaned {
+ AtkObject object;
+};
+
+struct _GalA11yEPanedClass {
+ AtkObject parent_class;
+};
+
+
+/* Standard Glib function */
+GType gal_a11y_e_text_get_type (void);
+
+AtkObject* gal_a11y_e_paned_new (GtkWidget *widget);
+
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+
+#endif /* __GAL_A11Y_E_PANED_H__ */
--- /dev/null 2002-08-31 07:31:37.000000000 +0800
+++ gal/a11y/gal-a11y-factory.h 2003-07-18 15:14:02.000000000 +0800
@@ -0,0 +1,94 @@
+/* -*- 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__ */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]