Class: Curses::Window

Inherits:
Data
  • Object
show all
Defined in:
curses.c

Instance Method Summary collapse

Constructor Details

#initializeObject

def initialize(h, w, top, left)



770
771
772
# File 'curses.c', line 770

static VALUE
window_initialize(obj, h, w, top, left)
VALUE obj;

Instance Method Details

#<<Object

def <<(str)



1133
1134
1135
# File 'curses.c', line 1133

static VALUE
window_addstr2(obj, str)
VALUE obj;

#addchObject

def addch(ch)



1090
1091
1092
# File 'curses.c', line 1090

static VALUE
window_addch(obj, ch)
VALUE obj;

#addstrObject

def addstr(str)



1118
1119
1120
# File 'curses.c', line 1118

static VALUE
window_addstr(obj, str)
VALUE obj;

#attroff(attrs) ⇒ Object



1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
# File 'curses.c', line 1285

static VALUE
window_attroff(VALUE obj, VALUE attrs)
{
#ifdef HAVE_WATTROFF
  struct windata *winp;

  GetWINDOW(obj,winp);
  return INT2FIX(wattroff(winp->window,NUM2INT(attrs)));
#else
  return Qtrue;
#endif
}

#attron(attrs) ⇒ Object



1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
# File 'curses.c', line 1298

static VALUE
window_attron(VALUE obj, VALUE attrs)
{
#ifdef HAVE_WATTRON
  struct windata *winp;
  VALUE val;

  GetWINDOW(obj,winp);
  val = INT2FIX(wattron(winp->window,NUM2INT(attrs)));
  if( rb_block_given_p() ){
    rb_yield(val);
    wattroff(winp->window,NUM2INT(attrs));
    return val;
  }
  else{
    return val;
  }
#else
  return Qtrue;
#endif
}

#attrset(attrs) ⇒ Object



1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
# File 'curses.c', line 1320

static VALUE
window_attrset(VALUE obj, VALUE attrs)
{
#ifdef HAVE_WATTRSET
  struct windata *winp;

  GetWINDOW(obj,winp);
  return INT2FIX(wattrset(winp->window,NUM2INT(attrs)));
#else
  return Qtrue;
#endif
}

#begxObject

def begx



1002
1003
1004
# File 'curses.c', line 1002

static VALUE
window_begx(obj)
VALUE obj;

#begyObject

def begy



985
986
987
# File 'curses.c', line 985

static VALUE
window_begy(obj)
VALUE obj;

#bkgd(ch) ⇒ Object



1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
# File 'curses.c', line 1345

static VALUE
window_bkgd(VALUE obj, VALUE ch)
{
#ifdef HAVE_WBKGD
  struct windata *winp;

  GetWINDOW(obj,winp);
  return (wbkgd(winp->window, NUM2CH(ch)) == OK) ? Qtrue : Qfalse;
#else
  return Qfalse;
#endif
}

#bkgdset(ch) ⇒ Object



1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
# File 'curses.c', line 1333

static VALUE
window_bkgdset(VALUE obj, VALUE ch)
{
#ifdef HAVE_WBKGDSET
  struct windata *winp;

  GetWINDOW(obj,winp);
  wbkgdset(winp->window, NUM2CH(ch));
#endif
  return Qnil;
}

#boxObject

def box(vert, hor)



1019
1020
1021
# File 'curses.c', line 1019

static VALUE
window_box(argc, argv, self)
int argc;

#clearObject

def clear



832
833
834
# File 'curses.c', line 832

static VALUE
window_clear(obj)
VALUE obj;

#closeObject

def close



818
819
820
# File 'curses.c', line 818

static VALUE
window_close(obj)
VALUE obj;

#clrtoeolObject

def clrtoeol



845
846
847
# File 'curses.c', line 845

static VALUE
window_clrtoeol(obj)
VALUE obj;

#color_set(col) ⇒ Object



1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
# File 'curses.c', line 1249

static VALUE
window_color_set(VALUE obj, VALUE col) 
{
  struct windata *winp;
  int res;

  GetWINDOW(obj, winp);
  res = wcolor_set(winp->window, NUM2INT(col), NULL);
  return (res == OK) ? Qtrue : Qfalse;
}

#curxObject

def curx



930
931
932
# File 'curses.c', line 930

static VALUE
window_curx(obj)
VALUE obj;

#curyObject

def cury



917
918
919
# File 'curses.c', line 917

static VALUE
window_cury(obj)
VALUE obj;

#delchObject

def delch



1173
1174
1175
# File 'curses.c', line 1173

static VALUE
window_delch(obj)
VALUE obj;

#deletelnObject

def delelteln



1185
1186
1187
# File 'curses.c', line 1185

static VALUE
window_deleteln(obj)
VALUE obj;

#getbkgdObject



