--- /dev/null
+/*
+ * $Id: rb_cursor.c 98 2004-08-26 13:12:55Z tilman $
+ *
+ * Copyright (C) 2004 ruby-ecore team (see AUTHORS)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include <ruby.h>
+
+#include <Ecore_X.h>
+#include <Ecore_X_Cursor.h>
+
+#define __RB_CURSOR_C
+#include "rb_ecore_x.h"
+#include "rb_cursor.h"
+
+VALUE cCursor;
+
+static void c_free (RbCursor *c)
+{
+ if (c->real && c->need_free)
+ ecore_x_cursor_free (c->real);
+
+ free (c);
+}
+
+static VALUE c_new_from_shape (VALUE klass, VALUE shape)
+{
+ VALUE self;
+ RbCursor *cursor = NULL;
+
+ self = Data_Make_Struct (klass, RbCursor, NULL, c_free, cursor);
+
+ cursor->real = ecore_x_cursor_shape_get (FIX2INT (shape));
+ cursor->need_free = false;
+
+ rb_obj_call_init (self, 0, NULL);
+
+ return self;
+}
+
+void Init_Cursor (void)
+{
+ cCursor = rb_define_class_under (mX, "Cursor", rb_cObject);
+
+ rb_define_singleton_method (cCursor, "new_from_shape",
+ c_new_from_shape, 1);
+
+ /* shape constants */
+ DEF_CONST (cCursor, ECORE_X_CURSOR_, X);
+ DEF_CONST (cCursor, ECORE_X_CURSOR_, ARROW);
+ DEF_CONST (cCursor, ECORE_X_CURSOR_, BASED_ARROW_DOWN);
+ DEF_CONST (cCursor, ECORE_X_CURSOR_, UP);
+ DEF_CONST (cCursor, ECORE_X_CURSOR_, BOAT);
+ DEF_CONST (cCursor, ECORE_X_CURSOR_, BOTTOM_LEFT_CORNER);
+ DEF_CONST (cCursor, ECORE_X_CURSOR_, BOTTOM_RIGHT_CORNER);
+ DEF_CONST (cCursor, ECORE_X_CURSOR_, BOTTOM_SIDE);
+ DEF_CONST (cCursor, ECORE_X_CURSOR_, BOTTOM_TEE);
+ DEF_CONST (cCursor, ECORE_X_CURSOR_, BOX_SPIRAL);
+ DEF_CONST (cCursor, ECORE_X_CURSOR_, CENTER_PTR);
+ DEF_CONST (cCursor, ECORE_X_CURSOR_, CIRCLE);
+ DEF_CONST (cCursor, ECORE_X_CURSOR_, CLOCK);
+ DEF_CONST (cCursor, ECORE_X_CURSOR_, COFFEE_MUG);
+ DEF_CONST (cCursor, ECORE_X_CURSOR_, CROSS);
+ DEF_CONST (cCursor, ECORE_X_CURSOR_, CROSS_REVERSE);
+ DEF_CONST (cCursor, ECORE_X_CURSOR_, CROSSHAIR);
+ DEF_CONST (cCursor, ECORE_X_CURSOR_, DIAMOND_CROSS);
+ DEF_CONST (cCursor, ECORE_X_CURSOR_, DOT);
+ DEF_CONST (cCursor, ECORE_X_CURSOR_, DOT_BOX_MASK);
+ DEF_CONST (cCursor, ECORE_X_CURSOR_, DOUBLE_ARROW);
+ DEF_CONST (cCursor, ECORE_X_CURSOR_, DRAFT_LARGE);
+ DEF_CONST (cCursor, ECORE_X_CURSOR_, DRAFT_SMALL);
+ DEF_CONST (cCursor, ECORE_X_CURSOR_, DRAPED_BOX);
+ DEF_CONST (cCursor, ECORE_X_CURSOR_, EXCHANGE);
+ DEF_CONST (cCursor, ECORE_X_CURSOR_, FLEUR);
+ DEF_CONST (cCursor, ECORE_X_CURSOR_, GOBBLER);
+ DEF_CONST (cCursor, ECORE_X_CURSOR_, GUMBY);
+ DEF_CONST (cCursor, ECORE_X_CURSOR_, HAND1);
+ DEF_CONST (cCursor, ECORE_X_CURSOR_, HAND2);
+ DEF_CONST (cCursor, ECORE_X_CURSOR_, HEART);
+ DEF_CONST (cCursor, ECORE_X_CURSOR_, ICON);
+ DEF_CONST (cCursor, ECORE_X_CURSOR_, IRON_CROSS);
+ DEF_CONST (cCursor, ECORE_X_CURSOR_, LEFT_PTR);
+ DEF_CONST (cCursor, ECORE_X_CURSOR_, LEFT_SIDE);
+ DEF_CONST (cCursor, ECORE_X_CURSOR_, LEFT_TEE);
+ DEF_CONST (cCursor, ECORE_X_CURSOR_, LEFTBUTTON);
+ DEF_CONST (cCursor, ECORE_X_CURSOR_, LL_ANGLE);
+ DEF_CONST (cCursor, ECORE_X_CURSOR_, LR_ANGLE);
+ DEF_CONST (cCursor, ECORE_X_CURSOR_, MAN);
+ DEF_CONST (cCursor, ECORE_X_CURSOR_, MIDDLEBUTTON);
+ DEF_CONST (cCursor, ECORE_X_CURSOR_, MOUSE);
+ DEF_CONST (cCursor, ECORE_X_CURSOR_, PENCIL);
+ DEF_CONST (cCursor, ECORE_X_CURSOR_, PIRATE);
+ DEF_CONST (cCursor, ECORE_X_CURSOR_, PLUS);
+ DEF_CONST (cCursor, ECORE_X_CURSOR_, QUESTION_ARROW);
+ DEF_CONST (cCursor, ECORE_X_CURSOR_, RIGHT_PTR);
+ DEF_CONST (cCursor, ECORE_X_CURSOR_, RIGHT_SIDE);
+ DEF_CONST (cCursor, ECORE_X_CURSOR_, RIGHT_TEE);
+ DEF_CONST (cCursor, ECORE_X_CURSOR_, RIGHTBUTTON);
+ DEF_CONST (cCursor, ECORE_X_CURSOR_, RTL_LOGO);
+ DEF_CONST (cCursor, ECORE_X_CURSOR_, SAILBOAT);
+ DEF_CONST (cCursor, ECORE_X_CURSOR_, SB_DOWN_ARROW);
+ DEF_CONST (cCursor, ECORE_X_CURSOR_, SB_H_DOUBLE_ARROW);
+ DEF_CONST (cCursor, ECORE_X_CURSOR_, SB_LEFT_ARROW);
+ DEF_CONST (cCursor, ECORE_X_CURSOR_, SB_RIGHT_ARROW);
+ DEF_CONST (cCursor, ECORE_X_CURSOR_, SB_UP_ARROW);
+ DEF_CONST (cCursor, ECORE_X_CURSOR_, SB_V_DOUBLE_ARROW);
+ DEF_CONST (cCursor, ECORE_X_CURSOR_, SHUTTLE);
+ DEF_CONST (cCursor, ECORE_X_CURSOR_, SIZING);
+ DEF_CONST (cCursor, ECORE_X_CURSOR_, SPIDER);
+ DEF_CONST (cCursor, ECORE_X_CURSOR_, SPRAYCAN);
+ DEF_CONST (cCursor, ECORE_X_CURSOR_, STAR);
+ DEF_CONST (cCursor, ECORE_X_CURSOR_, TARGET);
+ DEF_CONST (cCursor, ECORE_X_CURSOR_, TCROSS);
+ DEF_CONST (cCursor, ECORE_X_CURSOR_, TOP_LEFT_ARROW);
+ DEF_CONST (cCursor, ECORE_X_CURSOR_, TOP_LEFT_CORNER);
+ DEF_CONST (cCursor, ECORE_X_CURSOR_, TOP_RIGHT_CORNER);
+ DEF_CONST (cCursor, ECORE_X_CURSOR_, TOP_SIDE);
+ DEF_CONST (cCursor, ECORE_X_CURSOR_, TOP_TEE);
+ DEF_CONST (cCursor, ECORE_X_CURSOR_, TREK);
+ DEF_CONST (cCursor, ECORE_X_CURSOR_, UL_ANGLE);
+ DEF_CONST (cCursor, ECORE_X_CURSOR_, UMBRELLA);
+ DEF_CONST (cCursor, ECORE_X_CURSOR_, UR_ANGLE);
+ DEF_CONST (cCursor, ECORE_X_CURSOR_, WATCH);
+ DEF_CONST (cCursor, ECORE_X_CURSOR_, XTERM);
+}
/*
- * $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)
*
#include "../ecore/rb_ecore.h"
#include "rb_ecore_x.h"
#include "rb_window.h"
+#include "rb_cursor.h"
VALUE cWindow;
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];
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);
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);
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);
}