Top |
void | goo_canvas_item_simple_check_style () |
gdouble | goo_canvas_item_simple_get_line_width () |
void | goo_canvas_item_simple_get_path_bounds () |
void | goo_canvas_item_simple_user_bounds_to_device () |
void | goo_canvas_item_simple_user_bounds_to_parent () |
gboolean | goo_canvas_item_simple_check_in_path () |
void | goo_canvas_item_simple_paint_path () |
void | goo_canvas_item_simple_changed () |
void | goo_canvas_item_simple_set_model () |
GooCairoAntialias | antialias | Read / Write |
GooCairoFillRule | clip-fill-rule | Read / Write |
gchar * | clip-path | Write |
gchar * | fill-color | Write |
GdkRGBA * | fill-color-gdk-rgba | Read / Write |
guint | fill-color-rgba | Read / Write |
GooCairoPattern * | fill-pattern | Read / Write |
GdkPixbuf * | fill-pixbuf | Write |
GooCairoFillRule | fill-rule | Read / Write |
gchar * | font | Read / Write |
PangoFontDescription * | font-desc | Read / Write |
GooCairoHintMetrics | hint-metrics | Read / Write |
GooCairoLineCap | line-cap | Read / Write |
GooCanvasLineDash * | line-dash | Read / Write |
GooCairoLineJoin | line-join | Read / Write |
gdouble | line-join-miter-limit | Read / Write |
gdouble | line-width | Read / Write |
GooCairoOperator | operator | Read / Write |
gchar * | stroke-color | Write |
GdkRGBA * | stroke-color-gdk-rgba | Read / Write |
guint | stroke-color-rgba | Read / Write |
GooCairoPattern * | stroke-pattern | Read / Write |
GdkPixbuf * | stroke-pixbuf | Write |
struct | GooCanvasItemSimple |
struct | GooCanvasItemSimpleData |
struct | GooCanvasItemSimpleClass |
GObject ╰── GooCanvasItemSimple ├── GooCanvasWidget ├── GooCanvasRect ├── GooCanvasGroup ├── GooCanvasPath ├── GooCanvasEllipse ├── GooCanvasText ├── GooCanvasPolyline ├── GooCanvasImage ╰── GooCanvasGrid
GooCanvasItemSimple 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 GooCanvasItem methods.
For very simple items, all that is needed is to implement the create_path()
method. (GooCanvasEllipse, GooCanvasRect and GooCanvasPath do this.)
More complicated items need to implement the update()
, paint()
and
is_item_at()
methods instead. (GooCanvasImage, GooCanvasPolyline,
GooCanvasText and GooCanvasWidget do this.) They may also need to
override some of the other GooCanvasItem methods such as set_canvas()
,
set_parent()
or allocate_area()
if special code is needed. (GooCanvasWidget
does this to make sure the GtkWidget is embedded in the GooCanvas widget
correctly.)
void
goo_canvas_item_simple_check_style (GooCanvasItemSimple *item
);
This function is intended to be used by subclasses of GooCanvasItemSimple,
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 GooCanvasStyle it makes sure the parent is set correctly. If it doesn't have its own style it uses the parent item's style.
gdouble
goo_canvas_item_simple_get_line_width (GooCanvasItemSimple *item
);
Gets the item's line width.
void goo_canvas_item_simple_get_path_bounds (GooCanvasItemSimple *item
,cairo_t *cr
,GooCanvasBounds *bounds
);
This function is intended to be used by subclasses of GooCanvasItemSimple,
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 GooCanvasBounds 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_identity_matrix()
to temporarily reset the current
transformation matrix to the identity matrix.
item |
||
cr |
a cairo context. |
|
bounds |
the GooCanvasBounds struct to store the resulting bounding box. |
void goo_canvas_item_simple_user_bounds_to_device (GooCanvasItemSimple *item
,cairo_t *cr
,GooCanvasBounds *bounds
);
This function is intended to be used by subclasses of GooCanvasItemSimple,
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.
void goo_canvas_item_simple_user_bounds_to_parent (GooCanvasItemSimple *item
,cairo_t *cr
,GooCanvasBounds *bounds
);
This function is intended to be used by subclasses of GooCanvasItemSimple,
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.
gboolean goo_canvas_item_simple_check_in_path (GooCanvasItemSimple *item
,gdouble x
,gdouble y
,cairo_t *cr
,GooCanvasPointerEvents pointer_events
);
This function is intended to be used by subclasses of GooCanvasItemSimple.
It checks if the given point is in the current path, using the item's style settings.
void goo_canvas_item_simple_paint_path (GooCanvasItemSimple *item
,cairo_t *cr
);
This function is intended to be used by subclasses of GooCanvasItemSimple.
It paints the current path, using the item's style settings.
void goo_canvas_item_simple_changed (GooCanvasItemSimple *item
,gboolean recompute_bounds
);
This function is intended to be used by subclasses of GooCanvasItemSimple.
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.
void goo_canvas_item_simple_set_model (GooCanvasItemSimple *item
,GooCanvasItemModel *model
);
This function should be called by subclasses of GooCanvasItemSimple
in their set_model()
method.
struct GooCanvasItemSimple { GooCanvas *canvas; GooCanvasItem *parent; GooCanvasItemModelSimple *model; GooCanvasItemSimpleData *simple_data; GooCanvasBounds bounds; guint need_update : 1; guint need_entire_subtree_update : 1; };
The GooCanvasItemSimple struct contains the basic data needed to implement canvas items.
GooCanvas * |
the canvas. |
|
GooCanvasItem * |
the parent item. |
|
GooCanvasItemModelSimple * |
the item's model, if it has one. |
|
GooCanvasItemSimpleData * |
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 GooCanvasItemSimpleData, otherwise the canvas item will have its own GooCanvasItemSimpleData. |
|
GooCanvasBounds |
the bounds of the item, in device space. |
|
if the item needs to recompute its bounds and redraw. |
||
if all descendants need to be updated. |
struct GooCanvasItemSimpleData { GooCanvasStyle *style; cairo_matrix_t *transform; GArray *clip_path_commands; gchar *tooltip; gdouble visibility_threshold; guint visibility : 2; guint pointer_events : 4; guint can_focus : 1; guint own_style : 1; guint clip_fill_rule : 4; guint is_static : 1; };
This is the data common to both the model and view classes.
GooCanvasStyle * |
the style to draw with. |
|
the transformation matrix of the item, or |
||
an array of GooCanvasPathCommand specifying the clip
path of the item, or |
||
the item's tooltip. |
||
the threshold scale setting at which to show the item
(if the |
||
the GooCanvasItemVisibility setting specifying whether the item is visible, invisible, or visible above a given canvas scale setting. |
||
the GooCanvasPointerEvents setting specifying the events the item should receive. |
||
if the item can take the keyboard focus. |
||
if the item has its own style, rather than using its parent's. |
||
the cairo_fill_rule_t setting specifying the fill rule used for the clip path. |
||
if the item is static. |
struct GooCanvasItemSimpleClass { void (* simple_create_path) (GooCanvasItemSimple *simple, cairo_t *cr); void (* simple_update) (GooCanvasItemSimple *simple, cairo_t *cr); void (* simple_paint) (GooCanvasItemSimple *simple, cairo_t *cr, const GooCanvasBounds *bounds); gboolean (* simple_is_item_at) (GooCanvasItemSimple *simple, gdouble x, gdouble y, cairo_t *cr, gboolean is_pointer_event); };
The GooCanvasItemSimpleClass struct contains several methods that subclasses can override.
Simple items need only implement the create_path()
method. More complex
items must override the update()
, paint()
and is_item_at()
methods instead.
simple subclasses that draw basic shapes and paths only
need to override this one method. It creates the path for the item.
All updating, painting and hit-testing is provided automatically by the
GooCanvasItemSimple class. (This method is used by the builtin
GooCanvasEllipse, GooCanvasRect and GooCanvasPath items.)
More complicated subclasses must override |
||
subclasses should override this to calculate their new bounds, in user space. |
||
subclasses should override this to paint their item. |
||
subclasses should override this to do hit-testing. |
“antialias”
property“antialias” GooCairoAntialias
The antialiasing mode to use.
Flags: Read / Write
Default value: CAIRO_ANTIALIAS_GRAY
“clip-fill-rule”
property“clip-fill-rule” GooCairoFillRule
The fill rule used to determine which parts of the item are clipped.
Flags: Read / Write
Default value: CAIRO_FILL_RULE_WINDING
“clip-path”
property “clip-path” gchar *
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.
Flags: Write
Default value: NULL
“fill-color”
property “fill-color” gchar *
The color to use to paint the interior of the item. To disable painting set the 'fill-pattern' property to NULL.
Flags: Write
Default value: NULL
“fill-color-gdk-rgba”
property “fill-color-gdk-rgba” GdkRGBA *
The color to use to paint the interior of the item, specified as a GdkRGBA. To disable painting set the 'fill-pattern' property to NULL.
Flags: Read / Write
Since: 2.0.1
“fill-color-rgba”
property “fill-color-rgba” guint
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 NULL.
Flags: Read / Write
Default value: 0
“fill-pattern”
property“fill-pattern” GooCairoPattern *
The pattern to use to paint the interior of the item, or NULL to disable painting.
Flags: Read / Write
“fill-pixbuf”
property “fill-pixbuf” GdkPixbuf *
The pixbuf to use to paint the interior of the item. To disable painting set the 'fill-pattern' property to NULL.
Flags: Write
“fill-rule”
property“fill-rule” GooCairoFillRule
The fill rule used to determine which parts of the item are filled.
Flags: Read / Write
Default value: CAIRO_FILL_RULE_WINDING
“font”
property “font” gchar *
The base font to use for the text.
Flags: Read / Write
Default value: NULL
“font-desc”
property “font-desc” PangoFontDescription *
The attributes specifying which font to use.
Flags: Read / Write
“hint-metrics”
property“hint-metrics” GooCairoHintMetrics
The hinting to be used for font metrics.
Flags: Read / Write
Default value: CAIRO_HINT_METRICS_OFF
“line-cap”
property“line-cap” GooCairoLineCap
The line cap style to use.
Flags: Read / Write
Default value: CAIRO_LINE_CAP_BUTT
“line-dash”
property“line-dash” GooCanvasLineDash *
The dash pattern to use.
Flags: Read / Write
“line-join”
property“line-join” GooCairoLineJoin
The line join style to use.
Flags: Read / Write
Default value: CAIRO_LINE_JOIN_MITER
“line-join-miter-limit”
property “line-join-miter-limit” gdouble
The smallest angle to use with miter joins, in degrees. Bevel joins will be used below this limit.
Flags: Read / Write
Allowed values: >= 0
Default value: 10
“line-width”
property “line-width” gdouble
The line width to use for the item's perimeter.
Flags: Read / Write
Allowed values: >= 0
Default value: 2
“operator”
property“operator” GooCairoOperator
The compositing operator to use.
Flags: Read / Write
Default value: CAIRO_OPERATOR_OVER
“stroke-color”
property “stroke-color” gchar *
The color to use for the item's perimeter. To disable painting set the 'stroke-pattern' property to NULL.
Flags: Write
Default value: NULL
“stroke-color-gdk-rgba”
property “stroke-color-gdk-rgba” GdkRGBA *
The color to use for the item's perimeter, specified as a GdkRGBA. To disable painting set the 'stroke-pattern' property to NULL.
Flags: Read / Write
Since: 2.0.1
“stroke-color-rgba”
property “stroke-color-rgba” guint
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 NULL.
Flags: Read / Write
Default value: 0
“stroke-pattern”
property“stroke-pattern” GooCairoPattern *
The pattern to use to paint the perimeter of the item, or NULL disable painting.
Flags: Read / Write