Gnome.CanvasItem Class
Base class for all canvas items

See Also: CanvasItem Members

Syntax

public class CanvasItem : Gtk.Object

Remarks

This is the base class for all canvas items. Canvas items are the drawing elements of a GnomeCanvas. Example items include lines, ellipses, polygons, images, text, curves and even arbitrary GTK+ widgets.

Canvas items use the GObject property system to query and set parameters. Properties are inherited so, for example, a Gnome.CanvasPolygon has a CanvasPolygon.FillColor property that is inherited from its parent class object Gnome.CanvasShape. So be sure to check the parent classes of Gnome.CanvasItem objects when looking for item properties.

To create a new canvas item use the CanvasItem constructor which takes a parent Gnome.CanvasGroup, GLib.Type of the item to create, and a null terminated list of name/value GObject properties to set for the new item.

There are several methods to change the drawing stacking order of an item. Call CanvasItem.Raise to raise an item a specified number of positions or CanvasItem.Lower to lower it. To raise an item to the top call CanvasItem.RaiseToTop. The CanvasItem.LowerToBottom methods will put it at the bottom.

To show an item call CanvasItem.Show. Note that canvas item's are shown by default and so do not need to be explicitly shown after creation (contrary to GTK+ widget behavior). Call CanvasItem.Hide to hide an item.

To move an item relative to its current position (item coordinates) call CanvasItem.Move or CanvasItem.AffineRelative for more complex transforms. CanvasItem.AffineAbsolute can be used to set an item's transform to specific values (not offsets).

To convert between world and item coordinate systems call CanvasItem.W2i, and to convert in the other direction call CanvasItem.I2w. To get the transform for converting from item to world coordinates use CanvasItem.I2wAffine or for converting item to canvas coordinates, CanvasItem.I2cAffine.

Handling user input for interactive items is accomplished through a few functions and the CanvasItem.CanvasEvent signals. To grab the mouse cursor call CanvasItem.Grab, it can be ungrabbed with CanvasItem.Ungrab (see Gdk.Pointer.Grab of the GTK+ library for details). To grab keyboard focus call CanvasItem.GrabFocus. Received events will be signaled via the "event" signal.

Some other useful functions include a reparenting routine, CanvasItem.Reparent, and a function to query the bounding box of an item (a minumum rectangular area containing all parts of the item), CanvasItem.Getbounds.

Requirements

Namespace: Gnome
Assembly: gnome-sharp (in gnome-sharp.dll)
Assembly Versions: 2.20.0.0