class Newt::Listbox

Public Class Methods

new(p1, p2, p3, p4) click to toggle source
static VALUE rb_ext_Listbox_new(VALUE self, VALUE left, VALUE top, VALUE height, VALUE flags)
{
  newtComponent co;

  co = newtListbox(NUM2INT(left), NUM2INT(top), NUM2INT(height), NUM2INT(flags));
  return Data_Wrap_Struct(self, 0, 0, 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;

  Data_Get_Struct(self, struct newtComponent_struct, co);

  switch(TYPE(data)) {
    case T_STRING:
      newtListboxAppendEntry(co, StringValuePtr(text), (void *)StringValuePtr(data));
      break;
    case T_FIXNUM:
      newtListboxAppendEntry(co, StringValuePtr(text), (void *)NUM2INT(data));
      break;
    default:
      rb_raise(rb_eTypeError, "String or Fixnum expected");
      break;
  }
  return Qnil;
}
clear() click to toggle source
static VALUE rb_ext_Listbox_Clear(VALUE self)
{
  newtComponent co;

  Data_Get_Struct(self, struct newtComponent_struct, co);

  newtListboxClear(co);
  return Qnil;
}
clearSelection() click to toggle source
static VALUE rb_ext_Listbox_ClearSelection(VALUE self)
{
  newtComponent co;

  Data_Get_Struct(self, struct newtComponent_struct, co);

  newtListboxClearSelection(co);
  return Qnil;
}
delete(p1) click to toggle source
static VALUE rb_ext_Listbox_DeleteEntry(VALUE self, VALUE data)
{
  newtComponent co;

  Data_Get_Struct(self, struct newtComponent_struct, co);

  switch(TYPE(data)) {
    case T_STRING:
      newtListboxDeleteEntry(co, (void *)StringValuePtr(data));
      break;
    case T_FIXNUM:
      newtListboxDeleteEntry(co, (void *)NUM2INT(data));
      break;
    default:
      rb_raise(rb_eTypeError, "String or Fixnum expected");
      break;
  }
  return Qnil;
}
get_current() click to toggle source
static VALUE rb_ext_Listbox_GetCurrentAsNumber(VALUE self)
{
  newtComponent co;

  Data_Get_Struct(self, struct newtComponent_struct, co);
  return INT2NUM((int *) newtListboxGetCurrent(co));
}
get_current_as_number() click to toggle source
static VALUE rb_ext_Listbox_GetCurrentAsNumber(VALUE self)
{
  newtComponent co;

  Data_Get_Struct(self, struct newtComponent_struct, co);
  return INT2NUM((int *) newtListboxGetCurrent(co));
}
get_current_as_string() click to toggle source
static VALUE rb_ext_Listbox_GetCurrentAsString(VALUE self)
{
  newtComponent co;

  Data_Get_Struct(self, struct newtComponent_struct, co);
  return rb_str_new2((char *) newtListboxGetCurrent(co));
}
insert(p1, p2, p3) click to toggle source
static VALUE rb_ext_Listbox_InsertEntry(VALUE self, VALUE text, VALUE data, VALUE key)
{
  newtComponent co;

  Data_Get_Struct(self, struct newtComponent_struct, co);

  switch(TYPE(data)) {
    case T_STRING:
      switch(TYPE(key)) {
        case T_STRING:
          newtListboxInsertEntry(co, StringValuePtr(text), (void *)StringValuePtr(data), (void *)StringValuePtr(key));
          break;
        case T_FIXNUM:
          newtListboxInsertEntry(co, StringValuePtr(text), (void *)StringValuePtr(data), (void *)NUM2INT(key));
          break;
        default:
          rb_raise(rb_eTypeError, "String or Fixnum expected");
          break;
      }
    case T_FIXNUM:
      switch(TYPE(key)) {
        case T_STRING:
          newtListboxInsertEntry(co, StringValuePtr(text), (void *)NUM2INT(data), (void *)StringValuePtr(key));
          break;
        case T_FIXNUM:
          newtListboxInsertEntry(co, StringValuePtr(text), (void *)NUM2INT(data), (void *)NUM2INT(key));
          break;
        default:
          rb_raise(rb_eTypeError, "String or Fixnum expected");
          break;
      }
      break;
    default:
      rb_raise(rb_eTypeError, "String or Fixnum expected");
      break;
  }
  return Qnil;
}
select(p1, p2) click to toggle source
static VALUE rb_ext_Listbox_SelectItem(VALUE self, VALUE key, VALUE sense)
{
  newtComponent co;

  Data_Get_Struct(self, struct newtComponent_struct, co);

  switch(TYPE(key)) {
    case T_STRING:
      newtListboxSelectItem(co, (void *)StringValuePtr(key), NUM2INT(sense));
      break;
    case T_FIXNUM:
      newtListboxSelectItem(co, (void *)NUM2INT(key), NUM2INT(sense));
      break;
    default:
      rb_raise(rb_eTypeError, "String or Fixnum expected");
      break;
  }
  return Qnil;
}
set(p1, p2) click to toggle source
static VALUE rb_ext_Listbox_SetEntry(VALUE self, VALUE num, VALUE text)
{
  newtComponent co;

  Data_Get_Struct(self, struct newtComponent_struct, co);
  newtListboxSetEntry(co, NUM2INT(num), StringValuePtr(text));
  return Qnil;
}
setCurrentByKey(p1) click to toggle source
static VALUE rb_ext_Listbox_SetCurrentByKey(VALUE self, VALUE key)
{
  newtComponent co;

  Data_Get_Struct(self, struct newtComponent_struct, co);

  switch(TYPE(key)) {
    case T_STRING:
      newtListboxSetCurrentByKey(co, (void *)StringValuePtr(key));
      break;
    case T_FIXNUM:
      newtListboxSetCurrentByKey(co, (void *)NUM2INT(key));
      break;
    default:
      rb_raise(rb_eTypeError, "String or Fixnum expected");
      break;
  }
  return Qnil;
}
setData(p1, p2) click to toggle source
static VALUE rb_ext_Listbox_SetData(VALUE self, VALUE num, VALUE data)
{
  newtComponent co;

  Data_Get_Struct(self, struct newtComponent_struct, co);

  switch(TYPE(data)) {
    case T_STRING:
      newtListboxSetData(co, NUM2INT(num), (void *)StringValuePtr(data));
      break;
    case T_FIXNUM:
      newtListboxSetData(co, NUM2INT(num), (void *)NUM2INT(data));
      break;
    default:
      rb_raise(rb_eTypeError, "String or Fixnum expected");
      break;
  }
  return Qnil;
}
set_current(p1) click to toggle source
static VALUE rb_ext_Listbox_SetCurrent(VALUE self, VALUE num)
{
  newtComponent co;

  Data_Get_Struct(self, struct newtComponent_struct, co);
  newtListboxSetCurrent(co, NUM2INT(num));
  return Qnil;
}
set_width(p1) click to toggle source
static VALUE rb_ext_Listbox_SetWidth(VALUE self, VALUE width)
{
  newtComponent co;

  Data_Get_Struct(self, struct newtComponent_struct, co);
  newtListboxSetWidth(co, NUM2INT(width));
  return Qnil;
}