goocanvasmm: Goocanvas::Canvas Class Reference

# Goocanvas::Canvas Class Reference

The main canvas widget, containing a number of canvas items. More...

Inheritance diagram for Goocanvas::Canvas:
[legend]

List of all members.

## Public Member Functions
virtual | ~Canvas ()
GooCanvas* | gobj ()
| Provides access to the underlying C GtkObject.
const GooCanvas* | gobj () const
| Provides access to the underlying C GtkObject.
| Canvas ()
Glib::RefPtr< Item > | get_root_item ()
| Gets the root item of the canvas, usually a Goo::CanvasGroup.
Glib::RefPtr< const Item > | get_root_item () const
| Gets the root item of the canvas, usually a Goo::CanvasGroup.
void | set_root_item (const Glib::RefPtr< Item >& item)
| Sets the root item of the canvas.
Glib::RefPtr< ItemModel > | get_root_item_model ()
| Gets the root item model of the canvas.
Glib::RefPtr< const ItemModel > | get_root_item_model () const
| Gets the root item model of the canvas.
void | set_root_item_model (const Glib::RefPtr< ItemModel >& model)
| Sets the root item model of the canvas.
Glib::RefPtr< Item > | get_static_root_item ()
Glib::RefPtr< const Item > | get_static_root_item () const
void | set_static_root_item (const Glib::RefPtr< Item >& item)
Glib::RefPtr< ItemModel > | get_static_root_item_model ()
Glib::RefPtr< const ItemModel > | get_static_root_item_model () const
void | set_static_root_item_model (const Glib::RefPtr< ItemModel >& model)
Glib::RefPtr< Item > | get_item (const Glib::RefPtr< ItemModel >& model)
| Gets the canvas item associated with the given Goo::CanvasItemModel.
Glib::RefPtr< const Item > | get_item (const Glib::RefPtr< ItemModel >& model) const
| Gets the canvas item associated with the given Goo::CanvasItemModel.
Glib::RefPtr< Item > | get_item_at (double x, double y, bool is_pointer_event)
| Gets the item at the given point.
Glib::RefPtr< const Item > | get_item_at (double x, double y, bool is_pointer_event) const
| Gets the item at the given point.
Glib::ListHandle< Glib::RefPtr < Item > > | get_items_at (double x, double y, bool is_pointer_event)
| Gets all items at the given point.
Glib::ListHandle< Glib::RefPtr < const Item > > | get_items_at (double x, double y, bool is_pointer_event) const
| Gets all items at the given point.
Glib::ListHandle< Glib::RefPtr < Item > > | get_items_in_area (const Bounds& area, bool inside_area, bool allow_overlaps, bool include_containers)
| Gets a list of items inside or outside a given area.
Glib::ListHandle< Glib::RefPtr < const Item > > | get_items_in_area (const Bounds& area, bool inside_area, bool allow_overlaps, bool include_containers) const
| Gets a list of items inside or outside a given area.
double | get_scale () const
| Gets the current scale of the canvas.
void | set_scale (double scale)
| Sets the scale of the canvas.
void | get_bounds (double& left, double& top, double& right, double& bottom) const
| Gets the bounds of the canvas, in canvas units.
void | get_bounds (Bounds& bounds) const
void | set_bounds (double left, double top, double right, double bottom)
| Sets the bounds of the Goo::Canvas, in canvas units.
void | set_bounds (const Bounds& bounds)
void | scroll_to (double left, double top)
| Scrolls the canvas, placing the given point as close to the top-left of the view as possible.
void | grab_focus (const Glib::RefPtr< Item >& item)
| Grabs the keyboard focus for the given item.
void | render (const Cairo::RefPtr< Cairo::Context >& context, const Bounds& bounds, double scale=0.0)
| Renders all or part of a canvas to the given cairo context.
void | render (const Cairo::RefPtr< Cairo::Context >& context, double scale=0.0)
void | convert_to_pixels (double& x, double& y) const
| Converts a coordinate from the canvas coordinate space to pixels.
void | convert_from_pixels (double& x, double& y) const
| Converts a coordinate from pixels to the canvas coordinate space.
void | convert_to_item_space (const Glib::RefPtr< Item >& item, double& x, double& y) const
| Converts a coordinate from the canvas coordinate space to the given item's coordinate space, applying all transformation matrices including the item's own transformation matrix, if it has one.
void | convert_from_item_space (const Glib::RefPtr< Item >& item, double& x, double& y) const
| Converts a coordinate from the given item's coordinate space to the canvas coordinate space, applying all transformation matrices including the item's own transformation matrix, if it has one.
void | convert_bounds_to_item_space (const Glib::RefPtr< Item >& item, Bounds& bounds) const
Gdk::GrabStatus | pointer_grab (const Glib::RefPtr< Item >& item, Gdk::EventMask mask, const Gdk::Cursor& cursor, guint32 time)
| Attempts to grab the pointer for the given item.
Gdk::GrabStatus | pointer_grab (const Glib::RefPtr< Item >& item, Gdk::EventMask mask, guint32 time)
void | pointer_ungrab (const Glib::RefPtr< Item >& item, guint32 time)
| Ungrabs the pointer, if the given item has the pointer grab.
GdkGrabStatus | keyboard_grab (const Glib::RefPtr< Item >& item, bool owner_events, guint32 time)
| Attempts to grab the keyboard for the given item.
void | keyboard_ungrab (const Glib::RefPtr< Item >& item, guint32 time)
| Ungrabs the keyboard, if the given item has the keyboard grab.
Cairo::RefPtr< Cairo::Context > | create_cairo_context ()
| Creates a cairo context, initialized with the default canvas settings.
Glib::RefPtr< Item > | create_item (const Glib::RefPtr< ItemModel >& model)
| This function is only intended to be used when implementing new canvas items, typically container items such as Goo::CanvasGroup.
void | unregister_item (const Glib::RefPtr< ItemModel >& model)
| This function is only intended to be used when implementing new canvas items.
void | update ()
| This function is only intended to be used by subclasses of Goo::Canvas or Goo::CanvasItem implementations.
void | request_update ()
| This function is only intended to be used by subclasses of Goo::Canvas or Goo::CanvasItem implementations.
void | request_redraw (const Bounds& bounds)
| This function is only intended to be used by subclasses of Goo::Canvas or Goo::CanvasItem implementations.
void | request_item_redraw (const Bounds& bounds, bool is_static=false)
double | get_default_line_width () const
| Gets the default line width, which depends on the current units setting.
void | register_widget_item (const Glib::RefPtr< Goocanvas::Widget >& widget)
| This function should only be used by Goo::CanvasWidget and subclass implementations.
void | unregister_widget_item (const Glib::RefPtr< Goocanvas::Widget >& widget)
| This function should only be used by Goo::CanvasWidget and subclass implementations.
Glib::SignalProxy2< void, Gtk::Adjustment *, Gtk::Adjustment* > | signal_set_scroll_adjustments ()
Glib::SignalProxy2< void, const Glib::RefPtr< Item > &, const Glib::RefPtr < ItemModel >& > | signal_item_created ()
Glib::PropertyProxy< double > | property_scale ()
| The magnification factor of the canvas.
Glib::PropertyProxy_ReadOnly < double > | property_scale () const
| The magnification factor of the canvas.
Glib::PropertyProxy< double > | property_scale_x ()
| The horizontal magnification factor of the canvas.
Glib::PropertyProxy_ReadOnly < double > | property_scale_x () const
| The horizontal magnification factor of the canvas.
Glib::PropertyProxy< double > | property_scale_y ()
| The vertical magnification factor of the canvas.
Glib::PropertyProxy_ReadOnly < double > | property_scale_y () const
| The vertical magnification factor of the canvas.
Glib::PropertyProxy < Gtk::AnchorType > | property_anchor ()
| Where to place the canvas when it is smaller than the widget's allocated area.
Glib::PropertyProxy_ReadOnly < Gtk::AnchorType > | property_anchor () const
| Where to place the canvas when it is smaller than the widget's allocated area.
Glib::PropertyProxy< double > | property_x1 ()
| The x coordinate of the left edge of the canvas bounds, in canvas units.
Glib::PropertyProxy_ReadOnly < double > | property_x1 () const
| The x coordinate of the left edge of the canvas bounds, in canvas units.
Glib::PropertyProxy< double > | property_y1 ()
| The y coordinate of the top edge of the canvas bounds, in canvas units.
Glib::PropertyProxy_ReadOnly < double > | property_y1 () const
| The y coordinate of the top edge of the canvas bounds, in canvas units.
Glib::PropertyProxy< double > | property_x2 ()
| The x coordinate of the right edge of the canvas bounds, in canvas units.
Glib::PropertyProxy_ReadOnly < double > | property_x2 () const
| The x coordinate of the right edge of the canvas bounds, in canvas units.
Glib::PropertyProxy< double > | property_y2 ()
| The y coordinate of the bottom edge of the canvas bounds, in canvas units.
Glib::PropertyProxy_ReadOnly < double > | property_y2 () const
| The y coordinate of the bottom edge of the canvas bounds, in canvas units.
Glib::PropertyProxy< bool > | property_automatic_bounds ()
| If the bounds are automatically calculated based on the bounds of all the items in the canvas.
Glib::PropertyProxy_ReadOnly < bool > | property_automatic_bounds () const
| If the bounds are automatically calculated based on the bounds of all the items in the canvas.
Glib::PropertyProxy< bool > | property_bounds_from_origin ()
| If the automatic bounds are calculated from the origin.
Glib::PropertyProxy_ReadOnly < bool > | property_bounds_from_origin () const
| If the automatic bounds are calculated from the origin.
Glib::PropertyProxy< double > | property_bounds_padding ()
| The padding added to the automatic bounds.
Glib::PropertyProxy_ReadOnly < double > | property_bounds_padding () const
| The padding added to the automatic bounds.
Glib::PropertyProxy< Gtk::Unit > | property_units ()
| The units to use for the canvas.
Glib::PropertyProxy_ReadOnly < Gtk::Unit > | property_units () const
| The units to use for the canvas.
Glib::PropertyProxy< double > | property_resolution_x ()
| The horizontal resolution of the display, in dots per inch.
Glib::PropertyProxy_ReadOnly < double > | property_resolution_x () const
| The horizontal resolution of the display, in dots per inch.
Glib::PropertyProxy< double > | property_resolution_y ()
| The vertical resolution of the display, in dots per inch.
Glib::PropertyProxy_ReadOnly < double > | property_resolution_y () const
| The vertical resolution of the display, in dots per inch.
Glib::PropertyProxy_WriteOnly < Glib::ustring > | property_background_color ()
| The color to use for the canvas background.
Glib::PropertyProxy_WriteOnly < guint > | property_background_color_rgb ()
| The color to use for the canvas background, specified as a 24-bit integer value, 0xRRGGBB.
Glib::PropertyProxy< bool > | property_integer_layout ()
| If all item layout is done to the nearest integer.
Glib::PropertyProxy_ReadOnly < bool > | property_integer_layout () const
| If all item layout is done to the nearest integer.
Glib::PropertyProxy< bool > | property_clear_background ()
| If the background is cleared before the canvas is painted.
Glib::PropertyProxy_ReadOnly < bool > | property_clear_background () const
| If the background is cleared before the canvas is painted.
## Protected Member Functions
virtual void | on_set_scroll_adjustments (Gtk::Adjustment* hadjustment, Gtk::Adjustment* vadjustment)
virtual void | on_item_created (const Glib::RefPtr< Item >& item, const Glib::RefPtr< ItemModel >& model)
virtual Glib::RefPtr< Item > | create_item_vfunc (const Glib::RefPtr< ItemModel >& model)
## Related Functions
(Note that these are not member functions.)
Goocanvas::Canvas* | wrap (GooCanvas* object, bool take_copy=false)
| A Glib::wrap() method for this object.

