2 * AT-SPI - Assistive Technology Service Provider Interface
3 * (Gnome Accessibility Project; http://developer.gnome.org/projects/gap)
5 * Copyright 2001 Sun Microsystems Inc.
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Library General Public License for more details.
17 * You should have received a copy of the GNU Library General Public
18 * License along with this library; if not, write to the
19 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
20 * Boston, MA 02111-1307, USA.
23 /* image.c : implements the Image interface */
27 #include <libspi/image.h>
31 spi_image_interface_new (AtkObject *obj)
33 SpiImage *new_image = g_object_new (SPI_IMAGE_TYPE, NULL);
35 spi_base_construct (SPI_BASE (new_image), G_OBJECT(obj));
41 get_image_from_servant (PortableServer_Servant servant)
43 SpiBase *object = SPI_BASE (bonobo_object_from_servant (servant));
45 g_return_val_if_fail (object, NULL);
46 g_return_val_if_fail (ATK_IS_OBJECT(object->gobj), NULL);
47 return ATK_IMAGE (object->gobj);
51 impl_getImagePosition (PortableServer_Servant servant,
52 CORBA_long * x, CORBA_long * y,
53 const CORBA_short coordType,
54 CORBA_Environment *ev)
56 AtkImage *image = get_image_from_servant (servant);
59 g_return_if_fail (image != NULL);
61 atk_image_get_image_position (image,
63 (AtkCoordType) coordType);
69 impl_getImageSize (PortableServer_Servant servant,
70 CORBA_long * width, CORBA_long * height,
71 CORBA_Environment *ev)
73 AtkImage *image = get_image_from_servant (servant);
76 g_return_if_fail (image != NULL);
78 atk_image_get_image_size (image,
84 static Accessibility_BoundingBox
85 impl_getImageExtents (PortableServer_Servant servant,
86 const CORBA_short coordType,
87 CORBA_Environment *ev)
90 gint x, y, width, height;
91 Accessibility_BoundingBox bbox;
93 bbox.x = bbox.y = bbox.width = bbox.height = -1;
95 image = get_image_from_servant (servant);
99 atk_image_get_image_size (image, &width, &height);
100 atk_image_get_image_position (image, &x, &y, coordType);
105 bbox.height = height;
112 impl__get_imageDescription (PortableServer_Servant servant,
113 CORBA_Environment *ev)
116 AtkImage *image = get_image_from_servant (servant);
118 g_return_val_if_fail (image != NULL, CORBA_string_dup (""));
120 rv = atk_image_get_image_description (image);
124 return CORBA_string_dup (rv);
128 return CORBA_string_dup ("");
133 spi_image_class_init (SpiImageClass *klass)
135 POA_Accessibility_Image__epv *epv = &klass->epv;
137 /* Initialize epv table */
138 epv->getImagePosition = impl_getImagePosition;
139 epv->getImageSize = impl_getImageSize;
140 epv->getImageExtents = impl_getImageExtents;
141 epv->_get_imageDescription = impl__get_imageDescription;
145 spi_image_init (SpiImage *image)
149 BONOBO_TYPE_FUNC_FULL (SpiImage,