Module: Curses

Module | Curses
In: | curses/curses.c

————————- Initialization ————————-

### Methods

addch addstr attroff attron attrset beep bkgd bkgdset can_change_color? cbreak clear close_screen closed? clrtoeol color_content color_pair cols crmode curs_set def_prog_mode delch deleteln doupdate echo flash getch getmouse getstr has_colors? inch init_color init_pair init_screen insch insertln keyname lines mouseinterval mousemask nl nocbreak nocrmode noecho nonl noraw pair_content pair_number raw refresh reset_prog_mode resize resizeterm scrl setpos setscrreg standend standout start_color stdscr timeout= ungetch ungetmouse

### Classes and Modules

Module Curses::Key
Class Curses::MouseEvent
Class Curses::Window

### Public Instance methods

addch(p1)

def addch(ch)

[Source]

    /* def addch(ch) */
    static VALUE
    curses_addch(obj, ch)
        VALUE obj;
        VALUE ch;
    {
        curses_stdscr();
        addch(NUM2CH(ch));
        return Qnil;
    }

addstr(p1)

def addstr(str)

[Source]

    /* def addstr(str) */
    static VALUE
    curses_addstr(obj, str)
        VALUE obj;
        VALUE str;
    {
        curses_stdscr();
        if (!NIL_P(str)) {
    	addstr(STR2CSTR(str));
        }
        return Qnil;
    }

attroff(p1)
attron(p1)
attrset(p1)
beep()

def beep

[Source]

    /* def beep */
    static VALUE
    curses_beep(obj)
        VALUE obj;
    {
    #ifdef HAVE_BEEP
        curses_stdscr();
        beep();
    #endif
        return Qnil;
    }

bkgd(p1)
bkgdset(p1)
can_change_color?()
cbreak()

def cbreak

[Source]

    /* def cbreak */
    static VALUE
    curses_cbreak(obj)
        VALUE obj;
    {
        curses_stdscr();
        cbreak();
        return Qnil;
    }

clear()

def clear

[Source]

    /* def clear */
    static VALUE
    curses_clear(obj)
        VALUE obj;
    {
        curses_stdscr();
        wclear(stdscr);
        return Qnil;
    }

close_screen()

def close_screen

[Source]

    /* def close_screen */
    static VALUE
    curses_close_screen()
    {
    #ifdef HAVE_ISENDWIN
        if (!isendwin())
    #endif
    	endwin();
        rb_stdscr = 0;
        return Qnil;
    }

closed?()

def closed?

[Source]

    /* def closed? */
    static VALUE
    curses_closed()
    {
    #ifdef HAVE_ISENDWIN
        if (isendwin()) {
    	return Qtrue;
        }
        return Qfalse;
    #else
        rb_notimplement();
    #endif
    }

clrtoeol()

def clrtoeol

[Source]

    /* def clrtoeol */
    static VALUE
    curses_clrtoeol()
    {
        curses_stdscr();
        clrtoeol();
        return Qnil;
    }

color_content(p1)
color_pair(p1)
cols()
crmode()

Alias for cbreak

curs_set(p1)
def_prog_mode()
delch()

def delch

[Source]

    /* def delch */
    static VALUE
    curses_delch(obj)
        VALUE obj;
    {
        delch();
        return Qnil;
    }

deleteln()

def delelteln

[Source]

    /* def delelteln */
    static VALUE
    curses_deleteln(obj)
        VALUE obj;
    {
    #if defined(HAVE_DELETELN) || defined(deleteln)
        deleteln();
    #endif
        return Qnil;
    }

doupdate()

def doupdate

[Source]

    /* def doupdate */
    static VALUE
    curses_doupdate(obj)
        VALUE obj;
    {
        curses_stdscr();
    #ifdef HAVE_DOUPDATE
        doupdate();
    #else
        refresh();
    #endif
        return Qnil;
    }

echo()

def echo

[Source]

    /* def echo */
    static VALUE
    curses_echo(obj)
        VALUE obj;
    {
        curses_stdscr();
        echo();
        return Qnil;
    }

flash()

def flash

[Source]

    /* def flash */
    static VALUE
    curses_flash(obj)
        VALUE obj;
    {
    #ifdef HAVE_FLASH
        curses_stdscr();
        flash();
    #endif
        return Qnil;
    }

getch()

def getch

[Source]

    /* def getch */
    static VALUE
    curses_getch(obj)
        VALUE obj;
    {
        rb_read_check(stdin);
        curses_stdscr();
        return UINT2NUM(getch());
    }

getmouse()
getstr()

def getstr

