diff options
author | Bolian Yin <bolian.yin@sun.com> | 2003-08-27 11:36:42 +0800 |
---|---|---|
committer | Bolian Yin <byin@src.gnome.org> | 2003-08-27 11:36:42 +0800 |
commit | e8fc140c7030594e556b56242afd2b52abc61634 (patch) | |
tree | 876546f299eef99a70b4c31868d83f6a903604bd /a11y/widgets | |
parent | 7e3eb5f87d84f5c7e7c945bb971367861928a9a0 (diff) | |
download | gsoc2013-evolution-e8fc140c7030594e556b56242afd2b52abc61634.tar gsoc2013-evolution-e8fc140c7030594e556b56242afd2b52abc61634.tar.gz gsoc2013-evolution-e8fc140c7030594e556b56242afd2b52abc61634.tar.bz2 gsoc2013-evolution-e8fc140c7030594e556b56242afd2b52abc61634.tar.lz gsoc2013-evolution-e8fc140c7030594e556b56242afd2b52abc61634.tar.xz gsoc2013-evolution-e8fc140c7030594e556b56242afd2b52abc61634.tar.zst gsoc2013-evolution-e8fc140c7030594e556b56242afd2b52abc61634.zip |
add widgets directory; move calendar idl stuff to calendar directory; stop
2003-08-27 Bolian Yin <bolian.yin@sun.com>
* 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
Diffstat (limited to 'a11y/widgets')
-rw-r--r-- | a11y/widgets/Makefile.am | 23 | ||||
-rw-r--r-- | a11y/widgets/ea-calendar-item.c | 165 | ||||
-rw-r--r-- | a11y/widgets/ea-calendar-item.h | 65 | ||||
-rw-r--r-- | a11y/widgets/ea-widgets.c | 35 | ||||
-rw-r--r-- | a11y/widgets/ea-widgets.h | 34 |
5 files changed, 322 insertions, 0 deletions
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 <bolian.yin@sun.com> Sun Microsystem Inc., 2003 + * + */ + +#include <stdio.h> +#include <string.h> +#include <libgnomecanvas/gnome-canvas.h> +#include <glib/gdate.h> +#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 <bolian.yin@sun.com> Sun Microsystem Inc., 2003 + * + */ + +#ifndef __EA_CALENDAR_ITEM_H__ +#define __EA_CALENDAR_ITEM_H__ + +#include <atk/atkgobjectaccessible.h> +#include <misc/e-calendar-item.h> + +#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 <bolian.yin@sun.com> 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 <bolian.yin@sun.com> 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__ */ |