[cairo-commit] goocanvas/src goocanvas.c, 1.1, 1.2 goocanvasgroup.c, 1.15, 1.16 goocanvasimage.c, 1.9, 1.10 goocanvasitem.c, 1.12, 1.13 goocanvasitem.h, 1.8, 1.9 goocanvasitemsimple.c, 1.16, 1.17 goocanvasitemsimple.h, 1.12, 1.13 goocanvaspolyline.c, 1.8, 1.9 goocanvastable.c, 1.2, 1.3 goocanvastable.h, 1.1, 1.2 goocanvastext.c, 1.8, 1.9 goocanvasutils.h, 1.8, 1.9 goocanvaswidget.c, 1.1, 1.2

Damon Chaplin commit at pdx.freedesktop.org
Wed Jan 31 17:19:10 PST 2007


Committed by: damon

Update of /cvs/cairo/goocanvas/src
In directory kemper:/tmp/cvs-serv7119/src

Modified Files:
	goocanvas.c goocanvasgroup.c goocanvasimage.c goocanvasitem.c 
	goocanvasitem.h goocanvasitemsimple.c goocanvasitemsimple.h 
	goocanvaspolyline.c goocanvastable.c goocanvastable.h 
	goocanvastext.c goocanvasutils.h goocanvaswidget.c 
Log Message:
2007-02-01  Damon Chaplin  <damon at gnome.org>

	* src/goocanvastable.c: finished table item. I think the only API
	breakage this introduces is that GooCanvasItemSimple subclasses that
	override the update() class method must now return the bounds in user
	space rather than device space. (This is needed to do the table
	layout.)

	* demo/table-demo.c: added more test tables with various transforms
	and settings.

	* src/goocanvasitem.c (goo_canvas_item_get_requested_area) 
	(goo_canvas_item_allocate_area)
	(goo_canvas_item_get_transform_for_child) : new functions and interface
	methods to support GooCanvasTable and other layout containers.

	* src/goocanvasitemsimple.c: added support for GOO_CANVAS_ITEM_HIDDEN,
	initialized the model's visibility setting to GOO_CANVAS_ITEM_VISIBLE.
	(goo_canvas_item_simple_update): split part of it out into
	goo_canvas_item_simple_update_internal and updated slightly.
	(goo_canvas_item_simple_get_requested_area) 
	(goo_canvas_item_simple_allocate_area): new functions to support
	GooCanvasTable and other layout containers.
	(goo_canvas_item_simple_get_path_bounds): don't convert to device space
	as some code needs the bounds in user space.

	* src/goocanvas.c (goo_canvas_convert_to_item_space) 
	(goo_canvas_convert_from_item_space): used the new
	goo_canvas_item_get_transform_for_child() function to get the transform
	for each item.

	* src/goocanvasutils.h: added GOO_CANVAS_ITEM_HIDDEN visibility setting
	which is used for items which are invisible and not allocated any space
	in containter items like GooCanvasTable.

	* src/goocanvasgroup.c (goo_canvas_group_get_item_at) 
	(goo_canvas_group_paint): support GOO_CANVAS_ITEM_HIDDEN.

	* src/goocanvaspolyline.c (goo_canvas_polyline_compute_bounds):
	* src/goocanvasimage.c (goo_canvas_image_update): leave bounds in user
	space.

	* src/goocanvaswidget.c: updated to override the GooCanvasItemSimple
	update, paint & get_item_at methods instead of the interface methods,
	added support for GOO_CANVAS_ITEM_HIDDEN, and added
	goo_canvas_widget_allocate_area() implementation.

	* src/goocanvastext.c (goo_canvas_text_get_item_at): fixed bug that
	meant it didn't work for text items with no fill color/pattern set.



