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 "atkselection.h"
23 atk_selection_get_type ()
25 static GType type = 0;
30 sizeof (AtkSelectionIface),
32 (GBaseFinalizeFunc) NULL,
36 type = g_type_register_static (G_TYPE_INTERFACE, "AtkSelection", &tinfo, 0);
43 * atk_selection_add_selection:
44 * @selection: a #GObject instance that implements AtkSelectionIface
45 * @i: a #gint specifying an accessible child of @selection
47 * Adds the specified accessible child of the object to the
50 * Returns: TRUE if success, FALSE otherwise.
53 atk_selection_add_selection (AtkSelection *obj,
56 AtkSelectionIface *iface;
58 g_return_val_if_fail (obj != NULL, FALSE);
59 g_return_val_if_fail (ATK_IS_SELECTION (obj), FALSE);
61 iface = ATK_SELECTION_GET_IFACE (obj);
63 if (iface->add_selection)
64 return (iface->add_selection) (obj, i);
70 * atk_selection_clear_selection:
71 * @selection: a #GObject instance that implements AtkSelectionIface
73 * Clears the selection in the object so that no children in the object
76 * Returns: TRUE if success, FALSE otherwise.
79 atk_selection_clear_selection (AtkSelection *obj)
81 AtkSelectionIface *iface;
83 g_return_val_if_fail (obj != NULL, FALSE);
84 g_return_val_if_fail (ATK_IS_SELECTION (obj), FALSE);
86 iface = ATK_SELECTION_GET_IFACE (obj);
88 if (iface->clear_selection)
89 return (iface->clear_selection) (obj);
95 * atk_selection_ref_selection:
96 * @selection: a #GObject instance that implements AtkSelectionIface
97 * @i: a #gint specifying an accessible child of @selection
99 * Gets a reference to the accessible object representing the specified
100 * selected child of the object.
101 * Note: callers should not rely on %NULL or on a zero value for
102 * indication of whether AtkSelectionIface is implemented, they should
103 * use type checking/interface checking macros or the
104 * atk_get_accessible_value() convenience method.
106 * Returns: an #AtkObject representing the selected accessible , or %NULL
107 * if @selection does not implement this interface.
110 atk_selection_ref_selection (AtkSelection *obj,
113 AtkSelectionIface *iface;
115 g_return_val_if_fail (obj != NULL, NULL);
116 g_return_val_if_fail (ATK_IS_SELECTION (obj), NULL);
118 iface = ATK_SELECTION_GET_IFACE (obj);
120 if (iface->ref_selection)
121 return (iface->ref_selection) (obj, i);
127 * atk_selection_get_selection_count:
128 * @selection: a #GObject instance that implements AtkSelectionIface
130 * Gets the number of accessible children currently selected.
131 * Note: callers should not rely on %NULL or on a zero value for
132 * indication of whether AtkSelectionIface is implemented, they should
133 * use type checking/interface checking macros or the
134 * atk_get_accessible_value() convenience method.
136 * Returns: a gint representing the number of items selected, or 0
137 * if @selection does not implement this interface.
140 atk_selection_get_selection_count (AtkSelection *obj)
142 AtkSelectionIface *iface;
144 g_return_val_if_fail (obj != NULL, 0);
145 g_return_val_if_fail (ATK_IS_SELECTION (obj), 0);
147 iface = ATK_SELECTION_GET_IFACE (obj);
149 if (iface->get_selection_count)
150 return (iface->get_selection_count) (obj);
156 * atk_selection_is_child_selected:
157 * @selection: a #GObject instance that implements AtkSelectionIface
158 * @i: a #gint specifying an accessible child of @selection
160 * Determines if the current child of this object is selected
161 * Note: callers should not rely on %NULL or on a zero value for
162 * indication of whether AtkSelectionIface is implemented, they should
163 * use type checking/interface checking macros or the
164 * atk_get_accessible_value() convenience method.
166 * Returns: a gboolean representing the specified child is selected, or 0
167 * if @selection does not implement this interface.
170 atk_selection_is_child_selected (AtkSelection *obj,
173 AtkSelectionIface *iface;
175 g_return_val_if_fail (obj != NULL, FALSE);
176 g_return_val_if_fail (ATK_IS_SELECTION (obj), FALSE);
178 iface = ATK_SELECTION_GET_IFACE (obj);
180 if (iface->is_child_selected)
181 return (iface->is_child_selected) (obj, i);
187 * atk_selection_remove_selection:
188 * @selection: a #GObject instance that implements AtkSelectionIface
189 * @i: a #gint specifying an accessible child of @selection
191 * Removes the specified child of the object from the object's selection.
193 * Returns: TRUE if success, FALSE otherwise.
196 atk_selection_remove_selection (AtkSelection *obj,
199 AtkSelectionIface *iface;
201 g_return_val_if_fail (obj != NULL, FALSE);
202 g_return_val_if_fail (ATK_IS_SELECTION (obj), FALSE);
204 iface = ATK_SELECTION_GET_IFACE (obj);
206 if (iface->remove_selection)
207 return (iface->remove_selection) (obj, i);
213 * atk_selection_select_all_selection:
214 * @selection: a #GObject instance that implements AtkSelectionIface
216 * Causes every child of the object to be selected if the object
217 * supports multiple selections.
220 atk_selection_select_all_selection (AtkSelection *obj)
222 AtkSelectionIface *iface;
224 g_return_if_fail (obj != NULL);
225 g_return_if_fail (ATK_IS_SELECTION (obj));
227 iface = ATK_SELECTION_GET_IFACE (obj);
229 if (iface->select_all_selection)
230 (iface->select_all_selection) (obj);