- klass = rb_hash_aref (event_classes, INT2NUM (type));
- if (NIL_P (klass))
- rb_raise (rb_eException, "Cannot find event class "
- "for event %i\n", type);
-
- /* now create and init the object */
- tmp = (VALUE) event;
- obj = rb_class_new_instance (1, &tmp, klass);
-
- len = RARRAY (handlers)->len;
-
- for (i = 0; i < len; i++) {
- handler = rb_ary_entry (handlers, i);
- handler_type = NUM2INT (rb_iv_get (handler, "@type"));
-
- if (handler_type == type) {
- Data_Get_Struct (handler, RbEventHandler, h);
- res = rb_funcall (h->callback, rb_intern ("call"), 1, obj);
-
- /* if the block returned false, don't call the other
- * event handlers
- */
- if (res == Qfalse) {
- ret = 0;
- break;
- }
- }
- }
-
- return ret;
+ return (tmp != Qfalse);
+}
+
+VALUE c_ev_inherited (VALUE klass, VALUE child)
+{
+ VALUE t;
+
+ t = INT2FIX (ecore_event_type_new ());
+ rb_hash_aset (event_classes, t, child);
+
+ rb_define_const (child, "TYPE", t);
+ rb_define_singleton_method (child, "raise", c_ev_raise, -2);
+
+ return Qnil;