/*
- * $Id: rb_evas.c 58 2004-08-10 14:10:02Z tilman $
+ * $Id: rb_evas.c 68 2004-08-16 15:42:19Z tilman $
*
* Copyright (C) 2004 Tilman Sauerbeck (tilman at code-monkey de)
*
static VALUE c_top_get (VALUE self)
{
Evas_Object *o;
- void *obj;
GET_OBJ (self, RbEvas, e);
if (!(o = evas_object_top_get (e->real)))
return Qnil;
- if (!(obj = evas_object_data_get (o, RUBY_EVAS_OBJECT_KEY))) {
- rb_raise (rb_eException, "EvasObject Ruby object key missing");
- return Qnil;
- }
-
- return (VALUE) obj;
+ return TO_EVAS_OBJECT (o);
}
/*
static VALUE c_bottom_get (VALUE self)
{
Evas_Object *o;
- void *obj;
GET_OBJ (self, RbEvas, e);
if (!(o = evas_object_bottom_get (e->real)))
return Qnil;
- if (!(obj = evas_object_data_get (o, RUBY_EVAS_OBJECT_KEY))) {
- rb_raise (rb_eException, "EvasObject Ruby object key missing");
- return Qnil;
- }
-
- return (VALUE) obj;
+ return TO_EVAS_OBJECT (o);
}
/*
static VALUE c_find_object (VALUE self, VALUE name)
{
Evas_Object *o;
- void *obj;
GET_OBJ (self, RbEvas, e);
if (!(o = evas_object_name_find (e->real, StringValuePtr (name))))
return Qnil;
- if (!(obj = evas_object_data_get (o, RUBY_EVAS_OBJECT_KEY))) {
- rb_raise (rb_eException, "EvasObject Ruby object key missing");
- return Qnil;
- }
-
- return (VALUE) obj;
+ return TO_EVAS_OBJECT (o);
}
void Init_Evas (void)
/*
- * $Id: rb_evas_object.c 64 2004-08-12 19:37:04Z tilman $
+ * $Id: rb_evas_object.c 68 2004-08-16 15:42:19Z tilman $
*
* Copyright (C) 2004 Tilman Sauerbeck (tilman at code-monkey de)
*
VALUE cEvasObject;
+VALUE TO_EVAS_OBJECT (Evas_Object *o)
+{
+ void *obj;
+
+ if (!o)
+ return Qnil;
+
+ if (!(obj = evas_object_data_get (o, RUBY_EVAS_OBJECT_KEY))) {
+ rb_raise (rb_eException, "EvasObject Ruby object key missing");
+ return Qnil;
+ }
+
+ return (VALUE) obj;
+}
+
/* called by the child classes */
void c_evas_object_mark (RbEvasObject *e)
{
static VALUE c_above_get (VALUE self)
{
Evas_Object *o;
- void *obj;
GET_OBJ (self, RbEvasObject, e);
if (!(o = evas_object_above_get (e->real)))
return Qnil;
- if (!(obj = evas_object_data_get (o, RUBY_EVAS_OBJECT_KEY))) {
- rb_raise (rb_eException, "EvasObject Ruby object key missing");
- return Qnil;
- }
-
- return (VALUE) obj;
+ return TO_EVAS_OBJECT (o);
}
/*
static VALUE c_below_get (VALUE self)
{
Evas_Object *o;
- void *obj;
GET_OBJ (self, RbEvasObject, e);
if (!(o = evas_object_below_get (e->real)))
return Qnil;
- if (!(obj = evas_object_data_get (o, RUBY_EVAS_OBJECT_KEY))) {
- rb_raise (rb_eException, "EvasObject Ruby object key missing");
- return Qnil;
- }
-
- return (VALUE) obj;
+ return TO_EVAS_OBJECT (o);
}
void Init_EvasObject (void)
/*
- * $Id: rb_evas_object.h 49 2004-08-01 10:17:39Z tilman $
+ * $Id: rb_evas_object.h 68 2004-08-16 15:42:19Z tilman $
*
* Copyright (C) 2004 Tilman Sauerbeck (tilman at code-monkey de)
*
void c_evas_object_free (RbEvasObject *e, bool free_mem);
void c_evas_object_mark (RbEvasObject *e);
+VALUE TO_EVAS_OBJECT (Evas_Object *o);
+
#ifndef __RB_EVAS_OBJECT_C
extern VALUE cEvasObject;
#endif
/*
- * $Id: rb_smart.c 61 2004-08-12 10:04:07Z tilman $
+ * $Id: rb_smart.c 68 2004-08-16 15:42:19Z tilman $
*
* Copyright (C) 2004 Tilman Sauerbeck (tilman at code-monkey de)
*
#define SMART_CB_OBJ(name) \
static void on_##name (Evas_Object *o, Evas_Object *other) \
{ \
- void *obj; \
-\
SMART_CB_BODY (name); \
-\
- obj = evas_object_data_get (other, RUBY_EVAS_OBJECT_KEY); \
- if (!obj) { \
- rb_raise (rb_eException, "EvasObject Ruby object key missing"); \
- return; \
- } \
-\
- rb_funcall (self, id, 1, (VALUE) obj); \
+ rb_funcall (self, id, 1, TO_EVAS_OBJECT (other)); \
}
#define SMART_CB_COORD(name) \