GooCanvas.CanvasItemSimple¶
- Subclasses:
GooCanvas.CanvasEllipse
,GooCanvas.CanvasGrid
,GooCanvas.CanvasGroup
,GooCanvas.CanvasImage
,GooCanvas.CanvasPath
,GooCanvas.CanvasPolyline
,GooCanvas.CanvasRect
,GooCanvas.CanvasText
,GooCanvas.CanvasWidget
Methods¶
- Inherited:
- Structs:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Virtual Methods¶
- Inherited:
|
|
|
|
|
Properties¶
- Inherited:
Name |
Type |
Flags |
Short Description |
---|---|---|---|
r/w |
The antialiasing mode to use |
||
r/w |
The fill rule used to determine which parts of the item are clipped |
||
w |
The sequence of path commands specifying the clip path |
||
w |
The color to use to paint the interior of the item. To disable painting set the ‘fill-pattern’ property to |
||
r/w |
The color to use to paint the interior of the item, specified as a |
||
r/w |
The color to use to paint the interior of the item, specified as a 32-bit integer value. To disable painting set the ‘fill-pattern’ property to |
||
r/w |
The pattern to use to paint the interior of the item, or |
||
w |
The pixbuf to use to paint the interior of the item. To disable painting set the ‘fill-pattern’ property to |
||
r/w |
The fill rule used to determine which parts of the item are filled |
||
r/w |
The base font to use for the text |
||
r/w |
The attributes specifying which font to use |
||
r/w |
The hinting to be used for font metrics |
||
r/w |
The line cap style to use |
||
r/w |
The dash pattern to use |
||
r/w |
The line join style to use |
||
r/w |
The smallest angle to use with miter joins, in degrees. Bevel joins will be used below this limit |
||
r/w |
The line width to use for the item’s perimeter |
||
r/w |
The compositing operator to use |
||
w |
The color to use for the item’s perimeter. To disable painting set the ‘stroke-pattern’ property to |
||
r/w |
The color to use for the item’s perimeter, specified as a |
||
r/w |
The color to use for the item’s perimeter, specified as a 32-bit integer value. To disable painting set the ‘stroke-pattern’ property to |
||
r/w |
The pattern to use to paint the perimeter of the item, or |
||
w |
The pixbuf to use to draw the item’s perimeter. To disable painting set the ‘stroke-pattern’ property to |
Signals¶
- Inherited:
Fields¶
- Inherited:
Name |
Type |
Access |
Description |
---|---|---|---|
bounds |
r |
the bounds of the item, in device space. |
|
canvas |
r |
the canvas. |
|
model |
r |
the item’s model, if it has one. |
|
need_entire_subtree_update |
r |
if all descendants need to be updated. |
|
need_update |
r |
if the item needs to recompute its bounds and redraw. |
|
parent |
r |
the parent item. |
|
parent_object |
r |
||
priv |
r |
||
simple_data |
r |
data that is common to both the model and view classes. If the canvas item has a model, this will point to the model’s |
Class Details¶
- class GooCanvas.CanvasItemSimple(**kwargs)¶
- Bases:
- Abstract:
No
- Structure:
GooCanvas.CanvasItemSimple
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.CanvasItem
methods.For very
GooCanvas.simple
items, all that is needed is to implement the create_path() method. (GooCanvas.CanvasEllipse
,GooCanvas.CanvasRect
andGooCanvas.CanvasPath
do this.)More complicated items need to implement the update(), paint() and is_item_at() methods instead. (
GooCanvas.CanvasImage
,GooCanvas.CanvasPolyline
,GooCanvas.CanvasText
andGooCanvas.CanvasWidget
do this.) They may also need to override some of the otherGooCanvas.CanvasItem
methods such as set_canvas(), set_parent() or allocate_area() if special code is needed. (GooCanvas.CanvasWidget
does this to make sure theGtk.Widget
is embedded in theGooCanvas.Canvas
widget correctly.)- changed(recompute_bounds)¶
- Parameters:
recompute_bounds (
bool
) – if the item’s bounds need to be recomputed.
This function is intended to be used by subclasses of
GooCanvas.CanvasItemSimple
.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)¶
- Parameters:
x (
float
) – the x coordinate of the point.y (
float
) – the y coordinate of the point.cr (
cairo.Context
) – a cairo context.pointer_events (
GooCanvas.CanvasPointerEvents
) – specifies which parts of the path to check.
- Returns:
True
if the given point is in the current path.- Return type:
This function is intended to be used by subclasses of
GooCanvas.CanvasItemSimple
.It checks if the given point is in the current path, using the item’s style settings.
- check_style()¶
This function is intended to be used by subclasses of
GooCanvas.CanvasItemSimple
, 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.CanvasStyle
it makes sure the parent is set correctly. If it doesn’t have its own style it uses the parent item’s style.
- get_path_bounds(cr, bounds)¶
- Parameters:
cr (
cairo.Context
) – a cairo context.bounds (
GooCanvas.CanvasBounds
) – theGooCanvas.CanvasBounds
struct to store the resulting bounding box.
This function is intended to be used by subclasses of
GooCanvas.CanvasItemSimple
, typically in their update() or get_requested_area() methods.It calculates the bounds of the current path, using the item’s style settings, and stores the results in the given
GooCanvas.CanvasBounds
struct.The returned bounds contains the bounding box of the path in device space, converted to user space coordinates. To calculate the bounds completely in user space, use
cairo.Context.identity_matrix
() to temporarily reset the current transformation matrix to the identity matrix.
- paint_path(cr)¶
- Parameters:
cr (
cairo.Context
) – a cairo context.
This function is intended to be used by subclasses of
GooCanvas.CanvasItemSimple
.It paints the current path, using the item’s style settings.
- set_model(model)¶
- Parameters:
model (
GooCanvas.CanvasItemModel
) – the model that self will view.
This function should be called by subclasses of
GooCanvas.CanvasItemSimple
in their set_model() method.
- user_bounds_to_device(cr, bounds)¶
- Parameters:
cr (
cairo.Context
) – a cairo context.bounds (
GooCanvas.CanvasBounds
) – the bounds of the item, in the item’s coordinate space.
This function is intended to be used by subclasses of
GooCanvas.CanvasItemSimple
, typically in their update() or get_requested_area() methods.It converts the item’s bounds to a bounding box in the canvas (device) coordinate space.
- user_bounds_to_parent(cr, bounds)¶
- Parameters:
cr (
cairo.Context
) – a cairo context.bounds (
GooCanvas.CanvasBounds
) – the bounds of the item, in the item’s coordinate space.
This function is intended to be used by subclasses of
GooCanvas.CanvasItemSimple
, typically in their get_requested_area() method.It 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.
- do_simple_create_path(cr) virtual¶
- Parameters:
cr (
cairo.Context
) –
- do_simple_is_item_at(x, y, cr, is_pointer_event) virtual¶
- Parameters:
x (
float
) –y (
float
) –cr (
cairo.Context
) –is_pointer_event (
bool
) –
- Return type:
- do_simple_paint(cr, bounds) virtual¶
- Parameters:
cr (
cairo.Context
) –bounds (
GooCanvas.CanvasBounds
) –
- do_simple_update(cr) virtual¶
- Parameters:
cr (
cairo.Context
) –
Property Details¶
- GooCanvas.CanvasItemSimple.props.antialias¶
- Name:
antialias
- Type:
- Default Value:
- Flags:
The antialiasing mode to use
- GooCanvas.CanvasItemSimple.props.clip_fill_rule¶
- Name:
clip-fill-rule
- Type:
- Default Value:
- Flags:
The fill rule used to determine which parts of the item are clipped
- GooCanvas.CanvasItemSimple.props.clip_path¶
-
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.
- GooCanvas.CanvasItemSimple.props.fill_color¶
-
The color to use to paint the interior of the item. To disable painting set the ‘fill-pattern’ property to
None
- GooCanvas.CanvasItemSimple.props.fill_color_gdk_rgba¶
-
The color to use to paint the interior of the item, specified as a
Gdk.RGBA
. To disable painting set the ‘fill-pattern’ property toNone
.New in version 2.0.1.
- GooCanvas.CanvasItemSimple.props.fill_color_rgba¶
-
The color to use to paint the interior of the item, specified as a 32-bit integer value. To disable painting set the ‘fill-pattern’ property to
None
- GooCanvas.CanvasItemSimple.props.fill_pattern¶
-
The pattern to use to paint the interior of the item, or
None
to disable painting
- GooCanvas.CanvasItemSimple.props.fill_pixbuf¶
- Name:
fill-pixbuf
- Type:
- Default Value:
- Flags:
The pixbuf to use to paint the interior of the item. To disable painting set the ‘fill-pattern’ property to
None
- GooCanvas.CanvasItemSimple.props.fill_rule¶
- Name:
fill-rule
- Type:
- Default Value:
- Flags:
The fill rule used to determine which parts of the item are filled
- GooCanvas.CanvasItemSimple.props.font¶
-
The base font to use for the text
- GooCanvas.CanvasItemSimple.props.font_desc¶
- Name:
font-desc
- Type:
- Default Value:
- Flags:
The attributes specifying which font to use
- GooCanvas.CanvasItemSimple.props.hint_metrics¶
- Name:
hint-metrics
- Type:
- Default Value:
- Flags:
The hinting to be used for font metrics
- GooCanvas.CanvasItemSimple.props.line_cap¶
- Name:
line-cap
- Type:
- Default Value:
- Flags:
The line cap style to use
- GooCanvas.CanvasItemSimple.props.line_dash¶
- Name:
line-dash
- Type:
- Default Value:
- Flags:
The dash pattern to use
- GooCanvas.CanvasItemSimple.props.line_join¶
- Name:
line-join
- Type:
- Default Value:
- Flags:
The line join style to use
- GooCanvas.CanvasItemSimple.props.line_join_miter_limit¶
-
The smallest angle to use with miter joins, in degrees. Bevel joins will be used below this limit
- GooCanvas.CanvasItemSimple.props.line_width¶
-
The line width to use for the item’s perimeter
- GooCanvas.CanvasItemSimple.props.operator¶
- Name:
operator
- Type:
- Default Value:
- Flags:
The compositing operator to use
- GooCanvas.CanvasItemSimple.props.stroke_color¶
-
The color to use for the item’s perimeter. To disable painting set the ‘stroke-pattern’ property to
None
- GooCanvas.CanvasItemSimple.props.stroke_color_gdk_rgba¶
-
The color to use for the item’s perimeter, specified as a
Gdk.RGBA
. To disable painting set the ‘stroke-pattern’ property toNone
.New in version 2.0.1.
- GooCanvas.CanvasItemSimple.props.stroke_color_rgba¶
-
The color to use for the item’s perimeter, specified as a 32-bit integer value. To disable painting set the ‘stroke-pattern’ property to
None
- GooCanvas.CanvasItemSimple.props.stroke_pattern¶
-
The pattern to use to paint the perimeter of the item, or
None
disable painting