1Goo::Canvas(3)        User Contributed Perl Documentation       Goo::Canvas(3)
2
3
4

NAME

6       Goo::Canvas - wrapper for GooCanvas
7

HIERARCHY

9         Glib::Object
10         +----Glib::InitiallyUnowned
11              +----Gtk2::Object
12                   +----Gtk2::Widget
13                        +----Gtk2::Container
14                             +----Goo::Canvas
15

INTERFACES

17         Glib::Object::_Unregistered::AtkImplementorIface
18         Gtk2::Buildable
19

SYNOPSIS

21           use Goo::Canvas;
22           use Gtk2 '-init';
23           use Glib qw(TRUE FALSE);
24
25           my $window = Gtk2::Window->new('toplevel');
26           $window->signal_connect('delete_event' => sub { Gtk2->main_quit; });
27           $window->set_default_size(640, 600);
28
29           my $swin = Gtk2::ScrolledWindow->new;
30           $swin->set_shadow_type('in');
31           $window->add($swin);
32
33           my $canvas = Goo::Canvas->new();
34           $canvas->set_size_request(600, 450);
35           $canvas->set_bounds(0, 0, 1000, 1000);
36           $swin->add($canvas);
37
38           my $root = $canvas->get_root_item();
39           my $rect = Goo::Canvas::Rect->new(
40               $root, 100, 100, 400, 400,
41               'line-width' => 10,
42               'radius-x' => 20,
43               'radius-y' => 10,
44               'stroke-color' => 'yellow',
45               'fill-color' => 'red'
46           );
47           $rect->signal_connect('button-press-event',
48                                 \&on_rect_button_press);
49
50           my $text = Goo::Canvas::Text->new(
51               $root, "Hello World", 300, 300, -1, 'center',
52               'font' => 'Sans 24',
53           );
54           $text->rotate(45, 300, 300);
55           $window->show_all();
56           Gtk2->main;
57
58           sub on_rect_button_press {
59               print "Rect item pressed!\n";
60               return TRUE;
61           }
62

DESCRIPTION

64       GTK+ doesn't has an built-in canvas widget. GooCanvas is wonderful.  It
65       is easy to use and has powerful and extensible methods to create items
66       in canvas. Just try it.
67
68       For more documents, please read GooCanvas Manual and the demo programs
69       provided in the source distribution in both perl-Goo::Canvas and
70       GooCanvas.
71

METHODS

73   widget = Goo::Canvas->new
74   list = $canvas->get_bounds
75   $canvas->set_bounds ($left, $top, $right, $bottom)
76       •   $left (double)
77
78       •   $top (double)
79
80       •   $right (double)
81
82       •   $bottom (double)
83
84   cairo_surface_t = $pixbuf->cairo_surface_from_pixbuf
85   $canvas->convert_from_item_space ($item, $x, $y)
86       •   $item (Goo::Canvas::Item)
87
88       •   $x (double)
89
90       •   $y (double)
91
92   $canvas->convert_from_pixels ($x, $y)
93       •   $x (double)
94
95       •   $y (double)
96
97   $canvas->convert_to_item_space ($item, $x, $y)
98       •   $item (Goo::Canvas::Item)
99
100       •   $x (double)
101
102       •   $y (double)
103
104   $canvas->convert_to_pixels ($x, $y)
105       •   $x (double)
106
107       •   $y (double)
108
109   item = $canvas->create_item ($model)
110       •   $model (Goo::Canvas::ItemModel)
111
112   $commands->create_path ($cr)
113       •   $cr (cairo_t)
114
115   double = $canvas->get_default_line_width
116   $canvas->grab_focus ($item)
117       •   $item (Goo::Canvas::Item)
118
119   item = $canvas->get_item_at ($x, $y, $is_pointer_event)
120       •   $x (double)
121
122       •   $y (double)
123
124       •   $is_pointer_event (boolean)
125
126   item = $canvas->get_item ($model)
127       •   $model (Goo::Canvas::ItemModel)
128
129   arrayref = $canvas->get_items_at ($x, $y, $is_pointer_event)
130       •   $x (double)
131
132       •   $y (double)
133
134       •   $is_pointer_event (boolean)
135
136   arrayref = $canvas->get_items_in_area ($area, $inside_area,
137       $allow_overlaps, $include_containers)
138       •   $area (GooCanvasBounds)
139
140       •   $inside_area (boolean)
141
142       •   $allow_overlaps (boolean)
143
144       •   $include_containers (boolean)
145
146   grabstatus = $canvas->keyboard_grab ($item, $owner_events, $time)
147       •   $item (Goo::Canvas::Item)
148
149       •   $owner_events (boolean)
150
151       •   $time (unsigned)
152
153   $canvas->keyboard_ungrab ($item, $time)
154       •   $item (Goo::Canvas::Item)
155
156       •   $time (unsigned)
157
158   GArray = $path_data->parse_path_data
159   grabstatus = $canvas->pointer_grab ($item, $event_mask, $cursor, $time)
160       •   $item (Goo::Canvas::Item)
161
162       •   $event_mask (Gtk2::Gdk::EventMask)
163
164       •   $cursor (Gtk2::Gdk::Cursor) the cursor to display during the grab,
165           or undef means no change
166
167       •   $time (unsigned)
168
169   $canvas->pointer_ungrab ($item, $time)
170       •   $item (Goo::Canvas::Item)
171
172       •   $time (unsigned)
173
174   $canvas->register_widget_item ($witem)
175       •   $witem (Goo::Canvas::Widget)
176
177   $canvas->render ($cr, $bounds, $scale)
178       •   $cr (cairo_t)
179
180       •   $bounds (GooCanvasBounds)
181
182       •   $scale (double)
183
184   $canvas->request_redraw ($bounds)
185       •   $bounds (GooCanvasBounds)
186
187   $canvas->request_update
188   item = $canvas->get_root_item
189   itemmodel = $canvas->get_root_item_model
190   $canvas->set_root_item_model ($model)
191       •   $model (Goo::Canvas::ItemModel)
192
193   $canvas->set_root_item ($item)
194       •   $item (Goo::Canvas::Item)
195
196   double = $canvas->get_scale
197   $canvas->set_scale ($scale)
198       •   $scale (double)
199
200   $canvas->scroll_to ($left, $top)
201       •   $left (double)
202
203       •   $top (double)
204
205   $canvas->unregister_item ($model)
206       •   $model (Goo::Canvas::ItemModel)
207
208   $canvas->unregister_widget_item ($witem)
209       •   $witem (Goo::Canvas::Widget)
210
211   $canvas->update

