Class: Newt::Widget
- Inherits:
-
Object
show all
- Defined in:
- ext/ruby_newt/ruby_newt.c
Direct Known Subclasses
Button, Checkbox, CheckboxTree, CompactButton, Entry, Form, Grid, Label, Listbox, RadioButton, Scale, Textbox
Instance Method Summary
collapse
Instance Method Details
#==(obj) ⇒ Object
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
|
# File 'ext/ruby_newt/ruby_newt.c', line 734
static VALUE rb_ext_Widget_equal(VALUE self, VALUE obj)
{
newtComponent co, cco;
void *data;
if (NIL_P(obj)) return Qfalse;
if (self == obj) return Qtrue;
if (rb_obj_is_kind_of(obj, cWidget) || rb_obj_is_kind_of(obj, cExitStruct)) {
Get_Widget_Data(self, data);
co = ((Widget_data *) data)->co;
if (rb_obj_is_kind_of(obj, cExitStruct)) {
Data_Get_Struct(obj, rb_newt_ExitStruct, data);
if (co == (((rb_newt_ExitStruct *) data)->es.u.co))
return Qtrue;
} else {
Get_Widget_Data(obj, data);
cco = ((Widget_data *) data)->co;
if (co == cco) return Qtrue;
}
}
return Qfalse;
}
|
#callback(*args) ⇒ Object
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
|
# File 'ext/ruby_newt/ruby_newt.c', line 685
static VALUE rb_ext_Widget_callback(int argc, VALUE *argv, VALUE self)
{
newtComponent co;
VALUE cb, data = Qnil;
if (argc < 1 || argc > 2)
ARG_ERROR(argc, "1 or 2");
INIT_GUARD();
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_cvar_set(self, CVAR_WIDGET_CALLBACK, cb);
newtComponentAddCallback(co, rb_ext_Widget_callback_function, (void *) cb);
return Qnil;
}
|
#get_position ⇒ Object
714
715
716
717
718
719
720
721
722
|
# File 'ext/ruby_newt/ruby_newt.c', line 714
static VALUE rb_ext_Widget_GetPosition(VALUE self)
{
newtComponent co;
int left, top;
Get_newtComponent(self, co);
newtComponentGetPosition(co, &left, &top);
return rb_ary_new_from_args(2, INT2NUM(left), INT2NUM(top));
}
|
#get_size ⇒ Object
724
725
726
727
728
729
730
731
732
|
# File 'ext/ruby_newt/ruby_newt.c', line 724
static VALUE rb_ext_Widget_GetSize(VALUE self)
{
newtComponent co;
int width, height;
Get_newtComponent(self, co);
newtComponentGetSize(co, &width, &height);
return rb_ary_new_from_args(2, INT2NUM(width), INT2NUM(height));
}
|
#inspect ⇒ Object
758
759
760
761
762
763
764
765
766
767
768
769
|
# File 'ext/ruby_newt/ruby_newt.c', line 758
static VALUE rb_ext_Widget_inspect(VALUE self)
{
newtComponent co;
void *data;
VALUE classname = rb_class_name(rb_obj_class(self));
char *class = StringValuePtr(classname);
Get_Widget_Data(self, data);
co = ((Widget_data *) data)->co;
return rb_sprintf("#<%s:%p component=%p>", class, (void *) self, co);
}
|
#takes_focus(index) ⇒ Object
705
706
707
708
709
710
711
712
|
# File 'ext/ruby_newt/ruby_newt.c', line 705
static VALUE rb_ext_Widget_takesFocus(VALUE self, VALUE index)
{
newtComponent co;
Get_newtComponent(self, co);
newtComponentTakesFocus(co, NUM2INT(index));
return Qnil;
}
|