Index: goocanvas.c
===================================================================
RCS file: /cvs/cairo/goocanvas/src/goocanvas.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- goocanvas.c	29 Nov 2006 18:27:06 -0000	1.1
+++ goocanvas.c	1 Feb 2007 01:19:05 -0000	1.2
@@ -2623,10 +2623,10 @@
 				  gdouble       *x,
 				  gdouble       *y)
 {
-  GooCanvasItem *tmp = item;
+  GooCanvasItem *tmp = item, *parent, *child;
   GList *list = NULL, *l;
-  cairo_matrix_t *item_transform, item_transform_copy;
-  cairo_matrix_t inverse = { 1, 0, 0, 1, 0, 0 };
+  cairo_matrix_t item_transform, inverse = { 1, 0, 0, 1, 0, 0 };
+  gboolean has_transform;
 
   /* Step up from the item to the top, pushing items onto the list. */
   while (tmp)
@@ -2638,12 +2638,14 @@
   /* Now step down applying the inverse of each item's transformation. */
   for (l = list; l; l = l->next)
     {
-      item_transform = goo_canvas_item_get_transform ((GooCanvasItem*) l->data);
-      if (item_transform)
+      parent = (GooCanvasItem*) l->data;
+      child = l->next ? (GooCanvasItem*) l->next->data : NULL;
+      has_transform = goo_canvas_item_get_transform_for_child (parent, child,
+							       &item_transform);
+      if (has_transform)
 	{
-	  item_transform_copy = *item_transform;
-	  cairo_matrix_invert (&item_transform_copy);
-	  cairo_matrix_multiply (&inverse, &inverse, &item_transform_copy);
+	  cairo_matrix_invert (&item_transform);
+	  cairo_matrix_multiply (&inverse, &inverse, &item_transform);
 	}
     }
   g_list_free (list);
@@ -2670,9 +2672,10 @@
 				    gdouble       *x,
 				    gdouble       *y)
 {
-  GooCanvasItem *tmp = item;
+  GooCanvasItem *tmp = item, *parent, *child;
   GList *list = NULL, *l;
-  cairo_matrix_t *item_transform, transform = { 1, 0, 0, 1, 0, 0 };
+  cairo_matrix_t item_transform, transform = { 1, 0, 0, 1, 0, 0 };
+  gboolean has_transform;
 
   /* Step up from the item to the top, pushing items onto the list. */
   while (tmp)
@@ -2684,10 +2687,13 @@
   /* Now step down applying each item's transformation. */
   for (l = list; l; l = l->next)
     {
-      item_transform = goo_canvas_item_get_transform ((GooCanvasItem*) l->data);
-      if (item_transform)
+      parent = (GooCanvasItem*) l->data;
+      child = l->next ? (GooCanvasItem*) l->next->data : NULL;
+      has_transform = goo_canvas_item_get_transform_for_child (parent, child,
+							       &item_transform);
+      if (has_transform)
 	{
-	  cairo_matrix_multiply (&transform, &transform, item_transform);
+	  cairo_matrix_multiply (&transform, &transform, &item_transform);
 	}
     }
   g_list_free (list);

Index: goocanvasgroup.c
===================================================================
RCS file: /cvs/cairo/goocanvas/src/goocanvasgroup.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- goocanvasgroup.c	9 Dec 2006 12:03:05 -0000	1.15
+++ goocanvasgroup.c	1 Feb 2007 01:19:05 -0000	1.16
@@ -406,7 +406,7 @@
   if (simple->need_update)
     goo_canvas_item_ensure_updated (item);
 
-  if (simple_data->visibility == GOO_CANVAS_ITEM_INVISIBLE
+  if (simple_data->visibility <= GOO_CANVAS_ITEM_INVISIBLE
       || (simple_data->visibility == GOO_CANVAS_ITEM_VISIBLE_ABOVE_THRESHOLD
 	  && simple->canvas->scale < simple_data->visibility_threshold))
     visible = FALSE;
@@ -458,7 +458,7 @@
   gint i;
 
   /* Check if the item should be visible. */
-  if (simple_data->visibility == GOO_CANVAS_ITEM_INVISIBLE
+  if (simple_data->visibility <= GOO_CANVAS_ITEM_INVISIBLE
       || (simple_data->visibility == GOO_CANVAS_ITEM_VISIBLE_ABOVE_THRESHOLD
 	  && simple->canvas->scale < simple_data->visibility_threshold))
     return;

Index: goocanvasimage.c
===================================================================
RCS file: /cvs/cairo/goocanvas/src/goocanvasimage.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- goocanvasimage.c	30 Nov 2006 14:35:05 -0000	1.9
+++ goocanvasimage.c	1 Feb 2007 01:19:05 -0000	1.10
@@ -345,8 +345,6 @@
   simple->bounds.y1 = image_data->y;
   simple->bounds.x2 = image_data->x + image_data->width;
   simple->bounds.y2 = image_data->y + image_data->height;
-
-  goo_canvas_item_simple_user_bounds_to_device (simple, cr, &simple->bounds);
 }
 
 

Index: goocanvasitem.c
===================================================================
RCS file: /cvs/cairo/goocanvas/src/goocanvasitem.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- goocanvasitem.c	9 Dec 2006 12:03:05 -0000	1.12
+++ goocanvasitem.c	1 Feb 2007 01:19:05 -0000	1.13
@@ -768,6 +768,44 @@
 
 
 /**
+ * goo_canvas_item_get_transform_for_child:
+ * @item: an item.
+ * @child: a child of @item.
+ * @transform: the place to store the transform.
+ * 
+ * Gets the transformation matrix of an item combined with any special
+ * transform needed for the given child. These special transforms are used
+ * by layout items such as #GooCanvasTable.
+ * 
+ * Returns: %TRUE if a transform is set.
+ **/
+gboolean
+goo_canvas_item_get_transform_for_child  (GooCanvasItem  *item,
+					  GooCanvasItem  *child,
+					  cairo_matrix_t *transform)
+{
+  GooCanvasItemIface *iface = GOO_CANVAS_ITEM_GET_IFACE (item);
+  cairo_matrix_t *item_transform;
+
+  if (child && iface->get_transform_for_child)
+    return iface->get_transform_for_child (item, child, transform);
+
+  /* We fallback to the standard get_transform method. */
+  if (iface->get_transform)
+    {
+      item_transform = iface->get_transform (item);
+      if (item_transform)
+	{
+	  *transform = *item_transform;
+	  return TRUE;
+	}
+    }
+
+  return FALSE;
+}
+
+
+/**
  * goo_canvas_item_set_transform:
  * @item: an item.
  * @matrix: the new transformation matrix, or %NULL to reset the
@@ -1326,6 +1364,31 @@
 }
 
 
+gboolean
+goo_canvas_item_get_requested_area (GooCanvasItem    *item,
+				    cairo_t          *cr,
+				    GooCanvasBounds  *bounds)
+{
+  GooCanvasItemIface *iface = GOO_CANVAS_ITEM_GET_IFACE (item);
+
+  return iface->get_requested_area (item, cr, bounds);
+}
+
+
+void
+goo_canvas_item_allocate_area      (GooCanvasItem    *item,
+				    cairo_t          *cr,
+				    GooCanvasBounds  *requested_area,
+				    GooCanvasBounds  *allocated_area,
+				    gdouble           x_offset,
+				    gdouble           y_offset)
+{
+  GooCanvasItemIface *iface = GOO_CANVAS_ITEM_GET_IFACE (item);
+
+  iface->allocate_area (item, cr, requested_area, allocated_area,
+			x_offset, y_offset);
+}
+
 
 /*
  * Child Properties.

Index: goocanvasitem.h
===================================================================
RCS file: /cvs/cairo/goocanvas/src/goocanvasitem.h,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- goocanvasitem.h	29 Nov 2006 18:40:53 -0000	1.8
+++ goocanvasitem.h	1 Feb 2007 01:19:05 -0000	1.9
@@ -116,6 +116,9 @@
 					      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);
@@ -138,6 +141,16 @@
 					    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);
+
   /* Virtual methods that canvas items may implement. */
   cairo_matrix_t*      (* get_transform)   (GooCanvasItem       *item);
   void                 (* set_transform)   (GooCanvasItem       *item,
@@ -222,6 +235,10 @@
 						   GooCanvasItem   *child,
 						   va_list	    var_args);
 
+gboolean goo_canvas_item_get_transform_for_child  (GooCanvasItem   *item,
+						   GooCanvasItem   *child,
+						   cairo_matrix_t  *transform);
+
 
 /*
  * Item functions - these are safe to call on all items.
@@ -303,6 +320,17 @@
 						   GooCanvasBounds *bounds,
 						   gdouble          scale);
 
+gboolean	   goo_canvas_item_get_requested_area (GooCanvasItem	*item,
+						       cairo_t          *cr,
+						       GooCanvasBounds  *requested_area);
+void		   goo_canvas_item_allocate_area      (GooCanvasItem	*item,
+						       cairo_t          *cr,
+						       GooCanvasBounds  *requested_area,
+						       GooCanvasBounds  *allocated_area,
+						       gdouble           x_offset,
+						       gdouble           y_offset);
+
+
 
 /*
  * Functions to support child properties when implementing new canvas items.

Index: goocanvasitemsimple.c
===================================================================
RCS file: /cvs/cairo/goocanvas/src/goocanvasitemsimple.c,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -d -r1.16 -r1.17
--- goocanvasitemsimple.c	30 Nov 2006 14:35:05 -0000	1.16
+++ goocanvasitemsimple.c	1 Feb 2007 01:19:05 -0000	1.17
@@ -881,7 +881,7 @@
 	return NULL;
       if (simple_data->pointer_events & GOO_CANVAS_EVENTS_VISIBLE_MASK
 	  && (!parent_visible
-	      || simple_data->visibility == GOO_CANVAS_ITEM_INVISIBLE
+	      || simple_data->visibility <= GOO_CANVAS_ITEM_INVISIBLE
 	      || (simple_data->visibility == GOO_CANVAS_ITEM_VISIBLE_ABOVE_THRESHOLD
 		  && simple->canvas->scale < simple_data->visibility_threshold)))
 	return NULL;
@@ -927,7 +927,7 @@
   GooCanvasItemSimple *simple = (GooCanvasItemSimple*) item;
   GooCanvasItemSimpleData *simple_data = simple->simple_data;
 
-  if (simple_data->visibility == GOO_CANVAS_ITEM_INVISIBLE
+  if (simple_data->visibility <= GOO_CANVAS_ITEM_INVISIBLE
       || (simple_data->visibility == GOO_CANVAS_ITEM_VISIBLE_ABOVE_THRESHOLD
 	  && simple->canvas->scale < simple_data->visibility_threshold))
     return FALSE;
@@ -970,12 +970,41 @@
 
 
 static void
+goo_canvas_item_simple_update_internal  (GooCanvasItemSimple *simple,
+					 cairo_t             *cr)
+{
+  GooCanvasItemSimpleClass *class = GOO_CANVAS_ITEM_SIMPLE_GET_CLASS (simple);
+  cairo_matrix_t transform;
+
+  simple->need_update = FALSE;
+
+  goo_canvas_item_simple_check_style (simple);
+
+  if (class->update)
+    {
+      class->update (simple, cr);
+    }
+  else
+    {
+      /* Use the identity matrix to get the bounds completely in user space. */
+      cairo_get_matrix (cr, &transform);
+      cairo_identity_matrix (cr);
+
+      class->create_path (simple, cr);
+
+      goo_canvas_item_simple_get_path_bounds (simple, cr, &simple->bounds);
+
+      cairo_set_matrix (cr, &transform);
+    }
+}
+
+
+static void
 goo_canvas_item_simple_update  (GooCanvasItem   *item,
 				gboolean         entire_tree,
 				cairo_t         *cr,
 				GooCanvasBounds *bounds)
 {
-  GooCanvasItemSimpleClass *class = GOO_CANVAS_ITEM_SIMPLE_GET_CLASS (item);
   GooCanvasItemSimple *simple = (GooCanvasItemSimple*) item;
   GooCanvasItemSimpleData *simple_data = simple->simple_data;
   cairo_matrix_t matrix;
@@ -983,9 +1012,8 @@
 
   if (entire_tree || simple->need_update)
     {
-      simple->need_update = FALSE;
-
-      goo_canvas_item_simple_check_style (simple);
+      /* Request a redraw of the existing bounds. */
+      goo_canvas_request_redraw (simple->canvas, &simple->bounds);
 
       cairo_save (cr);
       if (simple_data->transform)
@@ -998,18 +1026,10 @@
       matrix.x0 = matrix.y0 = 0.0;
       cairo_set_matrix (cr, &matrix);
 
-      /* Request a redraw of the existing bounds. */
-      goo_canvas_request_redraw (simple->canvas, &simple->bounds);
+      goo_canvas_item_simple_update_internal (simple, cr);
 
-      if (class->update)
-	{
-	  class->update (simple, cr);
-	}
-      else
-	{
-	  class->create_path (simple, cr);
-	  goo_canvas_item_simple_get_path_bounds (simple, cr, &simple->bounds);
-	}
+      goo_canvas_item_simple_user_bounds_to_device (simple, cr,
+						    &simple->bounds);
 
       /* Add the translation back to the bounds. */
       simple->bounds.x1 += x_offset;
@@ -1017,13 +1037,101 @@
       simple->bounds.x2 += x_offset;
       simple->bounds.y2 += y_offset;
 
+      cairo_restore (cr);
+
       /* Request a redraw of the new bounds. */
       goo_canvas_request_redraw (simple->canvas, &simple->bounds);
+    }
+
+  *bounds = simple->bounds;
+}
 
