Added the Ecore::X::Cursor class.
[ruby-ecore.git] / src / ecore_x / rb_window.c
index f5af7c78d9a168fc17db7e565b846624866db2ba..0463e2142e23dbab01c1234a0e0a1c85baae0ed6 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: rb_window.c 97 2004-08-23 18:30:28Z tilman $
+ * $Id: rb_window.c 98 2004-08-26 13:12:55Z tilman $
  *
  * Copyright (C) 2004 ruby-ecore team (see AUTHORS)
  *
@@ -27,6 +27,7 @@
 #include "../ecore/rb_ecore.h"
 #include "rb_ecore_x.h"
 #include "rb_window.h"
+#include "rb_cursor.h"
 
 VALUE cWindow;
 
@@ -92,6 +93,13 @@ static VALUE c_new (int argc, VALUE *argv, VALUE klass)
        return self;
 }
 
+static VALUE c_init (int argc, VALUE *argv, VALUE self)
+{
+       rb_iv_set (self, "@cursor", Qnil);
+
+       return self;
+}
+
 static VALUE c_inspect (VALUE self)
 {
        char buf[128];
@@ -361,6 +369,19 @@ static VALUE c_sticky_set (VALUE self, VALUE val)
        return Qnil;
 }
 
+static VALUE c_cursor_set (VALUE self, VALUE val)
+{
+       GET_OBJ (self, RbWindow, win);
+
+       CHECK_CLASS (val, cCursor);
+       GET_OBJ (val, RbCursor, c);
+
+       ecore_x_window_cursor_set (win->real, c->real);
+       rb_iv_set (self, "@cursor", val);
+
+       return Qnil;
+}
+
 static VALUE c_manage (VALUE self)
 {
        GET_OBJ (self, RbWindow, win);
@@ -411,6 +432,7 @@ 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, "initialize", c_init, -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);
@@ -439,9 +461,12 @@ void Init_Window (void)
        rb_define_method (cWindow, "get_protocol", c_get_protocol, 1);
        rb_define_method (cWindow, "sticky?", c_sticky_get, 0);
        rb_define_method (cWindow, "sticky=", c_sticky_set, 1);
+       rb_define_method (cWindow, "cursor=", c_cursor_set, 1);
        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);
+
+       rb_define_attr (cWindow, "cursor", 1, 0);
 }