Add new files atk/atkgobjectaccessible.c atk/atkgobjectaccessible.h
authorPadraig O'Briain <padraigo@src.gnome.org>
Wed, 19 Dec 2001 12:34:25 +0000 (12:34 +0000)
committerPadraig O'Briain <padraigo@src.gnome.org>
Wed, 19 Dec 2001 12:34:25 +0000 (12:34 +0000)
docs/tmpl/atkgobjectaccessible.sgml

* atk/Makefile.am atk/atk.h:
Add references to new files

* atk/atkobject.c atk/atkobject.h
docs/tmpl/atkobject.sgml:
Add new function atk_object_initialize

* atk/atkobjectfactory.c atk/atkobjectfactory.h
docs/tmpl/atkobjectfactory.sgml:
Add new function atk_object_factory_get_accessible_type

* docs/atk-sections.txt:
Add new functions.
Add functions in atk-unused.txt

13 files changed:
ChangeLog
atk/Makefile.am
atk/atk.h
atk/atkgobjectaccessible.c [new file with mode: 0644]
atk/atkgobjectaccessible.h [new file with mode: 0644]
atk/atkobject.c
atk/atkobject.h
atk/atkobjectfactory.c
atk/atkobjectfactory.h
docs/atk-sections.txt
docs/tmpl/atkgobjectaccessible.sgml [new file with mode: 0644]
docs/tmpl/atkobject.sgml
docs/tmpl/atkobjectfactory.sgml

index 060ed34..b553b7a 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,24 @@
+2001-12-19  Padraig O'Briain  <padraig.obriain@sun.com>
+
+       Add new files atk/atkgobjectaccessible.c atk/atkgobjectaccessible.h
+       docs/tmpl/atkgobjectaccessible.sgml
+
+       * atk/Makefile.am atk/atk.h:
+       Add references to new files
+
+       * atk/atkobject.c atk/atkobject.h
+       docs/tmpl/atkobject.sgml:
+       Add new function atk_object_initialize
+
+       * atk/atkobjectfactory.c atk/atkobjectfactory.h
+       docs/tmpl/atkobjectfactory.sgml:
+       Add new function atk_object_factory_get_accessible_type
+
+       * docs/atk-sections.txt:
+       Add new functions.
+       Add functions in atk-unused.txt
+
+       
 2001-12-17  Darin Adler  <darin@bentspoon.com>
 
        * atk/atktext.c: Add missing #include <string.h>
index d0743a4..e4809a3 100644 (file)
@@ -36,6 +36,7 @@ libatk_la_SOURCES =           \
        atkcomponent.c          \
        atkdocument.c           \
        atkeditabletext.c       \
+       atkgobjectaccessible.c  \
        atkhyperlink.c          \
        atkhypertext.c          \
        atkimage.c              \
@@ -82,6 +83,7 @@ atk_headers = \
         atkcomponent.h         \
         atkdocument.h          \
         atkeditabletext.h      \
+        atkgobjectaccessible.h \
         atkhyperlink.h         \
         atkhypertext.h         \
         atknoopobject.h                \
index d3b22c2..858072e 100755 (executable)
--- a/atk/atk.h
+++ b/atk/atk.h
@@ -22,6 +22,7 @@
 #include <atk/atkcomponent.h>
 #include <atk/atkdocument.h>
 #include <atk/atkeditabletext.h>
+#include <atk/atkgobjectaccessible.h>
 #include <atk/atkhyperlink.h>
 #include <atk/atkhypertext.h>
 #include <atk/atkimage.h>