## Detailed Description

The main canvas widget, containing a number of canvas items.

Add child items (see Item) to the root item (see get_root_item()), for instance with Item::add_child().

## Constructor & Destructor Documentation

virtual Goocanvas::Canvas::~Canvas | ( |  | ) | `[virtual]`

Goocanvas::Canvas::Canvas | ( |  | ) |

## Member Function Documentation

void Goocanvas::Canvas::convert_bounds_to_item_space | ( | const Glib::RefPtr< Item >& | item,
|  | Bounds& | bounds |
| ) |  |  | const

void Goocanvas::Canvas::convert_from_item_space | ( | const Glib::RefPtr< Item >& | item,
|  | double & | x,
|  | double & | y |
| ) |  |  | const

Converts a coordinate from the given item's coordinate space to the canvas coordinate space, applying all transformation matrices including the item's own transformation matrix, if it has one.

Parameters:

  | item | A Goo::CanvasItem.
  | x | A pointer to the x coordinate to convert.
  | y | A pointer to the y coordinate to convert.

void Goocanvas::Canvas::convert_from_pixels | ( | double & | x,
|  | double & | y |
| ) |  |  | const

Converts a coordinate from pixels to the canvas coordinate space.

The pixel coordinate space specifies pixels from the top-left of the entire canvas window, according to the current scale setting. See set_scale().

