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  = GtkMenu.html
27  * outPack = gtk
28  * outFile = Menu
29  * strct   = GtkMenu
30  * realStrct=
31  * ctorStrct=
32  * clss    = Menu
33  * interf  = 
34  * class Code: Yes
35  * interface Code: No
36  * template for:
37  * extend  = 
38  * implements:
39  * prefixes:
40  * 	- gtk_menu_
41  * omit structs:
42  * omit prefixes:
43  * omit code:
44  * omit signals:
45  * imports:
46  * 	- glib.Str
47  * 	- glib.ListG
48  * 	- gio.MenuModel
49  * 	- gdk.Device
50  * 	- gdk.Screen
51  * 	- gtk.AccelGroup
52  * 	- gtk.MenuItem
53  * 	- gtk.Widget
54  * structWrap:
55  * 	- GList* -> ListG
56  * 	- GMenuModel* -> MenuModel
57  * 	- GdkDevice* -> Device
58  * 	- GdkScreen* -> Screen
59  * 	- GtkAccelGroup* -> AccelGroup
60  * 	- GtkWidget* -> Widget
61  * module aliases:
62  * local aliases:
63  * overrides:
64  */
65 
66 module gtk.Menu;
67 
68 public  import gtkc.gtktypes;
69 
70 private import gtkc.gtk;
71 private import glib.ConstructionException;
72 private import gobject.ObjectG;
73 
74 private import gobject.Signals;
75 public  import gtkc.gdktypes;
76 
77 private import glib.Str;
78 private import glib.ListG;
79 private import gio.MenuModel;
80 private import gdk.Device;
81 private import gdk.Screen;
82 private import gtk.AccelGroup;
83 private import gtk.MenuItem;
84 private import gtk.Widget;
85 
86 
87 
88 private import gtk.MenuShell;
89 
90 /**
91  * A GtkMenu is a GtkMenuShell that implements a drop down menu
92  * consisting of a list of GtkMenuItem objects which can be navigated
93  * and activated by the user to perform application functions.
94  *
95  * A GtkMenu is most commonly dropped down by activating a
96  * GtkMenuItem in a GtkMenuBar or popped up by activating a
97  * GtkMenuItem in another GtkMenu.
98  *
99  * A GtkMenu can also be popped up by activating a GtkComboBox.
100  * Other composite widgets such as the GtkNotebook can pop up a
101  * GtkMenu as well.
102  *
103  * Applications can display a GtkMenu as a popup menu by calling the
104  * gtk_menu_popup() function. The example below shows how an application
105  * can pop up a menu when the 3rd mouse button is pressed.
106  *
107  * $(DDOC_COMMENT example)
108  *
109  * $(DDOC_COMMENT example)
110  */
111 public class Menu : MenuShell
112 {
113 	
114 	/** the main Gtk struct */
115 	protected GtkMenu* gtkMenu;
116 	
117 	
118 	public GtkMenu* getMenuStruct()
119 	{
120 		return gtkMenu;
121 	}
122 	
123 	
124 	/** the main Gtk struct as a void* */
125 	protected override void* getStruct()
126 	{
127 		return cast(void*)gtkMenu;
128 	}
129 	
130 	/**
131 	 * Sets our main struct and passes it to the parent class
132 	 */
133 	public this (GtkMenu* gtkMenu)
134 	{
135 		super(cast(GtkMenuShell*)gtkMenu);
136 		this.gtkMenu = gtkMenu;
137 	}
138 	
139 	protected override void setStruct(GObject* obj)
140 	{
141 		super.setStruct(obj);
142 		gtkMenu = cast(GtkMenu*)obj;
143 	}
144 	
145 	/**
146 	 * Popups up this menu
147 	 * Params:
148 	 *  button = you can pass a button number here
149 	 *  activateTime = you can pass the time from an event here
150 	 */
151 	void popup(guint button, guint32 activateTime)
152 	{
153 		popup(null, null, null, null, button, activateTime);
154 	}
155 	
156 	/**
157 	 * Creates and append a submenu to this menu.
158 	 * This menu item that actualy has the sub menu is also created.
159 	 * Params:
160 	 *  label = the sub menu item label
161 	 * Returns: the new menu
162 	 */
163 	Menu appendSubmenu(string label)
164 	{
165 		MenuItem item = new MenuItem(label);
166 		append(item);
167 		Menu submenu = new Menu();
168 		item.setSubmenu(submenu);
169 		return submenu;
170 	}
171 	
172 	/** */
173 	void appendSubmenu(string label, Menu submenu)
174 	{
175 		MenuItem item = new MenuItem(label);
176 		append(item);
177 		item.setSubmenu(submenu);
178 	}
179 	
180 	/** */
181 	Menu prependSubmenu(string label)
182 	{
183 		MenuItem item = new MenuItem(label);
184 		prepend(item);
185 		Menu submenu = new Menu();
186 		item.setSubmenu(submenu);
187 		return submenu;
188 	}
189 	
190 	/**
191 	 */
192 	int[string] connectedSignals;
193 	
194 	void delegate(GtkScrollType, Menu)[] onMoveScrollListeners;
195 	/**
196 	 */
197 	void addOnMoveScroll(void delegate(GtkScrollType, Menu) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
198 	{
199 		if ( !("move-scroll" in connectedSignals) )
200 		{
201 			Signals.connectData(
202 			getStruct(),
203 			"move-scroll",
204 			cast(GCallback)&callBackMoveScroll,
205 			cast(void*)this,
206 			null,
207 			connectFlags);
208 			connectedSignals["move-scroll"] = 1;
209 		}
210 		onMoveScrollListeners ~= dlg;
211 	}
212 	extern(C) static void callBackMoveScroll(GtkMenu* menuStruct, GtkScrollType scrollType, Menu _menu)
213 	{
214 		foreach ( void delegate(GtkScrollType, Menu) dlg ; _menu.onMoveScrollListeners )
215 		{
216 			dlg(scrollType, _menu);
217 		}
218 	}
219 	
220 	
221 	/**
222 	 * Creates a new GtkMenu
223 	 * Throws: ConstructionException GTK+ fails to create the object.
224 	 */
225 	public this ()
226 	{
227 		// GtkWidget * gtk_menu_new (void);
228 		auto p = gtk_menu_new();
229 		if(p is null)
230 		{
231 			throw new ConstructionException("null returned by gtk_menu_new()");
232 		}
233 		this(cast(GtkMenu*) p);
234 	}
235 	
236 	/**
237 	 * Creates a GtkMenu and populates it with menu items and
238 	 * submenus according to model.
239 	 * The created menu items are connected to actions found in the
240 	 * GtkApplicationWindow to which the menu belongs - typically
241 	 * by means of being attached to a widget (see gtk_menu_attach_to_widget())
242 	 * that is contained within the GtkApplicationWindows widget hierarchy.
243 	 * Params:
244 	 * model = a GMenuModel
245 	 * Throws: ConstructionException GTK+ fails to create the object.
246 	 */
247 	public this (MenuModel model)
248 	{
249 		// GtkWidget * gtk_menu_new_from_model (GMenuModel *model);
250 		auto p = gtk_menu_new_from_model((model is null) ? null : model.getMenuModelStruct());
251 		if(p is null)
252 		{
253 			throw new ConstructionException("null returned by gtk_menu_new_from_model((model is null) ? null : model.getMenuModelStruct())");
254 		}
255 		this(cast(GtkMenu*) p);
256 	}
257 	
258 	/**
259 	 * Sets the GdkScreen on which the menu will be displayed.
260 	 * Since 2.2
261 	 * Params:
262 	 * screen = a GdkScreen, or NULL if the screen should be
263 	 * determined by the widget the menu is attached to. [allow-none]
264 	 */
265 	public void setScreen(Screen screen)
266 	{
267 		// void gtk_menu_set_screen (GtkMenu *menu,  GdkScreen *screen);
268 		gtk_menu_set_screen(gtkMenu, (screen is null) ? null : screen.getScreenStruct());
269 	}
270 	
271 	/**
272 	 * Moves child to a new position in the list of menu
273 	 * children.
274 	 * Params:
275 	 * child = the GtkMenuItem to move
276 	 * position = the new position to place child.
277 	 * Positions are numbered from 0 to n - 1
278 	 */
279 	public void reorderChild(Widget child, int position)
280 	{
281 		// void gtk_menu_reorder_child (GtkMenu *menu,  GtkWidget *child,  gint position);
282 		gtk_menu_reorder_child(gtkMenu, (child is null) ? null : child.getWidgetStruct(), position);
283 	}
284 	
285 	/**
286 	 * Adds a new GtkMenuItem to a (table) menu. The number of 'cells' that
287 	 * an item will occupy is specified by left_attach, right_attach,
288 	 * top_attach and bottom_attach. These each represent the leftmost,
289 	 * rightmost, uppermost and lower column and row numbers of the table.
290 	 * (Columns and rows are indexed from zero).
291 	 * Note that this function is not related to gtk_menu_detach().
292 	 * Since 2.4
293 	 * Params:
294 	 * child = a GtkMenuItem
295 	 * leftAttach = The column number to attach the left side of the item to
296 	 * rightAttach = The column number to attach the right side of the item to
297 	 * topAttach = The row number to attach the top of the item to
298 	 * bottomAttach = The row number to attach the bottom of the item to
299 	 */
300 	public void attach(Widget child, uint leftAttach, uint rightAttach, uint topAttach, uint bottomAttach)
301 	{
302 		// void gtk_menu_attach (GtkMenu *menu,  GtkWidget *child,  guint left_attach,  guint right_attach,  guint top_attach,  guint bottom_attach);
303 		gtk_menu_attach(gtkMenu, (child is null) ? null : child.getWidgetStruct(), leftAttach, rightAttach, topAttach, bottomAttach);
304 	}
305 	
306 	/**
307 	 * Displays a menu and makes it available for selection.
308 	 * Applications can use this function to display context-sensitive menus,
309 	 * and will typically supply NULL for the parent_menu_shell,
310 	 * parent_menu_item, func, data and destroy parameters. The default
311 	 * menu positioning function will position the menu at the current position
312 	 * of device (or its corresponding pointer).
313 	 * The button parameter should be the mouse button pressed to initiate
314 	 * the menu popup. If the menu popup was initiated by something other than
315 	 * a mouse button press, such as a mouse button release or a keypress,
316 	 * button should be 0.
317 	 * The activate_time parameter is used to conflict-resolve initiation of
318 	 * concurrent requests for mouse/keyboard grab requests. To function
319 	 * properly, this needs to be the time stamp of the user event (such as
320 	 * a mouse click or key press) that caused the initiation of the popup.
321 	 * Only if no such event is available, gtk_get_current_event_time() can
322 	 * be used instead.
323 	 * Params:
324 	 * device = a GdkDevice. [allow-none]
325 	 * parentMenuShell = the menu shell containing the triggering
326 	 * menu item, or NULL. [allow-none]
327 	 * parentMenuItem = the menu item whose activation triggered
328 	 * the popup, or NULL. [allow-none]
329 	 * func = a user supplied function used to position the menu,
330 	 * or NULL. [allow-none]
331 	 * data = user supplied data to be passed to func. [allow-none]
332 	 * destroy = destroy notify for data. [allow-none]
333 	 * button = the mouse button which was pressed to initiate the event
334 	 * activateTime = the time at which the activation event occurred
335 	 * Since 3.0
336 	 */
337 	public void popupForDevice(Device device, Widget parentMenuShell, Widget parentMenuItem, GtkMenuPositionFunc func, void* data, GDestroyNotify destroy, uint button, uint activateTime)
338 	{
339 		// void gtk_menu_popup_for_device (GtkMenu *menu,  GdkDevice *device,  GtkWidget *parent_menu_shell,  GtkWidget *parent_menu_item,  GtkMenuPositionFunc func,  gpointer data,  GDestroyNotify destroy,  guint button,  guint32 activate_time);
340 		gtk_menu_popup_for_device(gtkMenu, (device is null) ? null : device.getDeviceStruct(), (parentMenuShell is null) ? null : parentMenuShell.getWidgetStruct(), (parentMenuItem is null) ? null : parentMenuItem.getWidgetStruct(), func, data, destroy, button, activateTime);
341 	}
342 	
343 	/**
344 	 * Displays a menu and makes it available for selection.
345 	 * Applications can use this function to display context-sensitive
346 	 * menus, and will typically supply NULL for the parent_menu_shell,
347 	 * parent_menu_item, func and data parameters. The default menu
348 	 * positioning function will position the menu at the current mouse
349 	 * cursor position.
350 	 * The button parameter should be the mouse button pressed to initiate
351 	 * the menu popup. If the menu popup was initiated by something other
352 	 * than a mouse button press, such as a mouse button release or a keypress,
353 	 * button should be 0.
354 	 * The activate_time parameter is used to conflict-resolve initiation
355 	 * of concurrent requests for mouse/keyboard grab requests. To function
356 	 * properly, this needs to be the timestamp of the user event (such as
357 	 * a mouse click or key press) that caused the initiation of the popup.
358 	 * Only if no such event is available, gtk_get_current_event_time() can
359 	 * be used instead.
360 	 * Params:
361 	 * parentMenuShell = the menu shell containing the
362 	 * triggering menu item, or NULL. [allow-none]
363 	 * parentMenuItem = the menu item whose activation
364 	 * triggered the popup, or NULL. [allow-none]
365 	 * func = a user supplied function used to position
366 	 * the menu, or NULL. [scope async][allow-none]
367 	 * data = user supplied data to be passed to func.
368 	 * button = the mouse button which was pressed to initiate the event.
369 	 * activateTime = the time at which the activation event occurred.
370 	 */
371 	public void popup(Widget parentMenuShell, Widget parentMenuItem, GtkMenuPositionFunc func, void* data, uint button, uint activateTime)
372 	{
373 		// void gtk_menu_popup (GtkMenu *menu,  GtkWidget *parent_menu_shell,  GtkWidget *parent_menu_item,  GtkMenuPositionFunc func,  gpointer data,  guint button,  guint32 activate_time);
374 		gtk_menu_popup(gtkMenu, (parentMenuShell is null) ? null : parentMenuShell.getWidgetStruct(), (parentMenuItem is null) ? null : parentMenuItem.getWidgetStruct(), func, data, button, activateTime);
375 	}
376 	
377 	/**
378 	 * Set the GtkAccelGroup which holds global accelerators for the
379 	 * menu. This accelerator group needs to also be added to all windows
380 	 * that this menu is being used in with gtk_window_add_accel_group(),
381 	 * in order for those windows to support all the accelerators
382 	 * contained in this group.
383 	 * Params:
384 	 * accelGroup = the GtkAccelGroup to be associated
385 	 * with the menu. [allow-none]
386 	 */
387 	public void setAccelGroup(AccelGroup accelGroup)
388 	{
389 		// void gtk_menu_set_accel_group (GtkMenu *menu,  GtkAccelGroup *accel_group);
390 		gtk_menu_set_accel_group(gtkMenu, (accelGroup is null) ? null : accelGroup.getAccelGroupStruct());
391 	}
392 	
393 	/**
394 	 * Gets the GtkAccelGroup which holds global accelerators for the
395 	 * menu. See gtk_menu_set_accel_group().
396 	 * Returns: the GtkAccelGroup associated with the menu. [transfer none]
397 	 */
398 	public AccelGroup getAccelGroup()
399 	{
400 		// GtkAccelGroup * gtk_menu_get_accel_group (GtkMenu *menu);
401 		auto p = gtk_menu_get_accel_group(gtkMenu);
402 		
403 		if(p is null)
404 		{
405 			return null;
406 		}
407 		
408 		return ObjectG.getDObject!(AccelGroup)(cast(GtkAccelGroup*) p);
409 	}
410 	
411 	/**
412 	 * Sets an accelerator path for this menu from which accelerator paths
413 	 * for its immediate children, its menu items, can be constructed.
414 	 * The main purpose of this function is to spare the programmer the
415 	 * inconvenience of having to call gtk_menu_item_set_accel_path() on
416 	 * each menu item that should support runtime user changable accelerators.
417 	 * Instead, by just calling gtk_menu_set_accel_path() on their parent,
418 	 * each menu item of this menu, that contains a label describing its
419 	 * purpose, automatically gets an accel path assigned.
420 	 * For example, a menu containing menu items "New" and "Exit", will, after
421 	 * gtk_menu_set_accel_path (menu, "<Gnumeric-Sheet>/File");
422 	 * Params:
423 	 * accelPath = a valid accelerator path. [allow-none]
424 	 */
425 	public void setAccelPath(string accelPath)
426 	{
427 		// void gtk_menu_set_accel_path (GtkMenu *menu,  const gchar *accel_path);
428 		gtk_menu_set_accel_path(gtkMenu, Str.toStringz(accelPath));
429 	}
430 	
431 	/**
432 	 * Retrieves the accelerator path set on the menu.
433 	 * Since 2.14
434 	 * Returns: the accelerator path set on the menu.
435 	 */
436 	public string getAccelPath()
437 	{
438 		// const gchar * gtk_menu_get_accel_path (GtkMenu *menu);
439 		return Str.toString(gtk_menu_get_accel_path(gtkMenu));
440 	}
441 	
442 	/**
443 	 * Warning
444 	 * gtk_menu_set_title is deprecated and should not be used in newly-written code. 3.10
445 	 * Sets the title string for the menu.
446 	 * The title is displayed when the menu is shown as a tearoff
447 	 * menu. If title is NULL, the menu will see if it is attached
448 	 * to a parent menu item, and if so it will try to use the same
449 	 * text as that menu item's label.
450 	 * Params:
451 	 * title = a string containing the title for the menu
452 	 */
453 	public void setTitle(string title)
454 	{
455 		// void gtk_menu_set_title (GtkMenu *menu,  const gchar *title);
456 		gtk_menu_set_title(gtkMenu, Str.toStringz(title));
457 	}
458 	
459 	/**
460 	 * Warning
461 	 * gtk_menu_get_title is deprecated and should not be used in newly-written code. 3.10
462 	 * Returns the title of the menu. See gtk_menu_set_title().
463 	 * Returns: the title of the menu, or NULL if the menu has no title set on it. This string is owned by GTK+ and should not be modified or freed.
464 	 */
465 	public string getTitle()
466 	{
467 		// const gchar * gtk_menu_get_title (GtkMenu *menu);
468 		return Str.toString(gtk_menu_get_title(gtkMenu));
469 	}
470 	
471 	/**
472 	 * Informs GTK+ on which monitor a menu should be popped up.
473 	 * See gdk_screen_get_monitor_geometry().
474 	 * This function should be called from a GtkMenuPositionFunc
475 	 * if the menu should not appear on the same monitor as the pointer.
476 	 * This information can't be reliably inferred from the coordinates
477 	 * returned by a GtkMenuPositionFunc, since, for very long menus,
478 	 * these coordinates may extend beyond the monitor boundaries or even
479 	 * the screen boundaries.
480 	 * Since 2.4
481 	 * Params:
482 	 * monitorNum = the number of the monitor on which the menu should
483 	 * be popped up
484 	 */
485 	public void setMonitor(int monitorNum)
486 	{
487 		// void gtk_menu_set_monitor (GtkMenu *menu,  gint monitor_num);
488 		gtk_menu_set_monitor(gtkMenu, monitorNum);
489 	}
490 	
491 	/**
492 	 * Retrieves the number of the monitor on which to show the menu.
493 	 * Since 2.14
494 	 * Returns: the number of the monitor on which the menu should be popped up or -1, if no monitor has been set
495 	 */
496 	public int getMonitor()
497 	{
498 		// gint gtk_menu_get_monitor (GtkMenu *menu);
499 		return gtk_menu_get_monitor(gtkMenu);
500 	}
501 	
502 	/**
503 	 * Warning
504 	 * gtk_menu_get_tearoff_state is deprecated and should not be used in newly-written code. 3.10
505 	 * Returns whether the menu is torn off.
506 	 * See gtk_menu_set_tearoff_state().
507 	 * Returns: TRUE if the menu is currently torn off.
508 	 */
509 	public int getTearoffState()
510 	{
511 		// gboolean gtk_menu_get_tearoff_state (GtkMenu *menu);
512 		return gtk_menu_get_tearoff_state(gtkMenu);
513 	}
514 	
515 	/**
516 	 * Sets whether the menu should reserve space for drawing toggles
517 	 * or icons, regardless of their actual presence.
518 	 * Since 2.18
519 	 * Params:
520 	 * reserveToggleSize = whether to reserve size for toggles
521 	 */
522 	public void setReserveToggleSize(int reserveToggleSize)
523 	{
524 		// void gtk_menu_set_reserve_toggle_size (GtkMenu *menu,  gboolean reserve_toggle_size);
525 		gtk_menu_set_reserve_toggle_size(gtkMenu, reserveToggleSize);
526 	}
527 	
528 	/**
529 	 * Returns whether the menu reserves space for toggles and
530 	 * icons, regardless of their actual presence.
531 	 * Since 2.18
532 	 * Returns: Whether the menu reserves toggle space
533 	 */
534 	public int getReserveToggleSize()
535 	{
536 		// gboolean gtk_menu_get_reserve_toggle_size (GtkMenu *menu);
537 		return gtk_menu_get_reserve_toggle_size(gtkMenu);
538 	}
539 	
540 	/**
541 	 * Removes the menu from the screen.
542 	 */
543 	public void popdown()
544 	{
545 		// void gtk_menu_popdown (GtkMenu *menu);
546 		gtk_menu_popdown(gtkMenu);
547 	}
548 	
549 	/**
550 	 * Repositions the menu according to its position function.
551 	 */
552 	public void reposition()
553 	{
554 		// void gtk_menu_reposition (GtkMenu *menu);
555 		gtk_menu_reposition(gtkMenu);
556 	}
557 	
558 	/**
559 	 * Returns the selected menu item from the menu. This is used by the
560 	 * GtkComboBox.
561 	 * Returns: the GtkMenuItem that was last selected in the menu. If a selection has not yet been made, the first menu item is selected. [transfer none]
562 	 */
563 	public Widget getActive()
564 	{
565 		// GtkWidget * gtk_menu_get_active (GtkMenu *menu);
566 		auto p = gtk_menu_get_active(gtkMenu);
567 		
568 		if(p is null)
569 		{
570 			return null;
571 		}
572 		
573 		return ObjectG.getDObject!(Widget)(cast(GtkWidget*) p);
574 	}
575 	
576 	/**
577 	 * Selects the specified menu item within the menu. This is used by
578 	 * the GtkComboBox and should not be used by anyone else.
579 	 * Params:
580 	 * index = the index of the menu item to select. Iindex values are
581 	 * from 0 to n-1
582 	 */
583 	public void setActive(uint index)
584 	{
585 		// void gtk_menu_set_active (GtkMenu *menu,  guint index);
586 		gtk_menu_set_active(gtkMenu, index);
587 	}
588 	
589 	/**
590 	 * Warning
591 	 * gtk_menu_set_tearoff_state is deprecated and should not be used in newly-written code. 3.10
592 	 * Changes the tearoff state of the menu. A menu is normally
593 	 * displayed as drop down menu which persists as long as the menu is
594 	 * active. It can also be displayed as a tearoff menu which persists
595 	 * until it is closed or reattached.
596 	 * Params:
597 	 * tornOff = If TRUE, menu is displayed as a tearoff menu.
598 	 */
599 	public void setTearoffState(int tornOff)
600 	{
601 		// void gtk_menu_set_tearoff_state (GtkMenu *menu,  gboolean torn_off);
602 		gtk_menu_set_tearoff_state(gtkMenu, tornOff);
603 	}
604 	
605 	/**
606 	 * Attaches the menu to the widget and provides a callback function
607 	 * that will be invoked when the menu calls gtk_menu_detach() during
608 	 * its destruction.
609 	 * If the menu is attached to the widget then it will be destroyed
610 	 * when the widget is destroyed, as if it was a child widget.
611 	 * An attached menu will also move between screens correctly if the
612 	 * widgets moves between screens.
613 	 * Params:
614 	 * attachWidget = the GtkWidget that the menu will be attached to
615 	 * detacher = the user supplied callback function
616 	 * that will be called when the menu calls gtk_menu_detach(). [scope async][allow-none]
617 	 */
618 	public void attachToWidget(Widget attachWidget, GtkMenuDetachFunc detacher)
619 	{
620 		// void gtk_menu_attach_to_widget (GtkMenu *menu,  GtkWidget *attach_widget,  GtkMenuDetachFunc detacher);
621 		gtk_menu_attach_to_widget(gtkMenu, (attachWidget is null) ? null : attachWidget.getWidgetStruct(), detacher);
622 	}
623 	
624 	/**
625 	 * Detaches the menu from the widget to which it had been attached.
626 	 * This function will call the callback function, detacher, provided
627 	 * when the gtk_menu_attach_to_widget() function was called.
628 	 */
629 	public void detach()
630 	{
631 		// void gtk_menu_detach (GtkMenu *menu);
632 		gtk_menu_detach(gtkMenu);
633 	}
634 	
635 	/**
636 	 * Returns the GtkWidget that the menu is attached to.
637 	 * Returns: the GtkWidget that the menu is attached to. [transfer none]
638 	 */
639 	public Widget getAttachWidget()
640 	{
641 		// GtkWidget * gtk_menu_get_attach_widget (GtkMenu *menu);
642 		auto p = gtk_menu_get_attach_widget(gtkMenu);
643 		
644 		if(p is null)
645 		{
646 			return null;
647 		}
648 		
649 		return ObjectG.getDObject!(Widget)(cast(GtkWidget*) p);
650 	}
651 	
652 	/**
653 	 * Returns a list of the menus which are attached to this widget.
654 	 * This list is owned by GTK+ and must not be modified.
655 	 * Since 2.6
656 	 * Params:
657 	 * widget = a GtkWidget
658 	 * Returns: the list of menus attached to his widget. [element-type GtkWidget][transfer none]
659 	 */
660 	public static ListG getForAttachWidget(Widget widget)
661 	{
662 		// GList * gtk_menu_get_for_attach_widget (GtkWidget *widget);
663 		auto p = gtk_menu_get_for_attach_widget((widget is null) ? null : widget.getWidgetStruct());
664 		
665 		if(p is null)
666 		{
667 			return null;
668 		}
669 		
670 		return ObjectG.getDObject!(ListG)(cast(GList*) p);
671 	}
672 }