diff --git a/atk/atkgobjectaccessible.c b/atk/atkgobjectaccessible.c
new file mode 100644 (file)
index 0000000..377d436
--- /dev/null
@@ -0,0 +1,149 @@
+/* ATK - Accessibility Toolkit
+ * Copyright 2001 Sun Microsystems 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.
+ */
+
+#include <atk/atkgobjectaccessible.h>
+
+static void       atk_gobject_accessible_class_init       (AtkGObjectAccessibleClass   *klass);
+static void       atk_real_gobject_accessible_initialize  (AtkObject         *atk_obj,
+                                                           gpointer          data);
+static void       atk_gobject_accessible_dispose          (gpointer          data);
+
+static GQuark quark_accessible_object = 0;
+static GQuark quark_object = 0;
+static AtkObjectClass *parent_class = NULL;
+
+GType
+atk_gobject_accessible_get_type (void)
+{
+  static GType type = 0;
+
+  if (!type)
+    {
+      static const GTypeInfo tinfo =
+      {
+        sizeof (AtkGObjectAccessibleClass),
+        (GBaseInitFunc) NULL, /* base init */
+        (GBaseFinalizeFunc) NULL, /* base finalize */
+        (GClassInitFunc) atk_gobject_accessible_class_init,
+        (GClassFinalizeFunc) NULL, /* class finalize */
+        NULL, /* class data */
+        sizeof (AtkGObjectAccessible),
+        0, /* nb preallocs */
+        (GInstanceInitFunc) NULL, /* instance init */
+        NULL /* value table */
+      };
+
+      type = g_type_register_static (ATK_TYPE_OBJECT,
+                                     "AtkGObjectAccessible", &tinfo, 0);
+    }
+
+  return type;
+}
+
+/**
+ * atk_gobject_accessible_for_object:
+ * @obj: a #GObject
+ *
+ * Gets the accessible object for the specified @obj.
+ *
+ * Returns: a #AtkObject which is the accessible object for the @obj
+ **/
+AtkObject*
+atk_gobject_accessible_for_object (GObject *obj)
+{
+  AtkObject* accessible;
+
+  g_return_val_if_fail (G_IS_OBJECT (obj), NULL);
+  /* See if we have a cached accessible for this object */
+
+  accessible = g_object_get_qdata (obj,
+                                  quark_accessible_object);
+
+  if (!accessible)
+    {
+      AtkObjectFactory *factory;
+      AtkRegistry *default_registry;
+
+      default_registry = atk_get_default_registry ();
+      factory = atk_registry_get_factory (default_registry, 
+                                          G_OBJECT_TYPE (obj));
+      accessible = atk_object_factory_create_accessible (factory,
+                                                         obj);
+      g_object_set_qdata (obj, quark_accessible_object, accessible);
+    }
+  return accessible;
+}
+
+/**
+ * atk_gobject_accessible_get_object:
+ * @obj: a #AtkObject
+ *
+ * Gets the GObject for which @obj is the accessible object.
+ *
+ * Returns: a #GObject which is the object for which @obj is the accessible objedct
+ **/
+GObject *
+atk_gobject_accessible_get_object (AtkGObjectAccessible *obj)
+{
+  g_return_val_if_fail (ATK_IS_GOBJECT_ACCESSIBLE (obj), NULL);
+
+  return g_object_get_qdata (G_OBJECT (obj), quark_object);
+}
+static void
+atk_real_gobject_accessible_initialize (AtkObject  *atk_obj,
+                                        gpointer   data)
+{
+  AtkGObjectAccessible *atk_gobj;
+
+  atk_gobj = ATK_GOBJECT_ACCESSIBLE (atk_obj);
+
+  g_object_set_qdata (G_OBJECT (atk_gobj), quark_object, data);
+  atk_obj->layer = ATK_LAYER_WIDGET;
+
+  g_object_weak_ref (data,
+                     (GWeakNotify) atk_gobject_accessible_dispose,
+                     atk_gobj);
+}
+
+static void
+atk_gobject_accessible_dispose (gpointer  data)
+{
+  g_return_if_fail (ATK_IS_GOBJECT_ACCESSIBLE (data));
+
+  g_object_set_qdata (G_OBJECT (data), quark_accessible_object, NULL);
+  atk_object_notify_state_change (ATK_OBJECT (data), ATK_STATE_DEFUNCT,
+                                  TRUE); 
+  g_object_unref (data);
+}
+
+static void
+atk_gobject_accessible_class_init (AtkGObjectAccessibleClass *klass)
+{ 
+  AtkObjectClass *class;
+
+  class = ATK_OBJECT_CLASS (klass);
+
+  parent_class = g_type_class_ref (ATK_TYPE_OBJECT);
+
+  class->initialize = atk_real_gobject_accessible_initialize;
+
+  quark_accessible_object = g_quark_from_static_string ("accessible-object");
+  quark_object = g_quark_from_static_string ("object-for-accessible");
+}
diff --git a/atk/atkgobjectaccessible.h b/atk/atkgobjectaccessible.h
new file mode 100644 (file)
index 0000000..f1743ad
--- /dev/null
@@ -0,0 +1,64 @@
+/* ATK - Accessibility Toolkit
+ * Copyright 2001 Sun Microsystems 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.
+ */
+
+#ifndef __ATK_GOBJECT_ACCESSIBLE__H__
+#define __ATK_GOBJECT_ACCESSIBLE__H__
+
+#include <atk/atk.h>
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/*
+ * The AtkGObjectAccessible class is provided as a basis for implementing
+ * accessibility support for objects which are not GTK+ widgets
+ */
+#define ATK_TYPE_GOBJECT_ACCESSIBLE            (atk_gobject_accessible_get_type ())
+#define ATK_GOBJECT_ACCESSIBLE(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), ATK_TYPE_GOBJECT_ACCESSIBLE, AtkGObjectAccessible))
+#define ATK_GOBJECT_ACCESSIBLE_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), ATK_TYPE_GOBJECT_ACCESSIBLE, AtkGObjectAccessibleClass))
+#define ATK_IS_GOBJECT_ACCESSIBLE(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), ATK_TYPE_GOBJECT_ACCESSIBLE))
+#define ATK_IS_GOBJECT_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), ATK_TYPE_GOBJECT_ACCESSIBLE))
+#define ATK_GOBJECT_ACCESSIBLE_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), ATK_TYPE_GOBJECT_ACCESSIBLE, AtkGObjectAccessibleClass))
+
+typedef struct _AtkGObjectAccessible                AtkGObjectAccessible;
+typedef struct _AtkGObjectAccessibleClass           AtkGObjectAccessibleClass;
+
+struct _AtkGObjectAccessible
+{
+  AtkObject parent;
+};
+
+GType atk_gobject_accessible_get_type (void);
+
+struct _AtkGObjectAccessibleClass
+{
+  AtkObjectClass parent_class;
+};
+
+AtkObject *atk_gobject_accessible_for_object      (GObject           *obj);
+GObject   *atk_gobject_accessible_get_object      (AtkGObjectAccessible *obj);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+
+#endif /* __ATK_GOBJECT_ACCESSIBLE_H__ */
index c762db7..96c6232 100755 (executable)
@@ -1051,6 +1051,29 @@ atk_object_real_remove_property_change_handler (AtkObject           *obj,
   g_signal_handler_disconnect (obj, handler_id);
 }
 
