1 /* ATK - The Accessibility Toolkit for GTK+
2 * Copyright 2001, 2002, 2003 Sun Microsystems Inc.
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library 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 * Library General Public License for more details.
14 * You should have received a copy of the GNU Library 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 "atkhypertext.h"
27 static void atk_hypertext_base_init (AtkHypertextIface *class);
29 static guint atk_hypertext_signals[LAST_SIGNAL] = { 0 };
33 atk_hypertext_get_type (void)
35 static GType type = 0;
38 static const GTypeInfo tinfo =
40 sizeof (AtkHypertextIface),
41 (GBaseInitFunc) atk_hypertext_base_init,
42 (GBaseFinalizeFunc) NULL,
46 type = g_type_register_static (G_TYPE_INTERFACE, "AtkHypertext", &tinfo, 0);
53 atk_hypertext_base_init (AtkHypertextIface *class)
55 static gboolean initialized = FALSE;
59 atk_hypertext_signals[LINK_SELECTED] =
60 g_signal_new ("link_selected",
63 G_STRUCT_OFFSET (AtkHypertextIface, link_selected),
64 (GSignalAccumulator) NULL, NULL,
65 g_cclosure_marshal_VOID__INT,
74 * atk_hypertext_get_link:
75 * @hypertext: an #AtkHypertext
76 * @link_index: an integer specifying the desired link
78 * Gets the link in this hypertext document at index
81 * Returns: the link in this hypertext document at
85 atk_hypertext_get_link (AtkHypertext *hypertext,
88 AtkHypertextIface *iface;
90 g_return_val_if_fail (ATK_IS_HYPERTEXT (hypertext), NULL);
95 iface = ATK_HYPERTEXT_GET_IFACE (hypertext);
98 return (*(iface->get_link)) (hypertext, link_index);
104 * atk_hypertext_get_n_links:
105 * @hypertext: an #AtkHypertext
107 * Gets the number of links within this hypertext document.
109 * Returns: the number of links within this hypertext document
112 atk_hypertext_get_n_links (AtkHypertext *hypertext)
114 AtkHypertextIface *iface;
116 g_return_val_if_fail (ATK_IS_HYPERTEXT (hypertext), 0);
118 iface = ATK_HYPERTEXT_GET_IFACE (hypertext);
120 if (iface->get_n_links)
121 return (*(iface->get_n_links)) (hypertext);
127 * atk_hypertext_get_link_index:
128 * @hypertext: an #AtkHypertext
129 * @char_index: a character index
131 * Gets the index into the array of hyperlinks that is associated with
132 * the character specified by @char_index.
134 * Returns: an index into the array of hyperlinks in @hypertext,
135 * or -1 if there is no hyperlink associated with this character.
138 atk_hypertext_get_link_index (AtkHypertext *hypertext,
141 AtkHypertextIface *iface;
143 g_return_val_if_fail (ATK_IS_HYPERTEXT (hypertext), -1);
148 iface = ATK_HYPERTEXT_GET_IFACE (hypertext);
150 if (iface->get_link_index)
151 return (*(iface->get_link_index)) (hypertext, char_index);