This file is indexed.

/usr/include/d/gtkd-3/gtk/MenuItem.d is in libgtkd-3-dev 3.7.5-2build1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
/*
 * This file is part of gtkD.
 *
 * gtkD is free software; you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License
 * as published by the Free Software Foundation; either version 3
 * of the License, or (at your option) any later version, with
 * some exceptions, please read the COPYING file.
 *
 * gtkD is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with gtkD; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
 */

// generated automatically - do not change
// find conversion definition on APILookup.txt
// implement new conversion functionalities on the wrap.utils pakage


module gtk.MenuItem;

private import glib.ConstructionException;
private import glib.Str;
private import gobject.ObjectG;
private import gobject.Signals;
private import gtk.AccelGroup;
private import gtk.ActionableIF;
private import gtk.ActionableT;
private import gtk.ActivatableIF;
private import gtk.ActivatableT;
private import gtk.Bin;
private import gtk.Menu;
private import gtk.Widget;
private import gtk.c.functions;
public  import gtk.c.types;
public  import gtkc.gtktypes;
private import std.algorithm;


/**
 * The #GtkMenuItem widget and the derived widgets are the only valid
 * children for menus. Their function is to correctly handle highlighting,
 * alignment, events and submenus.
 * 
 * As a GtkMenuItem derives from #GtkBin it can hold any valid child widget,
 * although only a few are really useful.
 * 
 * By default, a GtkMenuItem sets a #GtkAccelLabel as its child.
 * GtkMenuItem has direct functions to set the label and its mnemonic.
 * For more advanced label settings, you can fetch the child widget from the GtkBin.
 * 
 * An example for setting markup and accelerator on a MenuItem:
 * |[<!-- language="C" -->
 * GtkWidget *child = gtk_bin_get_child (GTK_BIN (menu_item));
 * gtk_label_set_markup (GTK_LABEL (child), "<i>new label</i> with <b>markup</b>");
 * gtk_accel_label_set_accel (GTK_ACCEL_LABEL (child), GDK_KEY_1, 0);
 * ]|
 * 
 * # GtkMenuItem as GtkBuildable
 * 
 * The GtkMenuItem implementation of the #GtkBuildable interface supports
 * adding a submenu by specifying “submenu” as the “type” attribute of
 * a <child> element.
 * 
 * An example of UI definition fragment with submenus:
 * |[
 * <object class="GtkMenuItem">
 * <child type="submenu">
 * <object class="GtkMenu"/>
 * </child>
 * </object>
 * ]|
 * 
 * # CSS nodes
 * 
 * |[<!-- language="plain" -->
 * menuitem
 * ├── <child>
 * ╰── [arrow.right]
 * ]|
 * 
 * GtkMenuItem has a single CSS node with name menuitem. If the menuitem
 * has a submenu, it gets another CSS node with name arrow, which has
 * the .left or .right style class.
 */
public class MenuItem : Bin, ActionableIF, ActivatableIF
{
	/** the main Gtk struct */
	protected GtkMenuItem* gtkMenuItem;

	/** Get the main Gtk struct */
	public GtkMenuItem* getMenuItemStruct(bool transferOwnership = false)
	{
		if (transferOwnership)
			ownedRef = false;
		return gtkMenuItem;
	}

	/** the main Gtk struct as a void* */
	protected override void* getStruct()
	{
		return cast(void*)gtkMenuItem;
	}

	protected override void setStruct(GObject* obj)
	{
		gtkMenuItem = cast(GtkMenuItem*)obj;
		super.setStruct(obj);
	}

	/**
	 * Sets our main struct and passes it to the parent class.
	 */
	public this (GtkMenuItem* gtkMenuItem, bool ownedRef = false)
	{
		this.gtkMenuItem = gtkMenuItem;
		super(cast(GtkBin*)gtkMenuItem, ownedRef);
	}

	// add the Actionable capabilities
	mixin ActionableT!(GtkMenuItem);

	// add the Activatable capabilities
	mixin ActivatableT!(GtkMenuItem);

