source: libcaca/trunk/ruby/caca-event.c @ 3993

Last change on this file since 3993 was 3582, checked in by Sam Hocevar, 11 years ago

Coding style: remove tabs and trailing spaces.

  • Property svn:eol-style set to native
File size: 2.5 KB
Line 
1/*
2 *  libcaca Ruby bindings
3 *  Copyright (c) 2007 Pascal Terjan <pterjan@linuxfr.org>
4 *
5 *  This library is free software. It comes without any warranty, to
6 *  the extent permitted by applicable law. You can redistribute it
7 *  and/or modify it under the terms of the Do What The Fuck You Want
8 *  To Public License, Version 2, as published by Sam Hocevar. See
9 *  http://sam.zoy.org/wtfpl/COPYING for more details.
10 */
11
12#include <ruby.h>
13#include <caca.h>
14#include <errno.h>
15#include "common.h"
16
17VALUE cEvent;
18static VALUE cEventKey;
19VALUE cEventKeyPress;
20VALUE cEventKeyRelease;
21static VALUE cEventMouse;
22VALUE cEventMousePress;
23VALUE cEventMouseRelease;
24VALUE cEventMouseMotion;
25VALUE cEventResize;
26VALUE cEventQuit;
27
28void Init_caca_event(VALUE mCaca)
29{
30    cEvent = rb_define_class_under(mCaca, "Event", rb_cObject);
31    rb_define_const(cEvent, "TYPE", INT2FIX(CACA_EVENT_ANY));
32
33    cEventKey = rb_define_class_under(cEvent, "Key", cEvent);
34    rb_define_const(cEventKey, "TYPE",
35                    INT2FIX(CACA_EVENT_KEY_PRESS|
36                            CACA_EVENT_KEY_RELEASE));
37
38    cEventKeyPress = rb_define_class_under(cEventKey, "Press", cEventKey);
39    rb_define_const(cEventKeyPress, "TYPE",
40                    INT2FIX(CACA_EVENT_KEY_PRESS));
41
42    cEventKeyRelease = rb_define_class_under(cEventKey, "Release", cEventKey);
43    rb_define_const(cEventKeyRelease, "TYPE",
44                    INT2FIX(CACA_EVENT_KEY_RELEASE));
45
46    cEventMouse = rb_define_class_under(cEvent, "Mouse", cEvent);
47    rb_define_const(cEventMouse, "TYPE",
48                    INT2FIX(CACA_EVENT_MOUSE_PRESS|
49                            CACA_EVENT_MOUSE_RELEASE|
50                            CACA_EVENT_MOUSE_MOTION));
51
52    cEventMousePress = rb_define_class_under(cEventMouse, "Press", cEventMouse);
53    rb_define_const(cEventMousePress, "TYPE",
54                    INT2FIX(CACA_EVENT_MOUSE_PRESS));
55
56    cEventMouseRelease = rb_define_class_under(cEventMouse, "Release", cEventMouse);
57    rb_define_const(cEventMouseRelease, "TYPE",
58                    INT2FIX(CACA_EVENT_MOUSE_RELEASE));
59
60    cEventMouseMotion = rb_define_class_under(cEventMouse, "Motion", cEventMouse);
61    rb_define_const(cEventMouseMotion, "TYPE",
62                    INT2FIX(CACA_EVENT_MOUSE_MOTION));
63
64    cEventResize = rb_define_class_under(cEvent, "Resize", cEvent);
65    rb_define_const(cEventResize, "TYPE",
66                    INT2FIX(CACA_EVENT_RESIZE));
67
68    cEventQuit = rb_define_class_under(cEvent, "Quit", cEvent);
69    rb_define_const(cEventQuit, "TYPE",
70                    INT2FIX(CACA_EVENT_QUIT));
71
72}
Note: See TracBrowser for help on using the repository browser.