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  = GladeXML.html
27  * outPack = glade
28  * outFile = Glade
29  * strct   = GladeXML
30  * realStrct=
31  * ctorStrct=
32  * clss    = Glade
33  * interf  = 
34  * class Code: Yes
35  * interface Code: No
36  * template for:
37  * extend  = 
38  * implements:
39  * prefixes:
40  * 	- glade_xml_
41  * omit structs:
42  * omit prefixes:
43  * omit code:
44  * 	- glade_xml_signal_autoconnect
45  * 	- glade_xml_signal_connect_data
46  * 	- glade_xml_signal_connect
47  * 	- glade_xml_signal_connect_full
48  * 	- glade_xml_signal_autoconnect_full
49  * 	- GladeXMLConnectFunc
50  * 	- GladeXMLCustomWidgetHandler
51  * 	- glade_set_custom_handler
52  * 	- glade_xml_get_widget
53  * 	- glade_xml_new
54  * 	- glade_xml_get_widget_prefix
55  * omit signals:
56  * imports:
57  * 	- gtk.Widget
58  * 	- gobject.ObjectG
59  * 	- glib.ListG
60  * 	- glib.Str
61  * structWrap:
62  * 	- GList* -> ListG
63  * 	- GObject* -> ObjectG
64  * 	- GladeXML* -> Glade
65  * 	- GtkWidget* -> Widget
66  * module aliases:
67  * local aliases:
68  * overrides:
69  */
70 
71 module glade.Glade;
72 
73 public  import gtkc.gladetypes;
74 
75 private import gtkc.glade;
76 private import glib.ConstructionException;
77 private import gobject.ObjectG;
78 
79 
80 private import gtk.Widget;
81 private import gobject.ObjectG;
82 private import glib.ListG;
83 private import glib.Str;
84 
85 
86 
87 private import gobject.ObjectG;
88 
89 /**
90  * Description
91  * This object represents an `instantiation' of an XML interface description.
92  * When one of these objects is created, the XML file is read, and the
93  * interface is created. The GladeXML object then provides an interface for
94  * accessing the widgets in the interface by the names assigned to them
95  * inside the XML description.
96  * The GladeXML object can also be used to connect handlers to the named
97  * signals in the description. Libglade also provides an interface by which
98  * it can look up the signal handler names in the program's symbol table and
99  * automatically connect as many handlers up as it can that way.
100  */
101 public class Glade : ObjectG
102 {
103 	
104 	/** the main Gtk struct */
105 	protected GladeXML* gladeXML;
106 	
107 	
108 	public GladeXML* getGladeStruct()
109 	{
110 		return gladeXML;
111 	}
112 	
113 	
114 	/** the main Gtk struct as a void* */
115 	protected override void* getStruct()
116 	{
117 		return cast(void*)gladeXML;
118 	}
119 	
120 	/**
121 	 * Sets our main struct and passes it to the parent class
122 	 */
123 	public this (GladeXML* gladeXML)
124 	{
125 		super(cast(GObject*)gladeXML);
126 		this.gladeXML = gladeXML;
127 	}
128 	
129 	protected override void setStruct(GObject* obj)
130 	{
131 		super.setStruct(obj);
132 		gladeXML = cast(GladeXML*)obj;
133 	}
134 	
135 	/**
136 	 * This function is used to get a pointer to the GtkWidget corresponding to
137 	 * name in the interface description. You would use this if you have to do
138 	 * anything to the widget after loading.
139 	 * Params:
140 	 *  name = the name of the widget.
141 	 * Returns:
142 	 *  the widget matching name, or NULL if none exists.
143 	 */
144 	public Widget getWidget(string name)
145 	{
146 		// GtkWidget* glade_xml_get_widget (GladeXML *self,  const char *name);
147 		return newFromWidget( glade_xml_get_widget(gladeXML, Str.toStringz(name)) );
148 	}
149 	
150 	
151 	
152 	
153 	
154 	
155 	/**
156 	 * Creates a new GladeXML object (and the corresponding widgets) from the
157 	 * XML file fname. Optionally it will only build the interface from the
158 	 * widget node root (if it is not NULL). This feature is useful if you
159 	 * only want to build say a toolbar or menu from the XML file, but not the
160 	 * window it is embedded in. Note also that the XML parse tree is cached
161 	 * to speed up creating another GladeXML object for the same file
162 	 * Params:
163 	 *  fname = the XML file name.
164 	 *  root = the widget node in fname to start building from (or NULL)
165 	 *  domain = the translation domain for the XML file (or NULL for default)
166 	 */
167 	public this (string fname, string root = null, string domain=null)
168 	{
169 		// GladeXML* glade_xml_new (const char *fname,  const char *root,  const char *domain);
170 		this(cast(GladeXML*)glade_xml_new(Str.toStringz(fname),
171 		root ? Str.toStringz(root) : null,
172 		domain ? Str.toStringz(domain) : null) );
173 	}
174 	
175 	/**
176 	 * This function is used to get a list of pointers to the GtkWidget(s)
177 	 * with names that start with the string name in the interface description.
178 	 * You would use this if you have to do something to all of these widgets
179 	 * after loading.
180 	 * Params:
181 	 *  name = the name of the widget.
182 	 * Returns:
183 	 *  A list of the widget that match name as the start of their
184 	 *  name, or NULL if none exists.
185 	 */
186 	public Widget[] getWidgetPrefix(string name)
187 	{
188 		// GList* glade_xml_get_widget_prefix (GladeXML *self,  const char *name);
189 		Widget[] ret;
190 		ListG widgets = new ListG( glade_xml_get_widget_prefix(gladeXML, Str.toStringz(name)) );
191 		
192 		if (widgets  is null)
193 		return null;
194 		
195 		for (int i=0;i < widgets.length; i++)
196 		{
197 			ret ~= newFromWidget( cast(GtkWidget*)widgets.nthData(i) );
198 		}
199 		return ret;
200 	}
201 	
202 	
203 	private import gobject.Type;
204 	private import gtk.AboutDialog;
205 	private import gtk.AccelLabel;
206 	private import gtk.Alignment;
207 	private import gtk.Arrow;
208 	private import gtk.AspectFrame;
209 	private import gtk.Assistant;
210 	private import gtk.Bin;
211 	private import gtk.Box;
212 	private import gtk.ButtonBox;
213 	private import gtk.Button;
214 	private import gtk.Calendar;
215 	private import gtk.CellView;
216 	private import gtk.CheckButton;
217 	private import gtk.CheckMenuItem;
218 	private import gtk.ColorButton;
219 	private import gtk.ColorSelection;
220 	private import gtk.ColorSelectionDialog;
221 	private import gtk.ComboBox;
222 	private import gtk.ComboBoxEntry;
223 	private import gtk.Container;
224 	private import gtk.Curve;
225 	private import gtk.Dialog;
226 	private import gtk.DrawingArea;
227 	private import gtk.Entry;
228 	private import gtk.EventBox;
229 	private import gtk.Expander;
230 	private import gtk.FileChooserButton;
231 	private import gtk.FileChooserDialog;
232 	private import gtk.FileChooserWidget;
233 	private import gtk.FileSelection;
234 	private import gtk.Fixed;
235 	private import gtk.FontButton;
236 	private import gtk.FontSelection;
237 	private import gtk.FontSelectionDialog;
238 	private import gtk.Frame;
239 	private import gtk.GammaCurve;
240 	private import gtk.HandleBox;
241 	private import gtk.HBox;
242 	private import gtk.HButtonBox;
243 	private import gtk.HPaned;
244 	private import gtk.HRuler;
245 	private import gtk.HScale;
246 	private import gtk.HScrollbar;
247 	private import gtk.HSeparator;
248 	private import gtk.IconView;
249 	private import gtk.Image;
250 	private import gtk.ImageMenuItem;
251 	private import gtk.InputDialog;
252 	private import gtk.Invisible;
253 	private import gtk.Item;
254 	private import gtk.Label;
255 	private import gtk.Layout;
256 	private import gtk.LinkButton;
257 	private import gtk.MenuBar;
258 	private import gtk.Menu;
259 	private import gtk.MenuItem;
260 	private import gtk.MenuShell;
261 	private import gtk.MenuToolButton;
262 	private import gtk.MessageDialog;
263 	private import gtk.Misc;
264 	private import gtk.Notebook;
265 	private import gtk.PageSetupUnixDialog;
266 	private import gtk.Paned;
267 	private import gtk.Plug;
268 	private import gtk.PrintUnixDialog;
269 	private import gtk.ProgressBar;
270 	private import gtk.Progress;
271 	private import gtk.RadioButton;
272 	private import gtk.RadioMenuItem;
273 	private import gtk.RadioToolButton;
274 	private import gtk.Range;
275 	private import gtk.RecentChooserDialog;
276 	private import gtk.RecentChooserMenu;
277 	private import gtk.RecentChooserWidget;
278 	private import gtk.Ruler;
279 	private import gtk.ScaleButton;
280 	private import gtk.Scale;
281 	private import gtk.Scrollbar;
282 	private import gtk.ScrolledWindow;
283 	private import gtk.Separator;
284 	private import gtk.SeparatorMenuItem;
285 	private import gtk.SeparatorToolItem;
286 	private import gtk.Socket;
287 	private import gtk.SpinButton;
288 	private import gtk.Statusbar;
289 	private import gtk.Table;
290 	private import gtk.TearoffMenuItem;
291 	private import gtk.TextView;
292 	private import gtk.ToggleButton;
293 	private import gtk.ToggleToolButton;
294 	private import gtk.Toolbar;
295 	private import gtk.ToolButton;
296 	private import gtk.ToolItem;
297 	private import gtk.TreeView;
298 	private import gtk.VBox;
299 	private import gtk.VButtonBox;
300 	private import gtk.Viewport;
301 	private import gtk.VolumeButton;
302 	private import gtk.VPaned;
303 	private import gtk.VRuler;
304 	private import gtk.VScale;
305 	private import gtk.VScrollbar;
306 	private import gtk.VSeparator;
307 	private import gtk.Widget;
308 	private import gtk.Window;
309 	
310 	/**
311 	 * Utilitiy method to create objects that are castable.
312 	 *
313 	 */
314 	Widget newFromWidget(GtkWidget* ptr)
315 	{
316 		if (ptr is null) {
317 			return null;
318 		}
319 		
320 		GTypeInstance* gTypeInstance = cast(GTypeInstance*)(ptr);
321 		string tname = Type.name(gTypeInstance.gClass.gType);
322 		
323 		switch(tname) {
324 			case "GtkAboutDialog": return new AboutDialog(cast(GtkAboutDialog *)ptr);
325 			case "GtkAccelLabel": return new AccelLabel(cast(GtkAccelLabel *)ptr);
326 			case "GtkAlignment": return new Alignment(cast(GtkAlignment *)ptr);
327 			case "GtkArrow": return new Arrow(cast(GtkArrow *)ptr);
328 			case "GtkAspectFrame": return new AspectFrame(cast(GtkAspectFrame *)ptr);
329 			case "GtkAssistant": return new Assistant(cast(GtkAssistant *)ptr);
330 			case "GtkBin": return new Bin(cast(GtkBin *)ptr);
331 			case "GtkBox": return new Box(cast(GtkBox *)ptr);
332 			case "GtkButtonBox": return new ButtonBox(cast(GtkButtonBox *)ptr);
333 			case "GtkButton": return new Button(cast(GtkButton *)ptr);
334 			case "GtkCalendar": return new Calendar(cast(GtkCalendar *)ptr);
335 			case "GtkCellView": return new CellView(cast(GtkCellView *)ptr);
336 			case "GtkCheckButton": return new CheckButton(cast(GtkCheckButton *)ptr);
337 			case "GtkCheckMenuItem": return new CheckMenuItem(cast(GtkCheckMenuItem *)ptr);
338 			case "GtkColorButton": return new ColorButton(cast(GtkColorButton *)ptr);
339 			case "GtkColorSelection": return new ColorSelection(cast(GtkColorSelection *)ptr);
340 			case "GtkColorSelectionDialog": return new ColorSelectionDialog(cast(GtkColorSelectionDialog *)ptr);
341 			case "GtkComboBox": return new ComboBox(cast(GtkComboBox *)ptr);
342 			case "GtkComboBoxEntry": return new ComboBoxEntry(cast(GtkComboBoxEntry *)ptr);
343 			case "GtkContainer": return new Container(cast(GtkContainer *)ptr);
344 			case "GtkCurve": return new Curve(cast(GtkCurve *)ptr);
345 			case "GtkDialog": return new Dialog(cast(GtkDialog *)ptr);
346 			case "GtkDrawingArea": return new DrawingArea(cast(GtkDrawingArea *)ptr);
347 			case "GtkEntry": return new Entry(cast(GtkEntry *)ptr);
348 			case "GtkEventBox": return new EventBox(cast(GtkEventBox *)ptr);
349 			case "GtkExpander": return new Expander(cast(GtkExpander *)ptr);
350 			case "GtkFileChooserButton": return new FileChooserButton(cast(GtkFileChooserButton *)ptr);
351 			case "GtkFileChooserDialog": return new FileChooserDialog(cast(GtkFileChooserDialog *)ptr);
352 			case "GtkFileChooserWidget": return new FileChooserWidget(cast(GtkFileChooserWidget *)ptr);
353 			case "GtkFileSelection": return new FileSelection(cast(GtkFileSelection *)ptr);
354 			case "GtkFixed": return new Fixed(cast(GtkFixed *)ptr);
355 			case "GtkFontButton": return new FontButton(cast(GtkFontButton *)ptr);
356 			case "GtkFontSelection": return new FontSelection(cast(GtkFontSelection *)ptr);
357 			case "GtkFontSelectionDialog": return new FontSelectionDialog(cast(GtkFontSelectionDialog *)ptr);
358 			case "GtkFrame": return new Frame(cast(GtkFrame *)ptr);
359 			case "GtkGammaCurve": return new GammaCurve(cast(GtkGammaCurve *)ptr);
360 			case "GtkHandleBox": return new HandleBox(cast(GtkHandleBox *)ptr);
361 			case "GtkHBox": return new HBox(cast(GtkHBox *)ptr);
362 			case "GtkHButtonBox": return new HButtonBox(cast(GtkHButtonBox *)ptr);
363 			case "GtkHPaned": return new HPaned(cast(GtkHPaned *)ptr);
364 			case "GtkHRuler": return new HRuler(cast(GtkHRuler *)ptr);
365 			case "GtkHScale": return new HScale(cast(GtkHScale *)ptr);
366 			case "GtkHScrollbar": return new HScrollbar(cast(GtkHScrollbar *)ptr);
367 			case "GtkHSeparator": return new HSeparator(cast(GtkHSeparator *)ptr);
368 			case "GtkIconView": return new IconView(cast(GtkIconView *)ptr);
369 			case "GtkImage": return new Image(cast(GtkImage *)ptr);
370 			case "GtkImageMenuItem": return new ImageMenuItem(cast(GtkImageMenuItem *)ptr);
371 			case "GtkInputDialog": return new InputDialog(cast(GtkInputDialog *)ptr);
372 			case "GtkInvisible": return new Invisible(cast(GtkInvisible *)ptr);
373 			case "GtkItem": return new Item(cast(GtkItem *)ptr);
374 			case "GtkLabel": return new Label(cast(GtkLabel *)ptr);
375 			case "GtkLayout": return new Layout(cast(GtkLayout *)ptr);
376 			case "GtkLinkButton": return new LinkButton(cast(GtkLinkButton *)ptr);
377 			case "GtkMenuBar": return new MenuBar(cast(GtkMenuBar *)ptr);
378 			case "GtkMenu": return new Menu(cast(GtkMenu *)ptr);
379 			case "GtkMenuItem": return new MenuItem(cast(GtkMenuItem *)ptr);
380 			case "GtkMenuShell": return new MenuShell(cast(GtkMenuShell *)ptr);
381 			case "GtkMenuToolButton": return new MenuToolButton(cast(GtkMenuToolButton *)ptr);
382 			case "GtkMessageDialog": return new MessageDialog(cast(GtkMessageDialog *)ptr);
383 			case "GtkMisc": return new Misc(cast(GtkMisc *)ptr);
384 			case "GtkNotebook": return new Notebook(cast(GtkNotebook *)ptr);
385 			case "GtkPageSetupUnixDialog": return new PageSetupUnixDialog(cast(GtkPageSetupUnixDialog *)ptr);
386 			case "GtkPaned": return new Paned(cast(GtkPaned *)ptr);
387 			case "GtkPlug": return new Plug(cast(GtkPlug *)ptr);
388 			case "GtkPrintUnixDialog": return new PrintUnixDialog(cast(GtkPrintUnixDialog *)ptr);
389 			case "GtkProgressBar": return new ProgressBar(cast(GtkProgressBar *)ptr);
390 			case "GtkProgress": return new Progress(cast(GtkProgress *)ptr);
391 			case "GtkRadioButton": return new RadioButton(cast(GtkRadioButton *)ptr);
392 			case "GtkRadioMenuItem": return new RadioMenuItem(cast(GtkRadioMenuItem *)ptr);
393 			case "GtkRadioToolButton": return new RadioToolButton(cast(GtkRadioToolButton *)ptr);
394 			case "GtkRange": return new Range(cast(GtkRange *)ptr);
395 			case "GtkRecentChooserDialog": return new RecentChooserDialog(cast(GtkRecentChooserDialog *)ptr);
396 			case "GtkRecentChooserMenu": return new RecentChooserMenu(cast(GtkRecentChooserMenu *)ptr);
397 			case "GtkRecentChooserWidget": return new RecentChooserWidget(cast(GtkRecentChooserWidget *)ptr);
398 			case "GtkRuler": return new Ruler(cast(GtkRuler *)ptr);
399 			case "GtkScaleButton": return new ScaleButton(cast(GtkScaleButton *)ptr);
400 			case "GtkScale": return new Scale(cast(GtkScale *)ptr);
401 			case "GtkScrollbar": return new Scrollbar(cast(GtkScrollbar *)ptr);
402 			case "GtkScrolledWindow": return new ScrolledWindow(cast(GtkScrolledWindow *)ptr);
403 			case "GtkSeparator": return new Separator(cast(GtkSeparator *)ptr);
404 			case "GtkSeparatorMenuItem": return new SeparatorMenuItem(cast(GtkSeparatorMenuItem *)ptr);
405 			case "GtkSeparatorToolItem": return new SeparatorToolItem(cast(GtkSeparatorToolItem *)ptr);
406 			case "GtkSocket": return new Socket(cast(GtkSocket *)ptr);
407 			case "GtkSpinButton": return new SpinButton(cast(GtkSpinButton *)ptr);
408 			case "GtkStatusbar": return new Statusbar(cast(GtkStatusbar *)ptr);
409 			case "GtkTable": return new Table(cast(GtkTable *)ptr);
410 			case "GtkTearoffMenuItem": return new TearoffMenuItem(cast(GtkTearoffMenuItem *)ptr);
411 			case "GtkTextView": return new TextView(cast(GtkTextView *)ptr);
412 			case "GtkToggleButton": return new ToggleButton(cast(GtkToggleButton *)ptr);
413 			case "GtkToggleToolButton": return new ToggleToolButton(cast(GtkToggleToolButton *)ptr);
414 			case "GtkToolbar": return new Toolbar(cast(GtkToolbar *)ptr);
415 			case "GtkToolButton": return new ToolButton(cast(GtkToolButton *)ptr);
416 			case "GtkToolItem": return new ToolItem(cast(GtkToolItem *)ptr);
417 			case "GtkTreeView": return new TreeView(cast(GtkTreeView *)ptr);
418 			case "GtkVBox": return new VBox(cast(GtkVBox *)ptr);
419 			case "GtkVButtonBox": return new VButtonBox(cast(GtkVButtonBox *)ptr);
420 			case "GtkViewport": return new Viewport(cast(GtkViewport *)ptr);
421 			case "GtkVolumeButton": return new VolumeButton(cast(GtkVolumeButton *)ptr);
422 			case "GtkVPaned": return new VPaned(cast(GtkVPaned *)ptr);
423 			case "GtkVRuler": return new VRuler(cast(GtkVRuler *)ptr);
424 			case "GtkVScale": return new VScale(cast(GtkVScale *)ptr);
425 			case "GtkVScrollbar": return new VScrollbar(cast(GtkVScrollbar *)ptr);
426 			case "GtkVSeparator": return new VSeparator(cast(GtkVSeparator *)ptr);
427 			case "GtkWidget": return new Widget(cast(GtkWidget *)ptr);
428 			case "GtkWindow": return new Window(cast(GtkWindow *)ptr);
429 			default: return null;
430 		}
431 		
432 	}
433 	
434 	
435 	/**
436 	 * Description
437 	 * These routines are used to initialise libglade, and to load addon modules
438 	 * that recognise extra widget sets. The glade_init
439 	 * routine must be called before any libglade routines are used, and the
440 	 * glade_load_module routine would be used to load
441 	 * extra modules.
442 	 */
443 	
444 	/**
445 	 * Creates a new GladeXML object (and the corresponding widgets) from the
446 	 * buffer buffer. Optionally it will only build the interface from the
447 	 * widget node root (if it is not NULL). This feature is useful if you
448 	 * only want to build say a toolbar or menu from the XML document, but not the
449 	 * window it is embedded in.
450 	 * Params:
451 	 * buffer = the memory buffer containing the XML document.
452 	 * size = the size of the buffer.
453 	 * root = the widget node in buffer to start building from (or NULL)
454 	 * domain = the translation domain to use for this interface (or NULL)
455 	 * Throws: ConstructionException GTK+ fails to create the object.
456 	 */
457 	public this (string buffer, int size, string root, string domain)
458 	{
459 		// GladeXML* glade_xml_new_from_buffer (const char *buffer,  int size,  const char *root,  const char *domain);
460 		auto p = glade_xml_new_from_buffer(Str.toStringz(buffer), size, Str.toStringz(root), Str.toStringz(domain));
461 		if(p is null)
462 		{
463 			throw new ConstructionException("null returned by glade_xml_new_from_buffer(Str.toStringz(buffer), size, Str.toStringz(root), Str.toStringz(domain))");
464 		}
465 		this(cast(GladeXML*) p);
466 	}
467 	
468 	/**
469 	 * This routine can be used by bindings (such as gtk--) to help construct
470 	 * a GladeXML object, if it is needed.
471 	 * Params:
472 	 * fname = the XML filename
473 	 * root = the root widget node (or NULL for none)
474 	 * domain = the translation domain (or NULL for the default)
475 	 * Returns: TRUE if the construction succeeded.
476 	 */
477 	public int construct(string fname, string root, string domain)
478 	{
479 		// gboolean glade_xml_construct (GladeXML *self,  const char *fname,  const char *root,  const char *domain);
480 		return glade_xml_construct(gladeXML, Str.toStringz(fname), Str.toStringz(root), Str.toStringz(domain));
481 	}
482 	
483 	/**
484 	 * Used to get the name of a widget that was generated by a GladeXML object.
485 	 * Params:
486 	 * widget = the widget
487 	 * Returns: the name of the widget.
488 	 */
489 	public static string gladeGetWidgetName(Widget widget)
490 	{
491 		// const char* glade_get_widget_name (GtkWidget *widget);
492 		return Str.toString(glade_get_widget_name((widget is null) ? null : widget.getWidgetStruct()));
493 	}
494 	
495 	/**
496 	 * This function is used to get the GladeXML object that built this widget.
497 	 * Params:
498 	 * widget = the widget
499 	 * Returns: the GladeXML object that built this widget.
500 	 */
501 	public static Glade gladeGetWidgetTree(Widget widget)
502 	{
503 		// GladeXML* glade_get_widget_tree (GtkWidget *widget);
504 		auto p = glade_get_widget_tree((widget is null) ? null : widget.getWidgetStruct());
505 		
506 		if(p is null)
507 		{
508 			return null;
509 		}
510 		
511 		return ObjectG.getDObject!(Glade)(cast(GladeXML*) p);
512 	}
513 	
514 	/**
515 	 * It used to be necessary to call glade_init() before creating
516 	 * GladeXML objects. This is now no longer the case, as libglade will
517 	 * be initialised on demand now. Calling glade_init() manually will
518 	 * not cause any problems though.
519 	 */
520 	public static void init()
521 	{
522 		// void glade_init (void);
523 		glade_init();
524 	}
525 	
526 	/**
527 	 * Ensure that a required library is available. If it is not already
528 	 * available, libglade will attempt to dynamically load a module that
529 	 * contains the handlers for that library.
530 	 * Params:
531 	 * library = the required library
532 	 */
533 	public static void require(string library)
534 	{
535 		// void glade_require (const gchar *library);
536 		glade_require(Str.toStringz(library));
537 	}
538 	
539 	/**
540 	 * This function should be called by a module to assert that it
541 	 * provides wrappers for a particular library. This should be called
542 	 * by the register_widgets() function of a libglade module so that it
543 	 * isn't loaded twice, for instance.
544 	 * Params:
545 	 * library = the provided library
546 	 */
547 	public static void provide(string library)
548 	{
549 		// void glade_provide (const gchar *library);
550 		glade_provide(Str.toStringz(library));
551 	}
552 }