Class: Newt::Widget

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

Instance Method Summary collapse

Instance Method Details

#==(widget) ⇒ Object



539
540
541
542
543
544
545
546
547
548
549
550
# File 'ext/ruby_newt/ruby_newt.c', line 539

static VALUE rb_ext_Widget_equal(VALUE self, VALUE widget)
{
  newtComponent co, co2;

  if (NIL_P(widget)) return Qfalse;
  if (self == widget) return Qtrue;

  Data_Get_Struct(self, struct newtComponent_struct, co);
  Data_Get_Struct(widget, struct newtComponent_struct, co2);
  if (co == co2) return Qtrue;
  return Qfalse;
}

#callback(argv[], self) ⇒ Object



508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
# File 'ext/ruby_newt/ruby_newt.c', line 508

static VALUE rb_ext_Widget_callback(int argc, VALUE argv[], VALUE self)
{
  newtComponent co;
  VALUE arg1, value;

  Data_Get_Struct(self, struct newtComponent_struct, co);
  switch(rb_scan_args(argc, argv, "01", &arg1)){
    case 0:
      value = rb_hash_aref(rb_ext_Widget_CALLBACK_HASH, self);
      break;
    case 1:
      rb_hash_aset(rb_ext_Widget_CALLBACK_HASH, self, arg1);
      newtComponentAddCallback(co, rb_ext_Widget_callback_function, (void*)arg1);
      value = Qnil;
      break;
    default:
      rb_bug("rb_ext_Widget_callback");
  };

  return value;
}

#takesFocus(index) ⇒ Object



530
531
532
533
534
535
536
537
# File 'ext/ruby_newt/ruby_newt.c', line 530

static VALUE rb_ext_Widget_takesFocus(VALUE self, VALUE index)
{
  newtComponent form;

  Data_Get_Struct(self, struct newtComponent_struct, form);
  newtComponentTakesFocus(form, NUM2INT(index));
  return Qnil;
}