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  = AtkRelationSet.html
27  * outPack = atk
28  * outFile = RelationSet
29  * strct   = AtkRelationSet
30  * realStrct=
31  * ctorStrct=
32  * clss    = RelationSet
33  * interf  = 
34  * class Code: No
35  * interface Code: No
36  * template for:
37  * extend  = 
38  * implements:
39  * prefixes:
40  * 	- atk_relationSet_
41  * omit structs:
42  * omit prefixes:
43  * omit code:
44  * omit signals:
45  * imports:
46  * 	- atk.ObjectAtk
47  * 	- atk.Relation
48  * 	- glib.PtrArray
49  * structWrap:
50  * 	- AtkObject* -> ObjectAtk
51  * 	- AtkRelation* -> Relation
52  * 	- GPtrArray* -> PtrArray
53  * module aliases:
54  * local aliases:
55  * overrides:
56  */
57 
58 module atk.RelationSet;
59 
60 public  import gtkc.atktypes;
61 
62 private import gtkc.atk;
63 private import glib.ConstructionException;
64 private import gobject.ObjectG;
65 
66 
67 private import atk.ObjectAtk;
68 private import atk.Relation;
69 private import glib.PtrArray;
70 
71 
72 
73 private import gobject.ObjectG;
74 
75 /**
76  * Description
77  * The AtkRelationSet held by an object establishes its relationships with
78  * objects beyond the normal "parent/child" hierarchical relationships that all
79  * user interface objects have. AtkRelationSets establish whether objects are
80  * labelled or controlled by other components, share group membership with other
81  * components (for instance within a radio-button group), or share content which
82  * "flows" between them, among other types of possible relationships.
83  */
84 public class RelationSet : ObjectG
85 {
86 	
87 	/** the main Gtk struct */
88 	protected AtkRelationSet* atkRelationSet;
89 	
90 	
91 	public AtkRelationSet* getRelationSetStruct()
92 	{
93 		return atkRelationSet;
94 	}
95 	
96 	
97 	/** the main Gtk struct as a void* */
98 	protected override void* getStruct()
99 	{
100 		return cast(void*)atkRelationSet;
101 	}
102 	
103 	/**
104 	 * Sets our main struct and passes it to the parent class
105 	 */
106 	public this (AtkRelationSet* atkRelationSet)
107 	{
108 		super(cast(GObject*)atkRelationSet);
109 		this.atkRelationSet = atkRelationSet;
110 	}
111 	
112 	protected override void setStruct(GObject* obj)
113 	{
114 		super.setStruct(obj);
115 		atkRelationSet = cast(AtkRelationSet*)obj;
116 	}
117 	
118 	/**
119 	 */
120 	
121 	/**
122 	 * Creates a new empty relation set.
123 	 * Returns: a new AtkRelationSet
124 	 */
125 	public static AtkRelationSet* atkRelationSetNew()
126 	{
127 		// AtkRelationSet * atk_relation_set_new (void);
128 		return atk_relation_set_new();
129 	}
130 	
131 	/**
132 	 * Determines whether the relation set contains a relation that matches the
133 	 * specified type.
134 	 * Params:
135 	 * relationship = an AtkRelationType
136 	 * Returns: TRUE if relationship is the relationship type of a relation in set, FALSE otherwise
137 	 */
138 	public int atkRelationSetContains(AtkRelationType relationship)
139 	{
140 		// gboolean atk_relation_set_contains (AtkRelationSet *set,  AtkRelationType relationship);
141 		return atk_relation_set_contains(atkRelationSet, relationship);
142 	}
143 	
144 	/**
145 	 * Removes a relation from the relation set.
146 	 * This function unref's the AtkRelation so it will be deleted unless there
147 	 * is another reference to it.
148 	 * Params:
149 	 * relation = an AtkRelation
150 	 */
151 	public void atkRelationSetRemove(Relation relation)
152 	{
153 		// void atk_relation_set_remove (AtkRelationSet *set,  AtkRelation *relation);
154 		atk_relation_set_remove(atkRelationSet, (relation is null) ? null : relation.getRelationStruct());
155 	}
156 	
157 	/**
158 	 * Add a new relation to the current relation set if it is not already
159 	 * present.
160 	 * This function ref's the AtkRelation so the caller of this function
161 	 * should unref it to ensure that it will be destroyed when the AtkRelationSet
162 	 * is destroyed.
163 	 * Params:
164 	 * relation = an AtkRelation
165 	 */
166 	public void atkRelationSetAdd(Relation relation)
167 	{
168 		// void atk_relation_set_add (AtkRelationSet *set,  AtkRelation *relation);
169 		atk_relation_set_add(atkRelationSet, (relation is null) ? null : relation.getRelationStruct());
170 	}
171 	
172 	/**
173 	 * Determines the number of relations in a relation set.
174 	 * Returns: an integer representing the number of relations in the set.
175 	 */
176 	public int atkRelationSetGetNRelations()
177 	{
178 		// gint atk_relation_set_get_n_relations (AtkRelationSet *set);
179 		return atk_relation_set_get_n_relations(atkRelationSet);
180 	}
181 	
182 	/**
183 	 * Determines the relation at the specified position in the relation set.
184 	 * Params:
185 	 * i = a gint representing a position in the set, starting from 0.
186 	 * Returns: a AtkRelation, which is the relation at position i in the set. [transfer none]
187 	 */
188 	public Relation atkRelationSetGetRelation(int i)
189 	{
190 		// AtkRelation * atk_relation_set_get_relation (AtkRelationSet *set,  gint i);
191 		auto p = atk_relation_set_get_relation(atkRelationSet, i);
192 		
193 		if(p is null)
194 		{
195 			return null;
196 		}
197 		
198 		return ObjectG.getDObject!(Relation)(cast(AtkRelation*) p);
199 	}
200 	
201 	/**
202 	 * Finds a relation that matches the specified type.
203 	 * Params:
204 	 * relationship = an AtkRelationType
205 	 * Returns: an AtkRelation, which is a relation matching the specified type. [transfer none]
206 	 */
207 	public Relation atkRelationSetGetRelationByType(AtkRelationType relationship)
208 	{
209 		// AtkRelation * atk_relation_set_get_relation_by_type  (AtkRelationSet *set,  AtkRelationType relationship);
210 		auto p = atk_relation_set_get_relation_by_type(atkRelationSet, relationship);
211 		
212 		if(p is null)
213 		{
214 			return null;
215 		}
216 		
217 		return ObjectG.getDObject!(Relation)(cast(AtkRelation*) p);
218 	}
219 	
220 	/**
221 	 * Add a new relation of the specified type with the specified target to
222 	 * the current relation set if the relation set does not contain a relation
223 	 * of that type. If it is does contain a relation of that typea the target
224 	 * is added to the relation.
225 	 * Since 1.9
226 	 * Params:
227 	 * relationship = an AtkRelationType
228 	 * target = an AtkObject
229 	 */
230 	public void atkRelationSetAddRelationByType(AtkRelationType relationship, ObjectAtk target)
231 	{
232 		// void atk_relation_set_add_relation_by_type  (AtkRelationSet *set,  AtkRelationType relationship,  AtkObject *target);
233 		atk_relation_set_add_relation_by_type(atkRelationSet, relationship, (target is null) ? null : target.getObjectAtkStruct());
234 	}
235 }