return the last selected item.
Screenshot
Resources
Config_Option | ResourceName | DefaultValue |
|
| | |
EZ_CLASS | class | "Menu" |
EZ_NAME | name | "menu" |
|
| | |
EZ_BORDER_WIDTH | borderWidth | 2 |
EZ_BORDER_TYPE | borderType | raised |
EZ_FOCUS_PAD | focusPad | 0 |
|
| | |
EZ_PADX | padx | 0 |
EZ_PADY | pady | 0 |
EZ_IPADX | iPadx | 0 |
EZ_IPADY | iPady | 0 |
|
| | |
EZ_ORIENTATION | orientation | vertical |
EZ_FILL_MODE | fillMode | fillBoth |
EZ_SIDE | side | left |
|
| | |
EZ_CURSOR | cursor | "XC_left_ptr" |
|
| | |
EZ_CALLBACK | N/A | null null |
EZ_DESTROY_CALLBACK | N/A | null null |
|
| | |
EZ_FOREGROUND | foreground | "black" |
EZ_BACKGROUND | background | "gray74 |
EZ_BG_IMAGE_FILE | bgImageFile | null |
EZ_BG_PIXMAP | N/A | none |
|
| | |
EZ_CLIENT_PTR_DATA | N/A | null |
EZ_CLIENT_INT_DATA | clientIntData | 0 |
|
| | |
EZ_MENU_TEAR_OFF | menuTearOff | true |
|
3.7.1 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:
%t
Makes non-formatting text in this item as the menu title string.
%F
Gets the callback-procedure, client-data for the callback of the menu
from the optional arguments.
%f
Gets the callback-procedure, client-data for the callback of
this menu-item from the optional arguments.
%l
Inserts a menu-separator.
%m
Makes this item as a menu-submenu item and
gets the menu from the optional arguments.
%n
Sets the instance name of the this menu item to
be the substring after the current formating characters and
before the next formating character or |
.
%c
Sets the class name of the this menu item to
be the substring after the current formating characters and
before the next formating character or |
.
%u
Set the index of the underline character
for the current item.
%s
Set the keyboard shortcut for the current item.
%x
[0-9]+ Sets the return value for this item. This value overrides
the default position-based value assigned to this menu item.
You must enter the numeric value as the part of the text
Here are some examples.
void submenu1Callback(EZ_Widget *, void *);
void Item2Callback(EZ_Widget *, void *);
EZ_Widget *submenu1 = EZ_CreateSimpleMenu("%F|red|green%x123 %s C-g|blue %u 0|%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 client 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
and a keyboard shortcut "C-g".
The letter 'b' in the third item will be underlined and will
be used as a keyboard accelerator.
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
.