1*9e180a65Suwe/* $NetBSD: menus.mc,v 1.13 2019/12/03 01:45:34 uwe Exp $ */ 295f3bf39Sphil 395f3bf39Sphil/* 495f3bf39Sphil * Copyright 1997 Piermont Information Systems Inc. 595f3bf39Sphil * All rights reserved. 695f3bf39Sphil * 795f3bf39Sphil * Written by Philip A. Nelson for Piermont Information Systems Inc. 895f3bf39Sphil * 995f3bf39Sphil * Redistribution and use in source and binary forms, with or without 1095f3bf39Sphil * modification, are permitted provided that the following conditions 1195f3bf39Sphil * are met: 1295f3bf39Sphil * 1. Redistributions of source code must retain the above copyright 1395f3bf39Sphil * notice, this list of conditions and the following disclaimer. 1495f3bf39Sphil * 2. Redistributions in binary form must reproduce the above copyright 1595f3bf39Sphil * notice, this list of conditions and the following disclaimer in the 1695f3bf39Sphil * documentation and/or other materials provided with the distribution. 1795f3bf39Sphil * 3. All advertising materials mentioning features or use of this software 1895f3bf39Sphil * must display the following acknowledgement: 19*9e180a65Suwe * This product includes software developed for the NetBSD Project by 2095f3bf39Sphil * Piermont Information Systems Inc. 2195f3bf39Sphil * 4. The name of Piermont Information Systems Inc. may not be used to endorse 2295f3bf39Sphil * or promote products derived from this software without specific prior 2395f3bf39Sphil * written permission. 2495f3bf39Sphil * 2595f3bf39Sphil * THIS SOFTWARE IS PROVIDED BY PIERMONT INFORMATION SYSTEMS INC. ``AS IS'' 2695f3bf39Sphil * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 2795f3bf39Sphil * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 2895f3bf39Sphil * ARE DISCLAIMED. IN NO EVENT SHALL PIERMONT INFORMATION SYSTEMS INC. BE 2995f3bf39Sphil * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 3095f3bf39Sphil * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 3195f3bf39Sphil * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 3295f3bf39Sphil * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 3395f3bf39Sphil * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 3495f3bf39Sphil * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 3595f3bf39Sphil * THE POSSIBILITY OF SUCH DAMAGE. 3695f3bf39Sphil * 3795f3bf39Sphil */ 3895f3bf39Sphil 3995f3bf39Sphil{ 4095f3bf39Sphil 41d20940b9Sphil#include "msg_defs.h" 42d20940b9Sphil 43d20940b9Sphil/* Initial code for definitions and includes and prototypes. */ 44d20940b9Sphilvoid do_dynamic (void); 45d20940b9Sphilstatic int msg_init = 0; 4695f3bf39Sphil 4795f3bf39Sphil} 4895f3bf39Sphil 4995f3bf39Sphildefault x=20, y=10; 5095f3bf39Sphil 51d6e31d7eSphilallow dynamic menus; 525aa748c6Sphil 531ec08fd9Sphilerror action { fprintf (stderr, "Testm: Could not initialize curses.\n"); 541ec08fd9Sphil exit(1); }; 551ec08fd9Sphil 56d20940b9Sphilmenu root, title " Main Menu of Test System", x=10; 57d20940b9Sphil display action { 58d20940b9Sphil /* Message initialization */ 59d20940b9Sphil if (!msg_init) { 60d20940b9Sphil msg_window (stdscr); 61d20940b9Sphil msg_init = 1; 62d20940b9Sphil } 63d20940b9Sphil msg_display (MSG_welcome); 64d20940b9Sphil wrefresh(stdscr); }; 6595f3bf39Sphil option "Do nothing option", 6695f3bf39Sphil action { } 6795f3bf39Sphil ; 6895f3bf39Sphil option "Try a sub menu", 6995f3bf39Sphil sub menu submenu 7095f3bf39Sphil ; 711063113cSphil option "A scrollable menu", 721063113cSphil sub menu scrollit 731063113cSphil ; 74b30b5628Sphil option "Another scrollable menu", 75b30b5628Sphil sub menu scrollit2 76b30b5628Sphil ; 77b30b5628Sphil option "Big non-scrollable menu, bombs on small screens", 78d20940b9Sphil sub menu bigscroll 79d20940b9Sphil ; 8094c74058Sphil option "A menu with no shortcuts", 8194c74058Sphil sub menu noshort 8294c74058Sphil ; 83d20940b9Sphil option "A dynamic menu ...", 84d20940b9Sphil action { do_dynamic (); } 85d20940b9Sphil ; 86a7fc6d16Smartin option "Continuous title and menu ...", 87a7fc6d16Smartin sub menu contdemo 88a7fc6d16Smartin ; 8995f3bf39Sphil option "Run a shell...", 9095f3bf39Sphil action (endwin) { system ("/bin/sh"); } 9195f3bf39Sphil ; 9295f3bf39Sphil exit action (endwin) { printf ("Thanks for playing\n"); }; 9321fceeadSphil help { 9421fceeadSphil Main Menu Help Screen 9595f3bf39Sphil 9621fceeadSphilThis is help text for the main menu of the menu test system. This 9721fceeadSphiltext should appear verbatim when asked for by use of the ? key by 9821fceeadSphilthe user. This should allow scrolling, if needed. If the first 9921fceeadSphilcharacter in the help is the newline (as the case for this help), 10021fceeadSphilthen that newline is not included in the help text. 10121fceeadSphil 10221fceeadSphilNow this tests lines for scrolling: 10321fceeadSphil10 10421fceeadSphil11 10521fceeadSphil12 10621fceeadSphil13 10721fceeadSphil14 10821fceeadSphil15 10921fceeadSphil16 11021fceeadSphil17 11121fceeadSphil18 11221fceeadSphil19 11321fceeadSphil20 11421fceeadSphil21 11521fceeadSphil22 11621fceeadSphil23 11721fceeadSphil24 11821fceeadSphil25 11921fceeadSphil26 12021fceeadSphil27 12121fceeadSphil28 12221fceeadSphil29 12321fceeadSphil30 12421fceeadSphil31 12521fceeadSphil32 12621fceeadSphil33 12721fceeadSphil34 12821fceeadSphil35 12921fceeadSphil36 13021fceeadSphil37 13121fceeadSphil38 13221fceeadSphil39 13321fceeadSphil40 13421fceeadSphil41 13521fceeadSphil42 13621fceeadSphil43 13721fceeadSphil44 13821fceeadSphil45 13921fceeadSphil46 14021fceeadSphil47 14121fceeadSphil48 14221fceeadSphil49 14321fceeadSphil50 14421fceeadSphil51 14521fceeadSphil52 14621fceeadSphil53 14721fceeadSphil54 14821fceeadSphil55 14921fceeadSphil56 15021fceeadSphil57 15121fceeadSphil58 15221fceeadSphil59 15321fceeadSphil60 15421fceeadSphil61 15521fceeadSphil62 15621fceeadSphil63 15721fceeadSphil64 15821fceeadSphil65 15921fceeadSphil66 16021fceeadSphil67 16121fceeadSphil68 16221fceeadSphil69 16321fceeadSphil70 16421fceeadSphil71 16521fceeadSphil72 16621fceeadSphil73 16721fceeadSphil74 16821fceeadSphil75 16921fceeadSphil76 17021fceeadSphil77 17121fceeadSphil78 17221fceeadSphil79 17321fceeadSphil80 17421fceeadSphil}; 17595f3bf39Sphil 17695f3bf39Sphilmenu submenu, title " submenu test"; 17795f3bf39Sphil option "upper right", sub menu upperright; 178b30b5628Sphil option "lower left", sub menu lowerleft; 17995f3bf39Sphil option "middle, no title", sub menu middle; 1805aa748c6Sphil option "next menu", next menu nextmenu; 18195f3bf39Sphil 18295f3bf39Sphilmenu upperright, title "upper right", y=2, x=60, no exit; 18395f3bf39Sphil option "Just Exit!", exit; 18495f3bf39Sphil 185af7a1531Swrstudenmenu lowerleft, title "lower left", y=19, x=2, no exit; 18695f3bf39Sphil option "Just Exit!", exit; 18795f3bf39Sphil 18895f3bf39Sphilmenu middle, no box; 18995f3bf39Sphil option "Just Exit!", exit; 19095f3bf39Sphil 1915aa748c6Sphilmenu nextmenu, title " A next window! ? for comments", no exit; 1925aa748c6Sphil option "Just Exit!:", exit; 1935aa748c6Sphil 19494c74058Sphilmenu noshort, title " No shortcut characters!", no shortcut; 19594c74058Sphil option "first", action {}; 19694c74058Sphil option "second", action {}; 19794c74058Sphil option "third", action {}; 19894c74058Sphil 1991063113cSphilmenu scrollit, scrollable, h=4, title " Scrollable Menu"; 2001063113cSphil option "option 1", action {}; 2011063113cSphil option "option 2", action {}; 2021063113cSphil option "option 3", action {}; 2031063113cSphil option "option 4", action {}; 2041063113cSphil option "option 5", action {}; 2051063113cSphil option "option 6", action {}; 206b30b5628Sphil 207b30b5628Sphilmenu bigscroll, no scrollable, title " Non-scrollable Menu"; 208b30b5628Sphil option "option 1", action {}; 209b30b5628Sphil option "option 2", action {}; 210b30b5628Sphil option "option 3", action {}; 211b30b5628Sphil option "option 4", action {}; 212b30b5628Sphil option "option 5", action {}; 213b30b5628Sphil option "option 6", action {}; 214b30b5628Sphil option "option 7", action {}; 215b30b5628Sphil option "option 8", action {}; 216b30b5628Sphil option "option 9", action {}; 217b30b5628Sphil option "option 10", action {}; 218b30b5628Sphil option "option 11", action {}; 219b30b5628Sphil option "option 12", action {}; 220b30b5628Sphil option "option 13", action {}; 221b30b5628Sphil option "option 14", action {}; 222b30b5628Sphil option "option 15", action {}; 223b30b5628Sphil option "option 16", action {}; 224b30b5628Sphil option "option 17", action {}; 225b30b5628Sphil option "option 18", action {}; 226b30b5628Sphil option "option 19", action {}; 227b30b5628Sphil option "option 20", action {}; 228b30b5628Sphil 2292098fd19Sphilmenu scrollit2, scrollable, title " Big scrollable Menu"; 230b30b5628Sphil option "option 1", action {}; 231b30b5628Sphil option "option 2", action {}; 232b30b5628Sphil option "option 3", action {}; 233b30b5628Sphil option "option 4", action {}; 234b30b5628Sphil option "option 5", action {}; 235b30b5628Sphil option "option 6", action {}; 236b30b5628Sphil option "option 7", action {}; 237b30b5628Sphil option "option 8", action {}; 238b30b5628Sphil option "option 9", action {}; 239b30b5628Sphil option "option 10", action {}; 240b30b5628Sphil option "option 11", action {}; 241b30b5628Sphil option "option 12", action {}; 242b30b5628Sphil option "option 13", action {}; 243b30b5628Sphil option "option 14", action {}; 244b30b5628Sphil option "option 15", action {}; 245b30b5628Sphil option "option 16", action {}; 246b30b5628Sphil option "option 17", action {}; 247b30b5628Sphil option "option 18", action {}; 248b30b5628Sphil option "option 19", action {}; 249b30b5628Sphil option "option 20", action {}; 250b30b5628Sphil option "option 21", action {}; 251b30b5628Sphil option "option 22", action {}; 252b30b5628Sphil option "option 23", action {}; 253b30b5628Sphil option "option 24", action {}; 254b30b5628Sphil option "option 25", action {}; 255b30b5628Sphil option "option 26", action {}; 256b30b5628Sphil option "option 27", action {}; 257b30b5628Sphil option "option 28", action {}; 258b30b5628Sphil option "option 29", action {}; 259b30b5628Sphil option "option 30", action {}; 260b30b5628Sphil option "option 31", action {}; 261b30b5628Sphil option "option 32", action {}; 262b30b5628Sphil option "option 33", action {}; 263b30b5628Sphil option "option 34", action {}; 264b30b5628Sphil option "option 35", action {}; 265b30b5628Sphil option "option 36", action {}; 266b30b5628Sphil option "option 37", action {}; 267b30b5628Sphil option "option 38", action {}; 268b30b5628Sphil option "option 39", action {}; 269b30b5628Sphil option "option 40", action {}; 270b30b5628Sphil option "option 41", action {}; 271b30b5628Sphil option "option 42", action {}; 272b30b5628Sphil option "option 43", action {}; 273b30b5628Sphil option "option 44", action {}; 274b30b5628Sphil option "option 45", action {}; 275b30b5628Sphil option "option 46", action {}; 276b30b5628Sphil option "option 47", action {}; 277b30b5628Sphil option "option 48", action {}; 278b30b5628Sphil option "option 49", action {}; 279b30b5628Sphil option "option 50", action {}; 280b30b5628Sphil option "option 51", action {}; 281a7fc6d16Smartin 282a7fc6d16Smartinmenu contdemo, title "Menus without space between title and menu", y=3, x=10; 283a7fc6d16Smartin option "With box", sub menu contdemo_box; 284a7fc6d16Smartin option "No box", sub menu contdemo_none; 285a7fc6d16Smartin 286a7fc6d16Smartinmenu contdemo_box, title "title text ends here-->", y=3, x=10, no exit, 287a7fc6d16Smartin continuous title; 288a7fc6d16Smartin option "<--- first menu item here", exit; 289a7fc6d16Smartin 290a7fc6d16Smartinmenu contdemo_none, title "title text ends here-->", y=3, x=10, no box, no exit, 291a7fc6d16Smartin continuous title; 292a7fc6d16Smartin option "<--- first menu item here", exit; 293a7fc6d16Smartin 294