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 (ATK_IS_SELECTION (obj), FALSE);
60 iface = ATK_SELECTION_GET_IFACE (obj);
62 if (iface->add_selection)
63 return (iface->add_selection) (obj, i);
69 * atk_selection_clear_selection:
70 * @selection: a #GObject instance that implements AtkSelectionIface
72 * Clears the selection in the object so that no children in the object
75 * Returns: TRUE if success, FALSE otherwise.
78 atk_selection_clear_selection (AtkSelection *obj)
80 AtkSelectionIface *iface;
82 g_return_val_if_fail (ATK_IS_SELECTION (obj), FALSE);
84 iface = ATK_SELECTION_GET_IFACE (obj);
86 if (iface->clear_selection)
87 return (iface->clear_selection) (obj);
93 * atk_selection_ref_selection:
94 * @selection: a #GObject instance that implements AtkSelectionIface
95 * @i: a #gint specifying the index in the selection set. (e.g. the
96 * ith selection as opposed to the ith child).
98 * Gets a reference to the accessible object representing the specified
99 * selected child of the object.
100 * Note: callers should not rely on %NULL or on a zero value for
101 * indication of whether AtkSelectionIface is implemented, they should
102 * use type checking/interface checking macros or the
103 * atk_get_accessible_value() convenience method.
105 * Returns: an #AtkObject representing the selected accessible , or %NULL
106 * if @selection does not implement this interface.
109 atk_selection_ref_selection (AtkSelection *obj,
112 AtkSelectionIface *iface;
114 g_return_val_if_fail (ATK_IS_SELECTION (obj), NULL);
116 iface = ATK_SELECTION_GET_IFACE (obj);
118 if (iface->ref_selection)
119 return (iface->ref_selection) (obj, i);
125 * atk_selection_get_selection_count:
126 * @selection: a #GObject instance that implements AtkSelectionIface
128 * Gets the number of accessible children currently selected.
129 * Note: callers should not rely on %NULL or on a zero value for
130 * indication of whether AtkSelectionIface is implemented, they should
131 * use type checking/interface checking macros or the
132 * atk_get_accessible_value() convenience method.
134 * Returns: a gint representing the number of items selected, or 0
135 * if @selection does not implement this interface.
138 atk_selection_get_selection_count (AtkSelection *obj)
140 AtkSelectionIface *iface;
142 g_return_val_if_fail (ATK_IS_SELECTION (obj), 0);
144 iface = ATK_SELECTION_GET_IFACE (obj);
146 if (iface->get_selection_count)
147 return (iface->get_selection_count) (obj);
153 * atk_selection_is_child_selected:
154 * @selection: a #GObject instance that implements AtkSelectionIface
155 * @i: a #gint specifying the child index.
157 * Determines if the current child of this object is selected
158 * Note: callers should not rely on %NULL or on a zero value for
159 * indication of whether AtkSelectionIface is implemented, they should
160 * use type checking/interface checking macros or the
161 * atk_get_accessible_value() convenience method.
163 * Returns: a gboolean representing the specified child is selected, or 0
164 * if @selection does not implement this interface.
167 atk_selection_is_child_selected (AtkSelection *obj,
170 AtkSelectionIface *iface;
172 g_return_val_if_fail (ATK_IS_SELECTION (obj), FALSE);
174 iface = ATK_SELECTION_GET_IFACE (obj);
176 if (iface->is_child_selected)
177 return (iface->is_child_selected) (obj, i);
183 * atk_selection_remove_selection:
184 * @selection: a #GObject instance that implements AtkSelectionIface
185 * @i: a #gint specifying the index in the selection set. (e.g. the
186 * ith selection as opposed to the ith child).
188 * Removes the specified child of the object from the object's selection.
190 * Returns: TRUE if success, FALSE otherwise.
193 atk_selection_remove_selection (AtkSelection *obj,
196 AtkSelectionIface *iface;
198 g_return_val_if_fail (ATK_IS_SELECTION (obj), FALSE);
200 iface = ATK_SELECTION_GET_IFACE (obj);
202 if (iface->remove_selection)
203 return (iface->remove_selection) (obj, i);
209 * atk_selection_select_all_selection:
210 * @selection: a #GObject instance that implements AtkSelectionIface
212 * Causes every child of the object to be selected if the object
213 * supports multiple selections.
215 * Returns: TRUE if success, FALSE otherwise.
218 atk_selection_select_all_selection (AtkSelection *obj)
220 AtkSelectionIface *iface;
222 g_return_val_if_fail (ATK_IS_SELECTION (obj), FALSE);
224 iface = ATK_SELECTION_GET_IFACE (obj);
226 if (iface->select_all_selection)
227 return (iface->select_all_selection) (obj);