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.
23 /* component.c : bonobo wrapper for accessible component implementation */
27 #include <libspi/action.h>
28 #include <atk/atkaction.h>
31 * Static function declarations
35 spi_action_class_init (SpiActionClass *klass);
37 spi_action_init (SpiAction *action);
39 impl__get_nActions(PortableServer_Servant servant,
40 CORBA_Environment * ev);
42 impl_getDescription (PortableServer_Servant servant,
43 const CORBA_long index,
44 CORBA_Environment * ev);
46 impl_doAction (PortableServer_Servant servant,
47 const CORBA_long index, CORBA_Environment * ev);
49 impl_getName (PortableServer_Servant servant,
50 const CORBA_long index,
51 CORBA_Environment * ev);
53 impl_getKeyBinding (PortableServer_Servant servant,
54 const CORBA_long index,
55 CORBA_Environment * ev);
57 BONOBO_TYPE_FUNC_FULL (SpiAction,
63 spi_action_class_init (SpiActionClass *klass)
65 POA_Accessibility_Action__epv *epv = &klass->epv;
67 /* Initialize epv table */
69 epv->_get_nActions = impl__get_nActions;
70 epv->doAction = impl_doAction;
71 epv->getDescription = impl_getDescription;
72 epv->getName = impl_getName;
73 epv->getKeyBinding = impl_getKeyBinding;
77 spi_action_init (SpiAction *action)
82 spi_action_interface_new (AtkObject *obj)
84 SpiAction *new_action = g_object_new (SPI_ACTION_TYPE, NULL);
86 spi_base_construct (SPI_BASE (new_action), G_OBJECT(obj));
92 get_action_from_servant (PortableServer_Servant servant)
94 SpiBase *object = SPI_BASE (bonobo_object_from_servant (servant));
95 g_return_val_if_fail (object != NULL, NULL);
96 g_return_val_if_fail (ATK_IS_OBJECT(object->gobj), NULL);
97 return ATK_ACTION (object->gobj);
101 impl__get_nActions (PortableServer_Servant servant,
102 CORBA_Environment *ev)
104 AtkAction *action = get_action_from_servant (servant);
105 return (CORBA_long) atk_action_get_n_actions (action);
109 impl_doAction (PortableServer_Servant servant,
110 const CORBA_long index, CORBA_Environment * ev)
112 AtkAction *action = get_action_from_servant (servant);
113 return (CORBA_boolean) atk_action_do_action (action, (gint) index);
117 impl_getDescription (PortableServer_Servant servant,
118 const CORBA_long index,
119 CORBA_Environment * ev)
121 AtkAction *action = get_action_from_servant (servant);
124 rv = atk_action_get_description (action, (gint) index);
126 return CORBA_string_dup (rv);
128 return CORBA_string_dup ("");
132 impl_getName (PortableServer_Servant servant,
133 const CORBA_long index,
134 CORBA_Environment * ev)
136 AtkAction *action = get_action_from_servant (servant);
139 rv = atk_action_get_name (action, (gint) index);
141 return CORBA_string_dup (rv);
143 return CORBA_string_dup ("");
147 impl_getKeyBinding (PortableServer_Servant servant,
148 const CORBA_long index,
149 CORBA_Environment * ev)
151 AtkAction *action = get_action_from_servant (servant);
154 rv = atk_action_get_keybinding (action, (gint) index);
156 return CORBA_string_dup (rv);
158 return CORBA_string_dup ("");