The canvas coordinate space is specified in the call to set_bounds().

Parameters:

  | x | A pointer to the x coordinate to convert.
  | y | A pointer to the y coordinate to convert.

void Goocanvas::Canvas::convert_to_item_space | ( | const Glib::RefPtr< Item >& | item,
|  | double & | x,
|  | double & | y |
| ) |  |  | const

Converts a coordinate from the canvas coordinate space to the given item's coordinate space, applying all transformation matrices including the item's own transformation matrix, if it has one.

Parameters:

  | item | A Goo::CanvasItem.
  | x | A pointer to the x coordinate to convert.
  | y | A pointer to the y coordinate to convert.

void Goocanvas::Canvas::convert_to_pixels | ( | double & | x,
|  | double & | y |
| ) |  |  | const

Converts a coordinate from the canvas coordinate space to pixels.

The canvas coordinate space is specified in the call to set_bounds().

The pixel coordinate space specifies pixels from the top-left of the entire canvas window, according to the current scale setting. See set_scale().

Parameters:

  | x | A pointer to the x coordinate to convert.
  | y | A pointer to the y coordinate to convert.

Cairo::RefPtr<Cairo::Context> Goocanvas::Canvas::create_cairo_context | ( |  | ) |

Creates a cairo context, initialized with the default canvas settings.

