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



377
378
379
380
381
382
383
384
385
386
387
388
# File 'ext/ruby_newt/ruby_newt.c', line 377

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



346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
# File 'ext/ruby_newt/ruby_newt.c', line 346

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



368
369
370
371
372
373
374
375
# File 'ext/ruby_newt/ruby_newt.c', line 368

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;
}