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