goocanvas 0.90.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/ChangeLog +87 -0
- data/README +37 -0
- data/Rakefile +14 -0
- data/ext/goocanvas/Makefile +162 -0
- data/ext/goocanvas/depend +5 -0
- data/ext/goocanvas/extconf.rb +66 -0
- data/ext/goocanvas/goocanvas.def +2 -0
- data/ext/goocanvas/goocanvas.so +0 -0
- data/ext/goocanvas/rbgoo_canvasversion.h +25 -0
- data/ext/goocanvas/rbgoocairo.c +74 -0
- data/ext/goocanvas/rbgoocairo.o +0 -0
- data/ext/goocanvas/rbgoocanvas.c +236 -0
- data/ext/goocanvas/rbgoocanvas.h +66 -0
- data/ext/goocanvas/rbgoocanvas.o +0 -0
- data/ext/goocanvas/rbgoocanvasellipse.c +50 -0
- data/ext/goocanvas/rbgoocanvasellipse.o +0 -0
- data/ext/goocanvas/rbgoocanvasgroup.c +41 -0
- data/ext/goocanvas/rbgoocanvasgroup.o +0 -0
- data/ext/goocanvas/rbgoocanvasimage.c +45 -0
- data/ext/goocanvas/rbgoocanvasimage.o +0 -0
- data/ext/goocanvas/rbgoocanvasitem.c +358 -0
- data/ext/goocanvas/rbgoocanvasitem.o +0 -0
- data/ext/goocanvas/rbgoocanvaspolyline.c +102 -0
- data/ext/goocanvas/rbgoocanvaspolyline.o +0 -0
- data/ext/goocanvas/rbgoocanvasrect.c +47 -0
- data/ext/goocanvas/rbgoocanvasrect.o +0 -0
- data/ext/goocanvas/rbgoocanvasstyle.c +61 -0
- data/ext/goocanvas/rbgoocanvasstyle.o +0 -0
- data/ext/goocanvas/rbgoocanvastable.c +41 -0
- data/ext/goocanvas/rbgoocanvastable.o +0 -0
- data/ext/goocanvas/rbgoocanvastext.c +58 -0
- data/ext/goocanvas/rbgoocanvastext.o +0 -0
- data/ext/goocanvas/rbgoocanvaswidget.c +48 -0
- data/ext/goocanvas/rbgoocanvaswidget.o +0 -0
- data/ext/goocanvas/rbgooutils.c +44 -0
- data/ext/goocanvas/rbgooutils.o +0 -0
- data/ext/goocanvas/ruby-goocanvas.pc +3 -0
- data/extconf.rb +49 -0
- data/lib/goocanvas.rb +145 -0
- data/sample/demo-arrowhead.rb +315 -0
- data/sample/demo-fifteen.rb +218 -0
- data/sample/demo-primitives.rb +720 -0
- data/sample/demo.rb +84 -0
- data/sample/flower.png +0 -0
- data/sample/scalability-demo.rb +130 -0
- data/sample/simple-demo.rb +35 -0
- data/sample/table-demo.rb +137 -0
- data/sample/toroid.png +0 -0
- data/sample/units-demo.rb +80 -0
- data/sample/widgets-demo.rb +197 -0
- metadata +133 -0
Binary file
|
@@ -0,0 +1,236 @@
|
|
1
|
+
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
2
|
+
/* $Id: rbgoocanvas.c 3288 2008-09-13 10:07:44Z ktou $ */
|
3
|
+
/* GooCanvas initialization
|
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
|
+
VALUE mGoo;
|
24
|
+
|
25
|
+
#define SELF(self) RVAL2GC(self)
|
26
|
+
|
27
|
+
void
|
28
|
+
rb_goo_canvas_initialize_item_object(VALUE obj, GooCanvasItem *item)
|
29
|
+
{
|
30
|
+
g_object_ref_sink(item);
|
31
|
+
G_INITIALIZE(obj, item);
|
32
|
+
}
|
33
|
+
|
34
|
+
static VALUE
|
35
|
+
rb_goo_canvas_new(VALUE self)
|
36
|
+
{
|
37
|
+
RBGTK_INITIALIZE(self, goo_canvas_new());
|
38
|
+
return Qnil;
|
39
|
+
}
|
40
|
+
|
41
|
+
static VALUE
|
42
|
+
rb_goo_canvas_set_bounds(VALUE self, VALUE left, VALUE top,
|
43
|
+
VALUE right, VALUE bottom)
|
44
|
+
{
|
45
|
+
goo_canvas_set_bounds(SELF(self), NUM2DBL(left), NUM2DBL(top),
|
46
|
+
NUM2DBL(right), NUM2DBL(bottom));
|
47
|
+
return self;
|
48
|
+
}
|
49
|
+
|
50
|
+
static VALUE
|
51
|
+
rb_goo_canvas_get_root_item(VALUE self)
|
52
|
+
{
|
53
|
+
VALUE root;
|
54
|
+
|
55
|
+
root = GOBJ2RVAL(goo_canvas_get_root_item(SELF(self)));
|
56
|
+
G_CHILD_ADD(self, root);
|
57
|
+
|
58
|
+
return root;
|
59
|
+
}
|
60
|
+
|
61
|
+
static VALUE
|
62
|
+
rb_goo_canvas_grab_focus(int argc, VALUE *argv, VALUE self)
|
63
|
+
{
|
64
|
+
VALUE item;
|
65
|
+
|
66
|
+
if (rb_scan_args(argc, argv, "01", &item) == 1) {
|
67
|
+
goo_canvas_grab_focus(SELF(self), RVAL2GCI(item));
|
68
|
+
} else {
|
69
|
+
rb_call_super(0, 0);
|
70
|
+
}
|
71
|
+
|
72
|
+
return self;
|
73
|
+
}
|
74
|
+
|
75
|
+
static VALUE
|
76
|
+
rb_goo_canvas_pointer_grab(VALUE self, VALUE item, VALUE event_mask, VALUE cursor, VALUE etime)
|
77
|
+
{
|
78
|
+
return GENUM2RVAL(
|
79
|
+
goo_canvas_pointer_grab(SELF(self), RVAL2GCI(item),
|
80
|
+
NUM2INT(event_mask),
|
81
|
+
(GdkCursor *)RVAL2BOXED(cursor, GDK_TYPE_CURSOR),
|
82
|
+
NIL_P(etime) ? 0 : NUM2UINT(etime)),
|
83
|
+
GDK_TYPE_GRAB_STATUS);
|
84
|
+
}
|
85
|
+
|
86
|
+
static VALUE
|
87
|
+
rb_goo_canvas_pointer_ungrab(VALUE self, VALUE item, VALUE etime)
|
88
|
+
{
|
89
|
+
goo_canvas_pointer_ungrab(SELF(self), RVAL2GCI(item),
|
90
|
+
NIL_P(etime) ? 0 : NUM2UINT(etime));
|
91
|
+
return self;
|
92
|
+
}
|
93
|
+
|
94
|
+
static VALUE
|
95
|
+
rb_goo_canvas_render(VALUE self, VALUE cr, VALUE rb_bounds, VALUE scale)
|
96
|
+
{
|
97
|
+
GooCanvasBounds bounds;
|
98
|
+
|
99
|
+
goo_canvas_render(SELF(self), RVAL2CRCONTEXT(cr),
|
100
|
+
RVAL2GCBOUNDS(rb_bounds, &bounds),
|
101
|
+
NUM2DBL(scale));
|
102
|
+
return self;
|
103
|
+
}
|
104
|
+
|
105
|
+
static VALUE
|
106
|
+
rb_goo_canvas_scroll_to(VALUE self, VALUE left, VALUE top)
|
107
|
+
{
|
108
|
+
goo_canvas_scroll_to(SELF(self), NUM2DBL(left), NUM2DBL(top));
|
109
|
+
return self;
|
110
|
+
}
|
111
|
+
|
112
|
+
void
|
113
|
+
Init_goocanvas(void)
|
114
|
+
{
|
115
|
+
VALUE cGooCanvas;
|
116
|
+
|
117
|
+
mGoo = rb_define_module("Goo");
|
118
|
+
cGooCanvas = G_DEF_CLASS(GOO_TYPE_CANVAS, "Canvas", mGoo);
|
119
|
+
|
120
|
+
rb_define_method(cGooCanvas, "initialize", rb_goo_canvas_new, 0);
|
121
|
+
rb_define_method(cGooCanvas, "set_bounds", rb_goo_canvas_set_bounds, 4);
|
122
|
+
rb_define_method(cGooCanvas, "root_item", rb_goo_canvas_get_root_item, 0);
|
123
|
+
rb_define_method(cGooCanvas, "grab_focus", rb_goo_canvas_grab_focus, -1);
|
124
|
+
rb_define_method(cGooCanvas, "pointer_grab", rb_goo_canvas_pointer_grab, 4);
|
125
|
+
rb_define_method(cGooCanvas, "pointer_ungrab",
|
126
|
+
rb_goo_canvas_pointer_ungrab, 2);
|
127
|
+
rb_define_method(cGooCanvas, "render", rb_goo_canvas_render, 3);
|
128
|
+
rb_define_method(cGooCanvas, "scroll_to", rb_goo_canvas_scroll_to, 2);
|
129
|
+
|
130
|
+
Init_goocanvasitem(); /* Goo::CanvasItem */
|
131
|
+
Init_goocanvastext(); /* Goo::CanvasText */
|
132
|
+
Init_goocanvasrect(); /* Goo::CanvasRect */
|
133
|
+
Init_goocanvasellipse(); /* Goo::CanvasEllipse */
|
134
|
+
Init_goocanvaspolyline(); /* Goo::CanvasPolyline */
|
135
|
+
Init_goocanvasimage(); /* Goo::CanvasImage */
|
136
|
+
Init_goocanvastable(); /* Goo::CanvasTable */
|
137
|
+
Init_goocanvaswidget(); /* Goo::CanvasWidget */
|
138
|
+
Init_goocanvasstyle(); /* Goo::CanvasStyle */
|
139
|
+
Init_goocanvasgroup(); /* Goo::CanvasGroup */
|
140
|
+
Init_goocairo(); /* conversion from Cairo types to GooCairo types */
|
141
|
+
|
142
|
+
#if 0
|
143
|
+
GooCanvasItem* goo_canvas_get_root_item (GooCanvas *canvas);
|
144
|
+
void goo_canvas_set_root_item (GooCanvas *canvas,
|
145
|
+
GooCanvasItem *item);
|
146
|
+
|
147
|
+
GooCanvasItemModel* goo_canvas_get_root_item_model (GooCanvas *canvas);
|
148
|
+
void goo_canvas_set_root_item_model (GooCanvas *canvas,
|
149
|
+
GooCanvasItemModel *model);
|
150
|
+
|
151
|
+
GooCanvasItem* goo_canvas_get_item (GooCanvas *canvas,
|
152
|
+
GooCanvasItemModel *model);
|
153
|
+
GooCanvasItem* goo_canvas_get_item_at (GooCanvas *canvas,
|
154
|
+
gdouble x,
|
155
|
+
gdouble y,
|
156
|
+
gboolean is_pointer_event);
|
157
|
+
|
158
|
+
gdouble goo_canvas_get_scale (GooCanvas *canvas);
|
159
|
+
void goo_canvas_set_scale (GooCanvas *canvas,
|
160
|
+
gdouble scale);
|
161
|
+
|
162
|
+
void goo_canvas_get_bounds (GooCanvas *canvas,
|
163
|
+
gdouble *left,
|
164
|
+
gdouble *top,
|
165
|
+
gdouble *right,
|
166
|
+
gdouble *bottom);
|
167
|
+
|
168
|
+
|
169
|
+
void goo_canvas_grab_focus (GooCanvas *canvas,
|
170
|
+
GooCanvasItem *item);
|
171
|
+
|
172
|
+
void goo_canvas_render (GooCanvas *canvas,
|
173
|
+
cairo_t *cr,
|
174
|
+
GooCanvasBounds *bounds,
|
175
|
+
gdouble scale);
|
176
|
+
|
177
|
+
/*
|
178
|
+
* Coordinate conversion.
|
179
|
+
*/
|
180
|
+
void goo_canvas_convert_to_pixels (GooCanvas *canvas,
|
181
|
+
gdouble *x,
|
182
|
+
gdouble *y);
|
183
|
+
void goo_canvas_convert_from_pixels (GooCanvas *canvas,
|
184
|
+
gdouble *x,
|
185
|
+
gdouble *y);
|
186
|
+
|
187
|
+
void goo_canvas_convert_to_item_space (GooCanvas *canvas,
|
188
|
+
GooCanvasItem *item,
|
189
|
+
gdouble *x,
|
190
|
+
gdouble *y);
|
191
|
+
void goo_canvas_convert_from_item_space (GooCanvas *canvas,
|
192
|
+
GooCanvasItem *item,
|
193
|
+
gdouble *x,
|
194
|
+
gdouble *y);
|
195
|
+
|
196
|
+
|
197
|
+
/*
|
198
|
+
* Pointer/keyboard grabbing & ungrabbing.
|
199
|
+
*/
|
200
|
+
GdkGrabStatus goo_canvas_pointer_grab (GooCanvas *canvas,
|
201
|
+
GooCanvasItem *item,
|
202
|
+
GdkEventMask event_mask,
|
203
|
+
GdkCursor *cursor,
|
204
|
+
guint32 time);
|
205
|
+
void goo_canvas_pointer_ungrab (GooCanvas *canvas,
|
206
|
+
GooCanvasItem *item,
|
207
|
+
guint32 time);
|
208
|
+
GdkGrabStatus goo_canvas_keyboard_grab (GooCanvas *canvas,
|
209
|
+
GooCanvasItem *item,
|
210
|
+
gboolean owner_events,
|
211
|
+
guint32 time);
|
212
|
+
void goo_canvas_keyboard_ungrab (GooCanvas *canvas,
|
213
|
+
GooCanvasItem *item,
|
214
|
+
guint32 time);
|
215
|
+
|
216
|
+
|
217
|
+
/*
|
218
|
+
* Internal functions, mainly for canvas subclasses and item implementations.
|
219
|
+
*/
|
220
|
+
GooCanvasItem* goo_canvas_create_item (GooCanvas *canvas,
|
221
|
+
GooCanvasItemModel *model);
|
222
|
+
void goo_canvas_unregister_item (GooCanvas *canvas,
|
223
|
+
GooCanvasItemModel *model);
|
224
|
+
void goo_canvas_update (GooCanvas *canvas);
|
225
|
+
void goo_canvas_request_update (GooCanvas *canvas);
|
226
|
+
void goo_canvas_request_redraw (GooCanvas *canvas,
|
227
|
+
GooCanvasBounds *bounds);
|
228
|
+
gdouble goo_canvas_get_default_line_width (GooCanvas *canvas);
|
229
|
+
|
230
|
+
|
231
|
+
void goo_canvas_register_widget_item (GooCanvas *canvas,
|
232
|
+
GooCanvasWidget *witem);
|
233
|
+
void goo_canvas_unregister_widget_item (GooCanvas *canvas,
|
234
|
+
GooCanvasWidget *witem);
|
235
|
+
#endif
|
236
|
+
}
|
@@ -0,0 +1,66 @@
|
|
1
|
+
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
2
|
+
/* $Id: rbgoocanvas.h 3288 2008-09-13 10:07:44Z ktou $ */
|
3
|
+
/* GooCanvas main header
|
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
|
+
#ifndef _RBGOOCANVAS_H_included
|
22
|
+
#define _RBGOOCANVAS_H_included
|
23
|
+
|
24
|
+
#include <rb_cairo.h>
|
25
|
+
#include <rbgtk.h>
|
26
|
+
#include <goocanvas.h>
|
27
|
+
|
28
|
+
#include "rbgoo_canvasversion.h"
|
29
|
+
|
30
|
+
#define RVAL2GC(obj) GOO_CANVAS(RVAL2GOBJ(obj))
|
31
|
+
#define RVAL2GCI(obj) GOO_CANVAS_ITEM(RVAL2GOBJ(obj))
|
32
|
+
#define RVAL2GCS(obj) GOO_CANVAS_STYLE(RVAL2GOBJ(obj))
|
33
|
+
|
34
|
+
#define RVAL2GCPOINTS(obj) \
|
35
|
+
((GooCanvasPoints *)(RVAL2BOXED(obj, GOO_TYPE_CANVAS_POINTS)))
|
36
|
+
|
37
|
+
#define RVAL2GCBOUNDS(obj, bounds) \
|
38
|
+
(ruby_to_goo_canvas_bounds(obj, bounds))
|
39
|
+
|
40
|
+
#define RVAL2GTK_WIDGET(obj) GTK_WIDGET(RVAL2GOBJ(obj))
|
41
|
+
|
42
|
+
#define RVAL2GDK_PIXBUF(obj) GDK_PIXBUF(RVAL2GOBJ(obj))
|
43
|
+
|
44
|
+
|
45
|
+
#define RB_GOO_CANVAS_ITEM_INITIALIZE(obj, item) \
|
46
|
+
(rb_goo_canvas_initialize_item_object(obj, GOO_CANVAS_ITEM(item)))
|
47
|
+
|
48
|
+
void rb_goo_canvas_initialize_item_object(VALUE obj, GooCanvasItem *item);
|
49
|
+
GooCanvasBounds *ruby_to_goo_canvas_bounds(VALUE rb_bounds, GooCanvasBounds *dest_bounds);
|
50
|
+
|
51
|
+
void Init_goocanvas(void); /* Goo::Canvas */
|
52
|
+
void Init_goocanvasitem(void); /* Goo::CanvasItem */
|
53
|
+
void Init_goocanvastext(void); /* Goo::CanvasText */
|
54
|
+
void Init_goocanvasrect(void); /* Goo::CanvasRect */
|
55
|
+
void Init_goocanvasellipse(void); /* Goo::CanvasEllipse */
|
56
|
+
void Init_goocanvaspolyline(void); /* Goo::CanvasPolyline */
|
57
|
+
void Init_goocanvasimage(void); /* Goo::CanvasImage */
|
58
|
+
void Init_goocanvastable(void); /* Goo::CanvasTable */
|
59
|
+
void Init_goocanvaswidget(void); /* Goo::CanvasWidget */
|
60
|
+
void Init_goocanvasstyle(void); /* Goo::CanvasStyle */
|
61
|
+
void Init_goocanvasgroup(void); /* Goo::CanvasGroup */
|
62
|
+
void Init_goocairo(void); /* conversion from Cairo types to GooCairo types */
|
63
|
+
|
64
|
+
extern VALUE mGoo;
|
65
|
+
|
66
|
+
#endif /* ! _RBGOOCANVAS_H_included */
|
Binary file
|
@@ -0,0 +1,50 @@
|
|
1
|
+
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
2
|
+
/* $Id: rbgoocanvasellipse.c 3288 2008-09-13 10:07:44Z ktou $ */
|
3
|
+
/* GooCanvasEllipse
|
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_ellipse_new(VALUE self, VALUE parent,
|
25
|
+
VALUE center_x, VALUE center_y,
|
26
|
+
VALUE radius_x, VALUE radius_y)
|
27
|
+
{
|
28
|
+
GooCanvasItem *item;
|
29
|
+
item = goo_canvas_ellipse_new(RVAL2GCI(parent),
|
30
|
+
NUM2DBL(center_x),
|
31
|
+
NUM2DBL(center_y),
|
32
|
+
NUM2DBL(radius_x),
|
33
|
+
NUM2DBL(radius_y),
|
34
|
+
NULL);
|
35
|
+
RB_GOO_CANVAS_ITEM_INITIALIZE(self, item);
|
36
|
+
G_CHILD_ADD(parent, self);
|
37
|
+
return Qnil;
|
38
|
+
}
|
39
|
+
|
40
|
+
void
|
41
|
+
Init_goocanvasellipse(void)
|
42
|
+
{
|
43
|
+
VALUE GooCanvasEllipse;
|
44
|
+
|
45
|
+
GooCanvasEllipse = G_DEF_CLASS(GOO_TYPE_CANVAS_ELLIPSE, "CanvasEllipse",
|
46
|
+
mGoo);
|
47
|
+
|
48
|
+
rb_define_method(GooCanvasEllipse, "initialize",
|
49
|
+
rb_goo_canvas_ellipse_new, 5);
|
50
|
+
}
|
Binary file
|
@@ -0,0 +1,41 @@
|
|
1
|
+
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
2
|
+
/* $Id: rbgoocanvasgroup.c 3288 2008-09-13 10:07:44Z ktou $ */
|
3
|
+
/* GooCanvasGroup
|
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_group_new(VALUE self, VALUE parent)
|
25
|
+
{
|
26
|
+
GooCanvasItem *item;
|
27
|
+
item = goo_canvas_group_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_goocanvasgroup(void)
|
35
|
+
{
|
36
|
+
VALUE GooCanvasGroup;
|
37
|
+
|
38
|
+
GooCanvasGroup = G_DEF_CLASS(GOO_TYPE_CANVAS_GROUP, "CanvasGroup", mGoo);
|
39
|
+
|
40
|
+
rb_define_method(GooCanvasGroup, "initialize", rb_goo_canvas_group_new, 1);
|
41
|
+
}
|
Binary file
|
@@ -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
|
+
}
|