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 the child index.
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 the index in the selection set. (e.g. the
98 * ith selection as opposed to the ith child).
100 * Gets a reference to the accessible object representing the specified
101 * selected child of the object.
102 * Note: callers should not rely on %NULL or on a zero value for
103 * indication of whether AtkSelectionIface is implemented, they should
104 * use type checking/interface checking macros or the
105 * atk_get_accessible_value() convenience method.
107 * Returns: an #AtkObject representing the selected accessible , or %NULL
108 * if @selection does not implement this interface.
111 atk_selection_ref_selection (AtkSelection *obj,
114 AtkSelectionIface *iface;
116 g_return_val_if_fail (obj != NULL, NULL);
117 g_return_val_if_fail (ATK_IS_SELECTION (obj), NULL);
119 iface = ATK_SELECTION_GET_IFACE (obj);
121 if (iface->ref_selection)
122 return (iface->ref_selection) (obj, i);
128 * atk_selection_get_selection_count:
129 * @selection: a #GObject instance that implements AtkSelectionIface
131 * Gets the number of accessible children currently selected.
132 * Note: callers should not rely on %NULL or on a zero value for
133 * indication of whether AtkSelectionIface is implemented, they should
134 * use type checking/interface checking macros or the
135 * atk_get_accessible_value() convenience method.
137 * Returns: a gint representing the number of items selected, or 0
138 * if @selection does not implement this interface.
141 atk_selection_get_selection_count (AtkSelection *obj)
143 AtkSelectionIface *iface;
145 g_return_val_if_fail (obj != NULL, 0);
146 g_return_val_if_fail (ATK_IS_SELECTION (obj), 0);
148 iface = ATK_SELECTION_GET_IFACE (obj);
150 if (iface->get_selection_count)
151 return (iface->get_selection_count) (obj);
157 * atk_selection_is_child_selected:
158 * @selection: a #GObject instance that implements AtkSelectionIface
159 * @i: a #gint specifying the child index.
161 * Determines if the current child of this object is selected
162 * Note: callers should not rely on %NULL or on a zero value for
163 * indication of whether AtkSelectionIface is implemented, they should
164 * use type checking/interface checking macros or the
165 * atk_get_accessible_value() convenience method.
167 * Returns: a gboolean representing the specified child is selected, or 0
168 * if @selection does not implement this interface.
171 atk_selection_is_child_selected (AtkSelection *obj,
174 AtkSelectionIface *iface;
176 g_return_val_if_fail (obj != NULL, FALSE);
177 g_return_val_if_fail (ATK_IS_SELECTION (obj), FALSE);
179 iface = ATK_SELECTION_GET_IFACE (obj);
181 if (iface->is_child_selected)
182 return (iface->is_child_selected) (obj, i);
188 * atk_selection_remove_selection:
189 * @selection: a #GObject instance that implements AtkSelectionIface
190 * @i: a #gint specifying the index in the selection set. (e.g. the
191 * ith selection as opposed to the ith child).
193 * Removes the specified child of the object from the object's selection.
195 * Returns: TRUE if success, FALSE otherwise.
198 atk_selection_remove_selection (AtkSelection *obj,
201 AtkSelectionIface *iface;
203 g_return_val_if_fail (obj != NULL, FALSE);
204 g_return_val_if_fail (ATK_IS_SELECTION (obj), FALSE);
206 iface = ATK_SELECTION_GET_IFACE (obj);
208 if (iface->remove_selection)
209 return (iface->remove_selection) (obj, i);
215 * atk_selection_select_all_selection:
216 * @selection: a #GObject instance that implements AtkSelectionIface
218 * Causes every child of the object to be selected if the object
219 * supports multiple selections.
221 * Returns: TRUE if success, FALSE otherwise.
224 atk_selection_select_all_selection (AtkSelection *obj)
226 AtkSelectionIface *iface;
228 g_return_val_if_fail (obj != NULL, FALSE);
229 g_return_val_if_fail (ATK_IS_SELECTION (obj), FALSE);
231 iface = ATK_SELECTION_GET_IFACE (obj);
233 if (iface->select_all_selection)
234 return (iface->select_all_selection) (obj);