Changes to introspection generation to remove DOCTYPE and XML
[platform/core/uifw/at-spi2-atk.git] / cspi / spi_image.c
1 /*
2  * AT-SPI - Assistive Technology Service Provider Interface
3  * (Gnome Accessibility Project; http://developer.gnome.org/projects/gap)
4  *
5  * Copyright 2001, 2002 Sun Microsystems Inc.,
6  * Copyright 2001, 2002 Ximian, Inc.
7  *
8  * This library is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Library General Public
10  * License as published by the Free Software Foundation; either
11  * version 2 of the License, or (at your option) any later version.
12  *
13  * This library is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16  * Library General Public License for more details.
17  *
18  * You should have received a copy of the GNU Library General Public
19  * License along with this library; if not, write to the
20  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
21  * Boston, MA 02111-1307, USA.
22  */
23
24 #include <cspi/spi-private.h>
25
26 /**
27  * AccessibleImage_ref:
28  * @obj: a pointer to the #AccessibleImage implementor on which to operate.
29  *
30  * Increment the reference count for an #AccessibleImage object.
31  **/
32 void
33 AccessibleImage_ref (AccessibleImage *obj)
34 {
35   cspi_object_ref (obj);
36 }
37
38 /**
39  * AccessibleImage_unref:
40  * @obj: a pointer to the #AccessibleImage implementor on which to operate.
41  *
42  * Decrement the reference count for an #AccessibleImage object.
43  **/
44 void
45 AccessibleImage_unref (AccessibleImage *obj)
46 {
47   cspi_object_unref (obj);
48 }
49
50 /**
51  * AccessibleImage_getImageDescription:
52  * @obj: a pointer to the #AccessibleImage implementor on which to operate.
53  *
54  * Get the description of the image displayed in an #AccessibleImage object.
55  *
56  * Returns: a UTF-8 string describing the image.
57  **/
58 char *
59 AccessibleImage_getImageDescription (AccessibleImage *obj)
60 {
61   char *retval;
62
63   cspi_return_val_if_fail (obj != NULL, NULL);
64
65   retval = 
66     Accessibility_Image__get_imageDescription (CSPI_OBJREF (obj),
67                                                cspi_ev ());
68
69   cspi_return_val_if_ev ("getImageDescription", NULL);
70
71   return retval;
72 }
73
74 /**
75  * AccessibleImage_getImageSize:
76  * @obj: a pointer to the #AccessibleImage to query.
77  * @width: a pointer to a #long into which the x extents (width) will be returned.
78  * @height: a pointer to a #long into which the y extents (height) will be returned.
79  *
80  * Get the size of the image displayed in a specified #AccessibleImage object.
81  **/
82 void
83 AccessibleImage_getImageSize (AccessibleImage *obj,
84                               long int *width,
85                               long int *height)
86 {
87   CORBA_long w, h;
88
89   cspi_return_if_fail (obj != NULL);
90
91   Accessibility_Image_getImageSize (CSPI_OBJREF (obj),
92                                     &w, &h, cspi_ev ());
93
94   if (!cspi_check_ev ("getImageSize"))
95     {
96       *width = 0;
97       *height = 0;
98     }
99   else
100     {
101       *width = w;
102       *height = h;
103     }
104 }
105
106 /**
107  * AccessibleImage_getImagePosition:
108  * @obj: a pointer to the #AccessibleImage implementor to query.
109  * @x: a pointer to a #long into which the minimum x coordinate will be returned.
110  * @y: a pointer to a #long into which the minimum y coordinate will be returned.
111  * @ctype: the desired coordinate system into which to return the results,
112  *         (e.g. SPI_COORD_TYPE_WINDOW, SPI_COORD_TYPE_SCREEN).
113  *
114  * Get the minimum x and y coordinates of the image displayed in a
115  *         specified #AccessibleImage implementor.
116  **/
117 void
118 AccessibleImage_getImagePosition (AccessibleImage *obj,
119                                   long *x,
120                                   long *y,
121                                   AccessibleCoordType ctype)
122 {
123   CORBA_long cx, cy;
124
125   cspi_return_if_fail (obj != NULL);
126
127   Accessibility_Image_getImagePosition (CSPI_OBJREF (obj),
128                                         &cx, &cy, ctype, cspi_ev ());
129
130   if (!cspi_check_ev ("getImagePosition"))
131     {
132       *x = 0;
133       *y = 0;
134     }
135   else
136     {
137       *x = cx;
138       *y = cy;
139     }
140 }
141
142 /**
143  * AccessibleImage_getImageExtents:
144  * @obj: a pointer to the #AccessibleImage implementor to query.
145  * @x: a pointer to a #long into which the minimum x coordinate will be returned.
146  * @y: a pointer to a #long into which the minimum y coordinate will be returned.
147  * @width: a pointer to a #long into which the image x extent will be returned.
148  * @height: a pointer to a #long into which the image y extent will be returned.
149  * @ctype: the desired coordinate system into which to return the results,
150  *         (e.g. SPI_COORD_TYPE_WINDOW, SPI_COORD_TYPE_SCREEN).
151  *
152  * Get the bounding box of the image displayed in a
153  *         specified #AccessibleImage implementor.
154  **/
155 void
156 AccessibleImage_getImageExtents (AccessibleImage *obj,
157                                  long *x,
158                                  long *y,
159                                  long *width,
160                                  long *height,
161                                  AccessibleCoordType ctype)
162 {
163   Accessibility_BoundingBox bbox;
164
165   cspi_return_if_fail (obj != NULL);
166
167   bbox = Accessibility_Image_getImageExtents (CSPI_OBJREF (obj),
168                                               ctype,
169                                               cspi_ev ());
170
171   if (!cspi_check_ev ("getImageExtents"))
172     {
173       *x = *y = *width = *height = 0;
174     }
175   else
176     {
177       *x = bbox.x;
178       *y = bbox.y;
179       *width = bbox.width;
180       *height = bbox.height;
181     }
182 }
183
184 /**
185  * AccessibleImage_getImageLocale:
186  * @obj: The #AccessibleImage being queried.
187  *
188  * Get the locale associated with an image and its textual representation.
189  *
190  * Returns: A POSIX LC_MESSAGES-style Locale value for image description and text.
191  **/
192 char *
193 AccessibleImage_getImageLocale  (AccessibleImage *obj)
194 {
195     char *retval = "C";
196
197     cspi_return_val_if_fail (obj != NULL, "C");
198
199     retval = Accessibility_Image__get_imageLocale (CSPI_OBJREF (obj), cspi_ev ());
200
201     cspi_return_val_if_ev ("getImageLocale", NULL);
202
203     return retval;
204 }
205