Class: Curses::Pad

Inherits:
Window
  • Object
show all
Defined in:
curses.c,
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

Methods inherited from Window

#<<, #addch, #addstr, #attroff, #attron, #attrset, #begx, #begy, #bkgd, #bkgdset, #box, #clear, #close, #clrtoeol, #color_set, #curx, #cury, #delch, #deleteln, #getbkgd, #getch, #getstr, #idlok, #inch, #insch, #insertln, #keypad, #keypad=, #maxx, #maxy, #move, #nodelay=, #resize, #scrl, #scroll, #scrollok, #setpos, #setscrreg, #standend, #standout, #subwin, #timeout=

Constructor Details

#initializeObject

call-seq:

new(height, width)

Contruct a new Curses::Pad with constraints of height lines, width columns



2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
# File 'curses.c', line 2508

static VALUE
pad_initialize(VALUE obj, VALUE h, VALUE w)
{
    struct windata *padp;
    WINDOW *window;

    rb_secure(4);
    curses_init_screen();
    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

#noutrefreshObject

call-seq:

pad.noutrefresh(pad_minrow, pad_mincol, screen_minrow, screen_mincol, screen_maxrow, screen_maxcol)

Refreshes the pad. pad_minrow and pad_mincol+ define the upper-left corner of the rectangle to be displayed. screen_minrow, screen_mincol, screen_maxrow, screen_maxcol define the edges of the rectangle to be displayed on the screen.



2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
# File 'curses.c', line 2601

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;
}

#refreshObject

call-seq:

pad.refresh(pad_minrow, pad_mincol, screen_minrow, screen_mincol, screen_maxrow, screen_maxcol)

Refreshes the pad. pad_minrow and pad_mincol+ define the upper-left corner of the rectangle to be displayed. screen_minrow, screen_mincol, screen_maxrow, screen_maxcol define the edges of the rectangle to be displayed on the screen.



2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
# File 'curses.c', line 2569

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

Contruct a new subpad with constraints of height lines, width columns, begin at begin_x line, and begin_y columns on the pad.



2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
# File 'curses.c', line 2537

static VALUE
pad_subpad(VALUE obj, VALUE height, VALUE width, VALUE begin_x, VALUE begin_y)
{
    struct windata *padp;
    WINDOW *subpad;
    VALUE pad;
    int h, w, x, y;

    h = NUM2INT(height);
    w = NUM2INT(width);
    x = NUM2INT(begin_x);
    y = NUM2INT(begin_y);
    GetWINDOW(obj, padp);
    subpad = subwin(padp->window, h, w, x, y);
    pad = prep_window(rb_obj_class(obj), subpad);

    return pad;
}