Re: Could we discuss the patch again on gal atk implementation? was:Re: [evolution-patches] Re: GAL status



On Wed, 2003-07-30 at 05:23, Mike Kestner wrote:
> <mk> comments inline.
> 
> 
> --- gal/Makefile.am     28 Jul 2003 16:36:10 -0000      1.67
> +++ gal/Makefile.am     29 Jul 2003 10:56:27 -0000
> @@ -1,5 +1,5 @@
>  nonui_subdirs = util
> -ui_subdirs    = widgets e-table e-text menus shortcut-bar . a11y
> +ui_subdirs    = widgets e-table e-text menus shortcut-bar a11y .
> 
> <mk>The "." is not needed if the current dir is to be built last.  You
> can remove it.</mk>

===================================================================
> 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        29 Jul 2003 10:56:31 -0000
> @@ -1,4 +1,4 @@
> -SUBDIRS = e-table e-text
> +SUBDIRS = e-table e-text 
okay, fix these two. The new patch is merge.patch_v4.
>  
>  SUBDIRS = $(nonui_subdirs) $(ui_subdirs) 
>  
> @@ -16,4 +16,5 @@
>                    e-text/libetext.la \
>                    menus/libgalmenus.la \
>                    shortcut-bar/libshortcut-bar.la \
> +                  a11y/libgal-a11y-2.0.la              \
> 
> <mk>Why are you linking the a11y lib into libgal-2.0.so?</mk>


> 
> <mk> Hopefully somebody who understands atk has reviewed this too?  I
> don't really know enough about it to give an informed opinion on this
> factory code.</mk>

In fact, The actually GAIL module (gnome atk implementation library)
owner Padraig discussed with us and  told us on how to do atk
implentation on custom gtkwidget. There is a draft paper by him in 
attachment 

Let me explain why libgal-a11y-2.0 is linked into libgal and why e-text
and e-table in the future is/will be linked into libgal-a11y-2.0.so. 

Unlike the original method -- make the atk implementation as a gtk
module, now gnome a11y architect/developer (Bill and Padraig) all agree
that the atk implementation should be an built-in feature of the widget.
And the Padraig's experience  shows that will not get performance down
if the AT apps is not running.

That is to say, the custom widget is first instantiated, the
corresponding atk implementation should be registered. Generally, a atk
register function should be called in the widget's classinit function. 
And this is what gtkhtml has done before we start our tasks.

Then, you see, in the view of source code, e-text will call 
gal_a11y_e_text_get_type at least. That is why I have to link 
libgal-2.0 against libgal-a11y-2.0.so. 

I also attach the e-paned atk implementation patch (merge.patch_v2)  for
your reference. 


Best Regards
Gilbert 

This paper describes the current state of the art of making GNOME
applications accessible.

An accessible application is an application usable by people with disabilities.

The key aspects of accessibility are:

- the application is usable using the keyboard alone. 

- the application uses standard mechanism for theming.

- providing programmatic access to the features and capabilities of
  application objects.

The bulk of this paper focuses on this last topic. It provides an introduction
to ATK and discusses how gucharmap was made accessible.


Keyboard Navigation
===================
In order to be accessible the application must be usable using the
keyboard alone.

Every object in the application on which a mouse button can be clicked must
be reachable using the keyboard. For exmaple, the keyboard equivalent to
clicking on an item in a menu bar is to either press F10 to display the
menu corresponding to first item in the menu bar and then use the arrow keys
to navigate to the required menu item or use the mnemonic, Alt+F to display
the File menu.

Normally the Tab key is used to change the focus object. When an object
has focus there must be a visible indication that the object has focus.
This is usually a dotted line drawn around the focused object. 


Theming
=======
Users with vision impairment may need to use  a Large Print theme, i.e.
a theme in which the size of the text and icons is larger than normal. 
All text and icons in the application must resize consistently.

Users with other disabilities may need to use themes with high or low contrast.