PROPERTIES

213       'anchor' (Gtk2::AnchorType : default "north-west" : readable /
214       writable)
215           Where to place the canvas when it is smaller than the widget's
216           allocated area
217
218       'automatic-bounds' (boolean : default false : readable / writable)
219           If the bounds are automatically calculated based on the bounds of
220           all the items in the canvas
221
222       'background-color' (string : default undef : writable)
223           The color to use for the canvas background
224
225       'background-color-rgb' (Glib::UInt : default 0 : writable)
226           The color to use for the canvas background, specified as a 24-bit
227           integer value, 0xRRGGBB
228
229       'bounds-from-origin' (boolean : default true : readable / writable)
230           If the automatic bounds are calculated from the origin
231
232       'bounds-padding' (double : default 0 : readable / writable)
233           The padding added to the automatic bounds
234
235       'clear-background' (boolean : default true : readable / writable)
236           If the background is cleared before the canvas is painted
237
238       'integer-layout' (boolean : default false : readable / writable)
239           If all item layout is done to the nearest integer
240
241       'redraw-when-scrolled' (boolean : default false : readable / writable)
242           If the canvas is completely redrawn when scrolled, to reduce the
243           flicker of static items
244
245       'resolution-x' (double : default 96 : readable / writable)
246           The horizontal resolution of the display, in dots per inch
247
248       'resolution-y' (double : default 96 : readable / writable)
249           The vertical resolution of the display, in dots per inch
250
251       'scale' (double : default 1 : readable / writable)
252           The magnification factor of the canvas
253
254       'scale-x' (double : default 1 : readable / writable)
255           The horizontal magnification factor of the canvas
256
257       'scale-y' (double : default 1 : readable / writable)
258           The vertical magnification factor of the canvas
259
260       'units' (Gtk2::Unit : default "pixel" : readable / writable)
261           The units to use for the canvas
262
263       'x1' (double : default 0 : readable / writable)
264           The x coordinate of the left edge of the canvas bounds, in canvas
265           units
266
267       'x2' (double : default 1000 : readable / writable)
268           The x coordinate of the right edge of the canvas bounds, in canvas
269           units
270
271       'y1' (double : default 0 : readable / writable)
272           The y coordinate of the top edge of the canvas bounds, in canvas
273           units
274
275       'y2' (double : default 1000 : readable / writable)
276           The y coordinate of the bottom edge of the canvas bounds, in canvas
277           units
278

SIGNALS

280       item-created (Goo::Canvas, Goo::Canvas::Item, Goo::Canvas::ItemModel)
281       set-scroll-adjustments (Goo::Canvas, Gtk2::Adjustment,
282       Gtk2::Adjustment)
283

