Updated copyright notice. Added event handler code.
[ruby-ecore.git] / src / ecore / rb_event_handler.h
diff --git a/src/ecore/rb_event_handler.h b/src/ecore/rb_event_handler.h
new file mode 100644 (file)
index 0000000..a0fa0e1
--- /dev/null
@@ -0,0 +1,45 @@
+/*
+ * $Id: rb_event_handler.h 77 2004-08-19 17:39:29Z tilman $
+ *
+ * Copyright (C) 2004 ruby-ecore team (see AUTHORS)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+#ifndef __RB_EVENT_HANDLER_H
+#define __RB_EVENT_HANDLER_H
+
+#define ADD_EVENT(mod, prefix, constname, clsname, obj) \
+       rb_define_const ((mod), #constname, \
+                        INT2FIX (prefix##constname)); \
+       ecore_event_handler_add (prefix##constname, on_ecore_event, \
+                                NULL); \
+\
+       (obj) = rb_define_class_under ((mod), #clsname, cEcoreEvent); \
+       rb_define_private_method (rb_singleton_class ((obj)), \
+                                 "new", NULL, 0); \
+\
+       rb_hash_aset (event_classes, INT2FIX (prefix##constname), (obj));
+
+void Init_EventHandler (void);
+
+int on_ecore_event (void *data, int type, void *event);
+VALUE c_ev_generic_init (VALUE self, VALUE event);
+
+#ifndef __RB_EVENT_HANDLER_C
+extern VALUE event_classes, cEcoreEvent;
+#endif
+
+#endif