Returns:
  A new cairo context. It should be freed with cairo_destroy().

Glib::RefPtr<Item> Goocanvas::Canvas::create_item | ( | const Glib::RefPtr< ItemModel >& | model | ) |

This function is only intended to be used when implementing new canvas items, typically container items such as Goo::CanvasGroup.

It creates a new canvas item for the given item model, and recursively creates items for any children.

It uses the create_item() virtual method if it has been set. Subclasses of Goo::Canvas can define this method if they want to use custom views for items.

It emits the Goo::Canvas::item-created signal after creating the view, so application code can connect signal handlers to the new view if desired.

Parameters:

  | model | The item model to create a canvas item for.

Returns:
  A new canvas item.

virtual Glib::RefPtr<Item> Goocanvas::Canvas::create_item_vfunc | ( | const Glib::RefPtr< ItemModel >& | model | ) | `[protected, virtual]`

void Goocanvas::Canvas::get_bounds | ( | Bounds& | bounds | ) | const

void Goocanvas::Canvas::get_bounds | ( | double & | left,
|  | double & | top,
|  | double & | right,
|  | double & | bottom |
| ) |  |  | const

Gets the bounds of the canvas, in canvas units.

By default, canvas units are pixels, though the Goo::Canvas:units property can be used to change the units to points, inches or millimeters.

Parameters:

  | left | A pointer to a gdouble to return the left edge, or `0`.
  | top | A pointer to a gdouble to return the top edge, or `0`.
  | right | A pointer to a gdouble to return the right edge, or `0`.
  | bottom | A pointer to a gdouble to return the bottom edge, or `0`.

double Goocanvas::Canvas::get_default_line_width | ( |  | ) | const

Gets the default line width, which depends on the current units setting.

Returns:
  The default line width of the canvas.

Glib::RefPtr<const Item> Goocanvas::Canvas::get_item | ( | const Glib::RefPtr< ItemModel >& | model | ) | const

Gets the canvas item associated with the given Goo::CanvasItemModel.

This is only useful when set_root_item_model() has been used to set a model for the canvas.

For simple applications you can use get_item() to set up signal handlers for your items, e.g.

     item = goo_canvas_get_item (GOO_CANVAS (canvas), my_item);
     g_signal_connect (item, "button_press_event",
     (GtkSignalFunc) on_my_item_button_press, <tt>0</tt>);

More complex applications may want to use the Goo::Canvas::item-created signal to hook up their signal handlers.

Parameters:

  | model | A Goo::CanvasItemModel.

Returns:
  The canvas item corresponding to the given Goo::CanvasItemModel, or `0` if no canvas item has been created for it yet.

Glib::RefPtr<Item> Goocanvas::Canvas::get_item | ( | const Glib::RefPtr< ItemModel >& | model | ) |

Gets the canvas item associated with the given Goo::CanvasItemModel.

This is only useful when set_root_item_model() has been used to set a model for the canvas.

For simple applications you can use get_item() to set up signal handlers for your items, e.g.

     item = goo_canvas_get_item (GOO_CANVAS (canvas), my_item);
     g_signal_connect (item, "button_press_event",
     (GtkSignalFunc) on_my_item_button_press, <tt>0</tt>);

More complex applications may want to use the Goo::Canvas::item-created signal to hook up their signal handlers.

Parameters:

  | model | A Goo::CanvasItemModel.

Returns:
  The canvas item corresponding to the given Goo::CanvasItemModel, or `0` if no canvas item has been created for it yet.

Glib::RefPtr<const Item> Goocanvas::Canvas::get_item_at | ( | double | x,
|  | double | y,
|  | bool | is_pointer_event |
| ) |  |  | const

