Implemented inspect and the manage* and sniff* methods.
[ruby-ecore.git] / src / ecore_x / rb_window.c
index 58c3d6b2625501a5d62a495861a69b0c53e2e2c2..d17817afdf06b21a3e2bc118a506cc340639e038 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: rb_window.c 81 2004-08-21 09:43:23Z tilman $
+ * $Id: rb_window.c 85 2004-08-22 11:53:57Z tilman $
  *
  * Copyright (C) 2004 ruby-ecore team (see AUTHORS)
  *
@@ -92,6 +92,19 @@ static VALUE c_new (int argc, VALUE *argv, VALUE klass)
        return self;
 }
 
+static VALUE c_inspect (VALUE self)
+{
+       char buf[128];
+
+       GET_OBJ (self, RbWindow, win);
+
+       snprintf (buf, sizeof (buf),
+                 "#<%s:%p id=%u>", rb_obj_classname (self),
+                 (void *) self, win->real);
+
+       return rb_str_new2 (buf);
+}
+
 static VALUE c_equal_value (VALUE self, VALUE other)
 {
        GET_OBJ (self, RbWindow, w1);
@@ -295,11 +308,57 @@ static VALUE c_set_protocol (VALUE self, VALUE proto, VALUE on)
        return Qnil;
 }
 
+static VALUE c_manage (VALUE self)
+{
+       GET_OBJ (self, RbWindow, win);
+
+       ecore_x_window_manage (win->real);
+
+       return Qnil;
+}
+
+static VALUE c_manage_container (VALUE self)
+{
+       GET_OBJ (self, RbWindow, win);
+
+       ecore_x_window_container_manage (win->real);
+
+       return Qnil;
+}
+
+static VALUE c_manage_client (VALUE self)
+{
+       GET_OBJ (self, RbWindow, win);
+
+       ecore_x_window_client_manage (win->real);
+
+       return Qnil;
+}
+
+static VALUE c_sniff (VALUE self)
+{
+       GET_OBJ (self, RbWindow, win);
+
+       ecore_x_window_sniff (win->real);
+
+       return Qnil;
+}
+
+static VALUE c_sniff_client (VALUE self)
+{
+       GET_OBJ (self, RbWindow, win);
+
+       ecore_x_window_client_sniff (win->real);
+
+       return Qnil;
+}
+
 void Init_Window (void)
 {
        cWindow = rb_define_class_under (mX, "Window", rb_cObject);
 
        rb_define_singleton_method (cWindow, "new", c_new, -1);
+       rb_define_method (cWindow, "inspect", c_inspect, 0);
        rb_define_method (cWindow, "==", c_equal_value, 1);
        rb_define_method (cWindow, "show", c_show, 0);
        rb_define_method (cWindow, "hide", c_hide, 0);
@@ -321,4 +380,9 @@ void Init_Window (void)
        rb_define_method (cWindow, "unset_event_mask",
                          c_unset_event_mask, 1);
        rb_define_method (cWindow, "set_protocol", c_set_protocol, 2);
+       rb_define_method (cWindow, "manage", c_manage, 0);
+       rb_define_method (cWindow, "manage_container", c_manage_container, 0);
+       rb_define_method (cWindow, "manage_client", c_manage_client, 0);
+       rb_define_method (cWindow, "sniff", c_sniff, 0);
+       rb_define_method (cWindow, "sniff_client", c_sniff_client, 0);
 }