1 | /* ATK - Accessibility Toolkit |
---|
2 | * Copyright 2001 Sun Microsystems Inc. |
---|
3 | * |
---|
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. |
---|
8 | * |
---|
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. |
---|
13 | * |
---|
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. |
---|
18 | */ |
---|
19 | |
---|
20 | #include "atkdocument.h" |
---|
21 | |
---|
22 | GType |
---|
23 | atk_document_get_type (void) |
---|
24 | { |
---|
25 | static GType type = 0; |
---|
26 | |
---|
27 | if (!type) { |
---|
28 | static const GTypeInfo tinfo = |
---|
29 | { |
---|
30 | sizeof (AtkDocumentIface), |
---|
31 | (GBaseInitFunc) NULL, |
---|
32 | (GBaseFinalizeFunc) NULL, |
---|
33 | |
---|
34 | }; |
---|
35 | |
---|
36 | type = g_type_register_static (G_TYPE_INTERFACE, "AtkDocument", &tinfo, 0); |
---|
37 | } |
---|
38 | |
---|
39 | return type; |
---|
40 | } |
---|
41 | |
---|
42 | /** |
---|
43 | * atk_document_get_document_type: |
---|
44 | * @document: a #GObject instance that implements AtkDocumentIface |
---|
45 | * |
---|
46 | * Gets a string indicating the document type. |
---|
47 | * |
---|
48 | * Returns: a string indicating the document type |
---|
49 | **/ |
---|
50 | G_CONST_RETURN gchar* |
---|
51 | atk_document_get_document_type (AtkDocument *document) |
---|
52 | { |
---|
53 | AtkDocumentIface *iface; |
---|
54 | |
---|
55 | g_return_val_if_fail (ATK_IS_DOCUMENT (document), NULL); |
---|
56 | |
---|
57 | iface = ATK_DOCUMENT_GET_IFACE (document); |
---|
58 | |
---|
59 | if (iface->get_document_type) |
---|
60 | { |
---|
61 | return (iface->get_document_type) (document); |
---|
62 | } |
---|
63 | else |
---|
64 | { |
---|
65 | return NULL; |
---|
66 | } |
---|
67 | } |
---|
68 | |
---|
69 | /** |
---|
70 | * atk_document_get_document: |
---|
71 | * @document: a #GObject instance that implements AtkDocumentIface |
---|
72 | * |
---|
73 | * Gets a %gpointer that points to an instance of the DOM. It is |
---|
74 | * up to the caller to check atk_document_get_type to determine |
---|
75 | * how to cast this pointer. |
---|
76 | * |
---|
77 | * Returns: a %gpointer that points to an instance of the DOM. |
---|
78 | **/ |
---|
79 | gpointer |
---|
80 | atk_document_get_document (AtkDocument *document) |
---|
81 | { |
---|
82 | AtkDocumentIface *iface; |
---|
83 | |
---|
84 | g_return_val_if_fail (ATK_IS_DOCUMENT (document), NULL); |
---|
85 | |
---|
86 | iface = ATK_DOCUMENT_GET_IFACE (document); |
---|
87 | |
---|
88 | if (iface->get_document) |
---|
89 | { |
---|
90 | return (iface->get_document) (document); |
---|
91 | } |
---|
92 | else |
---|
93 | { |
---|
94 | return NULL; |
---|
95 | } |
---|
96 | } |
---|
97 | |
---|