GooCanvas.CanvasStyle

g GObject.Object GObject.Object GooCanvas.CanvasStyle GooCanvas.CanvasStyle GObject.Object->GooCanvas.CanvasStyle

Subclasses:

None

Methods

Inherited:

GObject.Object (37)

Structs:

GObject.ObjectClass (5)

class

new ()

copy ()

get_parent ()

get_property (property_id)

set_fill_options (cr)

set_parent (parent)

set_property (property_id, value)

set_stroke_options (cr)

Virtual Methods

Inherited:

GObject.Object (7)

Properties

None

Signals

Inherited:

GObject.Object (1)

Fields

Inherited:

GObject.Object (1)

Name

Type

Access

Description

parent

GooCanvas.CanvasStyle

r

the parent style.

parent_object

GObject.Object

r

properties

[object]

r

an array of GooCanvas.CanvasStyleProperty property settings.

Class Details

class GooCanvas.CanvasStyle(**kwargs)
Bases:

GObject.Object

Abstract:

No

Structure:

GooCanvas.CanvasStyleClass

GooCanvas.CanvasStyle provides support for cascading style properties for canvas items. It is intended to be used when implementing new canvas items.

The cascading styles canvas feature may be removed in a future version of GooCanvas.Canvas.

Style properties are identified by a unique #GQuark, and contain arbitrary data stored in a GObject.Value.

GooCanvas.CanvasStyle also provides a few convenience functions such as GooCanvas.CanvasStyle.set_stroke_options() and GooCanvas.CanvasStyle.set_fill_options() which efficiently apply an item’s standard style properties to the given cairo.Context.

classmethod new()
Returns:

a new GooCanvas.CanvasStyle.

Return type:

GooCanvas.CanvasStyle

Creates a new GooCanvas.CanvasStyle.

copy()
Returns:

a copy of the given GooCanvas.CanvasStyle.

Return type:

GooCanvas.CanvasStyle

Copies the given GooCanvas.CanvasStyle, by copying all of its properties. Though the parent of the new style is left unset.

get_parent()
Returns:

the parent of the given style, or None.

Return type:

GooCanvas.CanvasStyle

Gets the parent of the style.

get_property(property_id)
Parameters:

property_id (int) – the property identifier.

Returns:

the property value, or None if it isn’t set.

Return type:

GObject.Value

Gets the value of a property.

This searches though all the GooCanvas.CanvasStyle's own list of property settings and also all ancestor GooCanvas.CanvasStyle objects.

Note that it returns a pointer to the internal GObject.Value setting, which should not be changed.

set_fill_options(cr)
Parameters:

cr (cairo.Context) – a cairo context.

Returns:

True if a paint source is set, or False if the fill should be skipped.

Return type:

bool

Sets the standard cairo fill options using the given style.

set_parent(parent)
Parameters:

parent (GooCanvas.CanvasStyle) – the new parent.

Sets the parent of the style.

set_property(property_id, value)
Parameters:
  • property_id (int) – the property identifier.

  • value (GObject.Value) – the value of the property.

Sets a property in the style, replacing any current setting.

Note that this will override the property setting in ancestor GooCanvas.CanvasStyle objects.

set_stroke_options(cr)
Parameters:

cr (cairo.Context) – a cairo context.

Returns:

True if a paint source is set, or False if the stroke should be skipped.

Return type:

bool

Sets the standard cairo stroke options using the given style.