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