goocanvas 1.2.4 → 1.2.5
Sign up to get free protection for your applications and to get access to all the features.
- data/sample/simple-demo.rb +48 -11
- metadata +4 -4
data/sample/simple-demo.rb
CHANGED
@@ -1,14 +1,38 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
-
|
2
|
+
#
|
3
|
+
# This sample code is a port of
|
4
|
+
# goocanvas/demo/simple-demo.c. It is licensed
|
5
|
+
# under the terms of the GNU Library General Public License, version
|
6
|
+
# 2 or (at your option) later.
|
7
|
+
#
|
8
|
+
# Copyright (C) 2013 Ruby-GNOME2 Project Team
|
9
|
+
#
|
10
|
+
# This library is free software; you can redistribute it and/or
|
11
|
+
# modify it under the terms of the GNU Lesser General Public
|
12
|
+
# License as published by the Free Software Foundation; either
|
13
|
+
# version 2.1 of the License, or (at your option) any later version.
|
14
|
+
#
|
15
|
+
# This library is distributed in the hope that it will be useful,
|
16
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
17
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
18
|
+
# Lesser General Public License for more details.
|
19
|
+
#
|
20
|
+
# You should have received a copy of the GNU Lesser General Public
|
21
|
+
# License along with this library; if not, write to the Free Software
|
22
|
+
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
23
|
+
|
24
|
+
require 'goocanvas-gi'
|
25
|
+
|
26
|
+
Goo.init
|
3
27
|
|
4
28
|
# Create the window and widgets.
|
5
|
-
window = Gtk::Window.new(
|
29
|
+
window = Gtk::Window.new(:toplevel)
|
6
30
|
window.set_default_size(640, 600)
|
7
31
|
window.show
|
8
32
|
window.signal_connect('delete_event') { Gtk.main_quit }
|
9
33
|
|
10
34
|
scrolled_win = Gtk::ScrolledWindow.new
|
11
|
-
scrolled_win.shadow_type =
|
35
|
+
scrolled_win.shadow_type = :in
|
12
36
|
scrolled_win.show
|
13
37
|
window.add(scrolled_win)
|
14
38
|
|
@@ -20,15 +44,28 @@ scrolled_win.add(canvas)
|
|
20
44
|
|
21
45
|
root = canvas.root_item
|
22
46
|
|
23
|
-
rect_item = Goo::CanvasRect.new(root,
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
47
|
+
rect_item = Goo::CanvasRect.new(:parent => root,
|
48
|
+
:x => 100,
|
49
|
+
:y => 100,
|
50
|
+
:width => 400,
|
51
|
+
:height => 400,
|
52
|
+
:line_width => 10.0,
|
53
|
+
:radius_x => 20.0,
|
54
|
+
:radius_y => 10.0,
|
55
|
+
:stroke_color => 'yellow',
|
56
|
+
:fill_color => 'red')
|
57
|
+
|
58
|
+
rect_item.signal_connect('button_press_event') do
|
59
|
+
puts("rect item received button press event")
|
60
|
+
end
|
30
61
|
|
31
|
-
text_item = Goo::CanvasText.new(
|
62
|
+
text_item = Goo::CanvasText.new(:parent => root,
|
63
|
+
:text => 'Hello World',
|
64
|
+
:x => 300,
|
65
|
+
:y => 300,
|
66
|
+
:width => -1,
|
67
|
+
:anchor => :center,
|
68
|
+
:font => 'Sans 24')
|
32
69
|
|
33
70
|
text_item.rotate(45, 300, 300)
|
34
71
|
|
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: 1.2.
|
4
|
+
version: 1.2.5
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-03-
|
12
|
+
date: 2013-03-27 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: gtk2
|
@@ -18,7 +18,7 @@ dependencies:
|
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version: 1.2.
|
21
|
+
version: 1.2.5
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
24
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -26,7 +26,7 @@ dependencies:
|
|
26
26
|
requirements:
|
27
27
|
- - ! '>='
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
version: 1.2.
|
29
|
+
version: 1.2.5
|
30
30
|
description: Ruby/GooCanvas is a Ruby binding of GooCanvas.
|
31
31
|
email: ruby-gnome2-devel-en@lists.sourceforge.net
|
32
32
|
executables: []
|