Programmatic Access to Application Objects
==========================================
Before discussing this we must introduce some acronyms.

ATK: "Accessibility Toolkit" is an accessibility API that can be implemented 
for widgets or objects. This library is a dependency of gtk+ and the gtk
library automatically loads this library. Thus, ATK functions can be called
in any program which uses GTK widgets.

gail: Gtk Accessibility Implementation Library" is a GTK module which
implements ATK for Gtk widgets and GnomeCanvas.

libgail-gnome: is a GTK module which provides accessibility support for
Bonobo Controls.

AT: "Assistive Technology" is hardware, software or both which provides
access to programs for users with disabilities. Examples are GOK 
(Gnome Onscreen Keyboard) and gnopernicus, which provides access to
blind or users with severe vision impairment using magnification, speech
or braille output. The AT runs in a separate process to the program being run
by the user.

AT-SPI: "At Service Provider Interface" provides an API to the AT to query
and manipulate accessible objects in the program being run by the user.
It uses Bonobo to communicate with the user program. The AT-SPI also has 
a GTK module called atk-bridge which is loaded into the user program and
which does the communication with the AT. 

Accessibility support is enabled by setting the Gconf key
/apps/desktop/gnome/interface/accessibility to true. Programs which call
gnome_program_init will have the required GTK modules automatically loaded.
Pure GTK programs rely on the value of the GTK_MODULES environment variable
which must be set to "gail:atk-bridge" in order to enable assistive 
technology support.


Overview of ATK
===============
ATK uses the GObject system including iheritance, signals and properties.

AtkObject
=========
An accessible object is an instance of AtkObject. 

The following code returns the AtkObject corresponding to a GtkWidget. 

AtkObject* atko = gtk_widget_get_accessible (widget);

The object is created if it did not already exist. One should never
call g_object_unref on the value returned from gtk_widget_get_accessible.
The AtkObject is destroyed when the corresponding GtkWidget is destroyed
unless g_object_ref() has been called.


Basic ATK Properties
====================
This section discusses the most important properties of AtkObject.
These properties are used by ATs in order to present a coherent view of
the application to its user.

Glade provides support for specifying accessible-name, accessible-description 
and relation, See the WheelChair icon tab in glade-2.


Name
====
Each accessible object has a name which should be as specific as possible
and should distinguish an object from others in the same context.

The following statement, from the CDPlayer applet, sets the name. 

atk_object_set_name (atko, _("Disc Image"));

If no name is specified by atk_object_set_name, by default the name of the 
GtkWidget is returned as the name. It is necessary to override the get_name 
class method to return is different value for the name for some widget types. 
For example, we return the text of a GtkLabel as the name. The following code 
does that.

static G_CONST_RETURN gchar*
gail_label_get_name (AtkObject *accessible)
{
  g_return_val_if_fail (GAIL_IS_LABEL (accessible), NULL);

  if (accessible->name != NULL)
    return accessible->name;
  else
    {
      /*
       * Get the text on the label
       */
      GtkWidget *widget;

      widget = GTK_ACCESSIBLE (accessible)->widget;
      if (widget == NULL)
        /*
         * State is defunct
         */
        return NULL;

      g_return_val_if_fail (GTK_IS_LABEL (widget), NULL);

      return gtk_label_get_text (GTK_LABEL (widget));
    }
}

It is unlikely that this class method will need to be overridden when providing
an accessible implementation for a custom widget.


Description
===========
The description clarifies or augments the information contained in 
the accessible name. If a widget has a tooltip the contents of the tooltip is
returned as the description of the corresponding AtkObject. The following
statement from the CD Player applet sets the accessible description.

atk_object_set_description (atko, _("An image of a cd-rom disc"));

Often, the only accesibility support which needs to be added to an
application is to add a name or description to some AtkObjects. 


