Added methods for Component Layer and MDI Z-Order information (see
[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   cspi_object_ref (obj);
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   cspi_object_unref (obj);
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. CSPI_COORD_TYPE_WINDOW, CSPI_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 SPIBoolean
55 AccessibleComponent_contains (AccessibleComponent *obj,
56                               long int x,
57                               long int y,
58                               AccessibleCoordType ctype)
59 {
60   return Accessibility_Component_contains (CSPI_OBJREF (obj),
61                                            (CORBA_long) x,
62                                            (CORBA_long) y,
63                                            ctype,
64                                            cspi_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. CSPI_COORD_TYPE_WINDOW, CSPI_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   Accessibility_Accessible child;
87
88   child = Accessibility_Component_getAccessibleAtPoint(CSPI_OBJREF (obj),
89                                                        (CORBA_long) x,
90                                                        (CORBA_long) y,
91                                                        ctype,
92                                                        cspi_ev ());
93   return cspi_object_add (child);
94 }
95
96 /**
97  * AccessibleComponent_getExtents:
98  * @obj: a pointer to the #AccessibleComponent to query.
99  * @x: a pointer to a #long into which the minimum x coordinate will be returned.
100  * @y: a pointer to a #long into which the minimum y coordinate will be returned.
101  * @width: a pointer to a #long into which the x extents (width) will be returned.
102  * @height: a pointer to a #long into which the y extents (height) will be returned.
103  * @ctype: the desired coordinate system into which to return the results,
104  *         (e.g. CSPI_COORD_TYPE_WINDOW, CSPI_COORD_TYPE_SCREEN).
105  *
106  * Get the bounding box of the specified #AccessibleComponent.
107  *
108  **/
109 void
110 AccessibleComponent_getExtents (AccessibleComponent *obj,
111                                 long int *x,
112                                 long int *y,
113                                 long int *width,
114                                 long int *height,
115                                 AccessibleCoordType ctype)
116 {
117   CORBA_long cx, cy, cw, ch;    
118   Accessibility_Component_getExtents (CSPI_OBJREF (obj),
119                                       &cx,
120                                       &cy,
121                                       &cw,
122                                       &ch,
123                                       ctype,
124                                       cspi_ev ());
125   cspi_warn_ev (cspi_ev (), "AccessibleComponent_getExtents");
126   *x = (long) cx;
127   *y = (long) cy;
128   *width = (long) cw;
129   *height = (long) ch;
130 }
131
132 /**
133  * AccessibleComponent_getPosition:
134  * @obj: a pointer to the #AccessibleComponent to query.
135  * @x: a pointer to a #long into which the minimum x coordinate will be returned.
136  * @y: a pointer to a #long into which the minimum y coordinate will be returned.
137  * @ctype: the desired coordinate system into which to return the results,
138  *         (e.g. CSPI_COORD_TYPE_WINDOW, CSPI_COORD_TYPE_SCREEN).
139  *
140  * Get the minimum x and y coordinates of the specified #AccessibleComponent.
141  *
142  **/
143 void
144 AccessibleComponent_getPosition (AccessibleComponent *obj,
145                                  long int *x,
146                                  long int *y,
147                                  AccessibleCoordType ctype)
148 {
149   Accessibility_Component_getPosition (CSPI_OBJREF (obj),
150                                        (CORBA_long *) x,
151                                        (CORBA_long *) y,
152                                        ctype,
153                                        cspi_ev ());
154 }
155
156 /**
157  * AccessibleComponent_getSize:
158  * @obj: a pointer to the #AccessibleComponent to query.
159  * @width: a pointer to a #long into which the x extents (width) will be returned.
160  * @height: a pointer to a #long into which the y extents (height) will be returned.
161  *
162  * Get the size of the specified #AccessibleComponent.
163  *
164  **/
165 void
166 AccessibleComponent_getSize (AccessibleComponent *obj,
167                              long int *width,
168                              long int *height)
169 {
170   Accessibility_Component_getSize (CSPI_OBJREF (obj),
171                                    (CORBA_long *) width,
172                                    (CORBA_long *) height,
173                                    cspi_ev ());
174 }
175
176 /**
177  * AccessibleComponent_getLayer:
178  * @obj: a pointer to the #AccessibleComponent to query.
179  *
180  * Query which layer the component is painted into, to help determine its 
181  *      visibility in terms of stacking order.
182  *
183  * Returns: the #AccessibleComponentLayer into which this component is painted.
184  **/
185 AccessibleComponentLayer
186 AccessibleComponent_getLayer (AccessibleComponent *obj)
187 {
188   Accessibility_ComponentLayer zlayer;
189   AccessibleComponentLayer retval;
190   
191   zlayer = Accessibility_Component_getLayer (CSPI_OBJREF (obj),
192                                               cspi_ev ());
193   switch (retval)
194     {
195     case Accessibility_LAYER_BACKGROUND:
196       retval = SPI_LAYER_BACKGROUND;
197       break;
198     case Accessibility_LAYER_CANVAS:      
199       retval = SPI_LAYER_CANVAS;
200       break;
201     case Accessibility_LAYER_WIDGET:      
202       retval = SPI_LAYER_WIDGET;
203       break;
204     case Accessibility_LAYER_MDI:         
205       retval = SPI_LAYER_MDI;
206       break;
207     case Accessibility_LAYER_POPUP:       
208       retval = SPI_LAYER_POPUP;
209       break;
210     case Accessibility_LAYER_OVERLAY:     
211       retval = SPI_LAYER_OVERLAY;
212       break;
213     default:
214       retval = SPI_LAYER_INVALID;
215     }
216   return retval;
217 }
218
219 /**
220  * AccessibleComponent_getMDIZOrder:
221  * @obj: a pointer to the #AccessibleComponent to query.
222  *
223  * Query the z stacking order of a component which is in the MDI layer.
224  *       (Bigger z-order numbers mean nearer the top)
225  *
226  * Returns: a short integer indicating the stacking order of the component 
227  *       in the MDI layer, or -1 if the component is not in the MDI layer.
228  **/
229 short
230 AccessibleComponent_getMDIZOrder (AccessibleComponent *obj)
231 {
232   return (short) Accessibility_Component_getMDIZOrder (CSPI_OBJREF (obj),
233                                                        cspi_ev ());
234 }
235
236 /**
237  * AccessibleComponent_grabFocus:
238  * @obj: a pointer to the #AccessibleComponent on which to operate.
239  *
240  * Attempt to set the keyboard input focus to the specified
241  *         #AccessibleComponent.
242  *
243  **/
244 void
245 AccessibleComponent_grabFocus (AccessibleComponent *obj)
246 {
247   ;
248 }