alternative to assert
[gtkD.git] / src / atk / Selection.d
blobd76a0e32b7025ad33420102f70db47f9dcf03088
1 /*
2 * This file is part of duit.
4 * duit is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation; either version 2.1 of the License, or
7 * (at your option) any later version.
9 * duit 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
12 * GNU Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public License
15 * along with duit; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 // generated automatically - do not change
20 // find conversion definition on APILookup.txt
21 // implement new conversion functionalities on the wrap.utils pakage
24 * Conversion parameters:
25 * inFile = AtkSelection.html
26 * outPack = atk
27 * outFile = Selection
28 * strct = AtkSelection
29 * realStrct=
30 * ctorStrct=
31 * clss = Selection
32 * interf =
33 * class Code: No
34 * interface Code: No
35 * template for:
36 * extend =
37 * implements:
38 * prefixes:
39 * - atk_selection_
40 * omit structs:
41 * omit prefixes:
42 * omit code:
43 * imports:
44 * structWrap:
45 * local aliases:
48 module atk.Selection;
50 private import atk.atktypes;
52 private import lib.atk;
55 /**
56 * Description
57 * AtkSelection should be implemented by UI components with children which
58 * are exposed by atk_object_ref_child and atk_object_get_n_children, if
59 * the use of the parent UI component ordinarily involves selection of one
60 * or more of the objects corresponding to those AtkObject children - for
61 * example, selectable lists.
62 * Note that other types of "selection" (for instance text selection) are
63 * accomplished a other ATK interfaces - AtkSelection is limited to the
64 * selection/deselection of children.
66 public class Selection
69 /** the main Gtk struct */
70 protected AtkSelection* atkSelection;
73 public AtkSelection* getSelectionStruct()
75 return atkSelection;
79 /** the main Gtk struct as a void* */
80 protected void* getStruct()
82 return cast(void*)atkSelection;
85 /**
86 * Sets our main struct and passes it to the parent class
88 public this (AtkSelection* atkSelection)
90 this.atkSelection = atkSelection;
93 /**
96 // imports for the signal processing
97 private import gobject.Signals;
98 private import gdk.gdktypes;
99 int[char[]] connectedSignals;
101 void delegate(Selection)[] onSelectionChangedListeners;
102 void addOnSelectionChanged(void delegate(Selection) dlg)
104 if ( !("selection-changed" in connectedSignals) )
106 Signals.connectData(
107 getStruct(),
108 "selection-changed",
109 cast(GCallback)&callBackSelectionChanged,
110 this,
111 null,
112 cast(ConnectFlags)0);
113 connectedSignals["selection-changed"] = 1;
115 onSelectionChangedListeners ~= dlg;
117 extern(C) static void callBackSelectionChanged(AtkSelection* atkselectionStruct, Selection selection)
119 bit consumed = false;
121 foreach ( void delegate(Selection) dlg ; selection.onSelectionChangedListeners )
123 dlg(selection);
126 return consumed;
132 * Adds the specified accessible child of the object to the
133 * object's selection.
134 * selection:
135 * a GObject instance that implements AtkSelectionIface
136 * i:
137 * a gint specifying the child index.
138 * Returns:
139 * TRUE if success, FALSE otherwise.
141 public int addSelection(int i)
143 // gboolean atk_selection_add_selection (AtkSelection *selection, gint i);
144 return atk_selection_add_selection(atkSelection, i);
148 * Clears the selection in the object so that no children in the object
149 * are selected.
150 * selection:
151 * a GObject instance that implements AtkSelectionIface
152 * Returns:
153 * TRUE if success, FALSE otherwise.
155 public int clearSelection()
157 // gboolean atk_selection_clear_selection (AtkSelection *selection);
158 return atk_selection_clear_selection(atkSelection);
162 * Gets a reference to the accessible object representing the specified
163 * selected child of the object.
164 * Note: callers should not rely on NULL or on a zero value for
165 * indication of whether AtkSelectionIface is implemented, they should
166 * use type checking/interface checking macros or the
167 * atk_get_accessible_value() convenience method.
168 * selection:
169 * a GObject instance that implements AtkSelectionIface
170 * i:
171 * a gint specifying the index in the selection set. (e.g. the
172 * ith selection as opposed to the ith child).
173 * Returns:
174 * an AtkObject representing the selected accessible , or NULL
175 * if selection does not implement this interface.
177 public AtkObject* refSelection(int i)
179 // AtkObject* atk_selection_ref_selection (AtkSelection *selection, gint i);
180 return atk_selection_ref_selection(atkSelection, i);
184 * Gets the number of accessible children currently selected.
185 * Note: callers should not rely on NULL or on a zero value for
186 * indication of whether AtkSelectionIface is implemented, they should
187 * use type checking/interface checking macros or the
188 * atk_get_accessible_value() convenience method.
189 * selection:
190 * a GObject instance that implements AtkSelectionIface
191 * Returns:
192 * a gint representing the number of items selected, or 0
193 * if selection does not implement this interface.
195 public int getSelectionCount()
197 // gint atk_selection_get_selection_count (AtkSelection *selection);
198 return atk_selection_get_selection_count(atkSelection);
202 * Determines if the current child of this object is selected
203 * Note: callers should not rely on NULL or on a zero value for
204 * indication of whether AtkSelectionIface is implemented, they should
205 * use type checking/interface checking macros or the
206 * atk_get_accessible_value() convenience method.
207 * selection:
208 * a GObject instance that implements AtkSelectionIface
209 * i:
210 * a gint specifying the child index.
211 * Returns:
212 * a gboolean representing the specified child is selected, or 0
213 * if selection does not implement this interface.
215 public int isChildSelected(int i)
217 // gboolean atk_selection_is_child_selected (AtkSelection *selection, gint i);
218 return atk_selection_is_child_selected(atkSelection, i);
222 * Removes the specified child of the object from the object's selection.
223 * selection:
224 * a GObject instance that implements AtkSelectionIface
225 * i:
226 * a gint specifying the index in the selection set. (e.g. the
227 * ith selection as opposed to the ith child).
228 * Returns:
229 * TRUE if success, FALSE otherwise.
231 public int removeSelection(int i)
233 // gboolean atk_selection_remove_selection (AtkSelection *selection, gint i);
234 return atk_selection_remove_selection(atkSelection, i);
238 * Causes every child of the object to be selected if the object
239 * supports multiple selections.
240 * selection:
241 * a GObject instance that implements AtkSelectionIface
242 * Returns:
243 * TRUE if success, FALSE otherwise.
244 * Signal Details
245 * The "selection-changed" signal
246 * void user_function (AtkSelection *atkselection,
247 * gpointer user_data) : Run last
248 * The "selection-changed" signal is emitted by an object which implements
249 * AtkSelection interface when the selection changes.
250 * atkselection:
251 * the object which received the signal.
252 * user_data:
253 * user data set when the signal handler was connected.
254 * See Also
255 * AtkText
257 public int selectAllSelection()
259 // gboolean atk_selection_select_all_selection (AtkSelection *selection);
260 return atk_selection_select_all_selection(atkSelection);