package Implements_Gtk_Buildable is new Glib.Types.Implements (Gtk.Buildable.Gtk_Buildable, Gtk_Menu_Record, Gtk_Menu);
type Gtk_Menu_Record is new Gtk_Menu_Shell_Record with null record;
type Gtk_Menu is access all Gtk_Menu_Record'Class;
type Gtk_Menu_Detach_Func is access procedure (Attach_Widget : System.Address; Menu : System.Address);
type Gtk_Menu_Position_Func is access procedure (Menu : not null access Gtk_Menu_Record'Class; X : in out Gint; Y : in out Gint; Push_In : out Boolean);
type Cb_Gtk_Menu_Gtk_Scroll_Type_Void is not null access procedure (Self : access Gtk_Menu_Record'Class; Scroll_Type : Gtk.Enums.Gtk_Scroll_Type);
type Cb_GObject_Gtk_Scroll_Type_Void is not null access procedure (Self : access Glib.Object.GObject_Record'Class; Scroll_Type : Gtk.Enums.Gtk_Scroll_Type);
Accel_Group_Property : constant Glib.Properties.Property_Object;
Accel_Path_Property : constant Glib.Properties.Property_String;
Active_Property : constant Glib.Properties.Property_Int;
Attach_Widget_Property : constant Glib.Properties.Property_Object;
Monitor_Property : constant Glib.Properties.Property_Int;
Reserve_Toggle_Size_Property : constant Glib.Properties.Property_Boolean;
Tearoff_State_Property : constant Glib.Properties.Property_Boolean;
Tearoff_Title_Property : constant Glib.Properties.Property_String;
Signal_Move_Scroll : constant Glib.Signal_Name := "move-scroll";
procedure Gtk_New
( | Menu | : out Gtk_Menu); |
procedure Initialize
( | Menu | : not null access Gtk_Menu_Record'Class); |
procedure Gtk_New_From_Model
( | Menu | : out Gtk_Menu; |
Model | : not null access Glib.Menu_Model.Gmenu_Model_Record'Class); |
procedure Initialize_From_Model
( | Menu | : not null access Gtk_Menu_Record'Class; |
Model | : not null access Glib.Menu_Model.Gmenu_Model_Record'Class); |
function Gtk_Menu_New_From_Model
( | Model | : not null access Glib.Menu_Model.Gmenu_Model_Record'Class) return Gtk_Menu; |
function Get_Type return Glib.GType;
procedure Attach
( | Menu | : not null access Gtk_Menu_Record; |
Child | : not null access Gtk.Widget.Gtk_Widget_Record'Class; | |
Left_Attach | : Guint; | |
Right_Attach | : Guint; | |
Top_Attach | : Guint; | |
Bottom_Attach | : Guint); |
procedure Attach_To_Widget
( | Menu | : not null access Gtk_Menu_Record; |
Attach_Widget | : not null access Gtk.Widget.Gtk_Widget_Record'Class; | |
Detacher | : Gtk_Menu_Detach_Func); |
procedure Detach
( | Menu | : not null access Gtk_Menu_Record); |
function Get_Accel_Group
( | Menu | : not null access Gtk_Menu_Record) return Gtk.Accel_Group.Gtk_Accel_Group; |
procedure Set_Accel_Group
( | Menu | : not null access Gtk_Menu_Record; |
Accel_Group | : access Gtk.Accel_Group.Gtk_Accel_Group_Record'Class); |
function Get_Accel_Path
( | Menu | : not null access Gtk_Menu_Record) return UTF8_String; |
procedure Set_Accel_Path
( | Menu | : not null access Gtk_Menu_Record; |
Accel_Path | : UTF8_String := ""); |
function Get_Active
( | Menu | : not null access Gtk_Menu_Record) return Gtk.Menu_Item.Gtk_Menu_Item; |
procedure Set_Active
( | Menu | : not null access Gtk_Menu_Record; |
Index | : Guint); |
function Get_Attach_Widget
( | Menu | : not null access Gtk_Menu_Record) return Gtk.Widget.Gtk_Widget; |
function Get_Monitor
( | Menu | : not null access Gtk_Menu_Record) return Gint; |
procedure Set_Monitor
( | Menu | : not null access Gtk_Menu_Record; |
Monitor_Num | : Gint); |
function Get_Reserve_Toggle_Size
( | Menu | : not null access Gtk_Menu_Record) return Boolean; |
procedure Set_Reserve_Toggle_Size
( | Menu | : not null access Gtk_Menu_Record; |
Reserve_Toggle_Size | : Boolean); |
function Get_Tearoff_State
( | Menu | : not null access Gtk_Menu_Record) return Boolean; |
procedure Set_Tearoff_State
( | Menu | : not null access Gtk_Menu_Record; |
Torn_Off | : Boolean); |
function Get_Title
( | Menu | : not null access Gtk_Menu_Record) return UTF8_String; |
procedure Set_Title
( | Menu | : not null access Gtk_Menu_Record; |
Title | : UTF8_String); |
procedure Popdown
( | Menu | : not null access Gtk_Menu_Record); |
procedure Popup
( | Menu | : not null 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); |
procedure Popup_For_Device
( | Menu | : not null access Gtk_Menu_Record; |
Device | : access Gdk.Device.Gdk_Device_Record'Class; | |
Parent_Menu_Shell | : access Gtk.Widget.Gtk_Widget_Record'Class; | |
Parent_Menu_Item | : access Gtk.Widget.Gtk_Widget_Record'Class; | |
Func | : Gtk_Menu_Position_Func; | |
Button | : Guint; | |
Activate_Time | : Guint32); |
procedure Reorder_Child
( | Menu | : not null access Gtk_Menu_Record; |
Child | : not null access Gtk.Widget.Gtk_Widget_Record'Class; | |
Position | : Gint); |
procedure Reposition
( | Menu | : not null access Gtk_Menu_Record); |
procedure Set_Screen
( | Menu | : not null access Gtk_Menu_Record; |
Screen | : access Gdk.Screen.Gdk_Screen_Record'Class); |
function Get_For_Attach_Widget
( | Widget | : not null access Gtk.Widget.Gtk_Widget_Record'Class) return Gtk.Widget.Widget_List.Glist; |
procedure On_Move_Scroll
( | Self | : not null access Gtk_Menu_Record; |
Call | : Cb_Gtk_Menu_Gtk_Scroll_Type_Void; | |
After | : Boolean := False); |
procedure On_Move_Scroll
( | Self | : not null access Gtk_Menu_Record; |
Call | : Cb_GObject_Gtk_Scroll_Type_Void; | |
Slot | : not null access Glib.Object.GObject_Record'Class; | |
After | : Boolean := False); |
function "+"
( | Widget | : access Gtk_Menu_Record'Class) return Gtk.Buildable.Gtk_Buildable renames Implements_Gtk_Buildable.To_Interface; |
function "-"
( | Interf | : Gtk.Buildable.Gtk_Buildable) return Gtk_Menu renames Implements_Gtk_Buildable.To_Object; |
A Gtk.Menu.Gtk_Menu is a Gtk.Menu_Shell.Gtk_Menu_Shell that implements a drop down menu consisting of a list of Gtk.Menu_Item.Gtk_Menu_Item objects which can be navigated and activated by the user to perform application functions.
A Gtk.Menu.Gtk_Menu is most commonly dropped down by activating a Gtk.Menu_Item.Gtk_Menu_Item in a Gtk.Menu_Bar.Gtk_Menu_Bar or popped up by activating a Gtk.Menu_Item.Gtk_Menu_Item in another Gtk.Menu.Gtk_Menu.
A Gtk.Menu.Gtk_Menu can also be popped up by activating a Gtk.Combo_Box.Gtk_Combo_Box. Other composite widgets such as the Gtk.Notebook.Gtk_Notebook can pop up a Gtk.Menu.Gtk_Menu as well.
Applications can display a Gtk.Menu.Gtk_Menu as a popup menu by calling the Gtk.Menu.Popup function. The example below shows how an application can pop up a menu when the 3rd mouse button is pressed. == Connecting the popup signal handler. == /<!---->* connect our handler which will popup the menu *<!---->/ g_signal_connect_swapped (window, "button_press_event", G_CALLBACK (my_popup_handler), menu); == Signal handler which displays a popup menu. == static gint my_popup_handler (GtkWidget *widget, GdkEvent *event) { GtkMenu *menu; GdkEventButton *event_button; g_return_val_if_fail (widget != NULL, FALSE); g_return_val_if_fail (GTK_IS_MENU (widget), FALSE); g_return_val_if_fail (event != NULL, FALSE); /<!---->* The "widget" is the menu that was supplied when * g_signal_connect_swapped was called. *<!---->/ menu = GTK_MENU (widget); if (event->type == GDK_BUTTON_PRESS) { event_button = (GdkEventButton *) event; if (event_button->button == GDK_BUTTON_SECONDARY) { gtk_menu_popup (menu, NULL, NULL, NULL, NULL, event_button->button, event_button->time); return TRUE; } } return FALSE; }