AtkUtil: ATK - Accessibility Toolkit

## AtkUtil AtkUtil — A set of ATK utility functions for event and toolkit support. |

## Functions

guint | atk_add_focus_tracker ()
void | atk_remove_focus_tracker ()
void | atk_focus_tracker_init ()
void | atk_focus_tracker_notify ()
void | (*AtkEventListener) ()
void | (*AtkEventListenerInit) ()
guint | atk_add_global_event_listener ()
void | atk_remove_global_event_listener ()
gint | (*AtkKeySnoopFunc) ()
guint | atk_add_key_event_listener ()
void | atk_remove_key_event_listener ()
AtkObject * | atk_get_root ()
AtkObject * | atk_get_focus_object ()
const gchar * | atk_get_toolkit_name ()
const gchar * | atk_get_toolkit_version ()
const gchar * | atk_get_version ()
#define | ATK_DEFINE_TYPE()
#define | ATK_DEFINE_TYPE_EXTENDED()
#define | ATK_DEFINE_TYPE_WITH_CODE()
#define | ATK_DEFINE_ABSTRACT_TYPE()
#define | ATK_DEFINE_ABSTRACT_TYPE_WITH_CODE()

## Types and Values

struct | AtkUtil
struct | AtkUtilClass
enum | AtkCoordType
struct | AtkKeyEventStruct
enum | AtkKeyEventType

## Object Hierarchy

        GObject
        ╰── AtkUtil

## Description

A set of ATK utility functions which are used to support event registration of various types, and obtaining the 'root' accessible of a process and information about the current ATK implementation and toolkit version.

## Functions

### atk_add_focus_tracker ()

    guint
    atk_add_focus_tracker (AtkEventListener focus_tracker);

`atk_add_focus_tracker` has been deprecated since version 2.9.4 and should not be used in newly-written code.

Focus tracking has been dropped as a feature to be implemented by ATK itself. If you need focus tracking on your implementation, subscribe to the state-changed:focused signal.

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

#### Parameters

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);

`atk_remove_focus_tracker` has been deprecated since version 2.9.4 and should not be used in newly-written code.

Focus tracking has been dropped as a feature to be implemented by ATK itself. If you need focus tracking on your implementation, subscribe to the state-changed:focused signal.

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

#### Parameters

tracker_id | the id of the focus tracker to remove |

### atk_focus_tracker_init ()

    void
    atk_focus_tracker_init (AtkEventListenerInit init);

`atk_focus_tracker_init` has been deprecated since version 2.9.4 and should not be used in newly-written code.

Focus tracking has been dropped as a feature to be implemented by ATK itself.

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.

#### Parameters

init | Function to be called for focus tracker initialization |

### atk_focus_tracker_notify ()

    void
    atk_focus_tracker_notify (AtkObject *object);

`atk_focus_tracker_notify` has been deprecated since version 2.9.4 and should not be used in newly-written code.

Focus tracking has been dropped as a feature to be implemented by ATK itself. As “focus-event” was deprecated in favor of a “state-change” signal, in order to notify a focus change on your implementation, you can use `atk_object_notify_state_change()` instead.

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

#### Parameters

object | an AtkObject |

### AtkEventListener ()

    void
    (*AtkEventListener) (AtkObject *obj);

A function which is called when an object emits a matching event, as used in atk_add_focus_tracker. Currently the only events for which object-specific handlers are supported are events of type "focus:". Most clients of ATK will prefer to attach signal handlers for the various ATK signals instead.

see atk_add_focus_tracker.

#### Parameters

obj | An AtkObject instance for whom the callback will be called when the specified event (e.g. 'focus:') takes place. |

### AtkEventListenerInit ()

    void
    (*AtkEventListenerInit) (void);

An AtkEventListenerInit function is a special function that is called in order to initialize the per-object event registration system used by AtkEventListener, if any preparation is required.

see atk_focus_tracker_init.

### 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 ATK event of type event_type occurs.

The format of event_type is the following: "ATK:<atk_type>:<atk_event>:<atk_event_detail>

Where "ATK" works as the namespace, <atk_interface> is the name of the ATK type (interface or object), <atk_event> is the name of the signal defined on that interface and <atk_event_detail> is the gsignal detail of that signal. You can find more info about gsignal details here: http://developer.gnome.org/gobject/stable/gobject-Signals.html

The first three parameters are mandatory. The last one is optional.

For example: ATK:AtkObject:state-change ATK:AtkText:text-selection-changed ATK:AtkText:text-insert:system

