gdk3 2.2.0 → 2.2.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (63) hide show
  1. checksums.yaml +4 -4
  2. data/Rakefile +18 -4
  3. data/lib/gdk3/atom.rb +26 -0
  4. data/lib/gdk3/cairo.rb +60 -0
  5. data/lib/gdk3/color.rb +27 -0
  6. data/lib/gdk3/deprecated.rb +14 -16
  7. data/lib/gdk3/event.rb +38 -0
  8. data/lib/gdk3/loader.rb +266 -0
  9. data/lib/gdk3/rectangle.rb +38 -0
  10. data/lib/gdk3/rgba.rb +32 -0
  11. data/lib/gdk3/window-attr.rb +28 -0
  12. data/lib/gdk3/window.rb +21 -0
  13. data/lib/gdk3.rb +61 -2
  14. data/test/run-test.rb +15 -6
  15. data/test/test-gdk-cairo.rb +41 -0
  16. data/test/test-gdk-event-type.rb +25 -0
  17. data/test/test-gdk-event.rb +47 -49
  18. data/test/test-gdk-keyval.rb +21 -0
  19. data/test/test-gdk-pixbuf.rb +49 -0
  20. data/test/test-gdk-rectangle.rb +35 -4
  21. data/test/test-gdk-rgba.rb +6 -1
  22. data/test/test-gdk-window-attr.rb +1 -1
  23. metadata +23 -51
  24. data/ext/gdk3/depend +0 -11
  25. data/ext/gdk3/extconf.rb +0 -130
  26. data/ext/gdk3/gdk3.def +0 -12
  27. data/ext/gdk3/init.c +0 -35
  28. data/ext/gdk3/rbgdk.c +0 -491
  29. data/ext/gdk3/rbgdk3.h +0 -73
  30. data/ext/gdk3/rbgdk3conversions.h +0 -121
  31. data/ext/gdk3/rbgdk3private.h +0 -85
  32. data/ext/gdk3/rbgdkatom.c +0 -122
  33. data/ext/gdk3/rbgdkcairo.c +0 -91
  34. data/ext/gdk3/rbgdkcolor.c +0 -137
  35. data/ext/gdk3/rbgdkconst.c +0 -33
  36. data/ext/gdk3/rbgdkcursor.c +0 -92
  37. data/ext/gdk3/rbgdkdevice.c +0 -253
  38. data/ext/gdk3/rbgdkdevicemanager.c +0 -39
  39. data/ext/gdk3/rbgdkdisplay.c +0 -434
  40. data/ext/gdk3/rbgdkdisplaymanager.c +0 -55
  41. data/ext/gdk3/rbgdkdragcontext.c +0 -191
  42. data/ext/gdk3/rbgdkevent.c +0 -1173
  43. data/ext/gdk3/rbgdkgeometry.c +0 -253
  44. data/ext/gdk3/rbgdkkeymap.c +0 -151
  45. data/ext/gdk3/rbgdkkeyval.c +0 -108
  46. data/ext/gdk3/rbgdkpango.c +0 -197
  47. data/ext/gdk3/rbgdkpangorenderer.c +0 -144
  48. data/ext/gdk3/rbgdkpixbuf.c +0 -176
  49. data/ext/gdk3/rbgdkproperty.c +0 -305
  50. data/ext/gdk3/rbgdkrectangle.c +0 -140
  51. data/ext/gdk3/rbgdkrgb.c +0 -199
  52. data/ext/gdk3/rbgdkrgba.c +0 -142
  53. data/ext/gdk3/rbgdkscreen.c +0 -443
  54. data/ext/gdk3/rbgdkselection.c +0 -146
  55. data/ext/gdk3/rbgdkthreads.c +0 -77
  56. data/ext/gdk3/rbgdktimecoord.c +0 -133
  57. data/ext/gdk3/rbgdkvisual.c +0 -251
  58. data/ext/gdk3/rbgdkwindow.c +0 -1069
  59. data/ext/gdk3/rbgdkwindowattr.c +0 -191
  60. data/ext/gdk3/rbgdkx11.c +0 -102
  61. data/ext/gdk3/rbgdkx11x11window.c +0 -66
  62. data/extconf.rb +0 -49
  63. data/lib/gdk3/base.rb +0 -59
