X-Git-Url: http://git.code-monkey.de/?a=blobdiff_plain;f=src%2Fecore_x%2Frb_window.c;h=58c3d6b2625501a5d62a495861a69b0c53e2e2c2;hb=aaf65fd2a802aa98b8fb2001bf711fac0f5c74e3;hp=04bb1166e8dd42c1c2c52394593035285add0b0b;hpb=0ad70bf579b712a8bf770e2775cffa4a50097557;p=ruby-ecore.git diff --git a/src/ecore_x/rb_window.c b/src/ecore_x/rb_window.c index 04bb116..58c3d6b 100644 --- a/src/ecore_x/rb_window.c +++ b/src/ecore_x/rb_window.c @@ -1,5 +1,5 @@ /* - * $Id: rb_window.c 77 2004-08-19 17:39:29Z tilman $ + * $Id: rb_window.c 81 2004-08-21 09:43:23Z tilman $ * * Copyright (C) 2004 ruby-ecore team (see AUTHORS) * @@ -49,9 +49,6 @@ VALUE TO_ECORE_X_WINDOW (VALUE parent, Ecore_X_Window w) VALUE self; RbWindow *window = NULL; - if (!w) - return Qnil; - self = Data_Make_Struct (cWindow, RbWindow, c_mark, free, window); window->real = w; @@ -123,6 +120,13 @@ static VALUE c_hide (VALUE self) return Qnil; } +static VALUE c_visible_get (VALUE self) +{ + GET_OBJ (self, RbWindow, win); + + return ecore_x_window_visible_get (win->real) ? Qtrue : Qfalse; +} + static VALUE c_delete (VALUE self) { GET_OBJ (self, RbWindow, win); @@ -153,6 +157,22 @@ static VALUE c_lower (VALUE self) return Qnil; } +static VALUE c_reparent (VALUE self, VALUE other, VALUE x, VALUE y) +{ + GET_OBJ (self, RbWindow, win); + + CHECK_CLASS (other, cWindow); + GET_OBJ (other, RbWindow, o); + + Check_Type (x, T_FIXNUM); + Check_Type (y, T_FIXNUM); + + ecore_x_window_reparent (win->real, o->real, + FIX2INT (x), FIX2INT (y)); + + return Qnil; +} + static VALUE c_move (VALUE self, VALUE x, VALUE y) { GET_OBJ (self, RbWindow, win); @@ -177,18 +197,18 @@ static VALUE c_resize (VALUE self, VALUE w, VALUE h) return Qnil; } -static VALUE c_get_size (VALUE self) +static VALUE c_size_get (VALUE self) { - int x = 0, y = 0; + int w = 0, h = 0; GET_OBJ (self, RbWindow, win); - ecore_x_window_size_get (win->real, &x, &y); + ecore_x_window_size_get (win->real, &w, &h); - return rb_ary_new3 (2, INT2FIX (x), INT2FIX (y)); + return rb_ary_new3 (2, INT2FIX (w), INT2FIX (h)); } -static VALUE c_get_geometry (VALUE self) +static VALUE c_geometry_get (VALUE self) { int x = 0, y = 0, w = 0, h = 0; @@ -200,6 +220,46 @@ static VALUE c_get_geometry (VALUE self) INT2FIX (w), INT2FIX (h)); } +static VALUE c_border_size_get (VALUE self) +{ + GET_OBJ (self, RbWindow, win); + + return INT2FIX (ecore_x_window_border_size_get (win->real)); +} + +static VALUE c_depth_get (VALUE self) +{ + GET_OBJ (self, RbWindow, win); + + return INT2FIX (ecore_x_window_depth_get (win->real)); +} + +static VALUE c_parent_get (VALUE self) +{ + GET_OBJ (self, RbWindow, win); + + return TO_ECORE_X_WINDOW (Qnil, + ecore_x_window_parent_get (win->real)); +} + +static VALUE c_title_get (VALUE self) +{ + GET_OBJ (self, RbWindow, win); + + return rb_str_new2 (ecore_x_window_prop_title_get (win->real)); +} + +static VALUE c_title_set (VALUE self, VALUE val) +{ + GET_OBJ (self, RbWindow, win); + + Check_Type (val, T_STRING); + + ecore_x_window_prop_title_set (win->real, StringValuePtr (val)); + + return Qnil; +} + static VALUE c_set_event_mask (VALUE self, VALUE val) { GET_OBJ (self, RbWindow, win); @@ -243,13 +303,20 @@ void Init_Window (void) rb_define_method (cWindow, "==", c_equal_value, 1); rb_define_method (cWindow, "show", c_show, 0); rb_define_method (cWindow, "hide", c_hide, 0); + rb_define_method (cWindow, "visible?", c_visible_get, 0); rb_define_method (cWindow, "delete", c_delete, 0); rb_define_method (cWindow, "raise", c_raise, 0); rb_define_method (cWindow, "lower", c_lower, 0); + rb_define_method (cWindow, "reparent", c_reparent, 3); rb_define_method (cWindow, "move", c_move, 2); rb_define_method (cWindow, "resize", c_resize, 2); - rb_define_method (cWindow, "get_size", c_get_size, 0); - rb_define_method (cWindow, "get_geometry", c_get_geometry, 0); + rb_define_method (cWindow, "size", c_size_get, 0); + rb_define_method (cWindow, "geometry", c_geometry_get, 0); + rb_define_method (cWindow, "border_size", c_border_size_get, 0); + rb_define_method (cWindow, "depth", c_depth_get, 0); + rb_define_method (cWindow, "parent", c_parent_get, 0); + rb_define_method (cWindow, "title", c_title_get, 0); + rb_define_method (cWindow, "title=", c_title_set, 1); rb_define_method (cWindow, "set_event_mask", c_set_event_mask, 1); rb_define_method (cWindow, "unset_event_mask", c_unset_event_mask, 1);