34df332d91310f3fc23375b04a6c38c0af97ea06
[ruby-ecore.git] / src / ecore / rb_event_handler.h
1 /*
2  * $Id: rb_event_handler.h 372 2006-02-16 20:39:55Z tilman $
3  *
4  * Copyright (C) 2004 ruby-ecore team (see AUTHORS)
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19  */
20
21 #ifndef __RB_EVENT_HANDLER_H
22 #define __RB_EVENT_HANDLER_H
23
24 #define ADD_EVENT(mod, constname, clsname, obj) \
25         rb_remove_method (rb_singleton_class (cEcoreEvent), "inherited"); \
26 \
27         (obj) = rb_define_class_under ((mod), (clsname), cEcoreEvent); \
28         rb_define_private_method (rb_singleton_class ((obj)), \
29                                   "new", NULL, 0); \
30 \
31         rb_define_const ((obj), "TYPE", INT2FIX (constname)); \
32         rb_hash_aset (event_classes, INT2FIX (constname), (obj)); \
33         rb_define_singleton_method (cEcoreEvent, "inherited", c_ev_inherited, 1);
34
35 void Init_EventHandler (void);
36
37 VALUE c_ev_inherited (VALUE klass, VALUE child);
38
39 #ifndef __RB_EVENT_HANDLER_C
40 extern VALUE event_classes, cEcoreEvent;
41 #endif
42
43 #endif