	/** store the action code passed in by the applcation */
	private string actionLabel;

	/** Gets the application set action code */
	public string getActionName()
	{
		if ( actionLabel is null )
		{
			actionLabel = "";
		}
		return actionLabel;
	}

	/**
	 * Creates a new menu item with a label and a listener and a action.
	 * used for backward compatibily with DUI.
	 */
	this(string label, void delegate(MenuItem)dlg, string action)
	{
		this(label);
		this.actionLabel = action;
		addOnActivate(dlg);
	}

	/**
	 * Creates a new Item associated with a "activate" delegate and with a action code
	 * and optionally accelGroup
	 */
	public this(void delegate(MenuItem) dlg, string label, string action,
	bool mnemonic=true,
	AccelGroup accelGroup=null,
	char accelKey='\0',
	GdkModifierType modifierType=GdkModifierType.CONTROL_MASK,
	GtkAccelFlags accelFlags=GtkAccelFlags.VISIBLE
	)
	{
		this(label, mnemonic);
		this.actionLabel = action;
		addOnActivate(dlg);
		if ( accelGroup !is null && accelKey != '\0' )
		{
			addAccelerator("activate",accelGroup,accelKey,modifierType,accelFlags);
		}
	}

	/**
	 * Creates a new Item associated with a "activate" delegate
	 */
	public this(void delegate(MenuItem) dlg, string label, bool mnemonic=true)
	{
		this(label, mnemonic);
		addOnActivate(dlg);
	}

	/**
	 * Creates a new GtkMenuItem whose child is a GtkLabel.
	 * Params:
	 *  label = the text for the label
	 *  mnemonic = if true the label
	 *  will be created using gtk_label_new_with_mnemonic(), so underscores
	 *  in label indicate the mnemonic for the menu item.
	 * Throws: ConstructionException GTK+ fails to create the object.
	 */
	public this (string label, bool mnemonic=true)
	{
		GtkMenuItem* p;

		if ( mnemonic )
		{
			// GtkWidget* gtk_menu_item_new_with_mnemonic (const gchar *label);
			p = cast(GtkMenuItem*)gtk_menu_item_new_with_mnemonic(Str.toStringz(label));
		}
		else
		{
			// GtkWidget* gtk_menu_item_new_with_label (const gchar *label);
			p = cast(GtkMenuItem*)gtk_menu_item_new_with_label(Str.toStringz(label));
		}

		if(p is null)
		{
			throw new ConstructionException("null returned by gtk_menu_item_new_with_");
		}

		this(p);

		setName(label);
	}

	/**
	 */

	/** */
	public static GType getType()
	{
		return gtk_menu_item_get_type();
	}

	/**
	 * Creates a new #GtkMenuItem.
	 *
	 * Returns: the newly created #GtkMenuItem
	 *
	 * Throws: ConstructionException GTK+ fails to create the object.
	 */
	public this()
	{
		auto p = gtk_menu_item_new();

		if(p is null)
		{
			throw new ConstructionException("null returned by new");
		}

		this(cast(GtkMenuItem*) p);
	}

	/**
	 * Emits the #GtkMenuItem::activate signal on the given item
	 */
	public void itemActivate()
	{
		gtk_menu_item_activate(gtkMenuItem);
	}

	/**
	 * Emits the #GtkMenuItem::deselect signal on the given item.
	 */
	public void deselect()
	{
		gtk_menu_item_deselect(gtkMenuItem);
	}

	/**
	 * Retrieve the accelerator path that was previously set on @menu_item.
	 *
	 * See gtk_menu_item_set_accel_path() for details.
	 *
	 * Returns: the accelerator path corresponding to
	 *     this menu item’s functionality, or %NULL if not set
	 *
	 * Since: 2.14
	 */
	public string getAccelPath()
	{
		return Str.toString(gtk_menu_item_get_accel_path(gtkMenuItem));
	}

