Pike v8.0 release 1738

Method GTKSupport.MenuFactory.MenuDef()->create()


Method create

GTKSupport.MenuFactory.MenuDef GTKSupport.MenuFactory.MenuDef(string path, function(:void)|void cb, mixed|void cbarg, string|void binding, int|void right)

Parameter path

Path is the menupath. A submenu will be created for each "Directory" in the path, and menuitems will be created for the "files". There are two special cases: The "file" "<separator>" will create a thin line. The "file"-prefix "<check>" will make the menuitem a checkmenuitem instead of a normal menuitem.

Parameter cb
Parameter cbarg

The second and third arguments are the callback function and the first callback function argument. If the callback function argument is an array, the indices of the array will be pushed as arguments. To call the function with an array as the only argument, make an array with the array in. The callback function will be called like callback( arg, widget ), or if arg is an array, callback( arg[0], arg[1], ..., widget ).

Parameter shortcut

The fourth argument, shortcut, is the shortcut to bind to this menu item. The shortcut can be changed later on by calling assign_shortcut, or by the user by pressing the desired keycombination over the menu item.

The shortcut syntax is: m[m[..]]-key, where m is one or more modifier character, and key is the desired key (NOTE: Key must be in the range 0-255 currently, this will hopefully be fixed by the GTK people in the future)

The modifiers are:

"s"

Shift

"c"

Control

"a"

Modifier 1 (called alt by the GTK people, that's not true, though)

"1"
"g"

Modifier 2 (called altgr by the GTK people, that's not true, though)

"2"
"m"

Modifier 3 (not mapped by the GTK people, meta on _my_ keyboard)

"3"
"h"

Modifier 4 (not mapped by the GTK people, hyper on _my_ keyboard)

"4"
"u"

Modifier 5 (not mapped by the GTK people, super on _my_ keyboard)

"5"
Parameter right

Currently ignored.