static VALUE rb_ext_Entry_new(VALUE self, VALUE left, VALUE top, VALUE initialValue, VALUE width, VALUE flags) { newtComponent co; co = newtEntry(NUM2INT(left), NUM2INT(top), StringValuePtr(initialValue), NUM2INT(width), NULL, NUM2INT(flags)); return Data_Wrap_Struct(self, 0, 0, co); }
static VALUE rb_ext_Entry_GetValue(VALUE self) { newtComponent co; Data_Get_Struct(self, struct newtComponent_struct, co); return rb_str_new2(newtEntryGetValue(co)); }
static VALUE rb_ext_Entry_Set(VALUE self, VALUE value, VALUE cursorAtEnd) { newtComponent co; Data_Get_Struct(self, struct newtComponent_struct, co); switch(TYPE(cursorAtEnd)) { case T_TRUE: newtEntrySet(co, StringValuePtr(value), 1); break; case T_FALSE: newtEntrySet(co, StringValuePtr(value), 0); break; case T_FIXNUM: newtEntrySet(co, StringValuePtr(value), NUM2INT(cursorAtEnd)); break; default: rb_raise(rb_eTypeError, "Boolean or Fixnum expected"); break; } return Qnil; }
static VALUE rb_ext_Entry_SetFlags(VALUE self, VALUE args) { newtComponent co; long len; len = RARRAY_LEN(args); if (len == 1) { Data_Get_Struct(self, struct newtComponent_struct, co); newtEntrySetFlags(co, NUM2INT(RARRAY_PTR(args)[0]), NEWT_FLAGS_SET); } else if (len == 2) { Data_Get_Struct(self, struct newtComponent_struct, co); newtEntrySetFlags(co, NUM2INT(RARRAY_PTR(args)[0]), NUM2INT(RARRAY_PTR(args)[1])); } else { rb_raise(rb_eArgError, "1 argument or 2 arguments required"); } return Qnil; }