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
16 * $FreeBSD: src/gnu/lib/libdialog/TESTS/radio2.c,v 1.7 2000/01/10 11:52:09 phantom Exp $
17 * $DragonFly: src/gnu/lib/libdialog/TESTS/radio2.c,v 1.2 2003/06/17 04:25:44 dillon Exp $
29 static char bachelor[10], bachelette[10];
32 getBachelor(dialogMenuItem *self)
34 return !strcmp(bachelor, self->prompt);
38 setBachelor(dialogMenuItem *self)
40 strcpy(bachelor, self->prompt);
41 return DITEM_SUCCESS | DITEM_REDRAW;
45 getBachelette(dialogMenuItem *self)
47 return !strcmp(bachelette, self->prompt);
51 setBachelette(dialogMenuItem *self)
53 strcpy(bachelette, self->prompt);
54 return DITEM_SUCCESS | DITEM_REDRAW;
57 /* menu6- More complex radiolist menu that creates two groups in a single menu */
58 /* prompt title checked fire */
59 static dialogMenuItem menu6[] = {
60 { "Tom", "Tom's a dynamic shoe salesman from Tulsa, OK!", getBachelor, setBachelor },
61 { "Dick", "Dick's a retired engine inspector from McDonnell-Douglas!", getBachelor, setBachelor },
62 { "Harry", "Harry's a professional female impersonator from Las Vegas!", getBachelor, setBachelor },
63 { "-----", "----------------------------------", NULL, NULL, NULL, NULL, ' ', ' ', ' ' },
64 { "Jane", "Jane's a twice-divorced housewife from Moose, Oregon!", getBachelette, setBachelette },
65 { "Sally", "Sally's a shy Human Resources Manager for IBM!", getBachelette, setBachelette },
66 { "Mary", "Mary's an energetic serial killer on the lam!", getBachelette, setBachelette },
69 /* End of hook functions */
71 /* Kick it off, James! */
73 main(int argc, char **argv)
79 retval = dialog_radiolist("this is dialog_radiolist() in action, test #2",
80 "Welcome to \"The Love Blender!\" - America's favorite game show\n"
81 "where YOU, the contestant, get to choose which of these two\n"
82 "fine specimens of humanity will go home together, whether they\n"
83 "like it or not!", -1, -1, 7, -7, menu6, NULL);
85 fprintf(stderr, "I'm sure that %s and %s will be very happy together!\n", bachelor, bachelette);