/* * Copyright (c) 2011-2024 Ross Cunniff * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ namespace term { /* Parameters for LibTermStart() */ const IS_RAW_IN = 1; // Start in raw input mode (Readch does not echo/block) const IS_COLOR = 2; // Allow color output const CAN_SCROLL = 3; // Automatically scroll if output goes past EOS /* Additional parameters for LibTermQuery() */ const WIDTH = 10; // Current width of the window const HEIGHT = 11; // Current height of the window const FG = 12; // Current foreground color const BG = 13; // Current background color const COLOR = 14; // Returns whether in color mode const NCOLORS = 15; // Returns number of possible color indexes const BOLD = 16; // Returns whether boldface is currently enabled const REVERSE = 17; // Returns whether reverse video is currently enabled const CURS_ROW = 18; // Returns the current cursor row const CURS_COL = 19; // Returns current cursor column /* Special keys returned from LibTermGetch() */ const NULL = -1; // No input is available (in cbreak mode) const UP = -2; // Keyboard up arrow const DOWN = -3; // Keyboard down arrow const LEFT = -4; // Keyboard left arrow const RIGHT = -5; // Keyboard right arrow const PGUP = -6; // Keyboard page up key const PGDN = -7; // Keyboard page down key const HOME = -8; // Keyboard page home key const END = -9; // Keyboard page end key const BACKTAB = -10; // Keyboard back-tab key const INSERT = -11; // Keyboard insert-char key const F1 = -12; // Keyboard function key F1 const F2 = -13; // Keyboard function key F2 const F3 = -14; // Keyboard function key F3 const F4 = -15; // Keyboard function key F4 const F5 = -16; // Keyboard function key F5 const F6 = -17; // Keyboard function key F6 const F7 = -18; // Keyboard function key F7 const F8 = -19; // Keyboard function key F8 const F9 = -20; // Keyboard function key F9 const F10 = -21; // Keyboard function key F10 const F11 = -22; // Keyboard function key F11 const F12 = -23; // Keyboard function key F12 /* Colors for LibTermColorPair() */ const BLACK = 0; const WHITE = 1; const RED = 2; const YELLOW = 3; const GREEN = 4; const CYAN = 5; const BLUE = 6; const MAGENTA = 7; /* Definitions of external procedures implemented */ extern Start, // Start(args) - initialize, where args are from above Stop, // Stop() - shut down termio GotoRC, // GotoRC(r,c) - move cursor to given screen position Bold, // Bold(isBold) - enable or disable bold (bright) chars Reverse, // Reverse(isReverse) - enable or disable reverse video RawInput, // RawInput(isRaw) - enable or disable raw input mode ColorPair, // ColorPair(idx,fg,bg) - create a fg,bg color pair for idx SetColor, // SetColor(idx) - sets current color to the given idx ScrollRegion, // ScrollRegion(top,bot) Establish top and bottom margins Scroll, // Scroll(n) - scroll up or down n lines CLS, // CLS() - clear the entire screen EEOL, // EEOL() - clear to the end of the current line EEOS, // EEOS() - clear to the bottom of the screen Flush, // Flush() - flush output Getch, // Getch() - get a keyboard key, including specials from above Query; // Query(item) - return value of items from list above } /* End namespace term */ /* If you're including this header, you're using this library. */ using extern "libterm";