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