Top |
gboolean | can-focus | Read / Write |
gchar * | description | Read / Write |
GooCanvasItemModel * | parent | Read / Write |
GooCanvasPointerEvents | pointer-events | Read / Write |
gchar * | title | Read / Write |
gchar * | tooltip | Read / Write |
GooCairoMatrix * | transform | Read / Write |
GooCanvasItemVisibility | visibility | Read / Write |
gdouble | visibility-threshold | Read / Write |
void | animation-finished | Run Last |
void | changed | Run Last |
void | child-added | Run Last |
void | child-moved | Run Last |
void | child-notify | No Hooks |
void | child-removed | Run Last |
GooCanvasItemModel is implemented by GooCanvasEllipseModel, GooCanvasGridModel, GooCanvasGroupModel, GooCanvasImageModel, GooCanvasItemModelSimple, GooCanvasPathModel, GooCanvasPolylineModel, GooCanvasRectModel, GooCanvasTableModel and GooCanvasTextModel.
GooCanvasItemModel defines the interface that models for canvas items must implement, and contains methods for operating on canvas item models.
The Model/View canvas feature may be removed in a future version of GooCanvas.
void goo_canvas_item_model_translate (GooCanvasItemModel *model
,gdouble tx
,gdouble ty
);
Translates the origin of the model's coordinate system by the given amounts.
void goo_canvas_item_model_scale (GooCanvasItemModel *model
,gdouble sx
,gdouble sy
);
Scales the model's coordinate system by the given amounts.
void goo_canvas_item_model_rotate (GooCanvasItemModel *model
,gdouble degrees
,gdouble cx
,gdouble cy
);
Rotates the model's coordinate system by the given amount, about the given origin.
void goo_canvas_item_model_skew_x (GooCanvasItemModel *model
,gdouble degrees
,gdouble cx
,gdouble cy
);
Skews the model's coordinate system along the x axis by the given amount, about the given origin.
void goo_canvas_item_model_skew_y (GooCanvasItemModel *model
,gdouble degrees
,gdouble cx
,gdouble cy
);
Skews the model's coordinate system along the y axis by the given amount, about the given origin.
gboolean goo_canvas_item_model_get_transform (GooCanvasItemModel *model
,cairo_matrix_t *transform
);
Gets the transformation matrix of an item model.
void goo_canvas_item_model_set_transform (GooCanvasItemModel *model
,const cairo_matrix_t *transform
);
Sets the transformation matrix of an item model.
gboolean goo_canvas_item_model_get_simple_transform (GooCanvasItemModel *model
,gdouble *x
,gdouble *y
,gdouble *scale
,gdouble *rotation
);
This function can be used to get the position, scale and rotation of an
item model, providing that the model has a simple transformation matrix
(e.g. set with goo_canvas_item_model_set_simple_transform()
, or using a
combination of simple translate, scale and rotate operations). If the model
has a complex transformation matrix the results will be incorrect.
void goo_canvas_item_model_set_simple_transform (GooCanvasItemModel *model
,gdouble x
,gdouble y
,gdouble scale
,gdouble rotation
);
A convenience function to set the item model's transformation matrix.
void goo_canvas_item_model_animate (GooCanvasItemModel *model
,gdouble x
,gdouble y
,gdouble scale
,gdouble degrees
,gboolean absolute
,gint duration
,gint step_time
,GooCanvasAnimateType type
);
Animates a model from its current position to the given offsets, scale and rotation.
model |
an item model. |
|
x |
the final x coordinate. |
|
y |
the final y coordinate. |
|
scale |
the final scale. |
|
degrees |
the final rotation. This can be negative to rotate anticlockwise, and can also be greater than 360 to rotate a number of times. |
|
absolute |
if the |
|
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_model_stop_animation (GooCanvasItemModel *model
);
Stops any current animation for the given model, leaving it at its current position.
void goo_canvas_item_model_raise (GooCanvasItemModel *model
,GooCanvasItemModel *above
);
Raises a model in the stacking order.
void goo_canvas_item_model_lower (GooCanvasItemModel *model
,GooCanvasItemModel *below
);
Lowers a model in the stacking order.
void
goo_canvas_item_model_remove (GooCanvasItemModel *model
);
Removes a model from its parent. If the model is in a canvas it will be removed.
This would normally also result in the model being freed.
GooCanvasItemModel *
goo_canvas_item_model_get_parent (GooCanvasItemModel *model
);
Gets the parent of the given model.
void goo_canvas_item_model_set_parent (GooCanvasItemModel *model
,GooCanvasItemModel *parent
);
This function is only intended to be used when implementing new canvas item models (specifically container models such as GooCanvasGroupModel). It sets the parent of the child model.
This function cannot be used to add a model to a group or to change the parent of a model. To do that use the “parent” property.
gboolean
goo_canvas_item_model_is_container (GooCanvasItemModel *model
);
Tests to see if the given item model is a container.
gint
goo_canvas_item_model_get_n_children (GooCanvasItemModel *model
);
Gets the number of children of the container.
GooCanvasItemModel * goo_canvas_item_model_get_child (GooCanvasItemModel *model
,gint child_num
);
Gets the child at the given stack position.
void goo_canvas_item_model_add_child (GooCanvasItemModel *model
,GooCanvasItemModel *child
,gint position
);
Adds a child at the given stack position.
void goo_canvas_item_model_move_child (GooCanvasItemModel *model
,gint old_position
,gint new_position
);
Moves a child to a new stack position.
void goo_canvas_item_model_remove_child (GooCanvasItemModel *model
,gint child_num
);
Removes the child at the given position.
gint goo_canvas_item_model_find_child (GooCanvasItemModel *model
,GooCanvasItemModel *child
);
Attempts to find the given child with the container's stack.
GooCanvasStyle *
goo_canvas_item_model_get_style (GooCanvasItemModel *model
);
Gets the model's style. If the model doesn't have its own style it will return its parent's style.
void goo_canvas_item_model_set_style (GooCanvasItemModel *model
,GooCanvasStyle *style
);
Sets the model's style, by copying the properties from the given style.
void goo_canvas_item_model_class_install_child_property (GObjectClass *mclass
,guint property_id
,GParamSpec *pspec
);
This function is only intended to be used when implementing new canvas item models, specifically layout container item models such as GooCanvasTableModel.
It installs a child property on a canvas item class.
GParamSpec ** goo_canvas_item_model_class_list_child_properties (GObjectClass *mclass
,guint *n_properties
);
This function is only intended to be used when implementing new canvas item models, specifically layout container item models such as GooCanvasTableModel.
It returns all child properties of a canvas item class.
GParamSpec * goo_canvas_item_model_class_find_child_property (GObjectClass *mclass
,const gchar *property_name
);
This function is only intended to be used when implementing new canvas item models, specifically layout container item models such as GooCanvasTableModel.
It finds a child property of a canvas item class by name.
void goo_canvas_item_model_get_child_property (GooCanvasItemModel *model
,GooCanvasItemModel *child
,const gchar *property_name
,GValue *value
);
Gets a child property of child
.
model |
||
child |
a child GooCanvasItemModel. |
|
property_name |
the name of the child property to get. |
|
value |
a location to return the value. |
void goo_canvas_item_model_set_child_property (GooCanvasItemModel *model
,GooCanvasItemModel *child
,const gchar *property_name
,const GValue *value
);
Sets a child property of child
.
model |
||
child |
a child GooCanvasItemModel. |
|
property_name |
the name of the child property to set. |
|
value |
the value to set the property to. |
void goo_canvas_item_model_get_child_properties (GooCanvasItemModel *model
,GooCanvasItemModel *child
,...
);
Gets the values of one or more child properties of child
.
model |
||
child |
a child GooCanvasItemModel. |
|
... |
pairs of property names and value pointers, and a terminating |
void goo_canvas_item_model_get_child_properties_valist (GooCanvasItemModel *model
,GooCanvasItemModel *child
,va_list var_args
);
Gets the values of one or more child properties of child
.
model |
||
child |
a child GooCanvasItemModel. |
|
var_args |
pairs of property names and value pointers, and a terminating
|
void goo_canvas_item_model_set_child_properties (GooCanvasItemModel *model
,GooCanvasItemModel *child
,...
);
Sets the values of one or more child properties of child
.
model |
||
child |
a child GooCanvasItemModel. |
|
... |
pairs of property names and values, and a terminating |
void goo_canvas_item_model_set_child_properties_valist (GooCanvasItemModel *model
,GooCanvasItemModel *child
,va_list var_args
);
Sets the values of one or more child properties of child
.
model |
||
child |
a child GooCanvasItemModel. |
|
var_args |
pairs of property names and values, and a terminating |
typedef struct _GooCanvasItemModel GooCanvasItemModel;
GooCanvasItemModel is a typedef used for objects that implement the GooCanvasItemModel interface.
(There is no actual GooCanvasItemModel struct, since it is only an interface. But using 'GooCanvasItemModel' is more helpful than using 'GObject'.)
struct GooCanvasItemModelIface { /* Virtual methods that group models must implement. */ gint (* get_n_children) (GooCanvasItemModel *model); GooCanvasItemModel* (* get_child) (GooCanvasItemModel *model, gint child_num); /* Virtual methods that group models may implement. */ void (* add_child) (GooCanvasItemModel *model, GooCanvasItemModel *child, gint position); void (* move_child) (GooCanvasItemModel *model, gint old_position, gint new_position); void (* remove_child) (GooCanvasItemModel *model, gint child_num); void (* get_child_property) (GooCanvasItemModel *model, GooCanvasItemModel *child, guint property_id, GValue *value, GParamSpec *pspec); void (* set_child_property) (GooCanvasItemModel *item, GooCanvasItemModel *child, guint property_id, const GValue *value, GParamSpec *pspec); /* Virtual methods that all item models must implement. */ GooCanvasItemModel* (* get_parent) (GooCanvasItemModel *model); void (* set_parent) (GooCanvasItemModel *model, GooCanvasItemModel *parent); GooCanvasItem* (* create_item) (GooCanvasItemModel *model, GooCanvas *canvas); /* Virtual methods that all item models may implement. */ gboolean (* get_transform) (GooCanvasItemModel *model, cairo_matrix_t *transform); void (* set_transform) (GooCanvasItemModel *model, const cairo_matrix_t *transform); GooCanvasStyle* (* get_style) (GooCanvasItemModel *model); void (* set_style) (GooCanvasItemModel *model, GooCanvasStyle *style); /* Signals. */ void (* child_added) (GooCanvasItemModel *model, gint child_num); void (* child_moved) (GooCanvasItemModel *model, gint old_child_num, gint new_child_num); void (* child_removed) (GooCanvasItemModel *model, gint child_num); void (* changed) (GooCanvasItemModel *model, gboolean recompute_bounds); void (* child_notify) (GooCanvasItemModel *model, GParamSpec *pspec); void (* animation_finished) (GooCanvasItemModel *model, gboolean stopped); };
GooCanvasItemModelIFace holds the virtual methods that make up the GooCanvasItemModel interface.
Simple item models only need to implement the get_parent()
, set_parent()
and create_item()
methods.
Items that support transforms should also implement get_transform()
and
set_transform()
. Items that support styles should implement get_style()
and set_style()
.
Container items must implement get_n_children()
and get_child()
.
Containers that support dynamic changes to their children should implement
add_child()
, move_child()
and remove_child()
.
Layout containers like GooCanvasTable may implement
get_child_property()
and set_child_property()
.
returns the number of children of the model. |
||
returns the child at the given index. |
||
adds a child. |
||
moves a child up or down the stacking order. |
||
removes a child. |
||
gets a child property of a given child model, e.g. the "row" or "column" property of a model in a GooCanvasTableModel. |
||
sets a child property for a given child model. |
||
gets the model's parent. |
||
sets the model's parent. |
||
creates a default canvas item to view the model. |
||
gets the model's transformation matrix. |
||
sets the model's transformation matrix. |
||
gets the model's style. |
||
sets the model's style. |
||
signal emitted when a child is added. |
||
signal emitted when a child is moved in the stacking order. |
||
signal emitted when a child is removed. |
||
signal emitted when the model has changed. |
||
signal emitted when a child property has changed. |
||
signal emitted when the model's animation has finished. |
“can-focus”
property “can-focus” gboolean
If the item can take the keyboard focus.
Flags: Read / Write
Default value: FALSE
“description”
property “description” gchar *
A description of the item for use by assistive technologies.
Flags: Read / Write
Default value: NULL
“pointer-events”
property“pointer-events” GooCanvasPointerEvents
Specifies when the item receives pointer events.
Flags: Read / Write
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” gchar *
A short context-rich description of the item for use by assistive technologies.
Flags: Read / Write
Default value: NULL
“tooltip”
property “tooltip” gchar *
The tooltip to display for the item.
Flags: Read / Write
Default value: NULL
“transform”
property“transform” GooCairoMatrix *
The transformation matrix of the item.
Flags: Read / Write
“visibility”
property“visibility” GooCanvasItemVisibility
When the canvas item is visible.
Flags: Read / Write
Default value: GOO_CANVAS_ITEM_VISIBLE
“animation-finished”
signalvoid user_function (GooCanvasItemModel *item, gboolean stopped, gpointer user_data)
Emitted when the item model animation has finished.
item |
the item model that received the signal. |
|
stopped |
if the animation was explicitly stopped. |
|
user_data |
user data set when the signal handler was connected. |
Flags: Run Last
“changed”
signalvoid user_function (GooCanvasItemModel *model, gboolean recompute_bounds, gpointer user_data)
Emitted when the item model has been changed.
model |
the item model 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. |
Flags: Run Last
“child-added”
signalvoid user_function (GooCanvasItemModel *model, gint child_num, gpointer user_data)
Emitted when a child has been added.
model |
the item model that received the signal. |
|
child_num |
the index of the new child. |
|
user_data |
user data set when the signal handler was connected. |
Flags: Run Last
“child-moved”
signalvoid user_function (GooCanvasItemModel *model, gint old_child_num, gint new_child_num, gpointer user_data)
Emitted when a child has been moved in the stacking order.
model |
the item model 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. |
Flags: Run Last
“child-notify”
signalvoid user_function (GooCanvasItemModel *item, GParamSpec *pspec, gpointer user_data)
Emitted for each child property that has changed. The signal's detail holds the property name.
item |
the item model that received the signal. |
|
pspec |
the GParamSpec of the changed child property. |
[type GObject.ParamSpec] |
user_data |
user data set when the signal handler was connected. |
Flags: No Hooks
“child-removed”
signalvoid user_function (GooCanvasItemModel *model, gint child_num, gpointer user_data)
Emitted when a child has been removed.
model |
the item model 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. |
Flags: Run Last