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