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 "atkhyperlink.h"
23 static void atk_hyperlink_class_init (AtkHyperlinkClass *klass);
24 static void atk_hyperlink_init (AtkHyperlink *link,
25 AtkHyperlinkClass *klass);
27 static void atk_hyperlink_action_iface_init (AtkActionIface *iface);
29 static gpointer parent_class = NULL;
32 atk_hyperlink_get_type (void)
34 static GType type = 0;
38 static const GTypeInfo typeInfo =
40 sizeof (AtkHyperlinkClass),
42 (GBaseFinalizeFunc) NULL,
43 (GClassInitFunc) atk_hyperlink_class_init,
44 (GClassFinalizeFunc) NULL,
48 (GInstanceInitFunc) atk_hyperlink_init,
51 static const GInterfaceInfo action_info =
53 (GInterfaceInitFunc) atk_hyperlink_action_iface_init,
54 (GInterfaceFinalizeFunc) NULL,
58 type = g_type_register_static (G_TYPE_OBJECT, "AtkHyperlink", &typeInfo, 0) ;
59 g_type_add_interface_static (type, ATK_TYPE_ACTION, &action_info);
65 atk_hyperlink_class_init (AtkHyperlinkClass *klass)
67 parent_class = g_type_class_ref (G_TYPE_OBJECT);
72 atk_hyperlink_init (AtkHyperlink *link,
73 AtkHyperlinkClass *klass)
78 atk_hyperlink_get_anchor (AtkHyperlink *link,
81 AtkHyperlinkClass *klass;
83 g_return_val_if_fail ((link != NULL), NULL);
84 g_return_val_if_fail (ATK_IS_HYPERLINK (link), NULL);
86 klass = ATK_HYPERLINK_GET_CLASS (link);
87 g_return_val_if_fail ((klass->get_anchor != NULL), NULL);
89 return (klass->get_anchor) (link, i);
93 atk_hyperlink_get_object (AtkHyperlink *link,
96 AtkHyperlinkClass *klass;
98 g_return_val_if_fail ((link != NULL), NULL);
99 g_return_val_if_fail (ATK_IS_HYPERLINK (link), NULL);
101 klass = ATK_HYPERLINK_GET_CLASS (link);
102 g_return_val_if_fail ((klass->get_object != NULL), NULL);
104 return (klass->get_object) (link, i);
108 atk_hyperlink_get_end_index (AtkHyperlink *link)
110 AtkHyperlinkClass *klass;
112 g_return_val_if_fail ((link != NULL), 0);
113 g_return_val_if_fail (ATK_IS_HYPERLINK (link), 0);
115 klass = ATK_HYPERLINK_GET_CLASS (link);
116 g_return_val_if_fail ((klass->get_end_index != NULL), 0);
118 return (klass->get_end_index) (link);
122 atk_hyperlink_get_start_index (AtkHyperlink *link)
124 AtkHyperlinkClass *klass;
126 g_return_val_if_fail ((link != NULL), 0);
127 g_return_val_if_fail (ATK_IS_HYPERLINK (link), 0);
129 klass = ATK_HYPERLINK_GET_CLASS (link);
130 g_return_val_if_fail ((klass->get_start_index != NULL), 0);
132 return (klass->get_end_index) (link);
136 atk_hyperlink_get_is_valid (AtkHyperlink *link)
138 AtkHyperlinkClass *klass;
140 g_return_val_if_fail ((link != NULL), FALSE);
141 g_return_val_if_fail (ATK_IS_HYPERLINK (link), FALSE);
143 klass = ATK_HYPERLINK_GET_CLASS (link);
144 g_return_val_if_fail ((klass->is_valid != NULL), FALSE);
146 return (klass->is_valid) (link);
149 static void atk_hyperlink_action_iface_init (AtkActionIface *iface)
154 * When we come to derive a class from AtkHyperlink we will provide an
155 * implementation of the AtkAction interface.
157 * This depends on being able to override an interface in a derived class
158 * which currently (March 2001) is not implemented but will be in GTK+ 2.0.