gtk.ItemFactory Signal Prototypes

Description

Warning

The gtk.ItemFactory
provides a convenient way to create and manage menus, menubars and option
menus from a data description. The data description is a tuple or list
containing a list of entry tuples that each describe an individual menu,
menuitem, etc. Each entry tuple may contain the following entry fields
though only the path must be specified; the other fields are
optional:

A path that defines the logical position of the menu or
menuitem in the menu hierarchy. a path is similar to a file path in that it
starts with a slash (/) character and all components are joined by a slash
(/) character. The last component may have an underscore that indicates that
the following character is to be used as the accelerator mnemonic.

An accelerator that defines a key sequence that will
activate the menuitem. The key sequence is a set of zero or more modifiers
followed by a single key. The modifier keys are:

"<alt>"

Alt-Lor
Alt-R

"<ctl>", "<ctrl>", "<control>"

Ctrl-Lor
Ctrl-R

"<shift>", "<shft>"

Shift-Lor
Shift-R

A callback function or method that will be invoked when the
menu item is activated or the accelerator key sequence is pressed. The
callback function is defined as either:

where callback_action is the
callback action defined below, callback_data is the
data passed with the create_items()
method and widget is the menuitem widget. The second
definition must be used if no callback_data argument
is specified by the call to create_items().

a gtk.AccelGroup
to which the accelerators for the menu items will be added, or
None to create a new one

The construct() method initializes an
item factory.

gtk.ItemFactory.get_item

def get_item(path)

path :

the path to the menu item

Returns :

the menu item with the specified
path, or None if
path doesn't lead to a menu item

The get_item() method returns the menu
item that corresponds to path. If the widget
corresponding to path is a menu item that opens a
submenu, then the item is returned. If you are interested in the submenu,
use the get_widget()
method instead.

gtk.ItemFactory.get_widget

def get_widget(path)

path :

the path to the widget

Returns :

the widget associated with the specified
path, or None if
path doesn't lead to a widget

The get_widget() method returns the
widget that corresponds to path. If the widget
corresponding to path is a menu item that opens a
submenu, then the submenu is returned. If you are interested in the menu
item, use get_item()
instead.

gtk.ItemFactory.get_widget_by_action

def get_widget_by_action(action)

action :

a callback action value

Returns :

the widget that corresponds to the given
action, or None if no widget was
found

The get_widget_by_action() method
returns the widget that is associated with the specified
action. If there are multiple items with the same
action, the result is undefined.

gtk.ItemFactory.get_item_by_action

def get_item_by_action(action)

action :

a callback action value

Returns :

the menu item that corresponds to the specified
action, or None if no menu item
was found

The get_item_by_action() returns the
menu item that is associated with the specified
action.

gtk.ItemFactory.create_items

def create_items(entries, callback_data=None)

entries :

a tuple or list of item factory
entries

callback_data :

optional data passed to the callback functions
of all entries

The create_items() method creates the
menu items from the specified item factory entries.
If no callback_data is specified it will not be
passed to the callback functions i.e the callback functions will be passed
one less argument.

gtk.ItemFactory.delete_item

def delete_item(path)

path :

a path

The delete_item() method deletes the
menu item that was created with the specified
path.

gtk.ItemFactory.popup

def popup(x, y, mouse_button, time=0L)

x :

the x position

y :

the y position

mouse_button :

the mouse button that was pressed to initiate
this action

time :

an optional timestamp for this action; default
is 0L which means use the current time

The popup() method pops up the menu
constructed from the item factory at the specified location
(x, y). This method is
generally invoked in response to a "button_press_event" so the arguments are
retrieved from the event information.