X-Git-Url: http://git.code-monkey.de/?a=blobdiff_plain;f=src%2Fesmart_container%2Frb_esmart_container.c;h=453c103ff96dc788ad9f512e305cf3bb137bb7de;hb=063ce0ad31e1021184c281d2bebe71701b2d02cd;hp=9bc6432383482ee4f28c98e80d2e6c7123fd25cb;hpb=2eaf440d914c96a82d83883b8cd5656d4cf546ec;p=ruby-esmart.git diff --git a/src/esmart_container/rb_esmart_container.c b/src/esmart_container/rb_esmart_container.c index 9bc6432..453c103 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 70 2004-08-16 15:43:51Z tilman $ + * $Id: rb_esmart_container.c 218 2005-02-10 14:53:47Z tilman $ * * Copyright (C) 2004 Tilman Sauerbeck (tilman at code-monkey de) * @@ -101,6 +101,28 @@ static VALUE c_elements_get (VALUE self) return ary; } +static VALUE c_elements_length_get (VALUE self) +{ + double l; + + GET_OBJ (self, RbEvasObject, e); + + l = esmart_container_elements_length_get (e->real); + + return rb_float_new (l); +} + +static VALUE c_elements_orig_length_get (VALUE self) +{ + double l; + + GET_OBJ (self, RbEvasObject, e); + + l = esmart_container_elements_orig_length_get (e->real); + + return rb_float_new (l); +} + static VALUE c_direction_get (VALUE self) { GET_OBJ (self, RbEvasObject, e); @@ -155,6 +177,25 @@ static VALUE c_fill_policy_set (VALUE self, VALUE val) return Qnil; } +static VALUE c_alignment_get (VALUE self) +{ + GET_OBJ (self, RbEvasObject, e); + + return INT2FIX (esmart_container_alignment_get (e->real)); +} + +static VALUE c_alignment_set (VALUE self, VALUE val) +{ + GET_OBJ (self, RbEvasObject, e); + + Check_Type (val, T_FIXNUM); + + esmart_container_alignment_set (e->real, FIX2INT (val)); + + return Qnil; +} + + static VALUE c_get_padding (VALUE self) { double l = 0, r = 0, t = 0, b = 0; @@ -209,12 +250,17 @@ void Init_esmart_container (void) rb_define_method (c, "spacing=", c_spacing_set, 1); rb_define_method (c, "fill_policy", c_fill_policy_get, 0); rb_define_method (c, "fill_policy=", c_fill_policy_set, 1); + rb_define_method (c, "alignment", c_alignment_get, 0); + rb_define_method (c, "alignment=", c_alignment_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, "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, "elements_length", c_elements_length_get, 0); + rb_define_method (c, "elements_orig_length", + c_elements_orig_length_get, 0); rb_define_method (c, "scroll", c_scroll, 1); rb_define_const (c, "HORIZONTAL", @@ -232,4 +278,15 @@ void Init_esmart_container (void) INT2FIX (CONTAINER_FILL_POLICY_FILL_Y)); rb_define_const (c, "HOMOGENOUS", INT2FIX (CONTAINER_FILL_POLICY_HOMOGENOUS)); + + rb_define_const (c, "CENTER", + INT2FIX (CONTAINER_ALIGN_CENTER)); + rb_define_const (c, "LEFT", + INT2FIX (CONTAINER_ALIGN_LEFT)); + rb_define_const (c, "RIGHT", + INT2FIX (CONTAINER_ALIGN_RIGHT)); + rb_define_const (c, "BOTTOM", + INT2FIX (CONTAINER_ALIGN_BOTTOM)); + rb_define_const (c, "TOP", + INT2FIX (CONTAINER_ALIGN_TOP)); }