# AtkUtil

## Name

AtkUtil -- This is a utility class which supports the adding and removal of event listeners.

## Synopsis

    struct      AtkUtil;
    enum        AtkCoordType;
    guint       atk_add_focus_tracker           (AtkEventListener focus_tracker);
    void        atk_remove_focus_tracker        (guint tracker_id);
    void        atk_focus_tracker_init          (AtkEventListenerInit add_function);
    void        atk_focus_tracker_notify        (AtkObject *object);
    void        (*AtkEventListener)             (AtkObject*);
    void        (*AtkEventListenerInit)         (void);
    guint       atk_add_global_event_listener   (GSignalEmissionHook listener,
                                                 const gchar *event_type);
    void        atk_remove_global_event_listener
                                                (guint listener_id);
    struct      AtkKeyEventStruct;
    enum        AtkKeyEventType;
    gint        (*AtkKeySnoopFunc)              (AtkKeyEventStruct *event,
                                                 gpointer func_data);
    guint       atk_add_key_event_listener      (AtkKeySnoopFunc listener,
                                                 gpointer data);
    void        atk_remove_key_event_listener   (guint listener_id);
    AtkObject*  atk_get_root                    (void);
    G_CONST_RETURN gchar* atk_get_toolkit_name  (void);
    G_CONST_RETURN gchar* atk_get_toolkit_version
                                                (void);

## Object Hierarchy

      GObject
       +----AtkUtil

## Description

This is a utility class which supports the adding and removal of event listeners. The adding and removing of the listeners must be done in the same thread. The file also contains a number of utility functions.

## Details

### struct AtkUtil

    struct AtkUtil;

The AtkObject structure should not be accessed directly.

### enum AtkCoordType

    typedef enum {
      ATK_XY_SCREEN,
      ATK_XY_WINDOW
    }AtkCoordType;

Specifies how xy coordinates are to be interpreted. Used by functions such as atk_component_get_position() and atk_text_get_character_extents()

`ATK_XY_SCREEN`

  specifies xy coordinates relative to the screen

`ATK_XY_WINDOW`

  specifies xy coordinates relative to the widget's top-level window

### atk_add_focus_tracker ()

    guint       atk_add_focus_tracker           (AtkEventListener focus_tracker);

Adds the specified function to the list of functions to be called when an object receives focus.

`focus_tracker` :

  Function to be added to the list of functions to be called when an object receives focus.

Returns :

  added focus tracker id, or 0 on failure.

### atk_remove_focus_tracker ()

    void        atk_remove_focus_tracker        (guint tracker_id);

Removes the specified focus tracker from the list of functions to be called when any object receives focus.

`tracker_id` :

  the id of the focus tracker to remove

### atk_focus_tracker_init ()

    void        atk_focus_tracker_init          (AtkEventListenerInit add_function);

Specifies the function to be called for focus tracker initialization. This function should be called by an implementation of the ATK interface if any specific work needs to be done to enable focus tracking.

`add_function` :

  Function to be called for focus tracker initialization

### atk_focus_tracker_notify ()

    void        atk_focus_tracker_notify        (AtkObject *object);

Cause the focus tracker functions which have been specified to be executed for the object.

`object` :

  an AtkObject

### AtkEventListener ()

    void        (*AtkEventListener)             (AtkObject*);

An AtkEventListener is user specified function which is called when an event, such as receiving focus, occurs. The parameter of the AtkEventListener is the AtkObject on which the event occurred.

`Param1` :

### AtkEventListenerInit ()

    void        (*AtkEventListenerInit)         (void);

An AtkEventListenerInit is an initialization function in an implementation of the ATK interface used to perform implementation-specific initialization when enabling focus tracking.

### atk_add_global_event_listener ()

    guint       atk_add_global_event_listener   (GSignalEmissionHook listener,
                                                 const gchar *event_type);

Adds the specified function to the list of functions to be called when an event of type event_type occurs.

`listener` :

  the listener to notify

`event_type` :

  the type of event for which notification is requested

Returns :

  added event listener id, or 0 on failure.

### atk_remove_global_event_listener ()

    void        atk_remove_global_event_listener
                                                (guint listener_id);

Removes the specified event listener

`listener_id` :

  the id of the event listener to remove

### struct AtkKeyEventStruct

    struct AtkKeyEventStruct {

      gint type;
      guint state;
      guint keyval;
      gint length;
      gchar *string;
      guint16 keycode;
      guint32 timestamp;
    };

The AtkKeyEventStruct describes a keyboard event.

### enum AtkKeyEventType

    typedef enum
    {
      ATK_KEY_EVENT_PRESS,
      ATK_KEY_EVENT_RELEASE,
      ATK_KEY_EVENT_LAST_DEFINED
    } AtkKeyEventType;

Specifies the type of a keyboard evemt.

`ATK_KEY_EVENT_PRESS`

  specifies a key press event

`ATK_KEY_EVENT_RELEASE`

  specifies a key release event

`ATK_KEY_EVENT_LAST_DEFINED`

  Not a valid value; specifies end of enumeration

### AtkKeySnoopFunc ()

    gint        (*AtkKeySnoopFunc)              (AtkKeyEventStruct *event,
                                                 gpointer func_data);

An AtkKeySnoopFunc is a function which is called when a keyboard event occurs.

`event` :

`func_data` :

Returns :

### atk_add_key_event_listener ()

    guint       atk_add_key_event_listener      (AtkKeySnoopFunc listener,
                                                 gpointer data);

Adds the specified function to the list of functions to be called when a key event occurs. The `data` element will be passed to the AtkKeySnoopFunc (`listener`) as the `func_data` param, on notification.

`listener` :

  the listener to notify

`data` :

  a gpointer that points to a block of data that should be sent to the registered listeners, along with the event notification, when it occurs.

Returns :

  added event listener id, or 0 on failure.

### atk_remove_key_event_listener ()

    void        atk_remove_key_event_listener   (guint listener_id);

Removes the specified event listener

`listener_id` :

  the id of the event listener to remove

### atk_get_root ()

    AtkObject*  atk_get_root                    (void);

Gets the root accessible container for the current application.

Returns :

  the root accessible container for the current application

### atk_get_toolkit_name ()

    G_CONST_RETURN gchar* atk_get_toolkit_name  (void);

Gets name string for the GUI toolkit implementing ATK for this application.

Returns :

  name string for the GUI toolkit implementing ATK for this application

### atk_get_toolkit_version ()

    G_CONST_RETURN gchar* atk_get_toolkit_version
                                                (void);

Gets version string for the GUI toolkit implementing ATK for this application.

Returns :

  version string for the GUI toolkit implementing ATK for this application