1 /* ATK - Accessibility Toolkit
2 * Copyright 2006 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.
21 #include "atkhyperlinkimpl.h"
24 * SECTION:atkhyperlinkimpl
25 * @Short_description: An interface from which the AtkHyperlink
26 * associated with an AtkObject may be obtained.
27 * @Title:AtkHyperlinImpl
29 * AtkHyperlinkImpl allows AtkObjects to refer to their associated
30 * AtkHyperlink instance, if one exists. AtkHyperlinkImpl differs
31 * from AtkHyperlink in that AtkHyperlinkImpl is an interface, whereas
32 * AtkHyperlink is a object type. The AtkHyperlinkImpl interface
33 * allows a client to query an AtkObject for the availability of an
34 * associated AtkHyperlink instance, and obtain that instance. It is
35 * thus particularly useful in cases where embedded content or inline
36 * content within a text object is present, since the embedding text
37 * object implements AtkHypertext and the inline/embedded objects are
38 * exposed as children which implement AtkHyperlinkImpl, in addition
39 * to their being obtainable via AtkHypertext:getLink followed by
40 * AtkHyperlink:getObject.
42 * The AtkHyperlinkImpl interface should be supported by objects
43 * exposed within the hierarchy as children of an AtkHypertext
44 * container which correspond to "links" or embedded content within
45 * the text. HTML anchors are not, for instance, normally exposed
46 * this way, but embedded images and components which appear inline in
47 * the content of a text object are. The AtkHyperlinkIface interface
48 * allows a means of determining which children are hyperlinks in this
49 * sense of the word, and for obtaining their corresponding
50 * AtkHyperlink object, from which the embedding range, URI, etc. can
53 * To some extent this interface exists because, for historical
54 * reasons, AtkHyperlink was defined as an object type, not an
55 * interface. Thus, in order to interact with AtkObjects via
56 * AtkHyperlink semantics, a new interface was required.
60 atk_hyperlink_impl_get_type (void)
62 static GType type = 0;
67 sizeof (AtkHyperlinkImplIface),
69 (GBaseFinalizeFunc) NULL,
73 type = g_type_register_static (G_TYPE_INTERFACE, "AtkHyperlinkImpl", &tinfo, 0);
80 * atk_hyperlink_impl_get_hyperlink:
81 * @impl: a #GObject instance that implements AtkHyperlinkImplIface
83 * Gets the hyperlink associated with this object.
85 * Returns: (transfer full): an AtkHyperlink object which points to this
86 * implementing AtkObject.
91 atk_hyperlink_impl_get_hyperlink (AtkHyperlinkImpl *impl)
93 AtkHyperlinkImplIface *iface;
95 g_return_val_if_fail (impl != NULL, NULL);
96 g_return_val_if_fail (ATK_IS_HYPERLINK_IMPL (impl), NULL);
98 iface = ATK_HYPERLINK_IMPL_GET_IFACE (impl);
100 if (iface->get_hyperlink)
102 return (iface->get_hyperlink) (impl);