Role
====
The role defines an object's function. Possible values include push-button, 
menu-bar and combo-box, which is used for both GtkComboBox and GtkOptionMenu.
It is possible for an application to add a new role although 
this feature has not been used yet.


State
=====
The function atk_object_ref_state_set returns information about an object's 
state. The state value include FOCUSED, SHOWING, EDITABLE. There is also a
special state called DEFUNCT, which indicates that the widget corresponding 
to the accessible object no longer exists.

The accesible implementation for a custom widget will often have to override
the method ref_state_set in AtkObjectClass. For instance in 
gucharmap/gucharmap/chartable_accessible.c the function 
chartable_accessible_ref_state_set adds the state ATK_STATE_MANAGES_DESCENDANTS.

static AtkStateSet*
chartable_accessible_ref_state_set (AtkObject *obj)
{
  AtkStateSet *state_set;
  GtkWidget *widget;

  state_set = ATK_OBJECT_CLASS (parent_class)->ref_state_set (obj);
  widget = GTK_ACCESSIBLE (obj)->widget;

  if (widget != NULL)
    atk_state_set_add_state (state_set, ATK_STATE_MANAGES_DESCENDANTS);

  return state_set;
}

Note that default implementation of ref_state_set is called so we only need
to add the extra state.
 

Parent/Child
============
An AtkObject corresponding to a widget is in a hierarchy with a parent
and possible some children. The AtkObject corresponding to a top level
window has as parent an AtkObject corresponding to the application.
There are functions provided, atk_object_get_parent, 
atk_object_get_index_in_parent and atk_object_ref_accessible_child which
allow the hierarchy to be travered.

This hierarchy is not necessarily the same as the widget hierarchy.
For instance, if a GtkButton contains only one label, the corresponding
AtkObject does not report any children.


Relation Sets
=============
An AtkObject may have an AtkRelationSet. This is a many-to-many mapping
of UI objects. There are a number of relation types defined. 

For instance a LABEL_FOR relation identifies an AtkObject for which the 
current AtkObject is a label. If a widget, e.g. a GtkOptionMenu, is specified 
as the mnemonic widget for a GtkLabel, the AtkObject for the GtkLabel has a 
LABEL_FOR relation identifying the AtkObject corresponding to the 
GtkOptionMenu and the AtkObject for the GtkOptionMenu has a LABELLED_BY 
relation identifying the AtkObject for the GtkLabel.

The AtkObject for a GtkRadioButton or a GtkRadioButtonItem has a MENBER_OF
relation which identifies the AtkObjects corresponding to all the
widgets in the button group.


ATK Interfaces
==============
An AtkObject may implement one or more of the following interfaces:

AtkAction 

This interface allows an object to be activated. Possible actions are
click, press, toggle, expand. It action is implemented for GtkButton.
An action can have a name, a desctiption and an optional keybinding.


AtkComponent 

This interface gives screen geometry information. It is implemented for 
all GtkWidgets.


AtkDocument 

This interface should be implemented by any object which has an associated
document object model. There is no implementation yet.


AtkEditableText 

This interface provides access to editable text. Any object implementing this
interface should also implement AtkText. It is implemented for GtkEntry and
GtkTextView.


AtkHypertext

This interface provides the standard mechanism for manipulating hyperlinks.
The function atk_hypertext_get_link returns an AtkHyperlink object. This is
an object which encapsulates a link and implements the AtkAction interface.

AtkHypertext is implemented in the accessible implementation for gtkhtml2. 
It will also be implemented in mozilla accessibility implementation.


AtkImage

This interface provides information about images. It is implemented for 
GtkImage.


AtkSelection

This interface allows items in a container object to be selected. It is
implemented for GtkMenu.

AtkStreamableContent

This interface provides streaming access to backing data. There is no 
implementation yet


AtkTable 

This interface provides access to child objects arranged by row/column.
Row and column headers can also be accessible objects. This interface is
implemented for GtkTreeView.


AtkText

