2 * AT-SPI - Assistive Technology Service Provider Interface
3 * (Gnome Accessibility Project; http://developer.gnome.org/projects/gap)
5 * Copyright 2001, 2002 Sun Microsystems Inc.,
6 * Copyright 2001, 2002 Ximian, Inc.
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.
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.
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.
24 #include "atspi-private.h"
26 G_DEFINE_TYPE (AtspiHyperlink, atspi_hyperlink, ATSPI_TYPE_OBJECT)
29 atspi_hyperlink_init (AtspiHyperlink *hyperlink)
34 atspi_hyperlink_finalize (GObject *obj)
36 /*AtspiHyperlink *hyperlink = ATSPI_HYPERLINK (obj); */
38 /* TODO: Unref parent/children, etc. */
42 atspi_hyperlink_class_init (AtspiHyperlinkClass *klass)
44 GObjectClass *object_class = G_OBJECT_CLASS (klass);
46 object_class->finalize = atspi_hyperlink_finalize;
50 atspi_hyperlink_new (AtspiApplication *app, const gchar *path)
52 AtspiHyperlink *hyperlink;
54 hyperlink = g_object_new (ATSPI_TYPE_HYPERLINK, NULL);
55 g_return_val_if_fail (hyperlink != NULL, NULL);
57 hyperlink->parent.app = g_object_ref (app);
58 hyperlink->parent.path = g_strdup (path);
64 * atspi_hyperlink_get_n_anchors:
65 * @obj: a pointer to the #AtspiHyperlink object on which to operate.
67 * Get the total number of anchors which an #AtspiHyperlink implementor has.
68 * Though typical hyperlinks have only one anchor, client-side image maps and
69 * other hypertext objects may potentially activate or refer to multiple
70 * URIs. For each anchor there is a corresponding URI and object.
71 * see atspi_hyperlink_get_uri() and atspi_hyperlink_get_object().
73 * Returns: a #gint indicating the number of anchors in this hyperlink.
76 atspi_hyperlink_get_n_anchors (AtspiHyperlink *obj, GError **error)
80 g_return_val_if_fail (obj != NULL, -1);
82 _atspi_dbus_get_property (obj, atspi_interface_hyperlink, "NAnchors", error, "i", &retval);
88 * atspi_hyperlink_get_uri:
89 * @obj: a pointer to the #AtspiHyperlink implementor on which to operate.
90 * @i: a (zero-index) integer indicating which hyperlink anchor to query.
92 * Get the URI associated with a particular hyperlink anchor.
94 * Returns: a UTF-8 string giving the URI of the @ith hyperlink anchor.
97 atspi_hyperlink_get_uri (AtspiHyperlink *obj, int i, GError **error)
102 g_return_val_if_fail (obj != NULL, NULL);
104 _atspi_dbus_call (obj, atspi_interface_hyperlink, "GetURI", error, "i=>s", d_i, &retval);
110 * atspi_hyperlink_get_object:
111 * @obj: a pointer to the #AtspiHyperlink implementor on which to operate.
112 * @i: a (zero-index) long integer indicating which hyperlink anchor to query.
114 * Get the object associated with a particular hyperlink anchor, as an #Accessible.
116 * Returns: (transfer full): an #AtspiAccessible that represents the object
117 * associated with the @ith anchor of the specified #AtspiHyperlink.
120 atspi_hyperlink_get_object (AtspiHyperlink *obj, gint i, GError **error)
122 dbus_int32_t d_i = i;
125 g_return_val_if_fail (obj != NULL, NULL);
127 reply = _atspi_dbus_call_partial (obj, atspi_interface_hyperlink, "GetObject", error, "i", d_i);
129 return _atspi_dbus_return_accessible_from_message (reply);
133 * atspi_hyperlink_get_index_range:
134 * @obj: a pointer to the #AtspiHyperlink implementor on which to operate.
137 * Get the starting and ending character offsets of the text range associated with
138 * a #AtspiHyperlink, in its originating #AtspiHypertext.
141 atspi_hyperlink_get_index_range (AtspiHyperlink *obj, GError **error)
143 dbus_int32_t d_start_offset, d_end_offset;
144 AtspiRange *ret = g_new (AtspiRange, 1);
147 ret->start_offset = ret->end_offset = -1;
152 _atspi_dbus_call (obj, atspi_interface_hyperlink, "GetIndexRange", error, "=>ii", &d_start_offset, &d_end_offset);
154 ret->start_offset = d_start_offset;
155 ret->end_offset = d_end_offset;
160 * atspi_hyperlink_get_start_index:
161 * @obj: a pointer to the #AtspiHyperlink implementor on which to operate.
164 * Get the starting character offset of the text range associated with
165 * a #AtspiHyperlink, in its originating #AtspiHypertext.
168 atspi_hyperlink_get_start_index (AtspiHyperlink *obj, GError **error)
170 dbus_int32_t d_start_offset = -1;
175 _atspi_dbus_get_property (obj, atspi_interface_hyperlink, "StartIndex",
176 error, "i", &d_start_offset);
178 return d_start_offset;
181 * atspi_hyperlink_get_end_index:
182 * @obj: a pointer to the #AtspiHyperlink implementor on which to operate.
185 * Get the ending character offset of the text range associated with
186 * a #AtspiHyperlink, in its originating #AtspiHypertext.
189 atspi_hyperlink_get_end_index (AtspiHyperlink *obj, GError **error)
191 dbus_int32_t d_end_offset = -1;
196 _atspi_dbus_get_property (obj, atspi_interface_hyperlink, "EndIndex", error,
204 * atspi_hyperlink_is_valid:
205 * @obj: a pointer to the #AtspiHyperlink on which to operate.
207 * Tell whether an #AtspiHyperlink object is still valid with respect to its
208 * originating hypertext object.
210 * Returns: #TRUE of the specified #AtspiHyperlink is still valid with respect
211 * to its originating #AtspiHypertext object, #FALSE otherwise.
214 atspi_hyperlink_is_valid (AtspiHyperlink *obj, GError **error)
218 g_return_val_if_fail (obj != NULL, FALSE);
220 _atspi_dbus_call (obj, atspi_interface_hyperlink, "IsValid", error, "=>b", &retval);