Class: Curses::Window
- Inherits:
-
Object
- Object
- Curses::Window
- Defined in:
- ext/curses/curses.c,
ext/curses/curses.c
Overview
Description
The means by which to create and manage frames or windows. While there may be more than one window at a time, only one window will receive input.
Usage
require "curses"
Curses.init_screen
my_str = "LOOK! PONIES!"
height, width = 12, my_str.length + 10
top, left = (Curses.lines - height) / 2, (Curses.cols - width) / 2
bwin = Curses::Window.new(height, width, top, left)
bwin.box("\\", "/")
bwin.refresh
win = bwin.subwin(height - 4, width - 4, top + 2, left + 2)
win.setpos(2, 3)
win.addstr(my_str)
# or even
win << "\nOH REALLY?"
win << "\nYES!! " + my_str
win.refresh
win.getch
win.close
Direct Known Subclasses
Instance Method Summary collapse
- #<<(str) ⇒ Object
- #addch(ch) ⇒ Object
- #addstr(str) ⇒ Object
- #attr_get ⇒ Object
- #attr_set(attrs, pair) ⇒ Object
- #attroff(attrs) ⇒ Object
- #attron(attrs) ⇒ Object
- #attrset(attrs) ⇒ Object
- #begx ⇒ Object
- #begy ⇒ Object
- #bkgd(ch) ⇒ Object
- #bkgdset(ch) ⇒ Object
- #box(*args) ⇒ Object
- #chgat(n, attrs) ⇒ Object
- #clear ⇒ Object
- #close ⇒ Object
- #clrtoeol ⇒ Object
- #color_set(col) ⇒ Object
- #curx ⇒ Object
- #cury ⇒ Object
- #delch ⇒ Object
- #deleteln ⇒ Object
- #derwin(height, width, top, left) ⇒ Object
- #erase ⇒ Object
- #get_char ⇒ Object
- #getbkgd ⇒ Object
- #getch ⇒ Object
- #getstr ⇒ Object
- #idlok(bf) ⇒ Object
- #inch ⇒ Object
- #initialize(h, w, top, left) ⇒ Object constructor
- #insch(ch) ⇒ Object
- #insertln ⇒ Object
- #keypad(val) ⇒ Object
- #keypad=(val) ⇒ Object
- #line_touched?(line) ⇒ Object
- #maxx ⇒ Object
- #maxy ⇒ Object
- #move(y, x) ⇒ Object
- #move_relative(y, x) ⇒ Object
- #nodelay=(val) ⇒ Object
- #noutrefresh ⇒ Object
- #redraw ⇒ Object
- #refresh ⇒ Object
- #resize(lin, col) ⇒ Object
- #scrl(n) ⇒ Object
- #scroll ⇒ Object
- #scrollok(bf) ⇒ Object
- #setpos(y, x) ⇒ Object
- #setscrreg(top, bottom) ⇒ Object
- #standend ⇒ Object
- #standout ⇒ Object
- #subwin(height, width, top, left) ⇒ Object
- #timeout=(delay) ⇒ Object
- #touch ⇒ Object
- #touch_line(*args) ⇒ Object
- #touched? ⇒ Object
- #untouch ⇒ Object
Constructor Details
#initialize(h, w, top, left) ⇒ Object
1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 |
# File 'ext/curses/curses.c', line 1896
static VALUE
window_initialize(VALUE obj, VALUE h, VALUE w, VALUE top, VALUE left)
{
struct windata *winp;
WINDOW *window;
curses_init_screen(Qnil);
TypedData_Get_Struct(obj, struct windata, &windata_type, 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
#<<(str) ⇒ Object
2569 2570 2571 2572 2573 2574 |
# File 'ext/curses/curses.c', line 2569
static VALUE
window_addstr2(VALUE obj, VALUE str)
{
window_addstr(obj, str);
return obj;
}
|
#addch(ch) ⇒ Object
2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 |
# File 'ext/curses/curses.c', line 2503
static VALUE
window_addch(VALUE obj, VALUE ch)
{
struct windata *winp;
GetWINDOW(obj, winp);
waddch(winp->window, OBJ2CHTYPE(ch));
return Qnil;
}
|
#addstr(str) ⇒ Object
2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 |
# File 'ext/curses/curses.c', line 2539
static VALUE
window_addstr(VALUE obj, VALUE str)
{
if (!NIL_P(str)) {
struct windata *winp;
StringValue(str);
#if defined(HAVE_WADDNWSTR) && defined(_WIN32)
str = rb_str_export_to_enc(str, get_wide_encoding());
GetWINDOW(obj, winp);
waddnwstr(winp->window, (wchar_t *)RSTRING_PTR(str), RSTRING_LEN(str) / sizeof(wchar_t));
#else
str = rb_str_export_to_enc(str, terminal_encoding);
GetWINDOW(obj, winp);
waddstr(winp->window, StringValueCStr(str));
#endif
}
return Qnil;
}
|
#attr_get ⇒ Object
2988 2989 2990 2991 2992 2993 2994 2995 2996 2997 2998 2999 3000 3001 3002 3003 |
# File 'ext/curses/curses.c', line 2988
static VALUE
window_attr_get(VALUE obj)
{
struct windata *winp;
attr_t attrs;
#ifdef NCURSES_PAIRS_T
NCURSES_PAIRS_T pair;
#else
short pair;
#endif
GetWINDOW(obj, winp);
if (wattr_get(winp->window, &attrs, &pair, NULL) == ERR)
return Qnil;
return rb_ary_new3(2, UINT2NUM(attrs), INT2NUM(pair));
}
|
#attr_set(attrs, pair) ⇒ Object
2965 2966 2967 2968 2969 2970 2971 2972 |
# File 'ext/curses/curses.c', line 2965
static VALUE
window_attr_set(VALUE obj, VALUE attrs, VALUE pair)
{
struct windata *winp;
GetWINDOW(obj, winp);
return (wattr_set(winp->window, NUM2UINT(attrs), NUM2INT(pair), NULL) == OK) ? Qtrue : Qfalse;
}
|
#attroff(attrs) ⇒ Object
2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 |
# File 'ext/curses/curses.c', line 2869
static VALUE
window_attroff(VALUE obj, VALUE attrs)
{
#ifdef HAVE_WATTROFF
struct windata *winp;
GetWINDOW(obj,winp);
return INT2FIX(wattroff(winp->window,NUM2CHTYPE(attrs)));
#else
return Qtrue;
#endif
}
|
#attron(attrs) ⇒ Object
2891 2892 2893 2894 2895 2896 2897 2898 2899 2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 |
# File 'ext/curses/curses.c', line 2891
static VALUE
window_attron(VALUE obj, VALUE attrs)
{
#ifdef HAVE_WATTRON
struct windata *winp;
VALUE val;
GetWINDOW(obj,winp);
val = INT2FIX(wattron(winp->window,NUM2CHTYPE(attrs)));
if (rb_block_given_p()) {
rb_yield(val);
wattroff(winp->window,NUM2CHTYPE(attrs));
return val;
}
else{
return val;
}
#else
return Qtrue;
#endif
}
|
#attrset(attrs) ⇒ Object
2939 2940 2941 2942 2943 2944 2945 2946 2947 2948 2949 2950 |
# File 'ext/curses/curses.c', line 2939
static VALUE
window_attrset(VALUE obj, VALUE attrs)
{
#ifdef HAVE_WATTRSET
struct windata *winp;
GetWINDOW(obj,winp);
return INT2FIX(wattrset(winp->window,NUM2CHTYPE(attrs)));
#else
return Qtrue;
#endif
}
|
#begx ⇒ Object
2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 |
# File 'ext/curses/curses.c', line 2382
static VALUE
window_begx(VALUE obj)
{
struct windata *winp;
int x, RB_UNUSED_VAR(y);
GetWINDOW(obj, winp);
#ifdef getbegyx
getbegyx(winp->window, y, x);
#else
x = winp->window->_begx;
#endif
return INT2FIX(x);
}
|
#begy ⇒ Object
2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 |
# File 'ext/curses/curses.c', line 2362
static VALUE
window_begy(VALUE obj)
{
struct windata *winp;
int RB_UNUSED_VAR(x), y;
GetWINDOW(obj, winp);
#ifdef getbegyx
getbegyx(winp->window, y, x);
#else
y = winp->window->_begy;
#endif
return INT2FIX(y);
}
|
#bkgd(ch) ⇒ Object
3036 3037 3038 3039 3040 3041 3042 3043 3044 3045 3046 3047 |
# File 'ext/curses/curses.c', line 3036
static VALUE
window_bkgd(VALUE obj, VALUE ch)
{
#ifdef HAVE_WBKGD
struct windata *winp;
GetWINDOW(obj,winp);
return (wbkgd(winp->window, OBJ2CHTYPE(ch)) == OK) ? Qtrue : Qfalse;
#else
return Qfalse;
#endif
}
|
#bkgdset(ch) ⇒ Object
3015 3016 3017 3018 3019 3020 3021 3022 3023 3024 3025 |
# File 'ext/curses/curses.c', line 3015
static VALUE
window_bkgdset(VALUE obj, VALUE ch)
{
#ifdef HAVE_WBKGDSET
struct windata *winp;
GetWINDOW(obj,winp);
wbkgdset(winp->window, OBJ2CHTYPE(ch));
#endif
return Qnil;
}
|
#box(*args) ⇒ Object
2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 |
# File 'ext/curses/curses.c', line 2408
static VALUE
window_box(int argc, VALUE *argv, VALUE self)
{
struct windata *winp;
VALUE vert, hor, corn;
rb_scan_args(argc, argv, "03", &vert, &hor, &corn);
GetWINDOW(self, winp);
box(winp->window,
NIL_P(vert) ? 0 : OBJ2CHTYPE(vert),
NIL_P(hor) ? 0 : OBJ2CHTYPE(hor));
if (!NIL_P(corn)) {
int cur_x, cur_y, x, y;
chtype c;
c = OBJ2CHTYPE(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);
}
return Qnil;
}
|
#chgat(n, attrs) ⇒ Object
3075 3076 3077 3078 3079 3080 3081 3082 3083 3084 3085 3086 3087 3088 3089 3090 3091 |
# File 'ext/curses/curses.c', line 3075
static VALUE
window_chgat(VALUE obj, VALUE n, VALUE attrs)
{
#ifdef HAVE_WCHGAT
chtype a = NUM2CHTYPE(attrs);
attr_t attr;
short pair;
struct windata *winp;
GetWINDOW(obj,winp);
attr = a & A_ATTRIBUTES;
pair = PAIR_NUMBER(attr);
return (wchgat(winp->window, NUM2INT(n), attr, pair, NULL) == OK) ? Qtrue : Qfalse;
#else
return Qnil;
#endif
}
|
#clear ⇒ Object
1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 |
# File 'ext/curses/curses.c', line 1993
static VALUE
window_clear(VALUE obj)
{
struct windata *winp;
GetWINDOW(obj, winp);
wclear(winp->window);
return Qnil;
}
|
#close ⇒ Object
1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 |
# File 'ext/curses/curses.c', line 1976
static VALUE
window_close(VALUE obj)
{
struct windata *winp;
GetWINDOW(obj, winp);
delwin(winp->window);
winp->window = 0;
return Qnil;
}
|
#clrtoeol ⇒ Object
2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 |
# File 'ext/curses/curses.c', line 2029
static VALUE
window_clrtoeol(VALUE obj)
{
struct windata *winp;
GetWINDOW(obj, winp);
wclrtoeol(winp->window);
return Qnil;
}
|
#color_set(col) ⇒ Object
2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 |
# File 'ext/curses/curses.c', line 2794
static VALUE
window_color_set(VALUE obj, VALUE col)
{
struct windata *winp;
GetWINDOW(obj, winp);
#if defined(HAVE_WATTR_SET) && defined(HAVE_WATTR_GET)
/* Use wattr_set to support pair numbers > 255; preserve existing attrs. */
{
attr_t attrs;
#ifdef NCURSES_PAIRS_T
NCURSES_PAIRS_T current_pair;
#else
short current_pair;
#endif
if (wattr_get(winp->window, &attrs, ¤t_pair, NULL) == ERR)
return Qfalse;
return (wattr_set(winp->window, attrs, NUM2INT(col), NULL) == OK) ? Qtrue : Qfalse;
}
#else
return (wcolor_set(winp->window, NUM2INT(col), NULL) == OK) ? Qtrue : Qfalse;
#endif
}
|
#curx ⇒ Object
2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 |
# File 'ext/curses/curses.c', line 2298
static VALUE
window_curx(VALUE obj)
{
struct windata *winp;
int x, RB_UNUSED_VAR(y);
GetWINDOW(obj, winp);
getyx(winp->window, y, x);
return INT2FIX(x);
}
|
#cury ⇒ Object
2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 |
# File 'ext/curses/curses.c', line 2282
static VALUE
window_cury(VALUE obj)
{
struct windata *winp;
int RB_UNUSED_VAR(x), y;
GetWINDOW(obj, winp);
getyx(winp->window, y, x);
return INT2FIX(y);
}
|
#delch ⇒ Object
2659 2660 2661 2662 2663 2664 2665 2666 2667 |
# File 'ext/curses/curses.c', line 2659
static VALUE
window_delch(VALUE obj)
{
struct windata *winp;
GetWINDOW(obj, winp);
wdelch(winp->window);
return Qnil;
}
|
#deleteln ⇒ Object
2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 |
# File 'ext/curses/curses.c', line 2675
static VALUE
window_deleteln(VALUE obj)
{
#if defined(HAVE_WDELETELN) || defined(wdeleteln)
struct windata *winp;
GetWINDOW(obj, winp);
wdeleteln(winp->window);
#endif
return Qnil;
}
|
#derwin(height, width, top, left) ⇒ Object
1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 |
# File 'ext/curses/curses.c', line 1949
static VALUE
window_derwin(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 = derwin(winp->window, h, w, t, l);
win = prep_window(rb_obj_class(obj), window, 0);
return win;
}
|
#erase ⇒ Object
2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 |
# File 'ext/curses/curses.c', line 2010
static VALUE
window_erase(VALUE obj)
{
struct windata *winp;
GetWINDOW(obj, winp);
werase(winp->window);
return Qnil;
}
|
#get_char ⇒ Object
5004 5005 5006 5007 5008 5009 5010 5011 5012 5013 5014 5015 5016 5017 5018 5019 5020 5021 5022 5023 5024 5025 5026 5027 5028 5029 5030 5031 5032 5033 5034 5035 5036 5037 5038 |
# File 'ext/curses/curses.c', line 5004
static VALUE
window_get_char(VALUE obj)
{
#ifdef HAVE_WGET_WCH
struct windata *winp;
struct wget_wch_arg arg;
GetWINDOW(obj, winp);
arg.win = winp->window;
rb_thread_call_without_gvl(wget_wch_func, &arg, RUBY_UBF_IO, 0);
switch (arg.retval) {
case OK:
return keyboard_uint_chr(arg.ch);
case KEY_CODE_YES:
return key_code_value(arg.ch);
}
return Qnil;
#else
struct windata *winp;
struct wgetch_arg arg;
GetWINDOW(obj, winp);
arg.win = winp->window;
rb_thread_call_without_gvl(wgetch_func, (void *)&arg, RUBY_UBF_IO, 0);
if (arg.c > 0xff) {
return INT2NUM(arg.c);
}
else if (arg.c >= 0) {
return keyboard_uint_chr(arg.c);
}
else {
return Qnil;
}
#endif
}
|
#getbkgd ⇒ Object
3054 3055 3056 3057 3058 3059 3060 3061 3062 3063 3064 3065 3066 |
# File 'ext/curses/curses.c', line 3054
static VALUE
window_getbkgd(VALUE obj)
{
#ifdef HAVE_WGETBKGD
chtype c;
struct windata *winp;
GetWINDOW(obj,winp);
return (c = getbkgd(winp->window) != ERR) ? ULONG2NUM(c) : Qnil;
#else
return Qnil;
#endif
}
|
#getch ⇒ Object
2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 |
# File 'ext/curses/curses.c', line 2597
static VALUE
window_getch(VALUE obj)
{
struct windata *winp;
struct wgetch_arg arg;
int c;
GetWINDOW(obj, winp);
arg.win = winp->window;
rb_thread_call_without_gvl(wgetch_func, (void *)&arg, RUBY_UBF_IO, 0);
c = arg.c;
if (c == EOF) return Qnil;
if (rb_isprint(c)) {
char ch = (char)c;
return rb_external_str_new_with_enc(&ch, 1, keyboard_encoding);
}
return UINT2NUM(c);
}
|
#getstr ⇒ Object
2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 |
# File 'ext/curses/curses.c', line 2640
static VALUE
window_getstr(VALUE obj)
{
struct windata *winp;
struct wgetstr_arg arg;
GetWINDOW(obj, winp);
arg.win = winp->window;
rb_thread_call_without_gvl(wgetstr_func, (void *)&arg, RUBY_UBF_IO, 0);
return rb_external_str_new_with_enc(arg.rtn, strlen(arg.rtn),
keyboard_encoding);
}
|
#idlok(bf) ⇒ Object
2746 2747 2748 2749 2750 2751 2752 2753 2754 |
# File 'ext/curses/curses.c', line 2746
static VALUE
window_idlok(VALUE obj, VALUE bf)
{
struct windata *winp;
GetWINDOW(obj, winp);
idlok(winp->window, RTEST(bf) ? TRUE : FALSE);
return Qnil;
}
|
#inch ⇒ Object
2486 2487 2488 2489 2490 2491 2492 2493 |
# File 'ext/curses/curses.c', line 2486
static VALUE
window_inch(VALUE obj)
{
struct windata *winp;
GetWINDOW(obj, winp);
return CHTYPE2NUM(winch(winp->window));
}
|
#insch(ch) ⇒ Object
2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 |
# File 'ext/curses/curses.c', line 2521
static VALUE
window_insch(VALUE obj, VALUE ch)
{
struct windata *winp;
GetWINDOW(obj, winp);
winsch(winp->window, OBJ2CHTYPE(ch));
return Qnil;
}
|
#insertln ⇒ Object
2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 |
# File 'ext/curses/curses.c', line 2693
static VALUE
window_insertln(VALUE obj)
{
#if defined(HAVE_WINSERTLN) || defined(winsertln)
struct windata *winp;
GetWINDOW(obj, winp);
winsertln(winp->window);
#endif
return Qnil;
}
|
#keypad(val) ⇒ Object
3142 3143 3144 3145 3146 3147 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 |
# File 'ext/curses/curses.c', line 3142
static VALUE
window_keypad(VALUE obj, VALUE val)
{
struct windata *winp;
GetWINDOW(obj,winp);
/* keypad() of NetBSD's libcurses returns no value */
#if defined(__NetBSD__) && !defined(NCURSES_VERSION)
keypad(winp->window,(RTEST(val) ? TRUE : FALSE));
return Qnil;
#else
/* may have to raise exception on ERR */
return (keypad(winp->window,RTEST(val) ? TRUE : FALSE)) == OK ?
Qtrue : Qfalse;
#endif
}
|
#keypad=(val) ⇒ Object
3142 3143 3144 3145 3146 3147 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 |
# File 'ext/curses/curses.c', line 3142
static VALUE
window_keypad(VALUE obj, VALUE val)
{
struct windata *winp;
GetWINDOW(obj,winp);
/* keypad() of NetBSD's libcurses returns no value */
#if defined(__NetBSD__) && !defined(NCURSES_VERSION)
keypad(winp->window,(RTEST(val) ? TRUE : FALSE));
return Qnil;
#else
/* may have to raise exception on ERR */
return (keypad(winp->window,RTEST(val) ? TRUE : FALSE)) == OK ?
Qtrue : Qfalse;
#endif
}
|
#line_touched?(line) ⇒ Object
2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 |
# File 'ext/curses/curses.c', line 2201
static VALUE
window_line_touched(VALUE obj, VALUE line)
{
struct windata *winp;
int result, n;
GetWINDOW(obj, winp);
n = NUM2INT(line);
result = is_linetouched(winp->window, n);
if (result == ERR) {
rb_raise(rb_eArgError, "Invalid line %d", n);
}
return result ? Qtrue : Qfalse;
}
|
#maxx ⇒ Object
2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 |
# File 'ext/curses/curses.c', line 2338
static VALUE
window_maxx(VALUE obj)
{
struct windata *winp;
GetWINDOW(obj, winp);
#if defined(getmaxx)
return INT2FIX(getmaxx(winp->window));
#elif defined(getmaxyx)
{
int x, RB_UNUSED_VAR(y);
getmaxyx(winp->window, y, x);
return INT2FIX(x);
}
#else
return INT2FIX(winp->window->_maxx+1);
#endif
}
|
#maxy ⇒ Object
2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 |
# File 'ext/curses/curses.c', line 2314
static VALUE
window_maxy(VALUE obj)
{
struct windata *winp;
GetWINDOW(obj, winp);
#if defined(getmaxy)
return INT2FIX(getmaxy(winp->window));
#elif defined(getmaxyx)
{
int RB_UNUSED_VAR(x), y;
getmaxyx(winp->window, y, x);
return INT2FIX(y);
}
#else
return INT2FIX(winp->window->_maxy+1);
#endif
}
|
#move(y, x) ⇒ Object
2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 |
# File 'ext/curses/curses.c', line 2225
static VALUE
window_move(VALUE obj, VALUE y, VALUE x)
{
struct windata *winp;
GetWINDOW(obj, winp);
mvwin(winp->window, NUM2INT(y), NUM2INT(x));
return Qnil;
}
|
#move_relative(y, x) ⇒ Object
2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 |
# File 'ext/curses/curses.c', line 2244
static VALUE
window_move_relative(VALUE obj, VALUE y, VALUE x)
{
struct windata *winp;
GetWINDOW(obj, winp);
mvderwin(winp->window, NUM2INT(y), NUM2INT(x));
return Qnil;
}
|
#nodelay=(val) ⇒ Object
3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 |
# File 'ext/curses/curses.c', line 3175
static VALUE
window_nodelay(VALUE obj, VALUE val)
{
struct windata *winp;
GetWINDOW(obj,winp);
/* nodelay() of NetBSD's libcurses returns no value */
#if defined(__NetBSD__) && !defined(NCURSES_VERSION)
nodelay(winp->window, RTEST(val) ? TRUE : FALSE);
return Qnil;
#else
return nodelay(winp->window,RTEST(val) ? TRUE : FALSE) == OK ? Qtrue : Qfalse;
#endif
}
|
#noutrefresh ⇒ Object
2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 |
# File 'ext/curses/curses.c', line 2065
static VALUE
window_noutrefresh(VALUE obj)
{
struct windata *winp;
GetWINDOW(obj, winp);
#ifdef HAVE_DOUPDATE
wnoutrefresh(winp->window);
#else
wrefresh(winp->window);
#endif
return Qnil;
}
|
#redraw ⇒ Object
2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 |
# File 'ext/curses/curses.c', line 2086
static VALUE
window_redraw(VALUE obj)
{
struct windata *winp;
GetWINDOW(obj, winp);
redrawwin(winp->window);
return Qnil;
}
|
#refresh ⇒ Object
2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 |
# File 'ext/curses/curses.c', line 2046
static VALUE
window_refresh(VALUE obj)
{
struct windata *winp;
GetWINDOW(obj, winp);
wrefresh(winp->window);
return Qnil;
}
|
#resize(lin, col) ⇒ Object
3100 3101 3102 3103 3104 3105 3106 3107 3108 3109 3110 3111 |
# File 'ext/curses/curses.c', line 3100
static VALUE
window_resize(VALUE obj, VALUE lin, VALUE col)
{
#if defined(HAVE_WRESIZE)
struct windata *winp;
GetWINDOW(obj,winp);
return wresize(winp->window, NUM2INT(lin), NUM2INT(col)) == OK ? Qtrue : Qfalse;
#else
return Qnil;
#endif
}
|
#scrl(n) ⇒ Object
2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 |
# File 'ext/curses/curses.c', line 2846
static VALUE
window_scrl(VALUE obj, VALUE n)
{
#ifdef HAVE_WSCRL
struct windata *winp;
GetWINDOW(obj, winp);
/* may have to raise exception on ERR */
return (wscrl(winp->window,NUM2INT(n)) == OK) ? Qtrue : Qfalse;
#else
return Qfalse;
#endif
}
|
#scroll ⇒ Object
2824 2825 2826 2827 2828 2829 2830 2831 2832 |
# File 'ext/curses/curses.c', line 2824
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(bf) ⇒ Object
2720 2721 2722 2723 2724 2725 2726 2727 2728 |
# File 'ext/curses/curses.c', line 2720
static VALUE
window_scrollok(VALUE obj, VALUE bf)
{
struct windata *winp;
GetWINDOW(obj, winp);
scrollok(winp->window, RTEST(bf) ? TRUE : FALSE);
return Qnil;
}
|
#setpos(y, x) ⇒ Object
2267 2268 2269 2270 2271 2272 2273 2274 2275 |
# File 'ext/curses/curses.c', line 2267
static VALUE
window_setpos(VALUE obj, VALUE y, VALUE x)
{
struct windata *winp;
GetWINDOW(obj, winp);
wmove(winp->window, NUM2INT(y), NUM2INT(x));
return Qnil;
}
|
#setscrreg(top, bottom) ⇒ Object
2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 |
# File 'ext/curses/curses.c', line 2770
static VALUE
window_setscrreg(VALUE obj, VALUE top, VALUE bottom)
{
#ifdef HAVE_WSETSCRREG
struct windata *winp;
int res;
GetWINDOW(obj, winp);
res = wsetscrreg(winp->window, NUM2INT(top), NUM2INT(bottom));
/* may have to raise exception on ERR */
return (res == OK) ? Qtrue : Qfalse;
#else
return Qfalse;
#endif
}
|
#standend ⇒ Object
2471 2472 2473 2474 2475 2476 2477 2478 2479 |
# File 'ext/curses/curses.c', line 2471
static VALUE
window_standend(VALUE obj)
{
struct windata *winp;
GetWINDOW(obj, winp);
wstandend(winp->window);
return Qnil;
}
|
#standout ⇒ Object
2452 2453 2454 2455 2456 2457 2458 2459 2460 |
# File 'ext/curses/curses.c', line 2452
static VALUE
window_standout(VALUE obj)
{
struct windata *winp;
GetWINDOW(obj, winp);
wstandout(winp->window);
return Qnil;
}
|
#subwin(height, width, top, left) ⇒ Object
1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 |
# File 'ext/curses/curses.c', line 1920
static VALUE
window_subwin(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, 0);
return win;
}
|
#timeout=(delay) ⇒ Object
3204 3205 3206 3207 3208 3209 3210 3211 3212 |
# File 'ext/curses/curses.c', line 3204
static VALUE
window_timeout(VALUE obj, VALUE delay)
{
struct windata *winp;
GetWINDOW(obj,winp);
wtimeout(winp->window,NUM2INT(delay));
return Qnil;
}
|
#touch ⇒ Object
2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 |
# File 'ext/curses/curses.c', line 2106
static VALUE
window_touch(VALUE obj)
{
struct windata *winp;
GetWINDOW(obj, winp);
touchwin(winp->window);
return Qnil;
}
|
#touch_line(*args) ⇒ Object
2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 |
# File 'ext/curses/curses.c', line 2167
static VALUE
window_touch_line(int argc, VALUE *argv, VALUE obj)
{
struct windata *winp;
VALUE y, n, changed;
int result;
rb_scan_args(argc, argv, "12", &y, &n, &changed);
if (argc < 2) {
n = INT2NUM(1);
}
if (argc < 3) {
changed = Qtrue;
}
GetWINDOW(obj, winp);
result = wtouchln(winp->window, NUM2INT(y), NUM2INT(n), RTEST(changed));
if (result == ERR) {
rb_raise(rb_eRangeError, "Out of window");
}
return Qnil;
}
|
#touched? ⇒ Object
2147 2148 2149 2150 2151 2152 2153 2154 |
# File 'ext/curses/curses.c', line 2147
static VALUE
window_touched(VALUE obj)
{
struct windata *winp;
GetWINDOW(obj, winp);
return is_wintouched(winp->window) ? Qtrue : Qfalse;
}
|
#untouch ⇒ Object
2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 |
# File 'ext/curses/curses.c', line 2127
static VALUE
window_untouch(VALUE obj)
{
struct windata *winp;
GetWINDOW(obj, winp);
untouchwin(winp->window);
return Qnil;
}
|