Added new functions to AtkUtil.
authorBrian Cameron <bcameron@src.gnome.org>
Fri, 29 Jun 2001 16:56:29 +0000 (16:56 +0000)
committerBrian Cameron <bcameron@src.gnome.org>
Fri, 29 Jun 2001 16:56:29 +0000 (16:56 +0000)
ChangeLog
atk/atkutil.c
atk/atkutil.h
docs/atk-sections.txt
docs/tmpl/atkutil.sgml

index 7e8aad4..72c0f5d 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,9 @@
 2001-06-28  Brian Cameron <brian.cameron@sun.com>
+       * atk/atkutil.c atk/atkutil.h docs/atk-sections.txt
+       docs/tmpl/atkutil.sgml
+       Added new functiosn to AtkUtil.
+
+2001-06-28  Brian Cameron <brian.cameron@sun.com>
        * atk/Makefile.am atk/atk.h atk/atkdocument.c atk/atkdocument.h
        docs/atk-docs.sgml docs/atk-sections.txt docs/tmpl/atk-unused.sgml
        docs/tmpl/atkobject.sgml
index 91a427a..5516924 100755 (executable)
 #include "atkutil.h"
 #include "atkmarshal.c"
 
+static void atk_util_class_init (AtkUtilClass *klass);
+
+GType
+atk_util_get_type (void)
+{
+  static GType type = 0;
+
+  if (!type)
+    {
+      static const GTypeInfo typeInfo =
+      {
+        sizeof (AtkUtilClass),
+        (GBaseInitFunc) NULL,
+        (GBaseFinalizeFunc) NULL,
+        (GClassInitFunc) atk_util_class_init,
+        (GClassFinalizeFunc) NULL,
+        NULL,
+        sizeof (AtkUtil),
+        0,
+        (GInstanceInitFunc) NULL,
+      } ;
+      type = g_type_register_static (G_TYPE_OBJECT, "AtkUtil", &typeInfo, 0) ;
+    }
+  return type;
+}
+
+static void
+atk_util_class_init (AtkUtilClass *klass)
+{
+  klass->add_global_event_listener = NULL;
+  klass->remove_global_event_listener = NULL;
+  klass->get_root = NULL;
+  klass->get_toolkit_name = NULL;
+  klass->get_toolkit_version = NULL;
+}
+
 /*
  * This file supports the addition and removal of multiple focus handlers
  * as long as they are all called in the same thread.
  */
-static AtkFocusTrackerInit  focus_tracker_init = (AtkFocusTrackerInit) NULL;
+static AtkEventListenerInit  focus_tracker_init = (AtkEventListenerInit) NULL;
 
 static gboolean init_done = FALSE;
 
@@ -34,12 +70,13 @@ static gboolean init_done = FALSE;
 static GArray *trackers = NULL;
 static guint  index = 0;
 
+typedef struct _FocusTracker FocusTracker;
+
 struct _FocusTracker {
   guint index;
-  AtkFocusTracker func;
+  AtkEventListener func;
 };
-typedef struct _FocusTracker FocusTracker;
-  
+
 /**
  * atk_focus_tracker_init:
  * @add_function: Function to be called for focus tracker initialization
@@ -50,7 +87,7 @@ typedef struct _FocusTracker FocusTracker;
  * focus tracking.
  **/
 void
-atk_focus_tracker_init (AtkFocusTrackerInit    init)
+atk_focus_tracker_init (AtkEventListenerInit    init)
 {
   if (!focus_tracker_init)
     focus_tracker_init = init;
@@ -67,7 +104,7 @@ atk_focus_tracker_init (AtkFocusTrackerInit    init)
  * Returns: added focus tracker id, or 0 on failure.
  **/
 guint
-atk_add_focus_tracker (AtkFocusTracker   focus_tracker)
+atk_add_focus_tracker (AtkEventListener   focus_tracker)
 {
   g_return_val_if_fail (focus_tracker, 0);
 
@@ -148,3 +185,109 @@ atk_focus_tracker_notify (AtkObject       *object)
     item->func (object);
   }
 }