ENUMS AND FLAGS

285   enum Gtk2::AnchorType
286       •   'center' / 'GTK_ANCHOR_CENTER'
287
288       •   'north' / 'GTK_ANCHOR_NORTH'
289
290       •   'north-west' / 'GTK_ANCHOR_NORTH_WEST'
291
292       •   'north-east' / 'GTK_ANCHOR_NORTH_EAST'
293
294       •   'south' / 'GTK_ANCHOR_SOUTH'
295
296       •   'south-west' / 'GTK_ANCHOR_SOUTH_WEST'
297
298       •   'south-east' / 'GTK_ANCHOR_SOUTH_EAST'
299
300       •   'west' / 'GTK_ANCHOR_WEST'
301
302       •   'east' / 'GTK_ANCHOR_EAST'
303
304       •   'n' / 'GTK_ANCHOR_N'
305
306       •   'nw' / 'GTK_ANCHOR_NW'
307
308       •   'ne' / 'GTK_ANCHOR_NE'
309
310       •   's' / 'GTK_ANCHOR_S'
311
312       •   'sw' / 'GTK_ANCHOR_SW'
313
314       •   'se' / 'GTK_ANCHOR_SE'
315
316       •   'w' / 'GTK_ANCHOR_W'
317
318       •   'e' / 'GTK_ANCHOR_E'
319
320   flags Gtk2::Gdk::EventMask
321       •   'exposure-mask' / 'GDK_EXPOSURE_MASK'
322
323       •   'pointer-motion-mask' / 'GDK_POINTER_MOTION_MASK'
324
325       •   'pointer-motion-hint-mask' / 'GDK_POINTER_MOTION_HINT_MASK'
326
327       •   'button-motion-mask' / 'GDK_BUTTON_MOTION_MASK'
328
329       •   'button1-motion-mask' / 'GDK_BUTTON1_MOTION_MASK'
330
331       •   'button2-motion-mask' / 'GDK_BUTTON2_MOTION_MASK'
332
333       •   'button3-motion-mask' / 'GDK_BUTTON3_MOTION_MASK'
334
335       •   'button-press-mask' / 'GDK_BUTTON_PRESS_MASK'
336
337       •   'button-release-mask' / 'GDK_BUTTON_RELEASE_MASK'
338
339       •   'key-press-mask' / 'GDK_KEY_PRESS_MASK'
340
341       •   'key-release-mask' / 'GDK_KEY_RELEASE_MASK'
342
343       •   'enter-notify-mask' / 'GDK_ENTER_NOTIFY_MASK'
344
345       •   'leave-notify-mask' / 'GDK_LEAVE_NOTIFY_MASK'
346
347       •   'focus-change-mask' / 'GDK_FOCUS_CHANGE_MASK'
348
349       •   'structure-mask' / 'GDK_STRUCTURE_MASK'
350
351       •   'property-change-mask' / 'GDK_PROPERTY_CHANGE_MASK'
352
353       •   'visibility-notify-mask' / 'GDK_VISIBILITY_NOTIFY_MASK'
354
355       •   'proximity-in-mask' / 'GDK_PROXIMITY_IN_MASK'
356
357       •   'proximity-out-mask' / 'GDK_PROXIMITY_OUT_MASK'
358
359       •   'substructure-mask' / 'GDK_SUBSTRUCTURE_MASK'
360
361       •   'scroll-mask' / 'GDK_SCROLL_MASK'
362
363       •   'all-events-mask' / 'GDK_ALL_EVENTS_MASK'
364
365   enum Gtk2::Gdk::GrabStatus
366       •   'success' / 'GDK_GRAB_SUCCESS'
367
368       •   'already-grabbed' / 'GDK_GRAB_ALREADY_GRABBED'
369
370       •   'invalid-time' / 'GDK_GRAB_INVALID_TIME'
371
372       •   'not-viewable' / 'GDK_GRAB_NOT_VIEWABLE'
373
374       •   'frozen' / 'GDK_GRAB_FROZEN'
375
376   enum Gtk2::Unit
377       •   'pixel' / 'GTK_UNIT_PIXEL'
378
379       •   'points' / 'GTK_UNIT_POINTS'
380
381       •   'inch' / 'GTK_UNIT_INCH'
382
383       •   'mm' / 'GTK_UNIT_MM'
384

SEE ALSO

386       Glib::Object, Glib::InitiallyUnowned, Gtk2::Object, Gtk2::Widget,
387       Gtk2::Container
388
390       Copyright (C) 2023 Gtk2-Perl Team
391
392
393
394perl v5.38.0                      2023-07-20                    Goo::Canvas(3)
Impressum