@@ -1,85 +0,0 @@
1
- /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
- /*
3
- * Copyright (C) 2011 Ruby-GNOME2 Project Team
4
- * Copyright (C) 2002,2003 Ruby-GNOME2 Project Team
5
- * Copyright (C) 1998-2000 Yukihiro Matsumoto,
6
- * Daisuke Kanda,
7
- * Hiroshi Igarashi
8
- *
9
- * This library is free software; you can redistribute it and/or
10
- * modify it under the terms of the GNU Lesser General Public
11
- * License as published by the Free Software Foundation; either
12
- * version 2.1 of the License, or (at your option) any later version.
13
- *
14
- * This library is distributed in the hope that it will be useful,
15
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
16
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17
- * Lesser General Public License for more details.
18
- *
19
- * You should have received a copy of the GNU Lesser General Public
20
- * License along with this library; if not, write to the Free Software
21
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
22
- * MA 02110-1301 USA
23
- */
24
-
25
- #ifndef __RBGDK3PRIVATE_H__
26
- #define __RBGDK3PRIVATE_H__
27
-
28
- #ifdef HAVE_RUBY_ST_H
29
- # include <ruby/st.h>
30
- #else
31
- # include <st.h>
32
- #endif
33
-
34
- #include <rb_cairo.h>
35
- #include <rbgobject.h>
36
- #include <rbpango.h>
37
- #include "rbgdk3.h"
38
-
39
- #ifndef HAVE_RB_ERRINFO
40
- # define rb_errinfo() (ruby_errinfo)
41
- #endif
42
-
43
- #ifndef G_VALUE_INIT
44
- # define G_VALUE_INIT { 0, { { 0 } } }
45
- #endif
46
-
47
- extern ID id_call;
48
-
49
- G_GNUC_INTERNAL void Init_gdk(void);
50
- G_GNUC_INTERNAL void Init_gdk_atom(VALUE mGdk);
51
- G_GNUC_INTERNAL void Init_gdk_cairo(void);
52
- G_GNUC_INTERNAL void Init_gdk_color(VALUE mGdk);
53
- G_GNUC_INTERNAL void Init_gdk_const(VALUE mGdk);
54
- G_GNUC_INTERNAL void Init_gdk_cursor(VALUE mGdk);
55
- G_GNUC_INTERNAL void Init_gdk_device(VALUE mGdk);
56
- G_GNUC_INTERNAL void Init_gdk_device_manager(VALUE mGdk);
57
- G_GNUC_INTERNAL void Init_gdk_display(VALUE mGdk);
58
- G_GNUC_INTERNAL void Init_gdk_display_manager(VALUE mGdk);
59
- G_GNUC_INTERNAL void Init_gdk_dragcontext(VALUE mGdk);
60
- G_GNUC_INTERNAL void Init_gdk_event(VALUE mGdk);
61
- G_GNUC_INTERNAL void Init_gdk_geometry(VALUE mGdk);
62
- G_GNUC_INTERNAL void Init_gdk_keymap(VALUE mGdk);
63
- G_GNUC_INTERNAL void Init_gdk_keyval(VALUE mGdk);
64
- G_GNUC_INTERNAL void Init_gdk_pango(VALUE mGdk);
65
- /* deprecated
66
- G_GNUC_INTERNAL void Init_gdk_pangorenderer(VALUE mGdk);
67
- */
68
- G_GNUC_INTERNAL void Init_gdk_pixbuf(VALUE mGdk);
69
- G_GNUC_INTERNAL void Init_gdk_property(VALUE mGdk);
70
- G_GNUC_INTERNAL void Init_gdk_rectangle(VALUE mGdk);
71
- /* deprecated
72
- G_GNUC_INTERNAL void Init_gdk_rgb(VALUE mGdk);
73
- */
74
- G_GNUC_INTERNAL void Init_gdk_rgba(VALUE mGdk);
75
- G_GNUC_INTERNAL void Init_gdk_screen(VALUE mGdk);
76
- G_GNUC_INTERNAL void Init_gdk_selection(VALUE mGdk);
77
- G_GNUC_INTERNAL void Init_gdk_threads(VALUE mGdk);
78
- G_GNUC_INTERNAL void Init_gdk_timecoord(VALUE mGdk);
79
- G_GNUC_INTERNAL void Init_gdk_visual(VALUE mGdk);
80
- G_GNUC_INTERNAL void Init_gdk_window(VALUE mGdk);
81
- G_GNUC_INTERNAL void Init_gdk_windowattr(VALUE mGdk);
82
- G_GNUC_INTERNAL void Init_gdkx11(void);
83
- G_GNUC_INTERNAL void Init_gdkx11_x11window(VALUE mGdkX11);
84
-
85
- #endif /* __RBGDK3PRIVATE_H__ */
data/ext/gdk3/rbgdkatom.c DELETED
@@ -1,122 +0,0 @@
1
- /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
- /*
3
- * Copyright (C) 2011 Ruby-GNOME2 Project Team
4
- * Copyright (C) 2002,2003 Masao Mutoh
5
- *
6
- * This library is free software; you can redistribute it and/or
7
- * modify it under the terms of the GNU Lesser General Public
8
- * License as published by the Free Software Foundation; either
9
- * version 2.1 of the License, or (at your option) any later version.
10
- *
11
- * This library is distributed in the hope that it will be useful,
12
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
- * Lesser General Public License for more details.
15
- *
16
- * You should have received a copy of the GNU Lesser General Public
17
- * License along with this library; if not, write to the Free Software
18
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19
- * MA 02110-1301 USA
20
- */
21
-
22
- #include "rbgdk3private.h"
23
-
24
- #define RG_TARGET_NAMESPACE cAtom
25
- #define _SELF(a) ((RVAL2GDKATOM(a))->atom)
26
-
27
- /*****************************************/
28
- static GdkAtomData *
29
- gdk_atom_copy(const GdkAtom atom)
30
- {
31
- GdkAtomData* data;
32
- data = g_new(GdkAtomData, 1);
33
- data->atom = atom;
34
- return data;
35
- }
36
-
37
- GType
38
- gdk_atom_get_type(void)
39
- {
40
- static GType our_type = 0;
41
- if (our_type == 0)
42
- our_type = g_boxed_type_register_static ("GdkAtomData",
43
- (GBoxedCopyFunc)gdk_atom_copy,
44
- (GBoxedFreeFunc)g_free);
45
- return our_type;
46
- }
47
-
48
- GdkAtom
49
- get_gdkatom(VALUE atom)
50
- {
51
- if (TYPE(atom) == T_STRING)
52
- return gdk_atom_intern(RVAL2CSTR(atom), FALSE);
53
- return (RVAL2GDKATOM(atom))->atom;
54
- }
55
- /*****************************************/
56
-
57
- static VALUE
58
- rg_s_intern(int argc, VALUE *argv, G_GNUC_UNUSED VALUE self)
59
- {
60
- VALUE name;
61
- VALUE exist;
62
-
63
- rb_scan_args(argc, argv, "11", &name, &exist);
64
-
65
- return GDKATOM2RVAL(gdk_atom_intern(RVAL2CSTR(name), RVAL2CBOOL(exist)));
66
- }
67
-
68
- /* We don't need them.
69
- GdkAtom gdk_atom_intern_static_string(const gchar *atom_name);
70
- */
71
-
72
- static VALUE
73
- rg_initialize(VALUE self, VALUE num)
74
- {
75
- guint atom = FIX2INT(num);
76
- if (atom == 0){
77
- /* This is a trick for passing 0(NULL) */
78
- G_INITIALIZE(self, GUINT_TO_POINTER(1));
79
- _SELF(self) = GUINT_TO_POINTER(GDK_NONE);
80
- } else {
81
- G_INITIALIZE(self, GUINT_TO_POINTER(atom));
82
- }
83
-
84
- return Qnil;
85
- }
86
-
87
- static VALUE
88
- rg_name(VALUE self)
89
- {
90
- return CSTR2RVAL_FREE(gdk_atom_name(_SELF(self)));
91
- }
92
-
93
- static VALUE
94
- rg_to_i(VALUE self)
95
- {
96
- return UINT2NUM(GPOINTER_TO_UINT(_SELF(self)));
97
- }
98
-
99
- static VALUE
100
- rg_operator_equal(VALUE self, VALUE other)
101
- {
102
- return CBOOL2RVAL(_SELF(self) == _SELF(other));
103
- }
104
-
105
- void
106
- Init_gdk_atom(VALUE mGdk)
107
- {
108
- VALUE none;
109
- VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GDK_TYPE_ATOM, "Atom", mGdk);
110
-
111
- RG_DEF_SMETHOD(intern, -1);
112
-
113
- RG_DEF_METHOD(initialize, 1);
114
- RG_DEF_METHOD(name, 0);
115
- RG_DEF_METHOD(to_i, 0);
116
- RG_DEF_METHOD_OPERATOR("==", equal, 1);
117
-
118
- /* This is a trick to define GDK_NONE as a BOXED object */
119
- none = GDKATOM2RVAL((gpointer)1);
120
- rb_define_const(RG_TARGET_NAMESPACE, "NONE", none);
121
- _SELF(none) = GDK_NONE;
122
- }
@@ -1,91 +0,0 @@
1
- /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
- /*
3
- * Copyright (C) 2011 Ruby-GNOME2 Project Team
4
- * Copyright (C) 2005 Kouhei Sutou
5
- *
6
- * This library is free software; you can redistribute it and/or
7
- * modify it under the terms of the GNU Lesser General Public
8
- * License as published by the Free Software Foundation; either
9
- * version 2.1 of the License, or (at your option) any later version.
10
- *
11
- * This library is distributed in the hope that it will be useful,
12
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
- * Lesser General Public License for more details.
15
- *
16
- * You should have received a copy of the GNU Lesser General Public
17
- * License along with this library; if not, write to the Free Software
18
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19
- * MA 02110-1301 USA
20
- */
21
-
22
- #include "rbgdk3private.h"
23
-
24
- #include <gdk/gdk.h>
25
- #include <rb_cairo.h>
26
-
27
- #define RG_TARGET_NAMESPACE rb_cCairo_Context
28
- #define _SELF(self) RVAL2CRCONTEXT(self)
29
-
30
- static VALUE
31
- rg_set_source_gdk_color(VALUE self, VALUE color)
32
- {
33
- gdk_cairo_set_source_color(_SELF(self), RVAL2GDKCOLOR(color));
34
- rb_cairo_check_status(cairo_status(_SELF(self)));
35
- return self;
36
- }
37
-
38
- static VALUE
39
- rg_set_source_pixbuf(int argc, VALUE *argv, VALUE self)
40
- {
41
- VALUE pixbuf, pixbuf_x, pixbuf_y;
42
-
43
- rb_scan_args(argc, argv, "12", &pixbuf, &pixbuf_x, &pixbuf_y);
44
-
45
- gdk_cairo_set_source_pixbuf(_SELF(self),
46
- RVAL2GDKPIXBUF(pixbuf),
47
- NIL_P(pixbuf_x) ? 0 : NUM2DBL(pixbuf_x),
48
- NIL_P(pixbuf_y) ? 0 : NUM2DBL(pixbuf_y));
49
- rb_cairo_check_status(cairo_status(_SELF(self)));
50
- return self;
51
- }
52
-
53
- /* deprecated
54
- static VALUE
55
- rg_set_source_pixmap(VALUE self, VALUE pixmap, VALUE pixmap_x, VALUE pixmap_y)
56
- {
57
- gdk_cairo_set_source_pixmap(_SELF(self), RVAL2GDKPIXMAP(pixmap),
58
- NUM2DBL(pixmap_x), NUM2DBL(pixmap_y));
59
- rb_cairo_check_status(cairo_status(_SELF(self)));
60
- return self;
61
- }
62
- */
63
-
64
- static VALUE
65
- rg_gdk_rectangle(VALUE self, VALUE rectangle)
66
- {
67
- gdk_cairo_rectangle(_SELF(self),
68
- RVAL2GDKRECTANGLE(rectangle));
69
- rb_cairo_check_status(cairo_status(_SELF(self)));
70
- return self;
71
- }
72
-
73
- static VALUE
74
- rg_gdk_region(VALUE self, VALUE region)
75
- {
76
- gdk_cairo_region(_SELF(self), RVAL2CRREGION(region));
77
- rb_cairo_check_status(cairo_status(_SELF(self)));
78
- return self;
79
- }
80
-
81
- void
82
- Init_gdk_cairo(void)
83
- {
84
- RG_DEF_METHOD(set_source_gdk_color, 1);
85
- RG_DEF_METHOD(set_source_pixbuf, -1);
86
- /* deprecated
87
- RG_DEF_METHOD(set_source_pixmap, 3);
88
- */
89
- RG_DEF_METHOD(gdk_rectangle, 1);
90
- RG_DEF_METHOD(gdk_region, 1);
91
- }
@@ -1,137 +0,0 @@
1
- /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
- /*
3
- * Copyright (C) 2011-2013 Ruby-GNOME2 Project Team
4
- * Copyright (C) 2002,2003 Ruby-GNOME2 Project Team
5
- * Copyright (C) 1998-2000 Yukihiro Matsumoto,
6
- * Daisuke Kanda,
7
- * Hiroshi Igarashi
8
- *
9
- * This library is free software; you can redistribute it and/or
10
- * modify it under the terms of the GNU Lesser General Public
11
- * License as published by the Free Software Foundation; either
12
- * version 2.1 of the License, or (at your option) any later version.
13
- *
14
- * This library is distributed in the hope that it will be useful,
15
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
16
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17
- * Lesser General Public License for more details.
18
- *
19
- * You should have received a copy of the GNU Lesser General Public
20
- * License along with this library; if not, write to the Free Software
21
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
22
- * MA 02110-1301 USA
23
- */
24
-
25
- #include "rbgdk3private.h"
26
-
27
- #define RG_TARGET_NAMESPACE cColor
28
- #define _SELF(c) (RVAL2GDKCOLOR(c))
29
-
30
- static VALUE
31
- rg_initialize(VALUE self, VALUE red, VALUE green, VALUE blue)
32
- {
33
- GdkColor color;
34
- color.pixel = 0;
35
- color.red = NUM2INT(red);
36
- color.green = NUM2INT(green);
37
- color.blue = NUM2INT(blue);
38
-
39
- G_INITIALIZE(self, g_boxed_copy(GDK_TYPE_COLOR, &color));
40
-
41
- return Qnil;
42
- }
43
-
44
- static VALUE
45
- rg_s_parse(G_GNUC_UNUSED VALUE self, VALUE name)
46
- {
47
- GdkColor c;
48
- if (! gdk_color_parse(RVAL2CSTR(name), &c)) {
49
- rb_raise(rb_eArgError, "can't parse color name `%s'", RVAL2CSTR(name));
50
- }
51
- return GDKCOLOR2RVAL(&c);
52
- }
53
-
54
- static VALUE
55
- rg_pixel(VALUE self)
56
- {
57
- return INT2NUM(_SELF(self)->pixel);
58
- }
59
-
60
- static VALUE
61
- rg_red(VALUE self)
62
- {
63
-
64
- return INT2FIX(_SELF(self)->red);
65
- }
66
-
67
- static VALUE
68
- rg_set_red(VALUE self, VALUE red)
69
- {
70
- _SELF(self)->red = NUM2INT(red);
71
- return self;
72
- }
73
-
74
- static VALUE
75
- rg_green(VALUE self)
76
- {
77
- return INT2FIX(_SELF(self)->green);
78
- }
79
-
80
- static VALUE
81
- rg_set_green(VALUE self, VALUE green)
82
- {
83
- _SELF(self)->green = NUM2INT(green);
84
- return self;
85
- }
86
-
87
- static VALUE
88
- rg_blue(VALUE self)
89
- {
90
- return INT2FIX(_SELF(self)->blue);
91
- }
92
-
93
- static VALUE
94
- rg_set_blue(VALUE self, VALUE blue)
95
- {
96
- _SELF(self)->blue = NUM2INT(blue);
97
- return self;
98
- }
99
-
100
- static VALUE
101
- rg_to_a(VALUE self)
102
- {
103
- GdkColor *c = _SELF(self);
104
- return rb_ary_new3(3, INT2FIX(c->red),
105
- INT2FIX(c->green), INT2FIX(c->blue));
106
- }
107
-
108
- static VALUE
109
- rg_operator_gdkcolor_equal(VALUE self, VALUE other)
110
- {
111
- return CBOOL2RVAL(gdk_color_equal(_SELF(self), _SELF(other)));
112
- }
113
-
114
- static VALUE
115
- rg_to_s(VALUE self)
116
- {
117
- return CSTR2RVAL_FREE(gdk_color_to_string(_SELF(self)));
118
- }
119
-
120
- void
121
- Init_gdk_color(VALUE mGdk)
122
- {
123
- VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GDK_TYPE_COLOR, "Color", mGdk);
124
-
125
- RG_DEF_SMETHOD(parse, 1);
126
- RG_DEF_METHOD(initialize, 3);
127
- RG_DEF_METHOD(pixel, 0);
128
- RG_DEF_METHOD(red, 0);
129
- RG_DEF_METHOD(set_red, 1);
130
- RG_DEF_METHOD(green, 0);
131
- RG_DEF_METHOD(set_green, 1);
132
- RG_DEF_METHOD(blue, 0);
133
- RG_DEF_METHOD(set_blue, 1);
134
- RG_DEF_METHOD(to_a, 0);
135
- RG_DEF_METHOD_OPERATOR("==", gdkcolor_equal, 1);
136
- RG_DEF_METHOD(to_s, 0);
137
- }
@@ -1,33 +0,0 @@
1
- /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
- /*
3
- * Copyright (C) 2011 Ruby-GNOME2 Project Team
4
- * Copyright (C) 2002,2003 Ruby-GNOME2 Project Team
5
- * Copyright (C) 1998-2000 Yukihiro Matsumoto,
6
- * Daisuke Kanda,
7
- * Hiroshi Igarashi
8
- *
9
- * This library is free software; you can redistribute it and/or
10
- * modify it under the terms of the GNU Lesser General Public
11
- * License as published by the Free Software Foundation; either
12
- * version 2.1 of the License, or (at your option) any later version.
13
- *
14
- * This library is distributed in the hope that it will be useful,
15
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
16
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17
- * Lesser General Public License for more details.
18
- *
19
- * You should have received a copy of the GNU Lesser General Public
20
- * License along with this library; if not, write to the Free Software
21
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
22
- * MA 02110-1301 USA
23
- */
24
-
25
- #include "rbgdk3private.h"
26
-
27
- void
28
- Init_gdk_const(VALUE mGdk)
29
- {
30
- G_DEF_CLASS(GDK_TYPE_STATUS, "Status", mGdk);
31
- }
32
-
33
-
@@ -1,92 +0,0 @@
1
- /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
- /*
3
- * Copyright (C) 2011 Ruby-GNOME2 Project Team
4
- * Copyright (C) 2001-2004 Masao Mutoh
5
- *
6
- * This library is free software; you can redistribute it and/or
7
- * modify it under the terms of the GNU Lesser General Public
8
- * License as published by the Free Software Foundation; either
9
- * version 2.1 of the License, or (at your option) any later version.
10
- *
11
- * This library is distributed in the hope that it will be useful,
12
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
- * Lesser General Public License for more details.
15
- *
16
- * You should have received a copy of the GNU Lesser General Public
17
- * License along with this library; if not, write to the Free Software
18
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19
- * MA 02110-1301 USA
20
- */
21
-
22
- #include "rbgdk3private.h"
23
-
24
- #define RG_TARGET_NAMESPACE cCursor
25
-
26
- static VALUE
27
- rg_initialize(int argc, VALUE *argv, VALUE self)
28
- {
29
- GdkCursor* cursor = NULL;
30
-
31
- if (argc == 1){
32
- VALUE type;
33
- rb_scan_args(argc, argv, "10", &type);
34
- cursor = gdk_cursor_new(RVAL2GDKCURSORTYPE(type));
35
- } else if (argc == 2) {
36
- VALUE display, type_or_name;
37
- rb_scan_args(argc, argv, "20", &display, &type_or_name);
38
- if (TYPE(type_or_name) == T_STRING)
39
- cursor = gdk_cursor_new_from_name(RVAL2GDKDISPLAYOBJECT(display),
40
- RVAL2CSTR(type_or_name));
41
- else
42
- cursor = gdk_cursor_new_for_display(RVAL2GDKDISPLAYOBJECT(display),
43
- RVAL2GDKCURSORTYPE(type_or_name));
44
- } else if (argc == 4) {
45
- VALUE display, pixbuf, x, y;
46
- rb_scan_args(argc, argv, "40", &display, &pixbuf, &x, &y);
47
- cursor = gdk_cursor_new_from_pixbuf(RVAL2GDKDISPLAYOBJECT(display),
48
- RVAL2GDKPIXBUF(pixbuf),
49
- NUM2INT(x), NUM2INT(y));
50
- /* deprecated
51
- } else if (argc == 6) {
52
- VALUE pixmap, mask, fg, bg, x, y;
53
- rb_scan_args(argc, argv, "60", &pixmap, &mask, &fg, &bg, &x, &y);
54
- cursor = gdk_cursor_new_from_pixmap(RVAL2GDKPIXMAP(pixmap),
55
- NIL_P(mask)?NULL:RVAL2GDKPIXMAP(mask),
56
- RVAL2GDKCOLOR(fg),
57
- RVAL2GDKCOLOR(bg),
58
- NUM2INT(x), NUM2INT(y));
59
- */
60
- }
61
- G_INITIALIZE(self, cursor);
62
-
63
- return Qnil;
64
- }
65
-
66
- /* TODO
67
- static VALUE
68
- rg_cursor_type(VALUE self)
69
- {
70
- return GDKCURSORTYPE2RVAL((RVAL2GDKCURSOR(self))->type);
71
- }
72
- */
73
-
74
- static VALUE
75
- rg_image(VALUE self)
76
- {
77
- return GOBJ2RVAL(gdk_cursor_get_image(RVAL2GDKCURSOR(self)));
78
- }
79
-
80
- void
81
- Init_gdk_cursor(VALUE mGdk)
82
- {
83
- VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GDK_TYPE_CURSOR, "Cursor", mGdk);
84
-
85
- RG_DEF_METHOD(initialize, -1);
86
- /* TODO
87
- RG_DEF_METHOD(cursor_type, 0);
88
- */
89
- RG_DEF_METHOD(image, 0);
90
-
91
- G_DEF_CLASS(GDK_TYPE_CURSOR_TYPE, "Type", RG_TARGET_NAMESPACE);
92
- }