4 * Copyright (C) 2004 Tilman Sauerbeck (tilman at code-monkey de)
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.
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.
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
23 #include <Esmart/Esmart_Trans_X11.h>
25 #include <rb_evas_object.h>
26 #include <rb_ecore_x_window.h>
28 #include "../rb_esmart.h"
30 static VALUE c_new (VALUE klass, VALUE evas)
35 CHECK_CLASS (evas, cEvas);
36 GET_OBJ (evas, Evas *, e);
38 self = Data_Make_Struct (klass, Evas_Object *, c_evas_object_mark,
39 c_evas_object_free, trans);
40 *trans = esmart_trans_x11_new (*e);
43 rb_obj_call_init (self, 1, argv);
48 static VALUE c_type_get (VALUE self)
50 GET_OBJ (self, Evas_Object *, e);
52 return INT2FIX (esmart_trans_x11_type_get (*e));
55 static VALUE c_type_set (VALUE self, VALUE val)
57 GET_OBJ (self, Evas_Object *, e);
59 Check_Type (val, T_FIXNUM);
61 esmart_trans_x11_type_set (*e, FIX2INT (val));
66 static VALUE c_window_set (VALUE self, VALUE window)
68 GET_OBJ (self, Evas_Object *, e);
70 CHECK_CLASS (window, cEcoreXWindow);
71 GET_OBJ (window, Ecore_X_Window, w);
73 esmart_trans_x11_window_set (*e, *w);
78 static VALUE c_freshen (VALUE self, VALUE x, VALUE y, VALUE w, VALUE h)
80 GET_OBJ (self, Evas_Object *, e);
82 Check_Type (x, T_FIXNUM);
83 Check_Type (y, T_FIXNUM);
84 Check_Type (w, T_FIXNUM);
85 Check_Type (h, T_FIXNUM);
87 esmart_trans_x11_freshen (*e, FIX2INT (x), FIX2INT (y),
88 FIX2INT (w), FIX2INT (h));
93 void Init_esmart_trans_x11 (void)
97 rb_require ("esmart");
98 rb_require ("ecore_x");
100 c = rb_define_class_under (mEsmart, "TransX11", cEvasObject);
102 rb_define_singleton_method (c, "new", c_new, 1);
103 rb_define_method (c, "type", c_type_get, 0);
104 rb_define_method (c, "type=", c_type_set, 1);
105 rb_define_method (c, "window=", c_window_set, 1);
106 rb_define_method (c, "freshen", c_freshen, 4);
108 rb_define_const (c, "BACKGROUND",
109 INT2FIX (Esmart_Trans_X11_Type_Background));
110 rb_define_const (c, "SCREENGRAB",
111 INT2FIX (Esmart_Trans_X11_Type_Screengrab));