+
+static gboolean
+goo_canvas_item_simple_get_requested_area (GooCanvasItem    *item,
+					   cairo_t          *cr,
+					   GooCanvasBounds  *requested_area)
+{
+  GooCanvasItemSimple *simple = (GooCanvasItemSimple*) item;
+  GooCanvasItemSimpleData *simple_data = simple->simple_data;
+  cairo_matrix_t matrix;
+  double x_offset, y_offset;
+
+  cairo_save (cr);
+  if (simple_data->transform)
+    cairo_transform (cr, simple_data->transform);
+
+  /* Remove any current translation, to avoid the 16-bit cairo limit. */
+  cairo_get_matrix (cr, &matrix);
+  x_offset = matrix.x0;
+  y_offset = matrix.y0;
+  matrix.x0 = matrix.y0 = 0.0;
+  cairo_set_matrix (cr, &matrix);
+
+  goo_canvas_item_simple_update_internal (simple, cr);
+
+  if (simple->simple_data->visibility == GOO_CANVAS_ITEM_HIDDEN)
+    {
+      simple->bounds.x1 = simple->bounds.x2 = 0.0;
+      simple->bounds.y1 = simple->bounds.y2 = 0.0;
       cairo_restore (cr);
+      return FALSE;
     }
 
-  *bounds = simple->bounds;
+  /* FIXME: Maybe optimize by just converting the offsets to user space
+     and adding them? */
+
+  /* Convert to device space. */
+  cairo_user_to_device (cr, &simple->bounds.x1, &simple->bounds.y1);
+  cairo_user_to_device (cr, &simple->bounds.x2, &simple->bounds.y2);
+
+  /* Add the translation back to the bounds. */
+  simple->bounds.x1 += x_offset;
+  simple->bounds.y1 += y_offset;
+  simple->bounds.x2 += x_offset;
+  simple->bounds.y2 += y_offset;
+
+  /* Restore the item's proper transformation matrix. */
+  matrix.x0 = x_offset;
+  matrix.y0 = y_offset;
+  cairo_set_matrix (cr, &matrix);
+
+  /* Convert back to user space. */
+  cairo_device_to_user (cr, &simple->bounds.x1, &simple->bounds.y1);
+  cairo_device_to_user (cr, &simple->bounds.x2, &simple->bounds.y2);
+
+
+  /* Copy the user bounds to the requested area. */
+  *requested_area = simple->bounds;
+
+  /* Convert to the parent's coordinate space. */
+  goo_canvas_item_simple_user_bounds_to_parent (simple, cr, requested_area);
+
+  /* Convert the item's bounds to device space. */
+  goo_canvas_item_simple_user_bounds_to_device (simple, cr, &simple->bounds);
+
+  cairo_restore (cr);
+
+  return TRUE;
+}
+
+
+static void
+goo_canvas_item_simple_allocate_area      (GooCanvasItem    *item,
+					   cairo_t          *cr,
+					   GooCanvasBounds  *requested_area,
+					   GooCanvasBounds  *allocated_area,
+					   gdouble           x_offset,
+					   gdouble           y_offset)
+{
+  GooCanvasItemSimple *simple = (GooCanvasItemSimple*) item;
+
+  /* Simple items can't resize at all, so we just adjust the bounds x & y
+     positions here, and let the item be clipped if necessary. */
+  simple->bounds.x1 += x_offset;
+  simple->bounds.y1 += y_offset;
+  simple->bounds.x2 += x_offset;
+  simple->bounds.y2 += y_offset;
 }
 
 
