Add atk-bridge
[platform/core/uifw/at-spi2-atk.git] / cspi / spi_hypertext.c
1 /*
2  * AT-SPI - Assistive Technology Service Provider Interface
3  * (Gnome Accessibility Project; http://developer.gnome.org/projects/gap)
4  *
5  * Copyright 2001, 2002 Sun Microsystems Inc.,
6  * Copyright 2001, 2002 Ximian, Inc.
7  *
8  * This library is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Library General Public
10  * License as published by the Free Software Foundation; either
11  * version 2 of the License, or (at your option) any later version.
12  *
13  * This library is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16  * Library General Public License for more details.
17  *
18  * You should have received a copy of the GNU Library General Public
19  * License along with this library; if not, write to the
20  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
21  * Boston, MA 02111-1307, USA.
22  */
23
24 #include <cspi/spi-private.h>
25
26 /**
27  * AccessibleHypertext_ref:
28  * @obj: a pointer to the #AccessibleHypertext object on which to operate.
29  *
30  * Increment the reference count for an #AccessibleHypertext object.
31  *       Since AccessibleHypertext is derived from AccessibleText,
32  *       this is the same as AccessibleText_unref().
33  **/
34 void
35 AccessibleHypertext_ref (AccessibleHypertext *obj)
36 {
37   cspi_object_ref (obj);
38 }
39
40 /**
41  * AccessibleHypertext_unref:
42  * @obj: a pointer to the #AccessibleHypertext object on which to operate.
43  *
44  * Decrement the reference count for an #AccessibleHypertext object.
45  *       Since AccessibleHypertext is derived from AccessibleText,
46  *       this is the same as AccessibleText_unref().
47  **/
48 void
49 AccessibleHypertext_unref (AccessibleHypertext *obj)
50 {
51   cspi_object_unref (obj);
52 }
53
54 /**
55  * AccessibleHypertext_getNLinks:
56  * @obj: a pointer to the #AccessibleHypertext implementor on which to operate.
57  *
58  * Get the total number of #AccessibleHyperlinks which an
59  *        #AccessibleHypertext implementor has.
60  *
61  * Returns: a #long indicating the number of #AccessibleHyperlinks
62  *        of the #AccessibleHypertext implementor, or -1 if
63  *        the number cannot be determined (for example, if the
64  *        #AccessibleHypertext object is so large that it is not
65  *        all currently in the memory cache).
66  **/
67 long
68 AccessibleHypertext_getNLinks (AccessibleHypertext *obj)
69 {
70   long retval;
71
72   cspi_return_val_if_fail (obj != NULL, FALSE);
73
74   retval =
75     Accessibility_Hypertext_getNLinks (CSPI_OBJREF (obj), cspi_ev ());
76
77   cspi_return_val_if_ev ("getNLinks", -1);
78
79   return retval;
80 }
81
82 /**
83  * AccessibleHypertext_getLink:
84  * @obj: a pointer to the #AccessibleHypertext implementor on which to operate.
85  * @linkIndex: a (zero-index) long integer indicating which hyperlink to query.
86  *
87  * Get the #AccessibleHyperlink object at a specified index.
88  *
89  * Returns: the #AccessibleHyperlink object specified by #linkIndex.
90  **/
91 AccessibleHyperlink *
92 AccessibleHypertext_getLink (AccessibleHypertext *obj,
93                              long int             linkIndex)
94 {
95   AccessibleHyperlink *retval;
96         
97   cspi_return_val_if_fail (obj != NULL, NULL);
98
99   retval = cspi_object_add (
100     Accessibility_Hypertext_getLink (CSPI_OBJREF (obj),
101                                      linkIndex,
102                                      cspi_ev ()));
103   
104   cspi_return_val_if_ev ("getLink", NULL); 
105
106   return retval;
107 }
108
109 /**
110  * AccessibleHypertext_getLinkIndex:
111  * @obj: a pointer to the #AccessibleHypertext implementor on which to operate.
112  * @characterOffset: an integer specifying the character offset to query.
113  *
114  * Get the index of the #AccessibleHyperlink object at a specified
115  *        character offset.
116  *
117  * Returns: the linkIndex of the #AccessibleHyperlink active at
118  *        character offset @characterOffset, or -1 if there is
119  *        no hyperlink at the specified character offset.
120  **/
121 long
122 AccessibleHypertext_getLinkIndex (AccessibleHypertext *obj,
123                                   long int             characterOffset)
124 {
125   long retval;
126
127   cspi_return_val_if_fail (obj != NULL, -1);
128
129   retval = 
130     Accessibility_Hypertext_getLinkIndex (CSPI_OBJREF (obj),
131                                           characterOffset,
132                                           cspi_ev ());
133
134   cspi_return_val_if_ev ("getLinkIndex", -1);
135
136   return retval;
137 }
138
139