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