1GooCanvas2(3)         User Contributed Perl Documentation        GooCanvas2(3)
2
3
4

NAME

6       GooCanvas2 - Perl binding for GooCanvas2 widget using
7       Glib::Object::Introspection
8

SYNOPSIS

10               #!/usr/bin/perl -w
11               use strict;
12               use warnings;
13
14               use Gtk3 -init;
15               use GooCanvas2;
16
17               my $window = Gtk3::Window->new();
18               $window->set_default_size(640, 600);
19               $window->signal_connect('destroy' => sub {Gtk3->main_quit()});
20
21               my $scrolled_win = Gtk3::ScrolledWindow->new();
22               $scrolled_win->set_shadow_type('in');
23
24               my $canvas = GooCanvas2::Canvas->new();
25               $canvas->set_size_request(600,450);
26               $canvas->set_bounds(0,0,1000,1000);
27               $scrolled_win->add($canvas);
28
29               my $root = $canvas->get_root_item();
30
31               # Add a few simple items
32               my $rect_item = GooCanvas2::CanvasRect->new('parent' => $root,
33                                                       'x' => 100,
34                                                       'y' => 100,
35                                                       'width' => 300,
36                                                       'height' => 300,
37                                                       'line_width' => 10.0,
38                                                       'radius-x' => 20.0,
39                                                       'radius-y' => 10.0,
40                                                       'stroke-color' => 'yellow',
41                                                       'fill-color' => 'red');
42
43               my $text_item = GooCanvas2::CanvasText->new('parent' => $root,
44                                                       'text' => 'Hello World',
45                                                       'x' => 300, 'y' => 300,
46                                                       'width' => -1,
47                                                       'anchor' => 'center',
48                                                       'font' => 'Sans 24');
49               $text_item->rotate(45, 300, 300);
50
51               # Connect a signal handler for the rectangle item.
52               $rect_item->signal_connect('button_press_event' => \&on_rect_button_press);
53
54               $window->add($scrolled_win);
55               $window->show_all;
56
57               # Pass control to the Gtk3 main event loop
58               Gtk3->main();
59
60               # This handles button presses in item views.
61               #We simply output a message to the console
62               sub on_rect_button_press {
63                       my ($item, $target, $event) = @_;
64                       print "rect item received button press event \n";
65                       return 1;
66               }
67

INSTALLATION

69       You need to install the typelib file for GooCanvas-2.0. For example on
70       Debian/Ubuntu it should be necessary to install the following package:
71
72               sudo apt-get install gir1.2-goocanvas-2.0
73
74       On Mageia for example you have to install:
75
76               urpmi lib64goocanvas-gir2.0
77

DESCRIPTION

79       GooCanvas2 is a new canvas widget for use with Gtk3 that uses the Cairo
80       2d library for drawing. This is a simple and basic implementation of
81       this wonderful Canvas widget.
82
83       For more informations see
84       <https://wiki.gnome.org/action/show/Projects/GooCanvas>
85
86       For instructions, how to use GooCanvas2, please study the API reference
87       at <https://developer.gnome.org/goocanvas/unstable/> for now. A perl-
88       specific documentation will perhaps come in later versions. But
89       applying the C documentation should be no problem.
90
91   OBJECTS, ITEMS, MODELS
92       The GooCanvas2 module provides the following objects, items and models.
93       For more details see
94       <https://wiki.gnome.org/action/show/Projects/GooCanvas>.
95
96       Core Objects
97
98       •   GooCanvas2::Canvas - the main canvas widget
99
100       •   GooCanvas2::CanvasItem - the interface for canvas items
101
102       •   GooCanvas2::CanvasItemModel - the interface for canvas item models.
103
104       •   GooCanvas2::CanvasItemSimple - the base class for the standard
105           canvas items.
106
107       •   GooCanvas2::CanvasItemModelSimple - the base class for the standard
108           canvas item models.
109
110       •   GooCanvas2::CanvasStyle - support for cascading style properties
111           for canvas items.
112
113       Standard Canvas Items
114
115       •   GooCanvas2::CanvasGroup - a group of items.
116
117       •   GooCanvas2::CanvasEllipse - an ellipse item.
118
119       •   GooCanvas2::CanvasGrid - a grid item.
120
121       •   GooCanvas2::CanvasImage - an image item.
122
123       •   GooCanvas2::CanvasPath - a path item (a series of lines and
124           curves).
125
126       •   GooCanvas2::CanvasPolyline - a polyline item (a series of lines
127           with optional arrows).
128
129       •   GooCanvas2::CanvasRect - a rectangle item.
130
131       •   GooCanvas2::CanvasText - a text item.
132
133       •   GooCanvas2::CanvasWidget - an embedded widget item.
134
135       •   GooCanvas2::CanvasTable - a table container to layout items.
136
137       Standard Canvas Item Models
138
139       •   GooCanvas2::CanvasGroupModel - a model for a group of items.
140
141       •   GooCanvas2::CanvasEllipseModel - a model for ellipse items.
142
143       •   GooCanvas2::CanvasGridModel - a model for grid items.
144
145       •   GooCanvas2::CanvasImageModel - a model for image items.
146
147       •   GooCanvas2::CanvasPathModel - a model for path items (a series of
148           lines and curves).
149
150       •   GooCanvas2::CanvasPolylineModel - a model for polyline items (a
151           series of lines with optional arrows).
152
153       •   GooCanvas2::CanvasRectModel - a model for rectangle items.
154
155       •   GooCanvas2::CanvasTextModel - a model for text items.
156
157       •   GooCanvas2::CanvasTableModel - a model for a table container to
158           layout items.
159
160   Development status and informations
161       Customizations and overrides
162
163       In order to make things more Perlish, GooCanvas2 customizes the API
164       generated by Glib::Object::Introspection in a few spots:
165
166       •   The array ref normally returned by the following functions is
167           flattened into a list:
168
169           GooCanvas2::Canvas::get_items_at
170           GooCanvas2::Canvas::get_items_in_area
171           GooCanvas2::CanvasItem::get_items_at
172           GooCanvas2::CanvasItem::class_list_child_properties
173           GooCanvas2::CanvasItemModell::class_list_child_properties
174

SEE ALSO

176       •   GooCanvas Homepage at
177           <https://wiki.gnome.org/action/show/Projects/GooCanvas>
178
179       •   GooCanvas2 API Reference
180           <https://developer.gnome.org/goocanvas/unstable/>
181
182       •   Gtk3
183
184       •   Glib::Object::Introspection
185

AUTHOR

187       Maximilian Lika, <Maximilian-Lika@gmx.de>
188
190       Copyright (C) 2017 by Maximilian Lika
191
192       This library is free software; you can redistribute it and/or modify it
193       under the same terms as Perl itself, either Perl version 5.22.3 or, at
194       your option, any later version of Perl 5 you may have available.
195
196
197
198perl v5.38.0                      2023-07-20                     GooCanvas2(3)
Impressum