Class: Curses::Item
- Inherits:
-
Object
- Object
- Curses::Item
- Defined in:
- ext/curses/curses.c
Instance Method Summary collapse
- #==(other) ⇒ Object
- #description ⇒ Object
-
#initialize(name, description) ⇒ Object
constructor
call-seq: new(name, description).
- #name ⇒ Object
-
#opts ⇒ Object
call-seq: opts.
-
#opts_off(opts) ⇒ Object
call-seq: opts_off(opts).
-
#opts_on(opts) ⇒ Object
call-seq: opts_on(opts).
-
#set_opts(opts) ⇒ Object
call-seq: set_opts(opts).
Constructor Details
#initialize(name, description) ⇒ Object
call-seq:
new(name, description)
Construct a new Curses::Item.
3269 3270 3271 3272 3273 3274 3275 3276 3277 3278 3279 3280 3281 3282 3283 3284 3285 3286 3287 3288 |
# File 'ext/curses/curses.c', line 3269
static VALUE
item_initialize(VALUE obj, VALUE name, VALUE description)
{
struct itemdata *itemp;
curses_init_screen(Qnil);
TypedData_Get_Struct(obj, struct itemdata, &itemdata_type, itemp);
if (itemp->item) {
rb_raise(rb_eRuntimeError, "already initialized item");
}
name = rb_str_export_to_enc(name, terminal_encoding);
description = rb_str_export_to_enc(description, terminal_encoding);
itemp->item = new_item(StringValueCStr(name),
StringValueCStr(description));
if (itemp->item == NULL) {
check_curses_error(errno);
}
return obj;
}
|
Instance Method Details
#==(other) ⇒ Object
3301 3302 3303 3304 3305 3306 3307 3308 3309 |
# File 'ext/curses/curses.c', line 3301
static VALUE
item_eq(VALUE obj, VALUE other)
{
struct itemdata *item1, *item2;
GetITEM(obj, item1);
GetITEM(other, item2);
return item1->item == item2->item ? Qtrue : Qfalse;
}
|
#description ⇒ Object
3322 3323 3324 3325 3326 3327 3328 3329 3330 3331 |
# File 'ext/curses/curses.c', line 3322
static VALUE
item_description_m(VALUE obj)
{
struct itemdata *itemp;
const char *desc;
GetITEM(obj, itemp);
desc = item_description(itemp->item);
return rb_external_str_new_with_enc(desc, strlen(desc), terminal_encoding);
}
|
#name ⇒ Object
3311 3312 3313 3314 3315 3316 3317 3318 3319 3320 |
# File 'ext/curses/curses.c', line 3311
static VALUE
item_name_m(VALUE obj)
{
struct itemdata *itemp;
const char *name;
GetITEM(obj, itemp);
name = item_name(itemp->item);
return rb_external_str_new_with_enc(name, strlen(name), terminal_encoding);
}
|
#opts ⇒ Object
call-seq:
opts
Get the current option bits of the item.
3401 3402 3403 3404 3405 3406 3407 3408 |
# File 'ext/curses/curses.c', line 3401
static VALUE
item_opts_m(VALUE obj)
{
struct itemdata *itemp;
GetITEM(obj, itemp);
return INT2NUM(item_opts(itemp->item));
}
|
#opts_off(opts) ⇒ Object
call-seq:
opts_off(opts)
Turn off the option bits of the item.
3381 3382 3383 3384 3385 3386 3387 3388 3389 3390 3391 |
# File 'ext/curses/curses.c', line 3381
static VALUE
item_opts_off_m(VALUE obj, VALUE opts)
{
struct itemdata *itemp;
int error;
GetITEM(obj, itemp);
error = item_opts_off(itemp->item, NUM2INT(opts));
check_curses_error(error);
return obj;
}
|
#opts_on(opts) ⇒ Object
call-seq:
opts_on(opts)
Turn on the option bits of the item.
3361 3362 3363 3364 3365 3366 3367 3368 3369 3370 3371 |
# File 'ext/curses/curses.c', line 3361
static VALUE
item_opts_on_m(VALUE obj, VALUE opts)
{
struct itemdata *itemp;
int error;
GetITEM(obj, itemp);
error = item_opts_on(itemp->item, NUM2INT(opts));
check_curses_error(error);
return obj;
}
|
#set_opts(opts) ⇒ Object
call-seq:
set_opts(opts)
Set the option bits of the item.
3341 3342 3343 3344 3345 3346 3347 3348 3349 3350 3351 |
# File 'ext/curses/curses.c', line 3341
static VALUE
item_set_opts(VALUE obj, VALUE opts)
{
struct itemdata *itemp;
int error;
GetITEM(obj, itemp);
error = set_item_opts(itemp->item, NUM2INT(opts));
check_curses_error(error);
return obj;
}
|