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.StateSet; 26 27 private import glib.ConstructionException; 28 private import gobject.ObjectG; 29 private import gtkc.atk; 30 public import gtkc.atktypes; 31 32 33 /** 34 * An AtkStateSet determines a component's state set. It is composed 35 * of a set of AtkStates. 36 */ 37 public class StateSet : ObjectG 38 { 39 /** the main Gtk struct */ 40 protected AtkStateSet* atkStateSet; 41 42 /** Get the main Gtk struct */ 43 public AtkStateSet* getStateSetStruct() 44 { 45 return atkStateSet; 46 } 47 48 /** the main Gtk struct as a void* */ 49 protected override void* getStruct() 50 { 51 return cast(void*)atkStateSet; 52 } 53 54 protected override void setStruct(GObject* obj) 55 { 56 atkStateSet = cast(AtkStateSet*)obj; 57 super.setStruct(obj); 58 } 59 60 /** 61 * Sets our main struct and passes it to the parent class. 62 */ 63 public this (AtkStateSet* atkStateSet, bool ownedRef = false) 64 { 65 this.atkStateSet = atkStateSet; 66 super(cast(GObject*)atkStateSet, ownedRef); 67 } 68 69 /** 70 */ 71 72 public static GType getType() 73 { 74 return atk_state_set_get_type(); 75 } 76 77 /** 78 * Creates a new empty state set. 79 * 80 * Return: a new #AtkStateSet 81 * 82 * Throws: ConstructionException GTK+ fails to create the object. 83 */ 84 public this() 85 { 86 auto p = atk_state_set_new(); 87 88 if(p is null) 89 { 90 throw new ConstructionException("null returned by new"); 91 } 92 93 this(cast(AtkStateSet*) p, true); 94 } 95 96 /** 97 * Add a new state for the specified type to the current state set if 98 * it is not already present. 99 * 100 * Params: 101 * type = an #AtkStateType 102 * 103 * Return: %TRUE if the state for @type is not already in @set. 104 */ 105 public bool addState(AtkStateType type) 106 { 107 return atk_state_set_add_state(atkStateSet, type) != 0; 108 } 109 110 /** 111 * Add the states for the specified types to the current state set. 112 * 113 * Params: 114 * types = an array of #AtkStateType 115 * nTypes = The number of elements in the array 116 */ 117 public void addStates(AtkStateType[] types) 118 { 119 atk_state_set_add_states(atkStateSet, types.ptr, cast(int)types.length); 120 } 121 122 /** 123 * Constructs the intersection of the two sets, returning %NULL if the 124 * intersection is empty. 125 * 126 * Params: 127 * compareSet = another #AtkStateSet 128 * 129 * Return: a new #AtkStateSet which is the intersection of 130 * the two sets. 131 */ 132 public StateSet andSets(StateSet compareSet) 133 { 134 auto p = atk_state_set_and_sets(atkStateSet, (compareSet is null) ? null : compareSet.getStateSetStruct()); 135 136 if(p is null) 137 { 138 return null; 139 } 140 141 return ObjectG.getDObject!(StateSet)(cast(AtkStateSet*) p, true); 142 } 143 144 /** 145 * Removes all states from the state set. 146 */ 147 public void clearStates() 148 { 149 atk_state_set_clear_states(atkStateSet); 150 } 151 152 /** 153 * Checks whether the state for the specified type is in the specified set. 154 * 155 * Params: 156 * type = an #AtkStateType 157 * 158 * Return: %TRUE if @type is the state type is in @set. 159 */ 160 public bool containsState(AtkStateType type) 161 { 162 return atk_state_set_contains_state(atkStateSet, type) != 0; 163 } 164 165 /** 166 * Checks whether the states for all the specified types are in the 167 * specified set. 168 * 169 * Params: 170 * types = an array of #AtkStateType 171 * nTypes = The number of elements in the array 172 * 173 * Return: %TRUE if all the states for @type are in @set. 174 */ 175 public bool containsStates(AtkStateType[] types) 176 { 177 return atk_state_set_contains_states(atkStateSet, types.ptr, cast(int)types.length) != 0; 178 } 179 180 /** 181 * Checks whether the state set is empty, i.e. has no states set. 182 * 183 * Return: %TRUE if @set has no states set, otherwise %FALSE 184 */ 185 public bool isEmpty() 186 { 187 return atk_state_set_is_empty(atkStateSet) != 0; 188 } 189 190 /** 191 * Constructs the union of the two sets. 192 * 193 * Params: 194 * compareSet = another #AtkStateSet 195 * 196 * Return: a new #AtkStateSet which is 197 * the union of the two sets, returning %NULL is empty. 198 */ 199 public StateSet orSets(StateSet compareSet) 200 { 201 auto p = atk_state_set_or_sets(atkStateSet, (compareSet is null) ? null : compareSet.getStateSetStruct()); 202 203 if(p is null) 204 { 205 return null; 206 } 207 208 return ObjectG.getDObject!(StateSet)(cast(AtkStateSet*) p, true); 209 } 210 211 /** 212 * Removes the state for the specified type from the state set. 213 * 214 * Params: 215 * type = an #AtkType 216 * 217 * Return: %TRUE if @type was the state type is in @set. 218 */ 219 public bool removeState(AtkStateType type) 220 { 221 return atk_state_set_remove_state(atkStateSet, type) != 0; 222 } 223 224 /** 225 * Constructs the exclusive-or of the two sets, returning %NULL is empty. 226 * The set returned by this operation contains the states in exactly 227 * one of the two sets. 228 * 229 * Params: 230 * compareSet = another #AtkStateSet 231 * 232 * Return: a new #AtkStateSet which contains the states 233 * which are in exactly one of the two sets. 234 */ 235 public StateSet xorSets(StateSet compareSet) 236 { 237 auto p = atk_state_set_xor_sets(atkStateSet, (compareSet is null) ? null : compareSet.getStateSetStruct()); 238 239 if(p is null) 240 { 241 return null; 242 } 243 244 return ObjectG.getDObject!(StateSet)(cast(AtkStateSet*) p, true); 245 } 246 }