	/**
	 * Sets @text on the @menu_item label
	 *
	 * Returns: The text in the @menu_item label. This is the internal
	 *     string used by the label, and must not be modified.
	 *
	 * Since: 2.16
	 */
	public string getLabel()
	{
		return Str.toString(gtk_menu_item_get_label(gtkMenuItem));
	}

	/**
	 * Returns whether the @menu_item reserves space for
	 * the submenu indicator, regardless if it has a submenu
	 * or not.
	 *
	 * Returns: %TRUE if @menu_item always reserves space for the
	 *     submenu indicator
	 *
	 * Since: 3.0
	 */
	public bool getReserveIndicator()
	{
		return gtk_menu_item_get_reserve_indicator(gtkMenuItem) != 0;
	}

	/**
	 * Gets whether the menu item appears justified at the right
	 * side of the menu bar.
	 *
	 * Deprecated: See gtk_menu_item_set_right_justified()
	 *
	 * Returns: %TRUE if the menu item will appear at the
	 *     far right if added to a menu bar.
	 */
	public bool getRightJustified()
	{
		return gtk_menu_item_get_right_justified(gtkMenuItem) != 0;
	}

	/**
	 * Gets the submenu underneath this menu item, if any.
	 * See gtk_menu_item_set_submenu().
	 *
	 * Returns: submenu for this menu item, or %NULL if none
	 */
	public Widget getSubmenu()
	{
		auto p = gtk_menu_item_get_submenu(gtkMenuItem);

		if(p is null)
		{
			return null;
		}

		return ObjectG.getDObject!(Widget)(cast(GtkWidget*) p);
	}

	/**
	 * Checks if an underline in the text indicates the next character
	 * should be used for the mnemonic accelerator key.
	 *
	 * Returns: %TRUE if an embedded underline in the label
	 *     indicates the mnemonic accelerator key.
	 *
	 * Since: 2.16
	 */
	public bool getUseUnderline()
	{
		return gtk_menu_item_get_use_underline(gtkMenuItem) != 0;
	}

	/**
	 * Emits the #GtkMenuItem::select signal on the given item.
	 */
	public void select()
	{
		gtk_menu_item_select(gtkMenuItem);
	}

	/**
	 * Set the accelerator path on @menu_item, through which runtime
	 * changes of the menu item’s accelerator caused by the user can be
	 * identified and saved to persistent storage (see gtk_accel_map_save()
	 * on this). To set up a default accelerator for this menu item, call
	 * gtk_accel_map_add_entry() with the same @accel_path. See also
	 * gtk_accel_map_add_entry() on the specifics of accelerator paths,
	 * and gtk_menu_set_accel_path() for a more convenient variant of
	 * this function.
	 *
	 * This function is basically a convenience wrapper that handles
	 * calling gtk_widget_set_accel_path() with the appropriate accelerator
	 * group for the menu item.
	 *
	 * Note that you do need to set an accelerator on the parent menu with
	 * gtk_menu_set_accel_group() for this to work.
	 *
	 * Note that @accel_path string will be stored in a #GQuark.
	 * Therefore, if you pass a static string, you can save some memory
	 * by interning it first with g_intern_static_string().
	 *
	 * Params:
	 *     accelPath = accelerator path, corresponding to this menu
	 *         item’s functionality, or %NULL to unset the current path.
	 */
	public void setAccelPath(string accelPath)
	{
		gtk_menu_item_set_accel_path(gtkMenuItem, Str.toStringz(accelPath));
	}

	/**
	 * Sets @text on the @menu_item label
	 *
	 * Params:
	 *     label = the text you want to set
	 *
	 * Since: 2.16
	 */
	public void setLabel(string label)
	{
		gtk_menu_item_set_label(gtkMenuItem, Str.toStringz(label));
	}

	/**
	 * Sets whether the @menu_item should reserve space for
	 * the submenu indicator, regardless if it actually has
	 * a submenu or not.
	 *
	 * There should be little need for applications to call
	 * this functions.
	 *
	 * Params:
	 *     reserve = the new value
	 *
	 * Since: 3.0
	 */
	public void setReserveIndicator(bool reserve)
	{
		gtk_menu_item_set_reserve_indicator(gtkMenuItem, reserve);
	}

