-#define GET_OBJ(obj, type, o, desc) \
- type **(o) = NULL; \
-\
- Data_Get_Struct ((obj), type *, (o)); \
-\
- if (!*(o)) { \
- rb_raise (rb_eException, desc " destroyed already"); \
- return Qnil; \
- }
- self = Data_Make_Struct (cEvas, Evas *,
- c_mark, free, my_e);
- *my_e = e;
-
- rb_hash_aset (parents, INT2NUM ((long) my_e), parent);
+ self = Data_Make_Struct (cEvas, RbEvas,
+ c_mark, free, evas);
+ evas->real = e;
+ evas->parent = parent;
+/* :nodoc: */
+static VALUE c_inspect (VALUE self)
+{
+ INSPECT (self, RbEvas);
+}
+
+/*
+ * call-seq:
+ * e.render => nil
+ *
+ * Forces a re-render of the Evas.
+ */
+static VALUE c_render (VALUE self)
+{
+ GET_OBJ (self, RbEvas, e);
+
+ evas_render (e->real);
+
+ return Qnil;
+}
+
static VALUE c_font_path_get (VALUE self)
{
VALUE ary;
const Evas_List *list, *l;
static VALUE c_font_path_get (VALUE self)
{
VALUE ary;
const Evas_List *list, *l;
- if (!(obj = evas_object_data_get (o, RUBY_EVAS_OBJECT_KEY))) {
- rb_raise (rb_eException, "EvasObject Ruby object key missing");
- return Qnil;
- }
+ return TO_EVAS_OBJECT (o);
+}
+
+static VALUE c_output_size_get (VALUE self)
+{
+ int w = 0, h = 0;
+
+ GET_OBJ (self, RbEvas, e);
/* not publically instantiable yet */
rb_define_private_method (rb_singleton_class (cEvas),
"new", NULL, 0);
/* not publically instantiable yet */
rb_define_private_method (rb_singleton_class (cEvas),
"new", NULL, 0);
+ rb_define_method (cEvas, "inspect", c_inspect, 0);
+ rb_define_method (cEvas, "render", c_render, 0);
rb_define_method (cEvas, "font_path_clear", c_font_path_clear, 0);
rb_define_method (cEvas, "font_path_append", c_font_path_append, 1);
rb_define_method (cEvas, "font_path_prepend", c_font_path_prepend, 1);
rb_define_method (cEvas, "font_path_clear", c_font_path_clear, 0);
rb_define_method (cEvas, "font_path_append", c_font_path_append, 1);
rb_define_method (cEvas, "font_path_prepend", c_font_path_prepend, 1);
rb_define_method (cEvas, "top", c_top_get, 0);
rb_define_method (cEvas, "bottom", c_bottom_get, 0);
rb_define_method (cEvas, "find_object", c_find_object, 1);
rb_define_method (cEvas, "top", c_top_get, 0);
rb_define_method (cEvas, "bottom", c_bottom_get, 0);
rb_define_method (cEvas, "find_object", c_find_object, 1);
-
- parents = rb_hash_new ();
- rb_global_variable (&parents);
+ rb_define_method (cEvas, "output_size", c_output_size_get, 0);