Add AT-SPI mapping for ATK_RELATION_NODE_PARENT_OF
[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   dbus_int32_t retval;
71
72   cspi_return_val_if_fail (obj != NULL, FALSE);
73
74   cspi_dbus_call (obj, spi_interface_hypertext, "getNLinks", NULL, "=>i", &retval);
75
76   cspi_return_val_if_ev ("getNLinks", -1);
77
78   return retval;
79 }
80
81 /**
82  * AccessibleHypertext_getLink:
83  * @obj: a pointer to the #AccessibleHypertext implementor on which to operate.
84  * @linkIndex: a (zero-index) long integer indicating which hyperlink to query.
85  *
86  * Get the #AccessibleHyperlink object at a specified index.
87  *
88  * Returns: the #AccessibleHyperlink object specified by #linkIndex.
89  **/
90 AccessibleHyperlink *
91 AccessibleHypertext_getLink (AccessibleHypertext *obj,
92                              long int             linkIndex)
93 {
94   dbus_int32_t d_linkIndex = linkIndex;
95   char *path;
96   AccessibleHyperlink *retval;
97         
98   cspi_return_val_if_fail (obj != NULL, NULL);
99
100   cspi_dbus_call (obj, spi_interface_hypertext, "getLink", NULL, "i=>o", d_linkIndex, &path);
101
102   cspi_return_val_if_ev ("getLink", NULL); 
103
104   retval = cspi_ref_related_accessible (obj, path);
105   g_free (path);
106   
107   return retval;
108 }
109
110 /**
111  * AccessibleHypertext_getLinkIndex:
112  * @obj: a pointer to the #AccessibleHypertext implementor on which to operate.
113  * @characterOffset: an integer specifying the character offset to query.
114  *
115  * Get the index of the #AccessibleHyperlink object at a specified
116  *        character offset.
117  *
118  * Returns: the linkIndex of the #AccessibleHyperlink active at
119  *        character offset @characterOffset, or -1 if there is
120  *        no hyperlink at the specified character offset.
121  **/
122 long
123 AccessibleHypertext_getLinkIndex (AccessibleHypertext *obj,
124                                   long int             characterOffset)
125 {
126   dbus_int32_t d_characterOffset = characterOffset;
127   dbus_int32_t retval;
128
129   cspi_return_val_if_fail (obj != NULL, -1);
130
131   cspi_dbus_call (obj, spi_interface_hypertext, "getLinkIndex", NULL, "i=>i", d_characterOffset, &retval);
132
133   cspi_return_val_if_ev ("getLinkIndex", -1);
134
135   return retval;
136 }
137
138