X-Git-Url: http://git.code-monkey.de/?a=blobdiff_plain;f=src%2Fesmart_container%2Frb_esmart_container.c;h=45e13f8958173a7ba5a93518cef1dedb8e7b936f;hb=442a877da882d6b38a5ed267d2f0024f9212eb58;hp=3269c37091bbc8105b5013027a3feca5af5d3211;hpb=d1dbab6affa71d4244e12e7e8e98531d23c573a5;p=ruby-esmart.git diff --git a/src/esmart_container/rb_esmart_container.c b/src/esmart_container/rb_esmart_container.c index 3269c37..45e13f8 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 286 2005-03-15 18:05:42Z tilman $ + * $Id: rb_esmart_container.c 317 2005-04-25 21:48:10Z tilman $ * * Copyright (C) 2004 Tilman Sauerbeck (tilman at code-monkey de) * @@ -60,7 +60,7 @@ static VALUE c_new (VALUE klass, VALUE evas) argv[0] = evas; rb_obj_call_init (self, 1, argv); - rb_iv_set (self, "@elements", rb_ary_new ()); + cont->elements = rb_ary_new (); return self; } @@ -250,6 +250,28 @@ static VALUE c_scroll (VALUE self, VALUE val) return Qnil; } +static VALUE c_scroll_percent_get (VALUE self) +{ + double val; + + GET_OBJ (self, RbContainer, e); + + val = esmart_container_scroll_percent_get (e->real.real); + + return rb_float_new (val); +} + +static VALUE c_scroll_percent_set (VALUE self, VALUE val) +{ + GET_OBJ (self, RbContainer, e); + + Check_Type (val, T_FLOAT); + + esmart_container_scroll_percent_set (e->real.real, NUM2DBL (val)); + + return Qnil; +} + void Init_esmart_container (void) { VALUE c; @@ -277,6 +299,8 @@ void Init_esmart_container (void) rb_define_method (c, "elements_orig_length", c_elements_orig_length_get, 0); rb_define_method (c, "scroll", c_scroll, 1); + rb_define_method (c, "scroll_percent", c_scroll_percent_get, 0); + rb_define_method (c, "scroll_percent=", c_scroll_percent_set, 1); rb_define_const (c, "HORIZONTAL", INT2FIX (CONTAINER_DIRECTION_HORIZONTAL));