summaryrefslogtreecommitdiffstats
path: root/gnu/lib/libdialog/TESTS/menu1.c
diff options
context:
space:
mode:
authorjkh <jkh@FreeBSD.org>1996-04-16 12:17:27 +0000
committerjkh <jkh@FreeBSD.org>1996-04-16 12:17:27 +0000
commit24a0bc2e7799a19dab39bf6c633ee7cd52b349ff (patch)
tree4657bce2c0155f54b1e409704ce7296c2c885a8a /gnu/lib/libdialog/TESTS/menu1.c
parent2d55190c7fa36b39ad2d0189168c9fe4b1558bb7 (diff)
downloadFreeBSD-src-24a0bc2e7799a19dab39bf6c633ee7cd52b349ff.zip
FreeBSD-src-24a0bc2e7799a19dab39bf6c633ee7cd52b349ff.tar.gz
More changes to attempt to make this whole new dialog scheme more
robust. The new "fire" actions, while affording signficantly more interactivity to libdialog, come at a cost - if the fire action trashes the screen then you're not going to be in Kansas anymore when you come back to the menu and there had better be considerable extra smarts in place for coping with such a situation. These changes are my attempt to do just that.
Diffstat (limited to 'gnu/lib/libdialog/TESTS/menu1.c')
-rw-r--r--gnu/lib/libdialog/TESTS/menu1.c126
1 files changed, 63 insertions, 63 deletions
diff --git a/gnu/lib/libdialog/TESTS/menu1.c b/gnu/lib/libdialog/TESTS/menu1.c
index bbab588..5e5a1ad 100644
--- a/gnu/lib/libdialog/TESTS/menu1.c
+++ b/gnu/lib/libdialog/TESTS/menu1.c
@@ -13,7 +13,7 @@
* the author assume any responsibility for damages incurred with
* its use.
*
- * $Id: menu1.c,v 1.1 1996/01/01 03:45:26 jkh Exp $
+ * $Id: menu1.c,v 1.2 1996/04/07 03:20:52 jkh Exp $
*/
#include <stdio.h>
@@ -29,69 +29,69 @@ static enum { nowhere, berlin, rome, ny } where;
static int
_menu1_berlin_action(dialogMenuItem *self)
{
- WINDOW *w;
- int st = DITEM_FAILURE;
-
- w = dupwin(newscr);
- if (where == berlin) {
- dialog_mesgbox("excuse me?", "But you're already *in* Berlin!", -1, -1);
- }
- else {
- where = berlin;
- dialog_mesgbox("whoosh!", "Welcome to Berlin! Have a beer!", -1, -1);
- }
- touchwin(w);
- wrefresh(w);
- delwin(w);
- return st;
+ WINDOW *w;
+ int st = DITEM_FAILURE;
+
+ w = dupwin(newscr);
+ if (where == berlin) {
+ dialog_mesgbox("excuse me?", "But you're already *in* Berlin!", -1, -1);
+ }
+ else {
+ where = berlin;
+ dialog_mesgbox("whoosh!", "Welcome to Berlin! Have a beer!", -1, -1);
+ }
+ touchwin(w);
+ wrefresh(w);
+ delwin(w);
+ return st;
}
static int
_menu1_rome_action(dialogMenuItem *self)
{
- WINDOW *w;
- int st = DITEM_FAILURE;
-
- w = dupwin(newscr);
- if (where == rome) {
- dialog_mesgbox("The wine must be getting to you..", "You're already in Rome!", -1, -1);
- }
- else {
- where = rome;
- dialog_mesgbox("whoosh!", "Welcome to Rome! Have a coffee!", -1, -1);
- }
- touchwin(w);
- wrefresh(w);
- delwin(w);
- return st;
+ WINDOW *w;
+ int st = DITEM_FAILURE;
+
+ w = dupwin(newscr);
+ if (where == rome) {
+ dialog_mesgbox("The wine must be getting to you..", "You're already in Rome!", -1, -1);
+ }
+ else {
+ where = rome;
+ dialog_mesgbox("whoosh!", "Welcome to Rome! Have a coffee!", -1, -1);
+ }
+ touchwin(w);
+ wrefresh(w);
+ delwin(w);
+ return st;
}
static int
_menu1_ny_action(dialogMenuItem *self)
{
- WINDOW *w;
- int st = DITEM_FAILURE;
-
- w = dupwin(newscr);
- if (where == ny) {
- dialog_mesgbox("Say what?", "You're already there!", -1, -1);
- }
- else {
- where = ny;
- dialog_mesgbox("whoosh!", "Welcome to New York! Now go someplace else!", -1, -1);
- }
- touchwin(w);
- wrefresh(w);
- delwin(w);
- return st;
+ WINDOW *w;
+ int st = DITEM_FAILURE;
+
+ w = dupwin(newscr);
+ if (where == ny) {
+ dialog_mesgbox("Say what?", "You're already there!", -1, -1);
+ }
+ else {
+ where = ny;
+ dialog_mesgbox("whoosh!", "Welcome to New York! Now go someplace else!", -1, -1);
+ }
+ touchwin(w);
+ wrefresh(w);
+ delwin(w);
+ return st;
}
/* menu1 - show off the "fire" action hook */
- /* prompt title checked fire */
+/* prompt title checked fire */
static dialogMenuItem menu1[] = {
- { "Berlin", "Go visit Germany's new capitol", NULL, _menu1_berlin_action },
- { "Rome", "Go visit the Roman ruins", NULL, _menu1_rome_action },
- { "New York", "Go visit the streets of New York", NULL, _menu1_ny_action },
+ { "Berlin", "Go visit Germany's new capitol", NULL, _menu1_berlin_action },
+ { "Rome", "Go visit the Roman ruins", NULL, _menu1_rome_action },
+ { "New York", "Go visit the streets of New York", NULL, _menu1_ny_action },
};
/* End of hook functions */
@@ -100,17 +100,17 @@ static dialogMenuItem menu1[] = {
int
main(int argc, unsigned char *argv[])
{
- int retval;
-
- init_dialog();
-
- retval = dialog_menu("this is dialog_menu() in action, test #1",
- "this simple menu shows off some of the straight-forward features\n"
- "of the new menu system's action dispatch hooks. Select Cancel to leave",
- -1, -1, 3, -3, menu1, NULL, NULL, NULL);
- dialog_clear();
- fprintf(stderr, "returned value for dialog_menu was %d\n", retval);
-
- end_dialog();
- return 0;
+ int retval;
+
+ init_dialog();
+
+ retval = dialog_menu("this is dialog_menu() in action, test #1",
+ "this simple menu shows off some of the straight-forward features\n"
+ "of the new menu system's action dispatch hooks. Select Cancel to leave",
+ -1, -1, 3, -3, menu1, NULL, NULL, NULL);
+ dialog_clear();
+ fprintf(stderr, "returned value for dialog_menu was %d\n", retval);
+
+ end_dialog();
+ return 0;
}
OpenPOWER on IntegriCloud