michael@0: /* ATK - Accessibility Toolkit michael@0: * Copyright 2001 Sun Microsystems Inc. michael@0: * michael@0: * This library is free software; you can redistribute it and/or michael@0: * modify it under the terms of the GNU Library General Public michael@0: * License as published by the Free Software Foundation; either michael@0: * version 2 of the License, or (at your option) any later version. michael@0: * michael@0: * This library is distributed in the hope that it will be useful, michael@0: * but WITHOUT ANY WARRANTY; without even the implied warranty of michael@0: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU michael@0: * Library General Public License for more details. michael@0: * michael@0: * You should have received a copy of the GNU Library General Public michael@0: * License along with this library; if not, write to the michael@0: * Free Software Foundation, Inc., 59 Temple Place - Suite 330, michael@0: * Boston, MA 02111-1307, USA. michael@0: */ michael@0: michael@0: #ifndef __ATK_UTIL_H__ michael@0: #define __ATK_UTIL_H__ michael@0: michael@0: #include michael@0: michael@0: #ifdef __cplusplus michael@0: extern "C" { michael@0: #endif /* __cplusplus */ michael@0: michael@0: #define ATK_TYPE_UTIL (atk_util_get_type ()) michael@0: #define ATK_IS_UTIL(obj) G_TYPE_CHECK_INSTANCE_TYPE ((obj), ATK_TYPE_UTIL) michael@0: #define ATK_UTIL(obj) G_TYPE_CHECK_INSTANCE_CAST ((obj), ATK_TYPE_UTIL, AtkUtil) michael@0: #define ATK_UTIL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), ATK_TYPE_UTIL, AtkUtilClass)) michael@0: #define ATK_IS_UTIL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), ATK_TYPE_UTIL)) michael@0: #define ATK_UTIL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), ATK_TYPE_UTIL, AtkUtilClass)) michael@0: michael@0: michael@0: #ifndef _TYPEDEF_ATK_UTIL_ michael@0: #define _TYPEDEF_ATK_UTIL_ michael@0: typedef struct _AtkUtil AtkUtil; michael@0: typedef struct _AtkUtilClass AtkUtilClass; michael@0: typedef struct _AtkKeyEventStruct AtkKeyEventStruct; michael@0: #endif michael@0: michael@0: /** michael@0: * AtkEventListener: michael@0: * @obj: An #AtkObject instance for whom the callback will be called when michael@0: * the specified event (e.g. 'focus:') takes place. michael@0: * michael@0: * A function which is called when an object emits a matching event, michael@0: * as used in #atk_add_focus_tracker. michael@0: * Currently the only events for which object-specific handlers are michael@0: * supported are events of type "focus:". Most clients of ATK will prefer to michael@0: * attach signal handlers for the various ATK signals instead. michael@0: * michael@0: * @see: atk_add_focus_tracker. michael@0: **/ michael@0: typedef void (*AtkEventListener) (AtkObject* obj); michael@0: /** michael@0: * AtkEventListenerInit: michael@0: * michael@0: * An #AtkEventListenerInit function is a special function that is michael@0: * called in order to initialize the per-object event registration system michael@0: * used by #AtkEventListener, if any preparation is required. michael@0: * michael@0: * @see: atk_focus_tracker_init. michael@0: **/ michael@0: typedef void (*AtkEventListenerInit) (void); michael@0: /** michael@0: * AtkKeySnoopFunc: michael@0: * @event: an AtkKeyEventStruct containing information about the key event for which michael@0: * notification is being given. michael@0: * @func_data: a block of data which will be passed to the event listener, on notification. michael@0: * michael@0: * An #AtkKeySnoopFunc is a type of callback which is called whenever a key event occurs, michael@0: * if registered via atk_add_key_event_listener. It allows for pre-emptive michael@0: * interception of key events via the return code as described below. michael@0: * michael@0: * Returns: TRUE (nonzero) if the event emission should be stopped and the event michael@0: * discarded without being passed to the normal GUI recipient; FALSE (zero) if the michael@0: * event dispatch to the client application should proceed as normal. michael@0: * michael@0: * @see: atk_add_key_event_listener. michael@0: **/ michael@0: typedef gint (*AtkKeySnoopFunc) (AtkKeyEventStruct *event, michael@0: gpointer func_data); michael@0: michael@0: /** michael@0: * AtkKeyEventStruct: michael@0: * @type: An AtkKeyEventType, generally one of ATK_KEY_EVENT_PRESS or ATK_KEY_EVENT_RELEASE michael@0: * @state: A bitmask representing the state of the modifier keys immediately after the event takes place. michael@0: * The meaning of the bits is currently defined to match the bitmask used by GDK in michael@0: * GdkEventType.state, see michael@0: * http://developer.gnome.org/doc/API/2.0/gdk/gdk-Event-Structures.html#GdkEventKey michael@0: * @keyval: A guint representing a keysym value corresponding to those used by GDK and X11: see michael@0: * /usr/X11/include/keysymdef.h. michael@0: * @length: The length of member #string. michael@0: * @string: A string containing one of the following: either a string approximating the text that would michael@0: * result from this keypress, if the key is a control or graphic character, or a symbolic name for this keypress. michael@0: * Alphanumeric and printable keys will have the symbolic key name in this string member, for instance "A". "0", michael@0: * "semicolon", "aacute". Keypad keys have the prefix "KP". michael@0: * @keycode: The raw hardware code that generated the key event. This field is raraly useful. michael@0: * @timestamp: A timestamp in milliseconds indicating when the event occurred. michael@0: * These timestamps are relative to a starting point which should be considered arbitrary, michael@0: * and only used to compare the dispatch times of events to one another. michael@0: * michael@0: * Encapsulates information about a key event. michael@0: **/ michael@0: struct _AtkKeyEventStruct { michael@0: gint type; michael@0: guint state; michael@0: guint keyval; michael@0: gint length; michael@0: gchar *string; michael@0: guint16 keycode; michael@0: guint32 timestamp; michael@0: }; michael@0: michael@0: /** michael@0: *AtkKeyEventType: michael@0: *@ATK_KEY_EVENT_PRESS: specifies a key press event michael@0: *@ATK_KEY_EVENT_RELEASE: specifies a key release event michael@0: *@ATK_KEY_EVENT_LAST_DEFINED: Not a valid value; specifies end of enumeration michael@0: * michael@0: *Specifies the type of a keyboard evemt. michael@0: **/ michael@0: typedef enum michael@0: { michael@0: ATK_KEY_EVENT_PRESS, michael@0: ATK_KEY_EVENT_RELEASE, michael@0: ATK_KEY_EVENT_LAST_DEFINED michael@0: } AtkKeyEventType; michael@0: michael@0: struct _AtkUtil michael@0: { michael@0: GObject parent; michael@0: }; michael@0: michael@0: struct _AtkUtilClass michael@0: { michael@0: GObjectClass parent; michael@0: guint (* add_global_event_listener) (GSignalEmissionHook listener, michael@0: const gchar *event_type); michael@0: void (* remove_global_event_listener) (guint listener_id); michael@0: guint (* add_key_event_listener) (AtkKeySnoopFunc listener, michael@0: gpointer data); michael@0: void (* remove_key_event_listener) (guint listener_id); michael@0: AtkObject* (* get_root) (void); michael@0: G_CONST_RETURN gchar* (* get_toolkit_name) (void); michael@0: G_CONST_RETURN gchar* (* get_toolkit_version) (void); michael@0: }; michael@0: GType atk_util_get_type (void); michael@0: michael@0: /** michael@0: *AtkCoordType: michael@0: *@ATK_XY_SCREEN: specifies xy coordinates relative to the screen michael@0: *@ATK_XY_WINDOW: specifies xy coordinates relative to the widget's michael@0: * top-level window michael@0: * michael@0: *Specifies how xy coordinates are to be interpreted. Used by functions such michael@0: *as atk_component_get_position() and atk_text_get_character_extents() michael@0: **/ michael@0: typedef enum { michael@0: ATK_XY_SCREEN, michael@0: ATK_XY_WINDOW michael@0: }AtkCoordType; michael@0: michael@0: /* michael@0: * Adds the specified function to the list of functions to be called michael@0: * when an object receives focus. michael@0: */ michael@0: guint atk_add_focus_tracker (AtkEventListener focus_tracker); michael@0: michael@0: /* michael@0: * Removes the specified focus tracker from the list of function michael@0: * to be called when any object receives focus michael@0: */ michael@0: void atk_remove_focus_tracker (guint tracker_id); michael@0: michael@0: /* michael@0: * atk_focus_tracker_init: michael@0: * @init: An #AtkEventListenerInit function to be called michael@0: * prior to any focus-tracking requests. michael@0: * michael@0: * Specifies the function to be called for focus tracker initialization. michael@0: * removal. This function should be called by an implementation of the michael@0: * ATK interface if any specific work needs to be done to enable michael@0: * focus tracking. michael@0: */ michael@0: void atk_focus_tracker_init (AtkEventListenerInit init); michael@0: michael@0: /* michael@0: * Cause the focus tracker functions which have been specified to be michael@0: * executed for the object. michael@0: */ michael@0: void atk_focus_tracker_notify (AtkObject *object); michael@0: michael@0: /* michael@0: * Adds the specified function to the list of functions to be called michael@0: * when an event of type event_type occurs. michael@0: */ michael@0: guint atk_add_global_event_listener (GSignalEmissionHook listener, michael@0: const gchar *event_type); michael@0: michael@0: /* michael@0: * Removes the specified event listener michael@0: */ michael@0: void atk_remove_global_event_listener (guint listener_id); michael@0: michael@0: /* michael@0: * Adds the specified function to the list of functions to be called michael@0: * when an keyboard event occurs. michael@0: */ michael@0: guint atk_add_key_event_listener (AtkKeySnoopFunc listener, gpointer data); michael@0: michael@0: /* michael@0: * Removes the specified event listener michael@0: */ michael@0: void atk_remove_key_event_listener (guint listener_id); michael@0: michael@0: /* michael@0: * Returns the root accessible container for the current application. michael@0: */ michael@0: AtkObject* atk_get_root(void); michael@0: michael@0: AtkObject* atk_get_focus_object (void); michael@0: michael@0: /* michael@0: * Returns name string for the GUI toolkit. michael@0: */ michael@0: G_CONST_RETURN gchar *atk_get_toolkit_name (void); michael@0: michael@0: /* michael@0: * Returns version string for the GUI toolkit. michael@0: */ michael@0: G_CONST_RETURN gchar *atk_get_toolkit_version (void); michael@0: michael@0: #ifdef __cplusplus michael@0: } michael@0: #endif /* __cplusplus */ michael@0: michael@0: michael@0: #endif /* __ATK_UTIL_H__ */