## Documentation

Table of Contents
Class Inheritance Tree
Widget Screenshots
Package groups

## Index

Package: Menu

- Goto spec source

# Description

    package Gtk.Menu is

This widget implements a drop-down menu.

This is basically a simple box that contains a series of Gtk_Menu_Item widgets, on which the user can click to perform actions.

Such a menu is usually part of a Gtk_Menu_Bar (at the top of the window), or activated by clicking on an item in another Gtk_Menu.

See Gtk.Option_Menu for another way of displaying menus.

All the menus in GtkAda can be "Tear off" menus, i.e you can detach them from their parent (either a menu bar or another menu) to keep them visible on the screen at all times).

It is worth noting that by default, the user of your application will be able to dynamically modify the shortcuts associated with each menu item.

For instance, selecting a menu item and pressing a key will assign this new shortcut to the item, possibly removing the shortcut from any other item it was associated with.

Note that pressing <backspace> will simply remove the shortcut.

This default behavior, somewhat unexpected, can be canceled.

There are two ways to control this behavior: you can lock a specific menu item by calling Gtk.Widget.Lock_Accelerators on it. But you can also lock all the menu items at once by calling Gtk.Accel_Group.Lock for all the accelerator groups that were used (the GUI builder gate generally creates a single one), as well as on the group returned by Gtk.Accel_Group.Get_Default, which is the one used for items that don't initially have a shortcut.

Binding from C File version 2.16.6

<testgtk>create_menu.adb</testgtk>

# Packages

### User_Menu_Popup (generic)

Full description

# Classes

### Gtk_Menu_Record

- Goto declaration in source
- Goto full declaration in source

    type Gtk_Menu_Record is new
         Gtk.Menu_Shell.Gtk_Menu_Shell_Record with private;

#### Ancestors:

Gtk.Menu_Shell.Gtk_Menu_Shell_Record
Gtk.Container.Gtk_Container_Record
Gtk.Widget.Gtk_Widget_Record
Glib.Object.GObject_Record

#### Primitive operations:

Attach

- To API doc
- To spec

Attach_To_Widget

- To API doc
- To spec

Detach

- To API doc
- To spec

Get_Accel_Group

- To API doc
- To spec

Get_Accel_Path

- To API doc
- To spec

Get_Active

- To API doc
- To spec

Get_Attach_Widget

- To API doc
- To spec

Get_Monitor

- To API doc
- To spec

Get_Tearoff_State

- To API doc
- To spec

Get_Title

- To API doc
- To spec

Glib.Object.Deallocate

- To API doc
- To spec

(Inherited)
Glib.Object.Get_Type

- To API doc
- To spec

(Inherited)
Glib.Object.Notify

- To API doc
- To spec

(Inherited)
Glib.Object.Ref

- To API doc
- To spec

(Inherited)
Glib.Object.Ref_Sink

- To API doc
- To spec

(Inherited)
Glib.Object.Unref

- To API doc
- To spec

(Inherited)
Gtk.Container.Add

- To API doc
- To spec

(Inherited)
Gtk.Container.Check_Resize

- To API doc
- To spec

(Inherited)
Gtk.Container.Child_Get_Property

- To API doc
- To spec

(Inherited)
Gtk.Container.Child_Set_Property

- To API doc
- To spec

(Inherited)
Gtk.Container.Child_Type

- To API doc
- To spec

(Inherited)
Gtk.Container.Forall

- To API doc
- To spec

(Inherited)
Gtk.Container.Foreach

- To API doc
- To spec

(Inherited)
Gtk.Container.Get_Border_Width

- To API doc
- To spec

(Inherited)
Gtk.Container.Get_Children

- To API doc
- To spec

(Inherited)
Gtk.Container.Get_Focus_Chain

- To API doc
- To spec

(Inherited)
Gtk.Container.Get_Focus_Child

- To API doc
- To spec