@@ -1038,7 +1146,7 @@
   GooCanvasItemSimpleData *simple_data = simple->simple_data;
 
   /* Check if the item should be visible. */
-  if (simple_data->visibility == GOO_CANVAS_ITEM_INVISIBLE
+  if (simple_data->visibility <= GOO_CANVAS_ITEM_INVISIBLE
       || (simple_data->visibility == GOO_CANVAS_ITEM_VISIBLE_ABOVE_THRESHOLD
 	  && scale < simple_data->visibility_threshold))
     return;
@@ -1054,6 +1162,7 @@
   else
     {
       class->create_path (simple, cr);
+
       goo_canvas_item_simple_paint_path (simple, cr);
     }
 
@@ -1061,6 +1170,7 @@
 }
 
 
+
 static void
 goo_canvas_item_simple_title_changed (GooCanvasItemModelSimple *smodel,
 				      GParamSpec               *pspec,
@@ -1152,24 +1262,26 @@
 static void
 canvas_item_interface_init (GooCanvasItemIface *iface)
 {
-  iface->get_canvas     = goo_canvas_item_simple_get_canvas;
-  iface->set_canvas     = goo_canvas_item_simple_set_canvas;
+  iface->get_canvas         = goo_canvas_item_simple_get_canvas;
+  iface->set_canvas         = goo_canvas_item_simple_set_canvas;
 
-  iface->get_parent	= goo_canvas_item_simple_get_parent;
-  iface->set_parent	= goo_canvas_item_simple_set_parent;
-  iface->get_bounds     = goo_canvas_item_simple_get_bounds;
-  iface->get_item_at	= goo_canvas_item_simple_get_item_at;
-  iface->update         = goo_canvas_item_simple_update;
-  iface->paint          = goo_canvas_item_simple_paint;
+  iface->get_parent	    = goo_canvas_item_simple_get_parent;
+  iface->set_parent	    = goo_canvas_item_simple_set_parent;
+  iface->get_bounds         = goo_canvas_item_simple_get_bounds;
+  iface->get_item_at	    = goo_canvas_item_simple_get_item_at;
+  iface->update             = goo_canvas_item_simple_update;
+  iface->get_requested_area = goo_canvas_item_simple_get_requested_area;
+  iface->allocate_area      = goo_canvas_item_simple_allocate_area;
+  iface->paint              = goo_canvas_item_simple_paint;
 
-  iface->get_transform  = goo_canvas_item_simple_get_transform;
-  iface->set_transform  = goo_canvas_item_simple_set_transform;
-  iface->get_style      = goo_canvas_item_simple_get_style;
-  iface->set_style      = goo_canvas_item_simple_set_style;
-  iface->is_visible     = goo_canvas_item_simple_is_visible;
+  iface->get_transform      = goo_canvas_item_simple_get_transform;
+  iface->set_transform      = goo_canvas_item_simple_set_transform;
+  iface->get_style          = goo_canvas_item_simple_get_style;
+  iface->set_style          = goo_canvas_item_simple_set_style;
+  iface->is_visible         = goo_canvas_item_simple_is_visible;
 
-  iface->get_model      = goo_canvas_item_simple_get_model;
-  iface->set_model      = goo_canvas_item_simple_set_model;
+  iface->get_model          = goo_canvas_item_simple_get_model;
+  iface->set_model          = goo_canvas_item_simple_set_model;
 }
 
 
@@ -1206,8 +1318,9 @@
  * @cr: a cairo context.
  * @bounds: the #GooCanvasBounds struct to store the resulting bounding box.
  * 
- * Calculates the bounds of the current path in device space, storing the
- * results in the given #GooCanvasBounds struct.
+ * 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.
  **/
 void
 goo_canvas_item_simple_get_path_bounds (GooCanvasItemSimple *item,
@@ -1242,8 +1355,6 @@
   bounds->y2 = MAX (tmp_bounds.y1, tmp_bounds.y2);
   bounds->y2 = MAX (bounds->y2, tmp_bounds2.y1);
   bounds->y2 = MAX (bounds->y2, tmp_bounds2.y2);
-
-  goo_canvas_item_simple_user_bounds_to_device (item, cr, bounds);
 }
 
 
@@ -1292,6 +1403,50 @@
 }
 
 
