/*
- * $Id: rb_ecore_evas.c 27 2004-07-08 18:25:05Z tilman $
+ * $Id: rb_ecore_evas.c 30 2004-07-10 14:05:30Z tilman $
*
* Copyright (C) 2004 Tilman Sauerbeck (tilman at code-monkey de)
*
#include "rb_ecore_evas_main.h"
#include "rb_ecore_evas.h"
-#define GET_OBJ(obj, type, o, desc) \
+#define GET_OBJ(obj, type, o) \
type **(o) = NULL; \
\
Data_Get_Struct ((obj), type *, (o)); \
\
if (!*(o)) { \
- rb_raise (rb_eException, desc " destroyed already"); \
+ rb_raise (rb_eException, \
+ "%s destroyed already", \
+ rb_obj_classname ((obj))); \
return Qnil; \
}
return Qnil; \
}
+#define INSPECT(obj, type) \
+ char buf[128]; \
+\
+ GET_OBJ (obj, type, o); \
+\
+ snprintf (buf, sizeof (buf), \
+ "#<%s:%p ptr=%p>", rb_obj_classname ((obj)), \
+ (void *) obj, *o); \
+\
+ return rb_str_new2 (buf);
+
static VALUE evases;
/* called by the child classes */
static VALUE c_inspect (VALUE self)
{
- char buf[128];
-
- GET_OBJ (self, Ecore_Evas, ee, "EcoreEvas");
-
- snprintf (buf, sizeof (buf), "#<Ecore::Evas::EcoreEvas:%p ptr=%p>",
- (void *) self, *ee);
-
- return rb_str_new2 (buf);
+ INSPECT (self, Ecore_Evas);
}
static VALUE c_show (VALUE self)
{
- GET_OBJ (self, Ecore_Evas, ee, "EcoreEvas");
+ GET_OBJ (self, Ecore_Evas, ee);
ecore_evas_show (*ee);
static VALUE c_hide (VALUE self)
{
- GET_OBJ (self, Ecore_Evas, ee, "EcoreEvas");
+ GET_OBJ (self, Ecore_Evas, ee);
ecore_evas_hide (*ee);
static VALUE c_visible_get (VALUE self)
{
- GET_OBJ (self, Ecore_Evas, ee, "EcoreEvas");
+ GET_OBJ (self, Ecore_Evas, ee);
return ecore_evas_visibility_get (*ee) ? Qtrue : Qfalse;
}
static VALUE c_raise (VALUE self)
{
- GET_OBJ (self, Ecore_Evas, ee, "EcoreEvas");
+ GET_OBJ (self, Ecore_Evas, ee);
ecore_evas_raise (*ee);
static VALUE c_lower (VALUE self)
{
- GET_OBJ (self, Ecore_Evas, ee, "EcoreEvas");
+ GET_OBJ (self, Ecore_Evas, ee);
ecore_evas_lower (*ee);
static VALUE c_layer_get (VALUE self)
{
- GET_OBJ (self, Ecore_Evas, ee, "EcoreEvas");
+ GET_OBJ (self, Ecore_Evas, ee);
return INT2FIX (ecore_evas_layer_get (*ee));
}
static VALUE c_layer_set (VALUE self, VALUE val)
{
- GET_OBJ (self, Ecore_Evas, ee, "EcoreEvas");
+ GET_OBJ (self, Ecore_Evas, ee);
Check_Type (val, T_FIXNUM);
{
VALUE evas;
- GET_OBJ (self, Ecore_Evas, ee, "EcoreEvas");
+ GET_OBJ (self, Ecore_Evas, ee);
if (NIL_P (evas = rb_hash_aref (evases, INT2NUM ((long) (ee))))) {
evas = TO_EVAS (self, ecore_evas_get (*ee));
{
int w = 0, h = 0;
- GET_OBJ (self, Ecore_Evas, ee, "EcoreEvas");
+ GET_OBJ (self, Ecore_Evas, ee);
ecore_evas_size_min_get (*ee, &w, &h);
static VALUE c_set_size_min (VALUE self, VALUE w, VALUE h)
{
- GET_OBJ (self, Ecore_Evas, ee, "EcoreEvas");
+ GET_OBJ (self, Ecore_Evas, ee);
Check_Type (w, T_FIXNUM);
Check_Type (h, T_FIXNUM);
{
int w = 0, h = 0;
- GET_OBJ (self, Ecore_Evas, ee, "EcoreEvas");
+ GET_OBJ (self, Ecore_Evas, ee);
ecore_evas_size_max_get (*ee, &w, &h);
static VALUE c_set_size_max (VALUE self, VALUE w, VALUE h)
{
- GET_OBJ (self, Ecore_Evas, ee, "EcoreEvas");
+ GET_OBJ (self, Ecore_Evas, ee);
Check_Type (w, T_FIXNUM);
Check_Type (h, T_FIXNUM);
static VALUE c_move (VALUE self, VALUE x, VALUE y)
{
- GET_OBJ (self, Ecore_Evas, ee, "EcoreEvas");
+ GET_OBJ (self, Ecore_Evas, ee);
Check_Type (x, T_FIXNUM);
Check_Type (y, T_FIXNUM);
static VALUE c_resize (VALUE self, VALUE w, VALUE h)
{
- GET_OBJ (self, Ecore_Evas, ee, "EcoreEvas");
+ GET_OBJ (self, Ecore_Evas, ee);
Check_Type (w, T_FIXNUM);
Check_Type (h, T_FIXNUM);
{
const char *tmp;
- GET_OBJ (self, Ecore_Evas, ee, "EcoreEvas");
+ GET_OBJ (self, Ecore_Evas, ee);
if (!(tmp = ecore_evas_title_get (*ee)))
return Qnil;
static VALUE c_title_set (VALUE self, VALUE val)
{
- GET_OBJ (self, Ecore_Evas, ee, "EcoreEvas");
+ GET_OBJ (self, Ecore_Evas, ee);
Check_Type (val, T_STRING);
static VALUE c_borderless_get (VALUE self)
{
- GET_OBJ (self, Ecore_Evas, ee, "EcoreEvas");
+ GET_OBJ (self, Ecore_Evas, ee);
return ecore_evas_borderless_get (*ee) ? Qtrue : Qfalse;
}
static VALUE c_borderless_set (VALUE self, VALUE val)
{
- GET_OBJ (self, Ecore_Evas, ee, "EcoreEvas");
+ GET_OBJ (self, Ecore_Evas, ee);
CHECK_BOOL (val);
static VALUE c_shaped_get (VALUE self)
{
- GET_OBJ (self, Ecore_Evas, ee, "EcoreEvas");
+ GET_OBJ (self, Ecore_Evas, ee);
return ecore_evas_shaped_get (*ee) ? Qtrue : Qfalse;
}
static VALUE c_shaped_set (VALUE self, VALUE val)
{
- GET_OBJ (self, Ecore_Evas, ee, "EcoreEvas");
+ GET_OBJ (self, Ecore_Evas, ee);
CHECK_BOOL (val);
static VALUE c_sticky_get (VALUE self)
{
- GET_OBJ (self, Ecore_Evas, ee, "EcoreEvas");
+ GET_OBJ (self, Ecore_Evas, ee);
return ecore_evas_sticky_get (*ee) ? Qtrue : Qfalse;
}
static VALUE c_sticky_set (VALUE self, VALUE val)
{
- GET_OBJ (self, Ecore_Evas, ee, "EcoreEvas");
+ GET_OBJ (self, Ecore_Evas, ee);
CHECK_BOOL (val);
static VALUE c_rotation_get (VALUE self)
{
- GET_OBJ (self, Ecore_Evas, ee, "EcoreEvas");
+ GET_OBJ (self, Ecore_Evas, ee);
return INT2FIX (ecore_evas_rotation_get (*ee));
}
static VALUE c_rotation_set (VALUE self, VALUE val)
{
- GET_OBJ (self, Ecore_Evas, ee, "EcoreEvas");
+ GET_OBJ (self, Ecore_Evas, ee);
Check_Type (val, T_FIXNUM);
static VALUE c_delete (VALUE self)
{
- GET_OBJ (self, Ecore_Evas, ee, "EcoreEvas");
+ GET_OBJ (self, Ecore_Evas, ee);
/* reap our children */
rb_gc_start ();