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