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