goocanvas 0.90.6-x86-mingw32

Sign up to get free protection for your applications and to get access to all the features.
Files changed (136) hide show
  1. data/ChangeLog +87 -0
  2. data/README +37 -0
  3. data/Rakefile +14 -0
  4. data/ext/goocanvas/depend +5 -0
  5. data/ext/goocanvas/extconf.rb +66 -0
  6. data/ext/goocanvas/goocanvas.def +2 -0
  7. data/ext/goocanvas/rbgoocairo.c +74 -0
  8. data/ext/goocanvas/rbgoocanvas.c +236 -0
  9. data/ext/goocanvas/rbgoocanvas.h +66 -0
  10. data/ext/goocanvas/rbgoocanvasellipse.c +50 -0
  11. data/ext/goocanvas/rbgoocanvasgroup.c +41 -0
  12. data/ext/goocanvas/rbgoocanvasimage.c +45 -0
  13. data/ext/goocanvas/rbgoocanvasitem.c +358 -0
  14. data/ext/goocanvas/rbgoocanvaspolyline.c +102 -0
  15. data/ext/goocanvas/rbgoocanvasrect.c +47 -0
  16. data/ext/goocanvas/rbgoocanvasstyle.c +61 -0
  17. data/ext/goocanvas/rbgoocanvastable.c +41 -0
  18. data/ext/goocanvas/rbgoocanvastext.c +58 -0
  19. data/ext/goocanvas/rbgoocanvaswidget.c +48 -0
  20. data/ext/goocanvas/rbgooutils.c +44 -0
  21. data/extconf.rb +49 -0
  22. data/lib/1.8/goocanvas.so +0 -0
  23. data/lib/1.9/goocanvas.so +0 -0
  24. data/lib/goocanvas.rb +145 -0
  25. data/sample/demo-arrowhead.rb +315 -0
  26. data/sample/demo-fifteen.rb +218 -0
  27. data/sample/demo-primitives.rb +720 -0
  28. data/sample/demo.rb +84 -0
  29. data/sample/flower.png +0 -0
  30. data/sample/scalability-demo.rb +130 -0
  31. data/sample/simple-demo.rb +35 -0
  32. data/sample/table-demo.rb +137 -0
  33. data/sample/toroid.png +0 -0
  34. data/sample/units-demo.rb +80 -0
  35. data/sample/widgets-demo.rb +197 -0
  36. data/vendor/local/bin/libgoocanvas-3.dll +0 -0
  37. data/vendor/local/include/goocanvas-1.0.0/goocanvas/goocanvas.h +334 -0
  38. data/vendor/local/include/goocanvas-1.0.0/goocanvas/goocanvasatk.h +22 -0
  39. data/vendor/local/include/goocanvas-1.0.0/goocanvas/goocanvasellipse.h +120 -0
  40. data/vendor/local/include/goocanvas-1.0.0/goocanvas/goocanvasenumtypes.h +33 -0
  41. data/vendor/local/include/goocanvas-1.0.0/goocanvas/goocanvasgrid.h +153 -0
  42. data/vendor/local/include/goocanvas-1.0.0/goocanvas/goocanvasgroup.h +109 -0
  43. data/vendor/local/include/goocanvas-1.0.0/goocanvas/goocanvasimage.h +121 -0
  44. data/vendor/local/include/goocanvas-1.0.0/goocanvas/goocanvasitem.h +479 -0
  45. data/vendor/local/include/goocanvas-1.0.0/goocanvas/goocanvasitemmodel.h +275 -0
  46. data/vendor/local/include/goocanvas-1.0.0/goocanvas/goocanvasitemsimple.h +247 -0
  47. data/vendor/local/include/goocanvas-1.0.0/goocanvas/goocanvasmarshal.h +61 -0
  48. data/vendor/local/include/goocanvas-1.0.0/goocanvas/goocanvaspath.h +116 -0
  49. data/vendor/local/include/goocanvas-1.0.0/goocanvas/goocanvaspolyline.h +176 -0
  50. data/vendor/local/include/goocanvas-1.0.0/goocanvas/goocanvasprivate.h +59 -0
  51. data/vendor/local/include/goocanvas-1.0.0/goocanvas/goocanvasrect.h +121 -0
  52. data/vendor/local/include/goocanvas-1.0.0/goocanvas/goocanvasstyle.h +110 -0
  53. data/vendor/local/include/goocanvas-1.0.0/goocanvas/goocanvastable.h +139 -0
  54. data/vendor/local/include/goocanvas-1.0.0/goocanvas/goocanvastext.h +133 -0
  55. data/vendor/local/include/goocanvas-1.0.0/goocanvas/goocanvasutils.h +333 -0
  56. data/vendor/local/include/goocanvas-1.0.0/goocanvas/goocanvaswidget.h +66 -0
  57. data/vendor/local/include/goocanvas-1.0.0/goocanvas/stamp-goocanvasmarshal.h +1 -0
  58. data/vendor/local/lib/libgoocanvas.a +0 -0
  59. data/vendor/local/lib/libgoocanvas.dll.a +0 -0
  60. data/vendor/local/lib/pkgconfig/goocanvas.pc +13 -0
  61. data/vendor/local/share/gtk-doc/html/goocanvas/GooCanvas.html +1982 -0
  62. data/vendor/local/share/gtk-doc/html/goocanvas/GooCanvasEllipse.html +269 -0
  63. data/vendor/local/share/gtk-doc/html/goocanvas/GooCanvasEllipseModel.html +274 -0
  64. data/vendor/local/share/gtk-doc/html/goocanvas/GooCanvasGrid.html +469 -0
  65. data/vendor/local/share/gtk-doc/html/goocanvas/GooCanvasGridModel.html +476 -0
  66. data/vendor/local/share/gtk-doc/html/goocanvas/GooCanvasGroup.html +183 -0
  67. data/vendor/local/share/gtk-doc/html/goocanvas/GooCanvasGroupModel.html +184 -0
  68. data/vendor/local/share/gtk-doc/html/goocanvas/GooCanvasImage.html +247 -0
  69. data/vendor/local/share/gtk-doc/html/goocanvas/GooCanvasImageModel.html +252 -0
  70. data/vendor/local/share/gtk-doc/html/goocanvas/GooCanvasItem.html +3014 -0
  71. data/vendor/local/share/gtk-doc/html/goocanvas/GooCanvasItemModel.html +1764 -0
  72. data/vendor/local/share/gtk-doc/html/goocanvas/GooCanvasItemModelSimple.html +298 -0
  73. data/vendor/local/share/gtk-doc/html/goocanvas/GooCanvasItemSimple.html +809 -0
  74. data/vendor/local/share/gtk-doc/html/goocanvas/GooCanvasPath.html +279 -0
  75. data/vendor/local/share/gtk-doc/html/goocanvas/GooCanvasPathModel.html +280 -0
  76. data/vendor/local/share/gtk-doc/html/goocanvas/GooCanvasPolyline.html +369 -0
  77. data/vendor/local/share/gtk-doc/html/goocanvas/GooCanvasPolylineModel.html +375 -0
  78. data/vendor/local/share/gtk-doc/html/goocanvas/GooCanvasRect.html +247 -0
  79. data/vendor/local/share/gtk-doc/html/goocanvas/GooCanvasRectModel.html +252 -0
  80. data/vendor/local/share/gtk-doc/html/goocanvas/GooCanvasStyle.html +489 -0
  81. data/vendor/local/share/gtk-doc/html/goocanvas/GooCanvasTable.html +452 -0
  82. data/vendor/local/share/gtk-doc/html/goocanvas/GooCanvasTableModel.html +452 -0
  83. data/vendor/local/share/gtk-doc/html/goocanvas/GooCanvasText.html +324 -0
  84. data/vendor/local/share/gtk-doc/html/goocanvas/GooCanvasTextModel.html +287 -0
  85. data/vendor/local/share/gtk-doc/html/goocanvas/GooCanvasWidget.html +266 -0
  86. data/vendor/local/share/gtk-doc/html/goocanvas/ch01.html +53 -0
  87. data/vendor/local/share/gtk-doc/html/goocanvas/ch02.html +50 -0
  88. data/vendor/local/share/gtk-doc/html/goocanvas/ch03.html +62 -0
  89. data/vendor/local/share/gtk-doc/html/goocanvas/ch04.html +60 -0
  90. data/vendor/local/share/gtk-doc/html/goocanvas/ch05.html +33 -0
  91. data/vendor/local/share/gtk-doc/html/goocanvas/goocanvas-GooCanvas-Types.html +815 -0
  92. data/vendor/local/share/gtk-doc/html/goocanvas/goocanvas-architecture.html +157 -0
  93. data/vendor/local/share/gtk-doc/html/goocanvas/goocanvas-coordinates.html +106 -0
  94. data/vendor/local/share/gtk-doc/html/goocanvas/goocanvas-creating-items.html +420 -0
  95. data/vendor/local/share/gtk-doc/html/goocanvas/goocanvas-model-view-canvas.html +246 -0
  96. data/vendor/local/share/gtk-doc/html/goocanvas/goocanvas-overview.html +106 -0
  97. data/vendor/local/share/gtk-doc/html/goocanvas/goocanvas-simple-canvas.html +238 -0
  98. data/vendor/local/share/gtk-doc/html/goocanvas/goocanvas-wysiwyg.html +84 -0
  99. data/vendor/local/share/gtk-doc/html/goocanvas/goocanvas.devhelp +608 -0
  100. data/vendor/local/share/gtk-doc/html/goocanvas/goocanvas.devhelp2 +639 -0
  101. data/vendor/local/share/gtk-doc/html/goocanvas/home.png +0 -0
  102. data/vendor/local/share/gtk-doc/html/goocanvas/index.html +138 -0
  103. data/vendor/local/share/gtk-doc/html/goocanvas/index.sgml +814 -0
  104. data/vendor/local/share/gtk-doc/html/goocanvas/left.png +0 -0
  105. data/vendor/local/share/gtk-doc/html/goocanvas/right.png +0 -0
  106. data/vendor/local/share/gtk-doc/html/goocanvas/style.css +257 -0
  107. data/vendor/local/share/gtk-doc/html/goocanvas/up.png +0 -0
  108. data/vendor/local/share/gtk-doc/tmpl/goocanvas/dummy.sgml +0 -0
  109. data/vendor/local/share/gtk-doc/tmpl/goocanvas/goocanvas-unused.sgml +0 -0
  110. data/vendor/local/share/gtk-doc/tmpl/goocanvas/goocanvas.sgml +536 -0
  111. data/vendor/local/share/gtk-doc/tmpl/goocanvas/goocanvasellipse.sgml +82 -0
  112. data/vendor/local/share/gtk-doc/tmpl/goocanvas/goocanvasellipsemodel.sgml +82 -0
  113. data/vendor/local/share/gtk-doc/tmpl/goocanvas/goocanvasgrid.sgml +176 -0
  114. data/vendor/local/share/gtk-doc/tmpl/goocanvas/goocanvasgridmodel.sgml +176 -0
  115. data/vendor/local/share/gtk-doc/tmpl/goocanvas/goocanvasgroup.sgml +58 -0
  116. data/vendor/local/share/gtk-doc/tmpl/goocanvas/goocanvasgroupmodel.sgml +58 -0
  117. data/vendor/local/share/gtk-doc/tmpl/goocanvas/goocanvasimage.sgml +81 -0
  118. data/vendor/local/share/gtk-doc/tmpl/goocanvas/goocanvasimagemodel.sgml +81 -0
  119. data/vendor/local/share/gtk-doc/tmpl/goocanvas/goocanvasitem.sgml +773 -0
  120. data/vendor/local/share/gtk-doc/tmpl/goocanvas/goocanvasitemmodel.sgml +490 -0
  121. data/vendor/local/share/gtk-doc/tmpl/goocanvas/goocanvasitemmodelsimple.sgml +135 -0
  122. data/vendor/local/share/gtk-doc/tmpl/goocanvas/goocanvasitemsimple.sgml +254 -0
  123. data/vendor/local/share/gtk-doc/tmpl/goocanvas/goocanvaspath.sgml +64 -0
  124. data/vendor/local/share/gtk-doc/tmpl/goocanvas/goocanvaspathmodel.sgml +64 -0
  125. data/vendor/local/share/gtk-doc/tmpl/goocanvas/goocanvaspolyline.sgml +109 -0
  126. data/vendor/local/share/gtk-doc/tmpl/goocanvas/goocanvaspolylinemodel.sgml +109 -0
  127. data/vendor/local/share/gtk-doc/tmpl/goocanvas/goocanvasrect.sgml +72 -0
  128. data/vendor/local/share/gtk-doc/tmpl/goocanvas/goocanvasrectmodel.sgml +72 -0
  129. data/vendor/local/share/gtk-doc/tmpl/goocanvas/goocanvasstyle.sgml +186 -0
  130. data/vendor/local/share/gtk-doc/tmpl/goocanvas/goocanvastable.sgml +158 -0
  131. data/vendor/local/share/gtk-doc/tmpl/goocanvas/goocanvastablemodel.sgml +158 -0
  132. data/vendor/local/share/gtk-doc/tmpl/goocanvas/goocanvastext.sgml +103 -0
  133. data/vendor/local/share/gtk-doc/tmpl/goocanvas/goocanvastextmodel.sgml +93 -0
  134. data/vendor/local/share/gtk-doc/tmpl/goocanvas/goocanvasutils.sgml +241 -0
  135. data/vendor/local/share/gtk-doc/tmpl/goocanvas/goocanvaswidget.sgml +73 -0
  136. metadata +218 -0
