Module: Curses
- Defined in:
- curses.c
Defined Under Namespace
Modules: Key Classes: MouseEvent, Window
Class Method Summary collapse
-
.addch ⇒ Object
def addch(ch).
-
.addstr ⇒ Object
def addstr(str).
- .attroff(attrs) ⇒ Object
-
.attron(attrs) ⇒ Object
return INT2FIX(attroff(NUM2INT(attrs)));.
-
.attrset(attrs) ⇒ Object
return INT2FIX(attroff(NUM2INT(attrs)));.
-
.beep ⇒ Object
def beep.
- .bkgd(ch) ⇒ Object
-
.bkgdset(ch) ⇒ Object
return INT2FIX(attroff(NUM2INT(attrs)));.
- .can_change_color? ⇒ Boolean
-
.cbreak ⇒ Object
def cbreak.
-
.clear ⇒ Object
def clear.
-
.close_screen ⇒ Object
def close_screen.
-
.closed? ⇒ Boolean
def closed?.
-
.clrtoeol ⇒ Object
def clrtoeol.
- .color_content(color) ⇒ Object
- .color_pair(attrs) ⇒ Object
- .cols ⇒ Object
- .curs_set(visibility) ⇒ Object
- .def_prog_mode ⇒ Object
-
.delch ⇒ Object
def delch.
-
.deleteln ⇒ Object
def delelteln.
-
.doupdate ⇒ Object
def doupdate.
-
.echo ⇒ Object
def echo.
-
.flash ⇒ Object
def flash.
-
.getch ⇒ Object
def getch.
- .getmouse ⇒ Object
-
.getstr ⇒ Object
def getstr.
- .has_colors? ⇒ Boolean
-
.inch ⇒ Object
def inch.
- .init_color(color, r, g, b) ⇒ Object
- .init_pair(pair, f, b) ⇒ Object
-
.init_screen ⇒ Object
def init_screen.
-
.insch ⇒ Object
def insch(ch).
-
.insertln ⇒ Object
def insertln.
-
.keyname ⇒ Object
def keyname.
- .lines ⇒ Object
- .mouseinterval(interval) ⇒ Object
- .mousemask(mask) ⇒ Object
-
.nl ⇒ Object
def nl.
-
.nocbreak ⇒ Object
def nocbreak.
-
.noecho ⇒ Object
def noecho.
-
.nonl ⇒ Object
def nonl.
-
.noraw ⇒ Object
def noraw.
- .pair_content(pair) ⇒ Object
- .pair_number(attrs) ⇒ Object
-
.raw ⇒ Object
def raw.
-
.refresh ⇒ Object
def refresh.
- .reset_prog_mode ⇒ Object
- .resize(lin, col) ⇒ Object
- .resizeterm(lin, col) ⇒ Object
- .scrl(n) ⇒ Object
-
.setpos ⇒ Object
def setpos(y, x).
- .setscrreg(top, bottom) ⇒ Object
-
.standend ⇒ Object
def standend.
-
.standout ⇒ Object
def standout.
- .start_color ⇒ Object
- .stdscr ⇒ Object
- .timeout= ⇒ Object
-
.ungetch ⇒ Object
def ungetch.
- .ungetmouse(mevent) ⇒ Object
Class Method Details
.addch ⇒ Object
def addch(ch)
381 382 383 |
# File 'curses.c', line 381 static VALUE curses_addch(obj, ch) VALUE obj; |
.addstr ⇒ Object
def addstr(str)
403 404 405 |
# File 'curses.c', line 403 static VALUE curses_addstr(obj, str) VALUE obj; |
.attroff(attrs) ⇒ Object
537 538 539 540 541 542 |
# File 'curses.c', line 537
static VALUE
curses_attroff(VALUE obj, VALUE attrs)
{
return window_attroff(rb_stdscr,attrs);
/* return INT2FIX(attroff(NUM2INT(attrs))); */
}
|
.attron(attrs) ⇒ Object
return INT2FIX(attroff(NUM2INT(attrs)));
544 545 546 547 548 549 |
# File 'curses.c', line 544
static VALUE
curses_attron(VALUE obj, VALUE attrs)
{
return window_attron(rb_stdscr,attrs);
/* return INT2FIX(attroff(NUM2INT(attrs))); */
}
|
.attrset(attrs) ⇒ Object
return INT2FIX(attroff(NUM2INT(attrs)));
551 552 553 554 555 556 |
# File 'curses.c', line 551
static VALUE
curses_attrset(VALUE obj, VALUE attrs)
{
return window_attrset(rb_stdscr,attrs);
/* return INT2FIX(attroff(NUM2INT(attrs))); */
}
|
.beep ⇒ Object
def beep
303 304 305 |
# File 'curses.c', line 303 static VALUE curses_beep(obj) VALUE obj; |
.bkgd(ch) ⇒ Object
567 568 569 570 571 572 573 574 575 |
# File 'curses.c', line 567
static VALUE
curses_bkgd(VALUE obj, VALUE ch)
{
#ifdef HAVE_BKGD
return (bkgd(NUM2CH(ch)) == OK) ? Qtrue : Qfalse;
#else
return Qfalse;
#endif
}
|
.bkgdset(ch) ⇒ Object
return INT2FIX(attroff(NUM2INT(attrs)));
558 559 560 561 562 563 564 565 |
# File 'curses.c', line 558
static VALUE
curses_bkgdset(VALUE obj, VALUE ch)
{
#ifdef HAVE_BKGDSET
bkgdset(NUM2CH(ch));
#endif
return Qnil;
}
|
.can_change_color? ⇒ Boolean
616 617 618 619 620 |
# File 'curses.c', line 616
static VALUE
curses_can_change_color(VALUE obj)
{
return can_change_color() ? Qtrue : Qfalse;
}
|
.cbreak ⇒ Object
def cbreak
263 264 265 |
# File 'curses.c', line 263 static VALUE curses_cbreak(obj) VALUE obj; |
.clear ⇒ Object
def clear
180 181 182 |
# File 'curses.c', line 180 static VALUE curses_clear(obj) VALUE obj; |
.close_screen ⇒ Object
def close_screen
141 142 143 144 145 146 147 148 149 150 |
# File 'curses.c', line 141
static VALUE
curses_close_screen()
{
#ifdef HAVE_ISENDWIN
if (!isendwin())
#endif
endwin();
rb_stdscr = 0;
return Qnil;
}
|
.closed? ⇒ Boolean
def closed?
166 167 168 169 170 171 172 173 174 175 176 177 |
# File 'curses.c', line 166
static VALUE
curses_closed()
{
#ifdef HAVE_ISENDWIN
if (isendwin()) {
return Qtrue;
}
return Qfalse;
#else
rb_notimplement();
#endif
}
|
.clrtoeol ⇒ Object
def clrtoeol
190 191 192 193 194 195 196 |
# File 'curses.c', line 190
static VALUE
curses_clrtoeol()
{
curses_stdscr();
clrtoeol();
return Qnil;
}
|
.color_content(color) ⇒ Object
622 623 624 625 626 627 628 629 |
# File 'curses.c', line 622
static VALUE
curses_color_content(VALUE obj, VALUE color)
{
short r,g,b;
color_content(NUM2INT(color),&r,&g,&b);
return rb_ary_new3(3,INT2FIX(r),INT2FIX(g),INT2FIX(b));
}
|
.color_pair(attrs) ⇒ Object
640 641 642 643 644 |
# File 'curses.c', line 640
static VALUE
curses_color_pair(VALUE obj, VALUE attrs)
{
return INT2FIX(COLOR_PAIR(NUM2INT(attrs)));
}
|
.cols ⇒ Object
498 499 500 501 502 |
# File 'curses.c', line 498
static VALUE
curses_cols()
{
return INT2FIX(COLS);
}
|
.curs_set(visibility) ⇒ Object
504 505 506 507 508 509 510 511 512 513 |
# File 'curses.c', line 504
static VALUE
curses_curs_set(VALUE obj, VALUE visibility)
{
#ifdef HAVE_CURS_SET
int n;
return (n = curs_set(NUM2INT(visibility)) != ERR) ? INT2FIX(n) : Qnil;
#else
return Qnil;
#endif
}
|
.def_prog_mode ⇒ Object
738 739 740 741 742 743 744 745 746 |
# File 'curses.c', line 738
static VALUE
curses_def_prog_mode(VALUE obj)
{
#ifdef HAVE_DEF_PROG_MODE
return def_prog_mode() == OK ? Qtrue : Qfalse;
#else
rb_notimplement();
#endif
}
|
.delch ⇒ Object
def delch
442 443 444 |
# File 'curses.c', line 442 static VALUE curses_delch(obj) VALUE obj; |
.deleteln ⇒ Object
def delelteln
451 452 453 |
# File 'curses.c', line 451 static VALUE curses_deleteln(obj) VALUE obj; |
.doupdate ⇒ Object
def doupdate
209 210 211 |
# File 'curses.c', line 209 static VALUE curses_doupdate(obj) VALUE obj; |
.echo ⇒ Object
def echo
223 224 225 |
# File 'curses.c', line 223 static VALUE curses_echo(obj) VALUE obj; |
.flash ⇒ Object
def flash
315 316 317 |
# File 'curses.c', line 315 static VALUE curses_flash(obj) VALUE obj; |
.getch ⇒ Object
def getch
416 417 418 |
# File 'curses.c', line 416 static VALUE curses_getch(obj) VALUE obj; |
.getmouse ⇒ Object
678 679 680 681 682 683 684 685 686 687 688 |
# File 'curses.c', line 678
static VALUE
curses_getmouse(VALUE obj)
{
struct mousedata *mdata;
VALUE val;
val = Data_Make_Struct(cMouseEvent,struct mousedata,
0,curses_mousedata_free,mdata);
mdata->mevent = (MEVENT*)xmalloc(sizeof(MEVENT));
return (getmouse(mdata->mevent) == OK) ? val : Qnil;
}
|
.getstr ⇒ Object
def getstr
426 427 428 |
# File 'curses.c', line 426 static VALUE curses_getstr(obj) VALUE obj; |
.has_colors? ⇒ Boolean
610 611 612 613 614 |
# File 'curses.c', line 610
static VALUE
curses_has_colors(VALUE obj)
{
return has_colors() ? Qtrue : Qfalse;
}
|
.inch ⇒ Object
def inch
372 373 374 |
# File 'curses.c', line 372 static VALUE curses_inch(obj) VALUE obj; |
.init_color(color, r, g, b) ⇒ Object
602 603 604 605 606 607 608 |
# File 'curses.c', line 602
static VALUE
curses_init_color(VALUE obj, VALUE color, VALUE r, VALUE g, VALUE b)
{
/* may have to raise exception on ERR */
return (init_color(NUM2INT(color),NUM2INT(r),
NUM2INT(g),NUM2INT(b)) == OK) ? Qtrue : Qfalse;
}
|
.init_pair(pair, f, b) ⇒ Object
595 596 597 598 599 600 |
# File 'curses.c', line 595
static VALUE
curses_init_pair(VALUE obj, VALUE pair, VALUE f, VALUE b)
{
/* may have to raise exception on ERR */
return (init_pair(NUM2INT(pair),NUM2INT(f),NUM2INT(b)) == OK) ? Qtrue : Qfalse;
}
|
.init_screen ⇒ Object
def init_screen
123 124 125 126 127 128 129 130 131 132 133 134 135 |
# File 'curses.c', line 123
static VALUE
curses_init_screen()
{
rb_secure(4);
if (rb_stdscr) return rb_stdscr;
initscr();
if (stdscr == 0) {
rb_raise(rb_eRuntimeError, "can't initialize curses");
}
clear();
rb_stdscr = prep_window(cWindow, stdscr);
return rb_stdscr;
}
|
.insch ⇒ Object
def insch(ch)
392 393 394 |
# File 'curses.c', line 392 static VALUE curses_insch(obj, ch) VALUE obj; |
.insertln ⇒ Object
def insertln
462 463 464 |
# File 'curses.c', line 462 static VALUE curses_insertln(obj) VALUE obj; |
.keyname ⇒ Object
def keyname
473 474 475 |
# File 'curses.c', line 473 static VALUE curses_keyname(obj, c) VALUE obj; |
.lines ⇒ Object
492 493 494 495 496 |
# File 'curses.c', line 492
static VALUE
curses_lines()
{
return INT2FIX(LINES);
}
|
.mouseinterval(interval) ⇒ Object
699 700 701 702 703 |
# File 'curses.c', line 699
static VALUE
curses_mouseinterval(VALUE obj, VALUE interval)
{
return mouseinterval(NUM2INT(interval)) ? Qtrue : Qfalse;
}
|
.mousemask(mask) ⇒ Object
705 706 707 708 709 |
# File 'curses.c', line 705
static VALUE
curses_mousemask(VALUE obj, VALUE mask)
{
return INT2NUM(mousemask(NUM2UINT(mask),NULL));
}
|
.nl ⇒ Object
def nl
283 284 285 |
# File 'curses.c', line 283 static VALUE curses_nl(obj) VALUE obj; |
.nocbreak ⇒ Object
def nocbreak
273 274 275 |
# File 'curses.c', line 273 static VALUE curses_nocbreak(obj) VALUE obj; |
.noecho ⇒ Object
def noecho
233 234 235 |
# File 'curses.c', line 233 static VALUE curses_noecho(obj) VALUE obj; |
.nonl ⇒ Object
def nonl
293 294 295 |
# File 'curses.c', line 293 static VALUE curses_nonl(obj) VALUE obj; |
.noraw ⇒ Object
def noraw
253 254 255 |
# File 'curses.c', line 253 static VALUE curses_noraw(obj) VALUE obj; |
.pair_content(pair) ⇒ Object
631 632 633 634 635 636 637 638 |
# File 'curses.c', line 631
static VALUE
curses_pair_content(VALUE obj, VALUE pair)
{
short f,b;
pair_content(NUM2INT(pair),&f,&b);
return rb_ary_new3(2,INT2FIX(f),INT2FIX(b));
}
|
.pair_number(attrs) ⇒ Object
646 647 648 649 650 |
# File 'curses.c', line 646
static VALUE
curses_pair_number(VALUE obj, VALUE attrs)
{
return INT2FIX(PAIR_NUMBER(NUM2INT(attrs)));
}
|
.raw ⇒ Object
def raw
243 244 245 |
# File 'curses.c', line 243 static VALUE curses_raw(obj) VALUE obj; |
.refresh ⇒ Object
def refresh
199 200 201 |
# File 'curses.c', line 199 static VALUE curses_refresh(obj) VALUE obj; |
.reset_prog_mode ⇒ Object
748 749 750 751 752 753 754 755 756 |
# File 'curses.c', line 748
static VALUE
curses_reset_prog_mode(VALUE obj)
{
#ifdef HAVE_RESET_PROG_MODE
return reset_prog_mode() == OK ? Qtrue : Qfalse;
#else
rb_notimplement();
#endif
}
|
.resize(lin, col) ⇒ Object
577 578 579 580 581 582 583 584 585 |
# File 'curses.c', line 577
static VALUE
curses_resizeterm(VALUE obj, VALUE lin, VALUE col)
{
#if defined(HAVE_RESIZETERM)
return (resizeterm(NUM2INT(lin),NUM2INT(col)) == OK) ? Qtrue : Qfalse;
#else
return Qnil;
#endif
}
|
.resizeterm(lin, col) ⇒ Object
577 578 579 580 581 582 583 584 585 |
# File 'curses.c', line 577
static VALUE
curses_resizeterm(VALUE obj, VALUE lin, VALUE col)
{
#if defined(HAVE_RESIZETERM)
return (resizeterm(NUM2INT(lin),NUM2INT(col)) == OK) ? Qtrue : Qfalse;
#else
return Qnil;
#endif
}
|
.scrl(n) ⇒ Object
515 516 517 518 519 520 521 522 523 524 |
# File 'curses.c', line 515
static VALUE
curses_scrl(VALUE obj, VALUE n)
{
/* may have to raise exception on ERR */
#ifdef HAVE_SCRL
return (scrl(NUM2INT(n)) == OK) ? Qtrue : Qfalse;
#else
return Qfalse;
#endif
}
|
.setpos ⇒ Object
def setpos(y, x)
342 343 344 |
# File 'curses.c', line 342 static VALUE curses_setpos(obj, y, x) VALUE obj; |
.setscrreg(top, bottom) ⇒ Object
526 527 528 529 530 531 532 533 534 535 |
# File 'curses.c', line 526
static VALUE
curses_setscrreg(VALUE obj, VALUE top, VALUE bottom)
{
/* may have to raise exception on ERR */
#ifdef HAVE_SETSCRREG
return (setscrreg(NUM2INT(top), NUM2INT(bottom)) == OK) ? Qtrue : Qfalse;
#else
return Qfalse;
#endif
}
|
.standend ⇒ Object
def standend
363 364 365 |
# File 'curses.c', line 363 static VALUE curses_standend(obj) VALUE obj; |
.standout ⇒ Object
def standout
354 355 356 |
# File 'curses.c', line 354 static VALUE curses_standout(obj) VALUE obj; |
.start_color ⇒ Object
588 589 590 591 592 593 |
# File 'curses.c', line 588
static VALUE
curses_start_color(VALUE obj)
{
/* may have to raise exception on ERR */
return (start_color() == OK) ? Qtrue : Qfalse;
}
|
.stdscr ⇒ Object
.timeout= ⇒ Object
.ungetch ⇒ Object
def ungetch
327 328 329 |
# File 'curses.c', line 327 static VALUE curses_ungetch(obj, ch) VALUE obj; |
.ungetmouse(mevent) ⇒ Object
690 691 692 693 694 695 696 697 |
# File 'curses.c', line 690
static VALUE
curses_ungetmouse(VALUE obj, VALUE mevent)
{
struct mousedata *mdata;
GetMOUSE(mevent,mdata);
return (ungetmouse(mdata->mevent) == OK) ? Qtrue : Qfalse;
}
|