2 * Copyright (C) 2004 Tilman Sauerbeck (tilman at code-monkey de)
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.
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.
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
21 #include <Esmart/Esmart_Trans_X11.h>
22 #include <evas/rb_evas.h>
23 #include <evas/rb_evas_object.h>
24 #include <ecore/rb_window.h>
26 #include "../rb_esmart.h"
30 static VALUE c_init (VALUE self, VALUE evas)
32 CHECK_CLASS (evas, cEvas);
33 GET_OBJ (evas, RbEvas, e);
34 GET_OBJ (self, RbEvasObject, trans);
36 trans->real = esmart_trans_x11_new (e->real);
38 rb_call_super (1, &evas);
43 static VALUE c_type_get (VALUE self)
45 GET_OBJ (self, RbEvasObject, e);
47 return INT2FIX (esmart_trans_x11_type_get (e->real));
50 static VALUE c_type_set (VALUE self, VALUE val)
52 GET_OBJ (self, RbEvasObject, e);
54 Check_Type (val, T_FIXNUM);
56 esmart_trans_x11_type_set (e->real, FIX2INT (val));
61 static VALUE c_window_set (VALUE self, VALUE window)
63 GET_OBJ (self, RbEvasObject, e);
65 CHECK_CLASS (window, cWindow);
66 GET_OBJ (window, RbWindow, w);
68 esmart_trans_x11_window_set (e->real, w->real);
73 static VALUE c_freshen (VALUE self, VALUE x, VALUE y, VALUE w, VALUE h)
75 GET_OBJ (self, RbEvasObject, e);
77 Check_Type (x, T_FIXNUM);
78 Check_Type (y, T_FIXNUM);
79 Check_Type (w, T_FIXNUM);
80 Check_Type (h, T_FIXNUM);
82 esmart_trans_x11_freshen (e->real, FIX2INT (x), FIX2INT (y),
83 FIX2INT (w), FIX2INT (h));
88 void Init_esmart_trans_x11 (void)
92 rb_require ("esmart");
93 rb_require ("ecore_x");
95 m = rb_const_get (rb_cModule, rb_intern ("Ecore"));
96 m = rb_const_get (m, rb_intern ("X"));
97 cWindow = rb_const_get (m, rb_intern ("Window"));
99 c = rb_define_class_under (mEsmart, "TransX11", cEvasObject);
101 rb_define_method (c, "initialize", c_init, 1);
102 rb_define_method (c, "type", c_type_get, 0);
103 rb_define_method (c, "type=", c_type_set, 1);
104 rb_define_method (c, "window=", c_window_set, 1);
105 rb_define_method (c, "freshen", c_freshen, 4);
107 rb_define_const (c, "BACKGROUND",
108 INT2FIX (Esmart_Trans_X11_Type_Background));
109 rb_define_const (c, "SCREENGRAB",
110 INT2FIX (Esmart_Trans_X11_Type_Screengrab));