Gets the item at the given point.

Parameters:

  | x | The x coordinate of the point.
  | y | The y coordinate of the point.
  | is_pointer_event | `true` if the "pointer-events" property of items should be used to determine which parts of the item are tested.

Returns:
  The item found at the given point, or `0` if no item was found.

Glib::RefPtr<Item> Goocanvas::Canvas::get_item_at | ( | double | x,
|  | double | y,
|  | bool | is_pointer_event |
| ) |  |  |

Gets the item at the given point.

Parameters:

  | x | The x coordinate of the point.
  | y | The y coordinate of the point.
  | is_pointer_event | `true` if the "pointer-events" property of items should be used to determine which parts of the item are tested.

Returns:
  The item found at the given point, or `0` if no item was found.

Glib::ListHandle< Glib::RefPtr<const Item> > Goocanvas::Canvas::get_items_at | ( | double | x,
|  | double | y,
|  | bool | is_pointer_event |
| ) |  |  | const

Gets all items at the given point.

Parameters:

  | x | The x coordinate of the point.
  | y | The y coordinate of the point.
  | is_pointer_event | `true` if the "pointer-events" property of items should be used to determine which parts of the item are tested.

Returns:
  A list of items found at the given point, with the top item at the start of the list, or `0` if no items were found. The list must be freed with Glib::list_free().

Glib::ListHandle< Glib::RefPtr<Item> > Goocanvas::Canvas::get_items_at | ( | double | x,
|  | double | y,
|  | bool | is_pointer_event |
| ) |  |  |

Gets all items at the given point.

Parameters:

  | x | The x coordinate of the point.
  | y | The y coordinate of the point.
  | is_pointer_event | `true` if the "pointer-events" property of items should be used to determine which parts of the item are tested.

Returns:
  A list of items found at the given point, with the top item at the start of the list, or `0` if no items were found. The list must be freed with Glib::list_free().

Glib::ListHandle< Glib::RefPtr<const Item> > Goocanvas::Canvas::get_items_in_area | ( | const Bounds& | area,
|  | bool | inside_area,
|  | bool | allow_overlaps,
|  | bool | include_containers |
| ) |  |  | const

Gets a list of items inside or outside a given area.

Parameters:

  | area | The area to compare with each item's bounds.
  | inside_area | `true` if items inside area should be returned, or `false` if items outside area should be returned.
  | allow_overlaps | `true` if items which are partly inside and partly outside should be returned.
  | include_containers | `true` if containers should be checked as well as normal items.

Returns:
  A list of items in the given area, or `0` if no items are found. The list should be freed with Glib::list_free().

Glib::ListHandle< Glib::RefPtr<Item> > Goocanvas::Canvas::get_items_in_area | ( | const Bounds& | area,
|  | bool | inside_area,
|  | bool | allow_overlaps,
|  | bool | include_containers |
| ) |  |  |

Gets a list of items inside or outside a given area.

Parameters:

  | area | The area to compare with each item's bounds.
  | inside_area | `true` if items inside area should be returned, or `false` if items outside area should be returned.
  | allow_overlaps | `true` if items which are partly inside and partly outside should be returned.
  | include_containers | `true` if containers should be checked as well as normal items.

Returns:
  A list of items in the given area, or `0` if no items are found. The list should be freed with Glib::list_free().

Glib::RefPtr<const Item> Goocanvas::Canvas::get_root_item | ( |  | ) | const

Gets the root item of the canvas, usually a Goo::CanvasGroup.

Returns:
  The root item, or `0` if there is no root item.

Glib::RefPtr<Item> Goocanvas::Canvas::get_root_item | ( |  | ) |

Gets the root item of the canvas, usually a Goo::CanvasGroup.

Returns:
  The root item, or `0` if there is no root item.

Glib::RefPtr<const ItemModel> Goocanvas::Canvas::get_root_item_model | ( |  | ) | const

Gets the root item model of the canvas.

Returns:
  The root item model, or `0` if there is no root item model.

Glib::RefPtr<ItemModel> Goocanvas::Canvas::get_root_item_model | ( |  | ) |

Gets the root item model of the canvas.

Returns:
  The root item model, or `0` if there is no root item model.

double Goocanvas::Canvas::get_scale | ( |  | ) | const

Gets the current scale of the canvas.

The scale specifies the magnification factor of the canvas, e.g. if an item has a width of 2 pixels and the scale is set to 3, it will be displayed with a width of 2 x 3 = 6 pixels.

Returns:
  The current scale setting.

Glib::RefPtr<const Item> Goocanvas::Canvas::get_static_root_item | ( |  | ) | const

