X-Git-Url: http://git.code-monkey.de/?a=blobdiff_plain;f=src%2Fesmart_draggies%2Frb_esmart_draggies.c;h=c422af512e30ad2d7d97afcbc11d90cab75660c2;hb=3528451b849fcc1650a5d76da48f334b3fdecf6b;hp=c67dd7b76745d8e16eca5fe3fd42adfd45237e65;hpb=1256110e4e9d2d3f332f7f460224765132eeb0d5;p=ruby-esmart.git diff --git a/src/esmart_draggies/rb_esmart_draggies.c b/src/esmart_draggies/rb_esmart_draggies.c index c67dd7b..c422af5 100644 --- a/src/esmart_draggies/rb_esmart_draggies.c +++ b/src/esmart_draggies/rb_esmart_draggies.c @@ -1,5 +1,5 @@ /* - * $Id: rb_esmart_draggies.c 36 2004-07-25 10:45:47Z tilman $ + * $Id: rb_esmart_draggies.c 316 2005-04-24 20:07:36Z tilman $ * * Copyright (C) 2004 Tilman Sauerbeck (tilman at code-monkey de) * @@ -21,24 +21,34 @@ #include #include -#include -#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 void c_free (RbEvasObject *e) +{ + c_evas_object_free (e, true); +} + static VALUE c_new (VALUE klass, VALUE ecore_evas) { VALUE self, argv[1]; static ID evas; - Evas_Object **draggies; + RbEvasObject *draggies; CHECK_CLASS (ecore_evas, cEcoreEvas); - GET_OBJ (ecore_evas, Ecore_Evas *, ee); + GET_OBJ (ecore_evas, RbEcoreEvas, ee); - self = Data_Make_Struct (klass, Evas_Object *, c_evas_object_mark, - c_evas_object_free, draggies); - *draggies = esmart_draggies_new (*ee); + self = Data_Make_Struct (klass, RbEvasObject, c_evas_object_mark, + c_free, draggies); + draggies->real = esmart_draggies_new (ee->real); if (!evas) evas = rb_intern ("evas"); @@ -46,16 +56,20 @@ static VALUE c_new (VALUE klass, VALUE ecore_evas) argv[0] = rb_funcall (ecore_evas, evas, 0); rb_obj_call_init (self, 1, argv); + 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, Evas_Object *, e); + GET_OBJ (self, RbEvasObject, e); Check_Type (val, T_FIXNUM); - esmart_draggies_button_set (*e, FIX2INT (val)); + esmart_draggies_button_set (e->real, FIX2INT (val)); return Qnil; }