Class: Curses::Window
- Inherits:
-
Data
- Object
- Data
- Curses::Window
- Defined in:
- curses.c
Instance Method Summary collapse
-
#<< ⇒ Object
def <<(str).
-
#addch ⇒ Object
def addch(ch).
-
#addstr ⇒ Object
def addstr(str).
- #attroff ⇒ Object
- #attron ⇒ Object
- #attrset ⇒ Object
-
#begx ⇒ Object
def begx.
-
#begy ⇒ Object
def begy.
- #bkgd ⇒ Object
- #bkgdset ⇒ Object
-
#box ⇒ Object
def box(vert, hor).
-
#clear ⇒ Object
def clear.
-
#close ⇒ Object
def close.
-
#clrtoeol ⇒ Object
def clrtoeol.
- #color_set ⇒ Object
-
#curx ⇒ Object
def curx.
-
#cury ⇒ Object
def cury.
-
#delch ⇒ Object
def delch.
-
#deleteln ⇒ Object
def delelteln.
- #getbkgd ⇒ Object
-
#getch ⇒ Object
def getch.
-
#getstr ⇒ Object
def getstr.
- #idlok ⇒ Object
-
#inch ⇒ Object
def inch.
-
#initialize ⇒ Object
constructor
def initialize(h, w, top, left).
-
#insch ⇒ Object
def insch(ch).
-
#insertln ⇒ Object
def insertln.
- #keypad ⇒ Object
- #keypad= ⇒ Object
-
#maxx ⇒ Object
def maxx.
-
#maxy ⇒ Object
def maxy.
-
#move ⇒ Object
def move(y, x).
- #nodelay= ⇒ Object
-
#noutrefresh ⇒ Object
def noutrefresh.
-
#refresh ⇒ Object
def refresh.
- #resize ⇒ Object
- #scrl ⇒ Object
-
#scroll ⇒ Object
USE_COLOR.
- #scrollok ⇒ Object
-
#setpos ⇒ Object
def setpos(y, x).
- #setscrreg ⇒ Object
-
#standend ⇒ Object
def standend.
-
#standout ⇒ Object
def standout.
-
#subwin ⇒ Object
def subwin(height, width, top, left).
- #timeout= ⇒ Object
Constructor Details
#initialize ⇒ Object
def initialize(h, w, top, left)
|
# File 'curses.c'
static VALUE
window_initialize(obj, h, w, top, left)
VALUE obj;
VALUE h;
VALUE w;
VALUE top;
VALUE left;
{
struct windata *winp;
WINDOW *window;
rb_secure(4);
curses_init_screen();
Data_Get_Struct(obj, struct windata, winp);
if (winp->window) delwin(winp->window);
window = newwin(NUM2INT(h), NUM2INT(w), NUM2INT(top), NUM2INT(left));
wclear(window);
winp->window = window;
return obj;
}
|
Instance Method Details
#<< ⇒ Object
def <<(str)
|
# File 'curses.c'
static VALUE
window_addstr2(obj, str)
VALUE obj;
VALUE str;
{
window_addstr(obj, str);
return obj;
}
|
#addch ⇒ Object
def addch(ch)
|
# File 'curses.c'
static VALUE
window_addch(obj, ch)
VALUE obj;
VALUE ch;
{
struct windata *winp;
GetWINDOW(obj, winp);
waddch(winp->window, NUM2CH(ch));
return Qnil;
}
|
#addstr ⇒ Object
def addstr(str)
|
# File 'curses.c'
static VALUE
window_addstr(obj, str)
VALUE obj;
VALUE str;
{
if (!NIL_P(str)) {
struct windata *winp;
GetWINDOW(obj, winp);
waddstr(winp->window, STR2CSTR(str));
}
|
#attroff ⇒ Object
#attron ⇒ Object
#attrset ⇒ Object
#begx ⇒ Object
def begx
|
# File 'curses.c'
static VALUE
window_begx(obj)
VALUE obj;
{
struct windata *winp;
int x, y;
GetWINDOW(obj, winp);
#ifdef getbegyx
getbegyx(winp->window, y, x);
return INT2FIX(x);
#else
return INT2FIX(winp->window->_begx);
#endif
}
|
#begy ⇒ Object
def begy
|
# File 'curses.c'
static VALUE
window_begy(obj)
VALUE obj;
{
struct windata *winp;
int x, y;
GetWINDOW(obj, winp);
#ifdef getbegyx
getbegyx(winp->window, y, x);
return INT2FIX(y);
#else
return INT2FIX(winp->window->_begy);
#endif
}
|
#bkgd ⇒ Object
#bkgdset ⇒ Object
#box ⇒ Object
def box(vert, hor)
|
# File 'curses.c'
static VALUE
window_box(argc, argv, self)
int argc;
VALUE argv[], self;
{
struct windata *winp;
VALUE vert, hor, corn;
rb_scan_args(argc, argv, "21", &vert, &hor, &corn);
GetWINDOW(self, winp);
box(winp->window, NUM2CH(vert), NUM2CH(hor));
if (!NIL_P(corn)) {
int cur_x, cur_y, x, y;
chtype c;
c = NUM2CH(corn);
getyx(winp->window, cur_y, cur_x);
x = NUM2INT(window_maxx(self)) - 1;
y = NUM2INT(window_maxy(self)) - 1;
wmove(winp->window, 0, 0);
waddch(winp->window, c);
wmove(winp->window, y, 0);
waddch(winp->window, c);
wmove(winp->window, y, x);
waddch(winp->window, c);
wmove(winp->window, 0, x);
waddch(winp->window, c);
wmove(winp->window, cur_y, cur_x);
}
|
#clear ⇒ Object
def clear
|
# File 'curses.c'
static VALUE
window_clear(obj)
VALUE obj;
{
struct windata *winp;
GetWINDOW(obj, winp);
wclear(winp->window);
return Qnil;
}
|
#close ⇒ Object
def close
|
# File 'curses.c'
static VALUE
window_close(obj)
VALUE obj;
{
struct windata *winp;
GetWINDOW(obj, winp);
delwin(winp->window);
winp->window = 0;
return Qnil;
}
|
#clrtoeol ⇒ Object
def clrtoeol
|
# File 'curses.c'
static VALUE
window_clrtoeol(obj)
VALUE obj;
{
struct windata *winp;
GetWINDOW(obj, winp);
wclrtoeol(winp->window);
return Qnil;
}
|
#color_set ⇒ Object
#curx ⇒ Object
def curx
|
# File 'curses.c'
static VALUE
window_curx(obj)
VALUE obj;
{
struct windata *winp;
int x, y;
GetWINDOW(obj, winp);
getyx(winp->window, y, x);
return INT2FIX(x);
}
|
#cury ⇒ Object
def cury
|
# File 'curses.c'
static VALUE
window_cury(obj)
VALUE obj;
{
struct windata *winp;
int x, y;
GetWINDOW(obj, winp);
getyx(winp->window, y, x);
return INT2FIX(y);
}
|
#delch ⇒ Object
def delch
|
# File 'curses.c'
static VALUE
window_delch(obj)
VALUE obj;
{
struct windata *winp;
GetWINDOW(obj, winp);
wdelch(winp->window);
return Qnil;
}
|
#deleteln ⇒ Object
def delelteln
|
# File 'curses.c'
static VALUE
window_deleteln(obj)
VALUE obj;
{
#if defined(HAVE_WDELETELN) || defined(wdeleteln)
struct windata *winp;
GetWINDOW(obj, winp);
wdeleteln(winp->window);
#endif
return Qnil;
}
|
#getbkgd ⇒ Object
#getch ⇒ Object
def getch
|
# File 'curses.c'
static VALUE
window_getch(obj)
VALUE obj;
{
struct windata *winp;
rb_read_check(stdin);
GetWINDOW(obj, winp);
return UINT2NUM(wgetch(winp->window));
}
|
#getstr ⇒ Object
def getstr
|
# File 'curses.c'
static VALUE
window_getstr(obj)
VALUE obj;
{
struct windata *winp;
char rtn[1024]; /* This should be big enough.. I hope */
GetWINDOW(obj, winp);
rb_read_check(stdin);
#if defined(HAVE_WGETNSTR)
wgetnstr(winp->window, rtn, 1023);
#else
wgetstr(winp->window, rtn);
#endif
return rb_tainted_str_new2(rtn);
}
|
#idlok ⇒ Object
#inch ⇒ Object
def inch
|
# File 'curses.c'
static VALUE
window_inch(obj)
VALUE obj;
{
struct windata *winp;
GetWINDOW(obj, winp);
return CH2FIX(winch(winp->window));
}
|
#insch ⇒ Object
def insch(ch)
|
# File 'curses.c'
static VALUE
window_insch(obj, ch)
VALUE obj;
VALUE ch;
{
struct windata *winp;
GetWINDOW(obj, winp);
winsch(winp->window, NUM2CH(ch));
return Qnil;
}
|
#insertln ⇒ Object
def insertln
|
# File 'curses.c'
static VALUE
window_insertln(obj)
VALUE obj;
{
#if defined(HAVE_WINSERTLN) || defined(winsertln)
struct windata *winp;
GetWINDOW(obj, winp);
winsertln(winp->window);
#endif
return Qnil;
}
|
#keypad ⇒ Object
#keypad= ⇒ Object
#maxx ⇒ Object
def maxx
|
# File 'curses.c'
static VALUE
window_maxx(obj)
VALUE obj;
{
struct windata *winp;
GetWINDOW(obj, winp);
#if defined(getmaxx)
return INT2FIX(getmaxx(winp->window));
#elif defined(getmaxyx)
{
int x, y;
getmaxyx(winp->window, y, x);
return INT2FIX(x);
}
|
#maxy ⇒ Object
def maxy
|
# File 'curses.c'
static VALUE
window_maxy(obj)
VALUE obj;
{
struct windata *winp;
GetWINDOW(obj, winp);
#if defined(getmaxy)
return INT2FIX(getmaxy(winp->window));
#elif defined(getmaxyx)
{
int x, y;
getmaxyx(winp->window, y, x);
return INT2FIX(y);
}
|
#move ⇒ Object
def move(y, x)
|
# File 'curses.c'
static VALUE
window_move(obj, y, x)
VALUE obj;
VALUE y;
VALUE x;
{
struct windata *winp;
GetWINDOW(obj, winp);
mvwin(winp->window, NUM2INT(y), NUM2INT(x));
return Qnil;
}
|
#nodelay= ⇒ Object
#noutrefresh ⇒ Object
def noutrefresh
|
# File 'curses.c'
static VALUE
window_noutrefresh(obj)
VALUE obj;
{
struct windata *winp;
GetWINDOW(obj, winp);
#ifdef HAVE_DOUPDATE
wnoutrefresh(winp->window);
#else
wrefresh(winp->window);
#endif
return Qnil;
}
|
#refresh ⇒ Object
def refresh
|
# File 'curses.c'
static VALUE
window_refresh(obj)
VALUE obj;
{
struct windata *winp;
GetWINDOW(obj, winp);
wrefresh(winp->window);
return Qnil;
}
|
#resize ⇒ Object
#scrl ⇒ Object
#scroll ⇒ Object
USE_COLOR
|
# File 'curses.c'
static VALUE
window_scroll(VALUE obj)
{
struct windata *winp;
GetWINDOW(obj, winp);
/* may have to raise exception on ERR */
return (scroll(winp->window) == OK) ? Qtrue : Qfalse;
}
|
#scrollok ⇒ Object
#setpos ⇒ Object
def setpos(y, x)
|
# File 'curses.c'
static VALUE
window_setpos(obj, y, x)
VALUE obj;
VALUE y;
VALUE x;
{
struct windata *winp;
GetWINDOW(obj, winp);
wmove(winp->window, NUM2INT(y), NUM2INT(x));
return Qnil;
}
|
#setscrreg ⇒ Object
#standend ⇒ Object
def standend
|
# File 'curses.c'
static VALUE
window_standend(obj)
VALUE obj;
{
struct windata *winp;
GetWINDOW(obj, winp);
wstandend(winp->window);
return Qnil;
}
|
#standout ⇒ Object
def standout
|
# File 'curses.c'
static VALUE
window_standout(obj)
VALUE obj;
{
struct windata *winp;
GetWINDOW(obj, winp);
wstandout(winp->window);
return Qnil;
}
|
#subwin ⇒ Object
def subwin(height, width, top, left)
|
# File 'curses.c'
static VALUE
window_subwin(obj, height, width, top, left)
VALUE obj;
VALUE height;
VALUE width;
VALUE top;
VALUE left;
{
struct windata *winp;
WINDOW *window;
VALUE win;
int h, w, t, l;
h = NUM2INT(height);
w = NUM2INT(width);
t = NUM2INT(top);
l = NUM2INT(left);
GetWINDOW(obj, winp);
window = subwin(winp->window, h, w, t, l);
win = prep_window(rb_obj_class(obj), window);
return win;
}
|