+void
+goo_canvas_item_simple_user_bounds_to_parent (GooCanvasItemSimple *simple,
+					      cairo_t             *cr,
+					      GooCanvasBounds     *bounds)
+{
+  GooCanvasItemSimpleData *simple_data = simple->simple_data;
+  cairo_matrix_t *transform = simple_data->transform;
+  GooCanvasBounds tmp_bounds, tmp_bounds2;
+
+  if (!transform)
+    return;
+
+  tmp_bounds = tmp_bounds2 = *bounds;
+
+  /* Convert the top-left and bottom-right corners to device coords. */
+  cairo_matrix_transform_point (transform, &tmp_bounds.x1, &tmp_bounds.y1);
+  cairo_matrix_transform_point (transform, &tmp_bounds.x2, &tmp_bounds.y2);
+
+  /* Now convert the top-right and bottom-left corners. */
+  cairo_matrix_transform_point (transform, &tmp_bounds2.x1, &tmp_bounds2.y2);
+  cairo_matrix_transform_point (transform, &tmp_bounds2.x2, &tmp_bounds2.y1);
+
+  /* Calculate the minimum x coordinate seen and put in x1. */
+  bounds->x1 = MIN (tmp_bounds.x1, tmp_bounds.x2);
+  bounds->x1 = MIN (bounds->x1, tmp_bounds2.x1);
+  bounds->x1 = MIN (bounds->x1, tmp_bounds2.x2);
+
+  /* Calculate the maximum x coordinate seen and put in x2. */
+  bounds->x2 = MAX (tmp_bounds.x1, tmp_bounds.x2);
+  bounds->x2 = MAX (bounds->x2, tmp_bounds2.x1);
+  bounds->x2 = MAX (bounds->x2, tmp_bounds2.x2);
+
+  /* Calculate the minimum y coordinate seen and put in y1. */
+  bounds->y1 = MIN (tmp_bounds.y1, tmp_bounds.y2);
+  bounds->y1 = MIN (bounds->y1, tmp_bounds2.y1);
+  bounds->y1 = MIN (bounds->y1, tmp_bounds2.y2);
+
+  /* Calculate the maximum y coordinate seen and put in y2. */
+  bounds->y2 = MAX (tmp_bounds.y1, tmp_bounds.y2);
+  bounds->y2 = MAX (bounds->y2, tmp_bounds2.y1);
+  bounds->y2 = MAX (bounds->y2, tmp_bounds2.y2);
+}
+
+
 /**
  * goo_canvas_item_simple_check_in_path:
  * @item: a #GooCanvasItemSimple.
@@ -1380,6 +1535,7 @@
 static void
 goo_canvas_item_model_simple_init (GooCanvasItemModelSimple *smodel)
 {
+  smodel->simple_data.visibility = GOO_CANVAS_ITEM_VISIBLE;
   smodel->simple_data.pointer_events = GOO_CANVAS_EVENTS_VISIBLE_PAINTED;
 }
 

Index: goocanvasitemsimple.h
===================================================================
RCS file: /cvs/cairo/goocanvas/src/goocanvasitemsimple.h,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- goocanvasitemsimple.h	30 Nov 2006 14:35:05 -0000	1.12
+++ goocanvasitemsimple.h	1 Feb 2007 01:19:05 -0000	1.13
@@ -125,6 +125,9 @@
 void     goo_canvas_item_simple_user_bounds_to_device (GooCanvasItemSimple *item,
 						       cairo_t             *cr,
 						       GooCanvasBounds     *bounds);
+void     goo_canvas_item_simple_user_bounds_to_parent (GooCanvasItemSimple *item,
+						       cairo_t             *cr,
+						       GooCanvasBounds     *bounds);
 gboolean goo_canvas_item_simple_check_in_path	   (GooCanvasItemSimple *item,
 						    gdouble              x,
 						    gdouble              y,

Index: goocanvaspolyline.c
===================================================================
RCS file: /cvs/cairo/goocanvas/src/goocanvaspolyline.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- goocanvaspolyline.c	30 Nov 2006 14:35:05 -0000	1.8
+++ goocanvaspolyline.c	1 Feb 2007 01:19:05 -0000	1.9
@@ -833,6 +833,7 @@
   GooCanvasItemSimpleData *simple_data = simple->simple_data;
   GooCanvasPolylineData *polyline_data = polyline->polyline_data;
   GooCanvasBounds tmp_bounds;
+  cairo_matrix_t transform;
 
   if (polyline_data->num_points == 0)
     {
@@ -840,6 +841,10 @@
       return;
     }
 
+  /* Use the identity matrix to get the bounds completely in user space. */
+  cairo_get_matrix (cr, &transform);
+  cairo_identity_matrix (cr);
+
   goo_canvas_polyline_create_path (polyline, cr);
   goo_canvas_item_simple_get_path_bounds (simple, cr, bounds);
 
@@ -855,8 +860,6 @@
 	  goo_canvas_polyline_create_start_arrow_path (polyline, cr);
 	  cairo_fill_extents (cr, &tmp_bounds.x1, &tmp_bounds.y1,
 			      &tmp_bounds.x2, &tmp_bounds.y2);
-	  goo_canvas_item_simple_user_bounds_to_device (simple, cr,
-							&tmp_bounds);
 	  bounds->x1 = MIN (bounds->x1, tmp_bounds.x1);
 	  bounds->y1 = MIN (bounds->y1, tmp_bounds.y1);
 	  bounds->x2 = MAX (bounds->x2, tmp_bounds.x2);
@@ -868,14 +871,14 @@
 	  goo_canvas_polyline_create_end_arrow_path (polyline, cr);
 	  cairo_fill_extents (cr, &tmp_bounds.x1, &tmp_bounds.y1,
 			      &tmp_bounds.x2, &tmp_bounds.y2);
-	  goo_canvas_item_simple_user_bounds_to_device (simple, cr,
-							&tmp_bounds);
 	  bounds->x1 = MIN (bounds->x1, tmp_bounds.x1);
 	  bounds->y1 = MIN (bounds->y1, tmp_bounds.y1);
 	  bounds->x2 = MAX (bounds->x2, tmp_bounds.x2);
 	  bounds->y2 = MAX (bounds->y2, tmp_bounds.y2);
 	}
     }
+
+  cairo_set_matrix (cr, &transform);
 }
 
 

Index: goocanvastable.c
===================================================================
RCS file: /cvs/cairo/goocanvas/src/goocanvastable.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- goocanvastable.c	9 Dec 2006 12:18:18 -0000	1.2
+++ goocanvastable.c	1 Feb 2007 01:19:05 -0000	1.3
@@ -9,11 +9,14 @@
 #include <glib/gi18n-lib.h>
 #include <gtk/gtk.h>
 #include "goocanvastable.h"
+#include "goocanvas.h"
 
 
 enum
 {
   PROP_0,
+  PROP_WIDTH,
+  PROP_HEIGHT,
[...1536 lines suppressed...]
-  iface->get_child_property = goo_canvas_table_get_child_property;
-  iface->set_child_property = goo_canvas_table_set_child_property;
+  iface->add_child               = goo_canvas_table_add_child;
+  iface->move_child              = goo_canvas_table_move_child;
+  iface->remove_child            = goo_canvas_table_remove_child;
+  iface->get_child_property      = goo_canvas_table_get_child_property;
+  iface->set_child_property      = goo_canvas_table_set_child_property;
+  iface->get_transform_for_child = goo_canvas_table_get_transform_for_child;
 
-  iface->set_model          = goo_canvas_table_set_model;
+  iface->update                  = goo_canvas_table_update;
+  iface->get_requested_area      = goo_canvas_table_get_requested_area;
+  iface->allocate_area           = goo_canvas_table_allocate_area;
+  iface->paint                   = goo_canvas_table_paint;
+  iface->get_item_at	         = goo_canvas_table_get_item_at;
+
+  iface->set_model               = goo_canvas_table_set_model;
 }
 
 