This interface provides access to text content and attributes. 
The text can be navigated by character, word, line, sentence or attribute run.
It also provides read and write access to the text caret. Signals for
text-changed and text-caret must be emitted when these change.
This interface is implemented for GtkEntry and GtkTextView.

AtkValue 

This interface provides the mechansm to determine and set a numerical value
as well as get the minimum and maximum value. This interface is implemented 
for GtkSpinButton.


It is posible to determine whether an AtkObject implements an interface.
For example the statment ATK_IS_TEXT (akto) determines whether atko 
implements the AtkText interface.

When implementing a custom widget one must decide which methods for interfaces
which are implemented for the parent must be overridden. One must also decide
which interfaces need to be implemented to describe the capabilites of the 
widget.


The following GNOME components contain code which implement accessibility 
support:

gucharmap: Contains implementation of cell and AtkTable.

libzvt: Provides an accessible object, which implements AtkText for ZvtTerm.

gtkhtml2: Provides accessible objects corresponding to layout objects to
          make the HTMNL accessible.

eel: Implements accessible objects for EelCanvas and provides some 
     boiler-plate code to make it easier to use ATK in nautilus

nautilus: Implements accessible object for Zoom Control in addition to using
          accessibility support provided in eel.

gnome-applets: Most of the accessibility support is adding accessible name
               and descriptions to objects.

libwnck: Implements accessible support for Workspace Switcher applet.

AtkObjectFactory
================
Each accesible object implementation has a corresponding accessible object
factory.

A factory has two important methods, get_accessible_type which returns the
GType of the object created by this factory and create_accessible which 
creates an accessible object for the specified GObject. Up to now we have
spoken only of creating an AtkObject for a GtkWidget. However an AtkObject
can be created for any GObject.

The function atk_registry_set_factory_type specifies what object factory is
used to create the accessible object for a GType.

The function call below is in the function gucharmap_table_init in
gucharmap/gucharmap/gucharmap-table.c and specifies that 
ChartableAccessibleFactory should be used to create an accessible object
for a GtkDrawingArea in gucharmap if accessibility is enabled.

  if (GTK_IS_ACCESSIBLE (gtk_widget_get_accessible (GTK_WIDGET (chartable))))
    {
      /* Accessibility support is enabled */
      atk_registry_set_factory_type (atk_get_default_registry (),
                                     GTK_TYPE_DRAWING_AREA,
                                     chartable_accessible_factory_get_type ());
    }

The code in gtkwidget.c which creates an AtkObject for a widget is

    factory = atk_registry_get_factory (atk_get_default_registry (),
                                        G_TYPE_FROM_INSTANCE (widget));
    accessible =
      atk_object_factory_create_accessible (factory,
                                            G_OBJECT (widget));

If accessibility support is not enabled the call to 
atk_registry_set_factory_type will not have been made and in this case
the function gtk_widget_get_accessible will return an instance of
AtkNoOpObject which is an AtkObject which implements all ATK interfaces
but does nothing. This allows functions such as atk_object_set_name to
be called even if accessibility support is not enabled.


AtkGObjectAccessible
====================
This is an AtkObject which can be used when implementing accessibility
support for an object which is not a GtkWidget. 

It is used in gail in the implementation of accessibility for Gnomecanvas 
and in eel in the implementation of accessibility support for EelCanvas.


What extra effort is required to make application accessible
============================================================
Program which use GTK+ widgets may not need any effort to make them
accessible. Programs which use custom widgets will normally require
more effort.

The first step is to evaluate the program. This is done by using the
program at-poke. Its source can be obtained from GNOME CVS or downloaded from
http://ftp.gnome.org/Public/GNOME/sources/at-poke/. 

The program is started with accessibility enabled and at-poke is run.
The program can be examined in at-poke. One can determine whether names
or desriptions are mising and whether the object hierarchy is correct.

When I did this for gucharmap I found that the table of Unicode characters
was not visible in at-poke. The reason for this is that the table is
drawn in a GtkDrawingArea and does not use widgets for the individual cells.

