/usr/share/doc/xviewg/examples/panels/btn_menu.c is in xview-examples 3.2p1.4-28.1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 | /*
* btn_menu.c -- display a panel that has an OPEN LOOK menu button.
* The choices displayed are Yes, No and Quit. If Quit is selected
* in the menu, the program exits.
*/
#include <xview/xview.h>
#include <xview/panel.h>
#include <xview/openmenu.h>
main(argc, argv)
int argc;
char *argv[];
{
Frame frame;
Panel panel;
Menu menu;
int selected();
void menu_proc();
xv_init(XV_INIT_ARGC_PTR_ARGV, &argc, argv, NULL);
frame = (Frame)xv_create(NULL, FRAME, NULL);
panel = (Panel)xv_create(frame, PANEL, NULL);
/* Create the menu _before_ the panel button */
menu = (Menu)xv_create(NULL, MENU,
MENU_NOTIFY_PROC, menu_proc,
MENU_STRINGS, "Yes", "No", "Quit", NULL,
NULL);
(void) xv_create(panel, PANEL_BUTTON,
PANEL_LABEL_STRING, "Y/N/Q",
PANEL_NOTIFY_PROC, selected,
PANEL_ITEM_MENU, menu, /* attach menu to button */
NULL);
window_fit(panel);
window_fit(frame);
xv_main_loop(frame);
}
int
selected(item, event)
Panel_item item;
Event *event;
{
printf("%s selected...\n", xv_get(item, PANEL_LABEL_STRING));
return XV_OK;
}
void
menu_proc(menu, menu_item)
Menu menu;
Menu_item menu_item;
{
printf("Menu Item: %s\n", xv_get(menu_item, MENU_STRING));
if (!strcmp((char *)xv_get(menu_item, MENU_STRING), "Quit"))
exit(0);
}
|