X-Git-Url: http://git.code-monkey.de/?p=ruby-edje.git;a=blobdiff_plain;f=src%2Frb_part.c;h=533b1638a40bdaea3c6f5ce8ffb6b5ea668c76b1;hp=e20259c48411daf307442a1d2bdcc88159162080;hb=00a4c037d60430de9f496f26804474949dceebad;hpb=30fb3b8341f1f9ee89d0fc2a699401c98b4c9201 diff --git a/src/rb_part.c b/src/rb_part.c index e20259c..533b163 100644 --- a/src/rb_part.c +++ b/src/rb_part.c @@ -1,6 +1,4 @@ /* - * $Id: rb_part.c 59 2004-08-10 14:10:31Z tilman $ - * * Copyright (C) 2004 Tilman Sauerbeck (tilman at code-monkey de) * * This library is free software; you can redistribute it and/or @@ -86,7 +84,7 @@ static VALUE c_geometry_get (VALUE self) (Evas_Coord *) &h); return rb_ary_new3 (4, INT2FIX (x), INT2FIX (y), - INT2FIX (y), INT2FIX (h)); + INT2FIX (w), INT2FIX (h)); } /* @@ -103,6 +101,7 @@ static VALUE c_swallow (VALUE self, VALUE target) GET_OBJ (target, RbEvasObject, t); edje_object_part_swallow (e->real.real, GET_NAME (self), t->real); + rb_iv_set (self, "swallowed_obj", target); return Qnil; } @@ -127,6 +126,7 @@ static VALUE c_unswallow (VALUE self) } edje_object_part_unswallow (e->real.real, o); + rb_iv_set (self, "swallowed_obj", Qnil); return Qnil; } @@ -142,7 +142,6 @@ static VALUE c_unswallow (VALUE self) static VALUE c_swallowed_object_get (VALUE self) { Evas_Object *o; - void *obj; GET_OBJ (GET_EDJE (self), RbEdje, e); @@ -150,12 +149,7 @@ static VALUE c_swallowed_object_get (VALUE self) if (!o) return Qnil; - if (!(obj = evas_object_data_get (o, RUBY_EVAS_OBJECT_KEY))) { - rb_raise (rb_eException, "EvasObject Ruby object key missing"); - return Qnil; - } - - return (VALUE) obj; + return TO_EVAS_OBJECT (o); } /* @@ -237,6 +231,19 @@ static VALUE c_set_drag_value (VALUE self, VALUE dx, VALUE dy) return Qnil; } +static VALUE c_state_get (VALUE self) +{ + const char *name; + double val = 0.0; + + GET_OBJ (GET_EDJE (self), RbEdje, e); + + name = edje_object_part_state_get (e->real.real, + GET_NAME (self), &val); + + return rb_ary_new3 (2, rb_str_new2 (name), rb_float_new (val)); +} + void Init_Part (void) { cPart = rb_define_class_under (mEdje, "Part", rb_cObject); @@ -254,6 +261,7 @@ void Init_Part (void) c_swallowed_object_get, 0); rb_define_method (cPart, "text", c_text_get, 0); rb_define_method (cPart, "text=", c_text_set, 1); - rb_define_method (cPart, "get_drag_value", c_get_drag_value, 2); + rb_define_method (cPart, "get_drag_value", c_get_drag_value, 0); rb_define_method (cPart, "set_drag_value", c_set_drag_value, 2); + rb_define_method (cPart, "state", c_state_get, 0); }