1 /* Public Domain Curses */ 2 3 /* $Id: curses.h,v 1.295 2008/07/15 17:13:25 wmcbrine Exp $ */ 4 5 /*----------------------------------------------------------------------* 6 * PDCurses * 7 *----------------------------------------------------------------------*/ 8 9 #ifndef __PDCURSES__ 10 #define __PDCURSES__ 1 11 12 /*man-start************************************************************** 13 14 PDCurses definitions list: (Only define those needed) 15 16 XCURSES True if compiling for X11. 17 PDC_RGB True if you want to use RGB color definitions 18 (Red = 1, Green = 2, Blue = 4) instead of BGR. 19 PDC_WIDE True if building wide-character support. 20 PDC_DLL_BUILD True if building a Win32 DLL. 21 NCURSES_MOUSE_VERSION Use the ncurses mouse API instead 22 of PDCurses' traditional mouse API. 23 24 PDCurses portable platform definitions list: 25 26 PDC_BUILD Defines API build version. 27 PDCURSES Enables access to PDCurses-only routines. 28 XOPEN Always true. 29 SYSVcurses True if you are compiling for SYSV portability. 30 BSDcurses True if you are compiling for BSD portability. 31 32 **man-end****************************************************************/ 33 34 #define PDC_BUILD 3401 35 #define PDCURSES 1 /* PDCurses-only routines */ 36 #define XOPEN 1 /* X/Open Curses routines */ 37 #define SYSVcurses 1 /* System V Curses routines */ 38 #define BSDcurses 1 /* BSD Curses routines */ 39 #define CHTYPE_LONG 1 /* size of chtype; long */ 40 41 /*----------------------------------------------------------------------*/ 42 43 #include <stdarg.h> 44 #include <stdbool.h> 45 #include <stddef.h> 46 #include <stdio.h> /* Required by X/Open usage below */ 47 48 #ifdef PDC_WIDE 49 # include <wchar.h> 50 #endif 51 52 /*---------------------------------------------------------------------- 53 * 54 * PDCurses Manifest Constants 55 * 56 */ 57 58 #ifndef FALSE 59 # define FALSE 0 60 #endif 61 #ifndef TRUE 62 # define TRUE 1 63 #endif 64 #ifndef NULL 65 # define NULL (void *)0 66 #endif 67 #ifndef ERR 68 # define ERR (-1) 69 #endif 70 #ifndef OK 71 # define OK 0 72 #endif 73 74 /*---------------------------------------------------------------------- 75 * 76 * PDCurses Type Declarations 77 * 78 */ 79 80 #ifdef CHTYPE_LONG 81 # if _LP64 82 typedef unsigned int chtype; 83 # else 84 typedef unsigned long chtype; /* 16-bit attr + 16-bit char */ 85 # endif 86 #else 87 typedef unsigned short chtype; /* 8-bit attr + 8-bit char */ 88 #endif 89 90 #ifdef PDC_WIDE 91 typedef chtype cchar_t; 92 #endif 93 94 typedef chtype attr_t; 95 96 /*---------------------------------------------------------------------- 97 * 98 * PDCurses Mouse Interface -- SYSVR4, with extensions 99 * 100 */ 101 102 typedef struct 103 { 104 int x; /* absolute column, 0 based, measured in characters */ 105 int y; /* absolute row, 0 based, measured in characters */ 106 short button[3]; /* state of each button */ 107 int changes; /* flags indicating what has changed with the mouse */ 108 } MOUSE_STATUS; 109 110 #define BUTTON_RELEASED 0x0000 111 #define BUTTON_PRESSED 0x0001 112 #define BUTTON_CLICKED 0x0002 113 #define BUTTON_DOUBLE_CLICKED 0x0003 114 #define BUTTON_TRIPLE_CLICKED 0x0004 115 #define BUTTON_MOVED 0x0005 /* PDCurses */ 116 #define WHEEL_SCROLLED 0x0006 /* PDCurses */ 117 #define BUTTON_ACTION_MASK 0x0007 /* PDCurses */ 118 119 #define PDC_BUTTON_SHIFT 0x0008 /* PDCurses */ 120 #define PDC_BUTTON_CONTROL 0x0010 /* PDCurses */ 121 #define PDC_BUTTON_ALT 0x0020 /* PDCurses */ 122 #define BUTTON_MODIFIER_MASK 0x0038 /* PDCurses */ 123 124 #define MOUSE_X_POS (Mouse_status.x) 125 #define MOUSE_Y_POS (Mouse_status.y) 126 127 /* 128 * Bits associated with the .changes field: 129 * 3 2 1 0 130 * 210987654321098765432109876543210 131 * 1 <- button 1 has changed 132 * 10 <- button 2 has changed 133 * 100 <- button 3 has changed 134 * 1000 <- mouse has moved 135 * 10000 <- mouse position report 136 * 100000 <- mouse wheel up 137 * 1000000 <- mouse wheel down 138 */ 139 140 #define PDC_MOUSE_MOVED 0x0008 141 #define PDC_MOUSE_POSITION 0x0010 142 #define PDC_MOUSE_WHEEL_UP 0x0020 143 #define PDC_MOUSE_WHEEL_DOWN 0x0040 144 145 #define A_BUTTON_CHANGED (Mouse_status.changes & 7) 146 #define MOUSE_MOVED (Mouse_status.changes & PDC_MOUSE_MOVED) 147 #define MOUSE_POS_REPORT (Mouse_status.changes & PDC_MOUSE_POSITION) 148 #define BUTTON_CHANGED(x) (Mouse_status.changes & (1 << ((x) - 1))) 149 #define BUTTON_STATUS(x) (Mouse_status.button[(x) - 1]) 150 #define MOUSE_WHEEL_UP (Mouse_status.changes & PDC_MOUSE_WHEEL_UP) 151 #define MOUSE_WHEEL_DOWN (Mouse_status.changes & PDC_MOUSE_WHEEL_DOWN) 152 153 /* mouse bit-masks */ 154 155 #define BUTTON1_RELEASED 0x00000001L 156 #define BUTTON1_PRESSED 0x00000002L 157 #define BUTTON1_CLICKED 0x00000004L 158 #define BUTTON1_DOUBLE_CLICKED 0x00000008L 159 #define BUTTON1_TRIPLE_CLICKED 0x00000010L 160 #define BUTTON1_MOVED 0x00000010L /* PDCurses */ 161 162 #define BUTTON2_RELEASED 0x00000020L 163 #define BUTTON2_PRESSED 0x00000040L 164 #define BUTTON2_CLICKED 0x00000080L 165 #define BUTTON2_DOUBLE_CLICKED 0x00000100L 166 #define BUTTON2_TRIPLE_CLICKED 0x00000200L 167 #define BUTTON2_MOVED 0x00000200L /* PDCurses */ 168 169 #define BUTTON3_RELEASED 0x00000400L 170 #define BUTTON3_PRESSED 0x00000800L 171 #define BUTTON3_CLICKED 0x00001000L 172 #define BUTTON3_DOUBLE_CLICKED 0x00002000L 173 #define BUTTON3_TRIPLE_CLICKED 0x00004000L 174 #define BUTTON3_MOVED 0x00004000L /* PDCurses */ 175 176 /* For the ncurses-compatible functions only, BUTTON4_PRESSED and 177 BUTTON5_PRESSED are returned for mouse scroll wheel up and down; 178 otherwise PDCurses doesn't support buttons 4 and 5 */ 179 180 #define BUTTON4_RELEASED 0x00008000L 181 #define BUTTON4_PRESSED 0x00010000L 182 #define BUTTON4_CLICKED 0x00020000L 183 #define BUTTON4_DOUBLE_CLICKED 0x00040000L 184 #define BUTTON4_TRIPLE_CLICKED 0x00080000L 185 186 #define BUTTON5_RELEASED 0x00100000L 187 #define BUTTON5_PRESSED 0x00200000L 188 #define BUTTON5_CLICKED 0x00400000L 189 #define BUTTON5_DOUBLE_CLICKED 0x00800000L 190 #define BUTTON5_TRIPLE_CLICKED 0x01000000L 191 192 #define MOUSE_WHEEL_SCROLL 0x02000000L /* PDCurses */ 193 #define BUTTON_MODIFIER_SHIFT 0x04000000L /* PDCurses */ 194 #define BUTTON_MODIFIER_CONTROL 0x08000000L /* PDCurses */ 195 #define BUTTON_MODIFIER_ALT 0x10000000L /* PDCurses */ 196 197 #define ALL_MOUSE_EVENTS 0x1fffffffL 198 #define REPORT_MOUSE_POSITION 0x20000000L 199 200 /* ncurses mouse interface */ 201 202 typedef unsigned long mmask_t; 203 204 typedef struct 205 { 206 short id; /* unused, always 0 */ 207 int x, y, z; /* x, y same as MOUSE_STATUS; z unused */ 208 mmask_t bstate; /* equivalent to changes + button[], but 209 in the same format as used for mousemask() */ 210 } MEVENT; 211 212 #ifdef NCURSES_MOUSE_VERSION 213 # define BUTTON_SHIFT BUTTON_MODIFIER_SHIFT 214 # define BUTTON_CONTROL BUTTON_MODIFIER_CONTROL 215 # define BUTTON_CTRL BUTTON_MODIFIER_CONTROL 216 # define BUTTON_ALT BUTTON_MODIFIER_ALT 217 #else 218 # define BUTTON_SHIFT PDC_BUTTON_SHIFT 219 # define BUTTON_CONTROL PDC_BUTTON_CONTROL 220 # define BUTTON_ALT PDC_BUTTON_ALT 221 #endif 222 223 /*---------------------------------------------------------------------- 224 * 225 * PDCurses Structure Definitions 226 * 227 */ 228 229 typedef struct _win /* definition of a window */ 230 { 231 int _cury; /* current pseudo-cursor */ 232 int _curx; 233 int _maxy; /* max window coordinates */ 234 int _maxx; 235 int _begy; /* origin on screen */ 236 int _begx; 237 int _flags; /* window properties */ 238 chtype _attrs; /* standard attributes and colors */ 239 chtype _bkgd; /* background, normally blank */ 240 bool _clear; /* causes clear at next refresh */ 241 bool _leaveit; /* leaves cursor where it is */ 242 bool _scroll; /* allows window scrolling */ 243 bool _nodelay; /* input character wait flag */ 244 bool _immed; /* immediate update flag */ 245 bool _sync; /* synchronise window ancestors */ 246 bool _use_keypad; /* flags keypad key mode active */ 247 chtype **_y; /* pointer to line pointer array */ 248 int *_firstch; /* first changed character in line */ 249 int *_lastch; /* last changed character in line */ 250 int _tmarg; /* top of scrolling region */ 251 int _bmarg; /* bottom of scrolling region */ 252 int _delayms; /* milliseconds of delay for getch() */ 253 int _parx, _pary; /* coords relative to parent (0,0) */ 254 struct _win *_parent; /* subwin's pointer to parent win */ 255 } WINDOW; 256 257 /* Avoid using the SCREEN struct directly -- use the corresponding 258 functions if possible. This struct may eventually be made private. */ 259 260 typedef struct 261 { 262 bool alive; /* if initscr() called, and not endwin() */ 263 bool autocr; /* if cr -> lf */ 264 bool cbreak; /* if terminal unbuffered */ 265 bool echo; /* if terminal echo */ 266 bool raw_inp; /* raw input mode (v. cooked input) */ 267 bool raw_out; /* raw output mode (7 v. 8 bits) */ 268 bool audible; /* FALSE if the bell is visual */ 269 bool mono; /* TRUE if current screen is mono */ 270 bool resized; /* TRUE if TERM has been resized */ 271 bool orig_attr; /* TRUE if we have the original colors */ 272 short orig_fore; /* original screen foreground color */ 273 short orig_back; /* original screen foreground color */ 274 int cursrow; /* position of physical cursor */ 275 int curscol; /* position of physical cursor */ 276 int visibility; /* visibility of cursor */ 277 int orig_cursor; /* original cursor size */ 278 int lines; /* new value for LINES */ 279 int cols; /* new value for COLS */ 280 unsigned long _trap_mbe; /* trap these mouse button events */ 281 unsigned long _map_mbe_to_key; /* map mouse buttons to slk */ 282 int mouse_wait; /* time to wait (in ms) for a 283 button release after a press, in 284 order to count it as a click */ 285 int slklines; /* lines in use by slk_init() */ 286 WINDOW *slk_winptr; /* window for slk */ 287 int linesrippedoff; /* lines ripped off via ripoffline() */ 288 int linesrippedoffontop; /* lines ripped off on 289 top via ripoffline() */ 290 int delaytenths; /* 1/10ths second to wait block 291 getch() for */ 292 bool _preserve; /* TRUE if screen background 293 to be preserved */ 294 int _restore; /* specifies if screen background 295 to be restored, and how */ 296 bool save_key_modifiers; /* TRUE if each key modifiers saved 297 with each key press */ 298 bool return_key_modifiers; /* TRUE if modifier keys are 299 returned as "real" keys */ 300 bool key_code; /* TRUE if last key is a special key; 301 used internally by get_wch() */ 302 #ifdef XCURSES 303 int XcurscrSize; /* size of Xcurscr shared memory block */ 304 bool sb_on; 305 int sb_viewport_y; 306 int sb_viewport_x; 307 int sb_total_y; 308 int sb_total_x; 309 int sb_cur_y; 310 int sb_cur_x; 311 #endif 312 short line_color; /* color of line attributes - default -1 */ 313 } SCREEN; 314 315 /*---------------------------------------------------------------------- 316 * 317 * PDCurses External Variables 318 * 319 */ 320 321 #ifdef PDC_DLL_BUILD 322 # ifdef CURSES_LIBRARY 323 # define PDCEX __declspec(dllexport) extern 324 # else 325 # define PDCEX __declspec(dllimport) 326 # endif 327 #else 328 # define PDCEX extern 329 #endif 330 331 PDCEX int LINES; /* terminal height */ 332 PDCEX int COLS; /* terminal width */ 333 PDCEX WINDOW *stdscr; /* the default screen window */ 334 PDCEX WINDOW *curscr; /* the current screen image */ 335 PDCEX SCREEN *SP; /* curses variables */ 336 PDCEX MOUSE_STATUS Mouse_status; 337 PDCEX int COLORS; 338 PDCEX int COLOR_PAIRS; 339 PDCEX int TABSIZE; 340 PDCEX chtype acs_map[]; /* alternate character set map */ 341 PDCEX char ttytype[]; /* terminal name/description */ 342 343 /*man-start************************************************************** 344 345 PDCurses Text Attributes 346 ======================== 347 348 Originally, PDCurses used a short (16 bits) for its chtype. To include 349 color, a number of things had to be sacrificed from the strict Unix and 350 System V support. The main problem was fitting all character attributes 351 and color into an unsigned char (all 8 bits!). 352 353 Today, PDCurses by default uses a long (32 bits) for its chtype, as in 354 System V. The short chtype is still available, by undefining CHTYPE_LONG 355 and rebuilding the library. 356 357 The following is the structure of a win->_attrs chtype: 358 359 short form: 360 361 ------------------------------------------------- 362 |15|14|13|12|11|10| 9| 8| 7| 6| 5| 4| 3| 2| 1| 0| 363 ------------------------------------------------- 364 color number | attrs | character eg 'a' 365 366 The available non-color attributes are bold, reverse and blink. Others 367 have no effect. The high order char is an index into an array of 368 physical colors (defined in color.c) -- 32 foreground/background color 369 pairs (5 bits) plus 3 bits for other attributes. 370 371 long form: 372 373 ---------------------------------------------------------------------------- 374 |31|30|29|28|27|26|25|24|23|22|21|20|19|18|17|16|15|14|13|12|..| 3| 2| 1| 0| 375 ---------------------------------------------------------------------------- 376 color number | modifiers | character eg 'a' 377 378 The available non-color attributes are bold, underline, invisible, 379 right-line, left-line, protect, reverse and blink. 256 color pairs (8 380 bits), 8 bits for other attributes, and 16 bits for character data. 381 382 **man-end****************************************************************/ 383 384 /*** Video attribute macros ***/ 385 386 #define A_NORMAL (chtype)0 387 388 #ifdef CHTYPE_LONG 389 # define A_ALTCHARSET (chtype)0x00010000 390 # define A_RIGHTLINE (chtype)0x00020000 391 # define A_LEFTLINE (chtype)0x00040000 392 # define A_INVIS (chtype)0x00080000 393 # define A_UNDERLINE (chtype)0x00100000 394 # define A_REVERSE (chtype)0x00200000 395 # define A_BLINK (chtype)0x00400000 396 # define A_BOLD (chtype)0x00800000 397 398 # define A_ATTRIBUTES (chtype)0xffff0000 399 # define A_CHARTEXT (chtype)0x0000ffff 400 # define A_COLOR (chtype)0xff000000 401 402 # define A_ITALIC A_INVIS 403 # define A_PROTECT (A_UNDERLINE | A_LEFTLINE | A_RIGHTLINE) 404 405 # define PDC_ATTR_SHIFT 19 406 # define PDC_COLOR_SHIFT 24 407 #else 408 # define A_BOLD (chtype)0x0100 /* X/Open */ 409 # define A_REVERSE (chtype)0x0200 /* X/Open */ 410 # define A_BLINK (chtype)0x0400 /* X/Open */ 411 412 # define A_ATTRIBUTES (chtype)0xff00 /* X/Open */ 413 # define A_CHARTEXT (chtype)0x00ff /* X/Open */ 414 # define A_COLOR (chtype)0xf800 /* System V */ 415 416 # define A_ALTCHARSET A_NORMAL /* X/Open */ 417 # define A_PROTECT A_NORMAL /* X/Open */ 418 # define A_UNDERLINE A_NORMAL /* X/Open */ 419 420 # define A_LEFTLINE A_NORMAL 421 # define A_RIGHTLINE A_NORMAL 422 # define A_ITALIC A_NORMAL 423 # define A_INVIS A_NORMAL 424 425 # define PDC_ATTR_SHIFT 8 426 # define PDC_COLOR_SHIFT 11 427 #endif 428 429 #define A_STANDOUT (A_REVERSE | A_BOLD) /* X/Open */ 430 #define A_DIM A_NORMAL 431 432 #define CHR_MSK A_CHARTEXT /* Obsolete */ 433 #define ATR_MSK A_ATTRIBUTES /* Obsolete */ 434 #define ATR_NRM A_NORMAL /* Obsolete */ 435 436 /* For use with attr_t -- X/Open says, "these shall be distinct", so 437 this is a non-conforming implementation. */ 438 439 #define WA_ALTCHARSET A_ALTCHARSET 440 #define WA_BLINK A_BLINK 441 #define WA_BOLD A_BOLD 442 #define WA_DIM A_DIM 443 #define WA_INVIS A_INVIS 444 #define WA_LEFT A_LEFTLINE 445 #define WA_PROTECT A_PROTECT 446 #define WA_REVERSE A_REVERSE 447 #define WA_RIGHT A_RIGHTLINE 448 #define WA_STANDOUT A_STANDOUT 449 #define WA_UNDERLINE A_UNDERLINE 450 451 #define WA_HORIZONTAL A_NORMAL 452 #define WA_LOW A_NORMAL 453 #define WA_TOP A_NORMAL 454 #define WA_VERTICAL A_NORMAL 455 456 /*** Alternate character set macros ***/ 457 458 /* 'w' = 32-bit chtype; acs_map[] index | A_ALTCHARSET 459 'n' = 16-bit chtype; it gets the fallback set because no bit is 460 available for A_ALTCHARSET */ 461 462 #ifdef CHTYPE_LONG 463 # define ACS_PICK(w, n) ((chtype)w | A_ALTCHARSET) 464 #else 465 # define ACS_PICK(w, n) ((chtype)n) 466 #endif 467 468 /* VT100-compatible symbols -- box chars */ 469 470 #define ACS_ULCORNER ACS_PICK('l', '+') 471 #define ACS_LLCORNER ACS_PICK('m', '+') 472 #define ACS_URCORNER ACS_PICK('k', '+') 473 #define ACS_LRCORNER ACS_PICK('j', '+') 474 #define ACS_RTEE ACS_PICK('u', '+') 475 #define ACS_LTEE ACS_PICK('t', '+') 476 #define ACS_BTEE ACS_PICK('v', '+') 477 #define ACS_TTEE ACS_PICK('w', '+') 478 #define ACS_HLINE ACS_PICK('q', '-') 479 #define ACS_VLINE ACS_PICK('x', '|') 480 #define ACS_PLUS ACS_PICK('n', '+') 481 482 /* VT100-compatible symbols -- other */ 483 484 #define ACS_S1 ACS_PICK('o', '-') 485 #define ACS_S9 ACS_PICK('s', '_') 486 #define ACS_DIAMOND ACS_PICK('`', '+') 487 #define ACS_CKBOARD ACS_PICK('a', ':') 488 #define ACS_DEGREE ACS_PICK('f', '\'') 489 #define ACS_PLMINUS ACS_PICK('g', '#') 490 #define ACS_BULLET ACS_PICK('~', 'o') 491 492 /* Teletype 5410v1 symbols -- these are defined in SysV curses, but 493 are not well-supported by most terminals. Stick to VT100 characters 494 for optimum portability. */ 495 496 #define ACS_LARROW ACS_PICK(',', '<') 497 #define ACS_RARROW ACS_PICK('+', '>') 498 #define ACS_DARROW ACS_PICK('.', 'v') 499 #define ACS_UARROW ACS_PICK('-', '^') 500 #define ACS_BOARD ACS_PICK('h', '#') 501 #define ACS_LANTERN ACS_PICK('i', '*') 502 #define ACS_BLOCK ACS_PICK('0', '#') 503 504 /* That goes double for these -- undocumented SysV symbols. Don't use 505 them. */ 506 507 #define ACS_S3 ACS_PICK('p', '-') 508 #define ACS_S7 ACS_PICK('r', '-') 509 #define ACS_LEQUAL ACS_PICK('y', '<') 510 #define ACS_GEQUAL ACS_PICK('z', '>') 511 #define ACS_PI ACS_PICK('{', 'n') 512 #define ACS_NEQUAL ACS_PICK('|', '+') 513 #define ACS_STERLING ACS_PICK('}', 'L') 514 515 /* Box char aliases */ 516 517 #define ACS_BSSB ACS_ULCORNER 518 #define ACS_SSBB ACS_LLCORNER 519 #define ACS_BBSS ACS_URCORNER 520 #define ACS_SBBS ACS_LRCORNER 521 #define ACS_SBSS ACS_RTEE 522 #define ACS_SSSB ACS_LTEE 523 #define ACS_SSBS ACS_BTEE 524 #define ACS_BSSS ACS_TTEE 525 #define ACS_BSBS ACS_HLINE 526 #define ACS_SBSB ACS_VLINE 527 #define ACS_SSSS ACS_PLUS 528 529 /* cchar_t aliases */ 530 531 #ifdef PDC_WIDE 532 # define WACS_ULCORNER (&(acs_map['l'])) 533 # define WACS_LLCORNER (&(acs_map['m'])) 534 # define WACS_URCORNER (&(acs_map['k'])) 535 # define WACS_LRCORNER (&(acs_map['j'])) 536 # define WACS_RTEE (&(acs_map['u'])) 537 # define WACS_LTEE (&(acs_map['t'])) 538 # define WACS_BTEE (&(acs_map['v'])) 539 # define WACS_TTEE (&(acs_map['w'])) 540 # define WACS_HLINE (&(acs_map['q'])) 541 # define WACS_VLINE (&(acs_map['x'])) 542 # define WACS_PLUS (&(acs_map['n'])) 543 544 # define WACS_S1 (&(acs_map['o'])) 545 # define WACS_S9 (&(acs_map['s'])) 546 # define WACS_DIAMOND (&(acs_map['`'])) 547 # define WACS_CKBOARD (&(acs_map['a'])) 548 # define WACS_DEGREE (&(acs_map['f'])) 549 # define WACS_PLMINUS (&(acs_map['g'])) 550 # define WACS_BULLET (&(acs_map['~'])) 551 552 # define WACS_LARROW (&(acs_map[','])) 553 # define WACS_RARROW (&(acs_map['+'])) 554 # define WACS_DARROW (&(acs_map['.'])) 555 # define WACS_UARROW (&(acs_map['-'])) 556 # define WACS_BOARD (&(acs_map['h'])) 557 # define WACS_LANTERN (&(acs_map['i'])) 558 # define WACS_BLOCK (&(acs_map['0'])) 559 560 # define WACS_S3 (&(acs_map['p'])) 561 # define WACS_S7 (&(acs_map['r'])) 562 # define WACS_LEQUAL (&(acs_map['y'])) 563 # define WACS_GEQUAL (&(acs_map['z'])) 564 # define WACS_PI (&(acs_map['{'])) 565 # define WACS_NEQUAL (&(acs_map['|'])) 566 # define WACS_STERLING (&(acs_map['}'])) 567 568 # define WACS_BSSB WACS_ULCORNER 569 # define WACS_SSBB WACS_LLCORNER 570 # define WACS_BBSS WACS_URCORNER 571 # define WACS_SBBS WACS_LRCORNER 572 # define WACS_SBSS WACS_RTEE 573 # define WACS_SSSB WACS_LTEE 574 # define WACS_SSBS WACS_BTEE 575 # define WACS_BSSS WACS_TTEE 576 # define WACS_BSBS WACS_HLINE 577 # define WACS_SBSB WACS_VLINE 578 # define WACS_SSSS WACS_PLUS 579 #endif 580 581 /*** Color macros ***/ 582 583 #define COLOR_BLACK 0 584 585 #ifdef PDC_RGB /* RGB */ 586 # define COLOR_RED 1 587 # define COLOR_GREEN 2 588 # define COLOR_BLUE 4 589 #else /* BGR */ 590 # define COLOR_BLUE 1 591 # define COLOR_GREEN 2 592 # define COLOR_RED 4 593 #endif 594 595 #define COLOR_CYAN (COLOR_BLUE | COLOR_GREEN) 596 #define COLOR_MAGENTA (COLOR_RED | COLOR_BLUE) 597 #define COLOR_YELLOW (COLOR_RED | COLOR_GREEN) 598 599 #define COLOR_WHITE 7 600 601 /*---------------------------------------------------------------------- 602 * 603 * Function and Keypad Key Definitions. 604 * Many are just for compatibility. 605 * 606 */ 607 608 #define KEY_CODE_YES 0x100 /* If get_wch() gives a key code */ 609 610 #define KEY_BREAK 0x101 /* Not on PC KBD */ 611 #define KEY_DOWN 0x102 /* Down arrow key */ 612 #define KEY_UP 0x103 /* Up arrow key */ 613 #define KEY_LEFT 0x104 /* Left arrow key */ 614 #define KEY_RIGHT 0x105 /* Right arrow key */ 615 #define KEY_HOME 0x106 /* home key */ 616 #define KEY_BACKSPACE 0x107 /* not on pc */ 617 #define KEY_F0 0x108 /* function keys; 64 reserved */ 618 619 #define KEY_DL 0x148 /* delete line */ 620 #define KEY_IL 0x149 /* insert line */ 621 #define KEY_DC 0x14a /* delete character */ 622 #define KEY_IC 0x14b /* insert char or enter ins mode */ 623 #define KEY_EIC 0x14c /* exit insert char mode */ 624 #define KEY_CLEAR 0x14d /* clear screen */ 625 #define KEY_EOS 0x14e /* clear to end of screen */ 626 #define KEY_EOL 0x14f /* clear to end of line */ 627 #define KEY_SF 0x150 /* scroll 1 line forward */ 628 #define KEY_SR 0x151 /* scroll 1 line back (reverse) */ 629 #define KEY_NPAGE 0x152 /* next page */ 630 #define KEY_PPAGE 0x153 /* previous page */ 631 #define KEY_STAB 0x154 /* set tab */ 632 #define KEY_CTAB 0x155 /* clear tab */ 633 #define KEY_CATAB 0x156 /* clear all tabs */ 634 #define KEY_ENTER 0x157 /* enter or send (unreliable) */ 635 #define KEY_SRESET 0x158 /* soft/reset (partial/unreliable) */ 636 #define KEY_RESET 0x159 /* reset/hard reset (unreliable) */ 637 #define KEY_PRINT 0x15a /* print/copy */ 638 #define KEY_LL 0x15b /* home down/bottom (lower left) */ 639 #define KEY_ABORT 0x15c /* abort/terminate key (any) */ 640 #define KEY_SHELP 0x15d /* short help */ 641 #define KEY_LHELP 0x15e /* long help */ 642 #define KEY_BTAB 0x15f /* Back tab key */ 643 #define KEY_BEG 0x160 /* beg(inning) key */ 644 #define KEY_CANCEL 0x161 /* cancel key */ 645 #define KEY_CLOSE 0x162 /* close key */ 646 #define KEY_COMMAND 0x163 /* cmd (command) key */ 647 #define KEY_COPY 0x164 /* copy key */ 648 #define KEY_CREATE 0x165 /* create key */ 649 #define KEY_END 0x166 /* end key */ 650 #define KEY_EXIT 0x167 /* exit key */ 651 #define KEY_FIND 0x168 /* find key */ 652 #define KEY_HELP 0x169 /* help key */ 653 #define KEY_MARK 0x16a /* mark key */ 654 #define KEY_MESSAGE 0x16b /* message key */ 655 #define KEY_MOVE 0x16c /* move key */ 656 #define KEY_NEXT 0x16d /* next object key */ 657 #define KEY_OPEN 0x16e /* open key */ 658 #define KEY_OPTIONS 0x16f /* options key */ 659 #define KEY_PREVIOUS 0x170 /* previous object key */ 660 #define KEY_REDO 0x171 /* redo key */ 661 #define KEY_REFERENCE 0x172 /* ref(erence) key */ 662 #define KEY_REFRESH 0x173 /* refresh key */ 663 #define KEY_REPLACE 0x174 /* replace key */ 664 #define KEY_RESTART 0x175 /* restart key */ 665 #define KEY_RESUME 0x176 /* resume key */ 666 #define KEY_SAVE 0x177 /* save key */ 667 #define KEY_SBEG 0x178 /* shifted beginning key */ 668 #define KEY_SCANCEL 0x179 /* shifted cancel key */ 669 #define KEY_SCOMMAND 0x17a /* shifted command key */ 670 #define KEY_SCOPY 0x17b /* shifted copy key */ 671 #define KEY_SCREATE 0x17c /* shifted create key */ 672 #define KEY_SDC 0x17d /* shifted delete char key */ 673 #define KEY_SDL 0x17e /* shifted delete line key */ 674 #define KEY_SELECT 0x17f /* select key */ 675 #define KEY_SEND 0x180 /* shifted end key */ 676 #define KEY_SEOL 0x181 /* shifted clear line key */ 677 #define KEY_SEXIT 0x182 /* shifted exit key */ 678 #define KEY_SFIND 0x183 /* shifted find key */ 679 #define KEY_SHOME 0x184 /* shifted home key */ 680 #define KEY_SIC 0x185 /* shifted input key */ 681 682 #define KEY_SLEFT 0x187 /* shifted left arrow key */ 683 #define KEY_SMESSAGE 0x188 /* shifted message key */ 684 #define KEY_SMOVE 0x189 /* shifted move key */ 685 #define KEY_SNEXT 0x18a /* shifted next key */ 686 #define KEY_SOPTIONS 0x18b /* shifted options key */ 687 #define KEY_SPREVIOUS 0x18c /* shifted prev key */ 688 #define KEY_SPRINT 0x18d /* shifted print key */ 689 #define KEY_SREDO 0x18e /* shifted redo key */ 690 #define KEY_SREPLACE 0x18f /* shifted replace key */ 691 #define KEY_SRIGHT 0x190 /* shifted right arrow */ 692 #define KEY_SRSUME 0x191 /* shifted resume key */ 693 #define KEY_SSAVE 0x192 /* shifted save key */ 694 #define KEY_SSUSPEND 0x193 /* shifted suspend key */ 695 #define KEY_SUNDO 0x194 /* shifted undo key */ 696 #define KEY_SUSPEND 0x195 /* suspend key */ 697 #define KEY_UNDO 0x196 /* undo key */ 698 699 /* PDCurses-specific key definitions -- PC only */ 700 701 #define ALT_0 0x197 702 #define ALT_1 0x198 703 #define ALT_2 0x199 704 #define ALT_3 0x19a 705 #define ALT_4 0x19b 706 #define ALT_5 0x19c 707 #define ALT_6 0x19d 708 #define ALT_7 0x19e 709 #define ALT_8 0x19f 710 #define ALT_9 0x1a0 711 #define ALT_A 0x1a1 712 #define ALT_B 0x1a2 713 #define ALT_C 0x1a3 714 #define ALT_D 0x1a4 715 #define ALT_E 0x1a5 716 #define ALT_F 0x1a6 717 #define ALT_G 0x1a7 718 #define ALT_H 0x1a8 719 #define ALT_I 0x1a9 720 #define ALT_J 0x1aa 721 #define ALT_K 0x1ab 722 #define ALT_L 0x1ac 723 #define ALT_M 0x1ad 724 #define ALT_N 0x1ae 725 #define ALT_O 0x1af 726 #define ALT_P 0x1b0 727 #define ALT_Q 0x1b1 728 #define ALT_R 0x1b2 729 #define ALT_S 0x1b3 730 #define ALT_T 0x1b4 731 #define ALT_U 0x1b5 732 #define ALT_V 0x1b6 733 #define ALT_W 0x1b7 734 #define ALT_X 0x1b8 735 #define ALT_Y 0x1b9 736 #define ALT_Z 0x1ba 737 738 #define CTL_LEFT 0x1bb /* Control-Left-Arrow */ 739 #define CTL_RIGHT 0x1bc 740 #define CTL_PGUP 0x1bd 741 #define CTL_PGDN 0x1be 742 #define CTL_HOME 0x1bf 743 #define CTL_END 0x1c0 744 745 #define KEY_A1 0x1c1 /* upper left on Virtual keypad */ 746 #define KEY_A2 0x1c2 /* upper middle on Virt. keypad */ 747 #define KEY_A3 0x1c3 /* upper right on Vir. keypad */ 748 #define KEY_B1 0x1c4 /* middle left on Virt. keypad */ 749 #define KEY_B2 0x1c5 /* center on Virt. keypad */ 750 #define KEY_B3 0x1c6 /* middle right on Vir. keypad */ 751 #define KEY_C1 0x1c7 /* lower left on Virt. keypad */ 752 #define KEY_C2 0x1c8 /* lower middle on Virt. keypad */ 753 #define KEY_C3 0x1c9 /* lower right on Vir. keypad */ 754 755 #define PADSLASH 0x1ca /* slash on keypad */ 756 #define PADENTER 0x1cb /* enter on keypad */ 757 #define CTL_PADENTER 0x1cc /* ctl-enter on keypad */ 758 #define ALT_PADENTER 0x1cd /* alt-enter on keypad */ 759 #define PADSTOP 0x1ce /* stop on keypad */ 760 #define PADSTAR 0x1cf /* star on keypad */ 761 #define PADMINUS 0x1d0 /* minus on keypad */ 762 #define PADPLUS 0x1d1 /* plus on keypad */ 763 #define CTL_PADSTOP 0x1d2 /* ctl-stop on keypad */ 764 #define CTL_PADCENTER 0x1d3 /* ctl-enter on keypad */ 765 #define CTL_PADPLUS 0x1d4 /* ctl-plus on keypad */ 766 #define CTL_PADMINUS 0x1d5 /* ctl-minus on keypad */ 767 #define CTL_PADSLASH 0x1d6 /* ctl-slash on keypad */ 768 #define CTL_PADSTAR 0x1d7 /* ctl-star on keypad */ 769 #define ALT_PADPLUS 0x1d8 /* alt-plus on keypad */ 770 #define ALT_PADMINUS 0x1d9 /* alt-minus on keypad */ 771 #define ALT_PADSLASH 0x1da /* alt-slash on keypad */ 772 #define ALT_PADSTAR 0x1db /* alt-star on keypad */ 773 #define ALT_PADSTOP 0x1dc /* alt-stop on keypad */ 774 #define CTL_INS 0x1dd /* ctl-insert */ 775 #define ALT_DEL 0x1de /* alt-delete */ 776 #define ALT_INS 0x1df /* alt-insert */ 777 #define CTL_UP 0x1e0 /* ctl-up arrow */ 778 #define CTL_DOWN 0x1e1 /* ctl-down arrow */ 779 #define CTL_TAB 0x1e2 /* ctl-tab */ 780 #define ALT_TAB 0x1e3 781 #define ALT_MINUS 0x1e4 782 #define ALT_EQUAL 0x1e5 783 #define ALT_HOME 0x1e6 784 #define ALT_PGUP 0x1e7 785 #define ALT_PGDN 0x1e8 786 #define ALT_END 0x1e9 787 #define ALT_UP 0x1ea /* alt-up arrow */ 788 #define ALT_DOWN 0x1eb /* alt-down arrow */ 789 #define ALT_RIGHT 0x1ec /* alt-right arrow */ 790 #define ALT_LEFT 0x1ed /* alt-left arrow */ 791 #define ALT_ENTER 0x1ee /* alt-enter */ 792 #define ALT_ESC 0x1ef /* alt-escape */ 793 #define ALT_BQUOTE 0x1f0 /* alt-back quote */ 794 #define ALT_LBRACKET 0x1f1 /* alt-left bracket */ 795 #define ALT_RBRACKET 0x1f2 /* alt-right bracket */ 796 #define ALT_SEMICOLON 0x1f3 /* alt-semi-colon */ 797 #define ALT_FQUOTE 0x1f4 /* alt-forward quote */ 798 #define ALT_COMMA 0x1f5 /* alt-comma */ 799 #define ALT_STOP 0x1f6 /* alt-stop */ 800 #define ALT_FSLASH 0x1f7 /* alt-forward slash */ 801 #define ALT_BKSP 0x1f8 /* alt-backspace */ 802 #define CTL_BKSP 0x1f9 /* ctl-backspace */ 803 #define PAD0 0x1fa /* keypad 0 */ 804 805 #define CTL_PAD0 0x1fb /* ctl-keypad 0 */ 806 #define CTL_PAD1 0x1fc 807 #define CTL_PAD2 0x1fd 808 #define CTL_PAD3 0x1fe 809 #define CTL_PAD4 0x1ff 810 #define CTL_PAD5 0x200 811 #define CTL_PAD6 0x201 812 #define CTL_PAD7 0x202 813 #define CTL_PAD8 0x203 814 #define CTL_PAD9 0x204 815 816 #define ALT_PAD0 0x205 /* alt-keypad 0 */ 817 #define ALT_PAD1 0x206 818 #define ALT_PAD2 0x207 819 #define ALT_PAD3 0x208 820 #define ALT_PAD4 0x209 821 #define ALT_PAD5 0x20a 822 #define ALT_PAD6 0x20b 823 #define ALT_PAD7 0x20c 824 #define ALT_PAD8 0x20d 825 #define ALT_PAD9 0x20e 826 827 #define CTL_DEL 0x20f /* clt-delete */ 828 #define ALT_BSLASH 0x210 /* alt-back slash */ 829 #define CTL_ENTER 0x211 /* ctl-enter */ 830 831 #define SHF_PADENTER 0x212 /* shift-enter on keypad */ 832 #define SHF_PADSLASH 0x213 /* shift-slash on keypad */ 833 #define SHF_PADSTAR 0x214 /* shift-star on keypad */ 834 #define SHF_PADPLUS 0x215 /* shift-plus on keypad */ 835 #define SHF_PADMINUS 0x216 /* shift-minus on keypad */ 836 #define SHF_UP 0x217 /* shift-up on keypad */ 837 #define SHF_DOWN 0x218 /* shift-down on keypad */ 838 #define SHF_IC 0x219 /* shift-insert on keypad */ 839 #define SHF_DC 0x21a /* shift-delete on keypad */ 840 841 #define KEY_MOUSE 0x21b /* "mouse" key */ 842 #define KEY_SHIFT_L 0x21c /* Left-shift */ 843 #define KEY_SHIFT_R 0x21d /* Right-shift */ 844 #define KEY_CONTROL_L 0x21e /* Left-control */ 845 #define KEY_CONTROL_R 0x21f /* Right-control */ 846 #define KEY_ALT_L 0x220 /* Left-alt */ 847 #define KEY_ALT_R 0x221 /* Right-alt */ 848 #define KEY_RESIZE 0x222 /* Window resize */ 849 #define KEY_SUP 0x223 /* Shifted up arrow */ 850 #define KEY_SDOWN 0x224 /* Shifted down arrow */ 851 852 #define KEY_MIN KEY_BREAK /* Minimum curses key value */ 853 #define KEY_MAX KEY_SDOWN /* Maximum curses key */ 854 855 #define KEY_F(n) (KEY_F0 + (n)) 856 857 /*---------------------------------------------------------------------- 858 * 859 * PDCurses Function Declarations 860 * 861 */ 862 863 /* Standard */ 864 865 int addch(const chtype); 866 int addchnstr(const chtype *, int); 867 int addchstr(const chtype *); 868 int addnstr(const char *, int); 869 int addstr(const char *); 870 int attroff(chtype); 871 int attron(chtype); 872 int attrset(chtype); 873 int attr_get(attr_t *, short *, void *); 874 int attr_off(attr_t, void *); 875 int attr_on(attr_t, void *); 876 int attr_set(attr_t, short, void *); 877 int baudrate(void); 878 int beep(void); 879 int bkgd(chtype); 880 void bkgdset(chtype); 881 int border(chtype, chtype, chtype, chtype, chtype, chtype, chtype, chtype); 882 int box(WINDOW *, chtype, chtype); 883 bool can_change_color(void); 884 int cbreak(void); 885 int chgat(int, attr_t, short, const void *); 886 int clearok(WINDOW *, bool); 887 int clear(void); 888 int clrtobot(void); 889 int clrtoeol(void); 890 int color_content(short, short *, short *, short *); 891 int color_set(short, void *); 892 int copywin(const WINDOW *, WINDOW *, int, int, int, int, int, int, int); 893 int curs_set(int); 894 int def_prog_mode(void); 895 int def_shell_mode(void); 896 int delay_output(int); 897 int delch(void); 898 int deleteln(void); 899 void delscreen(SCREEN *); 900 int delwin(WINDOW *); 901 WINDOW *derwin(WINDOW *, int, int, int, int); 902 int doupdate(void); 903 WINDOW *dupwin(WINDOW *); 904 int echochar(const chtype); 905 int echo(void); 906 int endwin(void); 907 char erasechar(void); 908 int erase(void); 909 void filter(void); 910 int flash(void); 911 int flushinp(void); 912 chtype getbkgd(WINDOW *); 913 int getnstr(char *, int); 914 int getstr(char *); 915 WINDOW *getwin(FILE *); 916 int halfdelay(int); 917 bool has_colors(void); 918 bool has_ic(void); 919 bool has_il(void); 920 int hline(chtype, int); 921 void idcok(WINDOW *, bool); 922 int idlok(WINDOW *, bool); 923 void immedok(WINDOW *, bool); 924 int inchnstr(chtype *, int); 925 int inchstr(chtype *); 926 chtype inch(void); 927 int init_color(short, short, short, short); 928 int init_pair(short, short, short); 929 WINDOW *initscr(void); 930 int innstr(char *, int); 931 int insch(chtype); 932 int insdelln(int); 933 int insertln(void); 934 int insnstr(const char *, int); 935 int insstr(const char *); 936 int instr(char *); 937 int intrflush(WINDOW *, bool); 938 bool isendwin(void); 939 bool is_linetouched(WINDOW *, int); 940 bool is_wintouched(WINDOW *); 941 const char *keyname(int); 942 int keypad(WINDOW *, bool); 943 char killchar(void); 944 int leaveok(WINDOW *, bool); 945 char *longname(void); 946 int meta(WINDOW *, bool); 947 int move(int, int); 948 int mvaddch(int, int, const chtype); 949 int mvaddchnstr(int, int, const chtype *, int); 950 int mvaddchstr(int, int, const chtype *); 951 int mvaddnstr(int, int, const char *, int); 952 int mvaddstr(int, int, const char *); 953 int mvchgat(int, int, int, attr_t, short, const void *); 954 int mvcur(int, int, int, int); 955 int mvdelch(int, int); 956 int mvderwin(WINDOW *, int, int); 957 int mvgetch(int, int); 958 int mvgetnstr(int, int, char *, int); 959 int mvgetstr(int, int, char *); 960 int mvhline(int, int, chtype, int); 961 chtype mvinch(int, int); 962 int mvinchnstr(int, int, chtype *, int); 963 int mvinchstr(int, int, chtype *); 964 int mvinnstr(int, int, char *, int); 965 int mvinsch(int, int, chtype); 966 int mvinsnstr(int, int, const char *, int); 967 int mvinsstr(int, int, const char *); 968 int mvinstr(int, int, char *); 969 int mvprintw(int, int, const char *, ...); 970 int mvscanw(int, int, const char *, ...); 971 int mvvline(int, int, chtype, int); 972 int mvwaddchnstr(WINDOW *, int, int, const chtype *, int); 973 int mvwaddchstr(WINDOW *, int, int, const chtype *); 974 int mvwaddch(WINDOW *, int, int, const chtype); 975 int mvwaddnstr(WINDOW *, int, int, const char *, int); 976 int mvwaddstr(WINDOW *, int, int, const char *); 977 int mvwchgat(WINDOW *, int, int, int, attr_t, short, const void *); 978 int mvwdelch(WINDOW *, int, int); 979 int mvwgetch(WINDOW *, int, int); 980 int mvwgetnstr(WINDOW *, int, int, char *, int); 981 int mvwgetstr(WINDOW *, int, int, char *); 982 int mvwhline(WINDOW *, int, int, chtype, int); 983 int mvwinchnstr(WINDOW *, int, int, chtype *, int); 984 int mvwinchstr(WINDOW *, int, int, chtype *); 985 chtype mvwinch(WINDOW *, int, int); 986 int mvwinnstr(WINDOW *, int, int, char *, int); 987 int mvwinsch(WINDOW *, int, int, chtype); 988 int mvwinsnstr(WINDOW *, int, int, const char *, int); 989 int mvwinsstr(WINDOW *, int, int, const char *); 990 int mvwinstr(WINDOW *, int, int, char *); 991 int mvwin(WINDOW *, int, int); 992 int mvwprintw(WINDOW *, int, int, const char *, ...); 993 int mvwscanw(WINDOW *, int, int, const char *, ...); 994 int mvwvline(WINDOW *, int, int, chtype, int); 995 int napms(int); 996 WINDOW *newpad(int, int); 997 SCREEN *newterm(const char *, FILE *, FILE *); 998 WINDOW *newwin(int, int, int, int); 999 int nl(void); 1000 int nocbreak(void); 1001 int nodelay(WINDOW *, bool); 1002 int noecho(void); 1003 int nonl(void); 1004 void noqiflush(void); 1005 int noraw(void); 1006 int notimeout(WINDOW *, bool); 1007 int overlay(const WINDOW *, WINDOW *); 1008 int overwrite(const WINDOW *, WINDOW *); 1009 int pair_content(short, short *, short *); 1010 int pechochar(WINDOW *, chtype); 1011 int pnoutrefresh(WINDOW *, int, int, int, int, int, int); 1012 int prefresh(WINDOW *, int, int, int, int, int, int); 1013 int printw(const char *, ...); 1014 int putwin(WINDOW *, FILE *); 1015 void qiflush(void); 1016 int raw(void); 1017 int redrawwin(WINDOW *); 1018 int refresh(void); 1019 int reset_prog_mode(void); 1020 int reset_shell_mode(void); 1021 int resetty(void); 1022 int ripoffline(int, int (*)(WINDOW *, int)); 1023 int savetty(void); 1024 int scanw(const char *, ...); 1025 int scr_dump(const char *); 1026 int scr_init(const char *); 1027 int scr_restore(const char *); 1028 int scr_set(const char *); 1029 int scrl(int); 1030 int scroll(WINDOW *); 1031 int scrollok(WINDOW *, bool); 1032 SCREEN *set_term(SCREEN *); 1033 int setscrreg(int, int); 1034 int slk_attroff(const chtype); 1035 int slk_attr_off(const attr_t, void *); 1036 int slk_attron(const chtype); 1037 int slk_attr_on(const attr_t, void *); 1038 int slk_attrset(const chtype); 1039 int slk_attr_set(const attr_t, short, void *); 1040 int slk_clear(void); 1041 int slk_color(short); 1042 int slk_init(int); 1043 char *slk_label(int); 1044 int slk_noutrefresh(void); 1045 int slk_refresh(void); 1046 int slk_restore(void); 1047 int slk_set(int, const char *, int); 1048 int slk_touch(void); 1049 int standend(void); 1050 int standout(void); 1051 int start_color(void); 1052 WINDOW *subpad(WINDOW *, int, int, int, int); 1053 WINDOW *subwin(WINDOW *, int, int, int, int); 1054 int syncok(WINDOW *, bool); 1055 chtype termattrs(void); 1056 attr_t term_attrs(void); 1057 const char *termname(void); 1058 void timeout(int); 1059 int touchline(WINDOW *, int, int); 1060 int touchwin(WINDOW *); 1061 int typeahead(int); 1062 int untouchwin(WINDOW *); 1063 void use_env(bool); 1064 int vidattr(chtype); 1065 int vid_attr(attr_t, short, void *); 1066 int vidputs(chtype, int (*)(int)); 1067 int vid_puts(attr_t, short, void *, int (*)(int)); 1068 int vline(chtype, int); 1069 int vw_printw(WINDOW *, const char *, va_list); 1070 int vwprintw(WINDOW *, const char *, va_list); 1071 int vw_scanw(WINDOW *, const char *, va_list); 1072 int vwscanw(WINDOW *, const char *, va_list); 1073 int waddchnstr(WINDOW *, const chtype *, int); 1074 int waddchstr(WINDOW *, const chtype *); 1075 int waddch(WINDOW *, const chtype); 1076 int waddnstr(WINDOW *, const char *, int); 1077 int waddstr(WINDOW *, const char *); 1078 int wattroff(WINDOW *, chtype); 1079 int wattron(WINDOW *, chtype); 1080 int wattrset(WINDOW *, chtype); 1081 int wattr_get(WINDOW *, attr_t *, short *, void *); 1082 int wattr_off(WINDOW *, attr_t, void *); 1083 int wattr_on(WINDOW *, attr_t, void *); 1084 int wattr_set(WINDOW *, attr_t, short, void *); 1085 void wbkgdset(WINDOW *, chtype); 1086 int wbkgd(WINDOW *, chtype); 1087 int wborder(WINDOW *, chtype, chtype, chtype, chtype, 1088 chtype, chtype, chtype, chtype); 1089 int wchgat(WINDOW *, int, attr_t, short, const void *); 1090 int wclear(WINDOW *); 1091 int wclrtobot(WINDOW *); 1092 int wclrtoeol(WINDOW *); 1093 int wcolor_set(WINDOW *, short, void *); 1094 void wcursyncup(WINDOW *); 1095 int wdelch(WINDOW *); 1096 int wdeleteln(WINDOW *); 1097 int wechochar(WINDOW *, const chtype); 1098 int werase(WINDOW *); 1099 int wgetch(WINDOW *); 1100 int wgetnstr(WINDOW *, char *, int); 1101 int wgetstr(WINDOW *, char *); 1102 int whline(WINDOW *, chtype, int); 1103 int winchnstr(WINDOW *, chtype *, int); 1104 int winchstr(WINDOW *, chtype *); 1105 chtype winch(WINDOW *); 1106 int winnstr(WINDOW *, char *, int); 1107 int winsch(WINDOW *, chtype); 1108 int winsdelln(WINDOW *, int); 1109 int winsertln(WINDOW *); 1110 int winsnstr(WINDOW *, const char *, int); 1111 int winsstr(WINDOW *, const char *); 1112 int winstr(WINDOW *, char *); 1113 int wmove(WINDOW *, int, int); 1114 int wnoutrefresh(WINDOW *); 1115 int wprintw(WINDOW *, const char *, ...); 1116 int wredrawln(WINDOW *, int, int); 1117 int wrefresh(WINDOW *); 1118 int wscanw(WINDOW *, const char *, ...); 1119 int wscrl(WINDOW *, int); 1120 int wsetscrreg(WINDOW *, int, int); 1121 int wstandend(WINDOW *); 1122 int wstandout(WINDOW *); 1123 void wsyncdown(WINDOW *); 1124 void wsyncup(WINDOW *); 1125 void wtimeout(WINDOW *, int); 1126 int wtouchln(WINDOW *, int, int, int); 1127 int wvline(WINDOW *, chtype, int); 1128 1129 /* Wide-character functions */ 1130 1131 #ifdef PDC_WIDE 1132 int addnwstr(const wchar_t *, int); 1133 int addwstr(const wchar_t *); 1134 int add_wch(const cchar_t *); 1135 int add_wchnstr(const cchar_t *, int); 1136 int add_wchstr(const cchar_t *); 1137 int border_set(const cchar_t *, const cchar_t *, const cchar_t *, 1138 const cchar_t *, const cchar_t *, const cchar_t *, 1139 const cchar_t *, const cchar_t *); 1140 int box_set(WINDOW *, const cchar_t *, const cchar_t *); 1141 int echo_wchar(const cchar_t *); 1142 int erasewchar(wchar_t *); 1143 int getbkgrnd(cchar_t *); 1144 int getcchar(const cchar_t *, wchar_t *, attr_t *, short *, void *); 1145 int getn_wstr(wint_t *, int); 1146 int get_wch(wint_t *); 1147 int get_wstr(wint_t *); 1148 int hline_set(const cchar_t *, int); 1149 int innwstr(wchar_t *, int); 1150 int ins_nwstr(const wchar_t *, int); 1151 int ins_wch(const cchar_t *); 1152 int ins_wstr(const wchar_t *); 1153 int inwstr(wchar_t *); 1154 int in_wch(cchar_t *); 1155 int in_wchnstr(cchar_t *, int); 1156 int in_wchstr(cchar_t *); 1157 char *key_name(wchar_t); 1158 int killwchar(wchar_t *); 1159 int mvaddnwstr(int, int, const wchar_t *, int); 1160 int mvaddwstr(int, int, const wchar_t *); 1161 int mvadd_wch(int, int, const cchar_t *); 1162 int mvadd_wchnstr(int, int, const cchar_t *, int); 1163 int mvadd_wchstr(int, int, const cchar_t *); 1164 int mvgetn_wstr(int, int, wint_t *, int); 1165 int mvget_wch(int, int, wint_t *); 1166 int mvget_wstr(int, int, wint_t *); 1167 int mvhline_set(int, int, const cchar_t *, int); 1168 int mvinnwstr(int, int, wchar_t *, int); 1169 int mvins_nwstr(int, int, const wchar_t *, int); 1170 int mvins_wch(int, int, const cchar_t *); 1171 int mvins_wstr(int, int, const wchar_t *); 1172 int mvinwstr(int, int, wchar_t *); 1173 int mvin_wch(int, int, cchar_t *); 1174 int mvin_wchnstr(int, int, cchar_t *, int); 1175 int mvin_wchstr(int, int, cchar_t *); 1176 int mvvline_set(int, int, const cchar_t *, int); 1177 int mvwaddnwstr(WINDOW *, int, int, const wchar_t *, int); 1178 int mvwaddwstr(WINDOW *, int, int, const wchar_t *); 1179 int mvwadd_wch(WINDOW *, int, int, const cchar_t *); 1180 int mvwadd_wchnstr(WINDOW *, int, int, const cchar_t *, int); 1181 int mvwadd_wchstr(WINDOW *, int, int, const cchar_t *); 1182 int mvwgetn_wstr(WINDOW *, int, int, wint_t *, int); 1183 int mvwget_wch(WINDOW *, int, int, wint_t *); 1184 int mvwget_wstr(WINDOW *, int, int, wint_t *); 1185 int mvwhline_set(WINDOW *, int, int, const cchar_t *, int); 1186 int mvwinnwstr(WINDOW *, int, int, wchar_t *, int); 1187 int mvwins_nwstr(WINDOW *, int, int, const wchar_t *, int); 1188 int mvwins_wch(WINDOW *, int, int, const cchar_t *); 1189 int mvwins_wstr(WINDOW *, int, int, const wchar_t *); 1190 int mvwin_wch(WINDOW *, int, int, cchar_t *); 1191 int mvwin_wchnstr(WINDOW *, int, int, cchar_t *, int); 1192 int mvwin_wchstr(WINDOW *, int, int, cchar_t *); 1193 int mvwinwstr(WINDOW *, int, int, wchar_t *); 1194 int mvwvline_set(WINDOW *, int, int, const cchar_t *, int); 1195 int pecho_wchar(WINDOW *, const cchar_t*); 1196 int setcchar(cchar_t*, const wchar_t*, const attr_t, short, const void*); 1197 int slk_wset(int, const wchar_t *, int); 1198 int unget_wch(const wchar_t); 1199 int vline_set(const cchar_t *, int); 1200 int waddnwstr(WINDOW *, const wchar_t *, int); 1201 int waddwstr(WINDOW *, const wchar_t *); 1202 int wadd_wch(WINDOW *, const cchar_t *); 1203 int wadd_wchnstr(WINDOW *, const cchar_t *, int); 1204 int wadd_wchstr(WINDOW *, const cchar_t *); 1205 int wbkgrnd(WINDOW *, const cchar_t *); 1206 void wbkgrndset(WINDOW *, const cchar_t *); 1207 int wborder_set(WINDOW *, const cchar_t *, const cchar_t *, 1208 const cchar_t *, const cchar_t *, const cchar_t *, 1209 const cchar_t *, const cchar_t *, const cchar_t *); 1210 int wecho_wchar(WINDOW *, const cchar_t *); 1211 int wgetbkgrnd(WINDOW *, cchar_t *); 1212 int wgetn_wstr(WINDOW *, wint_t *, int); 1213 int wget_wch(WINDOW *, wint_t *); 1214 int wget_wstr(WINDOW *, wint_t *); 1215 int whline_set(WINDOW *, const cchar_t *, int); 1216 int winnwstr(WINDOW *, wchar_t *, int); 1217 int wins_nwstr(WINDOW *, const wchar_t *, int); 1218 int wins_wch(WINDOW *, const cchar_t *); 1219 int wins_wstr(WINDOW *, const wchar_t *); 1220 int winwstr(WINDOW *, wchar_t *); 1221 int win_wch(WINDOW *, cchar_t *); 1222 int win_wchnstr(WINDOW *, cchar_t *, int); 1223 int win_wchstr(WINDOW *, cchar_t *); 1224 wchar_t *wunctrl(cchar_t *); 1225 int wvline_set(WINDOW *, const cchar_t *, int); 1226 #endif 1227 1228 /* Quasi-standard */ 1229 1230 chtype getattrs(WINDOW *); 1231 int getbegx(WINDOW *); 1232 int getbegy(WINDOW *); 1233 int getmaxx(WINDOW *); 1234 int getmaxy(WINDOW *); 1235 int getparx(WINDOW *); 1236 int getpary(WINDOW *); 1237 int getcurx(WINDOW *); 1238 int getcury(WINDOW *); 1239 void traceoff(void); 1240 void traceon(void); 1241 char *unctrl(chtype); 1242 1243 int crmode(void); 1244 int nocrmode(void); 1245 int draino(int); 1246 int resetterm(void); 1247 int fixterm(void); 1248 int saveterm(void); 1249 int setsyx(int, int); 1250 1251 int mouse_set(unsigned long); 1252 int mouse_on(unsigned long); 1253 int mouse_off(unsigned long); 1254 int request_mouse_pos(void); 1255 int map_button(unsigned long); 1256 void wmouse_position(WINDOW *, int *, int *); 1257 unsigned long getmouse(void); 1258 unsigned long getbmap(void); 1259 1260 /* ncurses */ 1261 1262 int assume_default_colors(int, int); 1263 const char *curses_version(void); 1264 bool has_key(int); 1265 int use_default_colors(void); 1266 int wresize(WINDOW *, int, int); 1267 1268 int mouseinterval(int); 1269 mmask_t mousemask(mmask_t, mmask_t *); 1270 bool mouse_trafo(int *, int *, bool); 1271 int nc_getmouse(MEVENT *); 1272 int ungetmouse(MEVENT *); 1273 bool wenclose(const WINDOW *, int, int); 1274 bool wmouse_trafo(const WINDOW *, int *, int *, bool); 1275 1276 /* PDCurses */ 1277 1278 int addrawch(chtype); 1279 int insrawch(chtype); 1280 bool is_termresized(void); 1281 int mvaddrawch(int, int, chtype); 1282 int mvdeleteln(int, int); 1283 int mvinsertln(int, int); 1284 int mvinsrawch(int, int, chtype); 1285 int mvwaddrawch(WINDOW *, int, int, chtype); 1286 int mvwdeleteln(WINDOW *, int, int); 1287 int mvwinsertln(WINDOW *, int, int); 1288 int mvwinsrawch(WINDOW *, int, int, chtype); 1289 int raw_output(bool); 1290 int resize_term(int, int); 1291 WINDOW *resize_window(WINDOW *, int, int); 1292 int waddrawch(WINDOW *, chtype); 1293 int winsrawch(WINDOW *, chtype); 1294 char wordchar(void); 1295 1296 #ifdef PDC_WIDE 1297 wchar_t *slk_wlabel(int); 1298 #endif 1299 1300 void PDC_debug(const char *, ...); 1301 int PDC_ungetch(int); 1302 int PDC_set_blink(bool); 1303 int PDC_set_line_color(short); 1304 void PDC_set_title(const char *); 1305 1306 int PDC_clearclipboard(void); 1307 int PDC_freeclipboard(char *); 1308 int PDC_getclipboard(char **, long *); 1309 int PDC_setclipboard(const char *, long); 1310 1311 unsigned long PDC_get_input_fd(void); 1312 unsigned long PDC_get_key_modifiers(void); 1313 int PDC_return_key_modifiers(bool); 1314 int PDC_save_key_modifiers(bool); 1315 1316 #ifdef XCURSES 1317 WINDOW *Xinitscr(int, char **); 1318 void XCursesExit(void); 1319 int sb_init(void); 1320 int sb_set_horz(int, int, int); 1321 int sb_set_vert(int, int, int); 1322 int sb_get_horz(int *, int *, int *); 1323 int sb_get_vert(int *, int *, int *); 1324 int sb_refresh(void); 1325 #endif 1326 1327 /*** Functions defined as macros ***/ 1328 1329 /* getch() and ungetch() conflict with some DOS libraries */ 1330 1331 #define getch() wgetch(stdscr) 1332 #define ungetch(ch) PDC_ungetch(ch) 1333 1334 #define COLOR_PAIR(n) (((chtype)(n) << PDC_COLOR_SHIFT) & A_COLOR) 1335 #define PAIR_NUMBER(n) (((n) & A_COLOR) >> PDC_COLOR_SHIFT) 1336 1337 /* These will _only_ work as macros */ 1338 1339 #define getbegyx(w, y, x) (y = getbegy(w), x = getbegx(w)) 1340 #define getmaxyx(w, y, x) (y = getmaxy(w), x = getmaxx(w)) 1341 #define getparyx(w, y, x) (y = getpary(w), x = getparx(w)) 1342 #define getyx(w, y, x) (y = getcury(w), x = getcurx(w)) 1343 1344 #define getsyx(y, x) { if (curscr->_leaveit) (y)=(x)=-1; \ 1345 else getyx(curscr,(y),(x)); } 1346 1347 #ifdef NCURSES_MOUSE_VERSION 1348 # define getmouse(x) nc_getmouse(x) 1349 #endif 1350 1351 /* return codes from PDC_getclipboard() and PDC_setclipboard() calls */ 1352 1353 #define PDC_CLIP_SUCCESS 0 1354 #define PDC_CLIP_ACCESS_ERROR 1 1355 #define PDC_CLIP_EMPTY 2 1356 #define PDC_CLIP_MEMORY_ERROR 3 1357 1358 /* PDCurses key modifier masks */ 1359 1360 #define PDC_KEY_MODIFIER_SHIFT 1 1361 #define PDC_KEY_MODIFIER_CONTROL 2 1362 #define PDC_KEY_MODIFIER_ALT 4 1363 #define PDC_KEY_MODIFIER_NUMLOCK 8 1364 1365 #if defined(__cplusplus) || defined(__cplusplus__) || defined(__CPLUSPLUS) 1366 # undef bool 1367 } 1368 #endif 1369 1370 /* Local functions not defined in normal curses */ 1371 1372 void curses_enable_vga(int); 1373 void curses_enable_serial(int); 1374 1375 int curses_vga_enabled(void); 1376 int curses_serial_enabled(void); 1377 1378 #endif /* __PDCURSES__ */ 1379