goocanvas 2.0.0 → 2.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,88 +0,0 @@
1
- /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
- /*
3
- * Copyright (C) 2011 Ruby-GNOME2 Project Team
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., 51 Franklin Street, Fifth Floor, Boston,
19
- * MA 02110-1301 USA
20
- */
21
-
22
- #include "rbgoocanvasprivate.h"
23
-
24
- #define RG_TARGET_NAMESPACE cCanvasPoints
25
- #define _SELF(self) RVAL2GOOCANVASPOINTS(self)
26
-
27
- static VALUE
28
- rg_initialize(VALUE self, VALUE num_points)
29
- {
30
- G_INITIALIZE(self, goo_canvas_points_new(NUM2INT(num_points)));
31
- return Qnil;
32
- }
33
-
34
- static VALUE
35
- rg_operator_get(VALUE self, VALUE point)
36
- {
37
- int i;
38
- GooCanvasPoints *points;
39
-
40
- i = NUM2INT(point);
41
- points = _SELF(self);
42
- if ((i < 0) || (i >= points->num_points))
43
- rb_raise(rb_eArgError, "invalid point number %d", i);
44
- return rb_ary_new3(2,
45
- rb_float_new(points->coords[i * 2]),
46
- rb_float_new(points->coords[i * 2 + 1]));
47
- }
48
-
49
- static VALUE
50
- rg_operator_set(VALUE self, VALUE point, VALUE new_coords)
51
- {
52
- int i;
53
- GooCanvasPoints *points;
54
-
55
- i = NUM2INT(point);
56
- points = _SELF(self);
57
- if ((i < 0) || (i >= points->num_points))
58
- rb_raise(rb_eArgError, "invalid point number %d", i);
59
- if (TYPE(new_coords) != T_ARRAY)
60
- rb_raise(rb_eArgError, "rb_goo_canvas_points_set should be given an array as new value");
61
- if (RARRAY_LEN(new_coords) != 2)
62
- rb_raise(rb_eArgError, "rb_goo_canvas_points_set should be given an array of length 2 as new value");
63
- points->coords[i*2] = NUM2DBL(RARRAY_PTR(new_coords)[0]);
64
- points->coords[i*2+1] = NUM2DBL(RARRAY_PTR(new_coords)[1]);
65
- return self;
66
- }
67
-
68
- static VALUE
69
- rg_num_points(VALUE self)
70
- {
71
- GooCanvasPoints *points;
72
-
73
- points = _SELF(self);
74
- return INT2NUM(points->num_points);
75
- }
76
-
77
- void
78
- Init_goocanvaspoints(VALUE mGoo)
79
- {
80
- VALUE RG_TARGET_NAMESPACE;
81
-
82
- RG_TARGET_NAMESPACE = G_DEF_CLASS(GOO_TYPE_CANVAS_POINTS, "CanvasPoints", mGoo);
83
-
84
- RG_DEF_METHOD(initialize, 1);
85
- RG_DEF_METHOD_OPERATOR("[]", get, 1);
86
- RG_DEF_METHOD_OPERATOR("[]=", set, 2);
87
- RG_DEF_METHOD(num_points, 0);
88
- }
@@ -1,45 +0,0 @@
1
- /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
- /*
3
- * Copyright (C) 2011 Ruby-GNOME2 Project Team
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., 51 Franklin Street, Fifth Floor, Boston,
19
- * MA 02110-1301 USA
20
- */
21
-
22
- #include "rbgoocanvasprivate.h"
23
-
24
- #define RG_TARGET_NAMESPACE cCanvasPolyline
25
-
26
- static VALUE
27
- rg_initialize(VALUE self, VALUE parent, VALUE close_path)
28
- {
29
- GooCanvasItem *item;
30
- item = goo_canvas_polyline_new(RVAL2GOOCANVASITEM(parent), RTEST(close_path), 0, NULL);
31
- RB_GOO_CANVAS_ITEM_INITIALIZE(self, item);
32
- G_CHILD_ADD(parent, self);
33
- return Qnil;
34
- }
35
-
36
- void
37
- Init_goocanvaspolyline(VALUE mGoo)
38
- {
39
- VALUE RG_TARGET_NAMESPACE;
40
-
41
- RG_TARGET_NAMESPACE = G_DEF_CLASS(GOO_TYPE_CANVAS_POLYLINE,
42
- "CanvasPolyline", mGoo);
43
-
44
- RG_DEF_METHOD(initialize, 2);
45
- }
@@ -1,47 +0,0 @@
1
- /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
- /*
3
- * Copyright (C) 2011 Ruby-GNOME2 Project Team
4
- *
5
- * This library is free software; you can redistribute it and/or
6
- * modify it under the terms of the GNU Lesser General Public
7
- * License as published by the Free Software Foundation; either
8
- * version 2.1 of the License, or (at your option) any later version.
9
- *
10
- * This library is distributed in the hope that it will be useful,
11
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
- * Lesser General Public License for more details.
14
- *
15
- * You should have received a copy of the GNU Lesser General Public
16
- * License along with this library; if not, write to the Free Software
17
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
18
- * MA 02110-1301 USA
19
- */
20
-
21
- #ifndef __RBGOOCANVASPRIVATE_H__
22
- #define __RBGOOCANVASPRIVATE_H__
23
-
24
- #include <rbgdk-pixbuf.h>
25
- #include "rbgoocanvas.h"
26
-
27
- #ifndef G_VALUE_INIT
28
- # define G_VALUE_INIT { 0, { { 0 } } }
29
- #endif
30
-
31
- void Init_goocanvas(void); /* Goo::Canvas */
32
- G_GNUC_INTERNAL void Init_goocanvasitem(VALUE mGoo); /* Goo::CanvasItem */
33
- G_GNUC_INTERNAL void Init_goocanvastext(VALUE mGoo); /* Goo::CanvasText */
34
- G_GNUC_INTERNAL void Init_goocanvasrect(VALUE mGoo); /* Goo::CanvasRect */
35
- G_GNUC_INTERNAL void Init_goocanvasellipse(VALUE mGoo); /* Goo::CanvasEllipse */
36
- G_GNUC_INTERNAL void Init_goocanvaspolyline(VALUE mGoo); /* Goo::CanvasPolyline */
37
- G_GNUC_INTERNAL void Init_goocanvaspoints(VALUE mGoo); /* Goo::CanvasPoints */
38
- G_GNUC_INTERNAL void Init_goocanvasimage(VALUE mGoo); /* Goo::CanvasImage */
39
- G_GNUC_INTERNAL void Init_goocanvastable(VALUE mGoo); /* Goo::CanvasTable */
40
- G_GNUC_INTERNAL void Init_goocanvaswidget(VALUE mGoo); /* Goo::CanvasWidget */
41
- G_GNUC_INTERNAL void Init_goocanvasstyle(VALUE mGoo); /* Goo::CanvasStyle */
42
- G_GNUC_INTERNAL void Init_goocanvasgroup(VALUE mGoo); /* Goo::CanvasGroup */
43
- G_GNUC_INTERNAL void Init_goo(void);
44
- G_GNUC_INTERNAL void Init_goocairopattern(VALUE mCairo);
45
- G_GNUC_INTERNAL void Init_goocairomatrix(VALUE mCairo);
46
-
47
- #endif /* __RBGOOCANVASPRIVATE_H__ */
@@ -1,50 +0,0 @@
1
- /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
- /*
3
- * Copyright (C) 2011 Ruby-GNOME2 Project Team
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., 51 Franklin Street, Fifth Floor, Boston,
19
- * MA 02110-1301 USA
20
- */
21
-
22
- #include "rbgoocanvasprivate.h"
23
-
24
- #define RG_TARGET_NAMESPACE cCanvasRect
25
-
26
- static VALUE
27
- rg_initialize(VALUE self, VALUE parent, VALUE x, VALUE y,
28
- VALUE width, VALUE height)
29
- {
30
- GooCanvasItem *item;
31
- item = goo_canvas_rect_new(RVAL2GOOCANVASITEM(parent),
32
- NUM2DBL(x),
33
- NUM2DBL(y),
34
- NUM2DBL(width),
35
- NUM2DBL(height),
36
- NULL);
37
- RB_GOO_CANVAS_ITEM_INITIALIZE(self, item);
38
- G_CHILD_ADD(parent, self);
39
- return Qnil;
40
- }
41
-
42
- void
43
- Init_goocanvasrect(VALUE mGoo)
44
- {
45
- VALUE RG_TARGET_NAMESPACE;
46
-
47
- RG_TARGET_NAMESPACE = G_DEF_CLASS(GOO_TYPE_CANVAS_RECT, "CanvasRect", mGoo);
48
-
49
- RG_DEF_METHOD(initialize, 5);
50
- }
@@ -1,62 +0,0 @@
1
- /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
- /*
3
- * Copyright (C) 2011 Ruby-GNOME2 Project Team
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., 51 Franklin Street, Fifth Floor, Boston,
19
- * MA 02110-1301 USA
20
- */
21
-
22
- #include "rbgoocanvasprivate.h"
23
-
24
- #define RG_TARGET_NAMESPACE cCanvasStyle
25
- #define _SELF(self) RVAL2GOOCANVASSTYLE(self)
26
-
27
- static VALUE
28
- rg_initialize(VALUE self)
29
- {
30
- G_INITIALIZE(self, goo_canvas_style_new());
31
- return Qnil;
32
- }
33
-
34
- /* TODO: make it more generic, with maybe some part in Ruby */
35
- static VALUE
36
- rg_set_fill_pattern(VALUE self, VALUE value)
37
- {
38
- GValue gval = G_VALUE_INIT;
39
- cairo_pattern_t *pattern;
40
-
41
- g_value_init(&gval, GOO_TYPE_CAIRO_PATTERN);
42
- pattern = RVAL2CRPATTERN(value);
43
- g_value_take_boxed(&gval, pattern);
44
- goo_canvas_style_set_property(_SELF(self),
45
- goo_canvas_style_fill_pattern_id,
46
- &gval);
47
- g_value_unset(&gval);
48
-
49
- G_CHILD_SET(self, rb_intern("fill_pattern"), value);
50
- return self;
51
- }
52
-
53
- void
54
- Init_goocanvasstyle(VALUE mGoo)
55
- {
56
- VALUE RG_TARGET_NAMESPACE;
57
-
58
- RG_TARGET_NAMESPACE = G_DEF_CLASS(GOO_TYPE_CANVAS_STYLE, "CanvasStyle", mGoo);
59
-
60
- RG_DEF_METHOD(initialize, 0);
61
- RG_DEF_METHOD(set_fill_pattern, 1);
62
- }
@@ -1,44 +0,0 @@
1
- /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
- /*
3
- * Copyright (C) 2011 Ruby-GNOME2 Project Team
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., 51 Franklin Street, Fifth Floor, Boston,
19
- * MA 02110-1301 USA
20
- */
21
-
22
- #include "rbgoocanvasprivate.h"
23
-
24
- #define RG_TARGET_NAMESPACE cCanvasTable
25
-
26
- static VALUE
27
- rg_initialize(VALUE self, VALUE parent)
28
- {
29
- GooCanvasItem *item;
30
- item = goo_canvas_table_new(RVAL2GOOCANVASITEM(parent), NULL);
31
- RB_GOO_CANVAS_ITEM_INITIALIZE(self, item);
32
- G_CHILD_ADD(parent, self);
33
- return Qnil;
34
- }
35
-
36
- void
37
- Init_goocanvastable(VALUE mGoo)
38
- {
39
- VALUE RG_TARGET_NAMESPACE;
40
-
41
- RG_TARGET_NAMESPACE = G_DEF_CLASS(GOO_TYPE_CANVAS_TABLE, "CanvasTable", mGoo);
42
-
43
- RG_DEF_METHOD(initialize, 1);
44
- }
@@ -1,51 +0,0 @@
1
- /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
- /*
3
- * Copyright (C) 2011 Ruby-GNOME2 Project Team
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., 51 Franklin Street, Fifth Floor, Boston,
19
- * MA 02110-1301 USA
20
- */
21
-
22
- #include "rbgoocanvasprivate.h"
23
-
24
- #define RG_TARGET_NAMESPACE cCanvasText
25
-
26
- static VALUE
27
- rg_initialize(VALUE self, VALUE parent, VALUE string,
28
- VALUE x, VALUE y, VALUE width, VALUE anchor)
29
- {
30
- GooCanvasItem *item;
31
- item = goo_canvas_text_new(RVAL2GOOCANVASITEM(parent),
32
- NIL_P(string) ? NULL : StringValueCStr(string),
33
- NUM2DBL(x),
34
- NUM2DBL(y),
35
- NUM2DBL(width),
36
- RVAL2GENUM(anchor, GTK_TYPE_ANCHOR_TYPE),
37
- NULL);
38
- RB_GOO_CANVAS_ITEM_INITIALIZE(self, item);
39
- G_CHILD_ADD(parent, self);
40
- return Qnil;
41
- }
42
-
43
- void
44
- Init_goocanvastext(VALUE mGoo)
45
- {
46
- VALUE RG_TARGET_NAMESPACE;
47
-
48
- RG_TARGET_NAMESPACE = G_DEF_CLASS(GOO_TYPE_CANVAS_TEXT, "CanvasText", mGoo);
49
-
50
- RG_DEF_METHOD(initialize, 6);
51
- }
@@ -1,51 +0,0 @@
1
- /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
- /*
3
- * Copyright (C) 2011 Ruby-GNOME2 Project Team
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., 51 Franklin Street, Fifth Floor, Boston,
19
- * MA 02110-1301 USA
20
- */
21
-
22
- #include "rbgoocanvasprivate.h"
23
-
24
- #define RG_TARGET_NAMESPACE cCanvasWidget
25
-
26
- static VALUE
27
- rg_initialize(VALUE self, VALUE parent, VALUE widget,
28
- VALUE x, VALUE y, VALUE width, VALUE height)
29
- {
30
- GooCanvasItem *item;
31
- item = goo_canvas_widget_new(RVAL2GOOCANVASITEM(parent),
32
- RVAL2GTKWIDGET(widget),
33
- NUM2DBL(x),
34
- NUM2DBL(y),
35
- NUM2DBL(width),
36
- NUM2DBL(height),
37
- NULL);
38
- RB_GOO_CANVAS_ITEM_INITIALIZE(self, item);
39
- G_CHILD_ADD(parent, self);
40
- return Qnil;
41
- }
42
-
43
- void
44
- Init_goocanvaswidget(VALUE mGoo)
45
- {
46
- VALUE RG_TARGET_NAMESPACE;
47
-
48
- RG_TARGET_NAMESPACE = G_DEF_CLASS(GOO_TYPE_CANVAS_WIDGET, "CanvasWidget", mGoo);
49
-
50
- RG_DEF_METHOD(initialize, 6);
51
- }