We also need to define accessible objects for the cells in the table.


Run-time inheritance from gail
==============================
We need an AtkObject for the GtkDrawingArea which has the standard 
accessibility support we would get if we just used gail but also
provides additional functionality.

We would like to derive our object from the accessible object defined in
gail for GtkDrawingArea but our problem is that we do not know what that
is and we do not wish to have to link to libgail at compile time.

The function which does this is below and the implementation of an accessible 
object for a custom widget will need a similar function.

GType
chartable_accessible_get_type (void)
{
  static GType type = 0;

  if (!type)
  {
    static GTypeInfo tinfo =
    {
      sizeof (ChartableAccessibleClass),
      (GBaseInitFunc) NULL, /* base init */
      (GBaseFinalizeFunc) NULL, /* base finalize */
      (GClassInitFunc) chartable_accessible_class_init, /* class init */
      (GClassFinalizeFunc) NULL, /* class finalize */
      NULL, /* class data */
      sizeof (ChartableAccessible), /* instance size */
      0, /* nb preallocs */
      (GInstanceInitFunc) NULL, /* instance init */
      NULL /* value table */
    };

    static const GInterfaceInfo atk_table_info =
    {
        (GInterfaceInitFunc) chartable_accessible_table_interface_init,
        (GInterfaceFinalizeFunc) NULL,
        NULL
    };

    static const GInterfaceInfo atk_component_info =
    {
        (GInterfaceInitFunc) chartable_accessible_component_interface_init,
        (GInterfaceFinalizeFunc) NULL,
        NULL
    };

    /*
     * Figure out the size of the class and instance
     * we are deriving from
     */
    AtkObjectFactory *factory;
    GType derived_type;
    GTypeQuery query;
    GType derived_atk_type;

    /*
     * This step returns GTK_WIDGET. If gail contained an implementation of
     * AtkObject for GtkDrawingArea we would need to define a new class
     * which derived from GtkDrawingArea and use that.
     */
    derived_type = g_type_parent (GTK_TYPE_DRAWING_AREA);
    factory = atk_registry_get_factory (atk_get_default_registry (),
                                        derived_type);
    /*
     * This step returns GAIL_WIDGET
     */
    derived_atk_type = atk_object_factory_get_accessible_type (factory);
    g_type_query (derived_atk_type, &query);
    /*
     * We define class and instance size for ChartableAccessible to be the 
     * same as for GailWidget. We cannot define any variables in the structs
     * ChartableAccessible or ChartableAccessibleClass. If we need such
     * variables in our implementation we must use object data.
     */
    tinfo.class_size = query.class_size;
    tinfo.instance_size = query.instance_size;

    type = g_type_register_static (derived_atk_type,
                                   "ChartableAccessible", &tinfo, 0);

    g_type_add_interface_static (type, ATK_TYPE_TABLE,
                                 &atk_table_info);

    g_type_add_interface_static (type, ATK_TYPE_COMPONENT,
                                 &atk_component_info);
  }

  return type;
}


In libzvt there is a requirement for an accessible object for a ZvtTerm so
the method get_accessible in GtkWidget is overridden by zvt_term_get_accessible
in libzvt/livzbt./zvtterm.c. The first time the function is called the factory
to be used to create the accessible is registered if accessibility is
enabled.

static AtkObject *
zvt_term_get_accessible (GtkWidget *widget)
{
  static gboolean first_time = TRUE;
  AtkRegistry *registry;
  AtkObjectFactory *factory;
  GType derived_type;
  GType derived_atk_type;

  if (first_time)
    {
      /* Determine whether accessibility is enabled by checking accessible
         created for parent */

      registry = atk_get_default_registry ();
      derived_type = g_type_parent (ZVT_TYPE_TERM);
      factory = atk_registry_get_factory (registry,
                                         derived_type);
      derived_atk_type = atk_object_factory_get_accessible_type (factory);
      if (g_type_is_a(derived_atk_type, GTK_TYPE_ACCESSIBLE))
        {
          atk_registry_set_factory_type (registry,
                                         ZVT_TYPE_TERM, ZVT_TYPE_ACCESSIBLE_FACT
ORY);
        }
      first_time = FALSE;
    }
  return GTK_WIDGET_CLASS(parent_class)->get_accessible (widget);
}


