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 * Returns: a UTF-8 string indicating the POSIX-style LC_MESSAGES
155 * locale of the document content as a whole, or NULL if
156 * the document content does not specify a locale.
158 G_CONST_RETURN gchar
*
159 atk_document_get_locale (AtkDocument
*document
)
161 AtkDocumentIface
*iface
;
163 g_return_val_if_fail (ATK_IS_DOCUMENT (document
), NULL
);
165 iface
= ATK_DOCUMENT_GET_IFACE (document
);
167 if (iface
->get_document_locale
)
169 return (iface
->get_document_locale
) (document
);
179 * atk_document_get_attributes:
180 * @document: a #GObject instance that implements AtkDocumentIface
182 * Gets an AtkAttributeSet which describes document-wide
183 * attributes as name-value pairs.
187 * Returns: (transfer none): An AtkAttributeSet containing the explicitly
188 * set name-value-pair attributes associated with this document
192 atk_document_get_attributes (AtkDocument
*document
)
194 AtkDocumentIface
*iface
;
196 g_return_val_if_fail (ATK_IS_DOCUMENT (document
), NULL
);
198 iface
= ATK_DOCUMENT_GET_IFACE (document
);
200 if (iface
->get_document_attributes
)
202 return (iface
->get_document_attributes
) (document
);
211 * atk_document_get_attribute_value:
212 * @document: a #GObject instance that implements AtkDocumentIface
213 * @attribute_name: a character string representing the name of the attribute
214 * whose value is being queried.
218 * Returns: a string value associated with the named attribute for this
219 * document, or NULL if a value for #attribute_name has not been specified
222 G_CONST_RETURN gchar
*
223 atk_document_get_attribute_value (AtkDocument
*document
,
224 const gchar
*attribute_name
)
226 AtkDocumentIface
*iface
;
228 g_return_val_if_fail (ATK_IS_DOCUMENT (document
), NULL
);
230 iface
= ATK_DOCUMENT_GET_IFACE (document
);
232 if (iface
->get_document_attribute_value
)
234 return (iface
->get_document_attribute_value
) (document
, attribute_name
);
243 * atk_document_set_attribute_value:
244 * @document: a #GObject instance that implements AtkDocumentIface
245 * @attribute_name: a character string representing the name of the attribute
246 * whose value is being set.
247 * @attribute_value: a string value to be associated with #attribute_name.
251 * Returns: TRUE if #value is successfully associated with #attribute_name
252 * for this document, FALSE otherwise (e.g. if the document does not
253 * allow the attribute to be modified).
256 atk_document_set_attribute_value (AtkDocument
*document
,
257 const gchar
*attribute_name
,
258 const gchar
*attribute_value
)
260 AtkDocumentIface
*iface
;
262 g_return_val_if_fail (ATK_IS_DOCUMENT (document
), FALSE
);
264 iface
= ATK_DOCUMENT_GET_IFACE (document
);
266 if (iface
->set_document_attribute
)
268 return (iface
->set_document_attribute
) (document
, attribute_name
, attribute_value
);