	/**
	 * Sets whether the menu item appears justified at the right
	 * side of a menu bar. This was traditionally done for “Help”
	 * menu items, but is now considered a bad idea. (If the widget
	 * layout is reversed for a right-to-left language like Hebrew
	 * or Arabic, right-justified-menu-items appear at the left.)
	 *
	 * Deprecated: If you insist on using it, use
	 * gtk_widget_set_hexpand() and gtk_widget_set_halign().
	 *
	 * Params:
	 *     rightJustified = if %TRUE the menu item will appear at the
	 *         far right if added to a menu bar
	 */
	public void setRightJustified(bool rightJustified)
	{
		gtk_menu_item_set_right_justified(gtkMenuItem, rightJustified);
	}

	/**
	 * Sets or replaces the menu item’s submenu, or removes it when a %NULL
	 * submenu is passed.
	 *
	 * Params:
	 *     submenu = the submenu, or %NULL
	 */
	public void setSubmenu(Menu submenu)
	{
		gtk_menu_item_set_submenu(gtkMenuItem, (submenu is null) ? null : cast(GtkWidget*)submenu.getMenuStruct());
	}

	/**
	 * If true, an underline in the text indicates the next character
	 * should be used for the mnemonic accelerator key.
	 *
	 * Params:
	 *     setting = %TRUE if underlines in the text indicate mnemonics
	 *
	 * Since: 2.16
	 */
	public void setUseUnderline(bool setting)
	{
		gtk_menu_item_set_use_underline(gtkMenuItem, setting);
	}

	/**
	 * Emits the #GtkMenuItem::toggle-size-allocate signal on the given item.
	 *
	 * Params:
	 *     allocation = the allocation to use as signal data.
	 */
	public void toggleSizeAllocate(int allocation)
	{
		gtk_menu_item_toggle_size_allocate(gtkMenuItem, allocation);
	}

	/**
	 * Emits the #GtkMenuItem::toggle-size-request signal on the given item.
	 *
	 * Params:
	 *     requisition = the requisition to use as signal data.
	 */
	public void toggleSizeRequest(ref int requisition)
	{
		gtk_menu_item_toggle_size_request(gtkMenuItem, &requisition);
	}

	protected class OnActivateDelegateWrapper
	{
		void delegate(MenuItem) dlg;
		gulong handlerId;

		this(void delegate(MenuItem) dlg)
		{
			this.dlg = dlg;
			onActivateListeners ~= this;
		}

		void remove(OnActivateDelegateWrapper source)
		{
			foreach(index, wrapper; onActivateListeners)
			{
				if (wrapper.handlerId == source.handlerId)
				{
					onActivateListeners[index] = null;
					onActivateListeners = std.algorithm.remove(onActivateListeners, index);
					break;
				}
			}
		}
	}
	OnActivateDelegateWrapper[] onActivateListeners;

