=head1 NAME

Goo::Canvas - wrapper for GooCanvas

=cut

=head1 HIERARCHY

  Glib::Object
  +----Glib::InitiallyUnowned
       +----Gtk2::Object
            +----Gtk2::Widget
                 +----Gtk2::Container
                      +----Goo::Canvas



=cut

=head1 INTERFACES

  Glib::Object::_Unregistered::AtkImplementorIface
  Gtk2::Buildable



=cut

=head1 SYNOPSIS

    use Goo::Canvas;
    use Gtk2 '-init';
    use Glib qw(TRUE FALSE);

    my $window = Gtk2::Window->new('toplevel');
    $window->signal_connect('delete_event' => sub { Gtk2->main_quit; });
    $window->set_default_size(640, 600);

    my $swin = Gtk2::ScrolledWindow->new;
    $swin->set_shadow_type('in');
    $window->add($swin);

    my $canvas = Goo::Canvas->new();
    $canvas->set_size_request(600, 450);
    $canvas->set_bounds(0, 0, 1000, 1000);
    $swin->add($canvas);

    my $root = $canvas->get_root_item();
    my $rect = Goo::Canvas::Rect->new(
        $root, 100, 100, 400, 400,
        'line-width' => 10,
        'radius-x' => 20,
        'radius-y' => 10,
        'stroke-color' => 'yellow',
        'fill-color' => 'red'
    );
    $rect->signal_connect('button-press-event',
                          \&on_rect_button_press);

    my $text = Goo::Canvas::Text->new(
        $root, "Hello World", 300, 300, -1, 'center',
        'font' => 'Sans 24',
    );
    $text->rotate(45, 300, 300);
    $window->show_all();
    Gtk2->main;

    sub on_rect_button_press {
        print "Rect item pressed!\n";
        return TRUE;
    }

=head1 DESCRIPTION

GTK+ doesn't has an built-in canvas widget. GooCanvas is wonderful.
It is easy to use and has powerful and extensible methods to create items
in canvas. Just try it.

For more documents, please read GooCanvas Manual and the demo programs
provided in the source distribution in both perl-Goo::Canvas and
GooCanvas.

=cut




=head1 METHODS

=head2 widget = Goo::Canvas-E<gt>B<new> 

=head2 list = $canvas-E<gt>B<get_bounds> 

=head2 $canvas-E<gt>B<set_bounds> ($left, $top, $right, $bottom)

=over

=item * $left (double) 

=item * $top (double) 

=item * $right (double) 

=item * $bottom (double) 

=back

=head2 cairo_surface_t = $pixbuf-E<gt>B<cairo_surface_from_pixbuf> 

=head2 $canvas-E<gt>B<convert_from_item_space> ($item, $x, $y)

=over

=item * $item (Goo::Canvas::Item) 

=item * $x (double) 

=item * $y (double) 

=back

=head2 $canvas-E<gt>B<convert_from_pixels> ($x, $y)

=over

=item * $x (double) 

=item * $y (double) 

=back

=head2 $canvas-E<gt>B<convert_to_item_space> ($item, $x, $y)

=over

=item * $item (Goo::Canvas::Item) 

=item * $x (double) 

=item * $y (double) 

=back

=head2 $canvas-E<gt>B<convert_to_pixels> ($x, $y)

=over

=item * $x (double) 

=item * $y (double) 

=back

=head2 item = $canvas-E<gt>B<create_item> ($model)

=over

=item * $model (Goo::Canvas::ItemModel) 

=back

=head2 $commands-E<gt>B<create_path> ($cr)

=over

=item * $cr (cairo_t) 

=back

=head2 double = $canvas-E<gt>B<get_default_line_width> 

=head2 $canvas-E<gt>B<grab_focus> ($item)

=over

=item * $item (Goo::Canvas::Item) 

=back

=head2 item = $canvas-E<gt>B<get_item_at> ($x, $y, $is_pointer_event)

=over

=item * $x (double) 

=item * $y (double) 

=item * $is_pointer_event (boolean) 

=back

=head2 item = $canvas-E<gt>B<get_item> ($model)

=over

=item * $model (Goo::Canvas::ItemModel) 

=back

=head2 arrayref = $canvas-E<gt>B<get_items_at> ($x, $y, $is_pointer_event)

=over

=item * $x (double) 

=item * $y (double) 

=item * $is_pointer_event (boolean) 

=back

=head2 arrayref = $canvas-E<gt>B<get_items_in_area> ($area, $inside_area, $allow_overlaps, $include_containers)

=over

=item * $area (GooCanvasBounds) 

=item * $inside_area (boolean) 

=item * $allow_overlaps (boolean) 

=item * $include_containers (boolean) 

=back

=head2 grabstatus = $canvas-E<gt>B<keyboard_grab> ($item, $owner_events, $time)

