2 * small test-driver for new dialog functionality
4 * Copyright (c) 1995, Jordan Hubbard
8 * This source code may be used, modified, copied, distributed, and
9 * sold, in both source and binary form provided that the above
10 * copyright and these terms are retained, verbatim, as the first
11 * lines of this file. Under no circumstances is the author
12 * responsible for the proper functioning of the software nor does
13 * the author assume any responsibility for damages incurred with
17 #include <sys/cdefs.h>
18 __FBSDID("$FreeBSD$");
27 /* Start of hook functions */
28 static enum { nowhere, berlin, rome, ny } where;
31 _menu1_berlin_action(dialogMenuItem *self)
34 dialog_mesgbox("excuse me?", "But you're already *in* Berlin!", -1, -1);
37 dialog_mesgbox("whoosh!", "Welcome to Berlin! Have a beer!", -1, -1);
39 return DITEM_SUCCESS | DITEM_RESTORE | DITEM_CONTINUE;
43 _menu1_rome_action(dialogMenuItem *self)
46 dialog_mesgbox("The wine must be getting to you..", "You're already in Rome!", -1, -1);
49 dialog_mesgbox("whoosh!", "Welcome to Rome! Have a coffee!", -1, -1);
51 return DITEM_SUCCESS | DITEM_RESTORE | DITEM_CONTINUE;
55 _menu1_ny_action(dialogMenuItem *self)
58 dialog_mesgbox("Say what?", "You're already there!", -1, -1);
61 dialog_mesgbox("whoosh!", "Welcome to New York! Now go someplace else!", -1, -1);
63 return DITEM_SUCCESS | DITEM_RESTORE | DITEM_CONTINUE;
66 /* menu1 - show off the "fire" action hook */
67 /* prompt title checked fire */
68 static dialogMenuItem menu1[] = {
69 { "Berlin", "Go visit Germany's new capitol", NULL, _menu1_berlin_action },
70 { "Rome", "Go visit the Roman ruins", NULL, _menu1_rome_action },
71 { "New York", "Go visit the streets of New York", NULL, _menu1_ny_action },
74 /* End of hook functions */
76 /* Kick it off, James! */
78 main(int argc, char **argv)
84 use_helpfile("menu2.c");
85 use_helpline("Type F1 to view the source for this demo");
86 retval = dialog_menu("this is dialog_menu() in action, test #2",
87 "this simple menu shows off some of the straight-forward features\n"
88 "of the new menu system's action dispatch hooks as well as a helpline\n"
89 "and a helpfile. Select Cancel to leave",
90 -1, -1, 3, -3, menu1, NULL, NULL, NULL);
92 fprintf(stderr, "returned value for dialog_menu was %d\n", retval);