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 of the EditableText bonobo object
40 #include "editabletext.h"
43 * Static function declarations
47 editable_text_class_init (EditableTextClass *klass);
49 editable_text_init (EditableText *editable);
51 editable_text_finalize (GObject *obj);
53 impl_setAttributes (PortableServer_Servant _servant,
54 const CORBA_char * attributes,
55 const CORBA_long startPos,
56 const CORBA_long endPos,
57 CORBA_Environment * ev);
59 impl_setTextContents (PortableServer_Servant _servant,
60 const CORBA_char * newContents,
61 CORBA_Environment * ev);
63 impl_insertText (PortableServer_Servant _servant,
64 const CORBA_long position,
65 const CORBA_char * text,
66 const CORBA_long length,
67 CORBA_Environment * ev);
69 impl_copyText (PortableServer_Servant _servant,
70 const CORBA_long startPos, const CORBA_long endPos,
71 CORBA_Environment * ev);
73 impl_cutText (PortableServer_Servant _servant,
74 const CORBA_long startPos, const CORBA_long endPos,
75 CORBA_Environment * ev);
77 impl_deleteText (PortableServer_Servant _servant,
78 const CORBA_long startPos, const CORBA_long endPos,
79 CORBA_Environment * ev);
81 impl_pasteText (PortableServer_Servant _servant,
82 const CORBA_long position, CORBA_Environment * ev);
84 static GObjectClass *parent_class;
87 editable_text_get_type (void)
89 static GType type = 0;
92 static const GTypeInfo tinfo = {
93 sizeof (EditableTextClass),
95 (GBaseFinalizeFunc) NULL,
96 (GClassInitFunc) editable_text_class_init,
97 (GClassFinalizeFunc) NULL,
98 NULL, /* class data */
99 sizeof (EditableText),
101 (GInstanceInitFunc) editable_text_init,
102 NULL /* value table */
106 * Bonobo_type_unique auto-generates a load of
107 * CORBA structures for us. All derived types must
108 * use bonobo_type_unique.
110 type = bonobo_type_unique (
112 POA_Accessibility_EditableText__init,
114 G_STRUCT_OFFSET (EditableTextClass, epv),
116 "AccessibleEditableText");
123 editable_text_class_init (EditableTextClass *klass)
125 GObjectClass * object_class = (GObjectClass *) klass;
126 POA_Accessibility_EditableText__epv *epv = &klass->epv;
127 parent_class = g_type_class_peek_parent (klass);
129 object_class->finalize = editable_text_finalize;
132 /* Initialize epv table */
134 epv->setAttributes = impl_setAttributes;
135 epv->setTextContents = impl_setTextContents;
136 epv->insertText = impl_insertText;
137 epv->copyText = impl_copyText;
138 epv->cutText = impl_cutText;
139 epv->deleteText = impl_deleteText;
140 epv->pasteText = impl_pasteText;
144 editable_text_init (EditableText *editable)
149 editable_text_finalize (GObject *obj)
151 EditableText *editable = EDITABLE_TEXT(obj);
152 editable->atk_editable_text = NULL;
153 parent_class->finalize (obj);
157 editable_text_new (AtkEditableText *editable)
159 EditableText *new_editable =
160 EDITABLE_TEXT(g_object_new (EDITABLE_TEXT_TYPE, NULL));
161 new_editable->atk_editable_text = editable;
168 impl_setAttributes (PortableServer_Servant _servant,
169 const CORBA_char * attributes,
170 const CORBA_long startPos,
171 const CORBA_long endPos,
172 CORBA_Environment * ev)
174 g_print ("setRunAttributes not implemented.\n");
180 impl_setTextContents (PortableServer_Servant _servant,
181 const CORBA_char * newContents,
182 CORBA_Environment * ev)
184 EditableText *editable = EDITABLE_TEXT(bonobo_object_from_servant (_servant));
185 atk_editable_text_set_text_contents (editable->atk_editable_text,
186 (gchar *) newContents);
192 impl_insertText (PortableServer_Servant _servant,
193 const CORBA_long position,
194 const CORBA_char * text,
195 const CORBA_long length,
196 CORBA_Environment * ev)
198 EditableText *editable = EDITABLE_TEXT (bonobo_object_from_servant(_servant));
199 atk_editable_text_insert_text (editable->atk_editable_text,
207 impl_copyText (PortableServer_Servant _servant,
208 const CORBA_long startPos, const CORBA_long endPos,
209 CORBA_Environment * ev)
211 EditableText *editable = EDITABLE_TEXT (bonobo_object_from_servant(_servant));
212 atk_editable_text_copy_text (editable->atk_editable_text,
213 (gint) startPos, (gint) endPos);
219 impl_cutText (PortableServer_Servant _servant,
220 const CORBA_long startPos, const CORBA_long endPos,
221 CORBA_Environment * ev)
223 EditableText *editable = EDITABLE_TEXT (bonobo_object_from_servant(_servant));
224 atk_editable_text_cut_text (editable->atk_editable_text,
225 (gint) startPos, (gint) endPos);
232 impl_deleteText (PortableServer_Servant _servant,
233 const CORBA_long startPos, const CORBA_long endPos,
234 CORBA_Environment * ev)
236 EditableText *editable = EDITABLE_TEXT (bonobo_object_from_servant(_servant));
237 atk_editable_text_delete_text (editable->atk_editable_text,
238 (gint) startPos, (gint) endPos);
243 impl_pasteText (PortableServer_Servant _servant,
244 const CORBA_long position, CORBA_Environment * ev)
246 EditableText *editable = EDITABLE_TEXT (bonobo_object_from_servant(_servant));
247 atk_editable_text_paste_text (editable->atk_editable_text, position);