X-Git-Url: http://git.code-monkey.de/?a=blobdiff_plain;f=src%2Fesmart_draggies%2Frb_esmart_draggies.c;h=e9eac004163b20124a61db79f36f73cc4548ca7b;hb=f48bba2d3cf64903ab176f6f957589a0a9ffa660;hp=d61f453d31511e83fdfff672fdd2fcf05843a9a9;hpb=197f83468ba03c07a5f51888e67e164e257aa9a3;p=ruby-esmart.git diff --git a/src/esmart_draggies/rb_esmart_draggies.c b/src/esmart_draggies/rb_esmart_draggies.c index d61f453..e9eac00 100644 --- a/src/esmart_draggies/rb_esmart_draggies.c +++ b/src/esmart_draggies/rb_esmart_draggies.c @@ -1,5 +1,5 @@ /* - * $Id$ + * $Id: rb_esmart_draggies.c 356 2006-02-10 18:27:31Z tilman $ * * Copyright (C) 2004 Tilman Sauerbeck (tilman at code-monkey de) * @@ -21,41 +21,48 @@ #include #include -#include -#include -#include +#include +#include +#include #include "../rb_esmart.h" -static VALUE c_new (VALUE klass, VALUE ecore_evas) +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) { - VALUE self, argv[1]; static ID evas; - Evas_Object **draggies; + VALUE tmp; CHECK_CLASS (ecore_evas, cEcoreEvas); - GET_OBJ (ecore_evas, Ecore_Evas *, ee); + GET_OBJ (ecore_evas, RbEcoreEvas, ee); + GET_OBJ (self, RbEvasObject, draggies); - self = Data_Make_Struct (klass, Evas_Object *, c_evas_object_mark, - c_evas_object_free, draggies); - *draggies = esmart_draggies_new (*ee); + draggies->real = esmart_draggies_new (ee->real); if (!evas) evas = rb_intern ("evas"); - argv[0] = rb_funcall (ecore_evas, evas, 0); - rb_obj_call_init (self, 1, argv); + 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, 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; } @@ -69,6 +76,6 @@ void Init_esmart_draggies (void) c = rb_define_class_under (mEsmart, "Draggies", cEvasObject); - rb_define_singleton_method (c, "new", c_new, 1); + rb_define_method (c, "initialize", c_init, 1); rb_define_method (c, "button=", c_button_set, 1); }