2 * AT-SPI - Assistive Technology Service Provider Interface
3 * (Gnome Accessibility Project; http://developer.gnome.org/projects/gap)
5 * Copyright 2001, 2002 Sun Microsystems Inc.,
6 * Copyright 2001, 2002 Ximian, Inc.
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either
11 * version 2 of the License, or (at your option) any later version.
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Library General Public License for more details.
18 * You should have received a copy of the GNU Library General Public
19 * License along with this library; if not, write to the
20 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
21 * Boston, MA 02111-1307, USA.
24 /* component.c : bonobo wrapper for accessible component implementation */
28 #include <libspi/action.h>
29 #include <atk/atkaction.h>
32 * Static function declarations
36 spi_action_class_init (SpiActionClass *klass);
38 spi_action_init (SpiAction *action);
40 impl__get_nActions(PortableServer_Servant servant,
41 CORBA_Environment * ev);
43 impl_getDescription (PortableServer_Servant servant,
44 const CORBA_long index,
45 CORBA_Environment * ev);
47 impl_doAction (PortableServer_Servant servant,
48 const CORBA_long index, CORBA_Environment * ev);
50 impl_getName (PortableServer_Servant servant,
51 const CORBA_long index,
52 CORBA_Environment * ev);
54 impl_getKeyBinding (PortableServer_Servant servant,
55 const CORBA_long index,
56 CORBA_Environment * ev);
58 BONOBO_TYPE_FUNC_FULL (SpiAction,
64 spi_action_class_init (SpiActionClass *klass)
66 POA_Accessibility_Action__epv *epv = &klass->epv;
68 /* Initialize epv table */
70 epv->_get_nActions = impl__get_nActions;
71 epv->doAction = impl_doAction;
72 epv->getDescription = impl_getDescription;
73 epv->getName = impl_getName;
74 epv->getKeyBinding = impl_getKeyBinding;
78 spi_action_init (SpiAction *action)
83 spi_action_interface_new (AtkObject *obj)
85 SpiAction *new_action = g_object_new (SPI_ACTION_TYPE, NULL);
87 spi_base_construct (SPI_BASE (new_action), G_OBJECT(obj));
93 get_action_from_servant (PortableServer_Servant servant)
95 SpiBase *object = SPI_BASE (bonobo_object_from_servant (servant));
96 g_return_val_if_fail (object != NULL, NULL);
97 /* the convention of making hyperlinks actionable breaks the assertion below */
98 /* g_return_val_if_fail (ATK_IS_OBJECT(object->gobj), NULL); */
99 return ATK_ACTION (object->gobj);
103 impl__get_nActions (PortableServer_Servant servant,
104 CORBA_Environment *ev)
106 AtkAction *action = get_action_from_servant (servant);
107 return atk_action_get_n_actions (action);
111 impl_doAction (PortableServer_Servant servant,
112 const CORBA_long index, CORBA_Environment * ev)
114 AtkAction *action = get_action_from_servant (servant);
115 return atk_action_do_action (action, (gint) index);
119 impl_getDescription (PortableServer_Servant servant,
120 const CORBA_long index,
121 CORBA_Environment * ev)
123 AtkAction *action = get_action_from_servant (servant);
126 rv = atk_action_get_description (action, index);
128 return CORBA_string_dup (rv);
130 return CORBA_string_dup ("");
134 impl_getName (PortableServer_Servant servant,
135 const CORBA_long index,
136 CORBA_Environment * ev)
138 AtkAction *action = get_action_from_servant (servant);
141 rv = atk_action_get_name (action, index);
143 return CORBA_string_dup (rv);
145 return CORBA_string_dup ("");
149 impl_getKeyBinding (PortableServer_Servant servant,
150 const CORBA_long index,
151 CORBA_Environment * ev)
153 AtkAction *action = get_action_from_servant (servant);
156 rv = atk_action_get_keybinding (action, index);
158 return CORBA_string_dup (rv);
160 return CORBA_string_dup ("");