1 /* ATK - Accessibility Toolkit
2 * Copyright 2001 Sun Microsystems Inc.
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the
16 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17 * Boston, MA 02111-1307, USA.
20 #include "atkdocument.h"
29 static void atk_document_base_init (AtkDocumentIface *class);
31 static guint atk_document_signals[LAST_SIGNAL] = {0};
34 atk_document_get_type (void)
36 static GType type = 0;
39 static const GTypeInfo tinfo =
41 sizeof (AtkDocumentIface),
42 (GBaseInitFunc) atk_document_base_init,
43 (GBaseFinalizeFunc) NULL,
47 type = g_type_register_static (G_TYPE_INTERFACE, "AtkDocument", &tinfo, 0);
54 atk_document_base_init (AtkDocumentIface *class)
56 static gboolean initialized = FALSE;
59 atk_document_signals[LOAD_COMPLETE] =
60 g_signal_new ("load_complete",
64 (GSignalAccumulator) NULL, NULL,
65 g_cclosure_marshal_VOID__VOID,
67 atk_document_signals[RELOAD] =
68 g_signal_new ("reload",
72 (GSignalAccumulator) NULL, NULL,
73 g_cclosure_marshal_VOID__VOID,
75 atk_document_signals[LOAD_STOPPED] =
76 g_signal_new ("load_stopped",
80 (GSignalAccumulator) NULL, NULL,
81 g_cclosure_marshal_VOID__VOID,
89 * atk_document_get_document_type:
90 * @document: a #GObject instance that implements AtkDocumentIface
92 * Gets a string indicating the document type.
94 * Returns: a string indicating the document type
97 atk_document_get_document_type (AtkDocument *document)
99 AtkDocumentIface *iface;
101 g_return_val_if_fail (ATK_IS_DOCUMENT (document), NULL);
103 iface = ATK_DOCUMENT_GET_IFACE (document);
105 if (iface->get_document_type)
107 return (iface->get_document_type) (document);
116 * atk_document_get_document:
117 * @document: a #GObject instance that implements AtkDocumentIface
119 * Gets a %gpointer that points to an instance of the DOM. It is
120 * up to the caller to check atk_document_get_type to determine
121 * how to cast this pointer.
123 * Returns: (transfer none): a %gpointer that points to an instance of the DOM.
126 atk_document_get_document (AtkDocument *document)
128 AtkDocumentIface *iface;
130 g_return_val_if_fail (ATK_IS_DOCUMENT (document), NULL);
132 iface = ATK_DOCUMENT_GET_IFACE (document);
134 if (iface->get_document)
136 return (iface->get_document) (document);
145 * atk_document_get_locale:
146 * @document: a #GObject instance that implements AtkDocumentIface
148 * Gets a UTF-8 string indicating the POSIX-style LC_MESSAGES locale
149 * of the content of this document instance. Individual
150 * text substrings or images within this document may have
151 * a different locale, see atk_text_get_attributes and
152 * atk_image_get_image_locale.
154 * Deprecated: This method is deprecated since ATK version
155 * 2.7.90. Please use atk_object_get_object_locale() instead.
157 * Returns: a UTF-8 string indicating the POSIX-style LC_MESSAGES
158 * locale of the document content as a whole, or NULL if
159 * the document content does not specify a locale.
160 * Virtual: get_document_locale
163 atk_document_get_locale (AtkDocument *document)
165 AtkDocumentIface *iface;
167 g_return_val_if_fail (ATK_IS_DOCUMENT (document), NULL);
169 iface = ATK_DOCUMENT_GET_IFACE (document);
171 if (iface->get_document_locale)
173 return (iface->get_document_locale) (document);
183 * atk_document_get_attributes:
184 * @document: a #GObject instance that implements AtkDocumentIface
186 * Gets an AtkAttributeSet which describes document-wide
187 * attributes as name-value pairs.
191 * Returns: (transfer none): An AtkAttributeSet containing the explicitly
192 * set name-value-pair attributes associated with this document
194 * Virtual: get_document_attributes
197 atk_document_get_attributes (AtkDocument *document)
199 AtkDocumentIface *iface;
201 g_return_val_if_fail (ATK_IS_DOCUMENT (document), NULL);
203 iface = ATK_DOCUMENT_GET_IFACE (document);
205 if (iface->get_document_attributes)
207 return (iface->get_document_attributes) (document);
216 * atk_document_get_attribute_value:
217 * @document: a #GObject instance that implements AtkDocumentIface
218 * @attribute_name: a character string representing the name of the attribute
219 * whose value is being queried.
223 * Returns: a string value associated with the named attribute for this
224 * document, or NULL if a value for #attribute_name has not been specified
226 * Virtual: get_document_attribute_value
229 atk_document_get_attribute_value (AtkDocument *document,
230 const gchar *attribute_name)
232 AtkDocumentIface *iface;
234 g_return_val_if_fail (ATK_IS_DOCUMENT (document), NULL);
236 iface = ATK_DOCUMENT_GET_IFACE (document);
238 if (iface->get_document_attribute_value)
240 return (iface->get_document_attribute_value) (document, attribute_name);
249 * atk_document_set_attribute_value:
250 * @document: a #GObject instance that implements AtkDocumentIface
251 * @attribute_name: a character string representing the name of the attribute
252 * whose value is being set.
253 * @attribute_value: a string value to be associated with #attribute_name.
257 * Returns: TRUE if #value is successfully associated with #attribute_name
258 * for this document, FALSE otherwise (e.g. if the document does not
259 * allow the attribute to be modified).
260 * Virtual: set_document_attribute
263 atk_document_set_attribute_value (AtkDocument *document,
264 const gchar *attribute_name,
265 const gchar *attribute_value)
267 AtkDocumentIface *iface;
269 g_return_val_if_fail (ATK_IS_DOCUMENT (document), FALSE);
271 iface = ATK_DOCUMENT_GET_IFACE (document);
273 if (iface->set_document_attribute)
275 return (iface->set_document_attribute) (document, attribute_name, attribute_value);