Home | History | Annotate | Line # | Download | only in testm
menus.mc revision 1.11
      1 /*	$NetBSD: menus.mc,v 1.11 2004/09/17 18:16:31 wrstuden 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 #include "msg_defs.h"
     42 
     43 /* Initial code for definitions and includes and  prototypes. */
     44 void do_dynamic (void);
     45 static int msg_init = 0;
     46 
     47 }
     48 
     49 default x=20, y=10;
     50 
     51 allow dynamic menus;
     52 
     53 error action { fprintf (stderr, "Testm: Could not initialize curses.\n");
     54 	       exit(1); };
     55 
     56 menu root, title "  Main Menu of Test System", x=10;
     57 	display action {
     58 		/* Message initialization */
     59 		if (!msg_init) {
     60 			msg_window (stdscr);
     61 			msg_init = 1;
     62 		}
     63 		msg_display (MSG_welcome);
     64 		wrefresh(stdscr); };
     65 	option  "Do nothing option",
     66 		action  { }
     67 	;
     68 	option  "Try a sub menu",
     69 		sub menu  submenu
     70 	;
     71 	option  "A scrollable menu",
     72 		sub menu  scrollit
     73 	;
     74 	option  "Another scrollable menu",
     75 		sub menu scrollit2
     76 	;
     77 	option  "Big non-scrollable menu, bombs on small screens",
     78 		sub menu bigscroll
     79 	;
     80 	option  "A menu with no shortcuts",
     81 		sub menu noshort
     82 	;
     83 	option  "A dynamic menu ...",
     84 		action { do_dynamic (); }
     85 	;
     86 	option  "Run a shell...",
     87 		action (endwin) { system ("/bin/sh"); }
     88 	;
     89 	exit action (endwin)  { printf ("Thanks for playing\n"); };
     90 	help {
     91                     Main Menu Help Screen
     92 
     93 This is help text for the main menu of the menu test system.  This
     94 text should appear verbatim when asked for by use of the ? key by
     95 the user.  This should allow scrolling, if needed.  If the first
     96 character in the help is the newline (as the case for this help),
     97 then that newline is not included in the help text.
     98 
     99 Now this tests lines for scrolling:
    100 10
    101 11
    102 12
    103 13
    104 14
    105 15
    106 16
    107 17
    108 18
    109 19
    110 20
    111 21
    112 22
    113 23
    114 24
    115 25
    116 26
    117 27
    118 28
    119 29
    120 30
    121 31
    122 32
    123 33
    124 34
    125 35
    126 36
    127 37
    128 38
    129 39
    130 40
    131 41
    132 42
    133 43
    134 44
    135 45
    136 46
    137 47
    138 48
    139 49
    140 50
    141 51
    142 52
    143 53
    144 54
    145 55
    146 56
    147 57
    148 58
    149 59
    150 60
    151 61
    152 62
    153 63
    154 64
    155 65
    156 66
    157 67
    158 68
    159 69
    160 70
    161 71
    162 72
    163 73
    164 74
    165 75
    166 76
    167 77
    168 78
    169 79
    170 80
    171 };
    172 
    173 menu submenu, title "  submenu test";
    174 	option  "upper right", sub menu  upperright;
    175 	option  "lower left", sub menu  lowerleft;
    176 	option  "middle, no title", sub menu middle;
    177 	option  "next menu", next menu nextmenu;
    178 
    179 menu upperright, title "upper right", y=2, x=60, no exit;
    180 	option  "Just Exit!", exit;
    181 
    182 menu lowerleft, title "lower left", y=19, x=2, no exit;
    183 	option  "Just Exit!", exit;
    184 
    185 menu middle, no box;
    186 	option "Just Exit!", exit;
    187 
    188 menu nextmenu, title "  A next window! ? for comments", no exit;
    189 	option "Just Exit!:", exit;
    190 
    191 menu noshort, title "  No shortcut characters!", no shortcut;
    192 	option "first", action {};
    193 	option "second", action {};
    194 	option "third", action {};
    195 
    196 menu scrollit, scrollable, h=4, title "  Scrollable Menu";
    197 	option "option 1", action {};
    198 	option "option 2", action {};
    199 	option "option 3", action {};
    200 	option "option 4", action {};
    201 	option "option 5", action {};
    202 	option "option 6", action {};
    203 
    204 menu bigscroll, no scrollable, title "  Non-scrollable Menu";
    205 	option "option 1", action {};
    206 	option "option 2", action {};
    207 	option "option 3", action {};
    208 	option "option 4", action {};
    209 	option "option 5", action {};
    210 	option "option 6", action {};
    211 	option "option 7", action {};
    212 	option "option 8", action {};
    213 	option "option 9", action {};
    214 	option "option 10", action {};
    215 	option "option 11", action {};
    216 	option "option 12", action {};
    217 	option "option 13", action {};
    218 	option "option 14", action {};
    219 	option "option 15", action {};
    220 	option "option 16", action {};
    221 	option "option 17", action {};
    222 	option "option 18", action {};
    223 	option "option 19", action {};
    224 	option "option 20", action {};
    225 
    226 menu scrollit2, scrollable, title "  Big scrollable Menu";
    227 	option "option 1", action {};
    228 	option "option 2", action {};
    229 	option "option 3", action {};
    230 	option "option 4", action {};
    231 	option "option 5", action {};
    232 	option "option 6", action {};
    233 	option "option 7", action {};
    234 	option "option 8", action {};
    235 	option "option 9", action {};
    236 	option "option 10", action {};
    237 	option "option 11", action {};
    238 	option "option 12", action {};
    239 	option "option 13", action {};
    240 	option "option 14", action {};
    241 	option "option 15", action {};
    242 	option "option 16", action {};
    243 	option "option 17", action {};
    244 	option "option 18", action {};
    245 	option "option 19", action {};
    246 	option "option 20", action {};
    247 	option "option 21", action {};
    248 	option "option 22", action {};
    249 	option "option 23", action {};
    250 	option "option 24", action {};
    251 	option "option 25", action {};
    252 	option "option 26", action {};
    253 	option "option 27", action {};
    254 	option "option 28", action {};
    255 	option "option 29", action {};
    256 	option "option 30", action {};
    257 	option "option 31", action {};
    258 	option "option 32", action {};
    259 	option "option 33", action {};
    260 	option "option 34", action {};
    261 	option "option 35", action {};
    262 	option "option 36", action {};
    263 	option "option 37", action {};
    264 	option "option 38", action {};
    265 	option "option 39", action {};
    266 	option "option 40", action {};
    267 	option "option 41", action {};
    268 	option "option 42", action {};
    269 	option "option 43", action {};
    270 	option "option 44", action {};
    271 	option "option 45", action {};
    272 	option "option 46", action {};
    273 	option "option 47", action {};
    274 	option "option 48", action {};
    275 	option "option 49", action {};
    276 	option "option 50", action {};
    277 	option "option 51", action {};
    278