Added boolean return types for methods in Component, Selection,
[platform/core/uifw/at-spi2-atk.git] / cspi / spi_component.c
index f644da3..cf43b7d 100644 (file)
@@ -11,9 +11,6 @@
  * @obj: a pointer to an object implementing #AccessibleComponent on which to operate.
  *
  * Increment the reference count for an #AccessibleComponent.
- *
- * Returns: (no return code implemented yet).
- *
  **/
 void
 AccessibleComponent_ref (AccessibleComponent *obj)
@@ -26,9 +23,6 @@ AccessibleComponent_ref (AccessibleComponent *obj)
  * @obj: a pointer to the object implementing #AccessibleComponent on which to operate.
  *
  * Decrement the reference count for an #AccessibleComponent.
- *
- * Returns: (no return code implemented yet).
- *
  **/
 void
 AccessibleComponent_unref (AccessibleComponent *obj)
@@ -55,13 +49,18 @@ AccessibleComponent_contains (AccessibleComponent *obj,
                               long int y,
                               AccessibleCoordType ctype)
 {
+  SPIBoolean retval;
+
   cspi_return_val_if_fail (obj != NULL, FALSE);
 
-  return Accessibility_Component_contains (CSPI_OBJREF (obj),
-                                           (CORBA_long) x,
-                                           (CORBA_long) y,
-                                           ctype,
-                                           cspi_ev ());
+  retval = Accessibility_Component_contains (CSPI_OBJREF (obj),
+                                            (CORBA_long) x,
+                                            (CORBA_long) y,
+                                            ctype,
+                                            cspi_ev ());
+  cspi_return_val_if_ev ("contains", FALSE);
+
+  return retval;
 }
 
 /**
@@ -123,7 +122,7 @@ AccessibleComponent_getExtents (AccessibleComponent *obj,
   bbox = Accessibility_Component_getExtents (CSPI_OBJREF (obj),
                                             ctype,
                                             cspi_ev ());
-  if (cspi_check_ev ("AccessibleComponent_getExtents"))
+  if (!cspi_check_ev ("AccessibleComponent_getExtents"))
     {
       *x = *y = *width = *height = 0;    
     }
@@ -153,11 +152,22 @@ AccessibleComponent_getPosition (AccessibleComponent *obj,
                                  long int *y,
                                  AccessibleCoordType ctype)
 {
+  CORBA_long cx, cy;
+
+  cspi_return_if_fail (obj != NULL);
+
   Accessibility_Component_getPosition (CSPI_OBJREF (obj),
-                                       (CORBA_long *) x,
-                                       (CORBA_long *) y,
-                                       ctype,
-                                       cspi_ev ());
+                                      &cx, &cy, ctype, cspi_ev ());
+
+  if (!cspi_check_ev ("getPosition"))
+    {
+      *x = *y = 0;
+    }
+  else
+    {
+      *x = cx;
+      *y = cy;
+    }
 }
 
 /**
@@ -174,6 +184,8 @@ AccessibleComponent_getSize (AccessibleComponent *obj,
                              long int *width,
                              long int *height)
 {
+  cspi_return_if_fail (obj != NULL);
+
   Accessibility_Component_getSize (CSPI_OBJREF (obj),
                                    (CORBA_long *) width,
                                    (CORBA_long *) height,
@@ -192,11 +204,16 @@ AccessibleComponent_getSize (AccessibleComponent *obj,
 AccessibleComponentLayer
 AccessibleComponent_getLayer (AccessibleComponent *obj)
 {
+  AccessibleComponentLayer     retval;
   Accessibility_ComponentLayer zlayer;
-  AccessibleComponentLayer retval;
-  
+
+  cspi_return_val_if_fail (obj != NULL, FALSE);
+
   zlayer = Accessibility_Component_getLayer (CSPI_OBJREF (obj),
                                             cspi_ev ());
+
+  cspi_return_val_if_ev ("getLayer", SPI_LAYER_INVALID);
+
   switch (zlayer)
     {
     case Accessibility_LAYER_BACKGROUND:
@@ -221,6 +238,7 @@ AccessibleComponent_getLayer (AccessibleComponent *obj)
       retval = SPI_LAYER_INVALID;
       break;
     }
+
   return retval;
 }
 
@@ -237,8 +255,16 @@ AccessibleComponent_getLayer (AccessibleComponent *obj)
 short
 AccessibleComponent_getMDIZOrder (AccessibleComponent *obj)
 {
-  return (short) Accessibility_Component_getMDIZOrder (CSPI_OBJREF (obj),
-                                                       cspi_ev ());
+  short retval;
+
+  cspi_return_val_if_fail (obj != NULL, FALSE);
+
+  retval = Accessibility_Component_getMDIZOrder (CSPI_OBJREF (obj),
+                                                cspi_ev ());
+
+  cspi_return_val_if_ev ("getMDIZOrder", FALSE);
+
+  return retval;
 }
 
 /**
@@ -248,9 +274,21 @@ AccessibleComponent_getMDIZOrder (AccessibleComponent *obj)
  * Attempt to set the keyboard input focus to the specified
  *         #AccessibleComponent.
  *
+ * Returns: #TRUE if successful, #FALSE otherwise.
+ *
  **/
-void
+SPIBoolean
 AccessibleComponent_grabFocus (AccessibleComponent *obj)
 {
-  ;
+  short retval;
+
+  cspi_return_val_if_fail (obj != NULL, FALSE);
+
+  retval = Accessibility_Component_grabFocus (CSPI_OBJREF (obj),
+                                             cspi_ev ());
+
+  cspi_return_val_if_ev ("grabFocus", FALSE);
+
+  return retval;
 }
+