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/check3.c,v 1.6 2000/01/10 11:52:03 phantom Exp $
26 getBool(dialogMenuItem *self)
28 if (self->data && *((int *)self->data))
34 setBool(dialogMenuItem *self)
37 *((int *)self->data) = !*((int *)self->data);
43 static int german_book, italian_book, slang_book;
47 check(dialogMenuItem *self)
49 return ((int)self->data == spending);
53 spend(dialogMenuItem *self)
55 spending = (int)self->data;
56 return DITEM_SUCCESS | DITEM_REDRAW;
59 /* menu4 - Show off a simulated compound menu (group at top is checklist, group at bottom radio) */
60 /* prompt title checked fire sel, data lbra mark rbra */
61 static dialogMenuItem menu4[] = {
62 { "German", "Buy books on learning German", getBool, setBool, NULL, &german_book },
63 { "Italian","Buy books on learning Italian", getBool, setBool, NULL, &italian_book },
64 { "Slang", "Buy books on commonly used insults", getBool, setBool, NULL, &slang_book },
65 { "-----", "----------------------------------", NULL, NULL, NULL, NULL, ' ', ' ', ' ' },
66 { "1000", "Spend $1,000", check, spend, NULL, (void *)1000, '(', '*', ')' },
67 { "500", "Spend $500", check, spend, NULL, (void *)500, '(', '*', ')' },
68 { "100", "Spend $100", check, spend, NULL, (void *)100, '(', '*', ')' },
71 /* End of hook functions */
73 /* Kick it off, James! */
75 main(int argc, char **argv)
82 retval = dialog_checklist("this is dialog_checklist() in action, test #3",
83 "Now we show off some of the button 'styles' one can create.",
84 -1, -1, 7, -7, menu4, NULL);
86 fprintf(stderr, "spent $%d on %s%s%s books\n", spending, german_book ? " german" : "",
87 italian_book ? " italian" : "", slang_book ? " slang" : "");