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  = GtkUIManager.html
27  * outPack = gtk
28  * outFile = UIManager
29  * strct   = GtkUIManager
30  * realStrct=
31  * ctorStrct=
32  * clss    = UIManager
33  * interf  = 
34  * class Code: Yes
35  * interface Code: No
36  * template for:
37  * extend  = 
38  * implements:
39  * 	- BuildableIF
40  * prefixes:
41  * 	- gtk_ui_manager_
42  * omit structs:
43  * omit prefixes:
44  * omit code:
45  * omit signals:
46  * imports:
47  * 	- glib.Str
48  * 	- glib.ErrorG
49  * 	- glib.GException
50  * 	- glib.ListG
51  * 	- glib.ListSG
52  * 	- gtk.Action
53  * 	- gtk.ActionGroup
54  * 	- gtk.AccelGroup
55  * 	- gtk.Widget
56  * 	- gtk.BuildableIF
57  * 	- gtk.BuildableT
58  * structWrap:
59  * 	- GList* -> ListG
60  * 	- GSList* -> ListSG
61  * 	- GtkAccelGroup* -> AccelGroup
62  * 	- GtkAction* -> Action
63  * 	- GtkActionGroup* -> ActionGroup
64  * 	- GtkWidget* -> Widget
65  * module aliases:
66  * local aliases:
67  * overrides:
68  */
69 
70 module gtk.UIManager;
71 
72 public  import gtkc.gtktypes;
73 
74 private import gtkc.gtk;
75 private import glib.ConstructionException;
76 private import gobject.ObjectG;
77 
78 private import gobject.Signals;
79 public  import gtkc.gdktypes;
80 
81 private import glib.Str;
82 private import glib.ErrorG;
83 private import glib.GException;
84 private import glib.ListG;
85 private import glib.ListSG;
86 private import gtk.Action;
87 private import gtk.ActionGroup;
88 private import gtk.AccelGroup;
89 private import gtk.Widget;
90 private import gtk.BuildableIF;
91 private import gtk.BuildableT;
92 
93 
94 
95 private import gobject.ObjectG;
96 
97 /**
98  * A GtkUIManager constructs a user interface (menus and toolbars) from
99  * one or more UI definitions, which reference actions from one or more
100  * action groups.
101  *
102  * UI Definitions
103  *
104  * The UI definitions are specified in an XML format which can be
105  * roughly described by the following DTD.
106  *
107  * Note
108  *
109  * Do not confuse the GtkUIManager UI Definitions described here with
110  * the similarly named GtkBuilder UI
111  * Definitions.
112  *
113  * <!ELEMENT ui (menubar|toolbar|popup|accelerator)* >
114  * <!ELEMENT menubar (menuitem|separator|placeholder|menu)* >
115  * <!ELEMENT menu (menuitem|separator|placeholder|menu)* >
116  * <!ELEMENT popup (menuitem|separator|placeholder|menu)* >
117  * <!ELEMENT toolbar (toolitem|separator|placeholder)* >
118  * <!ELEMENT placeholder (menuitem|toolitem|separator|placeholder|menu)* >
119  * <!ELEMENT menuitem EMPTY >
120  * <!ELEMENT toolitem (menu?) >
121  * <!ELEMENT separator EMPTY >
122  * <!ELEMENT accelerator EMPTY >
123  * <!ATTLIST menubar name #IMPLIED
124  *  action #IMPLIED >
125  * <!ATTLIST toolbar name #IMPLIED
126  *  action #IMPLIED >
127  * <!ATTLIST popup name #IMPLIED
128  *  action #IMPLIED
129  *  accelerators (true|false) #IMPLIED >
130  * <!ATTLIST placeholder name #IMPLIED
131  *  action #IMPLIED >
132  * <!ATTLIST separator name #IMPLIED
133  *  action #IMPLIED
134  *  expand (true|false) #IMPLIED >
135  * <!ATTLIST menu name #IMPLIED
136  *  action #REQUIRED
137  *  position (top|bot) #IMPLIED >
138  * <!ATTLIST menuitem name #IMPLIED
139  *  action #REQUIRED
140  *  position (top|bot) #IMPLIED
141  *  always-show-image (true|false) #IMPLIED >
142  * <!ATTLIST toolitem name #IMPLIED
143  *  action #REQUIRED
144  *  position (top|bot) #IMPLIED >
145  * <!ATTLIST accelerator name #IMPLIED
146  *  action #REQUIRED >
147  *
148  * There are some additional restrictions beyond those specified in the
149  * DTD, e.g. every toolitem must have a toolbar in its anchestry and
150  * every menuitem must have a menubar or popup in its anchestry. Since
151  * a GMarkup parser is used to parse the UI description, it must not only
152  * be valid XML, but valid GMarkup.
153  *
154  * If a name is not specified, it defaults to the action. If an action is
155  * not specified either, the element name is used. The name and action
156  * attributes must not contain '/' characters after parsing (since that
157  * would mess up path lookup) and must be usable as XML attributes when
158  * enclosed in doublequotes, thus they must not '"' characters or references
159  * to the " entity.
160  *
161  * $(DDOC_COMMENT example)
162  *
163  * The constructed widget hierarchy is very similar to the element tree
164  * of the XML, with the exception that placeholders are merged into their
165  * parents. The correspondence of XML elements to widgets should be
166  * almost obvious:
167  *
168  * menubar
169  *
170  * a GtkMenuBar
171  *
172  * toolbar
173  *
174  * a GtkToolbar
175  *
176  * popup
177  *
178  * a toplevel GtkMenu
179  *
180  * menu
181  *
182  * a GtkMenu attached to a menuitem
183  *
184  * menuitem
185  *
186  * a GtkMenuItem subclass, the exact type depends on the
187  * action
188  *
189  * toolitem
190  *
191  * a GtkToolItem subclass, the exact type depends on the
192  * action. Note that toolitem elements may contain a menu element, but only
193  * if their associated action specifies a GtkMenuToolButton as proxy.
194  *
195  * separator
196  *
197  * a GtkSeparatorMenuItem or
198  * GtkSeparatorToolItem
199  *
200  * accelerator
201  *
202  * a keyboard accelerator
203  *
204  * The "position" attribute determines where a constructed widget is positioned
205  * wrt. to its siblings in the partially constructed tree. If it is
206  * "top", the widget is prepended, otherwise it is appended.
207  *
208  * <hr>
209  *
210  * UI Merging
211  *
212  * The most remarkable feature of GtkUIManager is that it can overlay a set
213  * of menuitems and toolitems over another one, and demerge them later.
214  *
215  * Merging is done based on the names of the XML elements. Each element is
216  * identified by a path which consists of the names of its anchestors, separated
217  * by slashes. For example, the menuitem named "Left" in the example above
218  * has the path /ui/menubar/JustifyMenu/Left and the
219  * toolitem with the same name has path
220  * /ui/toolbar1/JustifyToolItems/Left.
221  *
222  * <hr>
223  *
224  * Accelerators
225  *
226  * Every action has an accelerator path. Accelerators are installed together with
227  * menuitem proxies, but they can also be explicitly added with &lt;accelerator&gt;
228  * elements in the UI definition. This makes it possible to have accelerators for
229  * actions even if they have no visible proxies.
230  *
231  * <hr>
232  *
233  * Smart Separators
234  *
235  * The separators created by GtkUIManager are "smart", i.e. they do not show up
236  * in the UI unless they end up between two visible menu or tool items. Separators
237  * which are located at the very beginning or end of the menu or toolbar
238  * containing them, or multiple separators next to each other, are hidden. This
239  * is a useful feature, since the merging of UI elements from multiple sources
240  * can make it hard or impossible to determine in advance whether a separator
241  * will end up in such an unfortunate position.
242  *
243  * For separators in toolbars, you can set expand="true" to
244  * turn them from a small, visible separator to an expanding, invisible one.
245  * Toolitems following an expanding separator are effectively right-aligned.
246  *
247  * <hr>
248  *
249  * Empty Menus
250  *
251  * Submenus pose similar problems to separators inconnection with merging. It is
252  * impossible to know in advance whether they will end up empty after merging.
253  * GtkUIManager offers two ways to treat empty submenus:
254  *
255  * make them disappear by hiding the menu item they're attached to
256  *
257  * add an insensitive "Empty" item
258  *
259  * The behaviour is chosen based on the "hide_if_empty" property of the action
260  * to which the submenu is associated.
261  *
262  * <hr>
263  *
264  * GtkUIManager as GtkBuildable
265  *
266  * The GtkUIManager implementation of the GtkBuildable interface accepts
267  * GtkActionGroup objects as &lt;child&gt; elements in UI definitions.
268  *
269  * A GtkUIManager UI definition as described above can be embedded in
270  * an GtkUIManager &lt;object&gt; element in a GtkBuilder UI definition.
271  *
272  * The widgets that are constructed by a GtkUIManager can be embedded in
273  * other parts of the constructed user interface with the help of the
274  * "constructor" attribute. See the example below.
275  *
276  * $(DDOC_COMMENT example)
277  */
278 public class UIManager : ObjectG, BuildableIF
279 {
280 	
281 	/** the main Gtk struct */
282 	protected GtkUIManager* gtkUIManager;
283 	
284 	
285 	public GtkUIManager* getUIManagerStruct()
286 	{
287 		return gtkUIManager;
288 	}
289 	
290 	
291 	/** the main Gtk struct as a void* */
292 	protected override void* getStruct()
293 	{
294 		return cast(void*)gtkUIManager;
295 	}
296 	
297 	/**
298 	 * Sets our main struct and passes it to the parent class
299 	 */
300 	public this (GtkUIManager* gtkUIManager)
301 	{
302 		super(cast(GObject*)gtkUIManager);
303 		this.gtkUIManager = gtkUIManager;
304 	}
305 	
306 	protected override void setStruct(GObject* obj)
307 	{
308 		super.setStruct(obj);
309 		gtkUIManager = cast(GtkUIManager*)obj;
310 	}
311 	
312 	// add the Buildable capabilities
313 	mixin BuildableT!(GtkUIManager);
314 	
315 	/**
316 	 */
317 	int[string] connectedSignals;
318 	
319 	void delegate(UIManager)[] onActionsChangedListeners;
320 	/**
321 	 * Warning
322 	 * GtkUIManager::actions-changed is deprecated and should not be used in newly-written code. 3.10
323 	 * The ::actions-changed signal is emitted whenever the set of actions
324 	 * changes.
325 	 * Since 2.4
326 	 */
327 	void addOnActionsChanged(void delegate(UIManager) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
328 	{
329 		if ( !("actions-changed" in connectedSignals) )
330 		{
331 			Signals.connectData(
332 			getStruct(),
333 			"actions-changed",
334 			cast(GCallback)&callBackActionsChanged,
335 			cast(void*)this,
336 			null,
337 			connectFlags);
338 			connectedSignals["actions-changed"] = 1;
339 		}
340 		onActionsChangedListeners ~= dlg;
341 	}
342 	extern(C) static void callBackActionsChanged(GtkUIManager* managerStruct, UIManager _uIManager)
343 	{
344 		foreach ( void delegate(UIManager) dlg ; _uIManager.onActionsChangedListeners )
345 		{
346 			dlg(_uIManager);
347 		}
348 	}
349 	
350 	void delegate(Widget, UIManager)[] onAddWidgetListeners;
351 	/**
352 	 * Warning
353 	 * GtkUIManager::add-widget is deprecated and should not be used in newly-written code. 3.10
354 	 * The ::add-widget signal is emitted for each generated menubar and toolbar.
355 	 * It is not emitted for generated popup menus, which can be obtained by
356 	 * gtk_ui_manager_get_widget().
357 	 * Since 2.4
358 	 */
359 	void addOnAddWidget(void delegate(Widget, UIManager) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
360 	{
361 		if ( !("add-widget" in connectedSignals) )
362 		{
363 			Signals.connectData(
364 			getStruct(),
365 			"add-widget",
366 			cast(GCallback)&callBackAddWidget,
367 			cast(void*)this,
368 			null,
369 			connectFlags);
370 			connectedSignals["add-widget"] = 1;
371 		}
372 		onAddWidgetListeners ~= dlg;
373 	}
374 	extern(C) static void callBackAddWidget(GtkUIManager* managerStruct, GtkWidget* widget, UIManager _uIManager)
375 	{
376 		foreach ( void delegate(Widget, UIManager) dlg ; _uIManager.onAddWidgetListeners )
377 		{
378 			dlg(ObjectG.getDObject!(Widget)(widget), _uIManager);
379 		}
380 	}
381 	
382 	void delegate(Action, Widget, UIManager)[] onConnectProxyListeners;
383 	/**
384 	 * Warning
385 	 * GtkUIManager::connect-proxy is deprecated and should not be used in newly-written code. 3.10
386 	 * The ::connect-proxy signal is emitted after connecting a proxy to
387 	 * an action in the group.
388 	 * This is intended for simple customizations for which a custom action
389 	 * class would be too clumsy, e.g. showing tooltips for menuitems in the
390 	 * statusbar.
391 	 * Since 2.4
392 	 */
393 	void addOnConnectProxy(void delegate(Action, Widget, UIManager) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
394 	{
395 		if ( !("connect-proxy" in connectedSignals) )
396 		{
397 			Signals.connectData(
398 			getStruct(),
399 			"connect-proxy",
400 			cast(GCallback)&callBackConnectProxy,
401 			cast(void*)this,
402 			null,
403 			connectFlags);
404 			connectedSignals["connect-proxy"] = 1;
405 		}
406 		onConnectProxyListeners ~= dlg;
407 	}
408 	extern(C) static void callBackConnectProxy(GtkUIManager* managerStruct, GtkAction* action, GtkWidget* proxy, UIManager _uIManager)
409 	{
410 		foreach ( void delegate(Action, Widget, UIManager) dlg ; _uIManager.onConnectProxyListeners )
411 		{
412 			dlg(ObjectG.getDObject!(Action)(action), ObjectG.getDObject!(Widget)(proxy), _uIManager);
413 		}
414 	}
415 	
416 	void delegate(Action, Widget, UIManager)[] onDisconnectProxyListeners;
417 	/**
418 	 * Warning
419 	 * GtkUIManager::disconnect-proxy is deprecated and should not be used in newly-written code. 3.10
420 	 * The ::disconnect-proxy signal is emitted after disconnecting a proxy
421 	 * from an action in the group.
422 	 * Since 2.4
423 	 */
424 	void addOnDisconnectProxy(void delegate(Action, Widget, UIManager) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
425 	{
426 		if ( !("disconnect-proxy" in connectedSignals) )
427 		{
428 			Signals.connectData(
429 			getStruct(),
430 			"disconnect-proxy",
431 			cast(GCallback)&callBackDisconnectProxy,
432 			cast(void*)this,
433 			null,
434 			connectFlags);
435 			connectedSignals["disconnect-proxy"] = 1;
436 		}
437 		onDisconnectProxyListeners ~= dlg;
438 	}
439 	extern(C) static void callBackDisconnectProxy(GtkUIManager* managerStruct, GtkAction* action, GtkWidget* proxy, UIManager _uIManager)
440 	{
441 		foreach ( void delegate(Action, Widget, UIManager) dlg ; _uIManager.onDisconnectProxyListeners )
442 		{
443 			dlg(ObjectG.getDObject!(Action)(action), ObjectG.getDObject!(Widget)(proxy), _uIManager);
444 		}
445 	}
446 	
447 	void delegate(Action, UIManager)[] onPostActivateListeners;
448 	/**
449 	 * Warning
450 	 * GtkUIManager::post-activate is deprecated and should not be used in newly-written code. 3.10
451 	 * The ::post-activate signal is emitted just after the action
452 	 * is activated.
453 	 * This is intended for applications to get notification
454 	 * just after any action is activated.
455 	 * Since 2.4
456 	 */
457 	void addOnPostActivate(void delegate(Action, UIManager) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
458 	{
459 		if ( !("post-activate" in connectedSignals) )
460 		{
461 			Signals.connectData(
462 			getStruct(),
463 			"post-activate",
464 			cast(GCallback)&callBackPostActivate,
465 			cast(void*)this,
466 			null,
467 			connectFlags);
468 			connectedSignals["post-activate"] = 1;
469 		}
470 		onPostActivateListeners ~= dlg;
471 	}
472 	extern(C) static void callBackPostActivate(GtkUIManager* managerStruct, GtkAction* action, UIManager _uIManager)
473 	{
474 		foreach ( void delegate(Action, UIManager) dlg ; _uIManager.onPostActivateListeners )
475 		{
476 			dlg(ObjectG.getDObject!(Action)(action), _uIManager);
477 		}
478 	}
479 	
480 	void delegate(Action, UIManager)[] onPreActivateListeners;
481 	/**
482 	 * Warning
483 	 * GtkUIManager::pre-activate is deprecated and should not be used in newly-written code. 3.10
484 	 * The ::pre-activate signal is emitted just before the action
485 	 * is activated.
486 	 * This is intended for applications to get notification
487 	 * just before any action is activated.
488 	 * Since 2.4
489 	 * See Also
490 	 * GtkBuilder
491 	 */
492 	void addOnPreActivate(void delegate(Action, UIManager) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
493 	{
494 		if ( !("pre-activate" in connectedSignals) )
495 		{
496 			Signals.connectData(
497 			getStruct(),
498 			"pre-activate",
499 			cast(GCallback)&callBackPreActivate,
500 			cast(void*)this,
501 			null,
502 			connectFlags);
503 			connectedSignals["pre-activate"] = 1;
504 		}
505 		onPreActivateListeners ~= dlg;
506 	}
507 	extern(C) static void callBackPreActivate(GtkUIManager* managerStruct, GtkAction* action, UIManager _uIManager)
508 	{
509 		foreach ( void delegate(Action, UIManager) dlg ; _uIManager.onPreActivateListeners )
510 		{
511 			dlg(ObjectG.getDObject!(Action)(action), _uIManager);
512 		}
513 	}
514 	
515 	
516 	/**
517 	 * Warning
518 	 * gtk_ui_manager_new is deprecated and should not be used in newly-written code. 3.10
519 	 * Creates a new ui manager object.
520 	 * Since 2.4
521 	 * Throws: ConstructionException GTK+ fails to create the object.
522 	 */
523 	public this ()
524 	{
525 		// GtkUIManager * gtk_ui_manager_new (void);
526 		auto p = gtk_ui_manager_new();
527 		if(p is null)
528 		{
529 			throw new ConstructionException("null returned by gtk_ui_manager_new()");
530 		}
531 		this(cast(GtkUIManager*) p);
532 	}
533 	
534 	/**
535 	 * Warning
536 	 * gtk_ui_manager_set_add_tearoffs has been deprecated since version 3.4 and should not be used in newly-written code. Tearoff menus are deprecated and should not
537 	 *  be used in newly written code.
538 	 * Sets the "add_tearoffs" property, which controls whether menus
539 	 * generated by this GtkUIManager will have tearoff menu items.
540 	 * Note that this only affects regular menus. Generated popup
541 	 * menus never have tearoff menu items.
542 	 * Since 2.4
543 	 * Params:
544 	 * addTearoffs = whether tearoff menu items are added
545 	 */
546 	public void setAddTearoffs(int addTearoffs)
547 	{
548 		// void gtk_ui_manager_set_add_tearoffs (GtkUIManager *manager,  gboolean add_tearoffs);
549 		gtk_ui_manager_set_add_tearoffs(gtkUIManager, addTearoffs);
550 	}
551 	
552 	/**
553 	 * Warning
554 	 * gtk_ui_manager_get_add_tearoffs has been deprecated since version 3.4 and should not be used in newly-written code. Tearoff menus are deprecated and should not
555 	 *  be used in newly written code.
556 	 * Returns whether menus generated by this GtkUIManager
557 	 * will have tearoff menu items.
558 	 * Since 2.4
559 	 * Returns: whether tearoff menu items are added
560 	 */
561 	public int getAddTearoffs()
562 	{
563 		// gboolean gtk_ui_manager_get_add_tearoffs (GtkUIManager *manager);
564 		return gtk_ui_manager_get_add_tearoffs(gtkUIManager);
565 	}
566 	
567 	/**
568 	 * Warning
569 	 * gtk_ui_manager_insert_action_group is deprecated and should not be used in newly-written code. 3.10
570 	 * Inserts an action group into the list of action groups associated
571 	 * with manager. Actions in earlier groups hide actions with the same
572 	 * name in later groups.
573 	 * If pos is larger than the number of action groups in manager, or
574 	 * negative, action_group will be inserted at the end of the internal
575 	 * list.
576 	 * Since 2.4
577 	 * Params:
578 	 * actionGroup = the action group to be inserted
579 	 * pos = the position at which the group will be inserted.
580 	 */
581 	public void insertActionGroup(ActionGroup actionGroup, int pos)
582 	{
583 		// void gtk_ui_manager_insert_action_group (GtkUIManager *manager,  GtkActionGroup *action_group,  gint pos);
584 		gtk_ui_manager_insert_action_group(gtkUIManager, (actionGroup is null) ? null : actionGroup.getActionGroupStruct(), pos);
585 	}
586 	
587 	/**
588 	 * Warning
589 	 * gtk_ui_manager_remove_action_group is deprecated and should not be used in newly-written code. 3.10
590 	 * Removes an action group from the list of action groups associated
591 	 * with manager.
592 	 * Since 2.4
593 	 * Params:
594 	 * actionGroup = the action group to be removed
595 	 */
596 	public void removeActionGroup(ActionGroup actionGroup)
597 	{
598 		// void gtk_ui_manager_remove_action_group (GtkUIManager *manager,  GtkActionGroup *action_group);
599 		gtk_ui_manager_remove_action_group(gtkUIManager, (actionGroup is null) ? null : actionGroup.getActionGroupStruct());
600 	}
601 	
602 	/**
603 	 * Warning
604 	 * gtk_ui_manager_get_action_groups is deprecated and should not be used in newly-written code. 3.10
605 	 * Returns the list of action groups associated with manager.
606 	 * Since 2.4
607 	 * Returns: a GList of action groups. The list is owned by GTK+ and should not be modified. [element-type GtkActionGroup][transfer none]
608 	 */
609 	public ListG getActionGroups()
610 	{
611 		// GList * gtk_ui_manager_get_action_groups (GtkUIManager *manager);
612 		auto p = gtk_ui_manager_get_action_groups(gtkUIManager);
613 		
614 		if(p is null)
615 		{
616 			return null;
617 		}
618 		
619 		return ObjectG.getDObject!(ListG)(cast(GList*) p);
620 	}
621 	
622 	/**
623 	 * Warning
624 	 * gtk_ui_manager_get_accel_group is deprecated and should not be used in newly-written code. 3.10
625 	 * Returns the GtkAccelGroup associated with manager.
626 	 * Since 2.4
627 	 * Returns: the GtkAccelGroup. [transfer none]
628 	 */
629 	public AccelGroup getAccelGroup()
630 	{
631 		// GtkAccelGroup * gtk_ui_manager_get_accel_group (GtkUIManager *manager);
632 		auto p = gtk_ui_manager_get_accel_group(gtkUIManager);
633 		
634 		if(p is null)
635 		{
636 			return null;
637 		}
638 		
639 		return ObjectG.getDObject!(AccelGroup)(cast(GtkAccelGroup*) p);
640 	}
641 	
642 	/**
643 	 * Warning
644 	 * gtk_ui_manager_get_widget is deprecated and should not be used in newly-written code. 3.10
645 	 * Looks up a widget by following a path.
646 	 * The path consists of the names specified in the XML description of the UI.
647 	 * separated by '/'. Elements which don't have a name or action attribute in
648 	 * the XML (e.g. &lt;popup&gt;) can be addressed by their XML element name
649 	 * (e.g. "popup"). The root element ("/ui") can be omitted in the path.
650 	 * Note that the widget found by following a path that ends in a &lt;menu&gt;
651 	 * element is the menuitem to which the menu is attached, not the menu itmanager.
652 	 * Also note that the widgets constructed by a ui manager are not tied to
653 	 * the lifecycle of the ui manager. If you add the widgets returned by this
654 	 * function to some container or explicitly ref them, they will survive the
655 	 * destruction of the ui manager.
656 	 * Since 2.4
657 	 * Params:
658 	 * path = a path
659 	 * Returns: the widget found by following the path, or NULL if no widget was found. [transfer none]
660 	 */
661 	public Widget getWidget(string path)
662 	{
663 		// GtkWidget * gtk_ui_manager_get_widget (GtkUIManager *manager,  const gchar *path);
664 		auto p = gtk_ui_manager_get_widget(gtkUIManager, Str.toStringz(path));
665 		
666 		if(p is null)
667 		{
668 			return null;
669 		}
670 		
671 		return ObjectG.getDObject!(Widget)(cast(GtkWidget*) p);
672 	}
673 	
674 	/**
675 	 * Warning
676 	 * gtk_ui_manager_get_toplevels is deprecated and should not be used in newly-written code. 3.10
677 	 * Obtains a list of all toplevel widgets of the requested types.
678 	 * Since 2.4
679 	 * Params:
680 	 * types = specifies the types of toplevel widgets to include. Allowed
681 	 * types are GTK_UI_MANAGER_MENUBAR, GTK_UI_MANAGER_TOOLBAR and
682 	 * GTK_UI_MANAGER_POPUP.
683 	 * Returns: a newly-allocated GSList of all toplevel widgets of the requested types. Free the returned list with g_slist_free(). [element-type GtkWidget][transfer container]
684 	 */
685 	public ListSG getToplevels(GtkUIManagerItemType types)
686 	{
687 		// GSList * gtk_ui_manager_get_toplevels (GtkUIManager *manager,  GtkUIManagerItemType types);
688 		auto p = gtk_ui_manager_get_toplevels(gtkUIManager, types);
689 		
690 		if(p is null)
691 		{
692 			return null;
693 		}
694 		
695 		return ObjectG.getDObject!(ListSG)(cast(GSList*) p);
696 	}
697 	
698 	/**
699 	 * Warning
700 	 * gtk_ui_manager_get_action is deprecated and should not be used in newly-written code. 3.10
701 	 * Looks up an action by following a path. See gtk_ui_manager_get_widget()
702 	 * for more information about paths.
703 	 * Since 2.4
704 	 * Params:
705 	 * path = a path
706 	 * Returns: the action whose proxy widget is found by following the path, or NULL if no widget was found. [transfer none]
707 	 */
708 	public Action getAction(string path)
709 	{
710 		// GtkAction * gtk_ui_manager_get_action (GtkUIManager *manager,  const gchar *path);
711 		auto p = gtk_ui_manager_get_action(gtkUIManager, Str.toStringz(path));
712 		
713 		if(p is null)
714 		{
715 			return null;
716 		}
717 		
718 		return ObjectG.getDObject!(Action)(cast(GtkAction*) p);
719 	}
720 	
721 	/**
722 	 * Warning
723 	 * gtk_ui_manager_add_ui_from_resource is deprecated and should not be used in newly-written code. 3.10
724 	 * Parses a resource file containing a UI definition and
725 	 * merges it with the current contents of manager.
726 	 * Params:
727 	 * resourcePath = the resource path of the file to parse
728 	 * Returns: The merge id for the merged UI. The merge id can be used to unmerge the UI with gtk_ui_manager_remove_ui(). If an error occurred, the return value is 0. Since 3.4
729 	 * Throws: GException on failure.
730 	 */
731 	public uint addUiFromResource(string resourcePath)
732 	{
733 		// guint gtk_ui_manager_add_ui_from_resource (GtkUIManager *manager,  const gchar *resource_path,  GError **error);
734 		GError* err = null;
735 		
736 		auto p = gtk_ui_manager_add_ui_from_resource(gtkUIManager, Str.toStringz(resourcePath), &err);
737 		
738 		if (err !is null)
739 		{
740 			throw new GException( new ErrorG(err) );
741 		}
742 		
743 		return p;
744 	}
745 	
746 	/**
747 	 * Warning
748 	 * gtk_ui_manager_add_ui_from_string is deprecated and should not be used in newly-written code. 3.10
749 	 * Parses a string containing a UI definition and
750 	 * merges it with the current contents of manager. An enclosing &lt;ui&gt;
751 	 * element is added if it is missing.
752 	 * Since 2.4
753 	 * Params:
754 	 * buffer = the string to parse
755 	 * Returns: The merge id for the merged UI. The merge id can be used to unmerge the UI with gtk_ui_manager_remove_ui(). If an error occurred, the return value is 0.
756 	 * Throws: GException on failure.
757 	 */
758 	public uint addUiFromString(string buffer)
759 	{
760 		// guint gtk_ui_manager_add_ui_from_string (GtkUIManager *manager,  const gchar *buffer,  gssize length,  GError **error);
761 		GError* err = null;
762 		
763 		auto p = gtk_ui_manager_add_ui_from_string(gtkUIManager, cast(char*)buffer.ptr, cast(int) buffer.length, &err);
764 		
765 		if (err !is null)
766 		{
767 			throw new GException( new ErrorG(err) );
768 		}
769 		
770 		return p;
771 	}
772 	
773 	/**
774 	 * Warning
775 	 * gtk_ui_manager_add_ui_from_file is deprecated and should not be used in newly-written code. 3.10
776 	 * Parses a file containing a UI definition and
777 	 * merges it with the current contents of manager.
778 	 * Since 2.4
779 	 * Params:
780 	 * filename = the name of the file to parse. [type filename]
781 	 * Returns: The merge id for the merged UI. The merge id can be used to unmerge the UI with gtk_ui_manager_remove_ui(). If an error occurred, the return value is 0.
782 	 * Throws: GException on failure.
783 	 */
784 	public uint addUiFromFile(string filename)
785 	{
786 		// guint gtk_ui_manager_add_ui_from_file (GtkUIManager *manager,  const gchar *filename,  GError **error);
787 		GError* err = null;
788 		
789 		auto p = gtk_ui_manager_add_ui_from_file(gtkUIManager, Str.toStringz(filename), &err);
790 		
791 		if (err !is null)
792 		{
793 			throw new GException( new ErrorG(err) );
794 		}
795 		
796 		return p;
797 	}
798 	
799 	/**
800 	 * Warning
801 	 * gtk_ui_manager_new_merge_id is deprecated and should not be used in newly-written code. 3.10
802 	 * Returns an unused merge id, suitable for use with
803 	 * gtk_ui_manager_add_ui().
804 	 * Since 2.4
805 	 * Returns: an unused merge id.
806 	 */
807 	public uint newMergeId()
808 	{
809 		// guint gtk_ui_manager_new_merge_id (GtkUIManager *manager);
810 		return gtk_ui_manager_new_merge_id(gtkUIManager);
811 	}
812 	
813 	/**
814 	 * Warning
815 	 * gtk_ui_manager_add_ui is deprecated and should not be used in newly-written code. 3.10
816 	 * Adds a UI element to the current contents of manager.
817 	 * If type is GTK_UI_MANAGER_AUTO, GTK+ inserts a menuitem, toolitem or
818 	 * separator if such an element can be inserted at the place determined by
819 	 * path. Otherwise type must indicate an element that can be inserted at
820 	 * the place determined by path.
821 	 * If path points to a menuitem or toolitem, the new element will be inserted
822 	 * before or after this item, depending on top.
823 	 * Since 2.4
824 	 * Params:
825 	 * mergeId = the merge id for the merged UI, see gtk_ui_manager_new_merge_id()
826 	 * path = a path
827 	 * name = the name for the added UI element
828 	 * action = the name of the action to be proxied, or NULL to add a separator. [allow-none]
829 	 * type = the type of UI element to add.
830 	 * top = if TRUE, the UI element is added before its siblings, otherwise it
831 	 * is added after its siblings.
832 	 */
833 	public void addUi(uint mergeId, string path, string name, string action, GtkUIManagerItemType type, int top)
834 	{
835 		// void gtk_ui_manager_add_ui (GtkUIManager *manager,  guint merge_id,  const gchar *path,  const gchar *name,  const gchar *action,  GtkUIManagerItemType type,  gboolean top);
836 		gtk_ui_manager_add_ui(gtkUIManager, mergeId, Str.toStringz(path), Str.toStringz(name), Str.toStringz(action), type, top);
837 	}
838 	
839 	/**
840 	 * Warning
841 	 * gtk_ui_manager_remove_ui is deprecated and should not be used in newly-written code. 3.10
842 	 * Unmerges the part of managers content identified by merge_id.
843 	 * Since 2.4
844 	 * Params:
845 	 * mergeId = a merge id as returned by gtk_ui_manager_add_ui_from_string()
846 	 */
847 	public void removeUi(uint mergeId)
848 	{
849 		// void gtk_ui_manager_remove_ui (GtkUIManager *manager,  guint merge_id);
850 		gtk_ui_manager_remove_ui(gtkUIManager, mergeId);
851 	}
852 	
853 	/**
854 	 * Warning
855 	 * gtk_ui_manager_get_ui is deprecated and should not be used in newly-written code. 3.10
856 	 * Creates a UI definition of the merged UI.
857 	 * Since 2.4
858 	 * Returns: A newly allocated string containing an XML representation of the merged UI.
859 	 */
860 	public string getUi()
861 	{
862 		// gchar * gtk_ui_manager_get_ui (GtkUIManager *manager);
863 		return Str.toString(gtk_ui_manager_get_ui(gtkUIManager));
864 	}
865 	
866 	/**
867 	 * Warning
868 	 * gtk_ui_manager_ensure_update is deprecated and should not be used in newly-written code. 3.10
869 	 * Makes sure that all pending updates to the UI have been completed.
870 	 * This may occasionally be necessary, since GtkUIManager updates the
871 	 * UI in an idle function. A typical example where this function is
872 	 * useful is to enforce that the menubar and toolbar have been added to
873 	 * Since 2.4
874 	 */
875 	public void ensureUpdate()
876 	{
877 		// void gtk_ui_manager_ensure_update (GtkUIManager *manager);
878 		gtk_ui_manager_ensure_update(gtkUIManager);
879 	}
880 }