2 * AT-SPI - Assistive Technology Service Provider Interface
3 * (Gnome Accessibility Project; http://developer.gnome.org/projects/gap)
5 * Copyright 2001, 2002 Sun Microsystems Inc.,
6 * Copyright 2001, 2002 Ximian, Inc.
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either
11 * version 2 of the License, or (at your option) any later version.
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Library General Public License for more details.
18 * You should have received a copy of the GNU Library General Public
19 * License along with this library; if not, write to the
20 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
21 * Boston, MA 02111-1307, USA.
24 /* image.c : implements the Image interface */
28 #include <libspi/image.h>
32 spi_image_interface_new (AtkObject *obj)
34 SpiImage *new_image = g_object_new (SPI_IMAGE_TYPE, NULL);
36 spi_base_construct (SPI_BASE (new_image), G_OBJECT(obj));
42 get_image_from_servant (PortableServer_Servant servant)
44 SpiBase *object = SPI_BASE (bonobo_object_from_servant (servant));
46 g_return_val_if_fail (object, NULL);
47 g_return_val_if_fail (ATK_IS_OBJECT(object->gobj), NULL);
48 return ATK_IMAGE (object->gobj);
52 impl_getImagePosition (PortableServer_Servant servant,
53 CORBA_long * x, CORBA_long * y,
54 const CORBA_short coordType,
55 CORBA_Environment *ev)
57 AtkImage *image = get_image_from_servant (servant);
60 g_return_if_fail (image != NULL);
62 atk_image_get_image_position (image,
64 (AtkCoordType) coordType);
70 impl_getImageSize (PortableServer_Servant servant,
71 CORBA_long * width, CORBA_long * height,
72 CORBA_Environment *ev)
74 AtkImage *image = get_image_from_servant (servant);
77 g_return_if_fail (image != NULL);
79 atk_image_get_image_size (image,
85 static Accessibility_BoundingBox
86 impl_getImageExtents (PortableServer_Servant servant,
87 const CORBA_short coordType,
88 CORBA_Environment *ev)
91 gint x, y, width, height;
92 Accessibility_BoundingBox bbox;
94 bbox.x = bbox.y = bbox.width = bbox.height = -1;
96 image = get_image_from_servant (servant);
100 atk_image_get_image_size (image, &width, &height);
101 atk_image_get_image_position (image, &x, &y, coordType);
106 bbox.height = height;
113 impl__get_imageDescription (PortableServer_Servant servant,
114 CORBA_Environment *ev)
117 AtkImage *image = get_image_from_servant (servant);
119 g_return_val_if_fail (image != NULL, CORBA_string_dup (""));
121 rv = atk_image_get_image_description (image);
125 return CORBA_string_dup (rv);
129 return CORBA_string_dup ("");
134 spi_image_class_init (SpiImageClass *klass)
136 POA_Accessibility_Image__epv *epv = &klass->epv;
138 /* Initialize epv table */
139 epv->getImagePosition = impl_getImagePosition;
140 epv->getImageSize = impl_getImageSize;
141 epv->getImageExtents = impl_getImageExtents;
142 epv->_get_imageDescription = impl__get_imageDescription;
146 spi_image_init (SpiImage *image)
150 BONOBO_TYPE_FUNC_FULL (SpiImage,