1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
# File 'curses.c', line 1358

static VALUE
window_getbkgd(VALUE obj)
{
#ifdef HAVE_WGETBKGD
  chtype c;
  struct windata *winp;

  GetWINDOW(obj,winp);
  return (c = getbkgd(winp->window) != ERR) ? CH2FIX(c) : Qnil;
#else
  return Qnil;
#endif
}

#getchObject

def getch



1143
1144
1145
# File 'curses.c', line 1143

static VALUE
window_getch(obj)
VALUE obj;

#getstrObject

def getstr



1155
1156
1157
# File 'curses.c', line 1155

static VALUE
window_getstr(obj)
VALUE obj;

#idlok(bf) ⇒ Object



1222
1223
1224
1225
1226
1227
1228
1229
1230
# File 'curses.c', line 1222

static VALUE
window_idlok(VALUE obj, VALUE bf)
{
  struct windata *winp;

  GetWINDOW(obj, winp);
  idlok(winp->window, RTEST(bf) ? TRUE : FALSE);
  return Qnil;
}

#inchObject

def inch



1079
1080
1081
# File 'curses.c', line 1079

static VALUE
window_inch(obj)
VALUE obj;

#inschObject

def insch(ch)



1104
1105
1106
# File 'curses.c', line 1104

static VALUE
window_insch(obj, ch)
VALUE obj;

#insertlnObject

def insertln



1199
1200
1201
# File 'curses.c', line 1199

static VALUE
window_insertln(obj)
VALUE obj;

#keypad(val) ⇒ Object



1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
# File 'curses.c', line 1386

static VALUE
window_keypad(VALUE obj, VALUE val)
{
#ifdef HAVE_KEYPAD
  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
#else
    rb_notimplement();
#endif /* HAVE_KEYPAD */
}

#keypad=(val) ⇒ Object



1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
# File 'curses.c', line 1386

static VALUE
window_keypad(VALUE obj, VALUE val)
{
#ifdef HAVE_KEYPAD
  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
#else
    rb_notimplement();
#endif /* HAVE_KEYPAD */
}

#maxxObject

def maxx



964
965
966
# File 'curses.c', line 964

static VALUE
window_maxx(obj)
VALUE obj;

#maxyObject

def maxy



943
944
945
# File 'curses.c', line 943

static VALUE
window_maxy(obj)
VALUE obj;

#moveObject

def move(y, x)



888
889
890
# File 'curses.c', line 888

static VALUE
window_move(obj, y, x)
VALUE obj;

#nodelay=(val) ⇒ Object



1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
# File 'curses.c', line 1407

static VALUE
window_nodelay(VALUE obj, VALUE val)
{
#ifdef HAVE_NODELAY
  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
#else
    rb_notimplement();
#endif
}

#noutrefreshObject

def noutrefresh



871
872
873
# File 'curses.c', line 871

static VALUE
window_noutrefresh(obj)
VALUE obj;

#refreshObject

def refresh



858
859
860
# File 'curses.c', line 858

static VALUE
window_refresh(obj)
VALUE obj;

#resize(lin, col) ⇒ Object



1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
# File 'curses.c', line 1372

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



1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
# File 'curses.c', line 1271

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
}

#scrollObject



1261
1262
1263
1264
1265
1266
1267
1268
1269
# File 'curses.c', line 1261

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



1212
1213
1214
1215
1216
1217
1218
1219
1220
# File 'curses.c', line 1212

static VALUE
window_scrollok(VALUE obj, VALUE bf)
{
  struct windata *winp;

  GetWINDOW(obj, winp);
  scrollok(winp->window, RTEST(bf) ? TRUE : FALSE);
  return Qnil;
}

#setposObject

def setpos(y, x)



903
904
905
# File 'curses.c', line 903

static VALUE
window_setpos(obj, y, x)
VALUE obj;

#setscrreg(top, bottom) ⇒ Object



1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
# File 'curses.c', line 1232

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
}

#standendObject

def standend



1067
1068
1069
# File 'curses.c', line 1067

static VALUE
window_standend(obj)
VALUE obj;

#standoutObject

def standout



1055
1056
1057
# File 'curses.c', line 1055

static VALUE
window_standout(obj)
VALUE obj;

#subwinObject

def subwin(height, width, top, left)



793
794
795
# File 'curses.c', line 793

static VALUE
window_subwin(obj, height, width, top, left)
VALUE obj;

#timeout=(delay) ⇒ Object



1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
# File 'curses.c', line 1426

static VALUE
window_timeout(VALUE obj, VALUE delay)
{
#ifdef HAVE_WTIMEOUT
  struct windata *winp;
  GetWINDOW(obj,winp);

  wtimeout(winp->window,NUM2INT(delay));
  return Qnil;
#else
    rb_notimplement();
#endif
}