/* * $Id: rb_esmart_draggies.c 356 2006-02-10 18:27:31Z tilman $ * * Copyright (C) 2004 Tilman Sauerbeck (tilman at code-monkey de) * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include #include #include #include #include #include "../rb_esmart.h" static void on_mouse_up (void *data, Evas *e, Evas_Object *o, void *ev) { ecore_evas_raise (data); } static VALUE c_init (VALUE self, VALUE ecore_evas) { static ID evas; VALUE tmp; CHECK_CLASS (ecore_evas, cEcoreEvas); GET_OBJ (ecore_evas, RbEcoreEvas, ee); GET_OBJ (self, RbEvasObject, draggies); draggies->real = esmart_draggies_new (ee->real); if (!evas) evas = rb_intern ("evas"); tmp = rb_funcall (ecore_evas, evas, 0); rb_call_super (1, &tmp); esmart_draggies_event_callback_add (draggies->real, EVAS_CALLBACK_MOUSE_UP, on_mouse_up, ee->real); return self; } static VALUE c_button_set (VALUE self, VALUE val) { GET_OBJ (self, RbEvasObject, e); Check_Type (val, T_FIXNUM); esmart_draggies_button_set (e->real, FIX2INT (val)); return Qnil; } void Init_esmart_draggies (void) { VALUE c; rb_require ("esmart"); rb_require ("ecore_evas"); c = rb_define_class_under (mEsmart, "Draggies", cEvasObject); rb_define_method (c, "initialize", c_init, 1); rb_define_method (c, "button=", c_button_set, 1); }