EZ
Up Prev Next Contents


3.7.6 Creating Simple Menus

EZwgl provides a convenient way to create simple menus, menus that uses only menu-normal-buttons, menu-submenus and menu-separators.

int EZ_CreateSimpleMenu(char *str, ...)

Specifing a Simple Menu

A simple menu is specified by a string and an optional set of arguments that provide callback procedures and/or submenus for the menu and menu items.

The string is a number of fields separated by |'s. Each field may contain any number of the following specifications:

Here are some examples.

void       submenu1Callback(EZ_Widget *, void *);
void       Item2Callback(EZ_Widget *, void *);

EZ_Widget *submenu1 = EZ_CreateSimpleMenu("%F|red|green%x123|blue|%l|||",
                                                submenu1Callback, NULL);

EZ_Widget *menu = EZ_CreateSimpleMenu("%T Test Menu|Item 1|Item 2%f|submenu%m|last item"
                                                Item2Callback, NULL, submenu1);

The first two lines declare two callbacks, one for a submenu and one for a menu item.

The third line creates a simple menu. This submenu has callback submenu1Callback with call data NULL. It contains 5 menu items and a menu-separator. The first three items are labeled by "red", "green" and "blue" respectively. The second item has a numeric return value of 123. The other items have the default return values (their position in the menu). The last two items have no lables specified, so the default lable item # will be used for them.

The forth line create a menu with title "Test Menu" and no callbacks. It contains four items. The second item has a callback procedure Item2Callback with call-data NULL. The third menu is a submenu-item with menu submenu1.


HTML Documentation Maintainance:Arturo Espinosa <arturo@nuclecu.unam.mx>