(Inherited)
Gtk.Container.Get_Focus_Hadjustment

- To API doc
- To spec

(Inherited)
Gtk.Container.Get_Focus_Vadjustment

- To API doc
- To spec

(Inherited)
Gtk.Container.Get_Resize_Mode

- To API doc
- To spec

(Inherited)
Gtk.Container.Propagate_Expose

- To API doc
- To spec

(Inherited)
Gtk.Container.Remove

- To API doc
- To spec

(Inherited)
Gtk.Container.Resize_Children

- To API doc
- To spec

(Inherited)
Gtk.Container.Set_Border_Width

- To API doc
- To spec

(Inherited)
Gtk.Container.Set_Focus_Chain

- To API doc
- To spec

(Inherited)
Gtk.Container.Set_Focus_Child

- To API doc
- To spec

(Inherited)
Gtk.Container.Set_Focus_Hadjustment

- To API doc
- To spec

(Inherited)
Gtk.Container.Set_Focus_Vadjustment

- To API doc
- To spec

(Inherited)
Gtk.Container.Set_Reallocate_Redraws

- To API doc
- To spec

(Inherited)
Gtk.Container.Set_Resize_Mode

- To API doc
- To spec

(Inherited)
Gtk.Container.Unset_Focus_Chain

- To API doc
- To spec

(Inherited)
Gtk.Menu_Shell.Activate_Item

- To API doc
- To spec

(Inherited)
Gtk.Menu_Shell.Append

- To API doc
- To spec

(Inherited)
Gtk.Menu_Shell.Cancel

- To API doc
- To spec

(Inherited)
Gtk.Menu_Shell.Deactivate

- To API doc
- To spec

(Inherited)
Gtk.Menu_Shell.Deselect

- To API doc
- To spec

(Inherited)
Gtk.Menu_Shell.Get_Take_Focus

- To API doc
- To spec

(Inherited)
Gtk.Menu_Shell.Insert

- To API doc
- To spec

(Inherited)
Gtk.Menu_Shell.Prepend

- To API doc
- To spec

(Inherited)
Gtk.Menu_Shell.Select_First

- To API doc
- To spec

(Inherited)
Gtk.Menu_Shell.Select_Item

- To API doc
- To spec

(Inherited)
Gtk.Menu_Shell.Set_Take_Focus

- To API doc
- To spec

(Inherited)
Gtk.Widget.Activate

- To API doc
- To spec

(Inherited)
Gtk.Widget.Add_Accelerator

- To API doc
- To spec

(Inherited)
Gtk.Widget.Add_Events

- To API doc
- To spec

(Inherited)
Gtk.Widget.Add_Mnemonic_Label

- To API doc
- To spec

(Inherited)
Gtk.Widget.Can_Activate_Accel

- To API doc
- To spec

(Inherited)
Gtk.Widget.Child_Notify

- To API doc
- To spec

(Inherited)
Gtk.Widget.Class_Path

- To API doc
- To spec

(Inherited)
Gtk.Widget.Class_Path_Reversed

- To API doc
- To spec

(Inherited)
Gtk.Widget.Create_Pango_Context

- To API doc
- To spec

(Inherited)
Gtk.Widget.Create_Pango_Layout

- To API doc
- To spec

(Inherited)
Gtk.Widget.Destroy

- To API doc
- To spec

(Inherited)
Gtk.Widget.Draw

- To API doc
- To spec

(Inherited)
Gtk.Widget.Ensure_Style

- To API doc
- To spec

(Inherited)
Gtk.Widget.Error_Bell

- To API doc
- To spec

(Inherited)
Gtk.Widget.Flag_Is_Set

- To API doc
- To spec

(Inherited)
Gtk.Widget.Flags

- To API doc
- To spec

(Inherited)
Gtk.Widget.Freeze_Child_Notify

- To API doc
- To spec

(Inherited)
Gtk.Widget.Get_Allocation_Height