[Source]

    /* def getstr */
    static VALUE
    curses_getstr(obj)
        VALUE obj;
    {
        char rtn[1024]; /* This should be big enough.. I hope */

        rb_read_check(stdin);
    #if defined(HAVE_GETNSTR)
        getnstr(rtn,1023);
    #else
        getstr(rtn);
    #endif
        return rb_tainted_str_new2(rtn);
    }

has_colors?()
inch()

def inch

[Source]

    /* def inch */
    static VALUE
    curses_inch(obj)
        VALUE obj;
    {
        curses_stdscr();
        return CH2FIX(inch());
    }

init_color(p1, p2, p3, p4)
init_pair(p1, p2, p3)
init_screen()

def init_screen

[Source]

    /* def init_screen */
    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(p1)

def insch(ch)

[Source]

    /* def insch(ch) */
    static VALUE
    curses_insch(obj, ch)
        VALUE obj;
        VALUE ch;
    {
        curses_stdscr();
        insch(NUM2CH(ch));
        return Qnil;
    }

insertln()

def insertln

[Source]

    /* def insertln */
    static VALUE
    curses_insertln(obj)
        VALUE obj;
    {
    #if defined(HAVE_INSERTLN) || defined(insertln)
        insertln();
    #endif
        return Qnil;
    }

keyname(p1)

def keyname

[Source]

    /* def keyname */
    static VALUE
    curses_keyname(obj, c)
        VALUE obj;
        VALUE c;
    {
    #ifdef HAVE_KEYNAME
      const char *name;

      name = keyname(NUM2INT(c));
      if (name) {
        return rb_str_new2(name);
      } else {
        return Qnil;
      }
    #else
      return Qnil;
    #endif
    }

lines()
mouseinterval(p1)
mousemask(p1)
nl()

def nl

[Source]

    /* def nl */
    static VALUE
    curses_nl(obj)
        VALUE obj;
    {
        curses_stdscr();
        nl();
        return Qnil;
    }

nocbreak()

def nocbreak

[Source]

    /* def nocbreak */
    static VALUE
    curses_nocbreak(obj)
        VALUE obj;
    {
        curses_stdscr();
        nocbreak();
        return Qnil;
    }

nocrmode()

Alias for nocbreak

noecho()

def noecho

[Source]

    /* def noecho */
    static VALUE
    curses_noecho(obj)
        VALUE obj;
    {
        curses_stdscr();
        noecho();
        return Qnil;
    }

nonl()

def nonl

[Source]

    /* def nonl */
    static VALUE
    curses_nonl(obj)
        VALUE obj;
    {
        curses_stdscr();
        nonl();
        return Qnil;
    }

noraw()

def noraw

[Source]

    /* def noraw */
    static VALUE
    curses_noraw(obj)
        VALUE obj;
    {
        curses_stdscr();
        noraw();
        return Qnil;
    }

pair_content(p1)
pair_number(p1)
raw()

def raw

[Source]

    /* def raw */
    static VALUE
    curses_raw(obj)
        VALUE obj;
    {
        curses_stdscr();
        raw();
        return Qnil;
    }

refresh()

def refresh

[Source]

    /* def refresh */
    static VALUE
    curses_refresh(obj)
        VALUE obj;
    {
        curses_stdscr();
        refresh();
        return Qnil;
    }

reset_prog_mode()
resize(p1, p2)
resizeterm(p1, p2)
scrl(p1)
setpos(p1, p2)

def setpos(y, x)

[Source]

    /* def setpos(y, x) */
    static VALUE
    curses_setpos(obj, y, x)
        VALUE obj;
        VALUE y;
        VALUE x;
    {
        curses_stdscr();
        move(NUM2INT(y), NUM2INT(x));
        return Qnil;
    }

setscrreg(p1, p2)
standend()

def standend

[Source]

    /* def standend */
    static VALUE
    curses_standend(obj)
        VALUE obj;
    {
        standend();
        return Qnil;
    }

standout()

def standout

[Source]

    /* def standout */
    static VALUE
    curses_standout(obj)
        VALUE obj;
    {
        standout();
        return Qnil;
    }

start_color()
stdscr()
timeout=(p1)

USE_MOUSE

[Source]

    /* USE_MOUSE */

    static VALUE
    curses_timeout(VALUE obj, VALUE delay)
    {
    #ifdef HAVE_TIMEOUT
      timeout(NUM2INT(delay));
      return Qnil;
    #else
        rb_notimplement();
    #endif
    }

ungetch(p1)

def ungetch

[Source]

    /* def ungetch */
    static VALUE
    curses_ungetch(obj, ch)
        VALUE obj;
        VALUE ch;
    {
    #ifdef HAVE_UNGETCH
        curses_stdscr();
        ungetch(NUM2INT(ch));
    #else
        rb_notimplement();
    #endif
        return Qnil;
    }

ungetmouse(p1)

[Validate]