goocanvas.ItemSimple — The base class for the standard canvas items.
goocanvas.ItemSimple extends, gobject.GObject {changed(recompute_bounds);check_in_path(x,
y,
cr,
pointer_events);check_style();get_line_width();get_path_bounds(cr);paint_path(cr);set_model(model);user_bounds_to_device(cr,
bounds);user_bounds_to_parent(cr,
bounds);
}
"antialias" Read/Write The antialiasing mode to use. Default value: cairo.ANTIALIAS_DEFAULT "clip-fill-rule" Read/Write The fill rule used to determine which parts of the item are clipped. Default value: cairo.FILL_RULE_WINDING "clip-path" Write The sequence of commands describing the clip path of the item, specified as a string using the same syntax as in the Scalable Vector Graphics (SVG) path element. Default value: None "fill-color" Write The color to use to paint the interior of the item. Default value: None "fill-color-rgba" Read/Write The color to use to paint the interior of the item, specified as a 32-bit integer value. Default value: 0 "fill-pattern" Read/Write The pattern to use to paint the interior of the item. "fill-pixbuf" Write The pixbuf to use to paint the interior of the item. "fill-rule" Read/Write The fill rule used to determine which parts of the item are filled. Default value: cairo.FILL_RULE_WINDING "font" Read/Write The base font to use for the text. Default value: None "font-desc" Read/Write The attributes specifying which font to use. "line-cap" Read/Write The line cap style to use. Default value: cairo.LINE_CAP_BUTT "line-dash" Read/Write The dash pattern to use. "line-join" Read/Write The line join style to use. Default value: cairo.LINE_JOIN_MITER "line-join-miter-limit" Read/Write The smallest angle to use with miter joins, in degrees. Bevel joins will be used below this limit. Allowed values: >= 0 Default value: 10. "line-width" Read/Write The line width to use for the item's perimeter. Allowed values: >= 0 Default value: 0 "operator" Read/Write The compositing operator to use. Default value: cairo.OPERATOR_OVER "stroke-color" Write The color to use for the item's perimeter. Default value: None "stroke-color-rgba" Read/Write The color to use for the item's perimeter, specified as a 32-bit integer value. Default value: 0 "stroke-pattern" Read/Write The pattern to use to paint the perimeter of the item. "stroke-pixbuf" Write The pixbuf to use to draw the item's perimeter.
goocanvas.ItemSimple
is implementated by
goocanvas.Rect
goocanvas.Ellipse
goocanvas.Path
goocanvas.Polyline
goocanvas.Text
goocanvas.Image
goocanvas.Group
goocanvas.ItemSimple
is used as a base class for all of the standard canvas items.
It can also be used as the base class for new custom canvas items.
It provides default implementations for many of the
goocanvas.Item methods.
For very simple items, all that is needed is to implement the create_path() method.
(GooCanvasEllipse, GooCanvasRect and GooCanvasPath do this.)
More complicated items need to implement the update(), paint() and get_item_at() methods.
(GooCanvasImage, GooCanvasPolyline, GooCanvasText and GooCanvasWidget do this.)
They may also need to override some of the other GooCanvasItem methods such as set_canvas(),
set_parent() or allocate_area() if special code is needed. (GooCanvasWidget does this to make
sure the GtkWidget is embedded in the GooCanvas widget correctly.)
changed(recompute_bounds);
| If the item's bounds need to be recomputed. |
This method is intended to be used by subclasses of
goocanvas.ItemSimple.
It is used as a callback for the "changed" signal of the item models.
It requests an update or redraw of the item as appropriate.
check_in_path(x,
y,
cr,
pointer_events);
| the x coordinate of the point. |
| the y coordinate of the point. |
| a cairo context. |
| specifies which parts of the path to check. |
Returns : | True if the given point is in the current path. |
Checks if the given point is in the current path.
check_style();
This method is intended to be used by subclasses of
goocanvas.ItemSimple,
typically in their update() or get_requested_area() methods.
It ensures that the item's style is setup correctly. If the item has its own
goocanvas.Style
it makes sure the parent is set correctly.
If it doesn't have its own style it uses the parent item's style.
get_line_width();
Returns : | The item's line width. |
Gets the item's line width.
get_path_bounds(cr,
bounds);
| A cairo context. |
Returns : | The goocanvas.Bounds holding the bounding box of the item in device space, converted to user space coordinates |
Calculates the bounds of the current path in device space, storing the results in a goocanvas.Bounds.
This method should be used only while implementing custom items
paint_path(cr);
| A cairo context. |
Paints the current path, using the item's style settings.
set_model(model);
| The model that item will view. |
This function should be called by subclasses of
goocanvas.ItemSimple
in their set_model() method.
user_bounds_to_device(cr,
bounds);
| a cairo context. |
| the bounds of the item, in the item's coordinate space. |
Converts the item's bounds to a bounding box in device space.
user_bounds_to_parent(cr,
bounds);
| A cairo context. |
| the bounds of the item, in the item's coordinate space. |
Converts the item's bounds to a bounding box in its parent's coordinate space.
If the item has no transformation matrix set then no conversion is needed.
This is typically needed when implementing the get_requested_area() method for subclasses of
goocanvas.ItemSimple.