- To API doc
- To spec

(Inherited)
Gtk.Widget.Get_Allocation_Width

- To API doc
- To spec

(Inherited)
Gtk.Widget.Get_Allocation_X

- To API doc
- To spec

(Inherited)
Gtk.Widget.Get_Allocation_Y

- To API doc
- To spec

(Inherited)
Gtk.Widget.Get_Ancestor

- To API doc
- To spec

(Inherited)
Gtk.Widget.Get_Child_Requisition

- To API doc
- To spec

(Inherited)
Gtk.Widget.Get_Child_Visible

- To API doc
- To spec

(Inherited)
Gtk.Widget.Get_Colormap

- To API doc
- To spec

(Inherited)
Gtk.Widget.Get_Composite_Name

- To API doc
- To spec

(Inherited)
Gtk.Widget.Get_Direction

- To API doc
- To spec

(Inherited)
Gtk.Widget.Get_Events

- To API doc
- To spec

(Inherited)
Gtk.Widget.Get_Extension_Events

- To API doc
- To spec

(Inherited)
Gtk.Widget.Get_Has_Tooltip

- To API doc
- To spec

(Inherited)
Gtk.Widget.Get_Name

- To API doc
- To spec

(Inherited)
Gtk.Widget.Get_No_Show_All

- To API doc
- To spec

(Inherited)
Gtk.Widget.Get_Pango_Context

- To API doc
- To spec

(Inherited)
Gtk.Widget.Get_Parent

- To API doc
- To spec

(Inherited)
Gtk.Widget.Get_Parent_Window

- To API doc
- To spec

(Inherited)
Gtk.Widget.Get_Pointer

- To API doc
- To spec

(Inherited)
Gtk.Widget.Get_Root_Window

- To API doc
- To spec

(Inherited)
Gtk.Widget.Get_Size_Request

- To API doc
- To spec

(Inherited)
Gtk.Widget.Get_Snapshot

- To API doc
- To spec

(Inherited)
Gtk.Widget.Get_State

- To API doc
- To spec

(Inherited)
Gtk.Widget.Get_Style

- To API doc
- To spec

(Inherited)
Gtk.Widget.Get_Tooltip_Markup

- To API doc
- To spec

(Inherited)
Gtk.Widget.Get_Tooltip_Text

- To API doc
- To spec

(Inherited)
Gtk.Widget.Get_Tooltip_Window

- To API doc
- To spec

(Inherited)
Gtk.Widget.Get_Toplevel

- To API doc
- To spec

(Inherited)
Gtk.Widget.Get_Visual

- To API doc
- To spec

(Inherited)
Gtk.Widget.Get_Window

- To API doc
- To spec

(Inherited)
Gtk.Widget.Grab_Default

- To API doc
- To spec

(Inherited)
Gtk.Widget.Grab_Focus

- To API doc
- To spec

(Inherited)
Gtk.Widget.Has_Screen

- To API doc
- To spec

(Inherited)
Gtk.Widget.Hide

- To API doc
- To spec

(Inherited)
Gtk.Widget.Hide_All

- To API doc
- To spec

(Inherited)
Gtk.Widget.Input_Shape_Combine_Mask

- To API doc
- To spec

(Inherited)
Gtk.Widget.Intersect

- To API doc
- To spec

(Inherited)
Gtk.Widget.Is_Ancestor

- To API doc
- To spec

(Inherited)
Gtk.Widget.Is_Composited

- To API doc
- To spec

(Inherited)
Gtk.Widget.Is_Focus

- To API doc
- To spec

(Inherited)
Gtk.Widget.Keynav_Failed

- To API doc
- To spec

(Inherited)
Gtk.Widget.List_Mnemonic_Labels

- To API doc
- To spec

(Inherited)
Gtk.Widget.Map

- To API doc
- To spec

(Inherited)
Gtk.Widget.Mnemonic_Activate

- To API doc
- To spec

