table of contents
Goo::Canvas(3) | User Contributed Perl Documentation | Goo::Canvas(3) |
NAME¶
Goo::Canvas - wrapper for GooCanvas
HIERARCHY¶
Glib::Object +----Glib::InitiallyUnowned +----Gtk2::Object +----Gtk2::Widget +----Gtk2::Container +----Goo::Canvas
INTERFACES¶
Glib::Object::_Unregistered::AtkImplementorIface Gtk2::Buildable
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; }
DESCRIPTION¶
GTK+ doesn't have a built-in canvas widget. GooCanvas is wonderful. It is easy to use and has powerful and extensible methods to create items in a canvas. Just try it.
For more documentation, please read the GooCanvas Manual and the demo programs provided in the source distribution in both perl-Goo::Canvas and GooCanvas.
METHODS¶
widget = Goo::Canvas->new¶
list = $canvas->get_bounds¶
$canvas->set_bounds ($left, $top, $right, $bottom)¶
- $left (double)
- $top (double)
- $right (double)
- $bottom (double)
cairo_surface_t = $pixbuf->cairo_surface_from_pixbuf¶
$canvas->convert_from_item_space ($item, $x, $y)¶
- $item (Goo::Canvas::Item)
- $x (double)
- $y (double)
$canvas->convert_from_pixels ($x, $y)¶
- $x (double)
- $y (double)
$canvas->convert_to_item_space ($item, $x, $y)¶
- $item (Goo::Canvas::Item)
- $x (double)
- $y (double)
$canvas->convert_to_pixels ($x, $y)¶
- $x (double)
- $y (double)
item = $canvas->create_item ($model)¶
- •
- $model (Goo::Canvas::ItemModel)
$commands->create_path ($cr)¶
- •
- $cr (cairo_t)
double = $canvas->get_default_line_width¶
$canvas->grab_focus ($item)¶
- •
- $item (Goo::Canvas::Item)
item = $canvas->get_item_at ($x, $y, $is_pointer_event)¶
- $x (double)
- $y (double)
- $is_pointer_event (boolean)
item = $canvas->get_item ($model)¶
- •
- $model (Goo::Canvas::ItemModel)
arrayref = $canvas->get_items_at ($x, $y, $is_pointer_event)¶
- $x (double)
- $y (double)
- $is_pointer_event (boolean)
arrayref = $canvas->get_items_in_area ($area, $inside_area, $allow_overlaps, $include_containers)¶
- $area (GooCanvasBounds)
- $inside_area (boolean)
- $allow_overlaps (boolean)
- $include_containers (boolean)
grabstatus = $canvas->keyboard_grab ($item, $owner_events, $time)¶
- $item (Goo::Canvas::Item)
- $owner_events (boolean)
- $time (unsigned)
$canvas->keyboard_ungrab ($item, $time)¶
- $item (Goo::Canvas::Item)
- $time (unsigned)
GArray = $path_data->parse_path_data¶
grabstatus = $canvas->pointer_grab ($item, $event_mask, $cursor, $time)¶
- $item (Goo::Canvas::Item)
- $event_mask (Gtk2::Gdk::EventMask)
- $cursor (Gtk2::Gdk::Cursor) the cursor to display during the grab; undef means no change
- $time (unsigned)
$canvas->pointer_ungrab ($item, $time)¶
- $item (Goo::Canvas::Item)
- $time (unsigned)
$canvas->register_widget_item ($witem)¶
- •
- $witem (Goo::Canvas::Widget)
$canvas->render ($cr, $bounds, $scale)¶
- $cr (cairo_t)
- $bounds (GooCanvasBounds)
- $scale (double)
$canvas->request_redraw ($bounds)¶
- •
- $bounds (GooCanvasBounds)
$canvas->request_update¶
item = $canvas->get_root_item¶
itemmodel = $canvas->get_root_item_model¶
$canvas->set_root_item_model ($model)¶
- •
- $model (Goo::Canvas::ItemModel)
$canvas->set_root_item ($item)¶
- •
- $item (Goo::Canvas::Item)
double = $canvas->get_scale¶
$canvas->set_scale ($scale)¶
- •
- $scale (double)
$canvas->scroll_to ($left, $top)¶
- $left (double)
- $top (double)
$canvas->unregister_item ($model)¶
- •
- $model (Goo::Canvas::ItemModel)
$canvas->unregister_widget_item ($witem)¶
- •
- $witem (Goo::Canvas::Widget)
$canvas->update¶
PROPERTIES¶
- 'anchor' (Gtk2::AnchorType : default "north-west" : readable / writable)
- Where to place the canvas when it is smaller than the widget's allocated area
- 'automatic-bounds' (boolean : default false : readable / writable)
- If the bounds are automatically calculated based on the bounds of all the items in the canvas
- 'background-color' (string : default undef : writable)
- The color to use for the canvas background
- 'background-color-rgb' (Glib::UInt : default 0 : writable)
- The color to use for the canvas background, specified as a 24-bit integer value, 0xRRGGBB
- 'bounds-from-origin' (boolean : default true : readable / writable)
- If the automatic bounds are calculated from the origin
- 'bounds-padding' (double : default 0 : readable / writable)
- The padding added to the automatic bounds
- 'clear-background' (boolean : default true : readable / writable)
- If the background is cleared before the canvas is painted
- 'integer-layout' (boolean : default false : readable / writable)
- If all item layout is done to the nearest integer
- 'redraw-when-scrolled' (boolean : default false : readable / writable)
- If the canvas is completely redrawn when scrolled, to reduce the flicker of static items
- 'resolution-x' (double : default 96 : readable / writable)
- The horizontal resolution of the display, in dots per inch
- 'resolution-y' (double : default 96 : readable / writable)
- The vertical resolution of the display, in dots per inch
- 'scale' (double : default 1 : readable / writable)
- The magnification factor of the canvas
- 'scale-x' (double : default 1 : readable / writable)
- The horizontal magnification factor of the canvas
- 'scale-y' (double : default 1 : readable / writable)
- The vertical magnification factor of the canvas
- 'units' (Gtk2::Unit : default "pixel" : readable / writable)
- The units to use for the canvas
- 'x1' (double : default 0 : readable / writable)
- The x coordinate of the left edge of the canvas bounds, in canvas units
- 'x2' (double : default 1000 : readable / writable)
- The x coordinate of the right edge of the canvas bounds, in canvas units
- 'y1' (double : default 0 : readable / writable)
- The y coordinate of the top edge of the canvas bounds, in canvas units
- 'y2' (double : default 1000 : readable / writable)
- The y coordinate of the bottom edge of the canvas bounds, in canvas units
SIGNALS¶
ENUMS AND FLAGS¶
enum Gtk2::AnchorType¶
- 'center' / 'GTK_ANCHOR_CENTER'
- 'north' / 'GTK_ANCHOR_NORTH'
- 'north-west' / 'GTK_ANCHOR_NORTH_WEST'
- 'north-east' / 'GTK_ANCHOR_NORTH_EAST'
- 'south' / 'GTK_ANCHOR_SOUTH'
- 'south-west' / 'GTK_ANCHOR_SOUTH_WEST'
- 'south-east' / 'GTK_ANCHOR_SOUTH_EAST'
- 'west' / 'GTK_ANCHOR_WEST'
- 'east' / 'GTK_ANCHOR_EAST'
- 'n' / 'GTK_ANCHOR_N'
- 'nw' / 'GTK_ANCHOR_NW'
- 'ne' / 'GTK_ANCHOR_NE'
- 's' / 'GTK_ANCHOR_S'
- 'sw' / 'GTK_ANCHOR_SW'
- 'se' / 'GTK_ANCHOR_SE'
- 'w' / 'GTK_ANCHOR_W'
- 'e' / 'GTK_ANCHOR_E'
flags Gtk2::Gdk::EventMask¶
- 'exposure-mask' / 'GDK_EXPOSURE_MASK'
- 'pointer-motion-mask' / 'GDK_POINTER_MOTION_MASK'
- 'pointer-motion-hint-mask' / 'GDK_POINTER_MOTION_HINT_MASK'
- 'button-motion-mask' / 'GDK_BUTTON_MOTION_MASK'
- 'button1-motion-mask' / 'GDK_BUTTON1_MOTION_MASK'
- 'button2-motion-mask' / 'GDK_BUTTON2_MOTION_MASK'
- 'button3-motion-mask' / 'GDK_BUTTON3_MOTION_MASK'
- 'button-press-mask' / 'GDK_BUTTON_PRESS_MASK'
- 'button-release-mask' / 'GDK_BUTTON_RELEASE_MASK'
- 'key-press-mask' / 'GDK_KEY_PRESS_MASK'
- 'key-release-mask' / 'GDK_KEY_RELEASE_MASK'
- 'enter-notify-mask' / 'GDK_ENTER_NOTIFY_MASK'
- 'leave-notify-mask' / 'GDK_LEAVE_NOTIFY_MASK'
- 'focus-change-mask' / 'GDK_FOCUS_CHANGE_MASK'
- 'structure-mask' / 'GDK_STRUCTURE_MASK'
- 'property-change-mask' / 'GDK_PROPERTY_CHANGE_MASK'
- 'visibility-notify-mask' / 'GDK_VISIBILITY_NOTIFY_MASK'
- 'proximity-in-mask' / 'GDK_PROXIMITY_IN_MASK'
- 'proximity-out-mask' / 'GDK_PROXIMITY_OUT_MASK'
- 'substructure-mask' / 'GDK_SUBSTRUCTURE_MASK'
- 'scroll-mask' / 'GDK_SCROLL_MASK'
- 'all-events-mask' / 'GDK_ALL_EVENTS_MASK'
enum Gtk2::Gdk::GrabStatus¶
- 'success' / 'GDK_GRAB_SUCCESS'
- 'already-grabbed' / 'GDK_GRAB_ALREADY_GRABBED'
- 'invalid-time' / 'GDK_GRAB_INVALID_TIME'
- 'not-viewable' / 'GDK_GRAB_NOT_VIEWABLE'
- 'frozen' / 'GDK_GRAB_FROZEN'
enum Gtk2::Unit¶
- 'pixel' / 'GTK_UNIT_PIXEL'
- 'points' / 'GTK_UNIT_POINTS'
- 'inch' / 'GTK_UNIT_INCH'
- 'mm' / 'GTK_UNIT_MM'
SEE ALSO¶
Glib::Object, Glib::InitiallyUnowned, Gtk2::Object, Gtk2::Widget, Gtk2::Container
COPYRIGHT¶
Copyright (C) 2013 Gtk2-Perl Team
2013-03-06 | perl v5.26.1 |