X-Git-Url: http://git.code-monkey.de/?a=blobdiff_plain;f=src%2Fesmart_container%2Frb_esmart_container.c;h=9eb89b21e897eee221869065ebeeb0810bae0a8e;hb=896922d4c294f3594306e6a060433b333ea2f338;hp=c2eb60cfe2a854032cd2930c92ef2db28fa6d41a;hpb=1256110e4e9d2d3f332f7f460224765132eeb0d5;p=ruby-esmart.git diff --git a/src/esmart_container/rb_esmart_container.c b/src/esmart_container/rb_esmart_container.c index c2eb60c..9eb89b2 100644 --- a/src/esmart_container/rb_esmart_container.c +++ b/src/esmart_container/rb_esmart_container.c @@ -1,5 +1,5 @@ /* - * $Id: rb_esmart_container.c 36 2004-07-25 10:45:47Z tilman $ + * $Id: rb_esmart_container.c 56 2004-08-10 13:28:01Z tilman $ * * Copyright (C) 2004 Tilman Sauerbeck (tilman at code-monkey de) * @@ -21,22 +21,27 @@ #include #include -#include -#include +#include +#include #include "../rb_esmart.h" +static void c_free (RbEvasObject *e) +{ + c_evas_object_free (e, true); +} + static VALUE c_new (VALUE klass, VALUE evas) { VALUE self, argv[1]; - Evas_Object **cont; + RbEvasObject *cont; CHECK_CLASS (evas, cEvas); - GET_OBJ (evas, Evas *, e); + GET_OBJ (evas, RbEvas, e); - self = Data_Make_Struct (klass, Evas_Object *, c_evas_object_mark, - c_evas_object_free, cont); - *cont = esmart_container_new (*e); + self = Data_Make_Struct (klass, RbEvasObject, c_evas_object_mark, + c_free, cont); + cont->real = esmart_container_new (e->real); argv[0] = evas; rb_obj_call_init (self, 1, argv); @@ -44,92 +49,92 @@ static VALUE c_new (VALUE klass, VALUE evas) return self; } -static VALUE c_element_append (VALUE self, VALUE element) +static VALUE c_append_element (VALUE self, VALUE element) { - GET_OBJ (self, Evas_Object *, e); + GET_OBJ (self, RbEvasObject, e); CHECK_CLASS (element, cEvasObject); GET_OBJ (element, Evas_Object *, o); - esmart_container_element_append (*e, *o); + esmart_container_element_append (e->real, *o); return Qnil; } -static VALUE c_element_prepend (VALUE self, VALUE element) +static VALUE c_prepend_element (VALUE self, VALUE element) { - GET_OBJ (self, Evas_Object *, e); + GET_OBJ (self, RbEvasObject, e); CHECK_CLASS (element, cEvasObject); GET_OBJ (element, Evas_Object *, o); - esmart_container_element_prepend (*e, *o); + esmart_container_element_prepend (e->real, *o); return Qnil; } -static VALUE c_element_remove (VALUE self, VALUE element) +static VALUE c_remove_element (VALUE self, VALUE element) { - GET_OBJ (self, Evas_Object *, e); + GET_OBJ (self, RbEvasObject, e); CHECK_CLASS (element, cEvasObject); GET_OBJ (element, Evas_Object *, o); - esmart_container_element_remove (*e, *o); + esmart_container_element_remove (e->real, *o); return Qnil; } static VALUE c_direction_get (VALUE self) { - GET_OBJ (self, Evas_Object *, e); + GET_OBJ (self, RbEvasObject, e); - return INT2FIX (esmart_container_direction_get (*e)); + return INT2FIX (esmart_container_direction_get (e->real)); } static VALUE c_direction_set (VALUE self, VALUE val) { - GET_OBJ (self, Evas_Object *, e); + GET_OBJ (self, RbEvasObject, e); Check_Type (val, T_FIXNUM); - esmart_container_direction_set (*e, FIX2INT (val)); + esmart_container_direction_set (e->real, FIX2INT (val)); return Qnil; } static VALUE c_spacing_get (VALUE self) { - GET_OBJ (self, Evas_Object *, e); + GET_OBJ (self, RbEvasObject, e); - return INT2FIX (esmart_container_spacing_get (*e)); + return INT2FIX (esmart_container_spacing_get (e->real)); } static VALUE c_spacing_set (VALUE self, VALUE val) { - GET_OBJ (self, Evas_Object *, e); + GET_OBJ (self, RbEvasObject, e); Check_Type (val, T_FIXNUM); - esmart_container_spacing_set (*e, FIX2INT (val)); + esmart_container_spacing_set (e->real, FIX2INT (val)); return Qnil; } static VALUE c_fill_policy_get (VALUE self) { - GET_OBJ (self, Evas_Object *, e); + GET_OBJ (self, RbEvasObject, e); - return INT2FIX (esmart_container_fill_policy_get (*e)); + return INT2FIX (esmart_container_fill_policy_get (e->real)); } static VALUE c_fill_policy_set (VALUE self, VALUE val) { - GET_OBJ (self, Evas_Object *, e); + GET_OBJ (self, RbEvasObject, e); Check_Type (val, T_FIXNUM); - esmart_container_fill_policy_set (*e, FIX2INT (val)); + esmart_container_fill_policy_set (e->real, FIX2INT (val)); return Qnil; } @@ -138,9 +143,9 @@ static VALUE c_get_padding (VALUE self) { double l = 0, r = 0, t = 0, b = 0; - GET_OBJ (self, Evas_Object *, e); + GET_OBJ (self, RbEvasObject, e); - esmart_container_padding_get (*e, &l, &r, &t, &b); + esmart_container_padding_get (e->real, &l, &r, &t, &b); return rb_ary_new3 (4, rb_float_new (l), rb_float_new (r), rb_float_new (t), rb_float_new (b)); @@ -149,14 +154,14 @@ static VALUE c_get_padding (VALUE self) static VALUE c_set_padding (VALUE self, VALUE l, VALUE r, VALUE t, VALUE b) { - GET_OBJ (self, Evas_Object *, e); + GET_OBJ (self, RbEvasObject, e); Check_Type (l, T_FLOAT); Check_Type (r, T_FLOAT); Check_Type (t, T_FLOAT); Check_Type (b, T_FLOAT); - esmart_container_padding_set (*e, NUM2DBL (l), NUM2DBL (r), + esmart_container_padding_set (e->real, NUM2DBL (l), NUM2DBL (r), NUM2DBL (t), NUM2DBL (b)); return Qnil; @@ -164,11 +169,11 @@ static VALUE c_set_padding (VALUE self, VALUE l, VALUE r, static VALUE c_scroll (VALUE self, VALUE val) { - GET_OBJ (self, Evas_Object *, e); + GET_OBJ (self, RbEvasObject, e); Check_Type (val, T_FIXNUM); - esmart_container_scroll (*e, FIX2INT (val)); + esmart_container_scroll (e->real, FIX2INT (val)); return Qnil; } @@ -190,9 +195,9 @@ void Init_esmart_container (void) rb_define_method (c, "fill_policy=", c_fill_policy_set, 1); rb_define_method (c, "get_padding", c_get_padding, 0); rb_define_method (c, "set_padding", c_set_padding, 4); - rb_define_method (c, "element_append", c_element_append, 1); - rb_define_method (c, "element_prepend", c_element_prepend, 1); - rb_define_method (c, "element_remove", c_element_remove, 1); + rb_define_method (c, "append_element", c_append_element, 1); + rb_define_method (c, "prepend_element", c_prepend_element, 1); + rb_define_method (c, "remove_element", c_remove_element, 1); rb_define_method (c, "scroll", c_scroll, 1); rb_define_const (c, "HORIZONTAL",