1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68
|
VALUE rb_cWXRect;
namespace RubyWX {
namespace Rect {
VALUE _alloc(VALUE self)
{
return wrap(new wxRect());
}
/*
* call-seq:
* inspect -> String
*
* Human-readable description.
* ===Return value
* String
*/
VALUE _inspect(VALUE self)
{
return rb_sprintf( "%s(%d, %d, %d, %d)",
rb_obj_classname( self ),
FIX2INT(_getX(self)),
FIX2INT(_getY(self)),
FIX2INT(_getWidth(self)),
FIX2INT(_getHeight(self)));
}
} // namespace Rect
} // namespace RubyWX
/*
* call-seq:
* hello_world -> String
*
* Human-readable description.
* ===Return value
* String
*/
VALUE _hello_world(VALUE self)
{
return rb_sprintf( "%s(%d, %d, %d, %d)",
rb_obj_classname( self ),
FIX2INT(_getX(self)),
FIX2INT(_getY(self)),
FIX2INT(_getWidth(self)),
FIX2INT(_getHeight(self)));
}
/* Arrays are ordered, integer-indexed collections of any object.
* Array indexing starts at 0, as in C or Java. A negative index is
* assumed to be relative to the end of the array---that is, an index of -1
* indicates the last element of the array, -2 is the next to last
* element in the array, and so on.
*/
void Init_Rect()
{
using namespace RubyWX::Rect;
rb_cWXRect = rb_define_class("Rect",rb_cObject);
rb_define_alloc_func(rb_cWXRect,_alloc);
rb_define_method(rb_cWXRect,"inspect",RUBY_METHOD_FUNC(_inspect),0);
rb_define_method(rb_cWXRect,"hello_world",RUBY_METHOD_FUNC(_hello_world),0);
}
|