alternative to assert
[gtkD.git] / gtkD / src / atk / Relation.d
blob45e558d9967d2a3639a499201d934561bdadb809
1 /*
2 * This file is part of gtkD.
4 * gtkD is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation; either version 2.1 of the License, or
7 * (at your option) any later version.
9 * gtkD is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public License
15 * along with gtkD; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 // generated automatically - do not change
20 // find conversion definition on APILookup.txt
21 // implement new conversion functionalities on the wrap.utils pakage
24 * Conversion parameters:
25 * inFile = AtkRelation.html
26 * outPack = atk
27 * outFile = Relation
28 * strct = AtkRelation
29 * realStrct=
30 * ctorStrct=
31 * clss = Relation
32 * interf =
33 * class Code: No
34 * interface Code: No
35 * template for:
36 * extend =
37 * implements:
38 * prefixes:
39 * - atk_relation_
40 * omit structs:
41 * omit prefixes:
42 * omit code:
43 * imports:
44 * - glib.PtrArray
45 * - glib.Str
46 * structWrap:
47 * - GPtrArray* -> PtrArray
48 * module aliases:
49 * local aliases:
52 module atk.Relation;
54 version(noAssert)
56 version(Tango)
58 import tango.io.Stdout; // use the tango loging?
62 private import gtkc.atktypes;
64 private import gtkc.atk;
67 private import glib.PtrArray;
68 private import glib.Str;
73 /**
74 * Description
75 * An AtkRelation describes a relation between an object and one or more
76 * other objects. The actual relations that an object has with other objects
77 * are defined as an AtkRelationSet, which is a set of AtkRelations.
79 private import gobject.ObjectG;
80 public class Relation : ObjectG
83 /** the main Gtk struct */
84 protected AtkRelation* atkRelation;
87 public AtkRelation* getRelationStruct()
89 return atkRelation;
93 /** the main Gtk struct as a void* */
94 protected void* getStruct()
96 return cast(void*)atkRelation;
99 /**
100 * Sets our main struct and passes it to the parent class
102 public this (AtkRelation* atkRelation)
104 version(noAssert)
106 if ( atkRelation is null )
108 int zero = 0;
109 version(Tango)
111 Stdout("struct atkRelation is null on constructor").newline;
113 else
115 printf("struct atkRelation is null on constructor");
117 zero = zero / zero;
120 else
122 assert(atkRelation !is null, "struct atkRelation is null on constructor");
124 super(cast(GObject*)atkRelation);
125 this.atkRelation = atkRelation;
134 * Associate name with a new AtkRelationType
135 * name:
136 * a name string
137 * Returns:
138 * an AtkRelationType associated with name
140 public static AtkRelationType typeRegister(char[] name)
142 // AtkRelationType atk_relation_type_register (const gchar *name);
143 return atk_relation_type_register(Str.toStringz(name));
147 * Gets the description string describing the AtkRelationType type.
148 * type:
149 * The AtkRelationType whose name is required
150 * Returns:
151 * the string describing the AtkRelationType
153 public static char[] typeGetName(AtkRelationType type)
155 // const gchar* atk_relation_type_get_name (AtkRelationType type);
156 return Str.toString(atk_relation_type_get_name(type) );
160 * Get the AtkRelationType type corresponding to a relation name.
161 * name:
162 * a string which is the (non-localized) name of an ATK relation type.
163 * Returns:
164 * the AtkRelationType enumerated type corresponding to the specified name,
165 * or ATK_RELATION_NULL if no matching relation type is found.
167 public static AtkRelationType typeForName(char[] name)
169 // AtkRelationType atk_relation_type_for_name (const gchar *name);
170 return atk_relation_type_for_name(Str.toStringz(name));
174 * Create a new relation for the specified key and the specified list
175 * of targets.
176 * targets:
177 * an array of pointers to AtkObjects
178 * n_targets:
179 * number of AtkObjects pointed to by targets
180 * relationship:
181 * an AtkRelationType with which to create the new
182 * AtkRelation
183 * Returns:
184 * a pointer to a new AtkRelation
186 public this (AtkObject** targets, int nTargets, AtkRelationType relationship)
188 // AtkRelation* atk_relation_new (AtkObject **targets, gint n_targets, AtkRelationType relationship);
189 this(cast(AtkRelation*)atk_relation_new(targets, nTargets, relationship) );
193 * Gets the type of relation
194 * relation:
195 * an AtkRelation
196 * Returns:
197 * the type of relation
199 public AtkRelationType getRelationType()
201 // AtkRelationType atk_relation_get_relation_type (AtkRelation *relation);
202 return atk_relation_get_relation_type(atkRelation);
206 * Gets the target list of relation
207 * relation:
208 * an AtkRelation
209 * Returns:
210 * the target list of relation
212 public PtrArray getTarget()
214 // GPtrArray* atk_relation_get_target (AtkRelation *relation);
215 return new PtrArray( atk_relation_get_target(atkRelation) );
219 * Adds the specified AtkObject to the target for the relation, if it is
220 * not already present.
221 * relation:
222 * an AtkRelation
223 * target:
224 * an AtkObject
225 * Since ATK 1.9
226 * Property Details
227 * The "relation-type" property
228 * "relation-type" AtkRelationType : Read / Write
229 * The type of the relation.
230 * Default value: ATK_RELATION_NULL
232 public void addTarget(AtkObject* target)
234 // void atk_relation_add_target (AtkRelation *relation, AtkObject *target);
235 atk_relation_add_target(atkRelation, target);