(Inherited)
Gtk.Widget.Modify_Base

- To API doc
- To spec

(Inherited)
Gtk.Widget.Modify_Bg

- To API doc
- To spec

(Inherited)
Gtk.Widget.Modify_Cursor

- To API doc
- To spec

(Inherited)
Gtk.Widget.Modify_Fg

- To API doc
- To spec

(Inherited)
Gtk.Widget.Modify_Font

- To API doc
- To spec

(Inherited)
Gtk.Widget.Modify_Text

- To API doc
- To spec

(Inherited)
Gtk.Widget.Path

- To API doc
- To spec

(Inherited)
Gtk.Widget.Path_Reversed

- To API doc
- To spec

(Inherited)
Gtk.Widget.Queue_Clear

- To API doc
- To spec

(Inherited)
Gtk.Widget.Queue_Clear_Area

- To API doc
- To spec

(Inherited)
Gtk.Widget.Queue_Draw

- To API doc
- To spec

(Inherited)
Gtk.Widget.Queue_Draw_Area

- To API doc
- To spec

(Inherited)
Gtk.Widget.Queue_Resize

- To API doc
- To spec

(Inherited)
Gtk.Widget.Queue_Resize_No_Redraw

- To API doc
- To spec

(Inherited)
Gtk.Widget.Realize

- To API doc
- To spec

(Inherited)
Gtk.Widget.Region_Intersect

- To API doc
- To spec

(Inherited)
Gtk.Widget.Remove_Accelerator

- To API doc
- To spec

(Inherited)
Gtk.Widget.Remove_Mnemonic_Label

- To API doc
- To spec

(Inherited)
Gtk.Widget.Render_Icon

- To API doc
- To spec

(Inherited)
Gtk.Widget.Reparent

- To API doc
- To spec

(Inherited)
Gtk.Widget.Reset_Rc_Styles

- To API doc
- To spec

(Inherited)
Gtk.Widget.Reset_Shapes

- To API doc
- To spec

(Inherited)
Gtk.Widget.Restore_Default_Style

- To API doc
- To spec

(Inherited)
Gtk.Widget.Send_Expose

- To API doc
- To spec

(Inherited)
Gtk.Widget.Set_Accel_Path

- To API doc
- To spec

(Inherited)
Gtk.Widget.Set_App_Paintable

- To API doc
- To spec

(Inherited)
Gtk.Widget.Set_Child_Visible

- To API doc
- To spec

(Inherited)
Gtk.Widget.Set_Colormap

- To API doc
- To spec

(Inherited)
Gtk.Widget.Set_Composite_Name

- To API doc
- To spec

(Inherited)
Gtk.Widget.Set_Direction

- To API doc
- To spec

(Inherited)
Gtk.Widget.Set_Double_Buffered

- To API doc
- To spec

(Inherited)
Gtk.Widget.Set_Events

- To API doc
- To spec

(Inherited)
Gtk.Widget.Set_Extension_Events

- To API doc
- To spec

(Inherited)
Gtk.Widget.Set_Flags

- To API doc
- To spec

(Inherited)
Gtk.Widget.Set_Has_Tooltip

- To API doc
- To spec

(Inherited)
Gtk.Widget.Set_Name

- To API doc
- To spec

(Inherited)
Gtk.Widget.Set_No_Show_All

- To API doc
- To spec

(Inherited)
Gtk.Widget.Set_Parent

- To API doc
- To spec

(Inherited)
Gtk.Widget.Set_Parent_Window

- To API doc
- To spec

(Inherited)
Gtk.Widget.Set_Redraw_On_Allocate

- To API doc
- To spec

(Inherited)
Gtk.Widget.Set_Scroll_Adjustments

- To API doc
- To spec

(Inherited)
Gtk.Widget.Set_Sensitive

- To API doc
- To spec

(Inherited)
Gtk.Widget.Set_Size_Request