Index: goocanvastable.h
===================================================================
RCS file: /cvs/cairo/goocanvas/src/goocanvastable.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- goocanvastable.h	9 Dec 2006 12:03:05 -0000	1.1
+++ goocanvastable.h	1 Feb 2007 01:19:05 -0000	1.2
@@ -33,8 +33,11 @@
 typedef struct _GooCanvasTableLayoutData GooCanvasTableLayoutData;
 struct _GooCanvasTableData
 {
-  GooCanvasTableDimension rows;
-  GooCanvasTableDimension columns;
+  /* The explicitly set width or height, or -1. */
+  gdouble width, height;
+
+  /* One for rows & one for columns. */
+  GooCanvasTableDimension dimensions[2];
 
   gdouble border_width;
 

Index: goocanvastext.c
===================================================================
RCS file: /cvs/cairo/goocanvas/src/goocanvastext.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- goocanvastext.c	30 Nov 2006 14:35:05 -0000	1.8
+++ goocanvastext.c	1 Feb 2007 01:19:05 -0000	1.9
@@ -476,8 +476,21 @@
   layout = goo_canvas_text_create_layout (text, cr, &simple->bounds,
 					  NULL, NULL);
   g_object_unref (layout);
+}
 
-  goo_canvas_item_simple_user_bounds_to_device (simple, cr, &simple->bounds);
+
+static gboolean
+goo_canvas_text_is_unpainted (GooCanvasStyle *style)
+{
+  GValue *value;
+
+  value = goo_canvas_style_get_property (style,
+					 goo_canvas_style_fill_pattern_id);
+
+  /* We only return TRUE if the value is explicitly set to NULL. */
+  if (value && !value->data[0].v_pointer)
+    return TRUE;
+  return FALSE;
 }
 
 
