Class Joyau::Message
In: Drawable.cpp
Parent: Joyau::Drawable

Class used when drawing message in message boxes. You can set backgrounds, images, fonts, … on them.

Methods

Public Instance methods

Returns the message’s background as a Sprite.

[Source]

/*
  Returns the message's background as a Sprite.
*/
VALUE Message_background(VALUE self)
{
   Message &ref = getRef<Message>(self);
   
   Sprite *img = ref.getBackground();
   if (img)
      return img->toRuby();
   return Qnil;
}
background=(p1)

Alias for setBackground

Returns the message’s background’s color.

[Source]

/*
  Returns the message's background's color.
*/
VALUE Message_bgColor(VALUE self)
{
   Message &ref = getRef<Message>(self);
   return col2hash(ref.getBgColor());
}
bgColor=(p1)

Alias for setBgColor

Returns the message’s border’s color.

[Source]

/*
  Returns the message's border's color.
*/
VALUE Message_borderColor(VALUE self)
{
   Message &ref = getRef<Message>(self);
   return col2hash(ref.getBorderColor());
}
borderColor=(p1)

Alias for setBorderColor

Sets the message’s height.

[Source]

/*
  call-seq: h=(val)

  Sets the message's height.
*/
VALUE Message_setH(VALUE self, VALUE h)
{
   Message &ref = getRef<Message>(self);
   ref.setH(FIX2INT(h));

   return h;
}

Returns the message’s image as a Sprite.

[Source]

/*
  Returns the message's image as a Sprite.
*/
VALUE Message_image(VALUE self)
{
   Message &ref = getRef<Message>(self);

   Sprite *img = ref.getImage();
   if (img)
      return img->toRuby();
   return Qnil;
}
image=(p1)

Alias for setImage

Resizes the messages.

[Source]

/*
  call-seq: resize(w, h)

  Resizes the messages.
*/
VALUE Message_resize(VALUE self, VALUE w, VALUE h)
{
   Message &ref = getRef<Message>(self);
   int _w = FIX2INT(w);
   int _h = FIX2INT(h);

   ref.resize(_w, _h);
   return Qnil;
}

Sets the image drawn under the message (the argument is a Sprite).

[Source]

/*
  call-seq: setBackground(pic)

  Sets the image drawn under the message (the argument is a Sprite).
*/
VALUE Message_setBackground(VALUE self, VALUE pic)
{
   Message &ref = getRef<Message>(self);
   Sprite *spr = getPtr<Sprite>(pic);
 
   ref.setBackground(spr);
   return pic;
}

Sets the message’s background’s color.

[Source]

/*
  call-seq: setBgColor(col)

  Sets the message's background's color.
*/
VALUE Message_setBgColor(VALUE self, VALUE col)
{
   Message &ref = getRef<Message>(self);
   OSL_COLOR color = hash2col(col);

   ref.setBgColor(color);
   return col;
}

Sets the message’s border’s color.

[Source]

/*
  call-seq: setBorderColor(col)

  Sets the message's border's color.
*/
VALUE Message_setBorderColor(VALUE self, VALUE col)
{
   Message &ref = getRef<Message>(self);
   OSL_COLOR color = hash2col(col);

   ref.setBorderColor(color);
   return col;
}

Sets the image drawn beside the message (the argument is a Sprite).

[Source]

/*
  call-seq: setImage(pic)

  Sets the image drawn beside the message (the argument is a Sprite).
*/
VALUE Message_setImage(VALUE self, VALUE pic)
{
   Message &ref = getRef<Message>(self);
   Sprite *spr = getPtr<Sprite>(pic);
   
   ref.setImage(spr);
   return pic;
}

Sets the message’s text.

[Source]

/*
  call-seq: setText(txt)

  Sets the message's text.
*/
VALUE Message_setText(VALUE self, VALUE txt)
{
   Message &ref = getRef<Message>(self);
   std::string str = StringValuePtr(txt);

   ref.setText(str);
   return txt;
}

Sets the message’s text’s color.

[Source]

/*
  call-seq: setTextColor(col)

  Sets the message's text's color.
*/
VALUE Message_setTextColor(VALUE self, VALUE col)
{
   Message &ref = getRef<Message>(self);
   OSL_COLOR color = hash2col(col);

   ref.setTextColor(color);
   return col;
}

