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 module atk.SelectionT; 26 27 public import atk.ObjectAtk; 28 public import atk.c.functions; 29 public import atk.c.types; 30 public import gobject.ObjectG; 31 public import gobject.Signals; 32 public import gtkc.atktypes; 33 public import std.algorithm; 34 35 36 /** 37 * #AtkSelection should be implemented by UI components with children 38 * which are exposed by #atk_object_ref_child and 39 * #atk_object_get_n_children, if the use of the parent UI component 40 * ordinarily involves selection of one or more of the objects 41 * corresponding to those #AtkObject children - for example, 42 * selectable lists. 43 * 44 * Note that other types of "selection" (for instance text selection) 45 * are accomplished a other ATK interfaces - #AtkSelection is limited 46 * to the selection/deselection of children. 47 */ 48 public template SelectionT(TStruct) 49 { 50 /** Get the main Gtk struct */ 51 public AtkSelection* getSelectionStruct(bool transferOwnership = false) 52 { 53 if (transferOwnership) 54 ownedRef = false; 55 return cast(AtkSelection*)getStruct(); 56 } 57 58 59 /** 60 * Adds the specified accessible child of the object to the 61 * object's selection. 62 * 63 * Params: 64 * i = a #gint specifying the child index. 65 * 66 * Returns: TRUE if success, FALSE otherwise. 67 */ 68 public bool addSelection(int i) 69 { 70 return atk_selection_add_selection(getSelectionStruct(), i) != 0; 71 } 72 73 /** 74 * Clears the selection in the object so that no children in the object 75 * are selected. 76 * 77 * Returns: TRUE if success, FALSE otherwise. 78 */ 79 public bool clearSelection() 80 { 81 return atk_selection_clear_selection(getSelectionStruct()) != 0; 82 } 83 84 /** 85 * Gets the number of accessible children currently selected. 86 * Note: callers should not rely on %NULL or on a zero value for 87 * indication of whether AtkSelectionIface is implemented, they should 88 * use type checking/interface checking macros or the 89 * atk_get_accessible_value() convenience method. 90 * 91 * Returns: a gint representing the number of items selected, or 0 92 * if @selection does not implement this interface. 93 */ 94 public int getSelectionCount() 95 { 96 return atk_selection_get_selection_count(getSelectionStruct()); 97 } 98 99 /** 100 * Determines if the current child of this object is selected 101 * Note: callers should not rely on %NULL or on a zero value for 102 * indication of whether AtkSelectionIface is implemented, they should 103 * use type checking/interface checking macros or the 104 * atk_get_accessible_value() convenience method. 105 * 106 * Params: 107 * i = a #gint specifying the child index. 108 * 109 * Returns: a gboolean representing the specified child is selected, or 0 110 * if @selection does not implement this interface. 111 */ 112 public bool isChildSelected(int i) 113 { 114 return atk_selection_is_child_selected(getSelectionStruct(), i) != 0; 115 } 116 117 /** 118 * Gets a reference to the accessible object representing the specified 119 * selected child of the object. 120 * Note: callers should not rely on %NULL or on a zero value for 121 * indication of whether AtkSelectionIface is implemented, they should 122 * use type checking/interface checking macros or the 123 * atk_get_accessible_value() convenience method. 124 * 125 * Params: 126 * i = a #gint specifying the index in the selection set. (e.g. the 127 * ith selection as opposed to the ith child). 128 * 129 * Returns: an #AtkObject representing the 130 * selected accessible, or %NULL if @selection does not implement this 131 * interface. 132 */ 133 public ObjectAtk refSelection(int i) 134 { 135 auto p = atk_selection_ref_selection(getSelectionStruct(), i); 136 137 if(p is null) 138 { 139 return null; 140 } 141 142 return ObjectG.getDObject!(ObjectAtk)(cast(AtkObject*) p, true); 143 } 144 145 /** 146 * Removes the specified child of the object from the object's selection. 147 * 148 * Params: 149 * i = a #gint specifying the index in the selection set. (e.g. the 150 * ith selection as opposed to the ith child). 151 * 152 * Returns: TRUE if success, FALSE otherwise. 153 */ 154 public bool removeSelection(int i) 155 { 156 return atk_selection_remove_selection(getSelectionStruct(), i) != 0; 157 } 158 159 /** 160 * Causes every child of the object to be selected if the object 161 * supports multiple selections. 162 * 163 * Returns: TRUE if success, FALSE otherwise. 164 */ 165 public bool selectAllSelection() 166 { 167 return atk_selection_select_all_selection(getSelectionStruct()) != 0; 168 } 169 170 /** 171 * The "selection-changed" signal is emitted by an object which 172 * implements AtkSelection interface when the selection changes. 173 */ 174 gulong addOnSelectionChanged(void delegate(SelectionIF) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 175 { 176 return Signals.connect(this, "selection-changed", dlg, connectFlags ^ ConnectFlags.SWAPPED); 177 } 178 }