Glib::RefPtr<Item> Goocanvas::Canvas::get_static_root_item | ( |  | ) |

Glib::RefPtr<const ItemModel> Goocanvas::Canvas::get_static_root_item_model | ( |  | ) | const

Glib::RefPtr<ItemModel> Goocanvas::Canvas::get_static_root_item_model | ( |  | ) |

const GooCanvas* Goocanvas::Canvas::gobj | ( |  | ) | const`[inline]`

Provides access to the underlying C GtkObject.

Reimplemented from Gtk::Container.

GooCanvas* Goocanvas::Canvas::gobj | ( |  | ) | `[inline]`

Provides access to the underlying C GtkObject.

Reimplemented from Gtk::Container.

void Goocanvas::Canvas::grab_focus | ( | const Glib::RefPtr< Item >& | item | ) |

Grabs the keyboard focus for the given item.

Parameters:

  | item | The item to grab the focus.

GdkGrabStatus Goocanvas::Canvas::keyboard_grab | ( | const Glib::RefPtr< Item >& | item,
|  | bool | owner_events,
|  | guint32 | time |
| ) |  |  |

Attempts to grab the keyboard for the given item.

Parameters:

  | item | The item to grab the keyboard for.
  | owner_events | `true` if keyboard events for this application will be reported normally, or `false` if all keyboard events will be reported with respect to the grab item.
  | time | The time of the event that lead to the keyboard grab. This should come from the relevant Gdk::Event.

Returns:
  Gdk::GRAB_SUCCESS if the grab succeeded.

void Goocanvas::Canvas::keyboard_ungrab | ( | const Glib::RefPtr< Item >& | item,
|  | guint32 | time |
| ) |  |  |

Ungrabs the keyboard, if the given item has the keyboard grab.

Parameters:

  | item | The item that has the keyboard grab.
  | time | The time of the event that lead to the keyboard ungrab. This should come from the relevant Gdk::Event.

virtual void Goocanvas::Canvas::on_item_created | ( | const Glib::RefPtr< Item >& | item,
|  | const Glib::RefPtr< ItemModel >& | model |
| ) |  |  | `[protected, virtual]`

virtual void Goocanvas::Canvas::on_set_scroll_adjustments | ( | Gtk::Adjustment * | hadjustment,
|  | Gtk::Adjustment * | vadjustment |
| ) |  |  | `[protected, virtual]`

Gdk::GrabStatus Goocanvas::Canvas::pointer_grab | ( | const Glib::RefPtr< Item >& | item,
|  | Gdk::EventMask | mask,
|  | guint32 | time |
| ) |  |  |

Gdk::GrabStatus Goocanvas::Canvas::pointer_grab | ( | const Glib::RefPtr< Item >& | item,
|  | Gdk::EventMask | mask,
|  | const Gdk::Cursor & | cursor,
|  | guint32 | time |
| ) |  |  |

Attempts to grab the pointer for the given item.

Parameters:

  | item | The item to grab the pointer for.
  | event_mask | The events to receive during the grab.
  | cursor | The cursor to display during the grab, or `0`.
  | time | The time of the event that lead to the pointer grab. This should come from the relevant Gdk::Event.

Returns:
  Gdk::GRAB_SUCCESS if the grab succeeded.

void Goocanvas::Canvas::pointer_ungrab | ( | const Glib::RefPtr< Item >& | item,
|  | guint32 | time |
| ) |  |  |

Ungrabs the pointer, if the given item has the pointer grab.

Parameters:

  | item | The item that has the grab.
  | time | The time of the event that lead to the pointer ungrab. This should come from the relevant Gdk::Event.

Glib::PropertyProxy_ReadOnly<Gtk::AnchorType> Goocanvas::Canvas::property_anchor | ( |  | ) | const

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

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy<Gtk::AnchorType> Goocanvas::Canvas::property_anchor | ( |  | ) |

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

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy_ReadOnly<bool> Goocanvas::Canvas::property_automatic_bounds | ( |  | ) | const

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

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy<bool> Goocanvas::Canvas::property_automatic_bounds | ( |  | ) |

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

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy_WriteOnly<Glib::ustring> Goocanvas::Canvas::property_background_color | ( |  | ) |

The color to use for the canvas background.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy_WriteOnly<guint> Goocanvas::Canvas::property_background_color_rgb | ( |  | ) |

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

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy_ReadOnly<bool> Goocanvas::Canvas::property_bounds_from_origin | ( |  | ) | const

If the automatic bounds are calculated from the origin.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy<bool> Goocanvas::Canvas::property_bounds_from_origin | ( |  | ) |

