From e8fc140c7030594e556b56242afd2b52abc61634 Mon Sep 17 00:00:00 2001 From: Bolian Yin Date: Wed, 27 Aug 2003 03:36:42 +0000 Subject: add widgets directory; move calendar idl stuff to calendar directory; stop 2003-08-27 Bolian Yin * Makefile.am: add widgets directory; move calendar idl stuff to calendar directory; stop make a single shared lib for whole a11y stuff. * ea-factory.h: make factory macros available to GOBJECT * calendar/Makefile.am: add calendar idl stuff * calendar/ea-cal-view-event.c: add atkcomponent interface. * calendar/ea-gnome-calendar.c (ea_gcal_switch_view_cb): add details for "children_changed". * new widgets directory for widgets a11y stuff, new files are: widgets/Makefile.am, widgets/ea-calendar-item.c, widgets/ea-calendar-item.h, widgets/ea-widgets.c, widgets/ea-widgets.h svn path=/trunk/; revision=22384 --- a11y/ChangeLog | 10 +++ a11y/Makefile.am | 35 +------- a11y/calendar/Makefile.am | 44 ++++++++++ a11y/calendar/ea-cal-view-event.c | 134 ++++++++++++++++++++++++++++++- a11y/calendar/ea-gnome-calendar.c | 26 ++++-- a11y/ea-factory.h | 49 +++++++---- a11y/widgets/Makefile.am | 23 ++++++ a11y/widgets/ea-calendar-item.c | 165 ++++++++++++++++++++++++++++++++++++++ a11y/widgets/ea-calendar-item.h | 65 +++++++++++++++ a11y/widgets/ea-widgets.c | 35 ++++++++ a11y/widgets/ea-widgets.h | 34 ++++++++ 11 files changed, 564 insertions(+), 56 deletions(-) create mode 100644 a11y/widgets/Makefile.am create mode 100644 a11y/widgets/ea-calendar-item.c create mode 100644 a11y/widgets/ea-calendar-item.h create mode 100644 a11y/widgets/ea-widgets.c create mode 100644 a11y/widgets/ea-widgets.h (limited to 'a11y') diff --git a/a11y/ChangeLog b/a11y/ChangeLog index 1d3e33c665..5e433f5314 100644 --- a/a11y/ChangeLog +++ b/a11y/ChangeLog @@ -1,3 +1,13 @@ +2003-08-27 Bolian Yin + + * Makefile.am: add widgets directory; move calendar idl stuff to calendar directory; stop make a single shared lib for whole a11y stuff. + * ea-factory.h: make factory macros available to GOBJECT + * calendar/Makefile.am: add calendar idl stuff + * calendar/ea-cal-view-event.c: add atkcomponent interface. + * calendar/ea-gnome-calendar.c (ea_gcal_switch_view_cb): add details for "children_changed". + * new widgets directory for widgets a11y stuff, new files are: + widgets/Makefile.am, widgets/ea-calendar-item.c, widgets/ea-calendar-item.h, widgets/ea-widgets.c, widgets/ea-widgets.h + 2003-08-20 Rodrigo Moya * calendar/ea-cal-view-event.c (ea_cal_view_event_get_name): diff --git a/a11y/Makefile.am b/a11y/Makefile.am index 0a9a210cba..796eeba234 100644 --- a/a11y/Makefile.am +++ b/a11y/Makefile.am @@ -1,36 +1,5 @@ -# Calendar IDL files - -CALENDAR_IDLS = $(top_srcdir)/calendar/idl/evolution-calendar.idl -CALENDAR_IDL_GENERATED_H = evolution-calendar.h +SUBDIRS = calendar widgets -$(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) \ - ea-factory.h - - -BUILT_SOURCES = $(CALENDAR_IDL_GENERATED_H) - -libevolution_a11y_la_LIBADD = \ - $(A11Y_LIBS) \ - $(top_builddir)/a11y/calendar/libevolution-calendar-a11y.la +EXTRA_DIST = ea-factory.h diff --git a/a11y/calendar/Makefile.am b/a11y/calendar/Makefile.am index 849e152135..2c3a26f2ba 100644 --- a/a11y/calendar/Makefile.am +++ b/a11y/calendar/Makefile.am @@ -1,4 +1,46 @@ +# Calendar IDL files + +CALENDAR_IDLS = $(top_srcdir)/calendar/idl/evolution-calendar.idl +SHELL_IDLS = \ + $(top_srcdir)/shell/Evolution-Activity.idl \ + $(top_srcdir)/shell/Evolution-ConfigControl.idl \ + $(top_srcdir)/shell/Evolution-Offline.idl \ + $(top_srcdir)/shell/Evolution-Session.idl \ + $(top_srcdir)/shell/Evolution-Shell.idl \ + $(top_srcdir)/shell/Evolution-ShellComponent.idl \ + $(top_srcdir)/shell/Evolution-ShellComponentDnd.idl \ + $(top_srcdir)/shell/Evolution-ShellView.idl \ + $(top_srcdir)/shell/Evolution-Shortcuts.idl \ + $(top_srcdir)/shell/Evolution-Storage.idl \ + $(top_srcdir)/shell/Evolution-StorageSetView.idl \ + $(top_srcdir)/shell/Evolution-Wizard.idl \ + $(top_srcdir)/shell/Evolution-common.idl \ + $(top_srcdir)/shell/Evolution.idl + +CALENDAR_IDL_GENERATED_H = evolution-calendar.h +CALENDAR_IDL_GENERATED_C = \ + evolution-calendar-common.c \ + evolution-calendar-skels.c \ + evolution-calendar-stubs.c +SHELL_IDL_GENERATED_H = Evolution.h +SHELL_IDL_GENERATED_C = \ + Evolution-common.c \ + Evolution-skels.c \ + Evolution-stubs.c + +$(CALENDAR_IDL_GENERATED_H): $(CALENDAR_IDLS) + $(ORBIT_IDL) -I $(srcdir) $(IDL_INCLUDES) \ + $(top_srcdir)/calendar/idl/evolution-calendar.idl + +$(SHELL_IDL_GENERATED_H): $(SHELL_IDLS) + $(ORBIT_IDL) -I $(srcdir) $(IDL_INCLUDES) \ + $(top_srcdir)/shell/Evolution.idl + +IDL_GENERATED = $(SHELL_IDL_GENERATED_H) $(CALENDAR_IDL_GENERATED_H) +BUILT_SOURCES = $(IDL_GENERATED) +CLEANFILES = $(BUILT_SOURCES) $(CALENDAR_IDL_GENERATED_C) $(SHELL_IDL_GENERATED_C) + noinst_LTLIBRARIES = libevolution-calendar-a11y.la INCLUDES = \ @@ -22,6 +64,8 @@ INCLUDES = \ $(EVOLUTION_CALENDAR_CFLAGS) libevolution_calendar_a11y_la_SOURCES = \ + $(CALENDAR_IDL_GENERATED_H) \ + $(SHELL_IDL_GENERATED_H) \ ea-calendar.c \ ea-calendar.h \ ea-calendar-helpers.c \ diff --git a/a11y/calendar/ea-cal-view-event.c b/a11y/calendar/ea-cal-view-event.c index 40418a56e1..deffa32ce8 100644 --- a/a11y/calendar/ea-cal-view-event.c +++ b/a11y/calendar/ea-cal-view-event.c @@ -36,6 +36,12 @@ static G_CONST_RETURN gchar* ea_cal_view_event_get_description (AtkObject *acces static AtkObject* ea_cal_view_event_get_parent (AtkObject *accessible); static gint ea_cal_view_event_get_index_in_parent (AtkObject *accessible); +/* component interface */ +static void atk_component_interface_init (AtkComponentIface *iface); +static void ea_cal_view_get_extents (AtkComponent *component, + gint *x, gint *y, gint *width, gint *height, + AtkCoordType coord_type); + static gpointer parent_class = NULL; GType @@ -61,6 +67,12 @@ ea_cal_view_event_get_type (void) 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 (atk object for E_TEXT, in this case) @@ -77,6 +89,8 @@ ea_cal_view_event_get_type (void) /* we inherit the component, text and other interfaces from E_TEXT */ type = g_type_register_static (derived_atk_type, "EaCalViewEvent", &tinfo, 0); + g_type_add_interface_static (type, ATK_TYPE_COMPONENT, + &atk_component_info); } return type; @@ -104,7 +118,6 @@ ea_cal_view_event_new (GObject *obj) GObject *target_obj; ECalView *cal_view; - g_return_val_if_fail (E_IS_TEXT (obj), NULL); cal_view = ea_calendar_helpers_get_cal_view_from (GNOME_CANVAS_ITEM (obj)); if (E_IS_WEEK_VIEW (cal_view)) { @@ -136,10 +149,13 @@ ea_cal_view_event_new (GObject *obj) target_obj = obj; if (!atk_obj) { + static AtkRole event_role = ATK_ROLE_INVALID; atk_obj = ATK_OBJECT (g_object_new (EA_TYPE_CAL_VIEW_EVENT, NULL)); atk_object_initialize (atk_obj, target_obj); - atk_obj->role = ATK_ROLE_TEXT; + if (event_role == ATK_ROLE_INVALID) + event_role = atk_role_register ("Calendar Event"); + atk_obj->role = event_role; #ifdef ACC_DEBUG printf ("EvoAcc: ea_cal_view_event created %p for item=%p\n", atk_obj, target_obj); @@ -328,3 +344,117 @@ ea_cal_view_event_get_index_in_parent (AtkObject *accessible) } return -1; } + +/* Atk Component Interface */ + +static void +atk_component_interface_init (AtkComponentIface *iface) +{ + g_return_if_fail (iface != NULL); + + iface->get_extents = ea_cal_view_get_extents; +} + +static void +ea_cal_view_get_extents (AtkComponent *component, + gint *x, + gint *y, + gint *width, + gint *height, + AtkCoordType coord_type) +{ + GObject *g_obj; + GnomeCanvasItem *canvas_item; + gint x_window, y_window; + gint scroll_x, scroll_y; + ECalView *cal_view; + gint item_x, item_y, item_w, item_h; + GtkWidget *canvas = NULL; + + g_return_if_fail (EA_IS_CAL_VIEW_EVENT (component)); + + g_obj = atk_gobject_accessible_get_object (ATK_GOBJECT_ACCESSIBLE(component)); + if (!g_obj) + /* defunct object*/ + return; + g_return_if_fail (E_IS_TEXT (g_obj)); + + canvas_item = GNOME_CANVAS_ITEM (g_obj); + cal_view = ea_calendar_helpers_get_cal_view_from (canvas_item); + if (!cal_view) + return; + + if (E_IS_DAY_VIEW (cal_view)) { + gint day, event_num; + + if (!e_day_view_find_event_from_item (E_DAY_VIEW (cal_view), + canvas_item, + &day, &event_num)) + return; + if (day == E_DAY_VIEW_LONG_EVENT) { + gint start_day, end_day; + if (!e_day_view_get_long_event_position (E_DAY_VIEW (cal_view), + event_num, + &start_day, + &end_day, + &item_x, + &item_y, + &item_w, + &item_h)) + return; + canvas = E_DAY_VIEW (cal_view)->top_canvas; + } + else { + if (!e_day_view_get_event_position (E_DAY_VIEW (cal_view), day, + event_num, + &item_x, &item_y, + &item_w, &item_h)) + + return; + canvas = E_DAY_VIEW (cal_view)->main_canvas; + } + } + else if (E_IS_WEEK_VIEW (cal_view)) { + gint event_num, span_num; + if (!e_week_view_find_event_from_item (E_WEEK_VIEW (cal_view), + canvas_item, &event_num, + &span_num)) + return; + + if (!e_week_view_get_span_position (E_WEEK_VIEW (cal_view), + event_num, span_num, + &item_x, &item_y, &item_w)) + return; + item_h = E_WEEK_VIEW_ICON_HEIGHT; + canvas = E_WEEK_VIEW (cal_view)->main_canvas; + } + else + return; + + if (!canvas) + return; + + gdk_window_get_origin (canvas->window, + &x_window, &y_window); + gnome_canvas_get_scroll_offsets (GNOME_CANVAS (canvas), &scroll_x, &scroll_y); + + *x = item_x + x_window - scroll_x; + *y = item_y + y_window - scroll_y; + *width = item_w; + *height = item_h; + + if (coord_type == ATK_XY_WINDOW) { + GdkWindow *window; + gint x_toplevel, y_toplevel; + + window = gdk_window_get_toplevel (GTK_WIDGET (cal_view)->window); + gdk_window_get_origin (window, &x_toplevel, &y_toplevel); + + *x -= x_toplevel; + *y -= y_toplevel; + } + +#ifdef ACC_DEBUG + printf ("Event Bounds (%d, %d, %d, %d)\n", *x, *y, *width, *height); +#endif +} diff --git a/a11y/calendar/ea-gnome-calendar.c b/a11y/calendar/ea-gnome-calendar.c index 20361f1451..407b8ed95f 100644 --- a/a11y/calendar/ea-gnome-calendar.c +++ b/a11y/calendar/ea-gnome-calendar.c @@ -117,14 +117,14 @@ ea_gnome_calendar_new (GtkWidget *widget) /* listen on view type change */ + g_signal_connect (widget, "dates_shown_changed", + G_CALLBACK (ea_gcal_dates_change_cb), + accessible); notebook = gnome_calendar_get_view_notebook_widget (gcal); if (notebook) { g_signal_connect (notebook, "switch_page", G_CALLBACK (ea_gcal_switch_view_cb), accessible); - g_signal_connect (widget, "dates_shown_changed", - G_CALLBACK (ea_gcal_dates_change_cb), - accessible); } #ifdef ACC_DEBUG @@ -213,10 +213,19 @@ static void ea_gcal_switch_view_cb (GtkNotebook *widget, GtkNotebookPage *page, guint index, gpointer data) { - g_signal_emit_by_name (G_OBJECT(data), "children_changed", - 0, NULL, NULL); + GtkWidget *new_widget; + + new_widget = gtk_notebook_get_nth_page (widget, index); + + /* views are always the second child in gnome calendar + */ + if (new_widget) + g_signal_emit_by_name (G_OBJECT(data), "children_changed::add", + 1, gtk_widget_get_accessible (new_widget), NULL); + #ifdef ACC_DEBUG - printf ("AccDebug: switch view: children_changed notified\n"); + printf ("AccDebug: view switch to widget %p (index=%d) \n", + new_widget, index); #endif } @@ -231,4 +240,9 @@ ea_gcal_dates_change_cb (GnomeCalendar *gcal, gpointer data) new_name = calendar_get_text_for_folder_bar_label (gcal); atk_object_set_name (ATK_OBJECT(data), new_name); + g_signal_emit_by_name (data, "visible_data_changed"); + +#ifdef ACC_DEBUG + printf ("AccDebug: calendar dates changed, label=%s\n", new_name); +#endif } diff --git a/a11y/ea-factory.h b/a11y/ea-factory.h index 07d91271be..06ae612d6f 100644 --- a/a11y/ea-factory.h +++ b/a11y/ea-factory.h @@ -32,29 +32,40 @@ #include #include -#define EA_FACTORY(type, type_as_function, opt_create_accessible) \ - \ -static GType \ -type_as_function ## _factory_get_accessible_type (void) \ -{ \ - return type; \ -} \ - \ +#define EA_FACTORY_PARTA_GOBJECT(type, type_as_function, opt_create_accessible) \ static AtkObject* \ type_as_function ## _factory_create_accessible (GObject *obj) \ -{ \ +{ \ + AtkObject *accessible; \ + g_return_val_if_fail (G_IS_OBJECT (obj), NULL); \ + accessible = opt_create_accessible (G_OBJECT (obj)); \ + return accessible; \ +} + +#define EA_FACTORY_PARTA(type, type_as_function, opt_create_accessible) \ +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; \ +} + +#define EA_FACTORY_PARTB(type, type_as_function, opt_create_accessible) \ \ - return accessible; \ +static GType \ +type_as_function ## _factory_get_accessible_type (void) \ +{ \ + return type; \ } \ \ + \ static void \ type_as_function ## _factory_class_init (AtkObjectFactoryClass *klass) \ { \ @@ -72,8 +83,8 @@ type_as_function ## _factory_get_type (void) \ char *name; \ static const GTypeInfo tinfo = \ { \ - sizeof (AtkObjectFactoryClass), \ - NULL, NULL, (GClassInitFunc) type_as_function ## _factory_class_init, \ + sizeof (AtkObjectFactoryClass), \ + NULL, NULL, (GClassInitFunc) type_as_function ## _factory_class_init, \ NULL, NULL, sizeof (AtkObjectFactory), 0, NULL, NULL \ }; \ \ @@ -86,9 +97,17 @@ type_as_function ## _factory_get_type (void) \ return t; \ } -#define EA_SET_FACTORY(widget_type, type_as_function) \ +#define EA_FACTORY(type, type_as_function, opt_create_accessible) \ + EA_FACTORY_PARTA(type, type_as_function, opt_create_accessible) \ + EA_FACTORY_PARTB(type, type_as_function, opt_create_accessible) + +#define EA_FACTORY_GOBJECT(type, type_as_function, opt_create_accessible) \ + EA_FACTORY_PARTA_GOBJECT(type, type_as_function, opt_create_accessible) \ + EA_FACTORY_PARTB(type, type_as_function, opt_create_accessible) + +#define EA_SET_FACTORY(obj_type, type_as_function) \ atk_registry_set_factory_type (atk_get_default_registry (), \ - widget_type, \ + obj_type, \ type_as_function ## _factory_get_type ()) #endif /* _EA_FACTORY_H__ */ diff --git a/a11y/widgets/Makefile.am b/a11y/widgets/Makefile.am new file mode 100644 index 0000000000..c6b0ea2221 --- /dev/null +++ b/a11y/widgets/Makefile.am @@ -0,0 +1,23 @@ + +noinst_LTLIBRARIES = libevolution-widgets-a11y.la + +INCLUDES = \ + -DG_LOG_DOMAIN=\"evolution-a11y\" \ + -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_widgets_a11y_la_SOURCES = \ + ea-calendar-item.c \ + ea-calendar-item.h \ + ea-widgets.c \ + ea-widgets.h diff --git a/a11y/widgets/ea-calendar-item.c b/a11y/widgets/ea-calendar-item.c new file mode 100644 index 0000000000..fee92e27d7 --- /dev/null +++ b/a11y/widgets/ea-calendar-item.c @@ -0,0 +1,165 @@ +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ +/* vim:expandtab:shiftwidth=8:tabstop=8: + */ +/* Evolution Accessibility: ea-calendar-item.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 Sun Microsystem Inc., 2003 + * + */ + +#include +#include +#include +#include +#include "ea-calendar-item.h" + +static void ea_calendar_item_class_init (EaCalendarItemClass *klass); + +static G_CONST_RETURN gchar* ea_calendar_item_get_name (AtkObject *accessible); +static G_CONST_RETURN gchar* ea_calendar_item_get_description (AtkObject *accessible); + +static gpointer parent_class = NULL; + +GType +ea_calendar_item_get_type (void) +{ + static GType type = 0; + AtkObjectFactory *factory; + GTypeQuery query; + GType derived_atk_type; + + + if (!type) { + static GTypeInfo tinfo = { + sizeof (EaCalendarItemClass), + (GBaseInitFunc) NULL, /* base init */ + (GBaseFinalizeFunc) NULL, /* base finalize */ + (GClassInitFunc) ea_calendar_item_class_init, /* class init */ + (GClassFinalizeFunc) NULL, /* class finalize */ + NULL, /* class data */ + sizeof (EaCalendarItem), /* instance size */ + 0, /* nb preallocs */ + (GInstanceInitFunc) NULL, /* instance init */ + NULL /* value table */ + }; + + /* + * Figure out the size of the class and instance + * we are run-time deriving from (GailCanvasItem, in this case) + */ + + factory = atk_registry_get_factory (atk_get_default_registry (), + GNOME_TYPE_CANVAS_ITEM); + 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, + "EaCalendarItem", &tinfo, 0); + } + + return type; +} + +static void +ea_calendar_item_class_init (EaCalendarItemClass *klass) +{ + AtkObjectClass *class = ATK_OBJECT_CLASS (klass); + + parent_class = g_type_class_peek_parent (klass); + + class->get_name = ea_calendar_item_get_name; + class->get_description = ea_calendar_item_get_description; +} + +AtkObject* +ea_calendar_item_new (GObject *obj) +{ + gpointer object; + AtkObject *atk_object; + + g_return_val_if_fail (E_IS_CALENDAR_ITEM (obj), NULL); + object = g_object_new (EA_TYPE_CALENDAR_ITEM, NULL); + atk_object = ATK_OBJECT (object); + atk_object_initialize (atk_object, obj); + atk_object->role = ATK_ROLE_CALENDAR; +#ifdef ACC_DEBUG + g_print ("ea_calendar_item created %p\n", atk_object); +#endif + return atk_object; +} + +static G_CONST_RETURN gchar* +ea_calendar_item_get_name (AtkObject *accessible) +{ + GObject *g_obj; + ECalendarItem *calitem; + gint start_year, start_month, start_day; + gint end_year, end_month, end_day; + GDate select_start, select_end; + static gchar new_name[256] = ""; + + g_return_val_if_fail (EA_IS_CALENDAR_ITEM (accessible), NULL); + + if (accessible->name) + return accessible->name; + + g_obj = atk_gobject_accessible_get_object (ATK_GOBJECT_ACCESSIBLE(accessible)); + g_return_val_if_fail (E_IS_CALENDAR_ITEM (g_obj), NULL); + + calitem = E_CALENDAR_ITEM (g_obj); + if (e_calendar_item_get_date_range (calitem, + &start_year, &start_month, &start_day, + &end_year, &end_month, &end_day)) { + ++start_month; + ++end_month; + sprintf (new_name, "calendar date range: from %d-%d-%d to %d-%d-%d.", + start_year, start_month, start_day, + end_year, end_month, end_day); + } + if (e_calendar_item_get_selection (calitem, &select_start, &select_end)) { + gint year1, year2, month1, month2, day1, day2; + + year1 = g_date_get_year (&select_start); + month1 = g_date_get_month (&select_start); + day1 = g_date_get_day (&select_start); + + year2 = g_date_get_year (&select_end); + month2 = g_date_get_month (&select_end); + day2 = g_date_get_day (&select_end); + + sprintf (new_name + strlen (new_name), + "current selection: from %d-%d-%d to %d-%d-%d.", + year1, month1, day1, + year2, month2, day2); + } + + return new_name; +} + +static G_CONST_RETURN gchar* +ea_calendar_item_get_description (AtkObject *accessible) +{ + if (accessible->description) + return accessible->description; + + return "evolution calendar widget"; +} diff --git a/a11y/widgets/ea-calendar-item.h b/a11y/widgets/ea-calendar-item.h new file mode 100644 index 0000000000..675cb4c6e7 --- /dev/null +++ b/a11y/widgets/ea-calendar-item.h @@ -0,0 +1,65 @@ +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ +/* vim:expandtab:shiftwidth=8:tabstop=8: + */ +/* Evolution Accessibility: ea-calendar-item.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 Sun Microsystem Inc., 2003 + * + */ + +#ifndef __EA_CALENDAR_ITEM_H__ +#define __EA_CALENDAR_ITEM_H__ + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +#define EA_TYPE_CALENDAR_ITEM (ea_calendar_item_get_type ()) +#define EA_CALENDAR_ITEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EA_TYPE_CALENDAR_ITEM, EaCalendarItem)) +#define EA_CALENDAR_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), EA_TYPE_CALENDAR_ITEM, EaCalendarItemClass)) +#define EA_IS_CALENDAR_ITEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EA_TYPE_CALENDAR_ITEM)) +#define EA_IS_CALENDAR_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), EA_TYPE_CALENDAR_ITEM)) +#define EA_CALENDAR_ITEM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), EA_TYPE_CALENDAR_ITEM, EaCalendarItemClass)) + +typedef struct _EaCalendarItem EaCalendarItem; +typedef struct _EaCalendarItemClass EaCalendarItemClass; + +struct _EaCalendarItem +{ + AtkGObjectAccessible parent; +}; + +GType ea_calendar_item_get_type (void); + +struct _EaCalendarItemClass +{ + AtkGObjectAccessibleClass parent_class; +}; + +AtkObject *ea_calendar_item_new (GObject *obj); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + + +#endif /* __EA_CALENDAR_ITEM_H__ */ diff --git a/a11y/widgets/ea-widgets.c b/a11y/widgets/ea-widgets.c new file mode 100644 index 0000000000..3b288dc669 --- /dev/null +++ b/a11y/widgets/ea-widgets.c @@ -0,0 +1,35 @@ +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ +/* vim:expandtab:shiftwidth=8:tabstop=8: + */ +/* Evolution Accessibility: ea-widgets.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 Sun Microsystem Inc., 2003 + * + */ + +#include "ea-factory.h" +#include "widgets/ea-calendar-item.h" +#include "ea-widgets.h" + +EA_FACTORY_GOBJECT (EA_TYPE_CALENDAR_ITEM, ea_calendar_item, ea_calendar_item_new); + +void e_calendar_item_a11y_init (void) +{ + EA_SET_FACTORY (e_calendar_item_get_type (), ea_calendar_item); +} diff --git a/a11y/widgets/ea-widgets.h b/a11y/widgets/ea-widgets.h new file mode 100644 index 0000000000..e9ec9b3ad9 --- /dev/null +++ b/a11y/widgets/ea-widgets.h @@ -0,0 +1,34 @@ +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ +/* vim:expandtab:shiftwidth=8:tabstop=8: + */ +/* Evolution Accessibility: ea-widgets.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 Sun Microsystem Inc., 2003 + * + */ + +/* Evolution Accessibility +*/ + +#ifndef _EA_WIDGETS_H__ +#define _EA_WIDGETS_H__ + +void e_calendar_item_a11y_init (void); + +#endif /* _EA_WIDGETS_H__ */ -- cgit