Back to Seed Clases

Gtk


Classes

Interfaces

Structs

Unions

Enums

Class Gtk.Menu

Import line: Gtk = imports.gi.Gtk;
GIR File: Gtk-3.0.gir
C documentation: GtkMenu
Class : Menu
Implements: Atk.ImplementorIface, Gtk.Buildable
Extends: Gtk.MenuShell
A GtkMenu is a GtkMenuShell that implements a drop down menu
consisting of a list of GtkMenuItem objects which can be navigated
and activated by the user to perform application functions.
A GtkMenu is most commonly dropped down by activating a
GtkMenuItem in a GtkMenuBar or popped up by activating a
GtkMenuItem in another GtkMenu.
A GtkMenu can also be popped up by activating a GtkOptionMenu.
Other composite widgets such as the GtkNotebook can pop up a
GtkMenu as well.
Applications can display a GtkMenu 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 == 3)
{
gtk_menu_popup (menu, NULL, NULL, NULL, NULL,
event_button->button, event_button->time);
return TRUE;
}
}
return FALSE;
}

Properties
Properties Defined By
Methods / Constructors
Method / Constructor Defined By
Events - usage syntax: this.signals.EVENTNAME.connect( Function )
Event Defined By
Used by These Methods / Signals / Properties
Class / Namespace Method / Signal / Properties
Gtk.AppChooserWidget
Signal
populate_popup (AppChooserWidget self, Menu menu, AppInfo application) : none
Emitted when a context menu is about to popup over an application item.
Gtk.Entry
Signal
populate_popup (Entry self, Menu menu) : none
The ::populate-popup signal gets emitted before showing the
context menu of the entry.
Gtk.Label
Signal
populate_popup (Label self, Menu menu) : none
The ::populate-popup signal gets emitted before showing the
context menu of the label.
Gtk.MenuItem
Property
submenu : Gtk.Menu
The submenu attached to the menu item, or NULL if it has none.
Gtk.MenuToolButton
Property
menu : Gtk.Menu
Gtk.StatusIcon
Method
Gtk.StatusIcon.position_menu (Menu menu, gint32 x, gint32 y, gboolean push_in, StatusIcon user_data) : Object
Menu positioning function to use with gtk_menu_popup()
to position menu aligned to the status icon user_data.
Gtk.TextView
Signal
populate_popup (TextView self, Menu menu) : none
The ::populate-popup signal gets emitted before showing the
context menu of the text view.
PeasGtk.PluginManagerView
Signal
populate_popup (PluginManagerView self, Menu menu) : none
WebKit.WebView
Signal
populate_popup (WebView self, Menu menu) : none
When a context menu is about to be displayed this signal is emitted.
Documentation generated by Introspection Doc Generator Loosely Based on JsDoc Toolkit on Sat Apr 16 2011 17:13:13 GMT+0800 (HKT)