Toolkit implementor note: ATK provides a default implementation for this virtual method. ATK implementors are discouraged from reimplementing this method.

Toolkit implementor note: this method is not intended to be used by ATK implementors but by ATK consumers.

ATK consumers note: as this method adds a listener for a given ATK type, that type should be already registered on the GType system before calling this method. A simple way to do that is creating an instance of AtkNoOpObject. This class implements all ATK interfaces, so creating the instance will register all ATK types as a collateral effect.

#### Parameters

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);

`listener_id` is the value returned by atk_add_global_event_listener when you registered that event listener.

Toolkit implementor note: ATK provides a default implementation for this virtual method. ATK implementors are discouraged from reimplementing this method.

Toolkit implementor note: this method is not intended to be used by ATK implementors but by ATK consumers.

Removes the specified event listener

#### Parameters

listener_id | the id of the event listener to remove |

### AtkKeySnoopFunc ()

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

An AtkKeySnoopFunc is a type of callback which is called whenever a key event occurs, if registered via atk_add_key_event_listener. It allows for pre-emptive interception of key events via the return code as described below.

#### Parameters

event | an AtkKeyEventStruct containing information about the key event for which notification is being given. |
user_data | a block of data which will be passed to the event listener, on notification. |

#### Returns

TRUE (nonzero) if the event emission should be stopped and the event discarded without being passed to the normal GUI recipient; FALSE (zero) if the event dispatch to the client application should proceed as normal.

see atk_add_key_event_listener.

### 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.

#### Parameters

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);

`listener_id` is the value returned by atk_add_key_event_listener when you registered that event listener.

Removes the specified event listener.

#### Parameters

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.

[transfer none]

### atk_get_focus_object ()

    AtkObject *
    atk_get_focus_object (void);

Gets the currently focused object.

#### Returns

the currently focused object for the current application.

[transfer none]

Since 1.6

### atk_get_toolkit_name ()

    const 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 ()

    const 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

### atk_get_version ()

    const gchar *
    atk_get_version (void);

Gets the current version for ATK.

#### Returns

version string for ATK

Since 1.20

### ATK_DEFINE_TYPE()

    #define ATK_DEFINE_TYPE(TN, t_n, T_P)			       ATK_DEFINE_TYPE_EXTENDED (TN, t_n, T_P, 0, {})

A convenience macro for type ATK implementations, which declares a class initialization function, an instance initialization function (see GTypeInfo for information about these) and a static variable named `t_n` _parent_class pointing to the parent class. Furthermore, it defines a `_get_type()` function.

#### Parameters

TN | The name of the new type, in Camel case. |
t_n | The name of the new type, in lowercase, with words separated by '_'. |
T_P | The GType of the parent type. |

Since 1.22

### ATK_DEFINE_TYPE_EXTENDED()

    #define ATK_DEFINE_TYPE_EXTENDED(TN, t_n, T_P, _f_, _C_)      _ATK_DEFINE_TYPE_EXTENDED_BEGIN (TN, t_n, T_P, _f_) {_C_;} _ATK_DEFINE_TYPE_EXTENDED_END()

The most general convenience macro for ATK type implementations, on which `ATK_DEFINE_TYPE()`, etc are based.

#### Parameters

TN | The name of the new type, in Camel case. |
t_n | The name of the new type, in lowercase, with words separated by '_'. |
T_P | The GType of the parent type. |
_f_ | GTypeFlags to pass to `g_type_register_static()` |
_C_ | Custom code that gets inserted in the `_get_type()` function. |

Since 1.22

### ATK_DEFINE_TYPE_WITH_CODE()

    #define ATK_DEFINE_TYPE_WITH_CODE(TN, t_n, T_P, _C_)	      _ATK_DEFINE_TYPE_EXTENDED_BEGIN (TN, t_n, T_P, 0) {_C_;} _ATK_DEFINE_TYPE_EXTENDED_END()

A convenience macro for ATK type implementations. Similar to `ATK_DEFINE_TYPE()`, but allows you to insert custom code into the `_get_type()` function, e.g. interface implementations via `G_IMPLEMENT_INTERFACE()`.

#### Parameters

TN | The name of the new type, in Camel case. |
t_n | The name of the new type in lowercase, with words separated by '_'. |
T_P | The GType of the parent type. |
_C_ | Custom code that gets inserted in the `_get_type()` function. |

Since 1.22