+
+/**
+ * atk_add_global_event_listener:
+ * @listener: the listener to notify
+ * @event_type: the type of event for which notification is requested
+ *
+ * Adds the specified function to the list of functions to be called
+ * when an event of type event_type occurs.
+ *
+ * Returns: added event listener id, or 0 on failure.
+ **/
+guint  
+atk_add_global_event_listener (AtkEventListener listener, gchar* event_type)
+{
+  AtkUtilClass *klass = g_type_class_peek (ATK_TYPE_UTIL);
+  if (klass->add_global_event_listener) 
+    {
+      return klass->add_global_event_listener (listener, event_type);
+    }
+  else
+    {
+      return -1;
+    }
+}
+
+/**
+ * atk_remove_global_event_listener:
+ * @listener_id: the id of the event listener to remove
+ *
+ * Removes the specified event listener
+ **/
+void   
+atk_remove_global_event_listener (guint listener_id)
+{
+  AtkUtilClass *klass = g_type_class_peek (ATK_TYPE_UTIL);
+  if (klass->remove_global_event_listener) 
+    {
+      return klass->remove_global_event_listener (listener_id);
+    }
+  else
+    {
+      return;
+    }
+}
+
+/**
+ * atk_get_root:
+ *
+ * Gets the root accessible container for the current application.
+ *
+ * Returns: the root accessible container for the current application
+ **/
+AtkObject* 
+atk_get_root(void)
+{
+  AtkUtilClass *klass = g_type_class_peek (ATK_TYPE_UTIL);
+  if (klass->get_root)
+    {
+      return klass->get_root ();
+    }
+  else
+    {
+      return NULL;
+    }
+}
+
+/**
+ * atk_get_toolkit_name:
+ *
+ * Gets name string for the GUI toolkit implementing ATK for this application.
+ *
+ * Returns: name string for the GUI toolkit implementing ATK for this application
+ **/
+gchar* atk_get_toolkit_name(void)
+{
+  AtkUtilClass *klass = g_type_class_peek (ATK_TYPE_UTIL);
+  if (klass->get_toolkit_name) 
+    {
+      return klass->get_toolkit_name ();
+    }
+  else
+    {
+      return NULL;
+    } 
+}
+
+/**
+ * atk_get_toolkit_version:
+ *
+ * Gets version string for the GUI toolkit implementing ATK for this application.
+ *
+ * Returns: version string for the GUI toolkit implementing ATK for this application
+ **/
+gchar* 
+atk_get_toolkit_version(void)
+{
+  AtkUtilClass *klass = g_type_class_peek (ATK_TYPE_UTIL);
+  if (klass->get_toolkit_version)
+    {
+      return klass->get_toolkit_version ();
+    }
+  else
+    {
+      return NULL;
+    }
+}
index 4b47b4a..bf5a580 100755 (executable)
 extern "C" {
 #endif /* __cplusplus */
 
+#define ATK_TYPE_UTIL                   (atk_util_get_type ())
+#define ATK_IS_UTIL(obj)                G_TYPE_CHECK_INSTANCE_TYPE ((obj), ATK_TYPE_UTIL)
+#define ATK_UTIL(obj)                   G_TYPE_CHECK_INSTANCE_CAST ((obj), ATK_TYPE_UTIL, AtkUtil)
+#define ATK_UTIL_CLASS(klass)                   (G_TYPE_CHECK_CLASS_CAST ((klass), ATK_TYPE_UTIL, AtkUtilClass))
+#define ATK_IS_UTIL_CLASS(klass)                (G_TYPE_CHECK_CLASS_TYPE ((klass), ATK_TYPE_UTIL))
+#define ATK_UTIL_GET_CLASS(obj)                 (G_TYPE_INSTANCE_GET_CLASS ((obj), ATK_TYPE_UTIL, AtkUtilClass))
+
+
+#ifndef _TYPEDEF_ATK_UTIL_
+#define _TYPEDEF_ATK_UTIL_
+typedef struct _AtkUtil      AtkUtil;
+typedef struct _AtkUtilClass AtkUtilClass;
+#endif
+
+/*
+ * A focus tracker is a function which is called when an object 
+ * receives focus.
+ */
+typedef void  (*AtkEventListener) (AtkObject*);
+typedef void  (*AtkEventListenerInit) (void);
+
+struct _AtkUtil
+{
+  GObject parent;
+};
+
+struct _AtkUtilClass
+{
+   GObjectClass parent;
+   guint        (* add_global_event_listener)    (AtkEventListener listener,
+                                                 gchar*            event_type);
+   void         (* remove_global_event_listener) (guint            listener_id);
+   AtkObject*   (* get_root)                     (void);
+   gchar*       (* get_toolkit_name)             (void);
+   gchar*       (* get_toolkit_version)          (void);
+};
+GType atk_util_get_type (void);
+
 /**
  *AtkCoordType:
  *@ATK_XY_SCREEN: specifies xy coordinates relative to the screen
@@ -40,36 +78,58 @@ typedef enum {
 }AtkCoordType;
 
 /*
- * A focus tracker is a function which is called when an object 
- * receives focus.
- */
-typedef void  (*AtkFocusTracker) (AtkObject*);
-typedef void  (*AtkFocusTrackerInit) (void);
-
-
-/*
  * Adds the specified function to the list of functions to be called
  * when an object receives focus.
  */
-guint    atk_add_focus_tracker     (AtkFocusTracker      focus_tracker);
+guint    atk_add_focus_tracker     (AtkEventListener      focus_tracker);
+
 /*
  * Removes the specified focus tracker from the list of function
  * to be called when any object receives focus
  */
 void     atk_remove_focus_tracker  (guint                tracker_id);
+
 /*
  * Specifies the function to be called for focus tracker initialization.
  * removal. This function should be called by an implementation of the
  * ATK interface if any specific work needs to be done to enable
  * focus tracking.
  */
-void     atk_focus_tracker_init    (AtkFocusTrackerInit  add_function);
+void     atk_focus_tracker_init    (AtkEventListenerInit  add_function);
+
 /*
  * Cause the focus tracker functions which have been specified to be
+F
  * executed for the object.
  */
 void     atk_focus_tracker_notify  (AtkObject            *object);
 
+/*
+ * Adds the specified function to the list of functions to be called
+ * when an event of type event_type occurs.
+ */
+guint  atk_add_global_event_listener (AtkEventListener listener, gchar* event_type);
+
+/*
+ * Removes the specified event listener
+ */
+void   atk_remove_global_event_listener (guint listener_id);
+
+/*
+ * Returns the root accessible container for the current application.
+ */
+AtkObject* atk_get_root(void);
+
+/*
+ * Returns name string for the GUI toolkit.
+ */
+gchar* atk_get_toolkit_name(void);
+
+/*
+ * Returns version string for the GUI toolkit.
+ */
+gchar* atk_get_toolkit_version(void);
+
 #ifdef __cplusplus
 }
 #endif /* __cplusplus */