@@ -504,7 +517,7 @@
 
   if (is_pointer_event
       && simple_data->pointer_events & GOO_CANVAS_EVENTS_PAINTED_MASK
-      && !goo_canvas_style_set_fill_options (simple_data->style, cr))
+      && goo_canvas_text_is_unpainted (simple_data->style))
     return NULL;
 
   layout = goo_canvas_text_create_layout (text, cr, &bounds,

Index: goocanvasutils.h
===================================================================
RCS file: /cvs/cairo/goocanvas/src/goocanvasutils.h,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- goocanvasutils.h	12 Oct 2006 13:16:56 -0000	1.8
+++ goocanvasutils.h	1 Feb 2007 01:19:05 -0000	1.9
@@ -77,20 +77,26 @@
 
 /**
  * GooCanvasItemVisibility
+ * @GOO_CANVAS_ITEM_HIDDEN: the item is invisible, and is not allocated any
+ *  space in layout container items such as #GooCanvasTable.
+ * @GOO_CANVAS_ITEM_INVISIBLE: the item is invisible, but it is still allocated
+ *  space in layout container items.
  * @GOO_CANVAS_ITEM_VISIBLE: the item is visible.
  * @GOO_CANVAS_ITEM_VISIBLE_ABOVE_THRESHOLD: the item is visible when the
  *  canvas scale setting is greater than or equal to the item's visibility
  *  threshold setting.
- * @GOO_CANVAS_ITEM_INVISIBLE: the item is invisible.
  *
  * The #GooCanvasItemVisibility enumeration is used to specify when a canvas
  * item is visible.
  */
+/* NOTE: Values are important here, as we test for <= GOO_CANVAS_ITEM_INVISIBLE
+   to check if an item is invisible or hidden. */
 typedef enum
 {
-  GOO_CANVAS_ITEM_VISIBLE,
-  GOO_CANVAS_ITEM_VISIBLE_ABOVE_THRESHOLD,
-  GOO_CANVAS_ITEM_INVISIBLE
+  GOO_CANVAS_ITEM_HIDDEN			= 0,
+  GOO_CANVAS_ITEM_INVISIBLE			= 1,
+  GOO_CANVAS_ITEM_VISIBLE			= 2,
+  GOO_CANVAS_ITEM_VISIBLE_ABOVE_THRESHOLD	= 3,
 } GooCanvasItemVisibility;
 
 

Index: goocanvaswidget.c
===================================================================
RCS file: /cvs/cairo/goocanvas/src/goocanvaswidget.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- goocanvaswidget.c	29 Nov 2006 18:27:06 -0000	1.1
+++ goocanvaswidget.c	1 Feb 2007 01:19:05 -0000	1.2
@@ -63,76 +63,6 @@
 
 
 static void
-goo_canvas_widget_class_init (GooCanvasWidgetClass *klass)
-{
-  GObjectClass *gobject_class = (GObjectClass*) klass;
-
-  gobject_class->finalize = goo_canvas_widget_finalize;
-
-  gobject_class->get_property = goo_canvas_widget_get_property;
-  gobject_class->set_property = goo_canvas_widget_set_property;
-
-  /* Register our accessible factory, but only if accessibility is enabled. */
-  if (!ATK_IS_NO_OP_OBJECT_FACTORY (atk_registry_get_factory (atk_get_default_registry (), GTK_TYPE_WIDGET)))
-    {
-      atk_registry_set_factory_type (atk_get_default_registry (),
-				     GOO_TYPE_CANVAS_WIDGET,
-				     goo_canvas_widget_accessible_factory_get_type ());
-    }
-
-  g_object_class_install_property (gobject_class, PROP_WIDGET,
-				   g_param_spec_object ("widget",
-							_("Widget"),
-							_("The widget to place in the canvas"),
-							GTK_TYPE_WIDGET,
-							G_PARAM_READWRITE));
-
-  g_object_class_install_property (gobject_class, PROP_X,
-				   g_param_spec_double ("x",
-							"X",
-							_("The x coordinate of the widget"),
-							-G_MAXDOUBLE,
-							G_MAXDOUBLE, 0.0,
-							G_PARAM_READWRITE));
-
-  g_object_class_install_property (gobject_class, PROP_Y,
-				   g_param_spec_double ("y",
-							"Y",
-							_("The y coordinate of the widget"),
-							-G_MAXDOUBLE,
-							G_MAXDOUBLE, 0.0,
-							G_PARAM_READWRITE));
-
-  g_object_class_install_property (gobject_class, PROP_WIDTH,
-				   g_param_spec_double ("width",
-							_("Width"),
-							_("The width of the widget, or -1 to use its requested width"),
-							-G_MAXDOUBLE,
-							G_MAXDOUBLE, -1.0,
-							G_PARAM_READWRITE));
-
-  g_object_class_install_property (gobject_class, PROP_HEIGHT,
-				   g_param_spec_double ("height",
-							_("Height"),
-							_("The height of the widget, or -1 to use its requested height"),
-							-G_MAXDOUBLE,
-							G_MAXDOUBLE, -1.0,
-							G_PARAM_READWRITE));
-
-  g_object_class_install_property (gobject_class, PROP_ANCHOR,
-				   g_param_spec_enum ("anchor",
-						      _("Anchor"),
-						      _("How to position the widget relative to the item's x and y coordinate settings"),
-						      GTK_TYPE_ANCHOR_TYPE,
-						      GTK_ANCHOR_NW,
-						      G_PARAM_READWRITE));
-
-  g_object_class_override_property (gobject_class, PROP_VISIBILITY,
-				    "visibility");
-}
-
-
-static void
 goo_canvas_widget_init (GooCanvasWidget *witem)
 {
   /* By default we place the widget at the top-left of the canvas at its
@@ -236,7 +166,7 @@
       witem->widget = widget;
       g_object_set_data (G_OBJECT (witem->widget), "goo-canvas-item", witem);
 
-      if (simple->simple_data->visibility == GOO_CANVAS_ITEM_INVISIBLE)
+      if (simple->simple_data->visibility <= GOO_CANVAS_ITEM_INVISIBLE)
 	gtk_widget_hide (widget);
       else
 	gtk_widget_show (widget);
@@ -338,7 +268,7 @@
       break;
     case PROP_VISIBILITY:
       simple->simple_data->visibility = g_value_get_enum (value);
-      if (simple->simple_data->visibility == GOO_CANVAS_ITEM_INVISIBLE)
+      if (simple->simple_data->visibility <= GOO_CANVAS_ITEM_INVISIBLE)
 	gtk_widget_hide (witem->widget);
       else
 	gtk_widget_show (witem->widget);
@@ -401,117 +331,128 @@
 
 
 static void
-goo_canvas_widget_update  (GooCanvasItem      *item,
-			   gboolean            entire_tree,
-			   cairo_t            *cr,
-			   GooCanvasBounds    *bounds)
+goo_canvas_widget_update  (GooCanvasItemSimple *simple,
+			   cairo_t             *cr)
 {
-  GooCanvasItemSimple *simple = (GooCanvasItemSimple*) item;
-  GooCanvasItemSimpleData *simple_data = simple->simple_data;
-  GooCanvasWidget *witem = (GooCanvasWidget*) item;
+  GooCanvasWidget *witem = (GooCanvasWidget*) simple;
   GtkRequisition requisition;
   gdouble width, height;
 
-  if (entire_tree || simple->need_update)
+  if (witem->widget)
     {
-      simple->need_update = FALSE;
-
-      goo_canvas_item_simple_check_style (simple);
+      /* Compute the new bounds. */
+      if (witem->width < 0 || witem->height < 0)
+	{
+	  gtk_widget_size_request (witem->widget, &requisition);
+	}
 
-      cairo_save (cr);
-      if (simple_data->transform)
-	cairo_transform (cr, simple_data->transform);
+      simple->bounds.x1 = witem->x;
+      simple->bounds.y1 = witem->y;
+      width = witem->width < 0 ? requisition.width : witem->width;
+      height = witem->height < 0 ? requisition.height : witem->height;
 
-      /* Request a redraw of the existing bounds. */
-      goo_canvas_request_redraw (simple->canvas, &simple->bounds);
+      switch (witem->anchor)
+	{
+	case GTK_ANCHOR_N:
+	case GTK_ANCHOR_CENTER:
+	case GTK_ANCHOR_S:
+	  simple->bounds.x1 -= width / 2.0;
+	  break;
+	case GTK_ANCHOR_NE:
+	case GTK_ANCHOR_E:
+	case GTK_ANCHOR_SE:
+	  simple->bounds.x1 -= width;
+	  break;
+	default:
+	  break;
+	}
 
-      if (witem->widget)
+      switch (witem->anchor)
 	{
-	  /* Compute the new bounds. */
-	  if (witem->width < 0 || witem->height < 0)
-	    {
-	      gtk_widget_size_request (witem->widget, &requisition);
-	    }
+	case GTK_ANCHOR_W:
+	case GTK_ANCHOR_CENTER:
+	case GTK_ANCHOR_E:
+	  simple->bounds.y1 -= height / 2.0;
+	  break;
+	case GTK_ANCHOR_SW:
+	case GTK_ANCHOR_S:
+	case GTK_ANCHOR_SE:
+	  simple->bounds.y1 -= height;
+	  break;
+	default:
+	  break;
+	}
 
-	  simple->bounds.x1 = witem->x;
-	  simple->bounds.y1 = witem->y;
-	  width = witem->width < 0 ? requisition.width : witem->width;
-	  height = witem->height < 0 ? requisition.height : witem->height;
+      simple->bounds.x2 = simple->bounds.x1 + width;
+      simple->bounds.y2 = simple->bounds.y1 + height;
 
-	  switch (witem->anchor)
-	    {
-	    case GTK_ANCHOR_N:
-	    case GTK_ANCHOR_CENTER:
-	    case GTK_ANCHOR_S:
-	      simple->bounds.x1 -= width / 2.0;
-	      break;
-	    case GTK_ANCHOR_NE:
-	    case GTK_ANCHOR_E:
-	    case GTK_ANCHOR_SE:
-	      simple->bounds.x1 -= width;
-	      break;
-	    default:
-	      break;
-	    }
+      /* Queue a resize of the widget so it gets moved. Note that the widget
+	 is moved by goo_canvas_size_allocate(). */
+      gtk_widget_queue_resize (witem->widget);
+    }
+  else
+    {
+      simple->bounds.x1 = simple->bounds.y1 = 0.0;
+      simple->bounds.x2 = simple->bounds.y2 = 0.0;
+    }
+}
 
-	  switch (witem->anchor)
-	    {
-	    case GTK_ANCHOR_W:
-	    case GTK_ANCHOR_CENTER:
-	    case GTK_ANCHOR_E:
-	      simple->bounds.y1 -= height / 2.0;
-	      break;
-	    case GTK_ANCHOR_SW:
-	    case GTK_ANCHOR_S:
-	    case GTK_ANCHOR_SE:
-	      simple->bounds.y1 -= height;
-	      break;
-	    default:
-	      break;
-	    }
 
