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),
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
51 atk_selection_add_selection (AtkSelection *obj,
54 AtkSelectionIface *iface;
56 g_return_if_fail (obj != NULL);
57 g_return_if_fail (ATK_IS_SELECTION (obj));
59 iface = ATK_SELECTION_GET_IFACE (obj);
61 if (iface->add_selection)
62 (iface->add_selection) (obj, i);
66 * atk_selection_clear_selection:
67 * @selection: a GObject instance that implements AtkSelectionIface
69 * Clears the selection in the object so that no children in the object
73 atk_selection_clear_selection (AtkSelection *obj)
75 AtkSelectionIface *iface;
77 g_return_if_fail (obj != NULL);
78 g_return_if_fail (ATK_IS_SELECTION (obj));
80 iface = ATK_SELECTION_GET_IFACE (obj);
82 if (iface->clear_selection)
83 (iface->clear_selection) (obj);
87 * atk_selection_ref_selection:
88 * @selection: a GObject instance that implements AtkSelectionIface
89 * @i: a #gint specifying an accessible child of @selection
91 * Gets a reference to the accessible object representing the specified
92 * selected * child of the object.
93 * Note: callers should not rely on %NULL or on a zero value for
94 * indication of whether AtkSelectionIface is implemented, they should
95 * use type checking/interface checking macros or the
96 * atk_get_accessible_value() convenience method.
98 * Returns: a AtkObject* representing the selected accessible , or NULL
99 * if value does not implement this interface.
102 atk_selection_ref_selection (AtkSelection *obj,
105 AtkSelectionIface *iface;
107 g_return_val_if_fail (obj != NULL, NULL);
108 g_return_val_if_fail (ATK_IS_SELECTION (obj), NULL);
110 iface = ATK_SELECTION_GET_IFACE (obj);
112 if (iface->ref_selection)
113 return (iface->ref_selection) (obj, i);
119 * atk_selection_get_selection_count:
120 * @selection: a GObject instance that implements AtkSelectionIface
122 * Gets the number of accessible children currently selected.
123 * Note: callers should not rely on %NULL or on a zero value for
124 * indication of whether AtkSelectionIface is implemented, they should
125 * use type checking/interface checking macros or the
126 * atk_get_accessible_value() convenience method.
128 * Returns: a gint representing the number of items selected, or 0
129 * if value does not implement this interface.
132 atk_selection_get_selection_count (AtkSelection *obj)
134 AtkSelectionIface *iface;
136 g_return_val_if_fail (obj != NULL, 0);
137 g_return_val_if_fail (ATK_IS_SELECTION (obj), 0);
139 iface = ATK_SELECTION_GET_IFACE (obj);
141 if (iface->get_selection_count)
142 return (iface->get_selection_count) (obj);
148 * atk_selection_is_child_selected:
149 * @selection: a GObject instance that implements AtkSelectionIface
150 * @i: a #gint specifying an accessible child of @selection
152 * Determines if the current child of this object is selected
153 * Note: callers should not rely on %NULL or on a zero value for
154 * indication of whether AtkSelectionIface is implemented, they should
155 * use type checking/interface checking macros or the
156 * atk_get_accessible_value() convenience method.
158 * Returns: a gboolean representing the specified child is selected, or 0
159 * if value does not implement this interface.
162 atk_selection_is_child_selected (AtkSelection *obj,
165 AtkSelectionIface *iface;
167 g_return_val_if_fail (obj != NULL, FALSE);
168 g_return_val_if_fail (ATK_IS_SELECTION (obj), FALSE);
170 iface = ATK_SELECTION_GET_IFACE (obj);
172 if (iface->is_child_selected)
173 return (iface->is_child_selected) (obj, i);
179 * atk_selection_remove_selection:
180 * @selection: a GObject instance that implements AtkSelectionIface
181 * @i: a #gint specifying an accessible child of @selection
183 * Removes the specified child of the object from the object's selection.
186 atk_selection_remove_selection (AtkSelection *obj,
189 AtkSelectionIface *iface;
191 g_return_if_fail (obj != NULL);
192 g_return_if_fail (ATK_IS_SELECTION (obj));
194 iface = ATK_SELECTION_GET_IFACE (obj);
196 if (iface->remove_selection)
197 (iface->remove_selection) (obj, i);
201 * atk_selection_select_all_selection:
202 * @selection: a GObject instance that implements AtkSelectionIface
204 * Causes every child of the object to be selected if the object
205 * supports multiple selections.
208 atk_selection_select_all_selection (AtkSelection *obj)
210 AtkSelectionIface *iface;
212 g_return_if_fail (obj != NULL);
213 g_return_if_fail (ATK_IS_SELECTION (obj));
215 iface = ATK_SELECTION_GET_IFACE (obj);
217 if (iface->select_all_selection)
218 (iface->select_all_selection) (obj);