## GocStyledItem

GocStyledItem — Styled items

## Functions

gboolean | goc_styled_item_set_cairo_line ()
gboolean | goc_styled_item_get_scale_line_width ()
void | goc_styled_item_set_scale_line_width ()

## Properties

gboolean | scale-line-width | Read / Write
GOStyle * | style | Read / Write

## Signals

void | style-changed | Run Last

## Types and Values

| GocStyledItem
struct | GocStyledItemClass

## Object Hierarchy

        GObject
        ╰── GocItem
            ╰── GocStyledItem
                ├── GocArc
                ├── GocCircle
                ├── GocEllipse
                ├── GocLine
                ├── GocPath
                ├── GocPolygon
                ├── GocPolyline
                ├── GocRectangle
                ╰── GocText

## Implemented Interfaces

GocStyledItem implements GOStyledObject.

## Description

The virtual base object for canvas items with style.

## Functions

### goc_styled_item_set_cairo_line ()

    gboolean
    goc_styled_item_set_cairo_line (GocStyledItem const *gsi,
                                    cairo_t *cr);

Prepares the cairo context `cr` to draw a line according to the item style and canvas scale. The line width is scaled only if the scale-line-width property is set to `TRUE`. This function calls `go_styled_object_set_cairo_line()`.

If the item drawing used `goc_group_cairo_transform()`, scale-line-width should be `FALSE` to avoid scaling twice, or `go_styled_object_set_cairo_line()` should be called directly instead.

#### Parameters

gsi | GocStyledItem |
cr | cairo_t |

#### Returns

`TRUE` if the line is not invisible

### goc_styled_item_get_scale_line_width ()

    gboolean
    goc_styled_item_get_scale_line_width (GocStyledItem const *gsi);

This function returns `TRUE` if the line width needs to be scaled. It will always return `FALSE` if the line width is 0.

#### Parameters

gsi | GocStyledItem |

#### Returns

whether the line width needs to be scaled.

### goc_styled_item_set_scale_line_width ()

    void
    goc_styled_item_set_scale_line_width (GocStyledItem *gsi,
                                          gboolean scale_line_width);

Sets whether the line width needs to be scaled according to the current canvas resolution and the item transformation. It will be ignored if the line width is 0. Default value is `TRUE`.

#### Parameters

gsi | GocStyledItem |
scale_line_width | boolean |

## Types and Values

### GocStyledItem

    typedef struct _GocStyledItem GocStyledItem;

### struct GocStyledItemClass

    struct GocStyledItemClass {
    	/* virtual */
    	void	  (*init_style)     	(GocStyledItem *item, GOStyle *style);
    	void (*reserved1) (void);
    	void (*reserved2) (void);
    };

#### Members

`init_style` () | style initialization handler. |
`reserved1` () | reserved for future expansion |
`reserved2` () | reserved for future expansion |

## Property Details

### The `“scale-line-width”` property

      “scale-line-width”         gboolean

Whether to scale the line width when zooming.

Owner: GocStyledItem

Flags: Read / Write

Default value: TRUE

### The `“style”` property

      “style”                    GOStyle *

A pointer to the GOStyle object.

Owner: GocStyledItem

Flags: Read / Write

## Signal Details

### The `“style-changed”` signal

    void
    user_function (GocStyledItem *gsi,
                   GObject       *style,
                   gpointer       user_data)

The ::style-changed signal is emitted when a new style has been set on a styled item.

#### Parameters

gsi | the object on which the signal is emitted |
style | the new GOStyle. |
user_data | user data set when the signal handler was connected. |

Flags: Run Last