### ATK_DEFINE_ABSTRACT_TYPE()

    #define ATK_DEFINE_ABSTRACT_TYPE(TN, t_n, T_P)		       ATK_DEFINE_TYPE_EXTENDED (TN, t_n, T_P, G_TYPE_FLAG_ABSTRACT, {})

A convenience macro for ATK type implementations. Similar to `ATK_DEFINE_TYPE()`, but defines an abstract type.

#### Parameters

TN | The name of the new type, in Camel case. |
t_n | The name of the new type, in lowercase, with words separated by '_'. |
T_P | The GType of the parent type. |

Since 1.22

### ATK_DEFINE_ABSTRACT_TYPE_WITH_CODE()

    #define ATK_DEFINE_ABSTRACT_TYPE_WITH_CODE(TN, t_n, T_P, _C_) _ATK_DEFINE_TYPE_EXTENDED_BEGIN (TN, t_n, T_P, G_TYPE_FLAG_ABSTRACT) {_C_;} _ATK_DEFINE_TYPE_EXTENDED_END()

A convenience macro for ATK type implementations. Similar to `ATK_DEFINE_TYPE_WITH_CODE()`, but defines an abstract type.

#### Parameters

TN | The name of the new type, in Camel case. |
t_n | The name of the new type, in lowercase, with words separated by '_'. |
T_P | The GType of the parent type. |
_C_ | Custom code that gets inserted in the `_get_type()` function. |

Since 1.22

## Types and Values

### struct AtkUtil

    struct AtkUtil;

### struct AtkUtilClass

    struct AtkUtilClass {
       GObjectClass parent;
       guint        (* add_global_event_listener)    (GSignalEmissionHook listener,
    						  const gchar        *event_type);
       void         (* remove_global_event_listener) (guint               listener_id);
       guint (* add_key_event_listener) 	 (AtkKeySnoopFunc     listener,
    						  gpointer data);
       void         (* remove_key_event_listener)    (guint               listener_id);
       AtkObject*   (* get_root)                     (void);
       const gchar* (* get_toolkit_name)             (void);
       const gchar* (* get_toolkit_version)          (void);
    };

#### Members

GObjectClass `parent`; |  |
`add_global_event_listener` () | adds the specified function to the list of functions to be called when an ATK event occurs. ATK implementors are discouraged from reimplementing this method. |
`remove_global_event_listener` () | removes the specified function to the list of functions to be called when an ATK event occurs. ATK implementors are discouraged from reimplementing this method. |
`add_key_event_listener` () | adds the specified function to the list of functions to be called when a key event occurs. |
`remove_key_event_listener` () | remove the specified function to the list of functions to be called when a key event occurs. |
`get_root` () | gets the root accessible container for the current application. |
`get_toolkit_name` () | gets name string for the GUI toolkit implementing ATK for this application. |
`get_toolkit_version` () | gets version string for the GUI toolkit implementing ATK for this application. |

### enum AtkCoordType

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

#### Members

ATK_XY_SCREEN | specifies xy coordinates relative to the screen |
ATK_XY_WINDOW | specifies xy coordinates relative to the widget's top-level window |

### struct AtkKeyEventStruct

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

Encapsulates information about a key event.

#### Members

gint `type`; | An AtkKeyEventType, generally one of ATK_KEY_EVENT_PRESS or ATK_KEY_EVENT_RELEASE |
guint `state`; | A bitmask representing the state of the modifier keys immediately after the event takes place. The meaning of the bits is currently defined to match the bitmask used by GDK in GdkEventType.state, see http://developer.gnome.org/doc/API/2.0/gdk/gdk-Event-Structures.htmlGdkEventKey |
guint `keyval`; | A guint representing a keysym value corresponding to those used by GDK and X11: see /usr/X11/include/keysymdef.h. |
gint `length`; | The length of member string. |
gchar *`string`; | A string containing one of the following: either a string approximating the text that would result from this keypress, if the key is a control or graphic character, or a symbolic name for this keypress. Alphanumeric and printable keys will have the symbolic key name in this string member, for instance "A". "0", "semicolon", "aacute". Keypad keys have the prefix "KP". |
guint16 `keycode`; | The raw hardware code that generated the key event. This field is raraly useful. |
guint32 `timestamp`; | A timestamp in milliseconds indicating when the event occurred. These timestamps are relative to a starting point which should be considered arbitrary, and only used to compare the dispatch times of events to one another. |

### enum AtkKeyEventType

Specifies the type of a keyboard evemt.

#### Members

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 |