goocanvas 2.0.0 → 2.0.1
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/Rakefile +0 -1
- data/ext/goocanvas/extconf.rb +14 -9
- data/ext/goocanvas/rbgoocanvas.c +23 -180
- data/ext/goocanvas/rbgoocanvas.h +3 -19
- data/{sample/goocanvas-gi.rb → lib/goo/canvas-item.rb} +12 -21
- data/lib/goocanvas.rb +55 -138
- data/sample/scalability-demo.rb +57 -18
- data/sample/simple-demo.rb +1 -3
- data/sample/table-demo.rb +104 -23
- data/sample/units-demo.rb +1 -3
- data/sample/widgets-demo.rb +112 -32
- metadata +8 -25
- data/ext/goocanvas/rbgoo.c +0 -41
- data/ext/goocanvas/rbgoocairomatrix.c +0 -47
- data/ext/goocanvas/rbgoocairopattern.c +0 -47
- data/ext/goocanvas/rbgoocanvasconversions.h +0 -31
- data/ext/goocanvas/rbgoocanvasellipse.c +0 -52
- data/ext/goocanvas/rbgoocanvasgroup.c +0 -44
- data/ext/goocanvas/rbgoocanvasimage.c +0 -48
- data/ext/goocanvas/rbgoocanvasitem.c +0 -265
- data/ext/goocanvas/rbgoocanvaspoints.c +0 -88
- data/ext/goocanvas/rbgoocanvaspolyline.c +0 -45
- data/ext/goocanvas/rbgoocanvasprivate.h +0 -47
- data/ext/goocanvas/rbgoocanvasrect.c +0 -50
- data/ext/goocanvas/rbgoocanvasstyle.c +0 -62
- data/ext/goocanvas/rbgoocanvastable.c +0 -44
- data/ext/goocanvas/rbgoocanvastext.c +0 -51
- data/ext/goocanvas/rbgoocanvaswidget.c +0 -51
- data/ext/goocanvas/rbgooutils.c +0 -45
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: goocanvas
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,24 +9,24 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-05-25 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: gtk2
|
16
16
|
requirement: !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
|
-
- -
|
19
|
+
- - '='
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version: 2.0.
|
21
|
+
version: 2.0.1
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
24
|
version_requirements: !ruby/object:Gem::Requirement
|
25
25
|
none: false
|
26
26
|
requirements:
|
27
|
-
- -
|
27
|
+
- - '='
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
version: 2.0.
|
29
|
+
version: 2.0.1
|
30
30
|
description: Ruby/GooCanvas is a Ruby binding of GooCanvas.
|
31
31
|
email: ruby-gnome2-devel-en@lists.sourceforge.net
|
32
32
|
executables: []
|
@@ -37,35 +37,18 @@ files:
|
|
37
37
|
- README
|
38
38
|
- Rakefile
|
39
39
|
- extconf.rb
|
40
|
+
- lib/goo/canvas-item.rb
|
40
41
|
- lib/goocanvas.rb
|
41
42
|
- ext/goocanvas/depend
|
42
43
|
- ext/goocanvas/extconf.rb
|
43
44
|
- ext/goocanvas/goocanvas.def
|
44
|
-
- ext/goocanvas/rbgoo.c
|
45
|
-
- ext/goocanvas/rbgoocairomatrix.c
|
46
|
-
- ext/goocanvas/rbgoocairopattern.c
|
47
45
|
- ext/goocanvas/rbgoocanvas.c
|
48
46
|
- ext/goocanvas/rbgoocanvas.h
|
49
|
-
- ext/goocanvas/rbgoocanvasconversions.h
|
50
|
-
- ext/goocanvas/rbgoocanvasellipse.c
|
51
|
-
- ext/goocanvas/rbgoocanvasgroup.c
|
52
|
-
- ext/goocanvas/rbgoocanvasimage.c
|
53
|
-
- ext/goocanvas/rbgoocanvasitem.c
|
54
|
-
- ext/goocanvas/rbgoocanvaspoints.c
|
55
|
-
- ext/goocanvas/rbgoocanvaspolyline.c
|
56
|
-
- ext/goocanvas/rbgoocanvasprivate.h
|
57
|
-
- ext/goocanvas/rbgoocanvasrect.c
|
58
|
-
- ext/goocanvas/rbgoocanvasstyle.c
|
59
|
-
- ext/goocanvas/rbgoocanvastable.c
|
60
|
-
- ext/goocanvas/rbgoocanvastext.c
|
61
|
-
- ext/goocanvas/rbgoocanvaswidget.c
|
62
|
-
- ext/goocanvas/rbgooutils.c
|
63
47
|
- sample/demo-arrowhead.rb
|
64
48
|
- sample/demo-fifteen.rb
|
65
49
|
- sample/demo-primitives.rb
|
66
50
|
- sample/demo.rb
|
67
51
|
- sample/flower.png
|
68
|
-
- sample/goocanvas-gi.rb
|
69
52
|
- sample/scalability-demo.rb
|
70
53
|
- sample/simple-demo.rb
|
71
54
|
- sample/table-demo.rb
|
@@ -74,7 +57,7 @@ files:
|
|
74
57
|
- sample/widgets-demo.rb
|
75
58
|
homepage: http://ruby-gnome2.sourceforge.jp/
|
76
59
|
licenses: []
|
77
|
-
post_install_message:
|
60
|
+
post_install_message:
|
78
61
|
rdoc_options: []
|
79
62
|
require_paths:
|
80
63
|
- lib
|
data/ext/goocanvas/rbgoo.c
DELETED
@@ -1,41 +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 mGoo
|
25
|
-
|
26
|
-
VALUE RG_TARGET_NAMESPACE;
|
27
|
-
|
28
|
-
void
|
29
|
-
Init_goo(void)
|
30
|
-
{
|
31
|
-
RG_TARGET_NAMESPACE = rb_define_module("Goo");
|
32
|
-
|
33
|
-
G_DEF_CLASS(GOO_TYPE_CAIRO_MATRIX, "CairoMatrix", RG_TARGET_NAMESPACE);
|
34
|
-
G_DEF_CLASS(GOO_TYPE_CAIRO_PATTERN, "CairoPattern", RG_TARGET_NAMESPACE);
|
35
|
-
G_DEF_CLASS(GOO_TYPE_CAIRO_FILL_RULE, "CairoFillRule", RG_TARGET_NAMESPACE);
|
36
|
-
G_DEF_CLASS(GOO_TYPE_CAIRO_OPERATOR, "CairoOperator", RG_TARGET_NAMESPACE);
|
37
|
-
G_DEF_CLASS(GOO_TYPE_CAIRO_ANTIALIAS, "CairoAntiAlias", RG_TARGET_NAMESPACE);
|
38
|
-
G_DEF_CLASS(GOO_TYPE_CAIRO_LINE_CAP, "CairoLineCap", RG_TARGET_NAMESPACE);
|
39
|
-
G_DEF_CLASS(GOO_TYPE_CAIRO_LINE_JOIN, "CairoLineJoin", RG_TARGET_NAMESPACE);
|
40
|
-
G_DEF_CLASS(GOO_TYPE_CAIRO_HINT_METRICS, "CairoHintMetrics", RG_TARGET_NAMESPACE);
|
41
|
-
}
|
@@ -1,47 +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 cMatrix
|
25
|
-
|
26
|
-
static VALUE
|
27
|
-
rg_to_goo(VALUE self)
|
28
|
-
{
|
29
|
-
GValue gval = G_VALUE_INIT;
|
30
|
-
VALUE result;
|
31
|
-
|
32
|
-
g_value_init(&gval, GOO_TYPE_CAIRO_MATRIX);
|
33
|
-
g_value_set_boxed(&gval, RVAL2CRMATRIX(self));
|
34
|
-
|
35
|
-
result = rbgobj_gvalue_to_rvalue(&gval);
|
36
|
-
g_value_unset(&gval);
|
37
|
-
|
38
|
-
return result;
|
39
|
-
}
|
40
|
-
|
41
|
-
void
|
42
|
-
Init_goocairomatrix(VALUE mCairo)
|
43
|
-
{
|
44
|
-
VALUE RG_TARGET_NAMESPACE = rb_const_get(mCairo, rb_intern("Matrix"));
|
45
|
-
|
46
|
-
RG_DEF_METHOD(to_goo, 0);
|
47
|
-
}
|
@@ -1,47 +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 cPattern
|
25
|
-
|
26
|
-
static VALUE
|
27
|
-
rg_to_goo(VALUE self)
|
28
|
-
{
|
29
|
-
GValue gval = G_VALUE_INIT;
|
30
|
-
VALUE result;
|
31
|
-
|
32
|
-
g_value_init(&gval, GOO_TYPE_CAIRO_PATTERN);
|
33
|
-
g_value_set_boxed(&gval, RVAL2CRPATTERN(self));
|
34
|
-
|
35
|
-
result = rbgobj_gvalue_to_rvalue(&gval);
|
36
|
-
g_value_unset(&gval);
|
37
|
-
|
38
|
-
return result;
|
39
|
-
}
|
40
|
-
|
41
|
-
void
|
42
|
-
Init_goocairopattern(VALUE mCairo)
|
43
|
-
{
|
44
|
-
VALUE RG_TARGET_NAMESPACE = rb_const_get(mCairo, rb_intern("Pattern"));
|
45
|
-
|
46
|
-
RG_DEF_METHOD(to_goo, 0);
|
47
|
-
}
|
@@ -1,31 +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 __RBGOOCANVASCONVERSIONS_H__
|
22
|
-
#define __RBGOOCANVASCONVERSIONS_H__
|
23
|
-
|
24
|
-
#define RVAL2GOOCANVAS(o) (GOO_CANVAS(RVAL2GOBJ(o)))
|
25
|
-
#define RVAL2GOOCANVASITEM(o) (GOO_CANVAS_ITEM(RVAL2GOBJ(o)))
|
26
|
-
#define RVAL2GOOCANVASSTYLE(o) (GOO_CANVAS_STYLE(RVAL2GOBJ(o)))
|
27
|
-
|
28
|
-
#define RVAL2GOOCANVASPOINTS(o) ((GooCanvasPoints*)RVAL2BOXED(o, GOO_TYPE_CANVAS_POINTS))
|
29
|
-
#define GOOCANVASPOINTS2RVAL(o) (BOXED2RVAL(o, GOO_TYPE_CANVAS_POINTS))
|
30
|
-
|
31
|
-
#endif /* __RBGOOCANVASCONVERSIONS_H__ */
|
@@ -1,52 +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 cCanvasEllipse
|
25
|
-
|
26
|
-
static VALUE
|
27
|
-
rg_initialize(VALUE self, VALUE parent,
|
28
|
-
VALUE center_x, VALUE center_y,
|
29
|
-
VALUE radius_x, VALUE radius_y)
|
30
|
-
{
|
31
|
-
GooCanvasItem *item;
|
32
|
-
item = goo_canvas_ellipse_new(RVAL2GOOCANVASITEM(parent),
|
33
|
-
NUM2DBL(center_x),
|
34
|
-
NUM2DBL(center_y),
|
35
|
-
NUM2DBL(radius_x),
|
36
|
-
NUM2DBL(radius_y),
|
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_goocanvasellipse(VALUE mGoo)
|
45
|
-
{
|
46
|
-
VALUE RG_TARGET_NAMESPACE;
|
47
|
-
|
48
|
-
RG_TARGET_NAMESPACE = G_DEF_CLASS(GOO_TYPE_CANVAS_ELLIPSE, "CanvasEllipse",
|
49
|
-
mGoo);
|
50
|
-
|
51
|
-
RG_DEF_METHOD(initialize, 5);
|
52
|
-
}
|
@@ -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 cCanvasGroup
|
25
|
-
|
26
|
-
static VALUE
|
27
|
-
rg_initialize(VALUE self, VALUE parent)
|
28
|
-
{
|
29
|
-
GooCanvasItem *item;
|
30
|
-
item = goo_canvas_group_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_goocanvasgroup(VALUE mGoo)
|
38
|
-
{
|
39
|
-
VALUE RG_TARGET_NAMESPACE;
|
40
|
-
|
41
|
-
RG_TARGET_NAMESPACE = G_DEF_CLASS(GOO_TYPE_CANVAS_GROUP, "CanvasGroup", mGoo);
|
42
|
-
|
43
|
-
RG_DEF_METHOD(initialize, 1);
|
44
|
-
}
|
@@ -1,48 +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 cCanvasImage
|
25
|
-
|
26
|
-
static VALUE
|
27
|
-
rg_initialize(VALUE self, VALUE parent, VALUE pixbuf,
|
28
|
-
VALUE x, VALUE y)
|
29
|
-
{
|
30
|
-
GooCanvasItem *item;
|
31
|
-
item = goo_canvas_image_new(RVAL2GOOCANVASITEM(parent),
|
32
|
-
RVAL2GDKPIXBUF(pixbuf),
|
33
|
-
NUM2DBL(x),
|
34
|
-
NUM2DBL(y),
|
35
|
-
NULL);
|
36
|
-
RB_GOO_CANVAS_ITEM_INITIALIZE(self, item);
|
37
|
-
G_CHILD_ADD(parent, self);
|
38
|
-
return Qnil;
|
39
|
-
}
|
40
|
-
|
41
|
-
void
|
42
|
-
Init_goocanvasimage(VALUE mGoo)
|
43
|
-
{
|
44
|
-
VALUE RG_TARGET_NAMESPACE;
|
45
|
-
|
46
|
-
RG_TARGET_NAMESPACE = G_DEF_CLASS(GOO_TYPE_CANVAS_IMAGE, "CanvasImage", mGoo);
|
47
|
-
RG_DEF_METHOD(initialize, 4);
|
48
|
-
}
|
@@ -1,265 +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 cCanvasItem
|
25
|
-
#define SELF(self) RVAL2GOOCANVASITEM(self)
|
26
|
-
|
27
|
-
static VALUE
|
28
|
-
rg_rotate(VALUE self, VALUE degrees, VALUE cx, VALUE cy)
|
29
|
-
{
|
30
|
-
goo_canvas_item_rotate(SELF(self), NUM2DBL(degrees),
|
31
|
-
NUM2DBL(cx), NUM2DBL(cy));
|
32
|
-
return self;
|
33
|
-
}
|
34
|
-
|
35
|
-
static VALUE
|
36
|
-
rg_translate(VALUE self, VALUE tx, VALUE ty)
|
37
|
-
{
|
38
|
-
goo_canvas_item_translate(SELF(self), NUM2DBL(tx), NUM2DBL(ty));
|
39
|
-
return self;
|
40
|
-
}
|
41
|
-
|
42
|
-
static VALUE
|
43
|
-
rg_lower(VALUE self, VALUE below)
|
44
|
-
{
|
45
|
-
goo_canvas_item_lower(SELF(self), SELF(below));
|
46
|
-
return self;
|
47
|
-
}
|
48
|
-
|
49
|
-
static VALUE
|
50
|
-
rg_raise(VALUE self, VALUE above)
|
51
|
-
{
|
52
|
-
goo_canvas_item_raise(SELF(self), SELF(above));
|
53
|
-
return self;
|
54
|
-
}
|
55
|
-
|
56
|
-
static VALUE
|
57
|
-
rg_scale(VALUE self, VALUE sx, VALUE sy)
|
58
|
-
{
|
59
|
-
goo_canvas_item_scale(SELF(self), NUM2DBL(sx), NUM2DBL(sy));
|
60
|
-
return self;
|
61
|
-
}
|
62
|
-
|
63
|
-
static VALUE
|
64
|
-
rg_x1(VALUE self)
|
65
|
-
{
|
66
|
-
GooCanvasBounds bounds;
|
67
|
-
goo_canvas_item_get_bounds(SELF(self), &bounds);
|
68
|
-
return rb_float_new(bounds.x1);
|
69
|
-
}
|
70
|
-
|
71
|
-
static VALUE
|
72
|
-
rg_x2(VALUE self)
|
73
|
-
{
|
74
|
-
GooCanvasBounds bounds;
|
75
|
-
goo_canvas_item_get_bounds(SELF(self), &bounds);
|
76
|
-
return rb_float_new(bounds.x2);
|
77
|
-
}
|
78
|
-
|
79
|
-
static VALUE
|
80
|
-
rg_y1(VALUE self)
|
81
|
-
{
|
82
|
-
GooCanvasBounds bounds;
|
83
|
-
goo_canvas_item_get_bounds(SELF(self), &bounds);
|
84
|
-
return rb_float_new(bounds.y1);
|
85
|
-
}
|
86
|
-
|
87
|
-
static VALUE
|
88
|
-
rg_y2(VALUE self)
|
89
|
-
{
|
90
|
-
GooCanvasBounds bounds;
|
91
|
-
goo_canvas_item_get_bounds(SELF(self), &bounds);
|
92
|
-
return rb_float_new(bounds.y2);
|
93
|
-
}
|
94
|
-
|
95
|
-
static VALUE
|
96
|
-
rg_skew_x(VALUE self, VALUE degrees, VALUE cx, VALUE cy)
|
97
|
-
{
|
98
|
-
goo_canvas_item_skew_x(SELF(self), NUM2DBL(degrees),
|
99
|
-
NUM2DBL(cx), NUM2DBL(cy));
|
100
|
-
return self;
|
101
|
-
}
|
102
|
-
|
103
|
-
static VALUE
|
104
|
-
rg_skew_y(VALUE self, VALUE degrees, VALUE cx, VALUE cy)
|
105
|
-
{
|
106
|
-
goo_canvas_item_skew_y(SELF(self), NUM2DBL(degrees),
|
107
|
-
NUM2DBL(cx), NUM2DBL(cy));
|
108
|
-
return self;
|
109
|
-
}
|
110
|
-
|
111
|
-
static VALUE
|
112
|
-
rg_set_simple_transform(VALUE self, VALUE x, VALUE y,
|
113
|
-
VALUE scale, VALUE rotation)
|
114
|
-
{
|
115
|
-
goo_canvas_item_set_simple_transform(SELF(self), NUM2DBL(x), NUM2DBL(y),
|
116
|
-
NUM2DBL(scale), NUM2DBL(rotation));
|
117
|
-
return self;
|
118
|
-
}
|
119
|
-
|
120
|
-
static VALUE
|
121
|
-
rg_animate(VALUE self, VALUE x, VALUE y, VALUE scale,
|
122
|
-
VALUE degrees, VALUE absolute, VALUE duration,
|
123
|
-
VALUE step_time, VALUE type)
|
124
|
-
{
|
125
|
-
goo_canvas_item_animate(SELF(self),
|
126
|
-
NUM2DBL(x),
|
127
|
-
NUM2DBL(y),
|
128
|
-
NUM2DBL(scale),
|
129
|
-
NUM2DBL(degrees),
|
130
|
-
RTEST(absolute),
|
131
|
-
NUM2INT(duration),
|
132
|
-
NUM2INT(step_time),
|
133
|
-
rbgobj_get_enum(type, GOO_TYPE_CANVAS_ANIMATE_TYPE));
|
134
|
-
return self;
|
135
|
-
}
|
136
|
-
|
137
|
-
static VALUE
|
138
|
-
rg_stop_animation(VALUE self)
|
139
|
-
{
|
140
|
-
goo_canvas_item_stop_animation(SELF(self));
|
141
|
-
return self;
|
142
|
-
}
|
143
|
-
|
144
|
-
static VALUE
|
145
|
-
rg_set_style(VALUE self, VALUE style)
|
146
|
-
{
|
147
|
-
goo_canvas_item_set_style(SELF(self), RVAL2GOOCANVASSTYLE(style));
|
148
|
-
return self;
|
149
|
-
}
|
150
|
-
|
151
|
-
static VALUE
|
152
|
-
rg_set_child_property(VALUE self, VALUE child,
|
153
|
-
VALUE prop_name, VALUE val)
|
154
|
-
{
|
155
|
-
GParamSpec* pspec;
|
156
|
-
const char* name;
|
157
|
-
|
158
|
-
if (SYMBOL_P(prop_name)) {
|
159
|
-
name = rb_id2name(SYM2ID(prop_name));
|
160
|
-
} else {
|
161
|
-
StringValue(prop_name);
|
162
|
-
name = StringValuePtr(prop_name);
|
163
|
-
}
|
164
|
-
pspec = goo_canvas_item_class_find_child_property(G_OBJECT_GET_CLASS(RVAL2GOBJ(self)), name);
|
165
|
-
|
166
|
-
if (!pspec)
|
167
|
-
rb_raise(rb_eRuntimeError, "No such child property: %s", name);
|
168
|
-
|
169
|
-
#define _SET_PROP_FOR_TYPE(gtype, ctype, val) \
|
170
|
-
case gtype: \
|
171
|
-
goo_canvas_item_set_child_properties(SELF(self), SELF(child), name, (ctype)(val), NULL); \
|
172
|
-
break;
|
173
|
-
|
174
|
-
switch (G_TYPE_FUNDAMENTAL(G_PARAM_SPEC_VALUE_TYPE(pspec))) {
|
175
|
-
_SET_PROP_FOR_TYPE(G_TYPE_CHAR, gchar, NUM2INT(val));
|
176
|
-
_SET_PROP_FOR_TYPE(G_TYPE_UCHAR, guchar, NUM2INT(val));
|
177
|
-
_SET_PROP_FOR_TYPE(G_TYPE_BOOLEAN, gboolean, RTEST(val));
|
178
|
-
_SET_PROP_FOR_TYPE(G_TYPE_INT, gint, NUM2INT(val));
|
179
|
-
_SET_PROP_FOR_TYPE(G_TYPE_UINT, guint, NUM2UINT(val));
|
180
|
-
_SET_PROP_FOR_TYPE(G_TYPE_LONG, glong, NUM2LONG(val));
|
181
|
-
_SET_PROP_FOR_TYPE(G_TYPE_ULONG, gulong, NUM2ULONG(val));
|
182
|
-
_SET_PROP_FOR_TYPE(G_TYPE_INT64, gint64, rbglib_num_to_int64(val));
|
183
|
-
_SET_PROP_FOR_TYPE(G_TYPE_UINT64, guint64, rbglib_num_to_uint64(val));
|
184
|
-
_SET_PROP_FOR_TYPE(G_TYPE_ENUM, gint, rbgobj_get_enum(val, G_PARAM_SPEC_VALUE_TYPE(pspec)));
|
185
|
-
_SET_PROP_FOR_TYPE(G_TYPE_FLAGS, guint, rbgobj_get_flags(val, G_PARAM_SPEC_VALUE_TYPE(pspec)));
|
186
|
-
_SET_PROP_FOR_TYPE(G_TYPE_FLOAT, gfloat, NUM2DBL(val));
|
187
|
-
_SET_PROP_FOR_TYPE(G_TYPE_DOUBLE, gdouble, NUM2DBL(val));
|
188
|
-
case G_TYPE_STRING:
|
189
|
-
{
|
190
|
-
if (SYMBOL_P(val))
|
191
|
-
val = rb_funcall(val, rb_intern("to_s"), 0);
|
192
|
-
goo_canvas_item_set_child_properties(SELF(self), SELF(child), name, StringValuePtr(val), NULL);
|
193
|
-
break;
|
194
|
-
}
|
195
|
-
|
196
|
-
default:
|
197
|
-
g_warning("rb_goo_canvas_item_set_child_property: unsupported type: %s\n", g_type_name(G_PARAM_SPEC_VALUE_TYPE(pspec)));
|
198
|
-
return Qnil;
|
199
|
-
}
|
200
|
-
|
201
|
-
#undef _SET_PROP_FOR_TYPE
|
202
|
-
|
203
|
-
G_CHILD_ADD(child, val);
|
204
|
-
|
205
|
-
return self;
|
206
|
-
}
|
207
|
-
|
208
|
-
static VALUE
|
209
|
-
rg_canvas(VALUE self)
|
210
|
-
{
|
211
|
-
return GOBJ2RVAL(goo_canvas_item_get_canvas(SELF(self)));
|
212
|
-
}
|
213
|
-
|
214
|
-
static VALUE
|
215
|
-
rg_remove_child(VALUE self, VALUE child)
|
216
|
-
{
|
217
|
-
gint child_num;
|
218
|
-
|
219
|
-
child_num = goo_canvas_item_find_child(SELF(self), SELF(child));
|
220
|
-
goo_canvas_item_remove_child(SELF(self), child_num);
|
221
|
-
G_CHILD_REMOVE(self, child);
|
222
|
-
|
223
|
-
return self;
|
224
|
-
}
|
225
|
-
|
226
|
-
void
|
227
|
-
Init_goocanvasitem(VALUE mGoo)
|
228
|
-
{
|
229
|
-
VALUE RG_TARGET_NAMESPACE;
|
230
|
-
|
231
|
-
RG_TARGET_NAMESPACE = G_DEF_CLASS(GOO_TYPE_CANVAS_ITEM, "CanvasItem", mGoo);
|
232
|
-
|
233
|
-
RG_DEF_METHOD(rotate, 3);
|
234
|
-
RG_DEF_METHOD(translate, 2);
|
235
|
-
RG_DEF_METHOD(lower, 1);
|
236
|
-
RG_DEF_METHOD(raise, 1);
|
237
|
-
RG_DEF_METHOD(scale, 2);
|
238
|
-
RG_DEF_METHOD(skew_x, 3);
|
239
|
-
RG_DEF_METHOD(skew_y, 3);
|
240
|
-
RG_DEF_METHOD(set_simple_transform, 4);
|
241
|
-
RG_DEF_METHOD(animate, 8);
|
242
|
-
RG_DEF_METHOD(stop_animation, 0);
|
243
|
-
|
244
|
-
RG_DEF_METHOD(set_style, 1);
|
245
|
-
|
246
|
-
RG_DEF_METHOD(set_child_property, 3);
|
247
|
-
|
248
|
-
RG_DEF_METHOD(canvas, 0);
|
249
|
-
|
250
|
-
RG_DEF_METHOD(remove_child, 1);
|
251
|
-
|
252
|
-
RG_DEF_METHOD(x1, 0);
|
253
|
-
RG_DEF_METHOD(x2, 0);
|
254
|
-
RG_DEF_METHOD(y1, 0);
|
255
|
-
RG_DEF_METHOD(y2, 0);
|
256
|
-
|
257
|
-
/* Enums */
|
258
|
-
G_DEF_CLASS(GOO_TYPE_CANVAS_ITEM_VISIBILITY, "Visibility", RG_TARGET_NAMESPACE);
|
259
|
-
G_DEF_CONSTANTS(RG_TARGET_NAMESPACE, GOO_TYPE_CANVAS_ITEM_VISIBILITY, "GOO_CANVAS_ITEM_");
|
260
|
-
G_DEF_CLASS(GOO_TYPE_CANVAS_ANIMATE_TYPE, "AnimateType", RG_TARGET_NAMESPACE);
|
261
|
-
G_DEF_CONSTANTS(RG_TARGET_NAMESPACE, GOO_TYPE_CANVAS_ANIMATE_TYPE, "GOO_CANVAS_");
|
262
|
-
|
263
|
-
G_DEF_CLASS(GOO_TYPE_CANVAS_POINTER_EVENTS, "PointerEvents",RG_TARGET_NAMESPACE);
|
264
|
-
G_DEF_CONSTANTS(RG_TARGET_NAMESPACE, GOO_TYPE_CANVAS_POINTER_EVENTS,"GOO_CANVAS_");
|
265
|
-
}
|