goocanvas.Style
Prev | PyGooCanvas Core Class Reference | Next

## goocanvas.Style

goocanvas.Style — Support for cascading style properties for canvas items.

## Synopsis

    class goocanvas.Style(gobject.GObject):
        goocanvas.Style()
        def copy()
        def get_parent()
        def get_style_property(property_id)
        def set_fill_options(cr)
        def set_parent(parent)
        def set_stroke_options(cr)
        def set_style_property(property_id, value)

## Ancestry

    +-- gobject.GObject
            +-- goocanvas.Style

## Description

`goocanvas.Style` provides support for cascading style properties for canvas items. It is intended to be used when implementing new canvas items.

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

`goocanvas.Style` also provides a few convenience functions such as `set_stroke_options` and `set_fill_options` which efficiently apply an item's standard style properties to the given cairo_t.

## Constructor

        goocanvas.Style()

Returns : | A new `goocanvas.Style`

Creates a new canvas Style object.

## Methods

### goocanvas.Style.copy

        def convert_from_item_scopypace()

Returns : | A copy of the given `goocanvas.Style`

Copies the given `goocanvas.Style`, by copying all of its properties. Though the parent of the new style is left unset.

### goocanvas.Style.get_parent

        def get_parent()

Returns : | The parent of the given style, or None.

Gets the parent of the style.

### goocanvas.Style.get_style_property

        def get_style_property(property_id)

`property_id` : | The property identifier.
Returns : | The property value, or None if it isn't set.

Gets the value of a property.

This searches though all the `goocanvas.Style`'s own list of property settings and also all ancestor `goocanvas.Style` objects.

### goocanvas.Style.set_fill_options

        def set_fill_options(cr)

`cr` : | A cairo context.
Returns : | True if a paint source is set, or False if the fill should be skipped.

Sets the standard cairo fill options using the given style.

### goocanvas.Style.set_parent

        def set_parent(parent)

`parent` : | The new parent

Sets the parent of the style.

### goocanvas.Style.set_stroke_options

        def set_stroke_options(cr)

`cr` : | A cairo context.
Returns : | True if a paint source is set, or False if the stroke should be skipped.

Sets the standard cairo stroke options using the given style.

### goocanvas.Style.set_style_property

        def set_style_property(property_id, value)

`property_id` : | the property identifier.
`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.Style` objects.

Prev | Up | Next
goocanvas.ItemModelSimple | Home | PyGooCanvas Standard Canvas Items Reference