From 442a877da882d6b38a5ed267d2f0024f9212eb58 Mon Sep 17 00:00:00 2001 From: Tilman Sauerbeck Date: Mon, 25 Apr 2005 21:48:10 +0000 Subject: [PATCH] Added Esmart::Container#scroll_percent and scroll_percent=. --- src/esmart_container/rb_esmart_container.c | 26 +++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) 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)); -- 2.30.2