If the automatic bounds are calculated from the origin.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy_ReadOnly<double> Goocanvas::Canvas::property_bounds_padding | ( |  | ) | const

The padding added to the automatic bounds.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy<double> Goocanvas::Canvas::property_bounds_padding | ( |  | ) |

The padding added to the automatic bounds.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy_ReadOnly<bool> Goocanvas::Canvas::property_clear_background | ( |  | ) | const

If the background is cleared before the canvas is painted.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy<bool> Goocanvas::Canvas::property_clear_background | ( |  | ) |

If the background is cleared before the canvas is painted.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy_ReadOnly<bool> Goocanvas::Canvas::property_integer_layout | ( |  | ) | const

If all item layout is done to the nearest integer.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy<bool> Goocanvas::Canvas::property_integer_layout | ( |  | ) |

If all item layout is done to the nearest integer.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy_ReadOnly<double> Goocanvas::Canvas::property_resolution_x | ( |  | ) | const

The horizontal resolution of the display, in dots per inch.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy<double> Goocanvas::Canvas::property_resolution_x | ( |  | ) |

The horizontal resolution of the display, in dots per inch.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy_ReadOnly<double> Goocanvas::Canvas::property_resolution_y | ( |  | ) | const

The vertical resolution of the display, in dots per inch.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy<double> Goocanvas::Canvas::property_resolution_y | ( |  | ) |

The vertical resolution of the display, in dots per inch.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy_ReadOnly<double> Goocanvas::Canvas::property_scale | ( |  | ) | const

The magnification factor of the canvas.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy<double> Goocanvas::Canvas::property_scale | ( |  | ) |

The magnification factor of the canvas.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy_ReadOnly<double> Goocanvas::Canvas::property_scale_x | ( |  | ) | const

The horizontal magnification factor of the canvas.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy<double> Goocanvas::Canvas::property_scale_x | ( |  | ) |

The horizontal magnification factor of the canvas.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy_ReadOnly<double> Goocanvas::Canvas::property_scale_y | ( |  | ) | const

The vertical magnification factor of the canvas.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy<double> Goocanvas::Canvas::property_scale_y | ( |  | ) |

The vertical magnification factor of the canvas.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy_ReadOnly<Gtk::Unit> Goocanvas::Canvas::property_units | ( |  | ) | const

The units to use for the canvas.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy<Gtk::Unit> Goocanvas::Canvas::property_units | ( |  | ) |

The units to use for the canvas.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy_ReadOnly<double> Goocanvas::Canvas::property_x1 | ( |  | ) | const

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

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy<double> Goocanvas::Canvas::property_x1 | ( |  | ) |

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

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy_ReadOnly<double> Goocanvas::Canvas::property_x2 | ( |  | ) | const

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

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy<double> Goocanvas::Canvas::property_x2 | ( |  | ) |

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

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy_ReadOnly<double> Goocanvas::Canvas::property_y1 | ( |  | ) | const

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

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy<double> Goocanvas::Canvas::property_y1 | ( |  | ) |

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

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy_ReadOnly<double> Goocanvas::Canvas::property_y2 | ( |  | ) | const

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

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy<double> Goocanvas::Canvas::property_y2 | ( |  | ) |

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

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

void Goocanvas::Canvas::register_widget_item | ( | const Glib::RefPtr< Goocanvas::Widget >& | widget | ) |

This function should only be used by Goo::CanvasWidget and subclass implementations.

It registers a widget item with the canvas, so that the canvas can do the necessary actions to move and resize the widget as needed.

Parameters:

  | witem | A Goo::CanvasWidget item.

void Goocanvas::Canvas::render | ( | const Cairo::RefPtr< Cairo::Context > & | context,
|  | double | scale = `0.0` |
| ) |  |  |

void Goocanvas::Canvas::render | ( | const Cairo::RefPtr< Cairo::Context > & | context,
|  | const Bounds& | bounds,
|  | double | scale = `0.0` |
| ) |  |  |

Renders all or part of a canvas to the given cairo context.

Parameters:

  | cr | A cairo context.
  | bounds | The area to render, or `0` to render the entire canvas.
  | scale | The scale to compare with each item's visibility threshold to see if they should be rendered. This only affects items that have their visibility set to Goo::CANVAS_ITEM_VISIBLE_ABOVE_THRESHOLD.

void Goocanvas::Canvas::request_item_redraw | ( | const Bounds& | bounds,
|  | bool | is_static = `false` |
| ) |  |  |

void Goocanvas::Canvas::request_redraw | ( | const Bounds& | bounds | ) |

