Home | History | Annotate | Line # | Download | only in testm
menus.mc revision 1.8
      1 /*	$NetBSD: menus.mc,v 1.8 1998/07/02 21:46:19 phil Exp $	*/
      2 
      3 /*
      4  * Copyright 1997 Piermont Information Systems Inc.
      5  * All rights reserved.
      6  *
      7  * Written by Philip A. Nelson for Piermont Information Systems Inc.
      8  *
      9  * Redistribution and use in source and binary forms, with or without
     10  * modification, are permitted provided that the following conditions
     11  * are met:
     12  * 1. Redistributions of source code must retain the above copyright
     13  *    notice, this list of conditions and the following disclaimer.
     14  * 2. Redistributions in binary form must reproduce the above copyright
     15  *    notice, this list of conditions and the following disclaimer in the
     16  *    documentation and/or other materials provided with the distribution.
     17  * 3. All advertising materials mentioning features or use of this software
     18  *    must display the following acknowledgement:
     19  *      This product includes software develooped for the NetBSD Project by
     20  *      Piermont Information Systems Inc.
     21  * 4. The name of Piermont Information Systems Inc. may not be used to endorse
     22  *    or promote products derived from this software without specific prior
     23  *    written permission.
     24  *
     25  * THIS SOFTWARE IS PROVIDED BY PIERMONT INFORMATION SYSTEMS INC. ``AS IS''
     26  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     27  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     28  * ARE DISCLAIMED. IN NO EVENT SHALL PIERMONT INFORMATION SYSTEMS INC. BE
     29  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     30  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     31  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     32  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     33  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     34  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
     35  * THE POSSIBILITY OF SUCH DAMAGE.
     36  *
     37  */
     38 
     39 {
     40 
     41 /* Initial code for definitions and includes. */
     42 
     43 }
     44 
     45 default x=20, y=10;
     46 
     47 allow dynamic menus;
     48 
     49 error action { fprintf (stderr, "Testm: Could not initialize curses.\n");
     50 	       exit(1); };
     51 
     52 menu root, title "  Main Menu of Test System";
     53 	option  "Do nothing option",
     54 		action  { }
     55 	;
     56 	option  "Try a sub menu",
     57 		sub menu  submenu
     58 	;
     59 	option  "A scrollable menu",
     60 		sub menu  scrollit
     61 	;
     62 	option  "Another scrollable menu",
     63 		sub menu scrollit2
     64 	;
     65 	option  "Big non-scrollable menu, bombs on small screens",
     66 		sub menu  bigscroll;
     67 	option  "Run a shell...",
     68 		action (endwin) { system ("/bin/sh"); }
     69 	;
     70 	exit action (endwin)  { printf ("Thanks for playing\n"); };
     71 	help {
     72                     Main Menu Help Screen
     73 
     74 This is help text for the main menu of the menu test system.  This
     75 text should appear verbatim when asked for by use of the ? key by
     76 the user.  This should allow scrolling, if needed.  If the first
     77 character in the help is the newline (as the case for this help),
     78 then that newline is not included in the help text.
     79 
     80 Now this tests lines for scrolling:
     81 10
     82 11
     83 12
     84 13
     85 14
     86 15
     87 16
     88 17
     89 18
     90 19
     91 20
     92 21
     93 22
     94 23
     95 24
     96 25
     97 26
     98 27
     99 28
    100 29
    101 30
    102 31
    103 32
    104 33
    105 34
    106 35
    107 36
    108 37
    109 38
    110 39
    111 40
    112 41
    113 42
    114 43
    115 44
    116 45
    117 46
    118 47
    119 48
    120 49
    121 50
    122 51
    123 52
    124 53
    125 54
    126 55
    127 56
    128 57
    129 58
    130 59
    131 60
    132 61
    133 62
    134 63
    135 64
    136 65
    137 66
    138 67
    139 68
    140 69
    141 70
    142 71
    143 72
    144 73
    145 74
    146 75
    147 76
    148 77
    149 78
    150 79
    151 80
    152 };
    153 
    154 menu submenu, title "  submenu test";
    155 	option  "upper right", sub menu  upperright;
    156 	option  "lower left", sub menu  lowerleft;
    157 	option  "middle, no title", sub menu middle;
    158 	option  "next menu", next menu nextmenu;
    159 
    160 menu upperright, title "upper right", y=2, x=60, no exit;
    161 	option  "Just Exit!", exit;
    162 
    163 menu lowerleft, title "lower left", y=20, x=2, no exit;
    164 	option  "Just Exit!", exit;
    165 
    166 menu middle, no box;
    167 	option "Just Exit!", exit;
    168 
    169 menu nextmenu, title "  A next window! ? for comments", no exit;
    170 	option "Just Exit!:", exit;
    171 
    172 menu scrollit, scrollable, h=4, title "  Scrollable Menu";
    173 	option "option 1", action {};
    174 	option "option 2", action {};
    175 	option "option 3", action {};
    176 	option "option 4", action {};
    177 	option "option 5", action {};
    178 	option "option 6", action {};
    179 
    180 menu bigscroll, no scrollable, title "  Non-scrollable Menu";
    181 	option "option 1", action {};
    182 	option "option 2", action {};
    183 	option "option 3", action {};
    184 	option "option 4", action {};
    185 	option "option 5", action {};
    186 	option "option 6", action {};
    187 	option "option 7", action {};
    188 	option "option 8", action {};
    189 	option "option 9", action {};
    190 	option "option 10", action {};
    191 	option "option 11", action {};
    192 	option "option 12", action {};
    193 	option "option 13", action {};
    194 	option "option 14", action {};
    195 	option "option 15", action {};
    196 	option "option 16", action {};
    197 	option "option 17", action {};
    198 	option "option 18", action {};
    199 	option "option 19", action {};
    200 	option "option 20", action {};
    201 
    202 menu scrollit2, scrollable, title "  Big scrollable Menu";
    203 	option "option 1", action {};
    204 	option "option 2", action {};
    205 	option "option 3", action {};
    206 	option "option 4", action {};
    207 	option "option 5", action {};
    208 	option "option 6", action {};
    209 	option "option 7", action {};
    210 	option "option 8", action {};
    211 	option "option 9", action {};
    212 	option "option 10", action {};
    213 	option "option 11", action {};
    214 	option "option 12", action {};
    215 	option "option 13", action {};
    216 	option "option 14", action {};
    217 	option "option 15", action {};
    218 	option "option 16", action {};
    219 	option "option 17", action {};
    220 	option "option 18", action {};
    221 	option "option 19", action {};
    222 	option "option 20", action {};
    223 	option "option 21", action {};
    224 	option "option 22", action {};
    225 	option "option 23", action {};
    226 	option "option 24", action {};
    227 	option "option 25", action {};
    228 	option "option 26", action {};
    229 	option "option 27", action {};
    230 	option "option 28", action {};
    231 	option "option 29", action {};
    232 	option "option 30", action {};
    233 	option "option 31", action {};
    234 	option "option 32", action {};
    235 	option "option 33", action {};
    236 	option "option 34", action {};
    237 	option "option 35", action {};
    238 	option "option 36", action {};
    239 	option "option 37", action {};
    240 	option "option 38", action {};
    241 	option "option 39", action {};
    242 	option "option 40", action {};
    243 	option "option 41", action {};
    244 	option "option 42", action {};
    245 	option "option 43", action {};
    246 	option "option 44", action {};
    247 	option "option 45", action {};
    248 	option "option 46", action {};
    249 	option "option 47", action {};
    250 	option "option 48", action {};
    251 	option "option 49", action {};
    252 	option "option 50", action {};
    253 	option "option 51", action {};
    254