Class: Curses::Pad
- Defined in:
- ext/curses/curses.c,
ext/curses/curses.c
Overview
Description
A Pad is like a Window but allows for scrolling of contents that cannot fit on the screen. Pads do not refresh automatically, use Pad#refresh or Pad#noutrefresh instead.
Instance Method Summary collapse
-
#initialize(h, w) ⇒ Object
constructor
call-seq: new(height, width).
- #noutrefresh(pminrow, pmincol, sminrow, smincol, smaxrow, smaxcol) ⇒ Object
- #refresh(pminrow, pmincol, sminrow, smincol, smaxrow, smaxcol) ⇒ Object
- #subpad(height, width, begin_x, begin_y) ⇒ Object
Methods inherited from Window
#<<, #addch, #addstr, #attr_get, #attr_set, #attroff, #attron, #attrset, #begx, #begy, #bkgd, #bkgdset, #box, #chgat, #clear, #close, #clrtoeol, #color_set, #curx, #cury, #delch, #deleteln, #derwin, #erase, #get_char, #getbkgd, #getch, #getstr, #idlok, #inch, #insch, #insertln, #keypad, #keypad=, #line_touched?, #maxx, #maxy, #move, #move_relative, #nodelay=, #redraw, #resize, #scrl, #scroll, #scrollok, #setpos, #setscrreg, #standend, #standout, #subwin, #timeout=, #touch, #touch_line, #touched?, #untouch
Constructor Details
#initialize(h, w) ⇒ Object
call-seq:
new(height, width)
Construct a new Curses::Pad with constraints of height lines, width
columns
3230 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 |
# File 'ext/curses/curses.c', line 3230
static VALUE
pad_initialize(VALUE obj, VALUE h, VALUE w)
{
struct windata *padp;
WINDOW *window;
curses_init_screen(Qnil);
TypedData_Get_Struct(obj, struct windata, &windata_type, padp);
if (padp->window) delwin(padp->window);
window = newpad(NUM2INT(h), NUM2INT(w));
wclear(window);
padp->window = window;
return obj;
}
|
Instance Method Details
#noutrefresh(pminrow, pmincol, sminrow, smincol, smaxrow, smaxcol) ⇒ Object
3318 3319 3320 3321 3322 3323 3324 3325 3326 3327 3328 3329 3330 3331 3332 3333 3334 3335 3336 3337 3338 3339 3340 |
# File 'ext/curses/curses.c', line 3318
static VALUE
pad_noutrefresh(VALUE obj, VALUE pminrow, VALUE pmincol, VALUE sminrow,
VALUE smincol, VALUE smaxrow, VALUE smaxcol)
{
struct windata *padp;
int pmr, pmc, smr, smc, sxr, sxc;
pmr = NUM2INT(pminrow);
pmc = NUM2INT(pmincol);
smr = NUM2INT(sminrow);
smc = NUM2INT(smincol);
sxr = NUM2INT(smaxrow);
sxc = NUM2INT(smaxcol);
GetWINDOW(obj, padp);
#ifdef HAVE_DOUPDATE
pnoutrefresh(padp->window, pmr, pmc, smr, smc, sxr, sxc);
#else
prefresh(padp->window, pmr, pmc, smr, smc, sxr, sxc);
#endif
return Qnil;
}
|
#refresh(pminrow, pmincol, sminrow, smincol, smaxrow, smaxcol) ⇒ Object
3286 3287 3288 3289 3290 3291 3292 3293 3294 3295 3296 3297 3298 3299 3300 3301 3302 3303 3304 |
# File 'ext/curses/curses.c', line 3286
static VALUE
pad_refresh(VALUE obj, VALUE pminrow, VALUE pmincol, VALUE sminrow,
VALUE smincol, VALUE smaxrow, VALUE smaxcol)
{
struct windata *padp;
int pmr, pmc, smr, smc, sxr, sxc;
pmr = NUM2INT(pminrow);
pmc = NUM2INT(pmincol);
smr = NUM2INT(sminrow);
smc = NUM2INT(smincol);
sxr = NUM2INT(smaxrow);
sxc = NUM2INT(smaxcol);
GetWINDOW(obj, padp);
prefresh(padp->window, pmr, pmc, smr, smc, sxr, sxc);
return Qnil;
}
|
#subpad(height, width, begin_x, begin_y) ⇒ Object
3255 3256 3257 3258 3259 3260 3261 3262 3263 3264 3265 3266 3267 3268 3269 3270 3271 3272 |
# File 'ext/curses/curses.c', line 3255
static VALUE
pad_subpad(VALUE obj, VALUE height, VALUE width, VALUE begin_x, VALUE begin_y)
{
struct windata *padp;
WINDOW *sub_pad;
VALUE pad;
int h, w, x, y;
h = NUM2INT(height);
w = NUM2INT(width);
x = NUM2INT(begin_x);
y = NUM2INT(begin_y);
GetWINDOW(obj, padp);
sub_pad = subpad(padp->window, h, w, x, y);
pad = prep_window(rb_obj_class(obj), sub_pad, 0);
return pad;
}
|