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>
29 /* Static function declarations */
32 spi_image_class_init (SpiImageClass *klass);
34 spi_image_init (SpiImage *image);
36 spi_image_finalize (GObject *obj);
38 impl_getImagePosition (PortableServer_Servant _servant,
39 CORBA_long * x, CORBA_long * y,
40 const CORBA_short coordType,
41 CORBA_Environment * ev);
43 impl_getImageSize (PortableServer_Servant _servant,
44 CORBA_long * width, CORBA_long * height,
45 CORBA_Environment * ev);
47 impl__get_imageDescription (PortableServer_Servant _servant,
48 CORBA_Environment * ev);
51 static GObjectClass *parent_class;
54 spi_image_get_type (void)
56 static GType type = 0;
59 static const GTypeInfo tinfo = {
60 sizeof (SpiImageClass),
62 (GBaseFinalizeFunc) NULL,
63 (GClassInitFunc) spi_image_class_init,
64 (GClassFinalizeFunc) NULL,
65 NULL, /* class data */
68 (GInstanceInitFunc) spi_image_init,
69 NULL /* value table */
73 * Bonobo_type_unique auto-generates a load of
74 * CORBA structures for us. All derived types must
75 * use bonobo_type_unique.
77 type = bonobo_type_unique (
79 POA_Accessibility_Image__init,
81 G_STRUCT_OFFSET (SpiImageClass, epv),
83 "SpiAccessibleImage");
90 spi_image_class_init (SpiImageClass *klass)
92 GObjectClass * object_class = (GObjectClass *) klass;
93 POA_Accessibility_Image__epv *epv = &klass->epv;
94 parent_class = g_type_class_peek_parent (klass);
96 object_class->finalize = spi_image_finalize;
99 /* Initialize epv table */
101 epv->getImagePosition = impl_getImagePosition;
102 epv->getImageSize = impl_getImageSize;
103 epv->_get_imageDescription = impl__get_imageDescription;
107 spi_image_init (SpiImage *image)
112 spi_image_finalize (GObject *obj)
114 SpiImage *image = SPI_IMAGE (obj);
115 g_object_unref (image->atko);
117 parent_class->finalize (obj);
121 spi_image_interface_new (AtkObject *obj)
123 SpiImage *new_image =
124 SPI_IMAGE(g_object_new (SPI_IMAGE_TYPE, NULL));
125 new_image->atko = obj;
133 impl_getImagePosition (PortableServer_Servant _servant,
134 CORBA_long * x, CORBA_long * y,
135 const CORBA_short coordType,
136 CORBA_Environment * ev)
138 SpiImage *image = SPI_IMAGE (bonobo_object_from_servant(_servant));
139 atk_image_get_image_position (ATK_IMAGE(image->atko),
140 (gint *) x, (gint *) y,
141 (AtkCoordType) coordType);
147 impl_getImageSize (PortableServer_Servant _servant,
148 CORBA_long * width, CORBA_long * height,
149 CORBA_Environment * ev)
151 SpiImage *image = SPI_IMAGE (bonobo_object_from_servant(_servant));
152 atk_image_get_image_size (ATK_IMAGE(image->atko),
153 (gint *) width, (gint *) height);
159 impl__get_imageDescription (PortableServer_Servant servant,
160 CORBA_Environment *ev)
165 image = SPI_IMAGE (bonobo_object_from_servant (servant));
167 rv = atk_image_get_image_description (ATK_IMAGE (image->atko));
169 return CORBA_string_dup (rv);
171 return CORBA_string_dup ("");