2001-11-23 Michael Meeks <michael@ximian.com>
[platform/core/uifw/at-spi2-atk.git] / cspi / spi_component.c
1 /*
2  *
3  * AccessibleComponent function implementations
4  *
5  */
6
7 #include <cspi/spi-private.h>
8
9 /**
10  * AccessibleComponent_ref:
11  * @obj: a pointer to an object implementing #AccessibleComponent on which to operate.
12  *
13  * Increment the reference count for an #AccessibleComponent.
14  *
15  * Returns: (no return code implemented yet).
16  *
17  **/
18 int
19 AccessibleComponent_ref (AccessibleComponent *obj)
20 {
21   Accessibility_Component_ref (*obj, spi_ev ());
22   return 0;
23 }
24
25 /**
26  * AccessibleComponent_unref:
27  * @obj: a pointer to the object implementing #AccessibleComponent on which to operate.
28  *
29  * Decrement the reference count for an #AccessibleComponent.
30  *
31  * Returns: (no return code implemented yet).
32  *
33  **/
34 int
35 AccessibleComponent_unref (AccessibleComponent *obj)
36 {
37   Accessibility_Component_unref (*obj, spi_ev ());
38   return 0;
39 }
40
41 /**
42  * AccessibleComponent_contains:
43  * @obj: a pointer to the #AccessibleComponent to query.
44  * @x: a #long specifying the x coordinate in question.
45  * @y: a #long specifying the y coordinate in question.
46  * @ctype: the desired coordinate system of the point (@x, @y)
47  *         (e.g. SPI_COORD_TYPE_WINDOW, SPI_COORD_TYPE_SCREEN).
48  *
49  * Query whether a given #AccessibleComponent contains a particular point.
50  *
51  * Returns: a #TRUE if the specified component contains the point (@x, @y),
52  *          otherwise #FALSE.
53  **/
54 boolean
55 AccessibleComponent_contains (AccessibleComponent *obj,
56                               long int x,
57                               long int y,
58                               AccessibleCoordType ctype)
59 {
60   return Accessibility_Component_contains (*obj,
61                                            (CORBA_long) x,
62                                            (CORBA_long) y,
63                                            ctype,
64                                            spi_ev ());
65 }
66
67 /**
68  * AccessibleComponent_getAccessibleAtPoint:
69  * @obj: a pointer to the #AccessibleComponent to query.
70  * @x: a #long specifying the x coordinate of the point in question.
71  * @y: a #long specifying the y coordinate of the point in question.
72  * @ctype: the coordinate system of the point (@x, @y)
73  *         (e.g. SPI_COORD_TYPE_WINDOW, SPI_COORD_TYPE_SCREEN).
74  *
75  * Get the accessible child at a given coordinate within an #AccessibleComponent.
76  *
77  * Returns: a pointer to an #Accessible child of the specified component which
78  *          contains the point (@x, @y), or NULL of no child contains the point.
79  **/
80 Accessible *
81 AccessibleComponent_getAccessibleAtPoint (AccessibleComponent *obj,
82                                           long int x,
83                                           long int y,
84                                           AccessibleCoordType ctype)
85 {
86   Accessible child;
87   child = Accessibility_Component_getAccessibleAtPoint(*obj,
88                                                        (CORBA_long) x,
89                                                        (CORBA_long) y,
90                                                        ctype,
91                                                        spi_ev ());
92   return spi_object_add (child);
93 }
94
95 /**
96  * AccessibleComponent_getExtents:
97  * @obj: a pointer to the #AccessibleComponent to query.
98  * @x: a pointer to a #long into which the minimum x coordinate will be returned.
99  * @y: a pointer to a #long into which the minimum y coordinate will be returned.
100  * @width: a pointer to a #long into which the x extents (width) will be returned.
101  * @height: a pointer to a #long into which the y extents (height) will be returned.
102  * @ctype: the desired coordinate system into which to return the results,
103  *         (e.g. SPI_COORD_TYPE_WINDOW, SPI_COORD_TYPE_SCREEN).
104  *
105  * Get the bounding box of the specified #AccessibleComponent.
106  *
107  **/
108 void
109 AccessibleComponent_getExtents (AccessibleComponent *obj,
110                                 long int *x,
111                                 long int *y,
112                                 long int *width,
113                                 long int *height,
114                                 AccessibleCoordType ctype)
115 {
116   CORBA_long cx, cy, cw, ch;    
117   Accessibility_Component_getExtents (*obj,
118                                       &cx,
119                                       &cy,
120                                       &cw,
121                                       &ch,
122                                       ctype,
123                                       spi_ev ());
124   spi_warn_ev (spi_ev (), "AccessibleComponent_getExtents");
125   *x = (long) cx;
126   *y = (long) cy;
127   *width = (long) cw;
128   *height = (long) ch;
129 }
130
131 /**
132  * AccessibleComponent_getPosition:
133  * @obj: a pointer to the #AccessibleComponent to query.
134  * @x: a pointer to a #long into which the minimum x coordinate will be returned.
135  * @y: a pointer to a #long into which the minimum y coordinate will be returned.
136  * @ctype: the desired coordinate system into which to return the results,
137  *         (e.g. SPI_COORD_TYPE_WINDOW, SPI_COORD_TYPE_SCREEN).
138  *
139  * Get the minimum x and y coordinates of the specified #AccessibleComponent.
140  *
141  **/
142 void
143 AccessibleComponent_getPosition (AccessibleComponent *obj,
144                                  long int *x,
145                                  long int *y,
146                                  AccessibleCoordType ctype)
147 {
148   Accessibility_Component_getPosition (*obj,
149                                        (CORBA_long *) x,
150                                        (CORBA_long *) y,
151                                        ctype,
152                                        spi_ev ());
153 }
154
155 /**
156  * AccessibleComponent_getSize:
157  * @obj: a pointer to the #AccessibleComponent to query.
158  * @width: a pointer to a #long into which the x extents (width) will be returned.
159  * @height: a pointer to a #long into which the y extents (height) will be returned.
160  *
161  * Get the size of the specified #AccessibleComponent.
162  *
163  **/
164 void
165 AccessibleComponent_getSize (AccessibleComponent *obj,
166                              long int *width,
167                              long int *height)
168 {
169   Accessibility_Component_getSize (*obj,
170                                    (CORBA_long *) width,
171                                    (CORBA_long *) height,
172                                    spi_ev ());
173 }
174
175 /**
176  * AccessibleComponent_grabFocus:
177  * @obj: a pointer to the #AccessibleComponent on which to operate.
178  *
179  * Attempt to set the keyboard input focus to the specified
180  *         #AccessibleComponent.
181  *
182  **/
183 void
184 AccessibleComponent_grabFocus (AccessibleComponent *obj)
185 {
186   ;
187 }