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 hypertext bonobo object
40 #include "hypertext.h"
43 * Static function declarations
47 hypertext_class_init (HypertextClass *klass);
49 hypertext_init (Hypertext *hypertext);
51 hypertext_finalize (GObject *obj);
53 impl__get_n_anchors (PortableServer_Servant _servant,
54 CORBA_Environment * ev);
56 impl__get_uri (PortableServer_Servant _servant,
57 CORBA_Environment * ev);
59 impl__get_startIndex (PortableServer_Servant _servant,
60 CORBA_Environment * ev);
62 impl__get_endIndex (PortableServer_Servant _servant,
63 CORBA_Environment * ev);
64 static Accessibility_Accessible
65 impl_getAnchor (PortableServer_Servant _servant,
67 CORBA_Environment * ev);
68 static Accessibility_Accessible
69 impl_getObject (PortableServer_Servant _servant,
71 CORBA_Environment * ev);
73 impl_getNLinks (PortableServer_Servant _servant,
74 CORBA_Environment * ev);
75 static Accessibility_Hyperlink
76 impl_getLink (PortableServer_Servant _servant,
77 const CORBA_long linkIndex,
78 CORBA_Environment * ev);
80 impl_getLinkIndex (PortableServer_Servant _servant,
81 const CORBA_long characterIndex,
82 CORBA_Environment * ev);
84 static GObjectClass *parent_class;
87 hypertext_get_type (void)
89 static GType type = 0;
92 static const GTypeInfo tinfo = {
93 sizeof (HypertextClass),
95 (GBaseFinalizeFunc) NULL,
96 (GClassInitFunc) hypertext_class_init,
97 (GClassFinalizeFunc) NULL,
98 NULL, /* class data */
101 (GInstanceInitFunc) hypertext_init,
102 NULL /* value table */
106 * Bonobo_type_unique auto-generates a load of
107 * CORBA structures for us. All derived types must
108 * use bonobo_type_unique.
110 type = bonobo_type_unique (
112 POA_Accessibility_Hypertext__init,
114 G_STRUCT_OFFSET (HypertextClass, epv),
116 "AccessibleHypertext");
123 hypertext_class_init (HypertextClass *klass)
125 GObjectClass * object_class = (GObjectClass *) klass;
126 POA_Accessibility_Hypertext__epv *epv = &klass->epv;
127 parent_class = g_type_class_peek_parent (klass);
129 object_class->finalize = hypertext_finalize;
131 /* Initialize epv table */
133 epv->getNLinks = impl_getNLinks;
134 epv->getLink = impl_getLink;
135 epv->getLinkIndex = impl_getLinkIndex;
139 hypertext_init (Hypertext *hypertext)
144 hypertext_finalize (GObject *obj)
146 Hypertext *hypertext = HYPERTEXT(obj);
147 g_object_unref (hypertext->atko);
148 hypertext->atko = NULL;
149 parent_class->finalize (obj);
153 hypertext_interface_new (AtkObject *obj)
155 Hypertext *new_hypertext =
156 HYPERTEXT(g_object_new (HYPERTEXT_TYPE, NULL));
157 new_hypertext->atko = obj;
159 return new_hypertext;
165 impl_getNLinks (PortableServer_Servant _servant,
166 CORBA_Environment * ev)
168 Hypertext *hypertext = HYPERTEXT(bonobo_object_from_servant(_servant));
170 atk_hypertext_get_n_links (ATK_HYPERTEXT(hypertext->atko));
175 static Accessibility_Hyperlink
176 impl_getLink (PortableServer_Servant _servant,
177 const CORBA_long linkIndex,
178 CORBA_Environment * ev)
181 Hypertext *hypertext = HYPERTEXT(bonobo_object_from_servant(_servant));
182 Accessibility_Hyperlink rv;
184 link = atk_hypertext_get_link (ATK_HYPERTEXT(hypertext->atko),
186 rv = bonobo_object_corba_objref (BONOBO_OBJECT(hyperlink_interface_new(ATK_OBJECT(link))));
193 impl_getLinkIndex (PortableServer_Servant _servant,
194 const CORBA_long characterIndex,
195 CORBA_Environment * ev)
197 Hypertext *hypertext = HYPERTEXT(bonobo_object_from_servant(_servant));
199 atk_hypertext_get_link_index (ATK_HYPERTEXT(hypertext->atko),
200 (gint) characterIndex);