Added better gtk-doc comments.
[platform/upstream/atk.git] / atk / atkhyperlink.c
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 "atkhyperlink.h"
21
22
23 static void atk_hyperlink_class_init (AtkHyperlinkClass *klass);
24 static void atk_hyperlink_init       (AtkHyperlink      *link,
25                                       AtkHyperlinkClass *klass);
26
27 static void atk_hyperlink_action_iface_init (AtkActionIface *iface);
28
29 static gpointer  parent_class = NULL;
30
31 GType
32 atk_hyperlink_get_type (void)
33 {
34   static GType type = 0;
35
36   if (!type)
37     {
38       static const GTypeInfo typeInfo =
39       {
40         sizeof (AtkHyperlinkClass),
41         (GBaseInitFunc) NULL,
42         (GBaseFinalizeFunc) NULL,
43         (GClassInitFunc) atk_hyperlink_class_init,
44         (GClassFinalizeFunc) NULL,
45         NULL,
46         sizeof (AtkObject),
47         0,
48         (GInstanceInitFunc) atk_hyperlink_init,
49       } ;
50
51       static const GInterfaceInfo action_info =
52       {
53         (GInterfaceInitFunc) atk_hyperlink_action_iface_init,
54         (GInterfaceFinalizeFunc) NULL,
55         NULL
56       };
57
58       type = g_type_register_static (G_TYPE_OBJECT, "AtkHyperlink", &typeInfo, 0) ;
59       g_type_add_interface_static (type, ATK_TYPE_ACTION, &action_info);
60     }
61   return type;
62 }
63
64 static void
65 atk_hyperlink_class_init (AtkHyperlinkClass *klass)
66 {
67   parent_class = g_type_class_ref (G_TYPE_OBJECT);
68
69 }
70
71 static void
72 atk_hyperlink_init  (AtkHyperlink        *link,
73                      AtkHyperlinkClass   *klass)
74 {
75 }
76
77 /**
78  *atk_hyperlink_get_anchor:
79  *@link: an #AtkHyperlink
80  *@i:
81  *
82  * Returns an object which represents the link anchor, as appropriate for 
83  * that link.
84  *
85  * Returns: an object which represents the link anchor, as appropriate for 
86  * that link.
87  **/
88 GObject*
89 atk_hyperlink_get_anchor (AtkHyperlink *link,
90                           gint         i)
91 {
92   AtkHyperlinkClass *klass;
93
94   g_return_val_if_fail ((link != NULL), NULL);
95   g_return_val_if_fail (ATK_IS_HYPERLINK (link), NULL);
96
97   klass = ATK_HYPERLINK_GET_CLASS (link);
98   g_return_val_if_fail ((klass->get_anchor != NULL), NULL);
99
100   return (klass->get_anchor) (link, i);
101 }
102
103 /**
104  *atk_hyperlink_get_object:
105  *@link: an #AtkHyperlink
106  *@i:
107  *
108  * Returns an object which represents the link action, as appropriate for 
109  * that link.
110  *
111  * Returns: an object which represents the link action, as appropriate for 
112  * that link.
113  **/
114 GObject*
115 atk_hyperlink_get_object (AtkHyperlink *link,
116                           gint         i)
117 {
118   AtkHyperlinkClass *klass;
119
120   g_return_val_if_fail ((link != NULL), NULL);
121   g_return_val_if_fail (ATK_IS_HYPERLINK (link), NULL);
122
123   klass = ATK_HYPERLINK_GET_CLASS (link);
124   g_return_val_if_fail ((klass->get_object != NULL), NULL);
125
126   return (klass->get_object) (link, i);
127 }
128
129 /**
130  *atk_hyperlink_get_end_actions:
131  *@link: an #AtkHyperlink
132  *
133  *
134  **/
135 //gint
136 //atk_hyperlink_get_end_actions (AtkHyperlink *link)
137 //{
138 //  AtkHyperlinkClass *klass;
139 //
140 //  g_return_val_if_fail ((link != NULL), 0);
141 //  g_return_val_if_fail (ATK_IS_HYPERLINK (link), 0);
142 //
143 //  klass = ATK_HYPERLINK_GET_CLASS (link);
144 //  g_return_val_if_fail ((klass->get_end_index != NULL), 0);
145 //
146 //  return (klass->get_end_index) (link);
147 //}
148
149 /**
150  *atk_hyperlink_get_end_index:
151  *@link: an #AtkHyperlink
152  *
153  * Gets the index with the hypertext document at which this link ends
154  *
155  *Returns: the index with the hypertext document at which this link ends
156  **/
157 gint
158 atk_hyperlink_get_end_index (AtkHyperlink *link)
159 {
160   AtkHyperlinkClass *klass;
161
162   g_return_val_if_fail ((link != NULL), 0);
163   g_return_val_if_fail (ATK_IS_HYPERLINK (link), 0);
164
165   klass = ATK_HYPERLINK_GET_CLASS (link);
166   g_return_val_if_fail ((klass->get_end_index != NULL), 0);
167
168   return (klass->get_end_index) (link);
169 }
170
171 /**
172  *atk_hyperlink_get_start_index:
173  *@link: an #AtkHyperlink
174  *
175  * Gets the index with the hypertext document at which this link begins 
176  *
177  *Returns: the index with the hypertext document at which this link begins
178  **/
179 gint
180 atk_hyperlink_get_start_index (AtkHyperlink *link)
181 {
182   AtkHyperlinkClass *klass;
183
184   g_return_val_if_fail ((link != NULL), 0);
185   g_return_val_if_fail (ATK_IS_HYPERLINK (link), 0);
186
187   klass = ATK_HYPERLINK_GET_CLASS (link);
188   g_return_val_if_fail ((klass->get_start_index != NULL), 0);
189
190   return (klass->get_end_index) (link);
191 }
192
193 /**
194  *atk_hyperlink_is_valid:
195  *@link: an #AtkHyperlink
196  *
197  * Since the document a link is associated with may have changed, this 
198  * method returns whether or not this link is still valid (with respect
199  * to the document is references)
200  *
201  *Returns: whether or not this link is still valid.
202  **/
203 gboolean
204 atk_hyperlink_get_valid (AtkHyperlink *link)
205 {
206   AtkHyperlinkClass *klass;
207
208   g_return_val_if_fail ((link != NULL), FALSE);
209   g_return_val_if_fail (ATK_IS_HYPERLINK (link), FALSE);
210
211   klass = ATK_HYPERLINK_GET_CLASS (link);
212   g_return_val_if_fail ((klass->is_valid != NULL), FALSE);
213
214   return (klass->is_valid) (link);
215 }
216
217 static void atk_hyperlink_action_iface_init (AtkActionIface *iface)
218 {
219   /*
220    * We do nothing here
221    *
222    * When we come to derive a class from AtkHyperlink we will provide an
223    * implementation of the AtkAction interface. 
224    *
225    * This depends on being able to override an interface in a derived class
226    * which currently (March 2001) is not implemented but will be in GTK+ 2.0.
227    */
228 }