Accessibility Implementation
============================
When implementing ChartableAccessible in gucharmap it was was necessary to
override some methods in AtkObject and AtkComponent and to implement
AtkTable.

The methods in AtkObject which needed to be overridden were initialize,
ref_child, ref_state_set and get_n_children.

The initialize method will normally have to be overridden when implementing 
a custom widget. Note that this method chains up in that it calls its 
parent class's initialize method. This method normally connects to signals
on the widget in order to report on change of widget state.

The ref_child method is needed in this case as we need to return an
AtkObject corresponding to a Unicode cell.

The ref_state method adds the state MANAGES_DESCENDANTS to indicate
that active-descendant-changed signal will be emitted when the focused cell
changes.

The get_n_children method returns the number of cells in the table.

The only method in AtkComponent which needed to be overridden was 
ref_accessible_at_point which identifies the object at a particular point
on the screen.

CharTableAccessible also needed an implementation of AtkTable.

Most of the implementation for CharTableAccessible is similar to
GailTreeView, the accessibility implementation for GtkTreeView.


Flyweight AtkObjects
====================
Flyweight AtkObjects are accessible objects corresponding to objects which 
are not GtkWidgets. Examples are cells in a table and icons in an icon list.

For examples see GailCell in gail which is used in the accessibility 
implementation for cells in a GtkClist and GtkTreeView and CharcellAccessible
in gucharmap which is used to represent a cell in the Unicode table.
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	29 Jul 2003 10:56:20 -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-2.0
 Cflags: -I${includedir}/gal-2.0
Index: gal/Makefile.am
===================================================================
RCS file: /cvs/gnome/gal/gal/Makefile.am,v
retrieving revision 1.67
diff -u -r1.67 Makefile.am
--- gal/Makefile.am	28 Jul 2003 16:36:10 -0000	1.67
+++ gal/Makefile.am	29 Jul 2003 10:56:27 -0000
@@ -1,5 +1,5 @@
 nonui_subdirs = util
-ui_subdirs    = widgets e-table e-text menus shortcut-bar . a11y
+ui_subdirs    = widgets e-table e-text menus shortcut-bar a11y
 
 SUBDIRS = $(nonui_subdirs) $(ui_subdirs) 
 
@@ -16,4 +16,5 @@
 		   e-text/libetext.la \
 		   menus/libgalmenus.la \
 		   shortcut-bar/libshortcut-bar.la \