- To API doc
- To spec

(Inherited)
Gtk.Widget.Set_State

- To API doc
- To spec

(Inherited)
Gtk.Widget.Set_Style

- To API doc
- To spec

(Inherited)
Gtk.Widget.Set_Tooltip_Markup

- To API doc
- To spec

(Inherited)
Gtk.Widget.Set_Tooltip_Text

- To API doc
- To spec

(Inherited)
Gtk.Widget.Set_Tooltip_Window

- To API doc
- To spec

(Inherited)
Gtk.Widget.Set_UPosition

- To API doc
- To spec

(Inherited)
Gtk.Widget.Set_USize

- To API doc
- To spec

(Inherited)
Gtk.Widget.Set_Window

- To API doc
- To spec

(Inherited)
Gtk.Widget.Shape_Combine_Mask

- To API doc
- To spec

(Inherited)
Gtk.Widget.Show

- To API doc
- To spec

(Inherited)
Gtk.Widget.Show_All

- To API doc
- To spec

(Inherited)
Gtk.Widget.Show_Now

- To API doc
- To spec

(Inherited)
Gtk.Widget.Size_Allocate

- To API doc
- To spec

(Inherited)
Gtk.Widget.Size_Request

- To API doc
- To spec

(Inherited)
Gtk.Widget.Style_Get_Property

- To API doc
- To spec

(Inherited)
Gtk.Widget.Thaw_Child_Notify

- To API doc
- To spec

(Inherited)
Gtk.Widget.Trigger_Tooltip_Query

- To API doc
- To spec

(Inherited)
Gtk.Widget.Unmap

- To API doc
- To spec

(Inherited)
Gtk.Widget.Unrealize

- To API doc
- To spec

(Inherited)
Gtk.Widget.Unset_Flags

- To API doc
- To spec

(Inherited)
Popdown

- To API doc
- To spec

Popup

- To API doc
- To spec

Popup

- To API doc
- To spec

Reorder_Child

- To API doc
- To spec

Reposition

- To API doc
- To spec

Set_Accel_Group

- To API doc
- To spec

Set_Accel_Path

- To API doc
- To spec

Set_Active

- To API doc
- To spec

Set_Monitor

- To API doc
- To spec

Set_Screen

- To API doc
- To spec

Set_Tearoff_State

- To API doc
- To spec

Set_Title

- To API doc
- To spec

# Types

### Gtk_Menu

- Goto declaration in source

    type Gtk_Menu is access all Gtk_Menu_Record'Class;

### Gtk_Menu_Detach_Func

