1 /* 2 * This file is part of gtkD. 3 * 4 * gtkD is free software; you can redistribute it and/or modify 5 * it under the terms of the GNU Lesser General Public License 6 * as published by the Free Software Foundation; either version 3 7 * of the License, or (at your option) any later version, with 8 * some exceptions, please read the COPYING file. 9 * 10 * gtkD is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU Lesser General Public License for more details. 14 * 15 * You should have received a copy of the GNU Lesser General Public License 16 * along with gtkD; if not, write to the Free Software 17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA 18 */ 19 20 // generated automatically - do not change 21 // find conversion definition on APILookup.txt 22 // implement new conversion functionalities on the wrap.utils pakage 23 24 /* 25 * Conversion parameters: 26 * inFile = AtkSelection.html 27 * outPack = atk 28 * outFile = Selection 29 * strct = AtkSelection 30 * realStrct= 31 * ctorStrct= 32 * clss = Selection 33 * interf = 34 * class Code: No 35 * interface Code: No 36 * template for: 37 * extend = 38 * implements: 39 * prefixes: 40 * - atk_selection_ 41 * omit structs: 42 * omit prefixes: 43 * omit code: 44 * omit signals: 45 * imports: 46 * - atk.ObjectAtk 47 * structWrap: 48 * - AtkObject* -> ObjectAtk 49 * module aliases: 50 * local aliases: 51 * overrides: 52 */ 53 54 module atk.Selection; 55 56 public import gtkc.atktypes; 57 58 private import gtkc.atk; 59 private import glib.ConstructionException; 60 private import gobject.ObjectG; 61 62 private import gobject.Signals; 63 public import gtkc.gdktypes; 64 65 private import atk.ObjectAtk; 66 67 68 69 70 /** 71 * Description 72 * AtkSelection should be implemented by UI components with children which 73 * are exposed by atk_object_ref_child and atk_object_get_n_children, if 74 * the use of the parent UI component ordinarily involves selection of one 75 * or more of the objects corresponding to those AtkObject children - for 76 * example, selectable lists. 77 * Note that other types of "selection" (for instance text selection) are 78 * accomplished a other ATK interfaces - AtkSelection is limited to the 79 * selection/deselection of children. 80 */ 81 public class Selection 82 { 83 84 /** the main Gtk struct */ 85 protected AtkSelection* atkSelection; 86 87 88 public AtkSelection* getSelectionStruct() 89 { 90 return atkSelection; 91 } 92 93 94 /** the main Gtk struct as a void* */ 95 protected void* getStruct() 96 { 97 return cast(void*)atkSelection; 98 } 99 100 /** 101 * Sets our main struct and passes it to the parent class 102 */ 103 public this (AtkSelection* atkSelection) 104 { 105 this.atkSelection = atkSelection; 106 } 107 108 /** 109 */ 110 int[string] connectedSignals; 111 112 void delegate(Selection)[] onSelectionChangedListeners; 113 /** 114 * The "selection-changed" signal is emitted by an object which implements 115 * AtkSelection interface when the selection changes. 116 * See Also 117 * AtkText 118 */ 119 void addOnSelectionChanged(void delegate(Selection) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 120 { 121 if ( !("selection-changed" in connectedSignals) ) 122 { 123 Signals.connectData( 124 getStruct(), 125 "selection-changed", 126 cast(GCallback)&callBackSelectionChanged, 127 cast(void*)this, 128 null, 129 connectFlags); 130 connectedSignals["selection-changed"] = 1; 131 } 132 onSelectionChangedListeners ~= dlg; 133 } 134 extern(C) static void callBackSelectionChanged(AtkSelection* atkselectionStruct, Selection _selection) 135 { 136 foreach ( void delegate(Selection) dlg ; _selection.onSelectionChangedListeners ) 137 { 138 dlg(_selection); 139 } 140 } 141 142 143 /** 144 * Adds the specified accessible child of the object to the 145 * object's selection. 146 * Params: 147 * i = a gint specifying the child index. 148 * Returns: TRUE if success, FALSE otherwise. 149 */ 150 public int addSelection(int i) 151 { 152 // gboolean atk_selection_add_selection (AtkSelection *selection, gint i); 153 return atk_selection_add_selection(atkSelection, i); 154 } 155 156 /** 157 * Clears the selection in the object so that no children in the object 158 * are selected. 159 * Returns: TRUE if success, FALSE otherwise. 160 */ 161 public int clearSelection() 162 { 163 // gboolean atk_selection_clear_selection (AtkSelection *selection); 164 return atk_selection_clear_selection(atkSelection); 165 } 166 167 /** 168 * Gets a reference to the accessible object representing the specified 169 * selected child of the object. 170 * Note: callers should not rely on NULL or on a zero value for 171 * indication of whether AtkSelectionIface is implemented, they should 172 * use type checking/interface checking macros or the 173 * atk_get_accessible_value() convenience method. 174 * Params: 175 * i = a gint specifying the index in the selection set. (e.g. the 176 * ith selection as opposed to the ith child). 177 * Returns: an AtkObject representing the selected accessible , or NULL if selection does not implement this interface. [transfer full] 178 */ 179 public ObjectAtk refSelection(int i) 180 { 181 // AtkObject * atk_selection_ref_selection (AtkSelection *selection, gint i); 182 auto p = atk_selection_ref_selection(atkSelection, i); 183 184 if(p is null) 185 { 186 return null; 187 } 188 189 return ObjectG.getDObject!(ObjectAtk)(cast(AtkObject*) p); 190 } 191 192 /** 193 * Gets the number of accessible children currently selected. 194 * Note: callers should not rely on NULL or on a zero value for 195 * indication of whether AtkSelectionIface is implemented, they should 196 * use type checking/interface checking macros or the 197 * atk_get_accessible_value() convenience method. 198 * Returns: a gint representing the number of items selected, or 0 if selection does not implement this interface. 199 */ 200 public int getSelectionCount() 201 { 202 // gint atk_selection_get_selection_count (AtkSelection *selection); 203 return atk_selection_get_selection_count(atkSelection); 204 } 205 206 /** 207 * Determines if the current child of this object is selected 208 * Note: callers should not rely on NULL or on a zero value for 209 * indication of whether AtkSelectionIface is implemented, they should 210 * use type checking/interface checking macros or the 211 * atk_get_accessible_value() convenience method. 212 * Params: 213 * i = a gint specifying the child index. 214 * Returns: a gboolean representing the specified child is selected, or 0 if selection does not implement this interface. 215 */ 216 public int isChildSelected(int i) 217 { 218 // gboolean atk_selection_is_child_selected (AtkSelection *selection, gint i); 219 return atk_selection_is_child_selected(atkSelection, i); 220 } 221 222 /** 223 * Removes the specified child of the object from the object's selection. 224 * Params: 225 * i = a gint specifying the index in the selection set. (e.g. the 226 * ith selection as opposed to the ith child). 227 * Returns: TRUE if success, FALSE otherwise. 228 */ 229 public int removeSelection(int i) 230 { 231 // gboolean atk_selection_remove_selection (AtkSelection *selection, gint i); 232 return atk_selection_remove_selection(atkSelection, i); 233 } 234 235 /** 236 * Causes every child of the object to be selected if the object 237 * supports multiple selections. 238 * Returns: TRUE if success, FALSE otherwise. Signal Details The "selection-changed" signal void user_function (AtkSelection *atkselection, gpointer user_data) : Run Last The "selection-changed" signal is emitted by an object which implements AtkSelection interface when the selection changes. 239 */ 240 public int selectAllSelection() 241 { 242 // gboolean atk_selection_select_all_selection (AtkSelection *selection); 243 return atk_selection_select_all_selection(atkSelection); 244 } 245 }