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