[cairo-commit] goocanvas/src goocanvasitem.c, 1.14,
1.15 goocanvasitem.h, 1.9, 1.10 goocanvasitemmodel.c, 1.4,
1.5 goocanvasitemmodel.h, 1.2, 1.3 goocanvasitemsimple.c, 1.18,
1.19 goocanvasitemsimple.h, 1.14, 1.15 goocanvasstyle.c, 1.3,
1.4 goocanvasutils.h, 1.9, 1.10
Damon Chaplin
commit at pdx.freedesktop.org
Thu Feb 8 09:54:31 PST 2007
Committed by: damon
Update of /cvs/cairo/goocanvas/src
In directory kemper:/tmp/cvs-serv644/src
Modified Files:
goocanvasitem.c goocanvasitem.h goocanvasitemmodel.c
goocanvasitemmodel.h goocanvasitemsimple.c
goocanvasitemsimple.h goocanvasstyle.c goocanvasutils.h
Log Message:
2007-02-08 Damon Chaplin <damon at gnome.org>
* */*: more documentation updates. It is 100% complete now, though it
still needs docs on the optional model/view split and creating new
items.
Index: goocanvasitem.c
===================================================================
RCS file: /cvs/cairo/goocanvas/src/goocanvasitem.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- goocanvasitem.c 4 Feb 2007 18:02:30 -0000 1.14
+++ goocanvasitem.c 8 Feb 2007 17:54:26 -0000 1.15
@@ -115,12 +115,12 @@
/**
* GooCanvasItem::enter-notify-event
- * @view: the item view that received the signal.
- * @target_view: the target of the event.
+ * @item: the item that received the signal.
+ * @target_item: the target of the event.
* @event: the event data, with coordinates translated to canvas
* coordinates.
*
- * Emitted when the mouse enters an item view.
+ * Emitted when the mouse enters an item.
*
* Returns: %TRUE to stop the signal emission, or %FALSE to let it
* continue.
@@ -139,12 +139,12 @@
/**
* GooCanvasItem::leave-notify-event
- * @view: the item view that received the signal.
- * @target_view: the target of the event.
+ * @item: the item that received the signal.
+ * @target_item: the target of the event.
* @event: the event data, with coordinates translated to canvas
* coordinates.
*
- * Emitted when the mouse leaves an item view.
+ * Emitted when the mouse leaves an item.
*
* Returns: %TRUE to stop the signal emission, or %FALSE to let it
* continue.
@@ -163,12 +163,12 @@
/**
* GooCanvasItem::motion-notify-event
- * @view: the item view that received the signal.
- * @target_view: the target of the event.
+ * @item: the item that received the signal.
+ * @target_item: the target of the event.
* @event: the event data, with coordinates translated to canvas
* coordinates.
*
- * Emitted when the mouse moves within an item view.
+ * Emitted when the mouse moves within an item.
*
* Returns: %TRUE to stop the signal emission, or %FALSE to let it
* continue.
@@ -187,12 +187,12 @@
/**
* GooCanvasItem::button-press-event
- * @view: the item view that received the signal.
- * @target_view: the target of the event.
+ * @item: the item that received the signal.
+ * @target_item: the target of the event.
* @event: the event data, with coordinates translated to canvas
* coordinates.
*
- * Emitted when a mouse button is pressed in an item view.
+ * Emitted when a mouse button is pressed in an item.
*
* Returns: %TRUE to stop the signal emission, or %FALSE to let it
* continue.
@@ -211,12 +211,12 @@
/**
* GooCanvasItem::button-release-event
- * @view: the item view that received the signal.
- * @target_view: the target of the event.
+ * @item: the item that received the signal.
+ * @target_item: the target of the event.
* @event: the event data, with coordinates translated to canvas
* coordinates.
*
- * Emitted when a mouse button is released in an item view.
+ * Emitted when a mouse button is released in an item.
*
* Returns: %TRUE to stop the signal emission, or %FALSE to let it
* continue.
@@ -238,8 +238,8 @@
/**
* GooCanvasItem::focus-in-event
- * @view: the item view that received the signal.
- * @target_view: the target of the event.
+ * @item: the item that received the signal.
+ * @target_item: the target of the event.
* @event: the event data.
*
* Emitted when the item receives the keyboard focus.
@@ -261,8 +261,8 @@
/**
* GooCanvasItem::focus-out-event
- * @view: the item view that received the signal.
- * @target_view: the target of the event.
+ * @item: the item that received the signal.
+ * @target_item: the target of the event.
* @event: the event data.
*
* Emitted when the item loses the keyboard focus.
@@ -284,11 +284,11 @@
/**
* GooCanvasItem::key-press-event
- * @view: the item view that received the signal.
- * @target_view: the target of the event.
+ * @item: the item that received the signal.
+ * @target_item: the target of the event.
* @event: the event data.
*
- * Emitted when a key is pressed and the item view has the keyboard
+ * Emitted when a key is pressed and the item has the keyboard
* focus.
*
* Returns: %TRUE to stop the signal emission, or %FALSE to let it
@@ -308,11 +308,11 @@
/**
* GooCanvasItem::key-release-event
- * @view: the item view that received the signal.
- * @target_view: the target of the event.
+ * @item: the item that received the signal.
+ * @target_item: the target of the event.
* @event: the event data.
*
- * Emitted when a key is released and the item view has the keyboard
+ * Emitted when a key is released and the item has the keyboard
* focus.
*
* Returns: %TRUE to stop the signal emission, or %FALSE to let it
@@ -333,11 +333,11 @@
/**
* GooCanvasItem::grab-broken-event
- * @view: the item view that received the signal.
- * @target_view: the target of the event.
+ * @item: the item that received the signal.
+ * @target_item: the target of the event.
* @event: the event data.
*
- * Emitted when the item view's keyboard or pointer grab was lost
+ * Emitted when the item's keyboard or pointer grab was lost
* unexpectedly.
*
* Returns: %TRUE to stop the signal emission, or %FALSE to let it
@@ -360,8 +360,8 @@
* @item: the item that received the signal.
* @pspec: the #GParamSpec of the changed child property.
*
- * The ::child-notify signal is emitted for each child property that has
- * changed on an object. The signal's detail holds the property name.
+ * Emitted for each child property that has changed.
+ * The signal's detail holds the property name.
*/
canvas_item_signals[CHILD_NOTIFY] =
g_signal_new ("child_notify",
@@ -485,7 +485,8 @@
{
GooCanvasItemIface *iface = GOO_CANVAS_ITEM_GET_IFACE (item);
- iface->set_canvas (item, canvas);
+ if (iface->set_canvas)
+ iface->set_canvas (item, canvas);
}
Index: goocanvasitem.h
===================================================================
RCS file: /cvs/cairo/goocanvas/src/goocanvasitem.h,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- goocanvasitem.h 1 Feb 2007 01:19:05 -0000 1.9
+++ goocanvasitem.h 8 Feb 2007 17:54:26 -0000 1.10
@@ -76,9 +76,70 @@
/**
* GooCanvasItemIface
+ * @get_canvas: returns the canvas the item is in.
+ * @set_canvas: sets the canvas the item is in.
+ * @get_n_children: returns the number of children of the item.
+ * @get_child: returns the child at the given index.
+ * @request_update: requests that an update is scheduled.
+ * @add_child: adds a child.
+ * @move_child: moves a child up or down the stacking order.
+ * @remove_child: removes a child.
+ * @get_child_property: gets a child property of a given child item,
+ * e.g. the "row" or "column" property of an item in a #GooCanvasTable.
+ * @set_child_property: sets a child property for a given child item.
+ * @get_transform_for_child: gets the transform used to lay out a given child.
+ * @get_parent: gets the item's parent.
+ * @set_parent: sets the item's parent.
+ * @get_bounds: gets the bounds of the item.
+ * @get_item_at: gets the item at the given point.
+ * @update: updates the item, if needed. It recalculates the bounds of the item
+ * and requests redraws of parts of the canvas if necessary.
+ * @paint: renders the item to the given cairo context.
+ * @get_requested_area: returns the requested area of the item, in its parent's
+ * coordinate space. This is only used for items in layout containers such as
+ * #GooCanvasTable.
+ * @allocate_area: allocates the item's area, in its parent's coordinate space.
+ * The item must recalculate its bounds and request redraws of parts of the
+ * canvas if necessary. This is only used for items in layout containers such
+ * as #GooCanvasTable.
+ * @get_transform: gets the item's transformation matrix.
+ * @set_transform: sets the item's transformation matrix.
+ * @get_style: gets the item's style.
+ * @set_style: sets the item's style.
+ * @is_visible: returns %TRUE if the item is currently visible.
+ * @get_model: gets the model that the canvas item is viewing.
+ * @set_model: sets the model that the canvas item will view.
+ * @enter_notify_event: signal emitted when the mouse enters the item.
+ * @leave_notify_event: signal emitted when the mouse leaves the item.
+ * @motion_notify_event: signal emitted when the mouse moves within the item.
+ * @button_press_event: signal emitted when a mouse button is pressed within
+ * the item.
+ * @button_release_event: signal emitted when a mouse button is released.
+ * @focus_in_event: signal emitted when the item receices the keyboard focus.
+ * @focus_out_event: signal emitted when the item loses the keyboard focus.
+ * @key_press_event: signal emitted when a key is pressed.
+ * @key_release_event: signal emitted when a key is released.
+ * @grab_broken_event: signal emitted when a grab that the item has is lost.
+ * @child_notify: signal emitted when a child property is changed.
*
* #GooCanvasItemIFace holds the virtual methods that make up the
* #GooCanvasItem interface.
+ *
+ * Simple canvas items only need to implement the get_parent(), set_parent(),
+ * get_bounds(), get_item_at(), update() and paint() methods (and also
+ * get_requested_area() and allocate_area() if they are going to be used
+ * inside a layout container like #GooCanvasTable).
+ *
+ * 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_canvas(), set_canvas(),
+ * get_n_children(), get_child() and request_update(). 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(), set_child_property() and
+ * get_transform_for_child().
*/
typedef struct _GooCanvasItemIface GooCanvasItemIface;
@@ -89,116 +150,116 @@
/*< public >*/
/* Virtual methods that group items must implement. */
- GooCanvas* (* get_canvas) (GooCanvasItem *item);
- void (* set_canvas) (GooCanvasItem *item,
- GooCanvas *canvas);
- gint (* get_n_children) (GooCanvasItem *item);
- GooCanvasItem* (* get_child) (GooCanvasItem *item,
- gint child_num);
- void (* request_update) (GooCanvasItem *item);
+ GooCanvas* (* get_canvas) (GooCanvasItem *item);
+ void (* set_canvas) (GooCanvasItem *item,
+ GooCanvas *canvas);
+ gint (* get_n_children) (GooCanvasItem *item);
+ GooCanvasItem* (* get_child) (GooCanvasItem *item,
+ gint child_num);
+ void (* request_update) (GooCanvasItem *item);
/* Virtual methods that group items may implement. */
- void (* add_child) (GooCanvasItem *item,
- GooCanvasItem *child,
- gint position);
- void (* move_child) (GooCanvasItem *item,
- gint old_position,
- gint new_position);
- void (* remove_child) (GooCanvasItem *item,
- gint child_num);
- void (*get_child_property) (GooCanvasItem *item,
- GooCanvasItem *child,
- guint property_id,
- GValue *value,
- GParamSpec *pspec);
- void (*set_child_property) (GooCanvasItem *item,
- GooCanvasItem *child,
- guint property_id,
- const GValue *value,
- GParamSpec *pspec);
- gboolean (* get_transform_for_child) (GooCanvasItem *item,
- GooCanvasItem *child,
- cairo_matrix_t *transform);
+ void (* add_child) (GooCanvasItem *item,
+ GooCanvasItem *child,
+ gint position);
+ void (* move_child) (GooCanvasItem *item,
+ gint old_position,
+ gint new_position);
+ void (* remove_child) (GooCanvasItem *item,
+ gint child_num);
+ void (* get_child_property) (GooCanvasItem *item,
+ GooCanvasItem *child,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec);
+ void (* set_child_property) (GooCanvasItem *item,
+ GooCanvasItem *child,
+ guint property_id,
+ const GValue *value,
+ GParamSpec *pspec);
+ gboolean (* get_transform_for_child) (GooCanvasItem *item,
+ GooCanvasItem *child,
+ cairo_matrix_t *transform);
/* Virtual methods that all canvas items must implement. */
- GooCanvasItem* (* get_parent) (GooCanvasItem *item);
- void (* set_parent) (GooCanvasItem *item,
- GooCanvasItem *parent);
- void (* get_bounds) (GooCanvasItem *item,
- GooCanvasBounds *bounds);
- GooCanvasItem* (* get_item_at) (GooCanvasItem *item,
- gdouble x,
- gdouble y,
- cairo_t *cr,
- gboolean is_pointer_event,
- gboolean parent_is_visible);
- void (* update) (GooCanvasItem *item,
- gboolean entire_tree,
- cairo_t *cr,
- GooCanvasBounds *bounds);
- void (* paint) (GooCanvasItem *item,
- cairo_t *cr,
- GooCanvasBounds *bounds,
- gdouble scale);
+ GooCanvasItem* (* get_parent) (GooCanvasItem *item);
+ void (* set_parent) (GooCanvasItem *item,
+ GooCanvasItem *parent);
+ void (* get_bounds) (GooCanvasItem *item,
+ GooCanvasBounds *bounds);
+ GooCanvasItem* (* get_item_at) (GooCanvasItem *item,
+ gdouble x,
+ gdouble y,
+ cairo_t *cr,
+ gboolean is_pointer_event,
+ gboolean parent_is_visible);
+ void (* update) (GooCanvasItem *item,
+ gboolean entire_tree,
+ cairo_t *cr,
+ GooCanvasBounds *bounds);
+ void (* paint) (GooCanvasItem *item,
+ cairo_t *cr,
+ GooCanvasBounds *bounds,
+ gdouble scale);
- gboolean (* get_requested_area) (GooCanvasItem *item,
- cairo_t *cr,
- GooCanvasBounds *requested_area);
- void (* allocate_area) (GooCanvasItem *item,
- cairo_t *cr,
- GooCanvasBounds *requested_area,
- GooCanvasBounds *allocated_area,
- gdouble x_offset,
- gdouble y_offset);
+ gboolean (* get_requested_area) (GooCanvasItem *item,
+ cairo_t *cr,
+ GooCanvasBounds *requested_area);
+ void (* allocate_area) (GooCanvasItem *item,
+ cairo_t *cr,
+ GooCanvasBounds *requested_area,
+ GooCanvasBounds *allocated_area,
+ gdouble x_offset,
+ gdouble y_offset);
/* Virtual methods that canvas items may implement. */
- cairo_matrix_t* (* get_transform) (GooCanvasItem *item);
- void (* set_transform) (GooCanvasItem *item,
- cairo_matrix_t *matrix);
- GooCanvasStyle* (* get_style) (GooCanvasItem *item);
- void (* set_style) (GooCanvasItem *item,
- GooCanvasStyle *style);
- gboolean (* is_visible) (GooCanvasItem *item);
+ cairo_matrix_t* (* get_transform) (GooCanvasItem *item);
+ void (* set_transform) (GooCanvasItem *item,
+ cairo_matrix_t *matrix);
+ GooCanvasStyle* (* get_style) (GooCanvasItem *item);
+ void (* set_style) (GooCanvasItem *item,
+ GooCanvasStyle *style);
+ gboolean (* is_visible) (GooCanvasItem *item);
/* Virtual methods that model/view items must implement. */
- GooCanvasItemModel* (* get_model) (GooCanvasItem *item);
- void (* set_model) (GooCanvasItem *item,
- GooCanvasItemModel *model);
+ GooCanvasItemModel* (* get_model) (GooCanvasItem *item);
+ void (* set_model) (GooCanvasItem *item,
+ GooCanvasItemModel *model);
/* Signals. */
- gboolean (* enter_notify_event) (GooCanvasItem *item,
- GooCanvasItem *target,
- GdkEventCrossing *event);
- gboolean (* leave_notify_event) (GooCanvasItem *item,
- GooCanvasItem *target,
- GdkEventCrossing *event);
- gboolean (* motion_notify_event) (GooCanvasItem *item,
- GooCanvasItem *target,
- GdkEventMotion *event);
- gboolean (* button_press_event) (GooCanvasItem *item,
- GooCanvasItem *target,
- GdkEventButton *event);
- gboolean (* button_release_event) (GooCanvasItem *item,
- GooCanvasItem *target,
- GdkEventButton *event);
- gboolean (* focus_in_event) (GooCanvasItem *item,
- GooCanvasItem *target,
- GdkEventFocus *event);
- gboolean (* focus_out_event) (GooCanvasItem *item,
- GooCanvasItem *target,
- GdkEventFocus *event);
- gboolean (* key_press_event) (GooCanvasItem *item,
- GooCanvasItem *target,
- GdkEventKey *event);
- gboolean (* key_release_event) (GooCanvasItem *item,
- GooCanvasItem *target,
- GdkEventKey *event);
- gboolean (* grab_broken_event) (GooCanvasItem *item,
- GooCanvasItem *target,
- GdkEventGrabBroken *event);
- void (* child_notify) (GooCanvasItem *item,
- GParamSpec *pspec);
+ gboolean (* enter_notify_event) (GooCanvasItem *item,
+ GooCanvasItem *target,
+ GdkEventCrossing *event);
+ gboolean (* leave_notify_event) (GooCanvasItem *item,
+ GooCanvasItem *target,
+ GdkEventCrossing *event);
+ gboolean (* motion_notify_event) (GooCanvasItem *item,
+ GooCanvasItem *target,
+ GdkEventMotion *event);
+ gboolean (* button_press_event) (GooCanvasItem *item,
+ GooCanvasItem *target,
+ GdkEventButton *event);
+ gboolean (* button_release_event) (GooCanvasItem *item,
+ GooCanvasItem *target,
+ GdkEventButton *event);
+ gboolean (* focus_in_event) (GooCanvasItem *item,
+ GooCanvasItem *target,
+ GdkEventFocus *event);
+ gboolean (* focus_out_event) (GooCanvasItem *item,
+ GooCanvasItem *target,
+ GdkEventFocus *event);
+ gboolean (* key_press_event) (GooCanvasItem *item,
+ GooCanvasItem *target,
+ GdkEventKey *event);
+ gboolean (* key_release_event) (GooCanvasItem *item,
+ GooCanvasItem *target,
+ GdkEventKey *event);
+ gboolean (* grab_broken_event) (GooCanvasItem *item,
+ GooCanvasItem *target,
+ GdkEventGrabBroken *event);
+ void (* child_notify) (GooCanvasItem *item,
+ GParamSpec *pspec);
};
Index: goocanvasitemmodel.c
===================================================================
RCS file: /cvs/cairo/goocanvas/src/goocanvasitemmodel.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- goocanvasitemmodel.c 4 Feb 2007 22:54:26 -0000 1.4
+++ goocanvasitemmodel.c 8 Feb 2007 17:54:26 -0000 1.5
@@ -104,10 +104,10 @@
/**
* GooCanvasItemModel::child-added
- * @model: the item that received the signal.
+ * @model: the item model that received the signal.
* @child_num: the index of the new child.
*
- * Emitted when a child has been added to the container item.
+ * Emitted when a child has been added.
*/
item_model_signals[CHILD_ADDED] =
g_signal_new ("child-added",
@@ -121,12 +121,11 @@
/**
* GooCanvasItemModel::child-moved
- * @model: the item that received the signal.
+ * @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.
*
- * Emitted when a child has been moved in the stacking order of a
- * container item.
+ * Emitted when a child has been moved in the stacking order.
*/
item_model_signals[CHILD_MOVED] =
g_signal_new ("child-moved",
@@ -140,10 +139,10 @@
/**
* GooCanvasItemModel::child-removed
- * @model: the item that received the signal.
+ * @model: the item model that received the signal.
* @child_num: the index of the child that was removed.
*
- * Emitted when a child has been removed from the container item.
+ * Emitted when a child has been removed.
*/
item_model_signals[CHILD_REMOVED] =
g_signal_new ("child-removed",
@@ -157,10 +156,10 @@
/**
* GooCanvasItemModel::changed
- * @model: the item that received the signal.
+ * @model: the item model that received the signal.
* @recompute_bounds: if the bounds of the item need to be recomputed.
*
- * Emitted when the item has been changed.
+ * Emitted when the item model has been changed.
*/
item_model_signals[CHANGED] =
g_signal_new ("changed",
@@ -177,8 +176,8 @@
* @item: the item model that received the signal.
* @pspec: the #GParamSpec of the changed child property.
*
- * The ::child-notify signal is emitted for each child property that has
- * changed on an object. The signal's detail holds the property name.
+ * Emitted for each child property that has changed.
+ * The signal's detail holds the property name.
*/
item_model_signals[CHILD_NOTIFY] =
g_signal_new ("child_notify",
@@ -405,9 +404,9 @@
* goo_canvas_item_model_get_parent:
* @model: an item model.
*
- * Gets the parent of the given item.
+ * Gets the parent of the given model.
*
- * Returns: the parent item, or %NULL if the item has no parent.
+ * Returns: the parent model, or %NULL if the model has no parent.
**/
GooCanvasItemModel*
goo_canvas_item_model_get_parent (GooCanvasItemModel *model)
@@ -419,9 +418,9 @@
/**
* goo_canvas_item_model_set_parent:
* @model: an item model.
- * @parent: the new parent item.
+ * @parent: the new parent item model.
*
- * Sets the parent of the item.
+ * Sets the parent of the model.
**/
void
goo_canvas_item_model_set_parent (GooCanvasItemModel *model,
@@ -437,7 +436,7 @@
* @above: the item to raise @model above, or %NULL to raise @model to the top
* of the stack.
*
- * Raises an item in the stacking order.
+ * Raises a model in the stacking order.
**/
void
goo_canvas_item_model_raise (GooCanvasItemModel *model,
@@ -480,7 +479,7 @@
* @below: the item to lower @model below, or %NULL to lower @model to the
* bottom of the stack.
*
- * Lowers an item in the stacking order.
+ * Lowers a model in the stacking order.
**/
void
goo_canvas_item_model_lower (GooCanvasItemModel *model,
@@ -523,7 +522,7 @@
*
* Gets the transformation matrix of an item model.
*
- * Returns: the item's transformation matrix.
+ * Returns: the model's transformation matrix.
**/
cairo_matrix_t*
goo_canvas_item_model_get_transform (GooCanvasItemModel *model)
@@ -556,7 +555,7 @@
* @tx: the amount to move the origin in the horizontal direction.
* @ty: the amount to move the origin in the vertical direction.
*
- * Translates the origin of the item's coordinate system by the given amounts.
+ * Translates the origin of the model's coordinate system by the given amounts.
**/
void
goo_canvas_item_model_translate (GooCanvasItemModel *model,
@@ -580,7 +579,7 @@
* @sx: the amount to scale the horizontal axis.
* @sy: the amount to scale the vertical axis.
*
- * Scales the item's coordinate system by the given amounts.
+ * Scales the model's coordinate system by the given amounts.
**/
void
goo_canvas_item_model_scale (GooCanvasItemModel *model,
@@ -605,7 +604,7 @@
* @cx: the x coordinate of the origin of the rotation.
* @cy: the y coordinate of the origin of the rotation.
*
- * Rotates the item's coordinate system by the given amount, about the given
+ * Rotates the model's coordinate system by the given amount, about the given
* origin.
**/
void
@@ -635,7 +634,7 @@
* @cx: the x coordinate of the origin of the skew transform.
* @cy: the y coordinate of the origin of the skew transform.
*
- * Skews the item's coordinate system along the x axis by the given amount,
+ * Skews the model's coordinate system along the x axis by the given amount,
* about the given origin.
**/
void
@@ -666,7 +665,7 @@
* @cx: the x coordinate of the origin of the skew transform.
* @cy: the y coordinate of the origin of the skew transform.
*
- * Skews the item's coordinate system along the y axis by the given amount,
+ * Skews the model's coordinate system along the y axis by the given amount,
* about the given origin.
**/
void
@@ -694,10 +693,10 @@
* goo_canvas_item_model_get_style:
* @model: an item model.
*
- * Gets the item's style. If the item doesn't have its own style it will return
- * its parent's style.
+ * Gets the model's style. If the model doesn't have its own style it will
+ * return its parent's style.
*
- * Returns: the item's style.
+ * Returns: the model's style.
**/
GooCanvasStyle*
goo_canvas_item_model_get_style (GooCanvasItemModel *model)
@@ -713,7 +712,7 @@
* @model: an item model.
* @style: a style.
*
- * Sets the item's style, by copying the properties from the given style.
+ * Sets the model's style, by copying the properties from the given style.
**/
void
goo_canvas_item_model_set_style (GooCanvasItemModel *model,
@@ -826,14 +825,14 @@
* @model: an item model.
* @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.
+ * @scale: the final scale of the model.
+ * @degrees: the final rotation of the model.
* @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.
*
- * Animates an item from its current position to the given offsets, scale
+ * Animates a model from its current position to the given offsets, scale
* and rotation.
**/
void
@@ -888,7 +887,7 @@
* goo_canvas_item_model_stop_animation:
* @model: an item model.
*
- * Stops any current animation for the given item, leaving it at its current
+ * Stops any current animation for the given model, leaving it at its current
* position.
**/
void
Index: goocanvasitemmodel.h
===================================================================
RCS file: /cvs/cairo/goocanvas/src/goocanvasitemmodel.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- goocanvasitemmodel.h 9 Dec 2006 12:03:05 -0000 1.2
+++ goocanvasitemmodel.h 8 Feb 2007 17:54:26 -0000 1.3
@@ -35,9 +35,42 @@
/**
* GooCanvasItemModelIface
+ * @get_n_children: returns the number of children of the model.
+ * @get_child: returns the child at the given index.
+ * @add_child: adds a child.
+ * @move_child: moves a child up or down the stacking order.
+ * @remove_child: removes a child.
+ * @get_child_property: gets a child property of a given child model,
+ * e.g. the "row" or "column" property of a model in a #GooCanvasTableModel.
+ * @set_child_property: sets a child property for a given child model.
+ * @get_parent: gets the model's parent.
+ * @set_parent: sets the model's parent.
+ * @create_item: creates a default canvas item to view the model.
+ * @get_transform: gets the model's transformation matrix.
+ * @set_transform: sets the model's transformation matrix.
+ * @get_style: gets the model's style.
+ * @set_style: sets the model's style.
+ * @child_added: signal emitted when a child is added.
+ * @child_moved: signal emitted when a child is moved in the stacking order.
+ * @child_removed: signal emitted when a child is removed.
+ * @changed: signal emitted when the model has changed.
+ * @child_notify: signal emitted when a child property has changed.
*
* #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().
*/
typedef struct _GooCanvasItemModelIface GooCanvasItemModelIface;
@@ -47,58 +80,59 @@
GTypeInterface base_iface;
/*< public >*/
- /* Virtual methods that group items must implement. */
- gint (* get_n_children) (GooCanvasItemModel *model);
- GooCanvasItemModel* (* get_child) (GooCanvasItemModel *model,
- gint child_num);
+ /* 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 items 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 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 canvas items must implement. */
- GooCanvasItemModel* (* get_parent) (GooCanvasItemModel *model);
- void (* set_parent) (GooCanvasItemModel *model,
- GooCanvasItemModel *parent);
+ /* Virtual methods that all item models must implement. */
+ GooCanvasItemModel* (* get_parent) (GooCanvasItemModel *model);
+ void (* set_parent) (GooCanvasItemModel *model,
+ GooCanvasItemModel *parent);
- cairo_matrix_t* (* get_transform) (GooCanvasItemModel *model);
- void (* set_transform) (GooCanvasItemModel *model,
- cairo_matrix_t *matrix);
- GooCanvasStyle* (* get_style) (GooCanvasItemModel *model);
- void (* set_style) (GooCanvasItemModel *model,
- GooCanvasStyle *style);
+ GooCanvasItem* (* create_item) (GooCanvasItemModel *model,
+ GooCanvas *canvas);
- GooCanvasItem* (* create_item) (GooCanvasItemModel *model,
- GooCanvas *canvas);
+ /* Virtual methods that all item models may implement. */
+ cairo_matrix_t* (* get_transform) (GooCanvasItemModel *model);
+ void (* set_transform) (GooCanvasItemModel *model,
+ cairo_matrix_t *matrix);
+ 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 (* 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);
};
Index: goocanvasitemsimple.c
===================================================================
RCS file: /cvs/cairo/goocanvas/src/goocanvasitemsimple.c,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -d -r1.18 -r1.19
--- goocanvasitemsimple.c 4 Feb 2007 18:02:30 -0000 1.18
+++ goocanvasitemsimple.c 8 Feb 2007 17:54:26 -0000 1.19
@@ -2,7 +2,7 @@
* GooCanvas. Copyright (C) 2005-6 Damon Chaplin.
* Released under the GNU LGPL license. See COPYING for details.
*
- * goocanvasitemsimple.c - abstract base class for simple item views.
+ * goocanvasitemsimple.c - abstract base class for canvas items.
*/
/**
@@ -12,11 +12,22 @@
* @Stability_Level:
* @See_Also:
*
- * #GooCanvasItemSimple is used as a base class for the standard canvas
- * items.
+ * #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
+ * get_item_at() methods. (#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.)
*/
#include <config.h>
#include <glib/gi18n-lib.h>
@@ -1328,8 +1339,12 @@
* @bounds: the #GooCanvasBounds struct to store the resulting bounding box.
*
* Calculates the bounds of the current path, storing the results in the given
- * #GooCanvasBounds struct. The returned bounds contains the bounding
- * box of the item in device space, converted to user space coordinates.
+ * #GooCanvasBounds struct.
+ *
+ * The returned bounds contains the bounding box of the item 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.
**/
void
goo_canvas_item_simple_get_path_bounds (GooCanvasItemSimple *item,
@@ -1526,10 +1541,15 @@
* @See_Also:
*
* #GooCanvasItemModelSimple is used as a base class for the standard canvas
+ * item models. It can also be used as the base class for new custom canvas
* item models.
*
* It provides default implementations for many of the #GooCanvasItemModel
* methods.
+ *
+ * Subclasses of #GooCanvasItemModelSimple only need to implement the
+ * create_item() method of the #GooCanvasItemModel interface, to create
+ * the default canvas item to view the item model.
*/
Index: goocanvasitemsimple.h
===================================================================
RCS file: /cvs/cairo/goocanvas/src/goocanvasitemsimple.h,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- goocanvasitemsimple.h 4 Feb 2007 18:02:30 -0000 1.14
+++ goocanvasitemsimple.h 8 Feb 2007 17:54:26 -0000 1.15
@@ -102,8 +102,8 @@
* The #GooCanvasItemSimpleClass-struct struct contains several methods that
* subclasses can override.
*
- * Simple items need only override the create_path() method. More complex items
- * must override the update(), paint() and get_item_at() methods.
+ * Simple items need only implement the create_path() method. More complex
+ * items must override the update(), paint() and get_item_at() methods.
*/
struct _GooCanvasItemSimpleClass
{
Index: goocanvasstyle.c
===================================================================
RCS file: /cvs/cairo/goocanvas/src/goocanvasstyle.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- goocanvasstyle.c 4 Feb 2007 23:10:14 -0000 1.3
+++ goocanvasstyle.c 8 Feb 2007 17:54:26 -0000 1.4
@@ -27,16 +27,82 @@
#include "goocanvasutils.h"
/* GQuarks for the basic properties. */
+
+/**
+ * goo_canvas_style_stroke_pattern_id:
+ *
+ * Unique #GQuark identifier used for the standard stroke pattern property.
+ **/
GQuark goo_canvas_style_stroke_pattern_id;
+
+/**
+ * goo_canvas_style_fill_pattern_id:
+ *
+ * Unique #GQuark identifier used for the standard fill pattern property.
+ **/
GQuark goo_canvas_style_fill_pattern_id;
+
+/**
+ * goo_canvas_style_fill_rule_id:
+ *
+ * Unique #GQuark identifier used for the standard fill rule property.
+ **/
GQuark goo_canvas_style_fill_rule_id;
+
+/**
+ * goo_canvas_style_operator_id:
+ *
+ * Unique #GQuark identifier used for the standard operator property.
+ **/
GQuark goo_canvas_style_operator_id;
+
+/**
+ * goo_canvas_style_antialias_id:
+ *
+ * Unique #GQuark identifier used for the standard antialias property.
+ **/
GQuark goo_canvas_style_antialias_id;
+
+/**
+ * goo_canvas_style_line_width_id:
+ *
+ * Unique #GQuark identifier used for the standard line width property.
+ **/
GQuark goo_canvas_style_line_width_id;
+
+/**
+ * goo_canvas_style_line_cap_id:
+ *
+ * Unique #GQuark identifier used for the standard line cap property.
+ **/
GQuark goo_canvas_style_line_cap_id;
+
+/**
+ * goo_canvas_style_line_join_id:
+ *
+ * Unique #GQuark identifier used for the standard line join property.
+ **/
GQuark goo_canvas_style_line_join_id;
+
+/**
+ * goo_canvas_style_line_join_miter_limit_id:
+ *
+ * Unique #GQuark identifier used for the standard miter limit property.
+ **/
GQuark goo_canvas_style_line_join_miter_limit_id;
+
+/**
+ * goo_canvas_style_line_dash_id:
+ *
+ * Unique #GQuark identifier used for the standard line dash property.
+ **/
GQuark goo_canvas_style_line_dash_id;
+
+/**
+ * goo_canvas_style_font_desc_id:
+ *
+ * Unique #GQuark identifier used for the standard font description property.
+ **/
GQuark goo_canvas_style_font_desc_id;
static void goo_canvas_style_finalize (GObject *object);
Index: goocanvasutils.h
===================================================================
RCS file: /cvs/cairo/goocanvas/src/goocanvasutils.h,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- goocanvasutils.h 1 Feb 2007 01:19:05 -0000 1.9
+++ goocanvasutils.h 8 Feb 2007 17:54:26 -0000 1.10
@@ -48,26 +48,16 @@
*/
typedef enum
{
- /* If the item must be visible to receive events. */
GOO_CANVAS_EVENTS_VISIBLE_MASK = 1 << 0,
-
- /* If the fill or stroke must be painted to receive events. */
GOO_CANVAS_EVENTS_PAINTED_MASK = 1 << 1,
-
- /* If the fill should receive events. */
GOO_CANVAS_EVENTS_FILL_MASK = 1 << 2,
-
- /* If the stroke should receive events. */
GOO_CANVAS_EVENTS_STROKE_MASK = 1 << 3,
-
GOO_CANVAS_EVENTS_NONE = 0,
-
GOO_CANVAS_EVENTS_VISIBLE_PAINTED = GOO_CANVAS_EVENTS_VISIBLE_MASK | GOO_CANVAS_EVENTS_PAINTED_MASK | GOO_CANVAS_EVENTS_FILL_MASK | GOO_CANVAS_EVENTS_STROKE_MASK,
GOO_CANVAS_EVENTS_VISIBLE_FILL = GOO_CANVAS_EVENTS_VISIBLE_MASK | GOO_CANVAS_EVENTS_FILL_MASK,
GOO_CANVAS_EVENTS_VISIBLE_STROKE = GOO_CANVAS_EVENTS_VISIBLE_MASK | GOO_CANVAS_EVENTS_STROKE_MASK,
GOO_CANVAS_EVENTS_VISIBLE = GOO_CANVAS_EVENTS_VISIBLE_MASK | GOO_CANVAS_EVENTS_FILL_MASK | GOO_CANVAS_EVENTS_STROKE_MASK,
-
GOO_CANVAS_EVENTS_PAINTED = GOO_CANVAS_EVENTS_PAINTED_MASK | GOO_CANVAS_EVENTS_FILL_MASK | GOO_CANVAS_EVENTS_STROKE_MASK,
GOO_CANVAS_EVENTS_FILL = GOO_CANVAS_EVENTS_FILL_MASK,
GOO_CANVAS_EVENTS_STROKE = GOO_CANVAS_EVENTS_STROKE_MASK,
More information about the cairo-commit
mailing list