class Newt::Entry
Public Class Methods
new(*args)
click to toggle source
static VALUE rb_ext_Entry_new(int argc, VALUE *argv, VALUE self) { newtComponent co; int flags; if (argc < 4 || argc > 5) ARG_ERROR(argc, "4..5"); INIT_GUARD(); flags = (argc == 5) ? NUM2INT(argv[4]) : 0; co = newtEntry(NUM2INT(argv[0]), NUM2INT(argv[1]), StringValuePtr(argv[2]), NUM2INT(argv[3]), NULL, flags); return Make_Widget(self, co); }
Public Instance Methods
get()
click to toggle source
static VALUE rb_ext_Entry_GetValue(VALUE self) { newtComponent co; Get_newtComponent(self, co); return rb_str_new2(newtEntryGetValue(co)); }
get_cursor_position()
click to toggle source
static VALUE rb_ext_Entry_GetCursorPosition(VALUE self) { newtComponent co; Get_newtComponent(self, co); return INT2NUM(newtEntryGetCursorPosition(co)); }
set(p1, p2)
click to toggle source
static VALUE rb_ext_Entry_Set(VALUE self, VALUE value, VALUE cursorAtEnd) { newtComponent co; Get_newtComponent(self, 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; }
set_colors(p1, p2)
click to toggle source
static VALUE rb_ext_Entry_SetColors(VALUE self, VALUE normal, VALUE disabled) { newtComponent co; Get_newtComponent(self, co); newtEntrySetColors(co, NUM2INT(normal), NUM2INT(disabled)); return Qnil; }
set_cursor_position(p1)
click to toggle source
static VALUE rb_ext_Entry_SetCursorPosition(VALUE self, VALUE position) { newtComponent co; Get_newtComponent(self, co); newtEntrySetCursorPosition(co, NUM2INT(position)); return Qnil; }
set_filter(*args)
click to toggle source
static VALUE rb_ext_Entry_SetFilter(int argc, VALUE *argv, VALUE self) { newtComponent co; VALUE cb, data = Qnil; if (argc < 1 || argc > 2) ARG_ERROR(argc, "1 or 2"); if (argc == 2) data = argv[1]; Get_newtComponent(self, co); cb = rb_struct_new(rb_ext_sCallback, self, rb_binding_new(), argv[0], data, NULL); rb_obj_freeze(cb); rb_ivar_set(self, IVAR_FILTER_CALLBACK, cb); newtEntrySetFilter(co, rb_ext_Entry_filter_function, (void *) cb); return Qnil; }
set_flags(*args)
click to toggle source
static VALUE rb_ext_Entry_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); newtEntrySetFlags(co, NUM2INT(argv[0]), sense); return Qnil; }