2 * AT-SPI - Assistive Technology Service Provider Interface
3 * (Gnome Accessibility Project; https://wiki.gnome.org/Accessibility)
5 * Copyright (c) 2015 Samsung Electronics Co., Ltd.
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 #include <glib-object.h>
26 #include "my-atk-object.h"
27 #include "my-atk-document.h"
29 static void atk_document_interface_init (AtkDocumentIface *iface);
31 G_DEFINE_TYPE_WITH_CODE (MyAtkDocument,
34 G_IMPLEMENT_INTERFACE (ATK_TYPE_DOCUMENT,
35 atk_document_interface_init));
38 my_atk_set_document (AtkDocument *obj, gint page, gint page_num)
40 g_return_if_fail (MY_IS_ATK_DOCUMENT(obj));
41 MyAtkDocument *self = MY_ATK_DOCUMENT (obj);
44 self->current_page = page_num;
46 AtkAttribute *attr1, *attr2;
47 attr1 = g_malloc (sizeof (AtkAttribute));
48 attr1->name = g_strdup ("atspi1");
49 attr1->value = g_strdup ("test1");
51 attr2 = g_malloc (sizeof (AtkAttribute));
52 attr2->name = g_strdup ("atspi2");
53 attr2->value = g_strdup ("test2");
55 self->attributes = g_slist_append (NULL, attr1);
56 self->attributes = g_slist_append (self->attributes, attr2);
60 my_atk_document_init (MyAtkDocument *obj)
62 obj->disposed = FALSE;
64 obj->document_type = NULL;
66 obj->current_page = 0;
70 my_atk_document_get_document_attributes (AtkDocument *document)
72 MyAtkDocument *self = MY_ATK_DOCUMENT (document);
74 return self->attributes;
78 my_atk_document_get_document_attribute_value (AtkDocument *document, const gchar *value)
80 AtkAttributeSet *attr = my_atk_document_get_document_attributes (document);
81 GSList *cur_attr = (GSList *) attr;
85 at = (AtkAttribute *) cur_attr->data;
86 if (!g_strcmp0 (at->name, value)) {
89 cur_attr = cur_attr->next;
95 my_atk_document_set_document_attribute (AtkDocument *document, const gchar *attribute_name, const gchar *attribute_value)
101 my_atk_document_get_current_page_number (AtkDocument *document)
107 my_atk_document_get_page_count (AtkDocument *document)
113 my_atk_document_get_document_locale (AtkDocument *document)
116 return g_strdup("document_locale");
120 atk_document_interface_init(AtkDocumentIface *iface)
124 iface->get_document_locale = my_atk_document_get_document_locale;
125 iface->get_document_attributes = my_atk_document_get_document_attributes;
126 iface->get_document_attribute_value = my_atk_document_get_document_attribute_value;
127 iface->set_document_attribute = my_atk_document_set_document_attribute;
128 iface->get_current_page_number = my_atk_document_get_current_page_number;
129 iface->get_page_count = my_atk_document_get_page_count;
133 my_atk_document_initialize(AtkObject *obj, gpointer data)
138 my_atk_document_finalize(GObject *object)
143 my_atk_document_class_init(MyAtkDocumentClass *my_class)
145 AtkObjectClass *atk_class = ATK_OBJECT_CLASS(my_class);
146 GObjectClass *gobject_class = G_OBJECT_CLASS(my_class);
148 gobject_class->finalize = my_atk_document_finalize;
150 atk_class->initialize = my_atk_document_initialize;