Class | Joyau::DrawableRect |
In: |
Drawable.cpp
|
Parent: | Joyau::FillableShape |
Creates a new DrawableRect.
/* call-seq: new() new(x, y [, w, h]) Creates a new DrawableRect. */ VALUE wrap<DrawableRect>(int argc, VALUE *argv, VALUE info) { DrawableRect *ptr = new DrawableRect; VALUE x1, y1, x2, y2; rb_scan_args(argc, argv, "04", &x1, &y1, &x2, &y2); if (!NIL_P(x1) && !NIL_P(y1)) { ptr->setPos(FIX2INT(x1), FIX2INT(y1)); if (argc >= 4) ptr->setCorner(FIX2INT(x2), FIX2INT(y2)); } VALUE tdata = Data_Wrap_Struct(info, 0, wrapped_free<DrawableRect>, ptr); return tdata; }
Sets the rect’s corner.
/* call-seq: corner=(point) Sets the rect's corner. */ VALUE DrawableRect_cornerOp(VALUE self, VALUE p) { DrawableRect &ref = getRef<DrawableRect>(self); Point &point = getRef<Point>(p); ref.setCorner(point.x, point.y); return p; }
Returns the rect’s second corner.
/* Returns the rect's second corner. */ VALUE DrawableRect_getCorner(VALUE self) { DrawableRect &ref = getRef<DrawableRect>(self); Point point = ref.getCorner(); return createObject(getClass("Point"), point); }
Sets the rect’s height.
/* call-seq: h=(height) Sets the rect's height. */ VALUE DrawableRect_setH(VALUE self, VALUE h) { DrawableRect &ref = getRef<DrawableRect>(self); ref.setH(FIX2INT(h)); return h; }
Resizes the rect.
/* call-seq: resize(w, h) Resizes the rect. */ VALUE DrawableRect_resize(VALUE self, VALUE w, VALUE h) { DrawableRect &ref = getRef<DrawableRect>(self); int _w = FIX2INT(w); int _h = FIX2INT(h); ref.resize(_w, _h); return Qnil; }