@@ -0,0 +1,45 @@
1
+ /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
+ /* $Id: rbgoocanvasimage.c 3288 2008-09-13 10:07:44Z ktou $ */
3
+ /* GooCanvasImage
4
+ * Copyright (C) 2007 Vincent Isambart <vincent.isambart@gmail.com>
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19
+ */
20
+
21
+ #include "rbgoocanvas.h"
22
+
23
+ static VALUE
24
+ rb_goo_canvas_image_new(VALUE self, VALUE parent, VALUE pixbuf,
25
+ VALUE x, VALUE y)
26
+ {
27
+ GooCanvasItem *item;
28
+ item = goo_canvas_image_new(RVAL2GCI(parent),
29
+ RVAL2GDK_PIXBUF(pixbuf),
30
+ NUM2DBL(x),
31
+ NUM2DBL(y),
32
+ NULL);
33
+ RB_GOO_CANVAS_ITEM_INITIALIZE(self, item);
34
+ G_CHILD_ADD(parent, self);
35
+ return Qnil;
36
+ }
37
+
38
+ void
39
+ Init_goocanvasimage(void)
40
+ {
41
+ VALUE GooCanvasImage;
42
+
43
+ GooCanvasImage = G_DEF_CLASS(GOO_TYPE_CANVAS_IMAGE, "CanvasImage", mGoo);
44
+ rb_define_method(GooCanvasImage, "initialize", rb_goo_canvas_image_new, 4);
45
+ }
@@ -0,0 +1,358 @@
1
+ /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
+ /* $Id: rbgoocanvasitem.c 3288 2008-09-13 10:07:44Z ktou $ */
3
+ /* GooCanvasItem
4
+ * Copyright (C) 2007 Vincent Isambart <vincent.isambart@gmail.com>
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19
+ */
20
+
21
+ #include "rbgoocanvas.h"
22
+
23
+ #define SELF(self) RVAL2GCI(self)
24
+
25
+ static VALUE
26
+ rb_goo_canvas_item_rotate(VALUE self, VALUE degrees, VALUE cx, VALUE cy)
27
+ {
28
+ goo_canvas_item_rotate(SELF(self), NUM2DBL(degrees),
29
+ NUM2DBL(cx), NUM2DBL(cy));
30
+ return self;
31
+ }
32
+
33
+ static VALUE
34
+ rb_goo_canvas_item_translate(VALUE self, VALUE tx, VALUE ty)
35
+ {
36
+ goo_canvas_item_translate(SELF(self), NUM2DBL(tx), NUM2DBL(ty));
37
+ return self;
38
+ }
39
+
40
+ static VALUE
41
+ rb_goo_canvas_item_lower(VALUE self, VALUE below)
42
+ {
43
+ goo_canvas_item_lower(SELF(self), SELF(below));
44
+ return self;
45
+ }
46
+
47
+ static VALUE
48
+ rb_goo_canvas_item_raise(VALUE self, VALUE above)
49
+ {
50
+ goo_canvas_item_raise(SELF(self), SELF(above));
51
+ return self;
52
+ }
53
+
54
+ static VALUE
55
+ rb_goo_canvas_item_scale(VALUE self, VALUE sx, VALUE sy)
56
+ {
57
+ goo_canvas_item_scale(SELF(self), NUM2DBL(sx), NUM2DBL(sy));
58
+ return self;
59
+ }
60
+
61
+ static VALUE
62
+ rb_goo_canvas_bounds_x1(VALUE self)
63
+ {
64
+ GooCanvasBounds bounds;
65
+ goo_canvas_item_get_bounds(SELF(self), &bounds);
66
+ return rb_float_new(bounds.x1);
67
+ }
68
+
69
+ static VALUE
70
+ rb_goo_canvas_bounds_x2(VALUE self)
71
+ {
72
+ GooCanvasBounds bounds;
73
+ goo_canvas_item_get_bounds(SELF(self), &bounds);
74
+ return rb_float_new(bounds.x2);
75
+ }
76
+
77
+ static VALUE
78
+ rb_goo_canvas_bounds_y1(VALUE self)
79
+ {
80
+ GooCanvasBounds bounds;
81
+ goo_canvas_item_get_bounds(SELF(self), &bounds);
82
+ return rb_float_new(bounds.y1);
83
+ }
84
+
85
+ static VALUE
86
+ rb_goo_canvas_bounds_y2(VALUE self)
87
+ {
88
+ GooCanvasBounds bounds;
89
+ goo_canvas_item_get_bounds(SELF(self), &bounds);
90
+ return rb_float_new(bounds.y2);
91
+ }
92
+
93
+ static VALUE
94
+ rb_goo_canvas_item_skew_x(VALUE self, VALUE degrees, VALUE cx, VALUE cy)
95
+ {
96
+ goo_canvas_item_skew_x(SELF(self), NUM2DBL(degrees),
97
+ NUM2DBL(cx), NUM2DBL(cy));
98
+ return self;
99
+ }
100
+
101
+ static VALUE
102
+ rb_goo_canvas_item_skew_y(VALUE self, VALUE degrees, VALUE cx, VALUE cy)
103
+ {
104
+ goo_canvas_item_skew_y(SELF(self), NUM2DBL(degrees),
105
+ NUM2DBL(cx), NUM2DBL(cy));
106
+ return self;
107
+ }
108
+
109
+ static VALUE
110
+ rb_goo_canvas_item_set_simple_transform(VALUE self, VALUE x, VALUE y,
111
+ VALUE scale, VALUE rotation)
112
+ {
113
+ goo_canvas_item_set_simple_transform(SELF(self), NUM2DBL(x), NUM2DBL(y),
114
+ NUM2DBL(scale), NUM2DBL(rotation));
115
+ return self;
116
+ }
117
+
118
+ static VALUE
119
+ rb_goo_canvas_item_animate(VALUE self, VALUE x, VALUE y, VALUE scale,
120
+ VALUE degrees, VALUE absolute, VALUE duration,
121
+ VALUE step_time, VALUE type)
122
+ {
123
+ goo_canvas_item_animate(SELF(self),
124
+ NUM2DBL(x),
125
+ NUM2DBL(y),
126
+ NUM2DBL(scale),
127
+ NUM2DBL(degrees),
128
+ RTEST(absolute),
129
+ NUM2INT(duration),
130
+ NUM2INT(step_time),
131
+ rbgobj_get_enum(type, GOO_TYPE_CANVAS_ANIMATE_TYPE));
132
+ return self;
133
+ }
134
+
135
+ static VALUE
136
+ rb_goo_canvas_item_stop_animation(VALUE self)
137
+ {
138
+ goo_canvas_item_stop_animation(SELF(self));
139
+ return self;
140
+ }
141
+
142
+ static VALUE
143
+ rb_goo_canvas_item_set_style(VALUE self, VALUE style)
144
+ {
145
+ goo_canvas_item_set_style(SELF(self), RVAL2GCS(style));
146
+ return self;
147
+ }
148
+
149
+ static VALUE
150
+ rb_goo_canvas_item_set_child_property(VALUE self, VALUE child,
151
+ VALUE prop_name, VALUE val)
152
+ {
153
+ GParamSpec* pspec;
154
+ const char* name;
155
+
156
+ if (SYMBOL_P(prop_name)) {
157
+ name = rb_id2name(SYM2ID(prop_name));
158
+ } else {
159
+ StringValue(prop_name);
160
+ name = StringValuePtr(prop_name);
161
+ }
162
+ pspec = goo_canvas_item_class_find_child_property(G_OBJECT_GET_CLASS(RVAL2GOBJ(self)), name);
163
+
164
+ if (!pspec)
165
+ rb_raise(rb_eRuntimeError, "No such child property: %s", name);
166
+
167
+ #define _SET_PROP_FOR_TYPE(gtype, ctype, val) \
168
+ case gtype: \
169
+ goo_canvas_item_set_child_properties(SELF(self), SELF(child), name, (ctype)(val), NULL); \
170
+ break;
171
+
172
+ switch (G_TYPE_FUNDAMENTAL(G_PARAM_SPEC_VALUE_TYPE(pspec))) {
173
+ _SET_PROP_FOR_TYPE(G_TYPE_CHAR, gchar, NUM2INT(val));
174
+ _SET_PROP_FOR_TYPE(G_TYPE_UCHAR, guchar, NUM2INT(val));
175
+ _SET_PROP_FOR_TYPE(G_TYPE_BOOLEAN, gboolean, RTEST(val));
176
+ _SET_PROP_FOR_TYPE(G_TYPE_INT, gint, NUM2INT(val));
177
+ _SET_PROP_FOR_TYPE(G_TYPE_UINT, guint, NUM2UINT(val));
178
+ _SET_PROP_FOR_TYPE(G_TYPE_LONG, glong, NUM2LONG(val));
179
+ _SET_PROP_FOR_TYPE(G_TYPE_ULONG, gulong, NUM2ULONG(val));
180
+ _SET_PROP_FOR_TYPE(G_TYPE_INT64, gint64, rbglib_num_to_int64(val));
181
+ _SET_PROP_FOR_TYPE(G_TYPE_UINT64, guint64, rbglib_num_to_uint64(val));
182
+ _SET_PROP_FOR_TYPE(G_TYPE_ENUM, gint, rbgobj_get_enum(val, G_PARAM_SPEC_VALUE_TYPE(pspec)));
183
+ _SET_PROP_FOR_TYPE(G_TYPE_FLAGS, guint, rbgobj_get_flags(val, G_PARAM_SPEC_VALUE_TYPE(pspec)));
184
+ _SET_PROP_FOR_TYPE(G_TYPE_FLOAT, gfloat, NUM2DBL(val));
185
+ _SET_PROP_FOR_TYPE(G_TYPE_DOUBLE, gdouble, NUM2DBL(val));
186
+ case G_TYPE_STRING:
187
+ {
188
+ if (SYMBOL_P(val))
189
+ val = rb_funcall(val, rb_intern("to_s"), 0);
190
+ goo_canvas_item_set_child_properties(SELF(self), SELF(child), name, StringValuePtr(val), NULL);
191
+ break;
192
+ }
193
+
194
+ default:
195
+ g_warning("rb_goo_canvas_item_set_child_property: unsupported type: %s\n", g_type_name(G_PARAM_SPEC_VALUE_TYPE(pspec)));
196
+ return Qnil;
197
+ }
198
+
199
+ #undef _SET_PROP_FOR_TYPE
200
+
201
+ G_CHILD_ADD(child, val);
202
+
203
+ return self;
204
+ }
205
+
206
+ static VALUE
207
+ rb_goo_canvas_item_get_canvas(VALUE self, VALUE tx, VALUE ty)
208
+ {
209
+ return GOBJ2RVAL(goo_canvas_item_get_canvas(SELF(self)));
210
+ }
211
+
212
+ static VALUE
213
+ rb_goo_canvas_item_remove_child(VALUE self, VALUE child)
214
+ {
215
+ gint child_num;
216
+
217
+ child_num = goo_canvas_item_find_child(SELF(self), SELF(child));
218
+ goo_canvas_item_remove_child(SELF(self), child_num);
219
+ G_CHILD_REMOVE(self, child);
220
+
221
+ return self;
222
+ }
223
+
224
+ void
225
+ Init_goocanvasitem(void)
226
+ {
227
+ VALUE GooCanvasItem;
228
+
229
+ GooCanvasItem = G_DEF_CLASS(GOO_TYPE_CANVAS_ITEM, "CanvasItem", mGoo);
230
+
231
+ rb_define_method(GooCanvasItem, "rotate", rb_goo_canvas_item_rotate, 3);
232
+ rb_define_method(GooCanvasItem, "translate", rb_goo_canvas_item_translate, 2);
233
+ rb_define_method(GooCanvasItem, "lower", rb_goo_canvas_item_lower, 1);
234
+ rb_define_method(GooCanvasItem, "raise", rb_goo_canvas_item_raise, 1);
235
+ rb_define_method(GooCanvasItem, "scale", rb_goo_canvas_item_scale, 2);
236
+ rb_define_method(GooCanvasItem, "skew_x", rb_goo_canvas_item_skew_x, 3);
237
+ rb_define_method(GooCanvasItem, "skew_y", rb_goo_canvas_item_skew_y, 3);
238
+ rb_define_method(GooCanvasItem, "set_simple_transform", rb_goo_canvas_item_set_simple_transform, 4);
239
+ rb_define_method(GooCanvasItem, "animate", rb_goo_canvas_item_animate, 8);
240
+ rb_define_method(GooCanvasItem, "stop_animation", rb_goo_canvas_item_stop_animation, 0);
241
+
242
+ rb_define_method(GooCanvasItem, "set_style", rb_goo_canvas_item_set_style, 1);
243
+
244
+ rb_define_method(GooCanvasItem, "set_child_property", rb_goo_canvas_item_set_child_property, 3);
245
+
246
+ rb_define_method(GooCanvasItem, "canvas", rb_goo_canvas_item_get_canvas, 0);
247
+
248
+ rb_define_method(GooCanvasItem, "remove_child", rb_goo_canvas_item_remove_child, 1);
249
+
250
+ rb_define_method(GooCanvasItem, "x1", rb_goo_canvas_bounds_x1, 0);
251
+ rb_define_method(GooCanvasItem, "x2", rb_goo_canvas_bounds_x2, 0);
252
+ rb_define_method(GooCanvasItem, "y1", rb_goo_canvas_bounds_y1, 0);
253
+ rb_define_method(GooCanvasItem, "y2", rb_goo_canvas_bounds_y2, 0);
254
+
255
+ /* Enums */
256
+ G_DEF_CLASS(GOO_TYPE_CANVAS_ITEM_VISIBILITY, "Visibility", GooCanvasItem);
257
+ G_DEF_CONSTANTS(GooCanvasItem, GOO_TYPE_CANVAS_ITEM_VISIBILITY, "GOO_CANVAS_ITEM_");
258
+ G_DEF_CLASS(GOO_TYPE_CANVAS_ANIMATE_TYPE, "AnimateType", GooCanvasItem);
259
+ G_DEF_CONSTANTS(GooCanvasItem, GOO_TYPE_CANVAS_ANIMATE_TYPE, "GOO_CANVAS_");
260
+
261
+
262
+ G_DEF_CLASS(GOO_TYPE_CANVAS_POINTER_EVENTS, "PointerEvents",GooCanvasItem);
263
+ G_DEF_CONSTANTS(GooCanvasItem, GOO_TYPE_CANVAS_POINTER_EVENTS,"GOO_CANVAS_");
264
+
265
+ #if 0
266
+ gint goo_canvas_item_get_n_children (GooCanvasItem *item);
267
+ GooCanvasItem* goo_canvas_item_get_child (GooCanvasItem *item,
268
+ gint child_num);
269
+ gint goo_canvas_item_find_child (GooCanvasItem *item,
270
+ GooCanvasItem *child);
271
+ void goo_canvas_item_add_child (GooCanvasItem *item,
272
+ GooCanvasItem *child,
273
+ gint position);
274
+ void goo_canvas_item_move_child (GooCanvasItem *item,
275
+ gint old_position,
276
+ gint new_position);
277
+ void goo_canvas_item_remove_child (GooCanvasItem *item,
278
+ gint child_num);
279
+
280
+ void goo_canvas_item_get_child_properties (GooCanvasItem *item,
281
+ GooCanvasItem *child,
282
+ ...) G_GNUC_NULL_TERMINATED;
283
+ void goo_canvas_item_set_child_properties (GooCanvasItem *item,
284
+ GooCanvasItem *child,
285
+ ...) G_GNUC_NULL_TERMINATED;
286
+ void goo_canvas_item_get_child_properties_valist (GooCanvasItem *item,
287
+ GooCanvasItem *child,
288
+ va_list var_args);
289
+ void goo_canvas_item_set_child_properties_valist (GooCanvasItem *item,
290
+ GooCanvasItem *child,
291
+ va_list var_args);
292
+
293
+ gboolean goo_canvas_item_get_transform_for_child (GooCanvasItem *item,
294
+ GooCanvasItem *child,
295
+ cairo_matrix_t *transform);
296
+
297
+
298
+ /*
299
+ * Item functions - these are safe to call on all items.
300
+ */
301
+ GooCanvas* goo_canvas_item_get_canvas (GooCanvasItem *item);
302
+ void goo_canvas_item_set_canvas (GooCanvasItem *item,
303
+ GooCanvas *canvas);
304
+ GooCanvasItem* goo_canvas_item_get_parent (GooCanvasItem *item);
305
+ void goo_canvas_item_set_parent (GooCanvasItem *item,
306
+ GooCanvasItem *parent);
307
+ gboolean goo_canvas_item_is_container (GooCanvasItem *item);
308
+
309
+ cairo_matrix_t* goo_canvas_item_get_transform (GooCanvasItem *item);
310
+ void goo_canvas_item_set_transform (GooCanvasItem *item,
311
+ cairo_matrix_t *matrix);
312
+ void goo_canvas_item_set_simple_transform (GooCanvasItem *item,
313
+ gdouble x,
314
+ gdouble y,
315
+ gdouble scale,
316
+ gdouble rotation);
317
+
318
+ GooCanvasStyle* goo_canvas_item_get_style (GooCanvasItem *item);
319
+
320
+
321
+ void goo_canvas_item_get_bounds (GooCanvasItem *item,
322
+ GooCanvasBounds *bounds);
323
+ GooCanvasItem* goo_canvas_item_get_item_at (GooCanvasItem *item,
324
+ gdouble x,
325
+ gdouble y,
326
+ cairo_t *cr,
327
+ gboolean is_pointer_event,
328
+ gboolean parent_is_visible);
329
+ gboolean goo_canvas_item_is_visible (GooCanvasItem *item);
330
+
331
+ GooCanvasItemModel* goo_canvas_item_get_model (GooCanvasItem *item);
332
+ void goo_canvas_item_set_model (GooCanvasItem *item,
333
+ GooCanvasItemModel *model);
334
+
335
+ void goo_canvas_item_request_update (GooCanvasItem *item);
336
+ void goo_canvas_item_ensure_updated (GooCanvasItem *item);
337
+ void goo_canvas_item_update (GooCanvasItem *item,
338
+ gboolean entire_tree,
339
+ cairo_t *cr,
340
+ GooCanvasBounds *bounds);
341
+ void goo_canvas_item_paint (GooCanvasItem *item,
342
+ cairo_t *cr,
343
+ GooCanvasBounds *bounds,
344
+ gdouble scale);
345
+
346
+ gboolean goo_canvas_item_get_requested_area (GooCanvasItem *item,
347
+ cairo_t *cr,
348
+ GooCanvasBounds *requested_area);
349
+ void goo_canvas_item_allocate_area (GooCanvasItem *item,
350
+ cairo_t *cr,
351
+ GooCanvasBounds *requested_area,
352
+ GooCanvasBounds *allocated_area,
353
+ gdouble x_offset,
354
+ gdouble y_offset);
355
+ #endif
356
+
357
+ G_DEF_SETTERS(GooCanvasItem);
358
+ }
@@ -0,0 +1,102 @@
1
+ /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
+ /* $Id: rbgoocanvaspolyline.c 3426 2008-11-01 14:20:52Z ktou $ */
3
+ /* GooCanvasPolyline and GooCanvasPoints
4
+ * Copyright (C) 2007 Vincent Isambart <vincent.isambart@gmail.com>
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19
+ */
20
+
21
+ #include "rbgoocanvas.h"
22
+
23
+ static VALUE
24
+ rb_goo_canvas_polyline_new(VALUE self, VALUE parent, VALUE close_path)
25
+ {
26
+ GooCanvasItem *item;
27
+ item = goo_canvas_polyline_new(RVAL2GCI(parent), RTEST(close_path), 0, NULL);
28
+ RB_GOO_CANVAS_ITEM_INITIALIZE(self, item);
29
+ G_CHILD_ADD(parent, self);
30
+ return Qnil;
31
+ }
32
+
33
+ static VALUE
34
+ rb_goo_canvas_points_new(VALUE self, VALUE num_points)
35
+ {
36
+ G_INITIALIZE(self, goo_canvas_points_new(NUM2INT(num_points)));
37
+ return Qnil;
38
+ }
39
+
40
+ static VALUE
41
+ rb_goo_canvas_points_get(VALUE self, VALUE point)
42
+ {
43
+ int i;
44
+ GooCanvasPoints *points;
45
+
46
+ i = NUM2INT(point);
47
+ points = RVAL2GCPOINTS(self);
48
+ if ((i < 0) || (i >= points->num_points))
49
+ rb_raise(rb_eArgError, "invalid point number %d", i);
50
+ return rb_ary_new3(2,
51
+ rb_float_new(points->coords[i * 2]),
52
+ rb_float_new(points->coords[i * 2 + 1]));
53
+ }
54
+
55
+ static VALUE
56
+ rb_goo_canvas_points_set(VALUE self, VALUE point, VALUE new_coords)
57
+ {
58
+ int i;
59
+ GooCanvasPoints *points;
60
+
61
+ i = NUM2INT(point);
62
+ points = RVAL2GCPOINTS(self);
63
+ if ((i < 0) || (i >= points->num_points))
64
+ rb_raise(rb_eArgError, "invalid point number %d", i);
65
+ if (TYPE(new_coords) != T_ARRAY)
66
+ rb_raise(rb_eArgError, "rb_goo_canvas_points_set should be given an array as new value");
67
+ if (RARRAY_LEN(new_coords) != 2)
68
+ rb_raise(rb_eArgError, "rb_goo_canvas_points_set should be given an array of length 2 as new value");
69
+ points->coords[i*2] = NUM2DBL(RARRAY_PTR(new_coords)[0]);
70
+ points->coords[i*2+1] = NUM2DBL(RARRAY_PTR(new_coords)[1]);
71
+ return self;
72
+ }
73
+
74
+ static VALUE
75
+ rb_goo_canvas_points_get_num_points(VALUE self)
76
+ {
77
+ GooCanvasPoints *points;
78
+
79
+ points = RVAL2GCPOINTS(self);
80
+ return INT2NUM(points->num_points);
81
+ }
82
+
83
+ void
84
+ Init_goocanvaspolyline(void)
85
+ {
86
+ VALUE GooCanvasPolyline;
87
+ VALUE GooCanvasPoints;
88
+
89
+ GooCanvasPolyline = G_DEF_CLASS(GOO_TYPE_CANVAS_POLYLINE,
90
+ "CanvasPolyline", mGoo);
91
+
92
+ rb_define_method(GooCanvasPolyline, "initialize",
93
+ rb_goo_canvas_polyline_new, 2);
94
+
95
+ GooCanvasPoints = G_DEF_CLASS(GOO_TYPE_CANVAS_POINTS, "CanvasPoints", mGoo);
96
+
97
+ rb_define_method(GooCanvasPoints, "initialize", rb_goo_canvas_points_new, 1);
98
+ rb_define_method(GooCanvasPoints, "[]", rb_goo_canvas_points_get, 1);
99
+ rb_define_method(GooCanvasPoints, "[]=", rb_goo_canvas_points_set, 2);
100
+ rb_define_method(GooCanvasPoints, "num_points",
101
+ rb_goo_canvas_points_get_num_points, 0);
102
+ }
@@ -0,0 +1,47 @@
1
+ /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
+ /* $Id: rbgoocanvasrect.c 3288 2008-09-13 10:07:44Z ktou $ */
3
+ /* GooCanvasRect
4
+ * Copyright (C) 2007 Vincent Isambart <vincent.isambart@gmail.com>
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19
+ */
20
+
21
+ #include "rbgoocanvas.h"
22
+
23
+ static VALUE
24
+ rb_goo_canvas_rect_new(VALUE self, VALUE parent, VALUE x, VALUE y,
25
+ VALUE width, VALUE height)
26
+ {
27
+ GooCanvasItem *item;
28
+ item = goo_canvas_rect_new(RVAL2GCI(parent),
29
+ NUM2DBL(x),
30
+ NUM2DBL(y),
31
+ NUM2DBL(width),
32
+ NUM2DBL(height),
33
+ NULL);
34
+ RB_GOO_CANVAS_ITEM_INITIALIZE(self, item);
35
+ G_CHILD_ADD(parent, self);
36
+ return Qnil;
37
+ }
38
+
39
+ void
40
+ Init_goocanvasrect(void)
41
+ {
42
+ VALUE GooCanvasRect;
43
+
44
+ GooCanvasRect = G_DEF_CLASS(GOO_TYPE_CANVAS_RECT, "CanvasRect", mGoo);
45
+
46
+ rb_define_method(GooCanvasRect, "initialize", rb_goo_canvas_rect_new, 5);
47
+ }
@@ -0,0 +1,61 @@
1
+ /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
+ /* $Id: rbgoocanvasstyle.c 3288 2008-09-13 10:07:44Z ktou $ */
3
+ /* GooCanvasStyle
4
+ * Copyright (C) 2007 Vincent Isambart <vincent.isambart@gmail.com>
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19
+ */
20
+
21
+ #include "rbgoocanvas.h"
22
+
23
+ static VALUE
24
+ rb_goo_canvas_style_new(VALUE self)
25
+ {
26
+ G_INITIALIZE(self, goo_canvas_style_new());
27
+ return Qnil;
28
+ }
29
+
30
+ /* TODO: make it more generic, with maybe some part in Ruby */
31
+ static VALUE
32
+ rb_goo_canvas_style_set_fill_pattern(VALUE self, VALUE value)
33
+ {
34
+ GValue gval = {0,};
35
+ cairo_pattern_t *pattern;
36
+
37
+ g_value_init(&gval, GOO_TYPE_CAIRO_PATTERN);
38
+ pattern = RVAL2CRPATTERN(value);
39
+ g_value_take_boxed(&gval, pattern);
40
+ goo_canvas_style_set_property(RVAL2GCS(self),
41
+ goo_canvas_style_fill_pattern_id,
42
+ &gval);
43
+ g_value_unset(&gval);
44
+
45
+ G_CHILD_SET(self, rb_intern("fill_pattern"), value);
46
+ return self;
47
+ }
48
+
49
+ void
50
+ Init_goocanvasstyle(void)
51
+ {
52
+ VALUE GooCanvasStyle;
53
+
54
+ GooCanvasStyle = G_DEF_CLASS(GOO_TYPE_CANVAS_STYLE, "CanvasStyle", mGoo);
55
+
56
+ rb_define_method(GooCanvasStyle, "initialize", rb_goo_canvas_style_new, 0);
57
+ rb_define_method(GooCanvasStyle, "set_fill_pattern",
58
+ rb_goo_canvas_style_set_fill_pattern, 1);
59
+
60
+ G_DEF_SETTERS(GooCanvasStyle);
61
+ }
@@ -0,0 +1,41 @@
1
+ /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
+ /* $Id: rbgoocanvastable.c 3288 2008-09-13 10:07:44Z ktou $ */
3
+ /* GooCanvasTable
4
+ * Copyright (C) 2007 Vincent Isambart <vincent.isambart@gmail.com>
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19
+ */
20
+
21
+ #include "rbgoocanvas.h"
22
+
23
+ static VALUE
24
+ rb_goo_canvas_table_new(VALUE self, VALUE parent)
25
+ {
26
+ GooCanvasItem *item;
27
+ item = goo_canvas_table_new(RVAL2GCI(parent), NULL);
28
+ RB_GOO_CANVAS_ITEM_INITIALIZE(self, item);
29
+ G_CHILD_ADD(parent, self);
30
+ return Qnil;
31
+ }
32
+
33
+ void
34
+ Init_goocanvastable(void)
35
+ {
36
+ VALUE GooCanvasTable;
37
+
38
+ GooCanvasTable = G_DEF_CLASS(GOO_TYPE_CANVAS_TABLE, "CanvasTable", mGoo);
39
+
40
+ rb_define_method(GooCanvasTable, "initialize", rb_goo_canvas_table_new, 1);
41
+ }