+/**
+ * atk_object_initialize:
+ * @accessible: a #AtkObject
+ * @data: a #gpointer which identifies the object for which the AtkObject was created.
+ *
+ * This function is called when implementing subclasses of #AtkObject.
+ * It does initialization required for the new object. It is intended
+ * that this function should called only in the ..._new() functions used
+ * to create an instance of a subclass of #AtkObject
+ **/
+void
+atk_object_initialize (AtkObject  *accessible,
+                       gpointer   data)
+{
+  AtkObjectClass *klass;
+
+  g_return_if_fail (ATK_IS_OBJECT (accessible));
+
+  klass = ATK_OBJECT_GET_CLASS (accessible);
+  if (klass->initialize)
+    klass->initialize (accessible, data);
+}
+
 /*
  * This function is a signal handler for notify signal which gets emitted
  * when a property changes value.
index fa0f653..a63b8d9 100755 (executable)
@@ -350,6 +350,8 @@ void                      (* remove_property_change_handler)     (AtkObject
                 *accessible,
                                                                   guint
                 handler_id);
+void                      (* initialize)                         (AtkObject                     *accessible,
+                                                                  gpointer                      data);
   /*
    * The signal handler which is executed when there is a change in the
    * children of the object
@@ -442,6 +444,8 @@ void                 atk_object_remove_property_change_handler   (AtkObject
 void                 atk_object_notify_state_change              (AtkObject                      *accessible,
                                                                   AtkState                       state,
                                                                   gboolean                       value);
+void                 atk_object_initialize                       (AtkObject                     *accessible,
+                                                                  gpointer                      data);
                                     
 G_CONST_RETURN gchar* atk_role_get_name      (AtkRole         role);
 AtkRole               atk_role_for_name      (const gchar     *name);
index 75a82ae..11d3501 100755 (executable)
@@ -108,3 +108,25 @@ atk_object_factory_invalidate (AtkObjectFactory *factory)
   if (klass->invalidate)
      (klass->invalidate) (factory);
 }
+
+/**
+ * atk_object_factory_get_accessible_type:
+ * @factory: an #AtkObjectFactory 
+ *
+ * Gets the GType of the accessible which is created by the factory. 
+ * The value G_TYPE_INVALID is returned if no type if found.
+ * Returns: the type of the accessible which is created by the @factory.
+ **/
+GType
+atk_object_factory_get_accessible_type (AtkObjectFactory *factory)
+{
+  AtkObjectFactoryClass *klass;
+
+  g_return_val_if_fail (ATK_OBJECT_FACTORY (factory), G_TYPE_INVALID);
+
+  klass = ATK_OBJECT_FACTORY_GET_CLASS (factory);
+  if (klass->get_accessible_type)
+     return (klass->get_accessible_type) ();
+  else
+     return G_TYPE_INVALID;
+}
index a1147f9..98c72b1 100755 (executable)
@@ -48,12 +48,14 @@ struct _AtkObjectFactoryClass
 
   AtkObject* (* create_accessible) (GObject          *obj);
   void       (* invalidate)        (AtkObjectFactory *factory);
