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