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.
24 * component.c : bonobo wrapper for accessible component implementation
28 #include <bonobo/Bonobo.h>
33 * This pulls the CORBA definitions for the "Accessibility::Accessible" server
35 #include <libspi/Accessibility.h>
38 * This pulls the definition of the hyperlink bonobo object
40 #include "hyperlink.h"
41 #include "accessible.h"
44 * Static function declarations
48 spi_hyperlink_class_init (SpiHyperlinkClass *klass);
50 spi_hyperlink_init (SpiHyperlink *hyperlink);
52 spi_hyperlink_finalize (GObject *obj);
54 impl_getURI (PortableServer_Servant _servant,
55 const CORBA_long i, CORBA_Environment * ev);
57 impl__get_n_anchors (PortableServer_Servant _servant,
58 CORBA_Environment * ev);
60 impl__get_startIndex (PortableServer_Servant _servant,
61 CORBA_Environment * ev);
63 impl__get_endIndex (PortableServer_Servant _servant,
64 CORBA_Environment * ev);
65 static Accessibility_Accessible
66 impl_getObject (PortableServer_Servant _servant,
68 CORBA_Environment * ev);
70 impl_isValid (PortableServer_Servant _servant,
71 CORBA_Environment * ev);
73 static GObjectClass *parent_class;
76 BONOBO_TYPE_FUNC_FULL (SpiHyperlink,
77 Accessibility_Hyperlink,
82 spi_hyperlink_class_init (SpiHyperlinkClass *klass)
84 GObjectClass * object_class = (GObjectClass *) klass;
85 POA_Accessibility_Hyperlink__epv *epv = &klass->epv;
86 parent_class = g_type_class_peek_parent (klass);
88 object_class->finalize = spi_hyperlink_finalize;
90 /* Initialize epv table */
92 epv->_get_nAnchors = impl__get_n_anchors;
93 epv->getURI = impl_getURI;
94 epv->_get_startIndex = impl__get_startIndex;
95 epv->_get_endIndex = impl__get_endIndex;
96 epv->getObject = impl_getObject;
97 epv->isValid = impl_isValid;
101 spi_hyperlink_init (SpiHyperlink *hyperlink)
106 spi_hyperlink_finalize (GObject *obj)
108 SpiHyperlink *hyperlink = SPI_HYPERLINK(obj);
109 g_object_unref (hyperlink->hyperlink);
110 hyperlink->hyperlink = NULL;
111 parent_class->finalize (obj);
115 spi_hyperlink_new (AtkHyperlink *hyperlink)
117 SpiHyperlink *new_hyperlink =
118 SPI_HYPERLINK(g_object_new (SPI_HYPERLINK_TYPE, NULL));
119 g_object_ref (hyperlink);
120 new_hyperlink->hyperlink = hyperlink;
121 return new_hyperlink;
127 impl__get_n_anchors (PortableServer_Servant _servant,
128 CORBA_Environment * ev)
130 SpiHyperlink *link = SPI_HYPERLINK(bonobo_object_from_servant(_servant));
131 return (CORBA_short) atk_hyperlink_get_n_anchors (ATK_HYPERLINK(link->hyperlink));
137 impl__get_startIndex (PortableServer_Servant _servant,
138 CORBA_Environment * ev)
140 SpiHyperlink *link = SPI_HYPERLINK(bonobo_object_from_servant(_servant));
141 return (CORBA_long) atk_hyperlink_get_start_index (ATK_HYPERLINK(link->hyperlink));
147 impl__get_endIndex (PortableServer_Servant _servant,
148 CORBA_Environment * ev)
150 SpiHyperlink *link = SPI_HYPERLINK(bonobo_object_from_servant(_servant));
151 return (CORBA_long) atk_hyperlink_get_end_index (ATK_HYPERLINK(link->hyperlink));
157 impl_getURI (PortableServer_Servant _servant,
158 const CORBA_long i, CORBA_Environment * ev)
160 SpiHyperlink *link = SPI_HYPERLINK(bonobo_object_from_servant(_servant));
163 uri = atk_hyperlink_get_uri (ATK_HYPERLINK(link->hyperlink), (gint) i);
166 rv = CORBA_string_dup (uri);
170 rv = CORBA_string_dup ("");
176 static Accessibility_Accessible
177 impl_getObject (PortableServer_Servant _servant,
179 CORBA_Environment * ev)
181 SpiHyperlink *link = SPI_HYPERLINK(bonobo_object_from_servant(_servant));
182 AtkObject *atk_object;
183 Accessibility_Accessible rv;
184 atk_object = atk_hyperlink_get_object (ATK_HYPERLINK(link->hyperlink), (gint) i);
185 rv = bonobo_object_corba_objref (BONOBO_OBJECT(spi_accessible_new(atk_object)));
192 impl_isValid (PortableServer_Servant _servant,
193 CORBA_Environment * ev)
195 SpiHyperlink *link = SPI_HYPERLINK(bonobo_object_from_servant(_servant));
196 return (CORBA_boolean) atk_hyperlink_is_valid (ATK_HYPERLINK(link->hyperlink));