X-Git-Url: http://git.code-monkey.de/?a=blobdiff_plain;f=src%2Frb_evas_object.c;h=a35477ab340b74070b0d34ae4ce5e46a4c6f07ed;hb=ff457c57c3ac469622c2fcd6bf9e66a55c1df678;hp=63e3cc4eb2e65f1fcd4f0e65ed844955b2f5a590;hpb=50d46594990dc1d3e518a2c808b7f51de32d6dda;p=ruby-evas.git diff --git a/src/rb_evas_object.c b/src/rb_evas_object.c index 63e3cc4..a35477a 100644 --- a/src/rb_evas_object.c +++ b/src/rb_evas_object.c @@ -1,5 +1,5 @@ /* - * $Id: rb_evas_object.c 314 2005-04-07 18:23:42Z tilman $ + * $Id: rb_evas_object.c 354 2006-02-10 18:14:08Z tilman $ * * Copyright (C) 2004 Tilman Sauerbeck (tilman at code-monkey de) * @@ -66,6 +66,19 @@ void c_evas_object_free (RbEvasObject *e, bool free_mem) free (e); } +static void c_free (RbEvasObject *e) +{ + c_evas_object_free (e, true); +} + +static VALUE c_alloc (VALUE klass) +{ + RbEvasObject *e; + + return Data_Make_Struct (klass, RbEvasObject, c_evas_object_mark, + c_free, e); +} + /* :nodoc: */ static VALUE c_init (VALUE self, VALUE parent) { @@ -85,6 +98,17 @@ static VALUE c_inspect (VALUE self) INSPECT (self, RbEvasObject); } +static VALUE c_type_get (VALUE self) +{ + const char *s; + + GET_OBJ (self, RbEvasObject, e); + + s = evas_object_type_get (e->real); + + return s ? rb_str_new2 (s) : Qnil; +} + /* * call-seq: * e.delete => nil @@ -364,6 +388,23 @@ static VALUE c_set_color (VALUE self, VALUE r, VALUE g, VALUE b, return Qnil; } +static VALUE c_get_clip (VALUE self) +{ + GET_OBJ (self, RbEvasObject, e); + + return TO_EVAS_OBJECT (evas_object_clip_get (e->real)); +} + +static VALUE c_set_clip (VALUE self, VALUE clip) +{ + GET_OBJ (self, RbEvasObject, e); + GET_OBJ (clip, RbEvasObject, e2); + + evas_object_clip_set (e->real, e2->real); + + return Qnil; +} + /* * call-seq: * e.pass_events? => true or false @@ -537,10 +578,10 @@ void Init_EvasObject (void) cEvasObject = rb_define_class_under (mEvas, "EvasObject", rb_cObject); - rb_define_private_method (rb_singleton_class (cEvasObject), - "new", NULL, 0); + rb_define_alloc_func (cEvasObject, c_alloc); rb_define_method (cEvasObject, "initialize", c_init, 1); rb_define_method (cEvasObject, "inspect", c_inspect, 0); + rb_define_method (cEvasObject, "type", c_type_get, 0); rb_define_method (cEvasObject, "delete", c_delete, 0); rb_define_method (cEvasObject, "resize", c_resize, 2); rb_define_method (cEvasObject, "move", c_move, 2); @@ -557,6 +598,8 @@ void Init_EvasObject (void) rb_define_method (cEvasObject, "layer=", c_layer_set, 1); rb_define_method (cEvasObject, "get_color", c_get_color, 0); rb_define_method (cEvasObject, "set_color", c_set_color, 4); + rb_define_method (cEvasObject, "clip", c_get_clip, 0); + rb_define_method (cEvasObject, "clip=", c_set_clip, 1); rb_define_method (cEvasObject, "pass_events?", c_pass_events_get, 0); rb_define_method (cEvasObject, "pass_events=",