=over

=item * $item (Goo::Canvas::Item) 

=item * $owner_events (boolean) 

=item * $time (unsigned) 

=back

=head2 $canvas-E<gt>B<keyboard_ungrab> ($item, $time)

=over

=item * $item (Goo::Canvas::Item) 

=item * $time (unsigned) 

=back

=head2 GArray = $path_data-E<gt>B<parse_path_data> 

=head2 grabstatus = $canvas-E<gt>B<pointer_grab> ($item, $event_mask, $cursor, $time)

=over

=item * $item (Goo::Canvas::Item) 

=item * $event_mask (Gtk2::Gdk::EventMask) 

=item * $cursor (Gtk2::Gdk::Cursor) the cursor to display during the grab, or undef means no change

=item * $time (unsigned) 

=back



=head2 $canvas-E<gt>B<pointer_ungrab> ($item, $time)

=over

=item * $item (Goo::Canvas::Item) 

=item * $time (unsigned) 

=back

=head2 $canvas-E<gt>B<register_widget_item> ($witem)

=over

=item * $witem (Goo::Canvas::Widget) 

=back

=head2 $canvas-E<gt>B<render> ($cr, $bounds, $scale)

=over

=item * $cr (cairo_t) 

=item * $bounds (GooCanvasBounds) 

=item * $scale (double) 

=back

=head2 $canvas-E<gt>B<request_redraw> ($bounds)

=over

=item * $bounds (GooCanvasBounds) 

=back

=head2 $canvas-E<gt>B<request_update> 

=head2 item = $canvas-E<gt>B<get_root_item> 

=head2 itemmodel = $canvas-E<gt>B<get_root_item_model> 

=head2 $canvas-E<gt>B<set_root_item_model> ($model)

=over

=item * $model (Goo::Canvas::ItemModel) 

=back

=head2 $canvas-E<gt>B<set_root_item> ($item)

=over

=item * $item (Goo::Canvas::Item) 

=back

=head2 double = $canvas-E<gt>B<get_scale> 

=head2 $canvas-E<gt>B<set_scale> ($scale)

=over

=item * $scale (double) 

=back

=head2 $canvas-E<gt>B<scroll_to> ($left, $top)

=over

=item * $left (double) 

=item * $top (double) 

=back

=head2 $canvas-E<gt>B<unregister_item> ($model)

=over

=item * $model (Goo::Canvas::ItemModel) 

=back

=head2 $canvas-E<gt>B<unregister_widget_item> ($witem)

=over

=item * $witem (Goo::Canvas::Widget) 

=back

=head2 $canvas-E<gt>B<update> 



=cut


=head1 PROPERTIES

=over

=item 'anchor' (Gtk2::AnchorType : default "north-west" : readable / writable)

Where to place the canvas when it is smaller than the widget's allocated area

=item 'automatic-bounds' (boolean : default false : readable / writable)

If the bounds are automatically calculated based on the bounds of all the items in the canvas

=item 'background-color' (string : default undef : writable)

The color to use for the canvas background

=item 'background-color-rgb' (Glib::UInt : default 0 : writable)

The color to use for the canvas background, specified as a 24-bit integer value, 0xRRGGBB

=item 'bounds-from-origin' (boolean : default true : readable / writable)

If the automatic bounds are calculated from the origin

=item 'bounds-padding' (double : default 0 : readable / writable)

The padding added to the automatic bounds

=item 'clear-background' (boolean : default true : readable / writable)

If the background is cleared before the canvas is painted

=item 'integer-layout' (boolean : default false : readable / writable)

If all item layout is done to the nearest integer

=item 'redraw-when-scrolled' (boolean : default false : readable / writable)

If the canvas is completely redrawn when scrolled, to reduce the flicker of static items

=item 'resolution-x' (double : default 96 : readable / writable)

The horizontal resolution of the display, in dots per inch

=item 'resolution-y' (double : default 96 : readable / writable)

The vertical resolution of the display, in dots per inch

=item 'scale' (double : default 1 : readable / writable)

The magnification factor of the canvas

=item 'scale-x' (double : default 1 : readable / writable)

The horizontal magnification factor of the canvas

=item 'scale-y' (double : default 1 : readable / writable)

The vertical magnification factor of the canvas

=item 'units' (Gtk2::Unit : default "pixel" : readable / writable)

The units to use for the canvas

=item 'x1' (double : default 0 : readable / writable)

The x coordinate of the left edge of the canvas bounds, in canvas units

=item 'x2' (double : default 1000 : readable / writable)

The x coordinate of the right edge of the canvas bounds, in canvas units

=item 'y1' (double : default 0 : readable / writable)

The y coordinate of the top edge of the canvas bounds, in canvas units

=item 'y2' (double : default 1000 : readable / writable)

The y coordinate of the bottom edge of the canvas bounds, in canvas units

