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 g_return_val_if_fail (ATK_IS_OBJECT(object->gobj), NULL);
98 return ATK_ACTION (object->gobj);
102 impl__get_nActions (PortableServer_Servant servant,
103 CORBA_Environment *ev)
105 AtkAction *action = get_action_from_servant (servant);
106 return atk_action_get_n_actions (action);
110 impl_doAction (PortableServer_Servant servant,
111 const CORBA_long index, CORBA_Environment * ev)
113 AtkAction *action = get_action_from_servant (servant);
114 return atk_action_do_action (action, (gint) index);
118 impl_getDescription (PortableServer_Servant servant,
119 const CORBA_long index,
120 CORBA_Environment * ev)
122 AtkAction *action = get_action_from_servant (servant);
125 rv = atk_action_get_description (action, index);
127 return CORBA_string_dup (rv);
129 return CORBA_string_dup ("");
133 impl_getName (PortableServer_Servant servant,
134 const CORBA_long index,
135 CORBA_Environment * ev)
137 AtkAction *action = get_action_from_servant (servant);
140 rv = atk_action_get_name (action, index);
142 return CORBA_string_dup (rv);
144 return CORBA_string_dup ("");
148 impl_getKeyBinding (PortableServer_Servant servant,
149 const CORBA_long index,
150 CORBA_Environment * ev)
152 AtkAction *action = get_action_from_servant (servant);
155 rv = atk_action_get_keybinding (action, index);
157 return CORBA_string_dup (rv);
159 return CORBA_string_dup ("");