Class Joyau::DrawableRect
In: Drawable.cpp
Parent: Joyau::FillableShape

Drawable used when drawing rects.

Methods

corner   corner=   getCorner   h=   new   resize   setCorner   w=  

Public Class methods

Creates a new DrawableRect.

[Source]

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

Public Instance methods

corner()

Alias for getCorner

Sets the rect’s corner.

[Source]

/*
  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.

[Source]

/*
  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.

[Source]

/*
  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.

[Source]

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

Sets the rect’s corner.

[Source]

/*
  call-seq: setCorner(x, y)

  Sets the rect's corner.
*/
VALUE DrawableRect_setCorner(VALUE self, VALUE x, VALUE y)
{
   DrawableRect &ref = getRef<DrawableRect>(self);
   int _x = FIX2INT(x);
   int _y = FIX2INT(y);

   ref.setCorner(_x, _y);
   return Qnil;
}

Sets the rect’s width.

[Source]

/*
  call-seq: w=(width)

  Sets the rect's width.
*/
VALUE DrawableRect_setW(VALUE self, VALUE w)
{
   DrawableRect &ref = getRef<DrawableRect>(self);
   ref.setW(FIX2INT(w));

   return w;
}

[Validate]