1 /*- 2 * Copyright (c) 2002 Jordan DeLong 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright 9 * notice, this list of conditions and the following disclaimer. 10 * 2. Redistributions in binary form must reproduce the above copyright 11 * notice, this list of conditions and the following disclaimer in the 12 * documentation and/or other materials provided with the distribution. 13 * 3. Neither the name of the author nor the names of contributors may be 14 * used to endorse or promote products derived from this software 15 * without specific prior written permission. 16 * 17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 * SUCH DAMAGE. 28 */ 29 #ifndef SCREEN_H 30 #define SCREEN_H 31 32 #include <curses.h> 33 34 #define KEYSYM_RESIZE KEY_RESIZE 35 #define SCREEN_FIRSTSYM KEY_MIN 36 #define SCREEN_FIRSTUSRSYM (KEY_MAX + 1) 37 38 /* attribute definitions for colors */ 39 #define SCREEN_A_NORM A_NORMAL 40 #define SCREEN_A_STAND A_STANDOUT 41 #define SCREEN_A_UL A_UNDERLINE 42 #define SCREEN_A_RV A_REVERSE 43 #define SCREEN_A_BLINK A_BLINK 44 #define SCREEN_A_DIM A_DIM 45 #define SCREEN_A_BOLD A_BOLD 46 47 /* routines implemented as macros */ 48 #define screen_reinit() do { endwin(); refresh(); } while (0) 49 #define screen_clear clear 50 #define screen_suspend endwin 51 #define screen_redraw() wrefresh(curscr) 52 #define screen_gotoxy(x, y) move(y, x) 53 #define screen_width COLS 54 #define screen_height LINES 55 #define screen_putc(c) addch(c) 56 #define screen_puts(s) addstr(s) 57 #define screen_nputs(s, n) addnstr(s, n) 58 #define screen_bell() screen_needbell = 1 59 60 extern int screen_needbell; 61 extern int screen_keysyms; 62 63 void screen_init(); 64 void screen_shutdown(); 65 void screen_defcolor(int ident, u_char *fg, u_char *bg, 66 int attrs, int bwattrs); 67 void screen_setcolor(int ident); 68 void screen_nokeysyms(int b); 69 int screen_getkey(); 70 int screen_ungetkey(int ch); 71 int screen_key_pending(int m); 72 int screen_nprintf(int n, u_char *fmt, ...); 73 void screen_refresh(); 74 75 #endif 76