This function is only intended to be used by subclasses of Goo::Canvas or Goo::CanvasItem implementations.

Requests that the given bounds be redrawn.

Parameters:

  | bounds | The bounds to redraw.

void Goocanvas::Canvas::request_update | ( |  | ) |

This function is only intended to be used by subclasses of Goo::Canvas or Goo::CanvasItem implementations.

It schedules an update of the Goo::Canvas. This will be performed in the idle loop, after all pending events have been handled, but before the canvas has been repainted.

void Goocanvas::Canvas::scroll_to | ( | double | left,
|  | double | top |
| ) |  |  |

Scrolls the canvas, placing the given point as close to the top-left of the view as possible.

Parameters:

  | left | The x coordinate to scroll to.
  | top | The y coordinate to scroll to.

void Goocanvas::Canvas::set_bounds | ( | const Bounds& | bounds | ) |

void Goocanvas::Canvas::set_bounds | ( | double | left,
|  | double | top,
|  | double | right,
|  | double | bottom |
| ) |  |  |

Sets the bounds of the Goo::Canvas, in canvas units.

By default, canvas units are pixels, though the Goo::Canvas:units property can be used to change the units to points, inches or millimeters.

Parameters:

  | left | The left edge.
  | top | The top edge.
  | right | The right edge.
  | bottom | The bottom edge.

void Goocanvas::Canvas::set_root_item | ( | const Glib::RefPtr< Item >& | item | ) |

Sets the root item of the canvas.

Any existing canvas items are removed.

Parameters:

  | item | The root canvas item.

void Goocanvas::Canvas::set_root_item_model | ( | const Glib::RefPtr< ItemModel >& | model | ) |

Sets the root item model of the canvas.

A hierarchy of canvas items will be created, corresponding to the hierarchy of items in the model. Any current canvas items will be removed.

Parameters:

  | model | A Goo::CanvasItemModel.

void Goocanvas::Canvas::set_scale | ( | double | scale | ) |

Sets the scale of the canvas.

The scale specifies the magnification factor of the canvas, e.g. if an item has a width of 2 pixels and the scale is set to 3, it will be displayed with a width of 2 x 3 = 6 pixels.

Parameters:

  | scale | The new scale setting.

void Goocanvas::Canvas::set_static_root_item | ( | const Glib::RefPtr< Item >& | item | ) |

void Goocanvas::Canvas::set_static_root_item_model | ( | const Glib::RefPtr< ItemModel >& | model | ) |

Glib::SignalProxy2< void,const Glib::RefPtr<Item>&,const Glib::RefPtr<ItemModel>& > Goocanvas::Canvas::signal_item_created | ( |  | ) |

Prototype:
  `void on_my_item_created(const Glib::RefPtr<Item>& item, const Glib::RefPtr<ItemModel>& model)`

Glib::SignalProxy2< void,Gtk::Adjustment*,Gtk::Adjustment* > Goocanvas::Canvas::signal_set_scroll_adjustments | ( |  | ) |

Prototype:
  `void on_my_set_scroll_adjustments(Gtk::Adjustment* hadjustment, Gtk::Adjustment* vadjustment)`

void Goocanvas::Canvas::unregister_item | ( | const Glib::RefPtr< ItemModel >& | model | ) |

This function is only intended to be used when implementing new canvas items.

It should be called in the finalize method of Goo::CanvasItem objects, to remove the canvas item from the Goo::Canvas's hash table.

Parameters:

  | model | The item model whose canvas item is being finalized.

void Goocanvas::Canvas::unregister_widget_item | ( | const Glib::RefPtr< Goocanvas::Widget >& | widget | ) |

This function should only be used by Goo::CanvasWidget and subclass implementations.

It unregisters a widget item from the canvas, when the item is no longer in the canvas.

Parameters:

  | witem | A Goo::CanvasWidget item.

void Goocanvas::Canvas::update | ( |  | ) |

This function is only intended to be used by subclasses of Goo::Canvas or Goo::CanvasItem implementations.

It updates any items that need updating.

If the bounds of items change, they will request a redraw of the old and new bounds so the display is updated correctly.

## Friends And Related Function Documentation

Goocanvas::Canvas* wrap | ( | GooCanvas * | object,
|  | bool | take_copy = `false` |
| ) |  |  | `[related]`

A Glib::wrap() method for this object.

Parameters:

  | object | The C instance.
  | take_copy | False if the result should take ownership of the C instance. True if it should take a new copy or ref.

Returns:
  A C++ instance that wraps this C instance.

The documentation for this class was generated from the following file:

- goocanvasmm/canvas.h