	/**
	 * Emitted when the item is activated.
	 */
	gulong addOnActivate(void delegate(MenuItem) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
	{
		auto wrapper = new OnActivateDelegateWrapper(dlg);
		wrapper.handlerId = Signals.connectData(
			this,
			"activate",
			cast(GCallback)&callBackActivate,
			cast(void*)wrapper,
			cast(GClosureNotify)&callBackActivateDestroy,
			connectFlags);
		return wrapper.handlerId;
	}

	extern(C) static void callBackActivate(GtkMenuItem* menuitemStruct, OnActivateDelegateWrapper wrapper)
	{
		wrapper.dlg(wrapper.outer);
	}

	extern(C) static void callBackActivateDestroy(OnActivateDelegateWrapper wrapper, GClosure* closure)
	{
		wrapper.remove(wrapper);
	}

	protected class OnActivateItemDelegateWrapper
	{
		void delegate(MenuItem) dlg;
		gulong handlerId;

		this(void delegate(MenuItem) dlg)
		{
			this.dlg = dlg;
			onActivateItemListeners ~= this;
		}

		void remove(OnActivateItemDelegateWrapper source)
		{
			foreach(index, wrapper; onActivateItemListeners)
			{
				if (wrapper.handlerId == source.handlerId)
				{
					onActivateItemListeners[index] = null;
					onActivateItemListeners = std.algorithm.remove(onActivateItemListeners, index);
					break;
				}
			}
		}
	}
	OnActivateItemDelegateWrapper[] onActivateItemListeners;

	/**
	 * Emitted when the item is activated, but also if the menu item has a
	 * submenu. For normal applications, the relevant signal is
	 * #GtkMenuItem::activate.
	 */
	gulong addOnActivateItem(void delegate(MenuItem) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
	{
		auto wrapper = new OnActivateItemDelegateWrapper(dlg);
		wrapper.handlerId = Signals.connectData(
			this,
			"activate-item",
			cast(GCallback)&callBackActivateItem,
			cast(void*)wrapper,
			cast(GClosureNotify)&callBackActivateItemDestroy,
			connectFlags);
		return wrapper.handlerId;
	}

	extern(C) static void callBackActivateItem(GtkMenuItem* menuitemStruct, OnActivateItemDelegateWrapper wrapper)
	{
		wrapper.dlg(wrapper.outer);
	}

	extern(C) static void callBackActivateItemDestroy(OnActivateItemDelegateWrapper wrapper, GClosure* closure)
	{
		wrapper.remove(wrapper);
	}

	protected class OnDeselectDelegateWrapper
	{
		void delegate(MenuItem) dlg;
		gulong handlerId;

		this(void delegate(MenuItem) dlg)
		{
			this.dlg = dlg;
			onDeselectListeners ~= this;
		}

		void remove(OnDeselectDelegateWrapper source)
		{
			foreach(index, wrapper; onDeselectListeners)
			{
				if (wrapper.handlerId == source.handlerId)
				{
					onDeselectListeners[index] = null;
					onDeselectListeners = std.algorithm.remove(onDeselectListeners, index);
					break;
				}
			}
		}
	}
	OnDeselectDelegateWrapper[] onDeselectListeners;

	/** */
	gulong addOnDeselect(void delegate(MenuItem) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
	{
		auto wrapper = new OnDeselectDelegateWrapper(dlg);
		wrapper.handlerId = Signals.connectData(
			this,
			"deselect",
			cast(GCallback)&callBackDeselect,
			cast(void*)wrapper,
			cast(GClosureNotify)&callBackDeselectDestroy,
			connectFlags);
		return wrapper.handlerId;
	}

	extern(C) static void callBackDeselect(GtkMenuItem* menuitemStruct, OnDeselectDelegateWrapper wrapper)
	{
		wrapper.dlg(wrapper.outer);
	}

	extern(C) static void callBackDeselectDestroy(OnDeselectDelegateWrapper wrapper, GClosure* closure)
	{
		wrapper.remove(wrapper);
	}

	protected class OnSelectDelegateWrapper
	{
		void delegate(MenuItem) dlg;
		gulong handlerId;

		this(void delegate(MenuItem) dlg)
		{
			this.dlg = dlg;
			onSelectListeners ~= this;
		}

		void remove(OnSelectDelegateWrapper source)
		{
			foreach(index, wrapper; onSelectListeners)
			{
				if (wrapper.handlerId == source.handlerId)
				{
					onSelectListeners[index] = null;
					onSelectListeners = std.algorithm.remove(onSelectListeners, index);
					break;
				}
			}
		}
	}
	OnSelectDelegateWrapper[] onSelectListeners;

	/** */
	gulong addOnSelect(void delegate(MenuItem) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
	{
		auto wrapper = new OnSelectDelegateWrapper(dlg);
		wrapper.handlerId = Signals.connectData(
			this,
			"select",
			cast(GCallback)&callBackSelect,
			cast(void*)wrapper,
			cast(GClosureNotify)&callBackSelectDestroy,
			connectFlags);
		return wrapper.handlerId;
	}

	extern(C) static void callBackSelect(GtkMenuItem* menuitemStruct, OnSelectDelegateWrapper wrapper)
	{
		wrapper.dlg(wrapper.outer);
	}

	extern(C) static void callBackSelectDestroy(OnSelectDelegateWrapper wrapper, GClosure* closure)
	{
		wrapper.remove(wrapper);
	}

	protected class OnToggleSizeAllocateDelegateWrapper
	{
		void delegate(int, MenuItem) dlg;
		gulong handlerId;

		this(void delegate(int, MenuItem) dlg)
		{
			this.dlg = dlg;
			onToggleSizeAllocateListeners ~= this;
		}

		void remove(OnToggleSizeAllocateDelegateWrapper source)
		{
			foreach(index, wrapper; onToggleSizeAllocateListeners)
			{
				if (wrapper.handlerId == source.handlerId)
				{
					onToggleSizeAllocateListeners[index] = null;
					onToggleSizeAllocateListeners = std.algorithm.remove(onToggleSizeAllocateListeners, index);
					break;
				}
			}
		}
	}
	OnToggleSizeAllocateDelegateWrapper[] onToggleSizeAllocateListeners;

	/** */
	gulong addOnToggleSizeAllocate(void delegate(int, MenuItem) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
	{
		auto wrapper = new OnToggleSizeAllocateDelegateWrapper(dlg);
		wrapper.handlerId = Signals.connectData(
			this,
			"toggle-size-allocate",
			cast(GCallback)&callBackToggleSizeAllocate,
			cast(void*)wrapper,
			cast(GClosureNotify)&callBackToggleSizeAllocateDestroy,
			connectFlags);
		return wrapper.handlerId;
	}

	extern(C) static void callBackToggleSizeAllocate(GtkMenuItem* menuitemStruct, int object, OnToggleSizeAllocateDelegateWrapper wrapper)
	{
		wrapper.dlg(object, wrapper.outer);
	}

	extern(C) static void callBackToggleSizeAllocateDestroy(OnToggleSizeAllocateDelegateWrapper wrapper, GClosure* closure)
	{
		wrapper.remove(wrapper);
	}

	protected class OnToggleSizeRequestDelegateWrapper
	{
		void delegate(void*, MenuItem) dlg;
		gulong handlerId;

		this(void delegate(void*, MenuItem) dlg)
		{
			this.dlg = dlg;
			onToggleSizeRequestListeners ~= this;
		}

		void remove(OnToggleSizeRequestDelegateWrapper source)
		{
			foreach(index, wrapper; onToggleSizeRequestListeners)
			{
				if (wrapper.handlerId == source.handlerId)
				{
					onToggleSizeRequestListeners[index] = null;
					onToggleSizeRequestListeners = std.algorithm.remove(onToggleSizeRequestListeners, index);
					break;
				}
			}
		}
	}
	OnToggleSizeRequestDelegateWrapper[] onToggleSizeRequestListeners;

	/** */
	gulong addOnToggleSizeRequest(void delegate(void*, MenuItem) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
	{
		auto wrapper = new OnToggleSizeRequestDelegateWrapper(dlg);
		wrapper.handlerId = Signals.connectData(
			this,
			"toggle-size-request",
			cast(GCallback)&callBackToggleSizeRequest,
			cast(void*)wrapper,
			cast(GClosureNotify)&callBackToggleSizeRequestDestroy,
			connectFlags);
		return wrapper.handlerId;
	}

	extern(C) static void callBackToggleSizeRequest(GtkMenuItem* menuitemStruct, void* object, OnToggleSizeRequestDelegateWrapper wrapper)
	{
		wrapper.dlg(object, wrapper.outer);
	}

	extern(C) static void callBackToggleSizeRequestDestroy(OnToggleSizeRequestDelegateWrapper wrapper, GClosure* closure)
	{
		wrapper.remove(wrapper);
	}
}