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), obj);
92 get_action_from_servant (PortableServer_Servant servant)
94 SpiBase *object = SPI_BASE (servant);
95 return ATK_ACTION (object->atko);
99 impl__get_nActions (PortableServer_Servant servant,
100 CORBA_Environment *ev)
102 AtkAction *action = get_action_from_servant (servant);
103 return (CORBA_long) atk_action_get_n_actions (action);
107 impl_doAction (PortableServer_Servant servant,
108 const CORBA_long index, CORBA_Environment * ev)
110 AtkAction *action = get_action_from_servant (servant);
111 return (CORBA_boolean) atk_action_do_action (action, (gint) index);
115 impl_getDescription (PortableServer_Servant servant,
116 const CORBA_long index,
117 CORBA_Environment * ev)
119 AtkAction *action = get_action_from_servant (servant);
122 rv = atk_action_get_description (action, (gint) index);
124 return CORBA_string_dup (rv);
126 return CORBA_string_dup ("");
130 impl_getName (PortableServer_Servant servant,
131 const CORBA_long index,
132 CORBA_Environment * ev)
134 AtkAction *action = get_action_from_servant (servant);
137 rv = atk_action_get_name (action, (gint) index);
139 return CORBA_string_dup (rv);
141 return CORBA_string_dup ("");
145 impl_getKeyBinding (PortableServer_Servant servant,
146 const CORBA_long index,
147 CORBA_Environment * ev)
149 AtkAction *action = get_action_from_servant (servant);
152 rv = atk_action_get_keybinding (action, (gint) index);
154 return CORBA_string_dup (rv);
156 return CORBA_string_dup ("");