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