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 private import atk.ObjectAtk; 65 66 67 68 /** 69 * AtkSelection should be implemented by UI components with children 70 * which are exposed by atk_object_ref_child and 71 * atk_object_get_n_children, if the use of the parent UI component 72 * ordinarily involves selection of one or more of the objects 73 * corresponding to those AtkObject children - for example, 74 * selectable lists. 75 * 76 * Note that other types of "selection" (for instance text selection) 77 * are accomplished a other ATK interfaces - AtkSelection is limited 78 * to the selection/deselection of children. 79 */ 80 public class Selection 81 { 82 83 /** the main Gtk struct */ 84 protected AtkSelection* atkSelection; 85 86 87 /** Get the main Gtk struct */ 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 115 * implements AtkSelection interface when the selection changes. 116 */ 117 void addOnSelectionChanged(void delegate(Selection) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 118 { 119 if ( !("selection-changed" in connectedSignals) ) 120 { 121 Signals.connectData( 122 getStruct(), 123 "selection-changed", 124 cast(GCallback)&callBackSelectionChanged, 125 cast(void*)this, 126 null, 127 connectFlags); 128 connectedSignals["selection-changed"] = 1; 129 } 130 onSelectionChangedListeners ~= dlg; 131 } 132 extern(C) static void callBackSelectionChanged(AtkSelection* atkselectionStruct, Selection _selection) 133 { 134 foreach ( void delegate(Selection) dlg ; _selection.onSelectionChangedListeners ) 135 { 136 dlg(_selection); 137 } 138 } 139 140 141 /** 142 * Adds the specified accessible child of the object to the 143 * object's selection. 144 * Params: 145 * i = a gint specifying the child index. 146 * Returns: TRUE if success, FALSE otherwise. 147 */ 148 public int addSelection(int i) 149 { 150 // gboolean atk_selection_add_selection (AtkSelection *selection, gint i); 151 return atk_selection_add_selection(atkSelection, i); 152 } 153 154 /** 155 * Clears the selection in the object so that no children in the object 156 * are selected. 157 * Returns: TRUE if success, FALSE otherwise. 158 */ 159 public int clearSelection() 160 { 161 // gboolean atk_selection_clear_selection (AtkSelection *selection); 162 return atk_selection_clear_selection(atkSelection); 163 } 164 165 /** 166 * Gets a reference to the accessible object representing the specified 167 * selected child of the object. 168 * Note: callers should not rely on NULL or on a zero value for 169 * indication of whether AtkSelectionIface is implemented, they should 170 * use type checking/interface checking macros or the 171 * atk_get_accessible_value() convenience method. 172 * Params: 173 * i = a gint specifying the index in the selection set. (e.g. the 174 * ith selection as opposed to the ith child). 175 * Returns: an AtkObject representing the selected accessible , or NULL if selection does not implement this interface. [transfer full] 176 */ 177 public ObjectAtk refSelection(int i) 178 { 179 // AtkObject * atk_selection_ref_selection (AtkSelection *selection, gint i); 180 auto p = atk_selection_ref_selection(atkSelection, i); 181 182 if(p is null) 183 { 184 return null; 185 } 186 187 return ObjectG.getDObject!(ObjectAtk)(cast(AtkObject*) p); 188 } 189 190 /** 191 * Gets the number of accessible children currently selected. 192 * Note: callers should not rely on NULL or on a zero value for 193 * indication of whether AtkSelectionIface is implemented, they should 194 * use type checking/interface checking macros or the 195 * atk_get_accessible_value() convenience method. 196 * Returns: a gint representing the number of items selected, or 0 if selection does not implement this interface. 197 */ 198 public int getSelectionCount() 199 { 200 // gint atk_selection_get_selection_count (AtkSelection *selection); 201 return atk_selection_get_selection_count(atkSelection); 202 } 203 204 /** 205 * Determines if the current child of this object is selected 206 * Note: callers should not rely on NULL or on a zero value for 207 * indication of whether AtkSelectionIface is implemented, they should 208 * use type checking/interface checking macros or the 209 * atk_get_accessible_value() convenience method. 210 * Params: 211 * i = a gint specifying the child index. 212 * Returns: a gboolean representing the specified child is selected, or 0 if selection does not implement this interface. 213 */ 214 public int isChildSelected(int i) 215 { 216 // gboolean atk_selection_is_child_selected (AtkSelection *selection, gint i); 217 return atk_selection_is_child_selected(atkSelection, i); 218 } 219 220 /** 221 * Removes the specified child of the object from the object's selection. 222 * Params: 223 * i = a gint specifying the index in the selection set. (e.g. the 224 * ith selection as opposed to the ith child). 225 * Returns: TRUE if success, FALSE otherwise. 226 */ 227 public int removeSelection(int i) 228 { 229 // gboolean atk_selection_remove_selection (AtkSelection *selection, gint i); 230 return atk_selection_remove_selection(atkSelection, i); 231 } 232 233 /** 234 * Causes every child of the object to be selected if the object 235 * supports multiple selections. 236 * 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. 237 */ 238 public int selectAllSelection() 239 { 240 // gboolean atk_selection_select_all_selection (AtkSelection *selection); 241 return atk_selection_select_all_selection(atkSelection); 242 } 243 }