=back



=cut


=head1 SIGNALS

=over

=item B<item-created> (Goo::Canvas, Goo::Canvas::Item, Goo::Canvas::ItemModel)

=item B<set-scroll-adjustments> (Goo::Canvas, Gtk2::Adjustment, Gtk2::Adjustment)

=back



=cut


=head1 ENUMS AND FLAGS

=head2 enum Gtk2::AnchorType

=over

=item * 'center' / 'GTK_ANCHOR_CENTER'

=item * 'north' / 'GTK_ANCHOR_NORTH'

=item * 'north-west' / 'GTK_ANCHOR_NORTH_WEST'

=item * 'north-east' / 'GTK_ANCHOR_NORTH_EAST'

=item * 'south' / 'GTK_ANCHOR_SOUTH'

=item * 'south-west' / 'GTK_ANCHOR_SOUTH_WEST'

=item * 'south-east' / 'GTK_ANCHOR_SOUTH_EAST'

=item * 'west' / 'GTK_ANCHOR_WEST'

=item * 'east' / 'GTK_ANCHOR_EAST'

=item * 'n' / 'GTK_ANCHOR_N'

=item * 'nw' / 'GTK_ANCHOR_NW'

=item * 'ne' / 'GTK_ANCHOR_NE'

=item * 's' / 'GTK_ANCHOR_S'

=item * 'sw' / 'GTK_ANCHOR_SW'

=item * 'se' / 'GTK_ANCHOR_SE'

=item * 'w' / 'GTK_ANCHOR_W'

=item * 'e' / 'GTK_ANCHOR_E'

=back


=head2 flags Gtk2::Gdk::EventMask

=over

=item * 'exposure-mask' / 'GDK_EXPOSURE_MASK'

=item * 'pointer-motion-mask' / 'GDK_POINTER_MOTION_MASK'

=item * 'pointer-motion-hint-mask' / 'GDK_POINTER_MOTION_HINT_MASK'

=item * 'button-motion-mask' / 'GDK_BUTTON_MOTION_MASK'

=item * 'button1-motion-mask' / 'GDK_BUTTON1_MOTION_MASK'

=item * 'button2-motion-mask' / 'GDK_BUTTON2_MOTION_MASK'

=item * 'button3-motion-mask' / 'GDK_BUTTON3_MOTION_MASK'

=item * 'button-press-mask' / 'GDK_BUTTON_PRESS_MASK'

=item * 'button-release-mask' / 'GDK_BUTTON_RELEASE_MASK'

=item * 'key-press-mask' / 'GDK_KEY_PRESS_MASK'

=item * 'key-release-mask' / 'GDK_KEY_RELEASE_MASK'

=item * 'enter-notify-mask' / 'GDK_ENTER_NOTIFY_MASK'

=item * 'leave-notify-mask' / 'GDK_LEAVE_NOTIFY_MASK'

=item * 'focus-change-mask' / 'GDK_FOCUS_CHANGE_MASK'

=item * 'structure-mask' / 'GDK_STRUCTURE_MASK'

=item * 'property-change-mask' / 'GDK_PROPERTY_CHANGE_MASK'

=item * 'visibility-notify-mask' / 'GDK_VISIBILITY_NOTIFY_MASK'

=item * 'proximity-in-mask' / 'GDK_PROXIMITY_IN_MASK'

=item * 'proximity-out-mask' / 'GDK_PROXIMITY_OUT_MASK'

=item * 'substructure-mask' / 'GDK_SUBSTRUCTURE_MASK'

=item * 'scroll-mask' / 'GDK_SCROLL_MASK'

=item * 'all-events-mask' / 'GDK_ALL_EVENTS_MASK'

=back


=head2 enum Gtk2::Gdk::GrabStatus

=over

=item * 'success' / 'GDK_GRAB_SUCCESS'

=item * 'already-grabbed' / 'GDK_GRAB_ALREADY_GRABBED'

=item * 'invalid-time' / 'GDK_GRAB_INVALID_TIME'

=item * 'not-viewable' / 'GDK_GRAB_NOT_VIEWABLE'

=item * 'frozen' / 'GDK_GRAB_FROZEN'

=back


=head2 enum Gtk2::Unit

=over

=item * 'pixel' / 'GTK_UNIT_PIXEL'

=item * 'points' / 'GTK_UNIT_POINTS'

=item * 'inch' / 'GTK_UNIT_INCH'

=item * 'mm' / 'GTK_UNIT_MM'

=back




=cut


=head1 SEE ALSO

L<Glib::Object>, L<Glib::InitiallyUnowned>, L<Gtk2::Object>, L<Gtk2::Widget>, L<Gtk2::Container>


=cut


=head1 COPYRIGHT


Copyright (C) 2017 Gtk2-Perl Team




=cut