-	  simple->bounds.x2 = simple->bounds.x1 + width;
-	  simple->bounds.y2 = simple->bounds.y1 + height;
+static void
+goo_canvas_widget_allocate_area      (GooCanvasItem    *item,
+				      cairo_t          *cr,
+				      GooCanvasBounds  *requested_area,
+				      GooCanvasBounds  *allocated_area,
+				      gdouble           x_offset,
+				      gdouble           y_offset)
+{
+  GooCanvasItemSimple *simple = (GooCanvasItemSimple*) item;
+  GooCanvasWidget *witem = (GooCanvasWidget*) item;
+  gdouble requested_width, requested_height, allocated_width, allocated_height;
+  gdouble width_proportion, height_proportion;
+  gdouble width, height;
 
-	  goo_canvas_item_simple_user_bounds_to_device (simple, cr,
-							&simple->bounds);
+  width = simple->bounds.x2 - simple->bounds.x1;
+  height = simple->bounds.y2 - simple->bounds.y1;
 
-	  /* Request a redraw of the new bounds. */
-	  goo_canvas_request_redraw (simple->canvas, &simple->bounds);
+  simple->bounds.x1 += x_offset;
+  simple->bounds.y1 += y_offset;
 
-	  /* Queue a resize of the widget so it gets moved. */
-	  gtk_widget_queue_resize (witem->widget);
-	}
-      else
-	{
-	  simple->bounds.x1 = simple->bounds.y1 = 0.0;
-	  simple->bounds.x2 = simple->bounds.y2 = 0.0;
-	}
+  requested_width = requested_area->x2 - requested_area->x1;
+  requested_height = requested_area->y2 - requested_area->y1;
+  allocated_width = allocated_area->x2 - allocated_area->x1;
+  allocated_height = allocated_area->y2 - allocated_area->y1;
 
-      cairo_restore (cr);
-    }
+  width_proportion = allocated_width / requested_width;
+  height_proportion = allocated_height / requested_height;
 
-  *bounds = simple->bounds;
+  width *= width_proportion;
+  height *= height_proportion;
+
+  simple->bounds.x2 = simple->bounds.x1 + width;
+  simple->bounds.y2 = simple->bounds.y1 + height;
+
+  /* Queue a resize of the widget so it gets moved. Note that the widget
+     is moved by goo_canvas_size_allocate(). */
+  gtk_widget_queue_resize (witem->widget);
 }
 
 
 static void
-goo_canvas_widget_paint (GooCanvasItem     *item,
-			 cairo_t           *cr,
-			 GooCanvasBounds   *bounds,
-			 gdouble            scale)
+goo_canvas_widget_paint (GooCanvasItemSimple *simple,
+			 cairo_t             *cr,
+			 GooCanvasBounds     *bounds)
 {
   /* Do nothing for now. Maybe render for printing in future. */
 }
 
 
 static GooCanvasItem*
-goo_canvas_widget_get_item_at (GooCanvasItem  *item,
-			       gdouble         x,
-			       gdouble         y,
-			       cairo_t        *cr,
-			       gboolean        is_pointer_event,
-			       gboolean        parent_visible)
+goo_canvas_widget_get_item_at (GooCanvasItemSimple *simple,
+			       gdouble              x,
+			       gdouble              y,
+			       cairo_t             *cr,
+			       gboolean             is_pointer_event)
 {
   /* FIXME: Should we return the widget here? */
   return NULL;
@@ -523,7 +464,82 @@
 {
   iface->set_canvas     = goo_canvas_widget_set_canvas;
   iface->set_parent	= goo_canvas_widget_set_parent;
-  iface->get_item_at    = goo_canvas_widget_get_item_at;
-  iface->update         = goo_canvas_widget_update;
-  iface->paint          = goo_canvas_widget_paint;
+  iface->allocate_area  = goo_canvas_widget_allocate_area;
 }
+
+
+static void
+goo_canvas_widget_class_init (GooCanvasWidgetClass *klass)
+{
+  GObjectClass *gobject_class = (GObjectClass*) klass;
+  GooCanvasItemSimpleClass *simple_class = (GooCanvasItemSimpleClass*) klass;
+
+  gobject_class->finalize = goo_canvas_widget_finalize;
+
+  gobject_class->get_property = goo_canvas_widget_get_property;
+  gobject_class->set_property = goo_canvas_widget_set_property;
+
+  simple_class->update        = goo_canvas_widget_update;
+  simple_class->paint         = goo_canvas_widget_paint;
+  simple_class->get_item_at   = goo_canvas_widget_get_item_at;
+
+  /* Register our accessible factory, but only if accessibility is enabled. */
+  if (!ATK_IS_NO_OP_OBJECT_FACTORY (atk_registry_get_factory (atk_get_default_registry (), GTK_TYPE_WIDGET)))
+    {
+      atk_registry_set_factory_type (atk_get_default_registry (),
+				     GOO_TYPE_CANVAS_WIDGET,
+				     goo_canvas_widget_accessible_factory_get_type ());
+    }
+
+  g_object_class_install_property (gobject_class, PROP_WIDGET,
+				   g_param_spec_object ("widget",
+							_("Widget"),
+							_("The widget to place in the canvas"),
+							GTK_TYPE_WIDGET,
+							G_PARAM_READWRITE));
+
+  g_object_class_install_property (gobject_class, PROP_X,
+				   g_param_spec_double ("x",
+							"X",
+							_("The x coordinate of the widget"),
+							-G_MAXDOUBLE,
+							G_MAXDOUBLE, 0.0,
+							G_PARAM_READWRITE));
+
+  g_object_class_install_property (gobject_class, PROP_Y,
+				   g_param_spec_double ("y",
+							"Y",
+							_("The y coordinate of the widget"),
+							-G_MAXDOUBLE,
+							G_MAXDOUBLE, 0.0,
+							G_PARAM_READWRITE));
+
+  g_object_class_install_property (gobject_class, PROP_WIDTH,
+				   g_param_spec_double ("width",
+							_("Width"),
+							_("The width of the widget, or -1 to use its requested width"),
+							-G_MAXDOUBLE,
+							G_MAXDOUBLE, -1.0,
+							G_PARAM_READWRITE));
+
+  g_object_class_install_property (gobject_class, PROP_HEIGHT,
+				   g_param_spec_double ("height",
+							_("Height"),
+							_("The height of the widget, or -1 to use its requested height"),
+							-G_MAXDOUBLE,
+							G_MAXDOUBLE, -1.0,
+							G_PARAM_READWRITE));
+
+  g_object_class_install_property (gobject_class, PROP_ANCHOR,
+				   g_param_spec_enum ("anchor",
+						      _("Anchor"),
+						      _("How to position the widget relative to the item's x and y coordinate settings"),
+						      GTK_TYPE_ANCHOR_TYPE,
+						      GTK_ANCHOR_NW,
+						      G_PARAM_READWRITE));
+
+  g_object_class_override_property (gobject_class, PROP_VISIBILITY,
+				    "visibility");
+}
+
+



More information about the cairo-commit mailing list