Fix return value of spi_check_ev and have it call spi_throw_exception if an exception...
[platform/core/uifw/at-spi2-atk.git] / cspi / spi-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 _SPI_PRIVATE_H_
26 #define _SPI_PRIVATE_H_
27
28 /* Private internal implementation details of at-spi. */
29
30 #include <spi-common/spi-dbus.h>
31 #include <cspi/spi.h>
32 #include <string.h>
33 #include "cspi/cspi-lowlevel.h"
34 #include "cspi/spi-listener.h"
35 #include "dbind/dbind.h"
36 #include <glib-object.h>
37
38 typedef struct _CSpiApplication CSpiApplication;
39 struct _CSpiApplication
40 {
41   GHashTable *hash;
42   char *bus_name;
43 };
44
45 struct _Accessible {
46   gint ref_count;
47   Accessible *parent;
48   GList *children;
49         CSpiApplication *app;
50         union
51         {
52           gint id;
53           char *path;
54         } v;
55   gint role : 8;
56   gint interfaces : 24;
57   char *name;
58   char *description;
59 };
60
61 struct _AccessibleStateSet {
62         guint   ref_count;
63         GArray *states;
64 };
65
66 #define SPI_INTERNAL_EVENT_MAGIC 0xc3
67 /* 
68  * For internal use by CSPI implementation only
69  */
70 typedef struct {
71   AccessibleEvent event;
72   guint           id;
73   guchar          magic;
74   guchar          type;
75   guint16         ref_count;
76 } InternalEvent;
77
78 struct _SPIException {
79   SPIExceptionType type;
80   Accessible *source;
81   DBusError *error;
82   SPIExceptionCode code;
83   char * desc;
84 };
85
86 DBusConnection *spi_bus (void);
87 SPIBoolean             cspi_exception         (void);
88 Accessible            *cspi_object_add (Accessible  *accessible);
89 void                   cspi_object_ref        (Accessible  *accessible);
90 void                   cspi_object_unref      (Accessible  *accessible);
91 SPIBoolean             cspi_accessible_is_a   (Accessible  *accessible,
92                                                const char  *interface_name);
93 AccessibleRole         cspi_role_from_spi_role (Accessibility_Role role);
94 void                   cspi_streams_close_all (void);
95 gboolean               cspi_exception_throw (DBusError *error, const char *desc_prefix);
96
97 AccessibleAttributeSet 
98                      *_cspi_attribute_set_from_sequence (const GArray *seq);
99 #define cspi_return_if_fail(val)                \
100         if (!(val))                             \
101                 return
102 #define cspi_return_val_if_fail(val, ret)       \
103         if (!(val))                             \
104                 return (ret)
105
106 #define cspi_return_if_ev(err)                  \
107         if (cspi_exception ()) \
108                 return;
109 #define cspi_return_val_if_ev(err, ret) \
110         if (cspi_exception ()) \
111                 return (ret);
112
113 typedef struct _Accessibility_BoundingBox Accessibility_BoundingBox;
114 struct _Accessibility_BoundingBox
115 {
116   dbus_uint32_t x;
117   dbus_uint32_t y;
118   dbus_uint32_t width;
119   dbus_uint32_t height;
120 };
121
122 #endif /* _SPI_PRIVATE_H_ */