index 5901d18..5570bdc 100644 (file)
@@ -427,8 +427,13 @@ atk_add_focus_tracker
 atk_remove_focus_tracker
 atk_focus_tracker_init
 atk_focus_tracker_notify
+atk_add_global_event_listener
+atk_remove_global_event_listener
+atk_get_root
+atk_get_toolkit_name
+atk_get_toolkit_version
 <SUBSECTION Standard>
-AtkFocusTracker
-AtkFocusTrackerInit
+AtkEventListener
+AtkEventListenerInit
 </SECTION>
 
index 062101e..fd269d4 100644 (file)
@@ -47,3 +47,45 @@ The AtkUtility interface provides general purpose utility functions.
 @object: 
 
 
+<!-- ##### FUNCTION atk_add_global_event_listener ##### -->
+<para>
+
+</para>
+
+@listener: 
+@event_type: 
+@Returns: 
+
+
+<!-- ##### FUNCTION atk_remove_global_event_listener ##### -->
+<para>
+
+</para>
+
+@listener_id: 
+
+
+<!-- ##### FUNCTION atk_get_root ##### -->
+<para>
+
+</para>
+
+@Returns: 
+
+
+<!-- ##### FUNCTION atk_get_toolkit_name ##### -->
+<para>
+
+</para>
+
+@Returns: 
+
+
+<!-- ##### FUNCTION atk_get_toolkit_version ##### -->
+<para>
+
+</para>
+
+@Returns: 
+
+