Added methods for Component Layer and MDI Z-Order information (see
[platform/core/uifw/at-spi2-atk.git] / cspi / spi_component.c
index a5fdc07..103a69f 100644 (file)
@@ -1,11 +1,13 @@
 /*
  *
- * SpiAccessibleComponent function implementations
+ * AccessibleComponent function implementations
  *
  */
 
+#include <cspi/spi-private.h>
+
 /**
- * SpiAccessibleComponent_ref:
+ * AccessibleComponent_ref:
  * @obj: a pointer to an object implementing #AccessibleComponent on which to operate.
  *
  * Increment the reference count for an #AccessibleComponent.
  *
  **/
 int
-SpiAccessibleComponent_ref (SpiAccessibleComponent *obj)
+AccessibleComponent_ref (AccessibleComponent *obj)
 {
-  Accessibility_Component_ref (*obj, &ev);
+  cspi_object_ref (obj);
   return 0;
 }
 
 /**
- * SpiAccessibleComponent_unref:
+ * AccessibleComponent_unref:
  * @obj: a pointer to the object implementing #AccessibleComponent on which to operate.
  *
  * Decrement the reference count for an #AccessibleComponent.
@@ -30,94 +32,97 @@ SpiAccessibleComponent_ref (SpiAccessibleComponent *obj)
  *
  **/
 int
-SpiAccessibleComponent_unref (SpiAccessibleComponent *obj)
+AccessibleComponent_unref (AccessibleComponent *obj)
 {
-  Accessibility_Component_unref (*obj, &ev);
+  cspi_object_unref (obj);
   return 0;
 }
 
 /**
- * SpiAccessibleComponent_contains:
+ * AccessibleComponent_contains:
  * @obj: a pointer to the #AccessibleComponent to query.
  * @x: a #long specifying the x coordinate in question.
  * @y: a #long specifying the y coordinate in question.
  * @ctype: the desired coordinate system of the point (@x, @y)
- *         (e.g. COORD_TYPE_WINDOW, COORD_TYPE_SCREEN).
+ *         (e.g. CSPI_COORD_TYPE_WINDOW, CSPI_COORD_TYPE_SCREEN).
  *
  * Query whether a given #AccessibleComponent contains a particular point.
  *
+ * Returns: a #TRUE if the specified component contains the point (@x, @y),
+ *          otherwise #FALSE.
  **/
-boolean
-SpiAccessibleComponent_contains (SpiAccessibleComponent *obj,
-                              long x,
-                              long y,
-                              SpiAccessibleCoordType ctype)
+SPIBoolean
+AccessibleComponent_contains (AccessibleComponent *obj,
+                              long int x,
+                              long int y,
+                              AccessibleCoordType ctype)
 {
-  return Accessibility_Component_contains (*obj,
+  return Accessibility_Component_contains (CSPI_OBJREF (obj),
                                            (CORBA_long) x,
                                            (CORBA_long) y,
                                            ctype,
-                                           &ev);
+                                           cspi_ev ());
 }
 
 /**
- * SpiAccessibleComponent_getAccessibleAtPoint:
+ * AccessibleComponent_getAccessibleAtPoint:
  * @obj: a pointer to the #AccessibleComponent to query.
  * @x: a #long specifying the x coordinate of the point in question.
  * @y: a #long specifying the y coordinate of the point in question.
  * @ctype: the coordinate system of the point (@x, @y)
- *         (e.g. COORD_TYPE_WINDOW, COORD_TYPE_SCREEN).
+ *         (e.g. CSPI_COORD_TYPE_WINDOW, CSPI_COORD_TYPE_SCREEN).
  *
  * Get the accessible child at a given coordinate within an #AccessibleComponent.
  *
  * Returns: a pointer to an #Accessible child of the specified component which
  *          contains the point (@x, @y), or NULL of no child contains the point.
  **/
-SpiAccessible *
-SpiAccessibleComponent_getAccessibleAtPoint (SpiAccessibleComponent *obj,
-                                          long x,
-                                          long y,
-                                          SpiAccessibleCoordType ctype)
+Accessible *
+AccessibleComponent_getAccessibleAtPoint (AccessibleComponent *obj,
+                                          long int x,
+                                          long int y,
+                                          AccessibleCoordType ctype)
 {
-  SpiAccessible child;
-  child = Accessibility_Component_getAccessibleAtPoint(*obj,
+  Accessibility_Accessible child;
+
+  child = Accessibility_Component_getAccessibleAtPoint(CSPI_OBJREF (obj),
                                                        (CORBA_long) x,
                                                        (CORBA_long) y,
                                                        ctype,
-                                                       &ev);
-  return (child != NULL) ? Obj_Add (child) : NULL;
+                                                       cspi_ev ());
+  return cspi_object_add (child);
 }
 
 /**
- * SpiAccessibleComponent_getExtents:
+ * AccessibleComponent_getExtents:
  * @obj: a pointer to the #AccessibleComponent to query.
  * @x: a pointer to a #long into which the minimum x coordinate will be returned.
  * @y: a pointer to a #long into which the minimum y coordinate will be returned.
  * @width: a pointer to a #long into which the x extents (width) will be returned.
  * @height: a pointer to a #long into which the y extents (height) will be returned.
  * @ctype: the desired coordinate system into which to return the results,
- *         (e.g. COORD_TYPE_WINDOW, COORD_TYPE_SCREEN).
+ *         (e.g. CSPI_COORD_TYPE_WINDOW, CSPI_COORD_TYPE_SCREEN).
  *
  * Get the bounding box of the specified #AccessibleComponent.
  *
  **/
 void
-SpiAccessibleComponent_getExtents (SpiAccessibleComponent *obj,
-                                long *x,
-                                long *y,
-                                long *width,
-                                long *height,
-                                SpiAccessibleCoordType ctype)
+AccessibleComponent_getExtents (AccessibleComponent *obj,
+                                long int *x,
+                                long int *y,
+                                long int *width,
+                                long int *height,
+                                AccessibleCoordType ctype)
 {
   CORBA_long cx, cy, cw, ch;   
-  Accessibility_Component_getExtents (*obj,
+  Accessibility_Component_getExtents (CSPI_OBJREF (obj),
                                       &cx,
                                       &cy,
                                       &cw,
                                       &ch,
                                      ctype,
-                                     &ev);
-  spi_warn_ev (&ev, "SpiAccessibleComponent_getExtents");
+                                     cspi_ev ());
+  cspi_warn_ev (cspi_ev (), "AccessibleComponent_getExtents");
   *x = (long) cx;
   *y = (long) cy;
   *width = (long) cw;
@@ -125,31 +130,31 @@ SpiAccessibleComponent_getExtents (SpiAccessibleComponent *obj,
 }
 
 /**
- * SpiAccessibleComponent_getPosition:
+ * AccessibleComponent_getPosition:
  * @obj: a pointer to the #AccessibleComponent to query.
  * @x: a pointer to a #long into which the minimum x coordinate will be returned.
  * @y: a pointer to a #long into which the minimum y coordinate will be returned.
  * @ctype: the desired coordinate system into which to return the results,
- *         (e.g. COORD_TYPE_WINDOW, COORD_TYPE_SCREEN).
+ *         (e.g. CSPI_COORD_TYPE_WINDOW, CSPI_COORD_TYPE_SCREEN).
  *
  * Get the minimum x and y coordinates of the specified #AccessibleComponent.
  *
  **/
 void
-SpiAccessibleComponent_getPosition (SpiAccessibleComponent *obj,
-                                 long *x,
-                                 long *y,
-                                 SpiAccessibleCoordType ctype)
+AccessibleComponent_getPosition (AccessibleComponent *obj,
+                                 long int *x,
+                                 long int *y,
+                                 AccessibleCoordType ctype)
 {
-  Accessibility_Component_getPosition (*obj,
+  Accessibility_Component_getPosition (CSPI_OBJREF (obj),
                                        (CORBA_long *) x,
                                        (CORBA_long *) y,
                                        ctype,
-                                       &ev);
+                                       cspi_ev ());
 }
 
 /**
- * SpiAccessibleComponent_getSize:
+ * AccessibleComponent_getSize:
  * @obj: a pointer to the #AccessibleComponent to query.
  * @width: a pointer to a #long into which the x extents (width) will be returned.
  * @height: a pointer to a #long into which the y extents (height) will be returned.
@@ -158,19 +163,86 @@ SpiAccessibleComponent_getPosition (SpiAccessibleComponent *obj,
  *
  **/
 void
-SpiAccessibleComponent_getSize (SpiAccessibleComponent *obj,
-                             long *width,
-                             long *height)
+AccessibleComponent_getSize (AccessibleComponent *obj,
+                             long int *width,
+                             long int *height)
 {
-  Accessibility_Component_getSize (*obj,
+  Accessibility_Component_getSize (CSPI_OBJREF (obj),
                                    (CORBA_long *) width,
                                    (CORBA_long *) height,
-                                   &ev);
+                                   cspi_ev ());
+}
+
+/**
+ * AccessibleComponent_getLayer:
+ * @obj: a pointer to the #AccessibleComponent to query.
+ *
+ * Query which layer the component is painted into, to help determine its 
+ *      visibility in terms of stacking order.
+ *
+ * Returns: the #AccessibleComponentLayer into which this component is painted.
+ **/
+AccessibleComponentLayer
+AccessibleComponent_getLayer (AccessibleComponent *obj)
+{
+  Accessibility_ComponentLayer zlayer;
+  AccessibleComponentLayer retval;
+  
+  zlayer = Accessibility_Component_getLayer (CSPI_OBJREF (obj),
+                                             cspi_ev ());
+  switch (retval)
+    {
+    case Accessibility_LAYER_BACKGROUND:
+      retval = SPI_LAYER_BACKGROUND;
+      break;
+    case Accessibility_LAYER_CANVAS:     
+      retval = SPI_LAYER_CANVAS;
+      break;
+    case Accessibility_LAYER_WIDGET:     
+      retval = SPI_LAYER_WIDGET;
+      break;
+    case Accessibility_LAYER_MDI:        
+      retval = SPI_LAYER_MDI;
+      break;
+    case Accessibility_LAYER_POPUP:      
+      retval = SPI_LAYER_POPUP;
+      break;
+    case Accessibility_LAYER_OVERLAY:    
+      retval = SPI_LAYER_OVERLAY;
+      break;
+    default:
+      retval = SPI_LAYER_INVALID;
+    }
+  return retval;
+}
+
+/**
+ * AccessibleComponent_getMDIZOrder:
+ * @obj: a pointer to the #AccessibleComponent to query.
+ *
+ * Query the z stacking order of a component which is in the MDI layer.
+ *       (Bigger z-order numbers mean nearer the top)
+ *
+ * Returns: a short integer indicating the stacking order of the component 
+ *       in the MDI layer, or -1 if the component is not in the MDI layer.
+ **/
+short
+AccessibleComponent_getMDIZOrder (AccessibleComponent *obj)
+{
+  return (short) Accessibility_Component_getMDIZOrder (CSPI_OBJREF (obj),
+                                                       cspi_ev ());
 }
 
-/* Not Yet Implemented */
+/**
+ * AccessibleComponent_grabFocus:
+ * @obj: a pointer to the #AccessibleComponent on which to operate.
+ *
+ * Attempt to set the keyboard input focus to the specified
+ *         #AccessibleComponent.
+ *
+ **/
 void
-SpiAccessibleComponent_grabFocus (SpiAccessibleComponent *obj)
+AccessibleComponent_grabFocus (AccessibleComponent *obj)
 {
   ;
 }