- Goto declaration in source

    type Gtk_Menu_Detach_Func is access procedure
         (Attach_Widget : access Gtk.Widget.Gtk_Widget_Record'Class;
          Menu          : access Gtk_Menu_Record'Class);

### Gtk_Menu_Position_Func

- Goto declaration in source

    type Gtk_Menu_Position_Func is access procedure
         (Menu : access Gtk_Menu_Record'Class;
          X    : out Gint;
          Y    : out Gint);

This function is called when displaying a popup menu on the screen. It should return the (X, Y) coordinates of the menu. Note that you might want to attach the menu to a widget first if you want to display the menu relative to its attached widget. Note that there is a second version of this function (with added user data in the package User_Menu_Popup below

### C_Gtk_Menu_Position_Func

- Goto declaration in source

    type C_Gtk_Menu_Position_Func is access procedure
         (Menu      : System.Address;
          X         : out Gint;
          Y         : out Gint;
          Push_In   : out Gboolean;
          User_Data : System.Address);

# Constants & Global variables

### Accel_Group_Property

- Goto declaration in source

(Glib.Properties.Property_Object)

    Accel_Group_Property   : constant Glib.Properties.Property_Object;

### Accel_Path_Property

- Goto declaration in source

(Glib.Properties.Property_String)

    Accel_Path_Property    : constant Glib.Properties.Property_String;

### Active_Property

- Goto declaration in source

(Glib.Properties.Property_Int)

    Active_Property        : constant Glib.Properties.Property_Int;

### Attach_Widget_Property

- Goto declaration in source

(Glib.Properties.Property_Object)

    Attach_Widget_Property : constant Glib.Properties.Property_Object;

### Monitor_Property

- Goto declaration in source

(Glib.Properties.Property_Int)

    Monitor_Property       : constant Glib.Properties.Property_Int;

### Tearoff_State_Property

- Goto declaration in source

(Glib.Properties.Property_Boolean)

    Tearoff_State_Property : constant Glib.Properties.Property_Boolean;

### Tearoff_Title_Property

- Goto declaration in source

(Glib.Properties.Property_String)

    Tearoff_Title_Property : constant Glib.Properties.Property_String;

### Bottom_Attach_Property

- Goto declaration in source

(Glib.Properties.Property_Int)

    Bottom_Attach_Property : constant Glib.Properties.Property_Int;

### Left_Attach_Property

- Goto declaration in source

(Glib.Properties.Property_Int)

    Left_Attach_Property   : constant Glib.Properties.Property_Int;

### Right_Attach_Property

- Goto declaration in source

(Glib.Properties.Property_Int)

    Right_Attach_Property  : constant Glib.Properties.Property_Int;

### Top_Attach_Property

- Goto declaration in source

(Glib.Properties.Property_Int)

    Top_Attach_Property    : constant Glib.Properties.Property_Int;

### Arrow_Placement_Property

- Goto declaration in source

(Glib.Properties.Property_Enum)

    Arrow_Placement_Property    : constant Glib.Properties.Property_Enum;

### Arrow_Scaling_Property

- Goto declaration in source

(Glib.Properties.Property_Float)

    Arrow_Scaling_Property      : constant Glib.Properties.Property_Float;

### Double_Arrows_Property

- Goto declaration in source

(Glib.Properties.Property_Boolean)

    Double_Arrows_Property      : constant Glib.Properties.Property_Boolean;

### Horizontal_Offset_Property

- Goto declaration in source

(Glib.Properties.Property_Int)

    Horizontal_Offset_Property  : constant Glib.Properties.Property_Int;

### Horizontal_Padding_Property

- Goto declaration in source

(Glib.Properties.Property_Int)

    Horizontal_Padding_Property : constant Glib.Properties.Property_Int;

### Vertical_Offset_Property

- Goto declaration in source

(Glib.Properties.Property_Int)

    Vertical_Offset_Property    : constant Glib.Properties.Property_Int;

### Vertical_Padding_Property

- Goto declaration in source

(Glib.Properties.Property_Int)

    Vertical_Padding_Property   : constant Glib.Properties.Property_Int;

### Signal_Move_Scroll

- Goto declaration in source

(Glib.Signal_Name)

    Signal_Move_Scroll : constant Glib.Signal_Name := "move_scroll";

# Subprograms & Entries

### Gtk_New

- Goto spec in source

    procedure Gtk_New (Widget: out Gtk_Menu);

Create a new empty menu.

### Initialize

- Goto spec in source

    procedure Initialize (Widget: access Gtk_Menu_Record'Class);

Internal initialization function. See the section "Creating your own widgets" in the documentation.

### Get_Type

- Goto spec in source
- Goto body in source

    function Get_Type return Gtk.Gtk_Type;

Return the internal value associated with a Gtk_Menu.

### Set_Active

- Goto spec in source

    procedure Set_Active (Menu: access Gtk_Menu_Record;Index: Guint);

### Get_Active

- Goto spec in source

    function Get_Active (Menu: access Gtk_Menu_Record) return Gtk.Menu_Item.Gtk_Menu_Item;

Select a specified item in the menu. You will almost never need this function, it is used internally by Gtk_Option_Menu, for which it is the item that is currently selected. Note that the item is not considered as being pressed by the user when you call Set_Active, and thus no callback is called as a result.

### Set_Tearoff_State

- Goto spec in source

    procedure Set_Tearoff_State (Menu: access Gtk_Menu_Record;Torn_Off: Boolean);

### Get_Tearoff_State

- Goto spec in source

    function Get_Tearoff_State (Menu: access Gtk_Menu_Record) return Boolean;

Modify the tearoff status of the menu. If Torn_Off is False, the menu is displayed as a drop down menu which disappears when the menu is not active. If Torn_Off is True, the menu persists until it is closed or reattached. Note that you can give the user access to this functionality by inserting a Gtk_Tearoff_Menu_Item in the menu.

### Set_Title

- Goto spec in source

    procedure Set_Title (Menu: access Gtk_Menu_Record;Title: UTF8_String);

### Get_Title

- Goto spec in source

    function Get_Title  (Menu: access Gtk_Menu_Record) return UTF8_String;

Set the title of the menu. Title is displayed when the menu is displayed as a tearoff menu in an independent window.

### Reorder_Child

- Goto spec in source

    procedure Reorder_Child (Menu: access Gtk_Menu_Record;Child: access Gtk.Widget.Gtk_Widget_Record'Class;Position: Gint);

Move an existing menu_item within the menu. Its new position is given by Position, 0 being the first item in the menu. If Child does not exist in the menu, nothing is done.

### Attach

- Goto spec in source

    procedure Attach (Menu: access Gtk_Menu_Record;Child: access Gtk.Menu_Item.Gtk_Menu_Item_Record'Class;Left_Attach: Guint;Right_Attach: Guint;Top_Attach: Guint;Bottom_Attach: Guint);

Adds a new #GtkMenuItem to a (table) menu. The number of 'cells' that an item will occupy is specified by left_attach, right_attach, top_attach and bottom_attach. These each represent the leftmost, rightmost, uppermost and lower column and row numbers of the table. (Columns and rows are indexed from zero). Note that this function is not related to Detach(). Adding items to a standard menu is simply done by calling Add().

### Popup

- Goto spec in source

    procedure Popup (Menu: access Gtk_Menu_Record;Parent_Menu_Shell: Gtk.Menu_Shell.Gtk_Menu_Shell := null;Parent_Menu_Item: Gtk.Menu_Item.Gtk_Menu_Item := null;Func: Gtk_Menu_Position_Func := null;Button: Guint := 1;Activate_Time: Guint32 := 0);

Display a menu on the screen. This is the function to use to create contextual menus. Most of the time, the parameters can have a null value. Parent_Menu_Shell is the Gtk_Menu_Shell that contains Parent_Menu_Item, i.e. the widget that triggered the display of the menu. Func is a function that returns the coordinates for the menu. If it is null, then a default function that positions the menu at the pointer location is used. Button is the mouse button that was pressed to initiate the event. Activate_Time is the time at which the event occurred (you can get it directly from the Gdk_Event structure). Note that a variant of this function is given in the generic package User_Menu_Popup.

### Popup

- Goto spec in source

    procedure Popup (Menu: access Gtk_Menu_Record;Parent_Menu_Shell: Gtk.Menu_Shell.Gtk_Menu_Shell := null;Parent_Menu_Item: Gtk.Menu_Item.Gtk_Menu_Item := null;Func: C_Gtk_Menu_Position_Func := null;User_Data: System.Address;Button: Guint := 1;Activate_Time: Guint32 := 0);

Similar to the Popup function above, but exposes a lower level interface to a C positioning function (C_Gtk_Menu_Position_Func).

### Popdown

- Goto spec in source

    procedure Popdown (Menu: access Gtk_Menu_Record);

Remove the menu from the screen

### Reposition

- Goto spec in source

    procedure Reposition (Menu: access Gtk_Menu_Record);

Reposition a menu according to its position function. This function is set when Popup is called.

### Set_Monitor

- Goto spec in source

    procedure Set_Monitor (Menu: access Gtk_Menu_Record;Monitor_Num: Gint);

Informs GTK+ on which monitor a menu should be popped up. See Gdk.Screen.Get_Monitor_Geometry. This function should be called from a Gtk_Menu_Position_Func if the menu should not appear on the same monitor as the pointer. This information can't be reliably inferred from the coordinates returned by a Gtk_Menu_Position_Func, since, for very long menus, these coordinates may extend beyond the monitor boundaries or even the screen boundaries.

### Get_Monitor

- Goto spec in source

    function Get_Monitor (Menu: access Gtk_Menu_Record) return Gint;

Retrieves the number of the monitor on which to show the menu, or -1 if no monitor has been set.

### Set_Screen

- Goto spec in source

    procedure Set_Screen (Menu: access Gtk_Menu_Record;Screen: access Gdk.Screen.Gdk_Screen_Record'Class);

Sets the Gdk_Screen on which the menu will be displayed.

### Set_Accel_Group

- Goto spec in source

    procedure Set_Accel_Group (Menu: access Gtk_Menu_Record;Accel: Accel_Group.Gtk_Accel_Group);

### Get_Accel_Group

- Goto spec in source

    function Get_Accel_Group (Menu: access Gtk_Menu_Record) return Accel_Group.Gtk_Accel_Group;

Set the Accel_Group that holds the global accelerators and key bindings for the menu.

### Set_Accel_Path

- Goto spec in source

    procedure Set_Accel_Path (Menu: access Gtk_Menu_Record;Accel_Path: UTF8_String);

### Get_Accel_Path

- Goto spec in source

    function Get_Accel_Path (Menu: access Gtk_Menu_Record) return String;

Set an accelerator path for this menu from which accelerator paths for its immediate children, its menu items, can be constructed. The main purpose of this function is to spare the programmer the inconvenience of having to call Gtk.Menu_Item.Set_Accel_Path on each menu item that should support runtime user changable accelerators. Instead, by just calling Gtk.Menu.Set_Accel_Path on their parent, each menu item of this menu, that contains a label describing its purpose, automatically gets an accel path assigned. For example, a menu containing menu items "New" and "Exit", will, after Set_Accel_Path (menu, "<Gnumeric-Sheet>/File"); has been called, assign its items the accel paths: "<Gnumeric-Sheet>/File/New" and "<Gnumeric-Sheet>/File/Exit". Assigning accel paths to menu items then enables the user to change their accelerators at runtime.

### Attach_To_Widget

- Goto spec in source

    procedure Attach_To_Widget (Menu: access Gtk_Menu_Record;Attach_Widget: access Gtk.Widget.Gtk_Widget_Record'Class;Detacher: Gtk_Menu_Detach_Func);

Attach a menu to the widget. When the menu is detached from the widget (for instance when it is destroyed), the procedure Detacher will be called. You will almost never need to use this function, unless you specifically want a call back when a widget becomes unavailable. If Attach_Widget is a menu_item with a single label in it, the name of the window created when Menu is teared-off will be the label in the menu_item.

### Detach

- Goto spec in source

    procedure Detach (Menu: access Gtk_Menu_Record);

Detach the menu from its widget, and call the Detacher set in Attach_To_Widget.

### Get_Attach_Widget

- Goto spec in source

    function Get_Attach_Widget (Menu: access Gtk_Menu_Record) return Gtk.Widget.Gtk_Widget;

Return the widget to which the menu was attached. If the menu was not attached, this function returns null.

### Get_For_Attach_Widget

- Goto spec in source

    function Get_For_Attach_Widget (Widget: access Gtk.Widget.Gtk_Widget_Record'Class) return Gtk.Widget.Widget_List.Glist;

Returns a list of the menus which are attached to this widget. This list is owned by GTK+ and must not be modified.