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 for the BonoboObject (Gtk Type)
40 #include "component.h"
43 * Our parent Gtk object type
45 #define PARENT_TYPE BONOBO_OBJECT_TYPE
48 * A pointer to our parent object class
50 static GObjectClass *component_parent_class;
53 * Implemented GObject::finalize
56 accessibility_component_object_finalize (GObject *object)
58 Component *component = COMPONENT (object);
60 printf("accessible_component_object_finalize called\n");
61 component->atko = NULL;
63 printf("atko freed, calling parent finalize\n");
64 component_parent_class->finalize (object);
68 * CORBA Accessibility::Component::contains method implementation
71 impl_accessibility_component_contains (PortableServer_Servant servant,
74 CORBA_short coord_type,
75 CORBA_Environment *ev)
78 Component *component = COMPONENT (bonobo_object_from_servant (servant));
79 retval = atk_component_contains (ATK_COMPONENT (component->atko), (gint) x, (gint) y,
80 (AtkCoordType) coord_type);
81 fprintf (stderr, "Component contains() called: %s\n", retval ? "true" : "false" );
86 accessibility_component_class_init (ComponentClass *klass)
88 GObjectClass * object_class = (GObjectClass *) klass;
89 POA_Accessibility_Component__epv *epv = &klass->epv;
90 component_parent_class = g_type_class_peek_parent (klass);
92 object_class->finalize = accessibility_component_object_finalize;
94 epv->contains = impl_accessibility_component_contains;
98 accessibility_component_init (Component *component)
103 accessibility_component_get_type (void)
105 static GType type = 0;
108 static const GTypeInfo tinfo = {
109 sizeof (ComponentClass),
110 (GBaseInitFunc) NULL,
111 (GBaseFinalizeFunc) NULL,
112 (GClassInitFunc) accessibility_component_class_init,
113 (GClassFinalizeFunc) NULL,
114 NULL, /* class data */
117 (GInstanceInitFunc) accessibility_component_init,
118 NULL /* value table */
121 * Bonobo_type_unique auto-generates a load of
122 * CORBA structures for us. All derived types must
123 * use bonobo_type_unique.
125 type = bonobo_type_unique (
127 POA_Accessibility_Component__init,
129 G_STRUCT_OFFSET (ComponentClass, epv),
131 "AccessibleComponent");
138 component_interface_new (AtkObject *o)
141 COMPONENT (g_object_new (accessibility_component_get_type (), NULL));
142 /* don't increment AtkObject refcount, ref is held by containing Accessible instance */
143 retval->atko = ATK_OBJECT (o);