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