+		   a11y/libgal-a11y-2.0.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	29 Jul 2003 10:56:31 -0000
@@ -7,28 +7,30 @@
 	$(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-2.0.la
 
 libgal_a11y_2_0_la_LDFLAGS =    \
-	-rpath $(moduledir) -module -avoid-version -no-undefined \
+	-avoid-version -no-undefined \
         @LDFLAGS@
 
 libgal_a11y_2_0_la_SOURCES =	\
-	gal-a11y-util.c		\
-	init.c
+	gal-a11y-util.c
 
 libgal_a11y_2_0includedir = $(includedir)/gal-$(GAL_API_VERSION)/gal/a11y
 
 libgal_a11y_2_0include_HEADERS =		\
-	gal-a11y-util.h
+	gal-a11y-util.h			\
+	gal-a11y-factory.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	\
+	$(top_builddir)/gal/e-text/libetext.la	\
 	$(EXTRA_GNOME_LIBS)
--- /dev/null	2002-08-31 07:31:37.000000000 +0800
+++ gal/a11y/gal-a11y-factory.h	2003-07-29 16:34:30.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__ */
Index: gal-2.0.pc.in
===================================================================
RCS file: /cvs/gnome/gal/gal-2.0.pc.in,v
retrieving revision 1.4
retrieving revision 1.4.2.1
diff -u -r1.4 -r1.4.2.1
--- gal-2.0.pc.in	21 Jan 2003 16:48:00 -0000	1.4
+++ gal-2.0.pc.in	15 Jul 2003 06:34:18 -0000	1.4.2.1
@@ -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
retrieving revision 1.268.2.1
diff -u -r1.270 -r1.268.2.1
--- configure.in	25 Jun 2003 17:26:35 -0000	1.270
+++ configure.in	15 Jul 2003 06:34:18 -0000	1.268.2.1
@@ -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
retrieving revision 1.65.2.1
diff -u -r1.65 -r1.65.2.1
--- gal/Makefile.am	3 May 2003 17:05:27 -0000	1.65
+++ gal/Makefile.am	15 Jul 2003 06:34:18 -0000	1.65.2.1
@@ -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
retrieving revision 1.3.2.3
diff -u -r1.3 -r1.3.2.3
--- gal/a11y/Makefile.am	3 May 2003 17:05:28 -0000	1.3
+++ gal/a11y/Makefile.am	25 Jul 2003 04:08:26 -0000	1.3.2.3
@@ -1,4 +1,4 @@
-SUBDIRS = e-table e-text
+SUBDIRS = e-table e-text e-paned
 
 INCLUDES =					\
 	-I$(top_srcdir)                         \
@@ -7,28 +7,30 @@
 	$(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_a11y_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 =		\
-	gal-a11y-util.h
+libgal_a11yinclude_HEADERS =		\
+	gal-a11y-util.h			\
+	gal-a11y-factory.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
retrieving revision 1.10.2.1
diff -u -r1.10 -r1.10.2.1
--- gal/e-paned/e-paned.c	16 Nov 2002 23:31:47 -0000	1.10
+++ gal/e-paned/e-paned.c	15 Jul 2003 06:34:20 -0000	1.10.2.1
@@ -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
Index: gal/a11y/e-paned/Makefile.am
===================================================================
RCS file: gal/a11y/e-paned/Makefile.am
diff -N gal/a11y/e-paned/Makefile.am
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ gal/a11y/e-paned/Makefile.am	15 Jul 2003 06:34:20 -0000	1.1.2.1
@@ -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
Index: gal/a11y/e-paned/gal-a11y-e-paned.c
===================================================================
RCS file: gal/a11y/e-paned/gal-a11y-e-paned.c
diff -N gal/a11y/e-paned/gal-a11y-e-paned.c
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ gal/a11y/e-paned/gal-a11y-e-paned.c	25 Jul 2003 09:42:53 -0000	1.1.2.3
@@ -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_if_fail (GTK_IS_ACCESSIBLE (obj));
+
+  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_if_fail (GTK_IS_ACCESSIBLE (obj));
+
+  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_if_fail (GTK_IS_ACCESSIBLE (obj));
+
+  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), FALSEN);
+
+  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;
+}
+
+
Index: gal/a11y/e-paned/gal-a11y-e-paned.h
===================================================================
RCS file: gal/a11y/e-paned/gal-a11y-e-paned.h
diff -N gal/a11y/e-paned/gal-a11y-e-paned.h
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ gal/a11y/e-paned/gal-a11y-e-paned.h	15 Jul 2003 06:34:20 -0000	1.1.2.1
@@ -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__ */
Index: gal/a11y/gal-a11y-factory.h
===================================================================
RCS file: gal/a11y/gal-a11y-factory.h
diff -N gal/a11y/gal-a11y-factory.h
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ gal/a11y/gal-a11y-factory.h	15 Jul 2003 06:34:19 -0000	1.1.2.1
@@ -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]