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  = GtkBuildable.html
27  * outPack = gtk
28  * outFile = BuildableT
29  * strct   = GtkBuildable
30  * realStrct=
31  * ctorStrct=
32  * clss    = BuildableT
33  * interf  = BuildableIF
34  * class Code: No
35  * interface Code: No
36  * template for:
37  * 	- TStruct
38  * extend  = 
39  * implements:
40  * prefixes:
41  * 	- gtk_buildable_
42  * omit structs:
43  * omit prefixes:
44  * omit code:
45  * omit signals:
46  * imports:
47  * 	- glib.Str
48  * 	- gobject.ObjectG
49  * 	- gobject.Value
50  * 	- gtk.Builder
51  * structWrap:
52  * 	- GObject* -> ObjectG
53  * 	- GValue* -> Value
54  * 	- GtkBuilder* -> Builder
55  * module aliases:
56  * local aliases:
57  * 	- getName -> buildableGetName
58  * 	- setName -> buildableSetName
59  * overrides:
60  */
61 
62 module gtk.BuildableT;
63 
64 public  import gtkc.gtktypes;
65 
66 public import gtkc.gtk;
67 public import glib.ConstructionException;
68 public import gobject.ObjectG;
69 
70 public import glib.Str;
71 public import gobject.ObjectG;
72 public import gobject.Value;
73 public import gtk.Builder;
74 
75 
76 
77 /**
78  * GtkBuildable allows objects to extend and customize their deserialization
79  * from GtkBuilder UI descriptions.
80  * The interface includes methods for setting names and properties of objects,
81  * parsing custom tags and constructing child objects.
82  *
83  * The GtkBuildable interface is implemented by all widgets and
84  * many of the non-widget objects that are provided by GTK+. The
85  * main user of this interface is GtkBuilder. There should be
86  * very little need for applications to call any
87  * gtk_buildable_... functions.
88  *
89  * Note
90  *
91  * An object only needs to implement this interface if it needs
92  * to extend the GtkBuilder format or run any extra routines at deserialization time
93  */
94 public template BuildableT(TStruct)
95 {
96 	
97 	/** the main Gtk struct */
98 	protected GtkBuildable* gtkBuildable;
99 	
100 	
101 	/** Get the main Gtk struct */
102 	public GtkBuildable* getBuildableTStruct()
103 	{
104 		return cast(GtkBuildable*)getStruct();
105 	}
106 	
107 	
108 	/**
109 	 */
110 	
111 	/**
112 	 * Sets the name of the buildable object.
113 	 * Since 2.12
114 	 * Params:
115 	 * buildable = a GtkBuildable
116 	 * name = name to set
117 	 */
118 	public void buildableSetName(string name)
119 	{
120 		// void gtk_buildable_set_name (GtkBuildable *buildable,  const gchar *name);
121 		gtk_buildable_set_name(getBuildableTStruct(), Str.toStringz(name));
122 	}
123 	
124 	/**
125 	 * Gets the name of the buildable object.
126 	 * GtkBuilder sets the name based on the
127 	 * GtkBuilder UI definition
128 	 * used to construct the buildable.
129 	 * Since 2.12
130 	 * Params:
131 	 * buildable = a GtkBuildable
132 	 * Returns: the name set with gtk_buildable_set_name()
133 	 */
134 	public string buildableGetName()
135 	{
136 		// const gchar * gtk_buildable_get_name (GtkBuildable *buildable);
137 		return Str.toString(gtk_buildable_get_name(getBuildableTStruct()));
138 	}
139 	
140 	/**
141 	 * Adds a child to buildable. type is an optional string
142 	 * describing how the child should be added.
143 	 * Since 2.12
144 	 * Params:
145 	 * builder = a GtkBuilder
146 	 * child = child to add
147 	 * type = kind of child or NULL. [allow-none]
148 	 */
149 	public void addChild(Builder builder, ObjectG child, string type)
150 	{
151 		// void gtk_buildable_add_child (GtkBuildable *buildable,  GtkBuilder *builder,  GObject *child,  const gchar *type);
152 		gtk_buildable_add_child(getBuildableTStruct(), (builder is null) ? null : builder.getBuilderStruct(), (child is null) ? null : child.getObjectGStruct(), Str.toStringz(type));
153 	}
154 	
155 	/**
156 	 * Sets the property name name to value on the buildable object.
157 	 * Since 2.12
158 	 * Params:
159 	 * builder = a GtkBuilder
160 	 * name = name of property
161 	 * value = value of property
162 	 */
163 	public void setBuildableProperty(Builder builder, string name, Value value)
164 	{
165 		// void gtk_buildable_set_buildable_property  (GtkBuildable *buildable,  GtkBuilder *builder,  const gchar *name,  const GValue *value);
166 		gtk_buildable_set_buildable_property(getBuildableTStruct(), (builder is null) ? null : builder.getBuilderStruct(), Str.toStringz(name), (value is null) ? null : value.getValueStruct());
167 	}
168 	
169 	/**
170 	 * Constructs a child of buildable with the name name.
171 	 * GtkBuilder calls this function if a "constructor" has been
172 	 * specified in the UI definition.
173 	 * Since 2.12
174 	 * Params:
175 	 * builder = GtkBuilder used to construct this object
176 	 * name = name of child to construct
177 	 * Returns: the constructed child. [transfer full]
178 	 */
179 	public ObjectG constructChild(Builder builder, string name)
180 	{
181 		// GObject * gtk_buildable_construct_child (GtkBuildable *buildable,  GtkBuilder *builder,  const gchar *name);
182 		auto p = gtk_buildable_construct_child(getBuildableTStruct(), (builder is null) ? null : builder.getBuilderStruct(), Str.toStringz(name));
183 		
184 		if(p is null)
185 		{
186 			return null;
187 		}
188 		
189 		return ObjectG.getDObject!(ObjectG)(cast(GObject*) p);
190 	}
191 	
192 	/**
193 	 * This is called for each unknown element under <child>.
194 	 * Since 2.12
195 	 * Params:
196 	 * builder = a GtkBuilder used to construct this object
197 	 * child = child object or NULL for non-child tags. [allow-none]
198 	 * tagname = name of tag
199 	 * parser = a GMarkupParser structure to fill in. [out]
200 	 * data = return location for user data that will be passed in
201 	 * to parser functions. [out]
202 	 * Returns: TRUE if a object has a custom implementation, FALSE if it doesn't.
203 	 */
204 	public int customTagStart(Builder builder, ObjectG child, string tagname, GMarkupParser* parser, void** data)
205 	{
206 		// gboolean gtk_buildable_custom_tag_start (GtkBuildable *buildable,  GtkBuilder *builder,  GObject *child,  const gchar *tagname,  GMarkupParser *parser,  gpointer *data);
207 		return gtk_buildable_custom_tag_start(getBuildableTStruct(), (builder is null) ? null : builder.getBuilderStruct(), (child is null) ? null : child.getObjectGStruct(), Str.toStringz(tagname), parser, data);
208 	}
209 	
210 	/**
211 	 * This is called at the end of each custom element handled by
212 	 * the buildable.
213 	 * Since 2.12
214 	 * Params:
215 	 * builder = GtkBuilder used to construct this object
216 	 * child = child object or NULL for non-child tags. [allow-none]
217 	 * tagname = name of tag
218 	 * data = user data that will be passed in to parser functions. [type gpointer]
219 	 */
220 	public void customTagEnd(Builder builder, ObjectG child, string tagname, void** data)
221 	{
222 		// void gtk_buildable_custom_tag_end (GtkBuildable *buildable,  GtkBuilder *builder,  GObject *child,  const gchar *tagname,  gpointer *data);
223 		gtk_buildable_custom_tag_end(getBuildableTStruct(), (builder is null) ? null : builder.getBuilderStruct(), (child is null) ? null : child.getObjectGStruct(), Str.toStringz(tagname), data);
224 	}
225 	
226 	/**
227 	 * This is similar to gtk_buildable_parser_finished() but is
228 	 * called once for each custom tag handled by the buildable.
229 	 * Since 2.12
230 	 * Params:
231 	 * builder = a GtkBuilder
232 	 * child = child object or NULL for non-child tags. [allow-none]
233 	 * tagname = the name of the tag
234 	 * data = user data created in custom_tag_start
235 	 */
236 	public void customFinished(Builder builder, ObjectG child, string tagname, void* data)
237 	{
238 		// void gtk_buildable_custom_finished (GtkBuildable *buildable,  GtkBuilder *builder,  GObject *child,  const gchar *tagname,  gpointer data);
239 		gtk_buildable_custom_finished(getBuildableTStruct(), (builder is null) ? null : builder.getBuilderStruct(), (child is null) ? null : child.getObjectGStruct(), Str.toStringz(tagname), data);
240 	}
241 	
242 	/**
243 	 * Called when the builder finishes the parsing of a
244 	 * GtkBuilder UI definition.
245 	 * Note that this will be called once for each time
246 	 * gtk_builder_add_from_file() or gtk_builder_add_from_string()
247 	 * is called on a builder.
248 	 * Since 2.12
249 	 * Params:
250 	 * builder = a GtkBuilder
251 	 */
252 	public void parserFinished(Builder builder)
253 	{
254 		// void gtk_buildable_parser_finished (GtkBuildable *buildable,  GtkBuilder *builder);
255 		gtk_buildable_parser_finished(getBuildableTStruct(), (builder is null) ? null : builder.getBuilderStruct());
256 	}
257 	
258 	/**
259 	 * Get the internal child called childname of the buildable object.
260 	 * Since 2.12
261 	 * Params:
262 	 * builder = a GtkBuilder
263 	 * childname = name of child
264 	 * Returns: the internal child of the buildable object. [transfer none]
265 	 */
266 	public ObjectG getInternalChild(Builder builder, string childname)
267 	{
268 		// GObject * gtk_buildable_get_internal_child (GtkBuildable *buildable,  GtkBuilder *builder,  const gchar *childname);
269 		auto p = gtk_buildable_get_internal_child(getBuildableTStruct(), (builder is null) ? null : builder.getBuilderStruct(), Str.toStringz(childname));
270 		
271 		if(p is null)
272 		{
273 			return null;
274 		}
275 		
276 		return ObjectG.getDObject!(ObjectG)(cast(GObject*) p);
277 	}
278 }