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