Added test for SpiRemoteObject to spi_accessible_new() constructor,
[platform/core/uifw/at-spi2-atk.git] / libspi / image.c
index 5598ae6..8a30cb7 100644 (file)
@@ -32,26 +32,21 @@ spi_image_interface_new (AtkObject *obj)
 {
   SpiImage *new_image = g_object_new (SPI_IMAGE_TYPE, NULL);
 
-  spi_base_construct (SPI_BASE (new_image), obj);
+  spi_base_construct (SPI_BASE (new_image), G_OBJECT(obj));
 
   return new_image;
 }
 
-
 static AtkImage *
 get_image_from_servant (PortableServer_Servant servant)
 {
   SpiBase *object = SPI_BASE (bonobo_object_from_servant (servant));
 
-  if (!object)
-    {
-      return NULL;
-    }
-
-  return ATK_IMAGE (object->atko);
+  g_return_val_if_fail (object, NULL);
+  g_return_val_if_fail (ATK_IS_OBJECT(object->gobj), NULL);
+  return ATK_IMAGE (object->gobj);
 }
 
-
 static void 
 impl_getImagePosition (PortableServer_Servant servant,
                       CORBA_long * x, CORBA_long * y,
@@ -67,7 +62,6 @@ impl_getImagePosition (PortableServer_Servant servant,
                                (AtkCoordType) coordType);
 }
 
-
 static void 
 impl_getImageSize (PortableServer_Servant servant,
                   CORBA_long * width, CORBA_long * height,
@@ -81,6 +75,27 @@ impl_getImageSize (PortableServer_Servant servant,
                            (gint *) width, (gint *) height);
 }
 
+static Accessibility_BoundingBox
+impl_getImageExtents (PortableServer_Servant servant,
+                     const CORBA_short      coordType,
+                     CORBA_Environment     *ev)
+{
+  AtkImage *image;
+  gint x, y, width, height;
+  Accessibility_BoundingBox bbox;
+
+  image = get_image_from_servant (servant);
+
+  atk_image_get_image_size (image, &width, &height);
+  atk_image_get_image_position (image, &x, &y, coordType);
+
+  bbox.x = x;
+  bbox.y = y;
+  bbox.width = width;
+  bbox.height = height;
+
+  return bbox;
+}
 
 static CORBA_string 
 impl__get_imageDescription (PortableServer_Servant servant,
@@ -103,16 +118,15 @@ impl__get_imageDescription (PortableServer_Servant servant,
     }
 }
 
-
 static void
 spi_image_class_init (SpiImageClass *klass)
 {
   POA_Accessibility_Image__epv *epv = &klass->epv;
 
   /* Initialize epv table */
-
-  epv->getImagePosition = impl_getImagePosition;
-  epv->getImageSize = impl_getImageSize;
+  epv->getImagePosition      = impl_getImagePosition;
+  epv->getImageSize          = impl_getImageSize;
+  epv->getImageExtents       = impl_getImageExtents;
   epv->_get_imageDescription = impl__get_imageDescription;
 }