class Newt::Listbox
Public Class Methods
new(*args)
click to toggle source
static VALUE rb_ext_Listbox_new(int argc, VALUE *argv, VALUE self)
{
newtComponent co;
int flags;
if (argc < 3 || argc > 4)
ARG_ERROR(argc, "3..4");
INIT_GUARD();
flags = (argc == 4) ? NUM2INT(argv[3]) : 0;
co = newtListbox(NUM2INT(argv[0]), NUM2INT(argv[1]), NUM2INT(argv[2]), flags);
return Make_Widget(self, co);
}
Public Instance Methods
append(p1, p2)
click to toggle source
static VALUE rb_ext_Listbox_AppendEntry(VALUE self, VALUE text, VALUE data)
{
newtComponent co;
Get_newtComponent(self, co);
Data_Attach(self, data);
newtListboxAppendEntry(co, StringValuePtr(text), (void *) data);
return Qnil;
}
clear()
click to toggle source
static VALUE rb_ext_Listbox_Clear(VALUE self)
{
newtComponent co;
Get_newtComponent(self, co);
newtListboxClear(co);
return Qnil;
}
clear_selection()
click to toggle source
static VALUE rb_ext_Listbox_ClearSelection(VALUE self)
{
newtComponent co;
Get_newtComponent(self, co);
newtListboxClearSelection(co);
return Qnil;
}
delete(p1)
click to toggle source
static VALUE rb_ext_Listbox_DeleteEntry(VALUE self, VALUE data)
{
newtComponent co;
Get_newtComponent(self, co);
newtListboxDeleteEntry(co, (void *) data);
return Qnil;
}
get(p1)
click to toggle source
static VALUE rb_ext_Listbox_GetEntry(VALUE self, VALUE num)
{
char *text; void *data;
newtComponent co;
Get_newtComponent(self, co);
newtListboxGetEntry(co, NUM2INT(num), &text, &data);
return rb_ary_new_from_args(2, rb_str_new2(text), (VALUE *) data);
}
get_current()
click to toggle source
static VALUE rb_ext_Listbox_GetCurrent(VALUE self)
{
newtComponent co;
Get_newtComponent(self, co);
return (VALUE) newtListboxGetCurrent(co);
}
get_selection()
click to toggle source
static VALUE rb_ext_Listbox_GetSelection(VALUE self)
{
newtComponent co;
VALUE ary, item;
void **items;
int i, numitems = 0;
Get_newtComponent(self, co);
items = newtListboxGetSelection(co, &numitems);
ary = rb_ary_new();
for (i = 0; i < numitems; i++) {
item = (VALUE) items[i];
rb_ary_push(ary, item);
}
return ary;
}
insert(p1, p2, p3)
click to toggle source
static VALUE rb_ext_Listbox_InsertEntry(VALUE self, VALUE text, VALUE data, VALUE key)
{
newtComponent co;
Get_newtComponent(self, co);
Data_Attach(self, data);
newtListboxInsertEntry(co, StringValuePtr(text), (void *) data, (void *) key);
return Qnil;
}
item_count()
click to toggle source
static VALUE rb_ext_Listbox_ItemCount(VALUE self)
{
newtComponent co;
Get_newtComponent(self, co);
return INT2NUM(newtListboxItemCount(co));
}
select(p1, p2)
click to toggle source
static VALUE rb_ext_Listbox_SelectItem(VALUE self, VALUE key, VALUE sense)
{
newtComponent co;
Get_newtComponent(self, co);
newtListboxSelectItem(co, (void *) key, NUM2INT(sense));
return Qnil;
}
set(p1, p2)
click to toggle source
static VALUE rb_ext_Listbox_SetEntry(VALUE self, VALUE num, VALUE text)
{
newtComponent co;
Get_newtComponent(self, co);
newtListboxSetEntry(co, NUM2INT(num), StringValuePtr(text));
return Qnil;
}
set_current(p1)
click to toggle source
static VALUE rb_ext_Listbox_SetCurrent(VALUE self, VALUE num)
{
newtComponent co;
Get_newtComponent(self, co);
newtListboxSetCurrent(co, NUM2INT(num));
return Qnil;
}
set_current_by_key(p1)
click to toggle source
static VALUE rb_ext_Listbox_SetCurrentByKey(VALUE self, VALUE key)
{
newtComponent co;
Get_newtComponent(self, co);
newtListboxSetCurrentByKey(co, (void *) key);
return Qnil;
}
set_data(p1, p2)
click to toggle source
static VALUE rb_ext_Listbox_SetData(VALUE self, VALUE num, VALUE data)
{
newtComponent co;
Get_newtComponent(self, co);
Data_Attach(self, data);
newtListboxSetData(co, NUM2INT(num), (void *) data);
return Qnil;
}
set_width(p1)
click to toggle source
static VALUE rb_ext_Listbox_SetWidth(VALUE self, VALUE width)
{
newtComponent co;
Get_newtComponent(self, co);
newtListboxSetWidth(co, NUM2INT(width));
return Qnil;
}