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