1 | /* ATK - Accessibility Toolkit |
---|
2 | * Copyright 2001 Sun Microsystems Inc. |
---|
3 | * |
---|
4 | * This library is free software; you can redistribute it and/or |
---|
5 | * modify it under the terms of the GNU Library General Public |
---|
6 | * License as published by the Free Software Foundation; either |
---|
7 | * version 2 of the License, or (at your option) any later version. |
---|
8 | * |
---|
9 | * This library is distributed in the hope that it will be useful, |
---|
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
---|
12 | * Library General Public License for more details. |
---|
13 | * |
---|
14 | * You should have received a copy of the GNU Library General Public |
---|
15 | * License along with this library; if not, write to the |
---|
16 | * Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
---|
17 | * Boston, MA 02111-1307, USA. |
---|
18 | */ |
---|
19 | |
---|
20 | #ifndef __ATK_UTIL_H__ |
---|
21 | #define __ATK_UTIL_H__ |
---|
22 | |
---|
23 | #include <atk/atkobject.h> |
---|
24 | |
---|
25 | #ifdef __cplusplus |
---|
26 | extern "C" { |
---|
27 | #endif /* __cplusplus */ |
---|
28 | |
---|
29 | #define ATK_TYPE_UTIL (atk_util_get_type ()) |
---|
30 | #define ATK_IS_UTIL(obj) G_TYPE_CHECK_INSTANCE_TYPE ((obj), ATK_TYPE_UTIL) |
---|
31 | #define ATK_UTIL(obj) G_TYPE_CHECK_INSTANCE_CAST ((obj), ATK_TYPE_UTIL, AtkUtil) |
---|
32 | #define ATK_UTIL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), ATK_TYPE_UTIL, AtkUtilClass)) |
---|
33 | #define ATK_IS_UTIL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), ATK_TYPE_UTIL)) |
---|
34 | #define ATK_UTIL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), ATK_TYPE_UTIL, AtkUtilClass)) |
---|
35 | |
---|
36 | |
---|
37 | #ifndef _TYPEDEF_ATK_UTIL_ |
---|
38 | #define _TYPEDEF_ATK_UTIL_ |
---|
39 | typedef struct _AtkUtil AtkUtil; |
---|
40 | typedef struct _AtkUtilClass AtkUtilClass; |
---|
41 | typedef struct _AtkKeyEventStruct AtkKeyEventStruct; |
---|
42 | #endif |
---|
43 | |
---|
44 | /* |
---|
45 | * A focus tracker is a function which is called when an object |
---|
46 | * receives focus. |
---|
47 | */ |
---|
48 | typedef void (*AtkEventListener) (AtkObject*); |
---|
49 | typedef void (*AtkEventListenerInit) (void); |
---|
50 | typedef gint (*AtkKeySnoopFunc) (AtkKeyEventStruct *event, |
---|
51 | gpointer func_data); |
---|
52 | |
---|
53 | struct _AtkKeyEventStruct { |
---|
54 | gint type; |
---|
55 | guint state; |
---|
56 | guint keyval; |
---|
57 | gint length; |
---|
58 | gchar *string; |
---|
59 | guint16 keycode; |
---|
60 | guint32 timestamp; |
---|
61 | }; |
---|
62 | |
---|
63 | /** |
---|
64 | *AtkKeyEventType: |
---|
65 | *@ATK_KEY_EVENT_PRESS: specifies a key press event |
---|
66 | *@ATK_KEY_EVENT_RELEASE: specifies a key release event |
---|
67 | *@ATK_KEY_EVENT_LAST_DEFINED: Not a valid value; specifies end of enumeration |
---|
68 | * |
---|
69 | *Specifies the type of a keyboard evemt. |
---|
70 | **/ |
---|
71 | typedef enum |
---|
72 | { |
---|
73 | ATK_KEY_EVENT_PRESS, |
---|
74 | ATK_KEY_EVENT_RELEASE, |
---|
75 | ATK_KEY_EVENT_LAST_DEFINED |
---|
76 | } AtkKeyEventType; |
---|
77 | |
---|
78 | struct _AtkUtil |
---|
79 | { |
---|
80 | GObject parent; |
---|
81 | }; |
---|
82 | |
---|
83 | struct _AtkUtilClass |
---|
84 | { |
---|
85 | GObjectClass parent; |
---|
86 | guint (* add_global_event_listener) (GSignalEmissionHook listener, |
---|
87 | const gchar *event_type); |
---|
88 | void (* remove_global_event_listener) (guint listener_id); |
---|
89 | guint (* add_key_event_listener) (AtkKeySnoopFunc listener, |
---|
90 | gpointer data); |
---|
91 | void (* remove_key_event_listener) (guint listener_id); |
---|
92 | AtkObject* (* get_root) (void); |
---|
93 | G_CONST_RETURN gchar* (* get_toolkit_name) (void); |
---|
94 | G_CONST_RETURN gchar* (* get_toolkit_version) (void); |
---|
95 | }; |
---|
96 | GType atk_util_get_type (void); |
---|
97 | |
---|
98 | /** |
---|
99 | *AtkCoordType: |
---|
100 | *@ATK_XY_SCREEN: specifies xy coordinates relative to the screen |
---|
101 | *@ATK_XY_WINDOW: specifies xy coordinates relative to the widget's |
---|
102 | * top-level window |
---|
103 | * |
---|
104 | *Specifies how xy coordinates are to be interpreted. Used by functions such |
---|
105 | *as atk_component_get_position() and atk_text_get_character_extents() |
---|
106 | **/ |
---|
107 | typedef enum { |
---|
108 | ATK_XY_SCREEN, |
---|
109 | ATK_XY_WINDOW |
---|
110 | }AtkCoordType; |
---|
111 | |
---|
112 | /* |
---|
113 | * Adds the specified function to the list of functions to be called |
---|
114 | * when an object receives focus. |
---|
115 | */ |
---|
116 | guint atk_add_focus_tracker (AtkEventListener focus_tracker); |
---|
117 | |
---|
118 | /* |
---|
119 | * Removes the specified focus tracker from the list of function |
---|
120 | * to be called when any object receives focus |
---|
121 | */ |
---|
122 | void atk_remove_focus_tracker (guint tracker_id); |
---|
123 | |
---|
124 | /* |
---|
125 | * Specifies the function to be called for focus tracker initialization. |
---|
126 | * removal. This function should be called by an implementation of the |
---|
127 | * ATK interface if any specific work needs to be done to enable |
---|
128 | * focus tracking. |
---|
129 | */ |
---|
130 | void atk_focus_tracker_init (AtkEventListenerInit add_function); |
---|
131 | |
---|
132 | /* |
---|
133 | * Cause the focus tracker functions which have been specified to be |
---|
134 | * executed for the object. |
---|
135 | */ |
---|
136 | void atk_focus_tracker_notify (AtkObject *object); |
---|
137 | |
---|
138 | /* |
---|
139 | * Adds the specified function to the list of functions to be called |
---|
140 | * when an event of type event_type occurs. |
---|
141 | */ |
---|
142 | guint atk_add_global_event_listener (GSignalEmissionHook listener, |
---|
143 | const gchar *event_type); |
---|
144 | |
---|
145 | /* |
---|
146 | * Removes the specified event listener |
---|
147 | */ |
---|
148 | void atk_remove_global_event_listener (guint listener_id); |
---|
149 | |
---|
150 | /* |
---|
151 | * Adds the specified function to the list of functions to be called |
---|
152 | * when an keyboard event occurs. |
---|
153 | */ |
---|
154 | guint atk_add_key_event_listener (AtkKeySnoopFunc listener, gpointer data); |
---|
155 | |
---|
156 | /* |
---|
157 | * Removes the specified event listener |
---|
158 | */ |
---|
159 | void atk_remove_key_event_listener (guint listener_id); |
---|
160 | |
---|
161 | /* |
---|
162 | * Returns the root accessible container for the current application. |
---|
163 | */ |
---|
164 | AtkObject* atk_get_root(void); |
---|
165 | |
---|
166 | AtkObject* atk_get_focus_object (void); |
---|
167 | |
---|
168 | /* |
---|
169 | * Returns name string for the GUI toolkit. |
---|
170 | */ |
---|
171 | G_CONST_RETURN gchar *atk_get_toolkit_name (void); |
---|
172 | |
---|
173 | /* |
---|
174 | * Returns version string for the GUI toolkit. |
---|
175 | */ |
---|
176 | G_CONST_RETURN gchar *atk_get_toolkit_version (void); |
---|
177 | |
---|
178 | #ifdef __cplusplus |
---|
179 | } |
---|
180 | #endif /* __cplusplus */ |
---|
181 | |
---|
182 | |
---|
183 | #endif /* __ATK_UTIL_H__ */ |
---|