bf5360e0063466b1adcbfa0451b6b0d2eba46d4d
[platform/core/uifw/at-spi2-atk.git] / cspi / spi_image.c
1 #include <cspi/spi-private.h>
2
3 /**
4  * AccessibleImage_ref:
5  * @obj: a pointer to the #AccessibleImage implementor on which to operate.
6  *
7  * Increment the reference count for an #AccessibleImage object.
8  **/
9 void
10 AccessibleImage_ref (AccessibleImage *obj)
11 {
12   cspi_object_ref (obj);
13 }
14
15 /**
16  * AccessibleImage_unref:
17  * @obj: a pointer to the #AccessibleImage implementor on which to operate.
18  *
19  * Decrement the reference count for an #AccessibleImage object.
20  **/
21 void
22 AccessibleImage_unref (AccessibleImage *obj)
23 {
24   cspi_object_unref (obj);
25 }
26
27 /**
28  * AccessibleImage_getImageDescription:
29  * @obj: a pointer to the #AccessibleImage implementor on which to operate.
30  *
31  * Get the description of the image displayed in an #AccessibleImage object.
32  *
33  * Returns: a UTF-8 string describing the image.
34  **/
35 char *
36 AccessibleImage_getImageDescription (AccessibleImage *obj)
37 {
38   char *retval;
39
40   cspi_return_val_if_fail (obj != NULL, NULL);
41
42   retval = 
43     Accessibility_Image__get_imageDescription (CSPI_OBJREF (obj),
44                                                cspi_ev ());
45
46   cspi_return_val_if_ev ("getImageDescription", NULL);
47
48   return retval;
49 }
50
51 /**
52  * AccessibleImage_getImageSize:
53  * @obj: a pointer to the #AccessibleImage to query.
54  * @width: a pointer to a #long into which the x extents (width) will be returned.
55  * @height: a pointer to a #long into which the y extents (height) will be returned.
56  *
57  * Get the size of the image displayed in a specified #AccessibleImage object.
58  **/
59 void
60 AccessibleImage_getImageSize (AccessibleImage *obj,
61                               long int *width,
62                               long int *height)
63 {
64   CORBA_long w, h;
65
66   cspi_return_if_fail (obj != NULL);
67
68   Accessibility_Image_getImageSize (CSPI_OBJREF (obj),
69                                     &w, &h, cspi_ev ());
70
71   if (!cspi_check_ev ("getImageSize"))
72     {
73       *width = 0;
74       *height = 0;
75     }
76   else
77     {
78       *width = w;
79       *height = h;
80     }
81 }
82
83 /**
84  * AccessibleImage_getImagePosition:
85  * @obj: a pointer to the #AccessibleImage implementor to query.
86  * @x: a pointer to a #long into which the minimum x coordinate will be returned.
87  * @y: a pointer to a #long into which the minimum y coordinate will be returned.
88  * @ctype: the desired coordinate system into which to return the results,
89  *         (e.g. SPI_COORD_TYPE_WINDOW, SPI_COORD_TYPE_SCREEN).
90  *
91  * Get the minimum x and y coordinates of the image displayed in a
92  *         specified #AccessibleImage implementor.
93  **/
94 void
95 AccessibleImage_getImagePosition (AccessibleImage *obj,
96                                   long *x,
97                                   long *y,
98                                   AccessibleCoordType ctype)
99 {
100   CORBA_long cx, cy;
101
102   cspi_return_if_fail (obj != NULL);
103
104   Accessibility_Image_getImagePosition (CSPI_OBJREF (obj),
105                                         &cx, &cy, ctype, cspi_ev ());
106
107   if (!cspi_check_ev ("getImagePosition"))
108     {
109       *x = 0;
110       *y = 0;
111     }
112   else
113     {
114       *x = cx;
115       *y = cy;
116     }
117 }
118
119 /**
120  * AccessibleImage_getImageExtents:
121  * @obj: a pointer to the #AccessibleImage implementor to query.
122  * @x: a pointer to a #long into which the minimum x coordinate will be returned.
123  * @y: a pointer to a #long into which the minimum y coordinate will be returned.
124  * @width: a pointer to a #long into which the image x extent will be returned.
125  * @height: a pointer to a #long into which the image y extent will be returned.
126  * @ctype: the desired coordinate system into which to return the results,
127  *         (e.g. SPI_COORD_TYPE_WINDOW, SPI_COORD_TYPE_SCREEN).
128  *
129  * Get the bounding box of the image displayed in a
130  *         specified #AccessibleImage implementor.
131  **/
132 void
133 AccessibleImage_getImageExtents (AccessibleImage *obj,
134                                  long *x,
135                                  long *y,
136                                  long *width,
137                                  long *height,
138                                  AccessibleCoordType ctype)
139 {
140   Accessibility_BoundingBox bbox;
141
142   cspi_return_if_fail (obj != NULL);
143
144   bbox = Accessibility_Image_getImageExtents (CSPI_OBJREF (obj),
145                                               (CORBA_short) ctype,
146                                               cspi_ev ());
147
148   if (!cspi_check_ev ("getImageExtents"))
149     {
150       *x = *y = *width = *height = 0;
151     }
152   else
153     {
154       *x = bbox.x;
155       *y = bbox.y;
156       *width = bbox.width;
157       *height = bbox.height;
158     }
159 }