Removed RCS-style IDs.
[ruby-ecore.git] / src / ecore_evas / rb_fb.c
1 /*
2  * Copyright (C) 2004 ruby-ecore team (see AUTHORS)
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
17  */
18
19 #include <ruby.h>
20
21 #include <Ecore.h>
22 #include <Ecore_Evas.h>
23
24 #include "../ecore/rb_ecore.h"
25 #include "rb_ecore_evas_main.h"
26 #include "rb_ecore_evas.h"
27
28 static void c_free (RbEcoreEvas *ee)
29 {
30         c_ecore_evas_free (ee, true);
31 }
32
33 static VALUE c_alloc (VALUE klass)
34 {
35         RbEcoreEvas *ee = NULL;
36
37         ecore_init ();
38         ecore_evas_init ();
39
40         return Data_Make_Struct (klass, RbEcoreEvas,
41                                  c_ecore_evas_mark, c_free, ee);
42 }
43
44 /*
45  * call-seq:
46  *  Ecore::Evas::Fb.new([display, rotation, w, h]) => fb
47  *
48  * Creates an Ecore::Evas::Fb object.
49  */
50 static VALUE c_init (int argc, VALUE *argv, VALUE self)
51 {
52         VALUE disp, rot, w, h;
53         char *cdisp = NULL;
54         int irot = 0, iw = 0, ih = 0;
55
56         GET_OBJ (self, RbEcoreEvas, ee);
57
58         rb_scan_args (argc, argv, "04", &disp, &rot, &w, &h);
59
60         if (!NIL_P (disp)) {
61                 Check_Type (disp, T_STRING);
62                 cdisp = StringValuePtr (disp);
63         }
64
65         if (!NIL_P (rot)) {
66                 Check_Type (rot, T_FIXNUM);
67                 irot = FIX2INT (rot);
68         }
69
70         if (!NIL_P (w)) {
71                 Check_Type (w, T_FIXNUM);
72                 iw = FIX2INT (w);
73         }
74
75         if (!NIL_P (h)) {
76                 Check_Type (h, T_FIXNUM);
77                 ih = FIX2INT (h);
78         }
79
80         ee->real = ecore_evas_fb_new (cdisp, irot, iw, ih);
81
82         rb_call_super (argc, argv);
83
84         return self;
85 }
86
87 void Init_Fb (void)
88 {
89         VALUE c = rb_define_class_under (mEvas, "Fb", cEcoreEvas);
90
91         rb_define_alloc_func (c, c_alloc);
92         rb_define_method (c, "initialize", c_init, -1);
93 }