![]() |
![]() |
![]() |
GooCanvas Reference Manual | ![]() |
---|---|---|---|---|
#include <goocanvas.h> GooCanvasItem; GooCanvasItemIface; GooCanvasItem* goo_canvas_item_new (GooCanvasItem *parent, GType type, const gchar *first_property, ...); GooCanvasModel* goo_canvas_item_get_model (GooCanvasItem *item); GooCanvasItem* goo_canvas_item_get_parent (GooCanvasItem *item); void goo_canvas_item_set_parent (GooCanvasItem *item, GooCanvasItem *parent); gboolean goo_canvas_item_is_container (GooCanvasItem *item); gint goo_canvas_item_get_n_children (GooCanvasItem *group); GooCanvasItem* goo_canvas_item_get_child (GooCanvasItem *group, gint child_num); gint goo_canvas_item_find_child (GooCanvasItem *group, GooCanvasItem *child); void goo_canvas_item_add_child (GooCanvasItem *group, GooCanvasItem *item, gint position); void goo_canvas_item_move_child (GooCanvasItem *group, gint old_position, gint new_position); void goo_canvas_item_remove_child (GooCanvasItem *group, gint child_num); void goo_canvas_item_raise (GooCanvasItem *item, GooCanvasItem *above); void goo_canvas_item_lower (GooCanvasItem *item, GooCanvasItem *below); cairo_matrix_t* goo_canvas_item_get_transform (GooCanvasItem *item); void goo_canvas_item_set_transform (GooCanvasItem *item, cairo_matrix_t *matrix); void goo_canvas_item_translate (GooCanvasItem *item, double tx, double ty); void goo_canvas_item_scale (GooCanvasItem *item, double sx, double sy); void goo_canvas_item_rotate (GooCanvasItem *item, double degrees, double cx, double cy); void goo_canvas_item_skew_x (GooCanvasItem *item, double degrees, double cx, double cy); void goo_canvas_item_skew_y (GooCanvasItem *item, double degrees, double cx, double cy); void goo_canvas_item_animate (GooCanvasItem *item, double x, double y, double scale, double degrees, gint duration, gint step_time, GooCanvasAnimateType type); void goo_canvas_item_stop_animation (GooCanvasItem *item);
GooCanvasItem is implemented by GooCanvasRect, GooCanvasEllipse, GooCanvasPath, GooCanvasPolyline, GooCanvasText, GooCanvasImage, GooCanvasGroup and GooCanvasItemSimple.
"description" gchararray : Read / Write "pointer-events" GooCanvasPointerEvents : Read / Write "title" gchararray : Read / Write "transform" GooCairoMatrix : Read / Write "visibility" GooCanvasItemVisibility : Read / Write "visibility-threshold" gdouble : Read / Write
"changed" void user_function (GooCanvasItem *item, gboolean recompute_bounds, gpointer user_data) : Run last "child-added" void user_function (GooCanvasItem *item, gint child_num, gpointer user_data) : Run last "child-moved" void user_function (GooCanvasItem *item, gint old_child_num, gint new_child_num, gpointer user_data) : Run last "child-removed" void user_function (GooCanvasItem *item, gint child_num, gpointer user_data) : Run last
GooCanvasItem defines the interface that canvas items must implement, and contains methods for operating on canvas items.
typedef struct _GooCanvasItem GooCanvasItem;
GooCanvasItem is a typedef used for objects that implement the GooCanvasItem interface.
(There is no actual GooCanvasItem struct, since it is only an interface. But using 'GooCanvasItem' is more helpful than using 'GObject'.)
typedef struct { /* Virtual methods that group items must implement. */ GooCanvasModel* (* get_model) (GooCanvasItem *item); gint (* get_n_children) (GooCanvasItem *group); GooCanvasItem* (* get_child) (GooCanvasItem *group, gint child_num); /* Virtual methods that group items may implement. */ void (* add_child) (GooCanvasItem *group, GooCanvasItem *child, gint position); void (* move_child) (GooCanvasItem *group, gint old_position, gint new_position); void (* remove_child) (GooCanvasItem *group, gint child_num); /* Virtual methods that all canvas items must implement. */ GooCanvasItem* (* get_parent) (GooCanvasItem *item); void (* set_parent) (GooCanvasItem *item, GooCanvasItem *parent); cairo_matrix_t* (* get_transform) (GooCanvasItem *item); void (* set_transform) (GooCanvasItem *item, cairo_matrix_t *matrix); GooCanvasItemView* (* create_view) (GooCanvasItem *item, GooCanvasView *canvas_view, GooCanvasItemView *parent_view); /* Signals. */ void (* child_added) (GooCanvasItem *item, gint child_num); void (* child_moved) (GooCanvasItem *item, gint old_child_num, gint new_child_num); void (* child_removed) (GooCanvasItem *item, gint child_num); void (* changed) (GooCanvasItem *item, gboolean recompute_bounds); } GooCanvasItemIface;
GooCanvasItemIFace holds the virtual methods that make up the GooCanvasItem interface.
GooCanvasItem* goo_canvas_item_new (GooCanvasItem *parent, GType type, const gchar *first_property, ...);
Creates a new canvas item.
parent : |
the parent item, or NULL . If a parent is specified, it will assume
ownership of the item, and the item will automatically be freed when it is
removed from the parent. Otherwise call g_object_unref() to free it.
|
type : |
the type of the item to create. |
first_property : |
the name of the first property to set, or NULL .
|
... : |
the remaining property names and values to set, terminated with a
NULL .
|
Returns : | a new canvas item. |
GooCanvasModel* goo_canvas_item_get_model (GooCanvasItem *item);
Gets the canvas model containing the given item.
item : |
an item. |
Returns : | the canvas model, or NULL of the item isn't in a model.
|
GooCanvasItem* goo_canvas_item_get_parent (GooCanvasItem *item);
Gets the parent of the given item.
item : |
an item. |
Returns : | the parent item, or NULL if the item has no parent.
|
void goo_canvas_item_set_parent (GooCanvasItem *item, GooCanvasItem *parent);
Sets the parent of the item.
item : |
an item. |
parent : |
the new parent item. |
gboolean goo_canvas_item_is_container (GooCanvasItem *item);
Tests to see if the given item is a container.
item : |
an item. |
Returns : | TRUE if the item is a container.
|
gint goo_canvas_item_get_n_children (GooCanvasItem *group);
Gets the number of children of the container.
group : |
a container item. |
Returns : | the number of children. |
GooCanvasItem* goo_canvas_item_get_child (GooCanvasItem *group, gint child_num);
Gets the child item at the given stack position.
group : |
a container item. |
child_num : |
the position of a child in the container's stack. |
Returns : | the child item at the given stack position. |
gint goo_canvas_item_find_child (GooCanvasItem *group, GooCanvasItem *child);
Attempts to find the given child item with the container's stack.
group : |
a container item. |
child : |
the child item to find. |
Returns : | the position of the given child item, or -1 if it isn't found.
|
void goo_canvas_item_add_child (GooCanvasItem *group, GooCanvasItem *item, gint position);
Adds a child item to a container item at the given stack position.
group : |
the container to add the item to. |
item : |
the item to add. |
position : |
the position of the item, or -1 to place it last (at the top of the stacking order). |
void goo_canvas_item_move_child (GooCanvasItem *group, gint old_position, gint new_position);
Moves a child item to a new stack position within the container.
group : |
a container item. |
old_position : |
the current position of the child item. |
new_position : |
the new position of the child item. |
void goo_canvas_item_remove_child (GooCanvasItem *group, gint child_num);
Removes the child item at the given position.
group : |
a container item. |
child_num : |
the position of the child item to remove. |
void goo_canvas_item_raise (GooCanvasItem *item, GooCanvasItem *above);
Raises an item in the stacking order.
item : |
an item. |
above : |
the item to raise item above, or NULL to raise item to the top
of the stack.
|
void goo_canvas_item_lower (GooCanvasItem *item, GooCanvasItem *below);
Lowers an item in the stacking order.
item : |
an item. |
below : |
the item to lower item below, or NULL to lower item to the
bottom of the stack.
|
cairo_matrix_t* goo_canvas_item_get_transform (GooCanvasItem *item);
Gets the transformation matrix of an item.
item : |
an item. |
Returns : | the item's transformation matrix. |
void goo_canvas_item_set_transform (GooCanvasItem *item, cairo_matrix_t *matrix);
Sets the transformation matrix of an item.
item : |
an item. |
matrix : |
the new transformation matrix, or NULL to reset the
transformation to the identity matrix.
|
void goo_canvas_item_translate (GooCanvasItem *item, double tx, double ty);
Translates the origin of the item's coordinate system by the given amounts.
item : |
an item. |
tx : |
the amount to move the origin in the horizontal direction. |
ty : |
the amount to move the origin in the vertical direction. |
void goo_canvas_item_scale (GooCanvasItem *item, double sx, double sy);
Scales the item's coordinate system by the given amounts.
item : |
an item. |
sx : |
the amount to scale the horizontal axis. |
sy : |
the amount to scale the vertical axis. |
void goo_canvas_item_rotate (GooCanvasItem *item, double degrees, double cx, double cy);
Rotates the item's coordinate system by the given amount, about the given origin.
item : |
an item. |
degrees : |
the clockwise angle of rotation. |
cx : |
the x coordinate of the origin of the rotation. |
cy : |
the y coordinate of the origin of the rotation. |
void goo_canvas_item_skew_x (GooCanvasItem *item, double degrees, double cx, double cy);
Skews the item's coordinate system along the x axis by the given amount, about the given origin.
item : |
an item. |
degrees : |
the skew angle. |
cx : |
the x coordinate of the origin of the skew transform. |
cy : |
the y coordinate of the origin of the skew transform. |
void goo_canvas_item_skew_y (GooCanvasItem *item, double degrees, double cx, double cy);
Skews the item's coordinate system along the y axis by the given amount, about the given origin.
item : |
an item. |
degrees : |
the skew angle. |
cx : |
the x coordinate of the origin of the skew transform. |
cy : |
the y coordinate of the origin of the skew transform. |
void goo_canvas_item_animate (GooCanvasItem *item, double x, double y, double scale, double degrees, gint duration, gint step_time, GooCanvasAnimateType type);
Animates an item from its current position to the given offsets, scale and rotation.
item : |
an item. |
x : |
the final x offset from the current position. |
y : |
the final y offset from the current position. |
scale : |
the final scale of the item. |
degrees : |
the final rotation of the item. |
duration : |
the duration of the animation, in milliseconds (1/1000ths of a second). |
step_time : |
the time between each animation step, in milliseconds. |
type : |
specifies what happens when the animation finishes. |
void goo_canvas_item_stop_animation (GooCanvasItem *item);
Stops any current animation for the given item, leaving it at its current position.
item : |
an item. |
description
" property"description" gchararray : Read / Write
A description of the item for use by assistive technologies.
Default value: NULL
pointer-events
" property"pointer-events" GooCanvasPointerEvents : Read / Write
Specifies when the item receives pointer events.
Default value: GOO_CANVAS_EVENTS_VISIBLE_MASK|GOO_CANVAS_EVENTS_PAINTED_MASK|GOO_CANVAS_EVENTS_FILL_MASK|GOO_CANVAS_EVENTS_STROKE_MASK
title
" property"title" gchararray : Read / Write
A short context-rich description of the item for use by assistive technologies.
Default value: NULL
transform
" property"transform" GooCairoMatrix : Read / Write
The transformation matrix of the item.
visibility
" property"visibility" GooCanvasItemVisibility : Read / Write
When the canvas item is visible.
Default value: GOO_CANVAS_ITEM_VISIBLE
void user_function (GooCanvasItem *item, gboolean recompute_bounds, gpointer user_data) : Run last
Emitted when the item has been changed.
item : |
the item that received the signal. |
recompute_bounds : |
if the bounds of the item need to be recomputed. |
user_data : |
user data set when the signal handler was connected. |
void user_function (GooCanvasItem *item, gint child_num, gpointer user_data) : Run last
Emitted when a child has been added to the container item.
item : |
the item that received the signal. |
child_num : |
the index of the new child. |
user_data : |
user data set when the signal handler was connected. |
void user_function (GooCanvasItem *item, gint old_child_num, gint new_child_num, gpointer user_data) : Run last
Emitted when a child has been moved in the stacking order of a container item.
item : |
the item that received the signal. |
old_child_num : |
the old index of the child. |
new_child_num : |
the new index of the child. |
user_data : |
user data set when the signal handler was connected. |
void user_function (GooCanvasItem *item, gint child_num, gpointer user_data) : Run last
Emitted when a child has been removed from the container item.
item : |
the item that received the signal. |
child_num : |
the index of the child that was removed. |
user_data : |
user data set when the signal handler was connected. |