Sets the message’s text’s font.

[Source]

/*
  call-seq: setTextFont(col)

  Sets the message's text's font.
*/
VALUE Message_setTextFont(VALUE self, VALUE f)
{
   Message &ref = getRef<Message>(self);
   std::string str = StringValuePtr(f);

   ref.setTextFont(str);
   return f;
}

Sets the message’s title.

[Source]

/*
  call-seq: setTitle(txt)

  Sets the message's title.
*/
VALUE Message_setTitle(VALUE self, VALUE txt)
{
   Message &ref = getRef<Message>(self);
   std::string str = StringValuePtr(txt);

   ref.setTitle(str);
   return txt;
}

Sets the message’s title’s color.

[Source]

/*
  call-seq: setTitleColor(col)

  Sets the message's title's color.
*/
VALUE Message_setTitleColor(VALUE self, VALUE col)
{
   Message &ref = getRef<Message>(self);
   OSL_COLOR color = hash2col(col);

   ref.setTitleColor(color);
   return col;
}

Sets the message’s title’s font.

[Source]

/*
  call-seq: setTitleFont(col)

  Sets the message's title's font.
*/
VALUE Message_setTitleFont(VALUE self, VALUE f)
{
   Message &ref = getRef<Message>(self);
   std::string str = StringValuePtr(f);

   ref.setTitleFont(str);
   return f;
}

Sets the message’s title’s position.

[Source]

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

  Sets the message's title's position.
*/
VALUE Message_setTitlePos(VALUE self, VALUE x, VALUE y)
{
   Message &ref = getRef<Message>(self);
   int _x = FIX2INT(x);
   int _y = FIX2INT(y);

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

Returns the message’s text.

[Source]

/*
  Returns the message's text.
*/
VALUE Message_text(VALUE self)
{
   Message &ref = getRef<Message>(self);
   return rb_str_new2(ref.getText().c_str());
}
text=(p1)

Alias for setText

Returns the message’s text’s color.

[Source]

/*
  Returns the message's text's color.
*/
VALUE Message_textColor(VALUE self)
{
   Message &ref = getRef<Message>(self);
   return col2hash(ref.getTextColor());
}
textColor=(p1)

Alias for setTextColor

Returns the message’s text’s font.

[Source]

/*
  Returns the message's text's font.
*/
VALUE Message_textFont(VALUE self)
{
   Message &ref = getRef<Message>(self);
   return rb_str_new2(ref.getTextFont().c_str());
}
textFont=(p1)

Alias for setTextFont

Returns the message’s title.

[Source]

/*
  Returns the message's title.
*/
VALUE Message_title(VALUE self)
{
   Message &ref = getRef<Message>(self);
   return rb_str_new2(ref.getTitle().c_str());
}
title=(p1)

Alias for setTitle

Returns the message’s title’s color.

[Source]

/*
  Returns the message's title's color.
*/
VALUE Message_titleColor(VALUE self)
{
   Message &ref = getRef<Message>(self);
   return col2hash(ref.getTitleColor());
}
titleColor=(p1)

Alias for setTitleColor

Returns the message’s title’s font.

[Source]

/*
  Returns the message's title's font.
*/
VALUE Message_titleFont(VALUE self)
{
   Message &ref = getRef<Message>(self);
   return rb_str_new2(ref.getTitleFont().c_str());
}
titleFont=(p1)

Alias for setTitleFont

Returns the message’s title’s position.

[Source]

/*
  Returns the message's title's position.
*/
VALUE Message_titlePos(VALUE self)
{
   Message &ref = getRef<Message>(self);
   Point p = ref.getTitlePos();

   return createObject(getClass("Point"), p);
}

Sets the message’s title’s position.

[Source]

/*
  call-seq: titlePos=(point)

  Sets the message's title's position.
*/
VALUE Message_setTitlePoint(VALUE self, VALUE p)
{
   Message &ref = getRef<Message>(self);
   Point &point = getRef<Point>(p);
   
   ref.setTitlePos(point);
   return Qnil;
}

Sets the message’s width.

[Source]

/*
  call-seq: w=(val)

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

   return w;
}

[Validate]