![]() |
![]() |
![]() |
GooCanvas Reference Manual | ![]() |
---|---|---|---|---|
GooCanvasStyle; GooCanvasStyleProperty; GooCanvasStyle* goo_canvas_style_new (void); GooCanvasStyle* goo_canvas_style_copy (GooCanvasStyle *style); GooCanvasStyle* goo_canvas_style_get_parent (GooCanvasStyle *style); void goo_canvas_style_set_parent (GooCanvasStyle *style, GooCanvasStyle *parent); GValue* goo_canvas_style_get_property (GooCanvasStyle *style, GQuark property_id); void goo_canvas_style_set_property (GooCanvasStyle *style, GQuark property_id, const GValue *value); gboolean goo_canvas_style_set_fill_options (GooCanvasStyle *style, cairo_t *cr); gboolean goo_canvas_style_set_stroke_options (GooCanvasStyle *style, cairo_t *cr); extern GQuark goo_canvas_style_antialias_id; extern GQuark goo_canvas_style_fill_pattern_id; extern GQuark goo_canvas_style_fill_rule_id; extern GQuark goo_canvas_style_font_desc_id; extern GQuark goo_canvas_style_hint_metrics_id; extern GQuark goo_canvas_style_line_cap_id; extern GQuark goo_canvas_style_line_dash_id; extern GQuark goo_canvas_style_line_join_id; extern GQuark goo_canvas_style_line_join_miter_limit_id; extern GQuark goo_canvas_style_line_width_id; extern GQuark goo_canvas_style_operator_id; extern GQuark goo_canvas_style_stroke_pattern_id;
GooCanvasStyle 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.
GooCanvasStyle also provides a few convenience functions such as
goo_canvas_style_set_stroke_options()
and
goo_canvas_style_set_fill_options()
which efficiently apply an item's
standard style properties to the given cairo_t.
typedef struct { GooCanvasStyle *parent; GArray *properties; } GooCanvasStyle;
GooCanvasStyle holds the style properties of a canvas item, as well as a pointer to the parent style.
GooCanvasStyle * |
the parent style. |
GArray * |
an array of GooCanvasStyleProperty property settings. |
typedef struct { GQuark id; GValue value; } GooCanvasStyleProperty;
GooCanvasStyleProperty represents a property setting.
GooCanvasStyle* goo_canvas_style_new (void);
Creates a new GooCanvasStyle.
Returns : |
a new GooCanvasStyle. |
GooCanvasStyle* goo_canvas_style_copy (GooCanvasStyle *style);
Copies the given GooCanvasStyle, by copying all of its properties. Though the parent of the new style is left unset.
|
a GooCanvasStyle. |
Returns : |
a copy of the given GooCanvasStyle. |
GooCanvasStyle* goo_canvas_style_get_parent (GooCanvasStyle *style);
Gets the parent of the style.
|
a style. |
Returns : |
the parent of the given style, or NULL .
|
void goo_canvas_style_set_parent (GooCanvasStyle *style, GooCanvasStyle *parent);
Sets the parent of the style.
|
a style. |
|
the new parent. |
GValue* goo_canvas_style_get_property (GooCanvasStyle *style, GQuark property_id);
Gets the value of a property.
This searches though all the GooCanvasStyle's own list of property settings and also all ancestor GooCanvasStyle objects.
Note that it returns a pointer to the internal GValue setting, which should not be changed.
|
a style. |
|
the property identifier. |
Returns : |
the property value, or NULL if it isn't set.
|
void goo_canvas_style_set_property (GooCanvasStyle *style, GQuark property_id, const GValue *value);
Sets a property in the style, replacing any current setting.
Note that this will override the property setting in ancestor GooCanvasStyle objects.
|
a style. |
|
the property identifier. |
|
the value of the property. |
gboolean goo_canvas_style_set_fill_options (GooCanvasStyle *style, cairo_t *cr);
Sets the standard cairo fill options using the given style.
gboolean goo_canvas_style_set_stroke_options (GooCanvasStyle *style, cairo_t *cr);
Sets the standard cairo stroke options using the given style.
extern GQuark goo_canvas_style_antialias_id;
Unique GQuark identifier used for the standard antialias property.
extern GQuark goo_canvas_style_fill_pattern_id;
Unique GQuark identifier used for the standard fill pattern property.
extern GQuark goo_canvas_style_fill_rule_id;
Unique GQuark identifier used for the standard fill rule property.
extern GQuark goo_canvas_style_font_desc_id;
Unique GQuark identifier used for the standard font description property.
extern GQuark goo_canvas_style_hint_metrics_id;
Unique GQuark identifier used for the standard hint metrics property.
extern GQuark goo_canvas_style_line_cap_id;
Unique GQuark identifier used for the standard line cap property.
extern GQuark goo_canvas_style_line_dash_id;
Unique GQuark identifier used for the standard line dash property.
extern GQuark goo_canvas_style_line_join_id;
Unique GQuark identifier used for the standard line join property.
extern GQuark goo_canvas_style_line_join_miter_limit_id;
Unique GQuark identifier used for the standard miter limit property.
extern GQuark goo_canvas_style_line_width_id;
Unique GQuark identifier used for the standard line width property.
extern GQuark goo_canvas_style_operator_id;
Unique GQuark identifier used for the standard operator property.
extern GQuark goo_canvas_style_stroke_pattern_id;
Unique GQuark identifier used for the standard stroke pattern property.