1*525a267eSThomas Cort/* $NetBSD: menus.mc,v 1.11 2004/09/17 18:16:31 wrstuden Exp $ */ 2*525a267eSThomas Cort 3*525a267eSThomas Cort/* 4*525a267eSThomas Cort * Copyright 1997 Piermont Information Systems Inc. 5*525a267eSThomas Cort * All rights reserved. 6*525a267eSThomas Cort * 7*525a267eSThomas Cort * Written by Philip A. Nelson for Piermont Information Systems Inc. 8*525a267eSThomas Cort * 9*525a267eSThomas Cort * Redistribution and use in source and binary forms, with or without 10*525a267eSThomas Cort * modification, are permitted provided that the following conditions 11*525a267eSThomas Cort * are met: 12*525a267eSThomas Cort * 1. Redistributions of source code must retain the above copyright 13*525a267eSThomas Cort * notice, this list of conditions and the following disclaimer. 14*525a267eSThomas Cort * 2. Redistributions in binary form must reproduce the above copyright 15*525a267eSThomas Cort * notice, this list of conditions and the following disclaimer in the 16*525a267eSThomas Cort * documentation and/or other materials provided with the distribution. 17*525a267eSThomas Cort * 3. All advertising materials mentioning features or use of this software 18*525a267eSThomas Cort * must display the following acknowledgement: 19*525a267eSThomas Cort * This product includes software develooped for the NetBSD Project by 20*525a267eSThomas Cort * Piermont Information Systems Inc. 21*525a267eSThomas Cort * 4. The name of Piermont Information Systems Inc. may not be used to endorse 22*525a267eSThomas Cort * or promote products derived from this software without specific prior 23*525a267eSThomas Cort * written permission. 24*525a267eSThomas Cort * 25*525a267eSThomas Cort * THIS SOFTWARE IS PROVIDED BY PIERMONT INFORMATION SYSTEMS INC. ``AS IS'' 26*525a267eSThomas Cort * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 27*525a267eSThomas Cort * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 28*525a267eSThomas Cort * ARE DISCLAIMED. IN NO EVENT SHALL PIERMONT INFORMATION SYSTEMS INC. BE 29*525a267eSThomas Cort * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 30*525a267eSThomas Cort * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 31*525a267eSThomas Cort * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 32*525a267eSThomas Cort * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 33*525a267eSThomas Cort * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 34*525a267eSThomas Cort * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 35*525a267eSThomas Cort * THE POSSIBILITY OF SUCH DAMAGE. 36*525a267eSThomas Cort * 37*525a267eSThomas Cort */ 38*525a267eSThomas Cort 39*525a267eSThomas Cort{ 40*525a267eSThomas Cort 41*525a267eSThomas Cort#include "msg_defs.h" 42*525a267eSThomas Cort 43*525a267eSThomas Cort/* Initial code for definitions and includes and prototypes. */ 44*525a267eSThomas Cortvoid do_dynamic (void); 45*525a267eSThomas Cortstatic int msg_init = 0; 46*525a267eSThomas Cort 47*525a267eSThomas Cort} 48*525a267eSThomas Cort 49*525a267eSThomas Cortdefault x=20, y=10; 50*525a267eSThomas Cort 51*525a267eSThomas Cortallow dynamic menus; 52*525a267eSThomas Cort 53*525a267eSThomas Corterror action { fprintf (stderr, "Testm: Could not initialize curses.\n"); 54*525a267eSThomas Cort exit(1); }; 55*525a267eSThomas Cort 56*525a267eSThomas Cortmenu root, title " Main Menu of Test System", x=10; 57*525a267eSThomas Cort display action { 58*525a267eSThomas Cort /* Message initialization */ 59*525a267eSThomas Cort if (!msg_init) { 60*525a267eSThomas Cort msg_window (stdscr); 61*525a267eSThomas Cort msg_init = 1; 62*525a267eSThomas Cort } 63*525a267eSThomas Cort msg_display (MSG_welcome); 64*525a267eSThomas Cort wrefresh(stdscr); }; 65*525a267eSThomas Cort option "Do nothing option", 66*525a267eSThomas Cort action { } 67*525a267eSThomas Cort ; 68*525a267eSThomas Cort option "Try a sub menu", 69*525a267eSThomas Cort sub menu submenu 70*525a267eSThomas Cort ; 71*525a267eSThomas Cort option "A scrollable menu", 72*525a267eSThomas Cort sub menu scrollit 73*525a267eSThomas Cort ; 74*525a267eSThomas Cort option "Another scrollable menu", 75*525a267eSThomas Cort sub menu scrollit2 76*525a267eSThomas Cort ; 77*525a267eSThomas Cort option "Big non-scrollable menu, bombs on small screens", 78*525a267eSThomas Cort sub menu bigscroll 79*525a267eSThomas Cort ; 80*525a267eSThomas Cort option "A menu with no shortcuts", 81*525a267eSThomas Cort sub menu noshort 82*525a267eSThomas Cort ; 83*525a267eSThomas Cort option "A dynamic menu ...", 84*525a267eSThomas Cort action { do_dynamic (); } 85*525a267eSThomas Cort ; 86*525a267eSThomas Cort option "Run a shell...", 87*525a267eSThomas Cort action (endwin) { system ("/bin/sh"); } 88*525a267eSThomas Cort ; 89*525a267eSThomas Cort exit action (endwin) { printf ("Thanks for playing\n"); }; 90*525a267eSThomas Cort help { 91*525a267eSThomas Cort Main Menu Help Screen 92*525a267eSThomas Cort 93*525a267eSThomas CortThis is help text for the main menu of the menu test system. This 94*525a267eSThomas Corttext should appear verbatim when asked for by use of the ? key by 95*525a267eSThomas Cortthe user. This should allow scrolling, if needed. If the first 96*525a267eSThomas Cortcharacter in the help is the newline (as the case for this help), 97*525a267eSThomas Cortthen that newline is not included in the help text. 98*525a267eSThomas Cort 99*525a267eSThomas CortNow this tests lines for scrolling: 100*525a267eSThomas Cort10 101*525a267eSThomas Cort11 102*525a267eSThomas Cort12 103*525a267eSThomas Cort13 104*525a267eSThomas Cort14 105*525a267eSThomas Cort15 106*525a267eSThomas Cort16 107*525a267eSThomas Cort17 108*525a267eSThomas Cort18 109*525a267eSThomas Cort19 110*525a267eSThomas Cort20 111*525a267eSThomas Cort21 112*525a267eSThomas Cort22 113*525a267eSThomas Cort23 114*525a267eSThomas Cort24 115*525a267eSThomas Cort25 116*525a267eSThomas Cort26 117*525a267eSThomas Cort27 118*525a267eSThomas Cort28 119*525a267eSThomas Cort29 120*525a267eSThomas Cort30 121*525a267eSThomas Cort31 122*525a267eSThomas Cort32 123*525a267eSThomas Cort33 124*525a267eSThomas Cort34 125*525a267eSThomas Cort35 126*525a267eSThomas Cort36 127*525a267eSThomas Cort37 128*525a267eSThomas Cort38 129*525a267eSThomas Cort39 130*525a267eSThomas Cort40 131*525a267eSThomas Cort41 132*525a267eSThomas Cort42 133*525a267eSThomas Cort43 134*525a267eSThomas Cort44 135*525a267eSThomas Cort45 136*525a267eSThomas Cort46 137*525a267eSThomas Cort47 138*525a267eSThomas Cort48 139*525a267eSThomas Cort49 140*525a267eSThomas Cort50 141*525a267eSThomas Cort51 142*525a267eSThomas Cort52 143*525a267eSThomas Cort53 144*525a267eSThomas Cort54 145*525a267eSThomas Cort55 146*525a267eSThomas Cort56 147*525a267eSThomas Cort57 148*525a267eSThomas Cort58 149*525a267eSThomas Cort59 150*525a267eSThomas Cort60 151*525a267eSThomas Cort61 152*525a267eSThomas Cort62 153*525a267eSThomas Cort63 154*525a267eSThomas Cort64 155*525a267eSThomas Cort65 156*525a267eSThomas Cort66 157*525a267eSThomas Cort67 158*525a267eSThomas Cort68 159*525a267eSThomas Cort69 160*525a267eSThomas Cort70 161*525a267eSThomas Cort71 162*525a267eSThomas Cort72 163*525a267eSThomas Cort73 164*525a267eSThomas Cort74 165*525a267eSThomas Cort75 166*525a267eSThomas Cort76 167*525a267eSThomas Cort77 168*525a267eSThomas Cort78 169*525a267eSThomas Cort79 170*525a267eSThomas Cort80 171*525a267eSThomas Cort}; 172*525a267eSThomas Cort 173*525a267eSThomas Cortmenu submenu, title " submenu test"; 174*525a267eSThomas Cort option "upper right", sub menu upperright; 175*525a267eSThomas Cort option "lower left", sub menu lowerleft; 176*525a267eSThomas Cort option "middle, no title", sub menu middle; 177*525a267eSThomas Cort option "next menu", next menu nextmenu; 178*525a267eSThomas Cort 179*525a267eSThomas Cortmenu upperright, title "upper right", y=2, x=60, no exit; 180*525a267eSThomas Cort option "Just Exit!", exit; 181*525a267eSThomas Cort 182*525a267eSThomas Cortmenu lowerleft, title "lower left", y=19, x=2, no exit; 183*525a267eSThomas Cort option "Just Exit!", exit; 184*525a267eSThomas Cort 185*525a267eSThomas Cortmenu middle, no box; 186*525a267eSThomas Cort option "Just Exit!", exit; 187*525a267eSThomas Cort 188*525a267eSThomas Cortmenu nextmenu, title " A next window! ? for comments", no exit; 189*525a267eSThomas Cort option "Just Exit!:", exit; 190*525a267eSThomas Cort 191*525a267eSThomas Cortmenu noshort, title " No shortcut characters!", no shortcut; 192*525a267eSThomas Cort option "first", action {}; 193*525a267eSThomas Cort option "second", action {}; 194*525a267eSThomas Cort option "third", action {}; 195*525a267eSThomas Cort 196*525a267eSThomas Cortmenu scrollit, scrollable, h=4, title " Scrollable Menu"; 197*525a267eSThomas Cort option "option 1", action {}; 198*525a267eSThomas Cort option "option 2", action {}; 199*525a267eSThomas Cort option "option 3", action {}; 200*525a267eSThomas Cort option "option 4", action {}; 201*525a267eSThomas Cort option "option 5", action {}; 202*525a267eSThomas Cort option "option 6", action {}; 203*525a267eSThomas Cort 204*525a267eSThomas Cortmenu bigscroll, no scrollable, title " Non-scrollable Menu"; 205*525a267eSThomas Cort option "option 1", action {}; 206*525a267eSThomas Cort option "option 2", action {}; 207*525a267eSThomas Cort option "option 3", action {}; 208*525a267eSThomas Cort option "option 4", action {}; 209*525a267eSThomas Cort option "option 5", action {}; 210*525a267eSThomas Cort option "option 6", action {}; 211*525a267eSThomas Cort option "option 7", action {}; 212*525a267eSThomas Cort option "option 8", action {}; 213*525a267eSThomas Cort option "option 9", action {}; 214*525a267eSThomas Cort option "option 10", action {}; 215*525a267eSThomas Cort option "option 11", action {}; 216*525a267eSThomas Cort option "option 12", action {}; 217*525a267eSThomas Cort option "option 13", action {}; 218*525a267eSThomas Cort option "option 14", action {}; 219*525a267eSThomas Cort option "option 15", action {}; 220*525a267eSThomas Cort option "option 16", action {}; 221*525a267eSThomas Cort option "option 17", action {}; 222*525a267eSThomas Cort option "option 18", action {}; 223*525a267eSThomas Cort option "option 19", action {}; 224*525a267eSThomas Cort option "option 20", action {}; 225*525a267eSThomas Cort 226*525a267eSThomas Cortmenu scrollit2, scrollable, title " Big scrollable Menu"; 227*525a267eSThomas Cort option "option 1", action {}; 228*525a267eSThomas Cort option "option 2", action {}; 229*525a267eSThomas Cort option "option 3", action {}; 230*525a267eSThomas Cort option "option 4", action {}; 231*525a267eSThomas Cort option "option 5", action {}; 232*525a267eSThomas Cort option "option 6", action {}; 233*525a267eSThomas Cort option "option 7", action {}; 234*525a267eSThomas Cort option "option 8", action {}; 235*525a267eSThomas Cort option "option 9", action {}; 236*525a267eSThomas Cort option "option 10", action {}; 237*525a267eSThomas Cort option "option 11", action {}; 238*525a267eSThomas Cort option "option 12", action {}; 239*525a267eSThomas Cort option "option 13", action {}; 240*525a267eSThomas Cort option "option 14", action {}; 241*525a267eSThomas Cort option "option 15", action {}; 242*525a267eSThomas Cort option "option 16", action {}; 243*525a267eSThomas Cort option "option 17", action {}; 244*525a267eSThomas Cort option "option 18", action {}; 245*525a267eSThomas Cort option "option 19", action {}; 246*525a267eSThomas Cort option "option 20", action {}; 247*525a267eSThomas Cort option "option 21", action {}; 248*525a267eSThomas Cort option "option 22", action {}; 249*525a267eSThomas Cort option "option 23", action {}; 250*525a267eSThomas Cort option "option 24", action {}; 251*525a267eSThomas Cort option "option 25", action {}; 252*525a267eSThomas Cort option "option 26", action {}; 253*525a267eSThomas Cort option "option 27", action {}; 254*525a267eSThomas Cort option "option 28", action {}; 255*525a267eSThomas Cort option "option 29", action {}; 256*525a267eSThomas Cort option "option 30", action {}; 257*525a267eSThomas Cort option "option 31", action {}; 258*525a267eSThomas Cort option "option 32", action {}; 259*525a267eSThomas Cort option "option 33", action {}; 260*525a267eSThomas Cort option "option 34", action {}; 261*525a267eSThomas Cort option "option 35", action {}; 262*525a267eSThomas Cort option "option 36", action {}; 263*525a267eSThomas Cort option "option 37", action {}; 264*525a267eSThomas Cort option "option 38", action {}; 265*525a267eSThomas Cort option "option 39", action {}; 266*525a267eSThomas Cort option "option 40", action {}; 267*525a267eSThomas Cort option "option 41", action {}; 268*525a267eSThomas Cort option "option 42", action {}; 269*525a267eSThomas Cort option "option 43", action {}; 270*525a267eSThomas Cort option "option 44", action {}; 271*525a267eSThomas Cort option "option 45", action {}; 272*525a267eSThomas Cort option "option 46", action {}; 273*525a267eSThomas Cort option "option 47", action {}; 274*525a267eSThomas Cort option "option 48", action {}; 275*525a267eSThomas Cort option "option 49", action {}; 276*525a267eSThomas Cort option "option 50", action {}; 277*525a267eSThomas Cort option "option 51", action {}; 278