Class: Newt::Checkbox

Inherits:
Widget
  • Object
show all
Defined in:
ext/ruby_newt/ruby_newt.c

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Widget

#==, #callback, #get_position, #get_size, #inspect, #takes_focus

Class Method Details

.new(*args) ⇒ Object



904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
# File 'ext/ruby_newt/ruby_newt.c', line 904

static VALUE rb_ext_Checkbox_new(int argc, VALUE *argv, VALUE self)
{
  newtComponent co;
  const char *seq = NULL;
  char defValue = 0;

  if (argc < 3 || argc > 5)
    ARG_ERROR(argc, "3..5");

  INIT_GUARD();
  if (argc > 3 && !NIL_P(argv[3]))
    defValue = StringValuePtr(argv[3])[0];

  if (argc == 5 && !NIL_P(argv[4]) && RSTRING_LEN(argv[4]) > 0)
    seq = StringValuePtr(argv[4]);

  co = newtCheckbox(NUM2INT(argv[0]), NUM2INT(argv[1]), StringValuePtr(argv[2]), defValue, seq, NULL);
  return Make_Widget(self, co);
}

Instance Method Details

#getObject



924
925
926
927
928
929
930
931
932
933
# File 'ext/ruby_newt/ruby_newt.c', line 924

static VALUE rb_ext_Checkbox_GetValue(VALUE self)
{
  newtComponent co;
  char value[2];

  Get_newtComponent(self, co);
  value[0] = newtCheckboxGetValue(co);
  value[1] = '\0';
  return rb_str_new2(value);
}

#set(value) ⇒ Object



935
936
937
938
939
940
941
942
943
944
# File 'ext/ruby_newt/ruby_newt.c', line 935

static VALUE rb_ext_Checkbox_SetValue(VALUE self, VALUE value)
{
  newtComponent co;

  Get_newtComponent(self, co);
  if (RSTRING_LEN(value) > 0) {
    newtCheckboxSetValue(co, StringValuePtr(value)[0]);
  }
  return Qnil;
}

#set_flags(*args) ⇒ Object



946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
# File 'ext/ruby_newt/ruby_newt.c', line 946

static VALUE rb_ext_Checkbox_SetFlags(int argc, VALUE *argv, VALUE self)
{
  newtComponent co;
  int sense = NEWT_FLAGS_SET;

  if (argc < 1 || argc > 2)
    ARG_ERROR(argc, "1..2");

  if (argc == 2)
    sense = NUM2INT(argv[1]);

  Get_newtComponent(self, co);
  newtCheckboxSetFlags(co, NUM2INT(argv[0]), sense);
  return Qnil;
}