Some attribute-related fixes
[platform/upstream/at-spi2-core.git] / atspi / atspi-misc-private.h
1 /*
2  * AT-SPI - Assistive Technology Service Provider Interface
3  * (Gnome Accessibility Project; http://developer.gnome.org/projects/gap)
4  *
5  * Copyright 2002 Ximian, Inc.
6  *           2002 Sun Microsystems Inc.
7  *           
8  *
9  * This library is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU Library General Public
11  * License as published by the Free Software Foundation; either
12  * version 2 of the License, or (at your option) any later version.
13  *
14  * This library is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17  * Library General Public License for more details.
18  *
19  * You should have received a copy of the GNU Library General Public
20  * License along with this library; if not, write to the
21  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
22  * Boston, MA 02111-1307, USA.
23  */
24
25 #ifndef _ATSPI_MISC_PRIVATE_H_
26 #define _ATSPI_MISC_PRIVATE_H_
27
28 /* Private internal implementation details of at-spi. */
29
30 #include "atspi.h"
31
32 #include "dbus/dbus.h"
33
34 #include "dbind/dbind.h"
35
36 #define ATSPI_CACHE_PARENT      0x0001
37 #define ATSPI_CACHE_CHILDREN    0x0002
38 #define ATSPI_CACHE_NAME        0x0004
39 #define ATSPI_CACHE_DESCRIPTION 0x0008
40 #define ATSPI_CACHE_STATES      0x0010
41 #define ATSPI_CACHE_ROLE        0x0020
42 #define ATSPI_CACHE_INTERFACES  0x0040
43
44 typedef struct _AtspiReference AtspiReference;
45 struct _AtspiReference
46 {
47   char *name;
48   char *path;
49 };
50
51 /* constants */
52 #define ATSPI_DBUS_NAME_REGISTRY "org.a11y.atspi.Registry"
53 #define ATSPI_DBUS_PATH_REGISTRY "/org/a11y/atspi/registry"
54 #define ATSPI_DBUS_INTERFACE_REGISTRY "org.a11y.atspi.Registry"
55
56 #define ATSPI_DBUS_PATH_NULL "/org/a11y/atspi/null"
57 #define ATSPI_DBUS_PATH_ROOT "/org/a11y/atspi/accessible/root"
58
59 #define ATSPI_DBUS_PATH_DEC "/org/a11y/atspi/registry/deviceeventcontroller"
60 #define ATSPI_DBUS_INTERFACE_DEC "org.a11y.atspi.DeviceEventController"
61 #define ATSPI_DBUS_INTERFACE_DEVICE_EVENT_LISTENER "org.a11y.atspi.DeviceEventListener"
62
63 #define ATSPI_DBUS_INTERFACE_CACHE "org.a11y.atspi.Cache"
64 #define ATSPI_DBUS_INTERFACE_ACCESSIBLE "org.a11y.atspi.Accessible"
65 #define ATSPI_DBUS_INTERFACE_ACTION "org.a11y.atspi.Action"
66 #define ATSPI_DBUS_INTERFACE_APPLICATION "org.a11y.atspi.Application"
67 #define ATSPI_DBUS_INTERFACE_COLLECTION "org.a11y.atspi.Collection"
68 #define ATSPI_DBUS_INTERFACE_COMPONENT "org.a11y.atspi.Component"
69 #define ATSPI_DBUS_INTERFACE_DOCUMENT "org.a11y.atspi.Document"
70 #define ATSPI_DBUS_INTERFACE_EDITABLE_TEXT "org.a11y.atspi.EditableText"
71 #define ATSPI_DBUS_INTERFACE_EVENT_KEYBOARD "org.a11y.atspi.Event.Keyboard"
72 #define ATSPI_DBUS_INTERFACE_EVENT_MOUSE "org.a11y.atspi.Event.Mouse"
73 #define ATSPI_DBUS_INTERFACE_EVENT_OBJECT "org.a11y.atspi.Event.Object"
74 #define ATSPI_DBUS_INTERFACE_HYPERLINK "org.a11y.atspi.Hyperlink"
75 #define ATSPI_DBUS_INTERFACE_HYPERTEXT "org.a11y.atspi.Hypertext"
76 #define ATSPI_DBUS_INTERFACE_IMAGE "org.a11y.atspi.Image"
77 #define ATSPI_DBUS_INTERFACE_SELECTION "org.a11y.atspi.Selection"
78 #define ATSPI_DBUS_INTERFACE_TABLE "org.a11y.atspi.Table"
79 #define ATSPI_DBUS_INTERFACE_TEXT "org.a11y.atspi.Text"
80 #define ATSPI_DBUS_INTERFACE_VALUE "org.a11y.atspi.Value"
81 #define ATSPI_DBUS_INTERFACE_SOCKET "org.a11y.atspi.Socket"
82
83 /* externs */
84 extern const char *atspi_path_dec;
85 extern const char *atspi_path_registry;
86 extern const char *atspi_path_root;
87 extern const char *atspi_bus_registry;
88 extern const char *atspi_interface_accessible;
89 extern const char *atspi_interface_action;
90 extern const char *atspi_interface_application;
91 extern const char *atspi_interface_collection;
92 extern const char *atspi_interface_component;
93 extern const char *atspi_interface_dec;
94 extern const char *atspi_interface_device_event_listener;
95 extern const char *atspi_interface_document;
96 extern const char *atspi_interface_editable_text;
97 extern const char *atspi_interface_hyperlink;
98 extern const char *atspi_interface_hypertext;
99 extern const char *atspi_interface_image;
100 extern const char *atspi_interface_registry;
101 extern const char *atspi_interface_selection;
102 extern const char *atspi_interface_table;
103 extern const char *atspi_interface_text;
104 extern const char *atspi_interface_cache;
105 extern const char *atspi_interface_value;
106
107 /* function prototypes */
108 gint _atspi_get_iface_num (const char *iface);
109
110 DBusConnection * _atspi_bus ();
111
112 AtspiAccessible * _atspi_ref_accessible (const char *app, const char *path);
113
114 AtspiAccessible *
115 _atspi_dbus_return_accessible_from_message (DBusMessage *message);
116
117 AtspiAccessible *
118 _atspi_dbus_return_accessible_from_iter (DBusMessageIter *iter);
119
120 AtspiHyperlink *
121 _atspi_dbus_return_hyperlink_from_message (DBusMessage *message);
122
123 AtspiHyperlink *
124 _atspi_dbus_return_hyperlink_from_iter (DBusMessageIter *iter);
125
126 dbus_bool_t _atspi_dbus_call (gpointer obj, const char *interface, const char *method, GError **error, const char *type, ...);
127
128 DBusMessage *_atspi_dbus_call_partial (gpointer obj, const char *interface, const char *method, GError **error, const char *type, ...);
129
130 DBusMessage *_atspi_dbus_call_partial_va (gpointer obj, const char *interface, const char *method, GError **error, const char *type, va_list args);
131
132 dbus_bool_t _atspi_dbus_get_property (gpointer obj, const char *interface, const char *name, GError **error, const char *type, void *data);
133
134 DBusMessage * _atspi_dbus_send_with_reply_and_block (DBusMessage *message);
135
136 GHashTable *_atspi_dbus_return_hash_from_message (DBusMessage *message);
137
138 GHashTable *_atspi_dbus_hash_from_iter (DBusMessageIter *iter);
139
140 GArray *_atspi_dbus_return_attribute_array_from_message (DBusMessage *message);
141
142 GArray *_atspi_dbus_attribute_array_from_iter (DBusMessageIter *iter);
143
144 gboolean _atspi_process_deferred_messages (gpointer data);
145
146 void _atspi_dbus_set_interfaces (AtspiAccessible *accessible, DBusMessageIter *iter);
147
148 void _atspi_dbus_set_state (AtspiAccessible *accessible, DBusMessageIter *iter);
149
150 #define _ATSPI_DBUS_CHECK_SIG(message, type, ret) \
151   if (!message) { \
152     g_warning ("at-spi: Got no message at %s line %d\n", __FILE__, __LINE__); \
153     return (ret); \
154   } \
155   if (strcmp (dbus_message_get_signature (message), type) != 0) \
156   { \
157     g_warning ("at-spi: Expected message signature %s but got %s at %s line %d", type, dbus_message_get_signature (message), __FILE__, __LINE__); \
158     dbus_message_unref (message); \
159     return (ret); \
160   }
161 #endif  /* _ATSPI_MISC_PRIVATE_H_ */