X-Git-Url: http://git.code-monkey.de/?a=blobdiff_plain;f=src%2Fesmart_container%2Frb_esmart_container.c;h=9bc6432383482ee4f28c98e80d2e6c7123fd25cb;hb=2eaf440d914c96a82d83883b8cd5656d4cf546ec;hp=3c91108774b7cbc5835b8c2368f0006a2df10e1b;hpb=94cdd71fbad6175aba19192ebef7e54831f500ed;p=ruby-esmart.git diff --git a/src/esmart_container/rb_esmart_container.c b/src/esmart_container/rb_esmart_container.c index 3c91108..9bc6432 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 52 2004-08-01 10:19:14Z tilman $ + * $Id: rb_esmart_container.c 70 2004-08-16 15:43:51Z tilman $ * * Copyright (C) 2004 Tilman Sauerbeck (tilman at code-monkey de) * @@ -49,42 +49,58 @@ 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, RbEvasObject, e); CHECK_CLASS (element, cEvasObject); - GET_OBJ (element, Evas_Object *, o); + GET_OBJ (element, RbEvasObject, o); - esmart_container_element_append (e->real, *o); + esmart_container_element_append (e->real, o->real); return Qnil; } -static VALUE c_element_prepend (VALUE self, VALUE element) +static VALUE c_prepend_element (VALUE self, VALUE element) { GET_OBJ (self, RbEvasObject, e); CHECK_CLASS (element, cEvasObject); - GET_OBJ (element, Evas_Object *, o); + GET_OBJ (element, RbEvasObject, o); - esmart_container_element_prepend (e->real, *o); + esmart_container_element_prepend (e->real, o->real); return Qnil; } -static VALUE c_element_remove (VALUE self, VALUE element) +static VALUE c_remove_element (VALUE self, VALUE element) { GET_OBJ (self, RbEvasObject, e); CHECK_CLASS (element, cEvasObject); - GET_OBJ (element, Evas_Object *, o); + GET_OBJ (element, RbEvasObject, o); - esmart_container_element_remove (e->real, *o); + esmart_container_element_remove (e->real, o->real); return Qnil; } +static VALUE c_elements_get (VALUE self) +{ + VALUE ary; + Evas_List *list, *l; + + GET_OBJ (self, RbEvasObject, e); + + list = esmart_container_elements_get (e->real); + ary = rb_ary_new (); + + for (l = list; l; l = l->next) + rb_ary_push (ary, TO_EVAS_OBJECT (l->data)); + + return ary; +} + static VALUE c_direction_get (VALUE self) { GET_OBJ (self, RbEvasObject, e); @@ -195,9 +211,10 @@ 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, "elements", c_elements_get, 0); rb_define_method (c, "scroll", c_scroll, 1); rb_define_const (c, "HORIZONTAL",