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$");
30 stop(dialogMenuItem *self)
32 dialog_mesgbox("!", "I'm no idiot!", -1, -1);
37 maybe(dialogMenuItem *self)
39 dialog_mesgbox("!", "I said don't rush me! I'm THINKING!", -1, -1);
40 return DITEM_SUCCESS | DITEM_RESTORE | DITEM_CONTINUE;
43 /* Dummy menu just to show of the ability */
44 static char *insurance[] = {
45 "1,000,000", "Mondo insurance policy", "Off",
46 "5,000,000", "Mega insurance policy", "Off",
47 "10,000,000", "Friend! Most Favored customer!"
51 preinsure(dialogMenuItem *self, int is_selected)
56 /* This has to be here first if you want to see selection traverse properly in the invoking menu */
62 dialog_radiolist("How much insurance would you like to take out?",
63 "If you're really going to do this, we recommend some insurance\n"
64 "first! What kind of life insurance policy would you like?",
65 -1, -1, 3, 3, insurance, NULL);
73 * Show a simple menu that puts up a sub menu when a certain item is traversed to
76 /* prompt title checked fire sel */
77 static dialogMenuItem doit[] = {
80 { "Stop", "No, I'm not going to do that!", NULL, stop, NULL },
81 { "Maybe", "I'm still thinking about it, don't rush me!", NULL, maybe, NULL, },
82 { "Go", "Yes! Yes! I want to do it!", NULL, NULL, preinsure },
85 /* End of hook functions */
87 /* Kick it off, James! */
89 main(int argc, char **argv)
98 retval = dialog_menu("Do you have the GUTS?",
99 "C'mon, macho man! Do you have what it takes to do something REALLY\n"
100 "dangerous and stupid? WHAT ARE YOU WAITING FOR?!",
101 -1, -1, 3, -3, doit + 2, (char *)TRUE, NULL, NULL);
103 fprintf(stderr, "returned value for dialog_menu was %d\n", retval);