1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776
|
"<summary>Curses window structure</summary>
<prose>This data type represents a Curses window.</prose>"
abstract data Window = Window(Ptr ptr);
"<summary>Curses screen structure</summary>
<prose>This data type represents a Curses screen, and is not currently used.</prose>"
abstract data Screen = Screen(Ptr ptr);
"<summary>Text attributes</summary>
<prose>This data type represents various text attributes. Not all terminals support all attributes, or support attributes in the same way, though <code>Bold</code>, <code>Reverse</code> and <code>ColourPair</code> are generally well-supported.</prose>"
public data Attr
= Normal | Standout | Underline | Reverse
| Blink | Dim | Bold | Protect | Invis | AltCharset | CharText
| ColourPair(Int n);
foreign "curses_glue.o" {
Ptr getstdscr() = getstdscr;
Void cbreak() = docbreak;
Void nocbreak() = donocbreak;
Void echo() = doecho;
Void noecho() = donoecho;
Void nl() = donl;
Void nonl() = dononl;
Void raw() = doraw;
Void noraw() = donoraw;
Void dointrflush(Ptr ptr,Bool bf) = dointrflush;
Void dokeypad(Ptr ptr,Bool bf) = dokeypad;
Void dometa(Ptr ptr,Bool bf) = dometa;
Void donodelay(Ptr ptr, Bool bf) = donodelay;
Void donotimeout(Ptr ptr, Bool bf) = donotimeout;
"<argument name='tenths'>Time to wait for input, in tenths of a second (must be between 1 and 255)</argument>
<summary>Enable half-delay mode</summary>
<prose>Enable half-delay mode. Half-delay mode is similar to cbreak mode, but if no key is pressed within the specified delay, then the input function will fail with an error.</prose>
<related><functionref>cbreakMode</functionref></related>"
public Void halfDelay(Int tenths) = halfdelay;
Ptr doinitscr() = doinitscr;
Ptr doendwin() = endwin;
"<summary>Check for end of windowing mode</summary>
<prose>Return true if <functionref>endWin</functionref> has been called, with no subsequent call to <functionref>wRefresh</functionref>, and false otherwise (i.e. if the terminal is currently in Curses mode).</prose>"
public Bool isEndWin() = isendwin;
Bool dotesterr(Ptr x) = testerr;
"<summary>Refresh the screen</summary>
<prose>Refresh the screen, painting any updates since the last refresh. This is equivalent to <code>wRefresh(stdscr);</code>.</prose>
<related><functionref>stdscr</functionref></related>
<related><functionref>wRefresh</functionref></related>"
public Void refresh() = dorefresh;
Void dowrefresh(Ptr win) = dowrefresh;
"<summary>Get a character</summary>
<prose>Get the next input character. If the screen has been modified, then <functionref>refresh</functionref> will automatically be called first.</prose>
<related><functionref>getStr</functionref></related>
<related><functionref>mvgetChar</functionref></related>
<related><functionref>wmvgetChar</functionref></related>
<related><functionref>refresh</functionref></related>
<related><functionref>ungetChar</functionref></related>
<related><functionref>wgetChar</functionref></related>"
public Char getChar() = dogetch;
Char dowgetch(Ptr w) = dowgetch;
"<argument name='y'>New row position of cursor</argument>
<argument name='x'>New column position of cursor</argument>
<summary>Move and get a character</summary>
<prose>Move the cursor to the given co-ordinates, and get the next input character.</prose>
<related><functionref>getChar</functionref></related>
<related><functionref>wmvgetChar</functionref></related>
<related><functionref>ungetChar</functionref></related>
<related><functionref>wgetChar</functionref></related>"
public Char mvgetChar(Int y, Int x) = domvgetch;
Char dowmvgetch(Ptr w,Int y, Int x) = dowmvgetch;
"<argument name='c'>The character to unget</argument>
<summary>Unget a character</summary>
<prose>Unget a character. This character will then be the next character returned by a call to <functionref>getChar</functionref>.</prose>
<related><functionref>getChar</functionref></related>
<related><functionref>mvgetChar</functionref></related>
<related><functionref>wmvgetChar</functionref></related>
<related><functionref>wgetChar</functionref></related>"
public Void ungetChar(Char c) = ungetch;
"<summary>Get an input string up to newline</summary>
<prose>Get an input string up to newline, or a maximum length of 255 characters.</prose>
<related><functionref>getChar</functionref></related>
<related><functionref>wgetStr</functionref></related>"
public String getStr() = dogetstr;
String dowgetstr(Ptr w) = dowgetstr;
"<argument name='y'>New row position</argument>
<argument name='x'>New column position</argument>
<summary>Move the cursor</summary>
<prose>Move the cursor to the new position.</prose>
<related><functionref>mvgetChar</functionref></related>
<related><functionref>wMove</functionref></related>"
public Void move(Int y, Int x) = domove;
Void dowmove(Ptr w, Int y, Int x) = dowmove;
"<argument name='str'>The string to print</argument>
<summary>Print a string</summary>
<prose>Print a string at the current cursor position.</prose>
<related><functionref>waddStr</functionref></related>"
public Void addStr(String s) = doaddstr;
Void dowaddstr(Ptr w, String s) = dowaddstr;
Ptr doattron([Attr] attribs) = doattron;
Ptr doattroff([Attr] attribs) = doattroff;
Ptr dowattron(Ptr w, [Attr] attribs) = dowattron;
Ptr dowattroff(Ptr w, [Attr] attribs) = dowattroff;
"<summary>Enable colours</summary>
<prose>Enable colours (has no effect if the terminal does not support colour)</prose>
<related><functionref>hasColours</functionref></related>"
public Void startColour() = start_color;
"<summary>Check for support for colours</summary>
<prose>Returns true if the current terminal has colour support, false otherwise.</prose>
<related><functionref>startColour</functionref></related>"
public Bool hasColours() = has_colors;
Ptr doinit_colour(Int col, Int r, Int g, Int b) = init_color;
Ptr doinit_pair(Int pair, Int f, Int b) = init_pair;
"<summary>Black colour</summary>
<prose>Return the Int corresponding to the colour black.</prose>
<related><functionref>Blue</functionref></related>
<related><functionref>ColourPairs</functionref></related>
<related><functionref>Colours</functionref></related>
<related><functionref>Cyan</functionref></related>
<related><functionref>Green</functionref></related>
<related><functionref>initPair</functionref></related>
<related><functionref>initColour</functionref></related>
<related><functionref>Magenta</functionref></related>
<related><functionref>Red</functionref></related>
<related><functionref>White</functionref></related>
<related><functionref>Yellow</functionref></related>"
public Int Black() = getBlack;
"<summary>Red colour</summary>
<prose>Return the Int corresponding to the colour red.</prose>
<related><functionref>Black</functionref></related>
<related><functionref>Blue</functionref></related>
<related><functionref>ColourPairs</functionref></related>
<related><functionref>Colours</functionref></related>
<related><functionref>Cyan</functionref></related>
<related><functionref>Green</functionref></related>
<related><functionref>initPair</functionref></related>
<related><functionref>initColour</functionref></related>
<related><functionref>Magenta</functionref></related>
<related><functionref>White</functionref></related>
<related><functionref>Yellow</functionref></related>"
public Int Red() = getRed;
"<summary>Green colour</summary>
<prose>Return the Int corresponding to the colour green.</prose>
<related><functionref>Black</functionref></related>
<related><functionref>Blue</functionref></related>
<related><functionref>ColourPairs</functionref></related>
<related><functionref>Colours</functionref></related>
<related><functionref>Cyan</functionref></related>
<related><functionref>initPair</functionref></related>
<related><functionref>initColour</functionref></related>
<related><functionref>Magenta</functionref></related>
<related><functionref>Red</functionref></related>
<related><functionref>White</functionref></related>
<related><functionref>Yellow</functionref></related>"
public Int Green() = getGreen;
"<summary>Yellow colour</summary>
<prose>Return the Int corresponding to the colour yellow.</prose>
<related><functionref>Black</functionref></related>
<related><functionref>Blue</functionref></related>
<related><functionref>ColourPairs</functionref></related>
<related><functionref>Colours</functionref></related>
<related><functionref>Cyan</functionref></related>
<related><functionref>Green</functionref></related>
<related><functionref>initPair</functionref></related>
<related><functionref>initColour</functionref></related>
<related><functionref>Magenta</functionref></related>
<related><functionref>Red</functionref></related>
<related><functionref>White</functionref></related>"
public Int Yellow() = getYellow;
"<summary>Blue colour</summary>
<prose>Return the Int corresponding to the colour blue.</prose>
<related><functionref>Black</functionref></related>
<related><functionref>ColourPairs</functionref></related>
<related><functionref>Colours</functionref></related>
<related><functionref>Cyan</functionref></related>
<related><functionref>Green</functionref></related>
<related><functionref>initPair</functionref></related>
<related><functionref>initColour</functionref></related>
<related><functionref>Magenta</functionref></related>
<related><functionref>Red</functionref></related>
<related><functionref>White</functionref></related>
<related><functionref>Yellow</functionref></related>"
public Int Blue() = getBlue;
"<summary>Magenta colour</summary>
<prose>Return the Int corresponding to the colour magenta.</prose>
<related><functionref>Black</functionref></related>
<related><functionref>Blue</functionref></related>
<related><functionref>ColourPairs</functionref></related>
<related><functionref>Colours</functionref></related>
<related><functionref>Cyan</functionref></related>
<related><functionref>Green</functionref></related>
<related><functionref>initPair</functionref></related>
<related><functionref>initColour</functionref></related>
<related><functionref>Red</functionref></related>
<related><functionref>White</functionref></related>
<related><functionref>Yellow</functionref></related>"
public Int Magenta() = getMagenta;
"<summary>Cyan colour</summary>
<prose>Return the Int corresponding to the colour cyan.</prose>
<related><functionref>Black</functionref></related>
<related><functionref>Blue</functionref></related>
<related><functionref>ColourPairs</functionref></related>
<related><functionref>Colours</functionref></related>
<related><functionref>Cyan</functionref></related>
<related><functionref>Green</functionref></related>
<related><functionref>initPair</functionref></related>
<related><functionref>initColour</functionref></related>
<related><functionref>Magenta</functionref></related>
<related><functionref>Red</functionref></related>
<related><functionref>White</functionref></related>
<related><functionref>Yellow</functionref></related>"
public Int Cyan() = getCyan;
"<summary>White colour</summary>
<prose>Return the Int corresponding to the colour white.</prose>
<related><functionref>Black</functionref></related>
<related><functionref>Blue</functionref></related>
<related><functionref>ColourPairs</functionref></related>
<related><functionref>Colours</functionref></related>
<related><functionref>Cyan</functionref></related>
<related><functionref>Green</functionref></related>
<related><functionref>initPair</functionref></related>
<related><functionref>initColour</functionref></related>
<related><functionref>Magenta</functionref></related>
<related><functionref>Red</functionref></related>
<related><functionref>Yellow</functionref></related>"
public Int White() = getWhite;
"<summary>Number of supported colour pairs</summary>
<prose>Return the maximum number of colour pairs supported by the terminal</prose>
<related><functionref>initPair</functionref></related>"
public Int ColourPairs() = getColourPairs;
"<summary>Number of supported colours</summary>
<prose>Return the maximum number of distinct colours supported by the terminal</prose>
<related><functionref>initColour</functionref></related>"
public Int Colours() = getColours;
Ptr donewwin(Int lines,Int cols, Int beginy, Int beginx) = donewwin;
Ptr dodelwin(Ptr w) = dodelwin;
Ptr domvwin(Ptr w, Int y, Int x) = domvwin;
Ptr docurs_set(Int x) = docurs_set;
"<summary>Down arrow key</summary>
<prose>Return the Char constant corresponding to the down arrow key</prose>
<related><functionref>getch</functionref></related>"
public Char KeyDown() = key_DOWN;
"<summary>Up arrow key</summary>
<prose>Return the Char constant corresponding to the up arrow key</prose>
<related><functionref>getch</functionref></related>"
public Char KeyUp() = key_UP;
"<summary>Left arrow key</summary>
<prose>Return the Char constant corresponding to the left arrow key</prose>
<related><functionref>getch</functionref></related>"
public Char KeyLeft() = key_LEFT;
"<summary>Right arrow key</summary>
<prose>Return the Char constant corresponding to the right arrow key</prose>
<related><functionref>getch</functionref></related>"
public Char KeyRight() = key_RIGHT;
"<summary>Home key</summary>
<prose>Return the Char constant corresponding to the home key. On some keyboards this may also correspond to Numpad 7</prose>
<related><functionref>getch</functionref></related>"
public Char KeyHome() = key_HOME;
"<summary>End key</summary>
<prose>Return the Char constant corresponding to the end key. On some keyboards this may also correspond to Numpad 1</prose>
<related><functionref>getch</functionref></related>"
public Char KeyEnd() = key_END;
"<summary>Page up key</summary>
<prose>Return the Char constant corresponding to the previous page (page up) key. On some keyboards this may also correspond to Numpad 9</prose>
<related><functionref>getch</functionref></related>"
public Char KeyPPage() = key_PPAGE;
"<summary>Page down key</summary>
<prose>Return the Char constant corresponding to the next page (page down) key. On some keyboards this may also correspond to Numpad 3</prose>
<related><functionref>getch</functionref></related>"
public Char KeyNPage() = key_NPAGE;
"<summary>Backspace key</summary>
<prose>Return the Char constant corresponding to the backspace key.</prose>
<related><functionref>getch</functionref></related>"
public Char KeyBackspace() = key_BACKSPACE;
"<summary>A1 key</summary>
<prose>Return the Char constant corresponding to the A1 key (the top-left keypad key)</prose>
<related><functionref>getch</functionref></related>"
public Char KeyA1() = key_A1;
"<summary>A3 key</summary>
<prose>Return the Char constant corresponding to the A3 key (the top-right keypad key)</prose>
<related><functionref>getch</functionref></related>"
public Char KeyA3() = key_A3;
"<summary>B2 key</summary>
<prose>Return the Char constant corresponding to the B2 key (the centre keypad key)</prose>
<related><functionref>getch</functionref></related>"
public Char KeyB2() = key_B2;
"<summary>C1 key</summary>
<prose>Return the Char constant corresponding to the C1 key (the bottom-left keypad key)</prose>
<related><functionref>getch</functionref></related>"
public Char KeyC1() = key_C1;
"<summary>C3 key</summary>
<prose>Return the Char constant corresponding to the C3 key (the bottom-right keypad key)</prose>
<related><functionref>getch</functionref></related>"
public Char KeyC3() = key_C3;
"<summary>Function key 1</summary>
<prose>Return the Char constant corresponding to the first function key (F1)</prose>
<related><functionref>getch</functionref></related>"
public Char KeyF1() = key_F1;
"<summary>Function key 2</summary>
<prose>Return the Char constant corresponding to the second function key (F2)</prose>
<related><functionref>getch</functionref></related>"
public Char KeyF2() = key_F2;
"<summary>Function key 3</summary>
<prose>Return the Char constant corresponding to the third function key (F3)</prose>
<related><functionref>getch</functionref></related>"
public Char KeyF3() = key_F3;
"<summary>Function key 4</summary>
<prose>Return the Char constant corresponding to the fourth function key (F4)</prose>
<related><functionref>getch</functionref></related>"
public Char KeyF4() = key_F4;
"<summary>Function key 5</summary>
<prose>Return the Char constant corresponding to the fifth function key (F5)</prose>
<related><functionref>getch</functionref></related>"
public Char KeyF5() = key_F5;
"<summary>Function key 6</summary>
<prose>Return the Char constant corresponding to the sixth function key (F6)</prose>
<related><functionref>getch</functionref></related>"
public Char KeyF6() = key_F6;
"<summary>Function key 7</summary>
<prose>Return the Char constant corresponding to the seventh function key (F7)</prose>
<related><functionref>getch</functionref></related>"
public Char KeyF7() = key_F7;
"<summary>Function key 8</summary>
<prose>Return the Char constant corresponding to the eighth function key (F8)</prose>
<related><functionref>getch</functionref></related>"
public Char KeyF8() = key_F8;
"<summary>Function key 9</summary>
<prose>Return the Char constant corresponding to the ninth function key (F9)</prose>
<related><functionref>getch</functionref></related>"
public Char KeyF9() = key_F9;
"<summary>Function key 10</summary>
<prose>Return the Char constant corresponding to the tenth function key (F10)</prose>
<related><functionref>getch</functionref></related>"
public Char KeyF10() = key_F10;
"<summary>Function key 11</summary>
<prose>Return the Char constant corresponding to the eleventh function key (F11)</prose>
<related><functionref>getch</functionref></related>"
public Char KeyF11() = key_F11;
"<summary>Function key 12</summary>
<prose>Return the Char constant corresponding to the twelth function key (F12)</prose>
<related><functionref>getch</functionref></related>"
public Char KeyF12() = key_F12;
Ptr dobox(Ptr w, Char v, Char h) = dobox;
"<summary>Beep to alert the user</summary>
<prose>Beep to alert the user if possible, otherwise <functionref>flash</functionref>, otherwise do nothing.</prose>"
public Void beep() = beep;
"<summary>Flash the screen to alert the user</summary>
<prose>Flash the screen to alert the user if possible, otherwise <functionref>beep</functionref>, otherwise do nothing.</prose>"
public Void flash() = flash;
Void doclear() = doclear;
Void doerase() = doerase;
Void doclrtobot() = doclrtobot;
Void doclrtoeol() = doclrtoeol;
Void dowclear(Ptr p) = dowclear;
Void dowerase(Ptr p) = dowerase;
Void dowclrtobot(Ptr p) = dowclrtobot;
Void dowclrtoeol(Ptr p) = dowclrtoeol;
}
"<argument name='enable'>True to enable, false to disable</argument>
<summary>Enable or disable cbreak mode</summary>
<prose>Enable or disable cbreak mode (character-at-a-time input). Most interactive Curses programs should enable this.</prose>
<related><functionref>rawMode</functionref></related>"
public Void cbreakMode(Bool enable) {
if (enable) {
cbreak();
} else {
nocbreak();
}
}
"<argument name='enable'>True to enable, false to disable</argument>
<summary>Enable or disable echo</summary>
<prose>Enable or disable echoing of typed characters to the screen. Most interactive Curses programs should disable this.</prose>"
public Void echoMode(Bool enable) {
if (enable) {
echo();
} else {
noecho();
}
}
"<argument name='enable'>True to enable, false to disable</argument>
<summary>Enable or disable return key to newline translation</summary>
<prose>Enable or disable return key to newline translation. Disabling this allows the return key to be detected as a separate key, and may be slightly more efficient, but possibly less convenient.</prose>"
public Void newlineMode(Bool enable) {
if (enable) {
nl();
} else {
nonl();
}
}
"<argument name='enable'>True to enable, false to disable</argument>
<summary>Enable or disable raw mode</summary>
<prose>Raw mode is similar to cbreak mode, but when enabled interrupt, quit, suspend and flow control characters are passed straight through to the program rather than generating signals.</prose>
<related><functionref>cbreakMode</functionref></related>"
public Void rawMode(Bool enable) {
if (enable) {
raw();
} else {
noraw();
}
}
"<summary>Curses Error</summary>
<prose>This Exception is thrown when an error occurs in Curses functions.</prose>"
Exception CursesError();
"<summary>Can't create Window</summary>
<prose>This Exception is thrown when <functionref>newwin</functionref> cannot create a new window.</prose>"
Exception CantCreateWindow();
"<summary>Return the standard screen</summary>
<prose>This function returns the <dataref>Window</dataref> object corresponding to the standard screen.</prose>"
public Window stdscr = Window(getstdscr());
"<argument name='win'>The window to apply to (in ncurses, this argument is ignored: use <functionref>stdscr</functionref>)</argument>
<argument name='bf'>Whether interrupt flushing should be enabled.</argument>
<summary>Enable or disable interrupt flushing</summary>
<prose>Enable or disable interrupt flushing. If this is enabled, then all output in the terminal driver will be flushed when an interrupt (e.g. break) is received, giving an apparent faster response, but causing the curses library to not know what is currently on-screen.</prose>"
public Void intrFlush(Window win, Bool bf) {
dointrflush(win.ptr,bf);
}
"<argument name='win'>The window to apply to</argument>
<argument name='bf'>Whether to enable the keypad</argument>
<summary>Enable or disable the keypad</summary>
<prose>Enable or disable the keypad. If the keypad is enabled, then curses will translate keypad keys to their character constants (e.g. <functionref>KeyA3</functionref>). Otherwise, the raw escape sequences will be returned. This function does nothing on Windows</prose>"
public Void keypad(Window win, Bool bf) {
dokeypad(win.ptr,bf);
}
"<argument name='win'>The window to apply to</argument>
<argument name='bf'>Whether to enable 8 bit input</argument>
<summary>Enable or disable 8 bit input</summary>
<prose>Enable or disable 8 bit input.</prose>"
public Void meta(Window win, Bool bf) {
dometa(win.ptr,bf);
}
"<argument name='win'>The window to apply to</argument>
<argument name='bf'>Whether <functionref>wgetch</functionref> will wait for input.</argument>
<summary>Enable non-blocking input</summary>
<prose>Enable or disable non-blocking input. If this is enabled and no input is waiting, then <functionref>getch</functionref> will return <code>ERR</code> (probably -1). If it is disabled, then <code>getch</code> will wait for input. This function does nothing on Windows</prose>
<related><functionref>halfDelay</functionref></related>"
public Void noDelay(Window win, Bool bf) {
donodelay(win.ptr,bf);
}
"<argument name='win'>The window to apply to</argument>
<argument name='bf'>Whether to disable timeouts on escape sequences</argument>
<summary>Disable escape sequence timeout</summary>
<prose>If escape sequence timeouts are enabled, then curses will timeout and return the raw characters if a partial escape sequence has too much delay before the next character. This is usually useful, but may be inconvenient where users are manually entering escape sequences.</prose>"
public Void noTimeout(Window win, Bool bf) {
donotimeout(win.ptr,bf);
}
/// Screen initialisation and manipulation
Void testerr(Ptr x) {
// putStrLn("testing "+x);
if (dotesterr(x)) {
throw(CursesError());
}
}
"<summary>Initialise curses</summary>
<prose>Initialise the curses library. This must be called before any other function is called.</prose>
<related><functionref>endWin</functionref></related>"
public Void initScreen {
testerr(doinitscr());
}
"<summary>End curses windowing</summary>
<prose>End curses windowing. This should always be called before the program exits, regardless of the cause of the exit.</prose>
<prose>Note that the Curses library changes the buffering of standard
output, and so functions such as
<functionref>Prelude::putStr</functionref> will not always work as
expected. If you need to output further text after Curses windowing is
ended but before the program finishes, and it is important that this
text is immediately visible, then use <functionref>IO::flush</functionref>
on stdout</prose>
<related><functionref>initscr</functionref></related>"
public Void endWin { testerr(doendwin()); }
"<argument name='w'>The window to refresh</argument>
<summary>Refresh a window</summary>
<prose>Refresh a window, painting any updates since the last refresh.</prose>
<related><functionref>refresh</functionref></related>"
public Void wRefresh(Window w) { dowrefresh(w.ptr); }
/// Get characters
"<argument name='w'>The window to get from</argument>
<summary>Get a character in a window</summary>
<prose>Get a character from a particular window (and so refresh only that window instead of the whole screen).</prose>
<related><functionref>getChar</functionref></related>
<related><functionref>mvgetChar</functionref></related>
<related><functionref>ungetChar</functionref></related>
<related><functionref>wmvgetChar</functionref></related>"
public Char wgetChar(Window w) = dowgetch(w.ptr);
"<argument name='w'>The window to get from</argument>
<argument name='y'>The new row position</argument>
<argument name='x'>The new column position</argument>
<summary>Move and get a character in a window</summary>
<prose>Move the cursor to the new position and get a character from a particular window (and so refresh only that window instead of the whole screen).</prose>
<related><functionref>getChar</functionref></related>
<related><functionref>mvgetChar</functionref></related>
<related><functionref>ungetChar</functionref></related>
<related><functionref>wgetChar</functionref></related>"
public Char wmvgetChar(Window w,Int y, Int x) = dowmvgetch(w.ptr,y,x);
"<argument name='w'>The window to get from</argument>
<summary>Get an input string up to newline from a window</summary>
<prose>Get an input string up to newline, or a maximum length of 255 characters.</prose>
<related><functionref>getStr</functionref></related>
<related><functionref>wgetChar</functionref></related>"
public String wgetStr(Window w) = dowgetstr(w.ptr);
/// Move
"<argument name='w'>The window to move in</argument>
<argument name='y'>New row position (relative to the top-left corner of the window)</argument>
<argument name='x'>New column position (relative to the top-left corner of the window)</argument>
<summary>Move the cursor within a window</summary>
<prose>Move the cursor to the new position in the window.</prose>
<related><functionref>wmvgetChar</functionref></related>
<related><functionref>move</functionref></related>"
public Void wMove(Window w, Int y, Int x) = dowmove(w.ptr,y,x);
/// Add strings
"<argument name='win'>The window to print within</argument>
<argument name='str'>The string to print</argument>
<summary>Print a string in a window</summary>
<prose>Print a string at the current cursor position in the specified window.</prose>
<related><functionref>addStr</functionref></related>"
public Void waddStr(Window win, String s) {
dowaddstr(win.ptr,s);
}
/// Attributes
"<argument name='attribs'>A list of <dataref>Attr</dataref> to enable or disable</argument>
<argument name='enable'>True to enable, false to disable</argument>
<summary>Enable or disable text attributes</summary>
<prose>Enables or disables the specified text attributes for future <functionref>addStr</functionref> operations.</prose>
<related><functionref>wAttributes</functionref></related>"
public Void attributes([Attr] attribs, Bool enable) {
if (enable) {
testerr(doattron(attribs));
} else {
testerr(doattroff(attribs));
}
}
"<argument name='w'>The window</argument>
<argument name='attribs'>A list of <dataref>Attr</dataref> to enable or disable</argument>
<argument name='enable'>True to enable, false to disable</argument>
<summary>Enable or disable text attributes in a window</summary>
<prose>Enables or disables the specified text attributes for future <functionref>waddStr</functionref> operations in this window.</prose>
<related><functionref>wAttributes</functionref></related>"
public Void wAttributes(Window w, [Attr] attribs, Bool enable) {
if (enable) {
testerr(dowattron(w.ptr,attribs));
} else {
testerr(dowattroff(w.ptr,attribs));
}
}
"<argument name='col'>The colour number to redefine (0 to <functionref>Colours</functionref>)</argument>
<argument name='r'>The new red channel value (0-1000)</argument>
<argument name='g'>The new green channel value (0-1000)</argument>
<argument name='b'>The new blue channel value (0-1000)</argument>
<summary>Initialise a new colour</summary>
<prose>Initialise a new colour, or change an existing colour, provided that the terminal supports this operation.</prose>
<related><functionref>initPair</functionref></related>"
public Void initColour(Int col, Int r, Int g, Int b) {
testerr(doinit_colour(col,r,g,b));
}
"<argument name='pair'>The pair number to redefine (0 to <functionref>ColourPairs</functionref>)</argument>
<argument name='f'>The foreground colour (either a constant such as <functionref>Blue</functionref> or one defined with <functionref>initColour</functionref>)</argument>
<argument name='b'>The background colour (either a constant such as <functionref>Blue</functionref> or one defined with <functionref>initColour</functionref>)</argument>
<summary>Define a colour pair</summary>
<prose>Define a colour pair. These can then be used as text attributes using the <code>ColourPair</code> constructor of <dataref>Attr</dataref></prose>
<related><functionref>Black</functionref></related>
<related><functionref>Blue</functionref></related>
<related><functionref>ColourPairs</functionref></related>
<related><functionref>Colours</functionref></related>
<related><functionref>Cyan</functionref></related>
<related><functionref>Green</functionref></related>
<related><functionref>initPair</functionref></related>
<related><functionref>initColour</functionref></related>
<related><functionref>Magenta</functionref></related>
<related><functionref>Red</functionref></related>
<related><functionref>White</functionref></related>
<related><functionref>Yellow</functionref></related>"
public Void initPair(Int pair, Int f, Int b) {
testerr(doinit_pair(pair,f,b));
}
// Windows
"<argument name='lines'>Number of lines in window</argument>
<argument name='cols'>Number of columns in window</argument>
<argument name='beginy'>Position of top of window</argument>
<argument name='beginx'>Position of left of window</argument>
<summary>Create a new window</summary>
<prose>Create a new window at the specified position.</prose>
<related><dataref>Window</dataref></related>
<related><functionref>delWin</functionref></related>
<related><functionref>mvWin</functionref></related>"
public Window newWin(Int lines,Int cols, Int beginy, Int beginx)
{
win = donewwin(lines,cols,beginy,beginx);
if (null(win)) {
throw(CantCreateWindow());
}
else
return Window(win);
}
"<argument name='w'>Window to delete</argument>
<summary>Delete a window</summary>
<prose>Delete a window (any current window contents will remain on the screen).</prose>
<related><dataref>Window</dataref></related>
<related><functionref>mvWin</functionref></related>
<related><functionref>newWin</functionref></related>"
public Void delwin(Window w)
{
testerr(dodelwin(w.ptr));
}
"<argument name='w'>Window to move</argument>
<argument name='y'>New position of top edge</argument>
<argument name='x'>New position of left edge</argument>
<summary>Move a window</summary>
<prose>Move a window to the new position. This will fail if it would move the window off the screen.</prose>
<related><dataref>Window</dataref></related>
<related><functionref>delWin</functionref></related>
<related><functionref>newWin</functionref></related>"
public Void mvWin(Window w, Int y, Int x)
{
testerr(domvwin(w.ptr,y,x));
}
// Low level routines
"<summary>Cursor visibility</summary>
<prose>Cursor visibility levels</prose>
<related><functionref>curs_set</functionref></related>"
public data Visibility = Invisible | NormalVisible | VeryVisible;
"<argument name='mode'>New cursor visibility</argument>
<summary>Set cursor visibility</summary>
<prose>Set the new cursor visiblity level. This function always fails and throws an Exception on Windows</prose>
<related><dataref>Visibility</dataref></related>"
public Void setCursor(Visibility mode) {
x = case mode of {
Invisible -> 0;
| NormalVisible -> 1;
| VeryVisible -> 2;
};
testerr(docurs_set(x));
}
// Borders
R"<argument name='w'>The window to draw a box border on</argument>
<argument name='v'>The character to use on the vertical sides (the default, '\0', uses the curses default)</argument>
<argument name='h'>The character to use on the horizontal sides (the default, '\0', uses the curses default)</argument>
<summary>Draw a box border on a window</summary>
<prose>Draw a box border around the edges of the specified window</prose>"
public Void box(Window w, Char v = '\0', Char h = '\0')
{
testerr(dobox(w.ptr,v,h));
}
// Clearing
"<summary>Clear screen</summary>
<prose>Clear the screen, repainting completely on refresh.</prose>
<related><functionref>clearDown</functionref></related>
<related><functionref>clearRight</functionref></related>
<related><functionref>erase</functionref></related>
<related><functionref>wClear</functionref></related>"
public Void clear() { doclear(); }
"<summary>Erase screen</summary>
<prose>Erase the screen by writing blanks to all character positions.</prose>
<related><functionref>clear</functionref></related>
<related><functionref>clearDown</functionref></related>
<related><functionref>clearRight</functionref></related>
<related><functionref>wErase</functionref></related>"
public Void erase() { doerase(); }
"<summary>Clear to bottom of screen</summary>
<prose>Clear all lines below the current cursor, and everything to the right of the cursor on the current line.</prose>
<related><functionref>clear</functionref></related>
<related><functionref>clearRight</functionref></related>
<related><functionref>erase</functionref></related>
<related><functionref>wClearDown</functionref></related>"
public Void clearDown() { doclrtobot(); }
"<summary>Clear to end of line</summary>
<prose>Clear everything to the right of the cursor on the current line.</prose>
<related><functionref>clear</functionref></related>
<related><functionref>clearDown</functionref></related>
<related><functionref>erase</functionref></related>
<related><functionref>wClearRight</functionref></related>"
public Void clearRight() { doclrtoeol(); }
"<argument name='w'>The window to apply to</argument>
<summary>Clear window</summary>
<prose>Clear the window, repainting completely on refresh.</prose>
<related><dataref>Window</dataref></related>
<related><functionref>clear</functionref></related>
<related><functionref>wClearDown</functionref></related>
<related><functionref>wClearRight</functionref></related>
<related><functionref>wErase</functionref></related>"
public Void wClear(Window w) { dowclear(w.ptr); }
"<argument name='w'>The window to apply to</argument>
<summary>Erase window</summary>
<prose>Erase the window by writing blanks to all character positions.</prose>
<related><dataref>Window</dataref></related>
<related><functionref>erase</functionref></related>
<related><functionref>wClear</functionref></related>
<related><functionref>wClearDown</functionref></related>
<related><functionref>wClearRight</functionref></related>"
public Void wErase(Window w) { dowerase(w.ptr); }
"<argument name='w'>The window to apply to</argument>
<summary>Clear to bottom of window</summary>
<prose>Clear all lines below the current cursor within the window, and everything to the right of the cursor on the current line.</prose>
<related><dataref>Window</dataref></related>
<related><functionref>clearDown</functionref></related>
<related><functionref>wClear</functionref></related>
<related><functionref>wClearRight</functionref></related>
<related><functionref>wErase</functionref></related>"
public Void wClearDown(Window w) { dowclrtobot(w.ptr); }
"<argument name='w'>The window to apply to</argument>
<summary>Clear to end of line in a window</summary>
<prose>Clear everything to the right of the cursor in the current window on the current line.</prose>
<related><dataref>Window</dataref></related>
<related><functionref>clearRight</functionref></related>
<related><functionref>wClear</functionref></related>
<related><functionref>wClearDown</functionref></related>
<related><functionref>wErase</functionref></related>"
public Void wClearRight(Window w) { dowclrtoeol(w.ptr); }
|