+  GType      (* get_accessible_type)    (void);
 };
 
 GType atk_object_factory_get_type();
 
-AtkObject* atk_object_factory_create_accessible(AtkObjectFactory *factory, GObject *obj);
-void       atk_object_factory_invalidate       (AtkObjectFactory *factory);      
+AtkObject* atk_object_factory_create_accessible (AtkObjectFactory *factory, GObject *obj);
+void       atk_object_factory_invalidate (AtkObjectFactory *factory);
+GType      atk_object_factory_get_accessible_type (AtkObjectFactory *factory);
 #ifdef __cplusplus
 }
 #endif /* __cplusplus */
index b4461f9..681e28a 100644 (file)
@@ -171,6 +171,7 @@ atk_object_set_role
 atk_object_connect_property_change_handler
 atk_object_remove_property_change_handler
 atk_object_notify_state_change
+atk_object_initialize
 atk_role_get_name
 atk_role_for_name
 <SUBSECTION Standard>
@@ -184,9 +185,13 @@ ATK_OBJECT_GET_CLASS
 ATK_TYPE_IMPLEMENTOR
 ATK_IS_IMPLEMENTOR
 ATK_IMPLEMENTOR
+ATK_TYPE_ROLE
+ATK_TYPE_LAYER
 AtkStateSet
 atk_implementor_get_type
 atk_object_get_type
+atk_role_get_type
+atk_layer_get_type
 </SECTION>
 
 <SECTION>
@@ -194,6 +199,7 @@ atk_object_get_type
 <TITLE>AtkObjectFactory</TITLE>
 AtkObjectFactory
 atk_object_factory_create_accessible
+atk_object_factory_get_accessible_type
 atk_object_factory_invalidate
 <SUBSECTION Standard>
 ATK_OBJECT_FACTORY
@@ -238,7 +244,9 @@ atk_relation_get_target
 ATK_RELATION
 ATK_IS_RELATION
 ATK_TYPE_RELATION
