From: Tilman Sauerbeck Date: Mon, 25 Apr 2005 21:48:10 +0000 (+0000) Subject: Added Esmart::Container#scroll_percent and scroll_percent=. X-Git-Url: http://git.code-monkey.de/?a=commitdiff_plain;ds=sidebyside;h=442a877da882d6b38a5ed267d2f0024f9212eb58;hp=3528451b849fcc1650a5d76da48f334b3fdecf6b;p=ruby-esmart.git Added Esmart::Container#scroll_percent and scroll_percent=. --- diff --git a/src/esmart_container/rb_esmart_container.c b/src/esmart_container/rb_esmart_container.c index 34c8e26..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 297 2005-03-18 18:49:46Z tilman $ + * $Id: rb_esmart_container.c 317 2005-04-25 21:48:10Z tilman $ * * Copyright (C) 2004 Tilman Sauerbeck (tilman at code-monkey de) * @@ -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));