+ATK_TYPE_RELATION_TYPE
 atk_relation_get_type
+atk_relation_type_get_type
 ATK_RELATION_CLASS
 ATK_IS_RELATION_CLASS
 ATK_RELATION_GET_CLASS
@@ -386,7 +394,11 @@ ATK_TEXT
 ATK_IS_TEXT
 ATK_TYPE_TEXT
 ATK_TEXT_GET_IFACE
+ATK_TYPE_TEXT_ATTRIBUTE
+ATK_TYPE_TEXT_BOUNDARY
 atk_text_get_type
+atk_text_attribute_get_type
+atk_text_boundary_get_type
 </SECTION>
 
 <SECTION>
@@ -434,6 +446,9 @@ AtkState
 atk_state_type_register
 atk_state_type_get_name
 atk_state_type_for_name
+<SUBSECTION Standard>
+ATK_TYPE_STATE_TYPE
+atk_state_type_get_type
 </SECTION>
 
 <SECTION>
@@ -477,9 +492,28 @@ atk_get_toolkit_version
 ATK_UTIL
 ATK_IS_UTIL
 ATK_TYPE_UTIL
+ATK_TYPE_KEY_EVENT_TYPE
+ATK_TYPE_COORD_TYPE
 atk_util_get_type
+atk_key_event_type_get_type
+atk_coord_type_get_type
 ATK_UTIL_CLASS
 ATK_IS_UTIL_CLASS
 ATK_UTIL_GET_CLASS
 </SECTION>
 
+<SECTION>
+<FILE>atkgobjectaccessible</FILE>
+<TITLE>AtkGObjectAccessible</TITLE>
+AtkGObjectAccessible
+atk_gobject_accessible_for_object
+atk_gobject_accessible_get_object
+<SUBSECTION Standard>
+ATK_GOBJECT_ACCESSIBLE
+ATK_IS_GOBJECT_ACCESSIBLE
+ATK_TYPE_GOBJECT_ACCESSIBLE
+atk_gobject_accessible_get_type
+ATK_GOBJECT_ACCESSIBLE_CLASS
+ATK_IS_GOBJECT_ACCESSIBLE_CLASS
+ATK_GOBJECT_ACCESSIBLE_GET_CLASS
+</SECTION>
diff --git a/docs/tmpl/atkgobjectaccessible.sgml b/docs/tmpl/atkgobjectaccessible.sgml
new file mode 100644 (file)
index 0000000..85c93b1
--- /dev/null
@@ -0,0 +1,43 @@
+<!-- ##### SECTION Title ##### -->
+AtkGObjectAccessible
+
+<!-- ##### SECTION Short_Description ##### -->
+
+
+<!-- ##### SECTION Long_Description ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### SECTION See_Also ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### STRUCT AtkGObjectAccessible ##### -->
+<para>
+
+</para>
+
+@parent: 
+
+<!-- ##### FUNCTION atk_gobject_accessible_for_object ##### -->
+<para>
+
+</para>
+
+@obj: 
+@Returns: 
+
+
+<!-- ##### FUNCTION atk_gobject_accessible_get_object ##### -->
+<para>
+
+</para>
+
+@obj: 
+@Returns: 
+
+
index 235e3ee..c314931 100644 (file)
@@ -339,6 +339,15 @@ AtkObject
 @value: 
 
 
+<!-- ##### FUNCTION atk_object_initialize ##### -->
+<para>
+
+</para>
+
+@accessible: 
+@data: 
+
+
 <!-- ##### FUNCTION atk_role_get_name ##### -->
 <para>
 
index 740c1a9..4f4eb38 100644 (file)
@@ -31,6 +31,15 @@ AtkObjectFactory
 @Returns: 
 
 
+<!-- ##### FUNCTION atk_object_factory_get_accessible_type ##### -->
+<para>
+
+</para>
+
+@factory: 
+@Returns: 
+
+
 <!-- ##### FUNCTION atk_object_factory_invalidate ##### -->
 <para>