[cairo-commit] goocanvas/demo table-demo.c,1.4,1.5

Damon Chaplin commit at pdx.freedesktop.org
Tue Feb 20 14:54:52 PST 2007


Committed by: damon

Update of /cvs/cairo/goocanvas/demo
In directory kemper:/tmp/cvs-serv16006/demo

Modified Files:
	table-demo.c 
Log Message:
2007-02-20  Damon Chaplin  <damon at gnome.org>

	* src/goocanvastable.c (goo_canvas_table_get_item_at) 
	(goo_canvas_table_paint): if the table was shrunk below its requested
	size, clip the children if appropriate.

	* src/goocanvastable.c (goo_canvas_table_get_item_at) 
	(goo_canvas_table_paint): 
	* src/goocanvasgroup.c (goo_canvas_group_get_item_at) 
	(goo_canvas_group_paint): check the bounds and handle the clip path.

	* demo/table-demo.c (create_demo_table): added parameters and created
	a second table of shapes, this time with the items shrunk and clipped.



Index: table-demo.c
===================================================================
RCS file: /cvs/cairo/goocanvas/demo/table-demo.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- table-demo.c	13 Feb 2007 13:25:09 -0000	1.4
+++ table-demo.c	20 Feb 2007 22:54:46 -0000	1.5
@@ -154,15 +154,21 @@
 
 
 static void
-create_demo_table (GooCanvasItem *root)
+create_demo_table (GooCanvasItem *root,
+		   gdouble        x,
+		   gdouble        y,
+		   gdouble        width,
+		   gdouble        height)
 {
   GooCanvasItem *table, *square, *circle, *triangle;
 
   table = goo_canvas_table_new (root,
                                 "row-spacing", 4.0,
                                 "column-spacing", 4.0,
+				"width", width,
+				"height", height,
                                 NULL);
-  goo_canvas_item_translate (table, 400, 200);
+  goo_canvas_item_translate (table, x, y);
 
   square = goo_canvas_rect_new (table, 0.0, 0.0, 50.0, 50.0,
 				"fill-color", "red",
@@ -170,7 +176,11 @@
   goo_canvas_item_set_child_properties (table, square,
 					"row", 0,
 					"column", 0,
+					"x-shrink", TRUE,
 					NULL);
+  g_object_set_data (G_OBJECT (square), "id", "Red square");
+  g_signal_connect (square, "button_press_event",
+		    (GtkSignalFunc) on_button_press, NULL);
 
   circle = goo_canvas_ellipse_new (table, 0.0, 0.0, 25.0, 25.0,
 				   "fill-color", "blue",
@@ -178,7 +188,11 @@
   goo_canvas_item_set_child_properties (table, circle,
 					"row", 0,
 					"column", 1,
+					"x-shrink", TRUE,
 					NULL);
+  g_object_set_data (G_OBJECT (circle), "id", "Blue circle");
+  g_signal_connect (circle, "button_press_event",
+		    (GtkSignalFunc) on_button_press, NULL);
 
   triangle = goo_canvas_polyline_new (table, TRUE, 3,
 				      25.0, 0.0, 0.0, 50.0, 50.0, 50.0,
@@ -187,7 +201,11 @@
   goo_canvas_item_set_child_properties (table, triangle,
 					"row", 0,
 					"column", 2,
+					"x-shrink", TRUE,
 					NULL);
+  g_object_set_data (G_OBJECT (triangle), "id", "Yellow triangle");
+  g_signal_connect (triangle, "button_press_event",
+		    (GtkSignalFunc) on_button_press, NULL);
 }
 
 
@@ -238,7 +256,8 @@
   root = goo_canvas_get_root_item (GOO_CANVAS (canvas));
 
 #if 1
-  create_demo_table (root);
+  create_demo_table (root, 400, 200, -1, -1);
+  create_demo_table (root, 400, 260, 100, -1);
 #endif
 
 #if 1



More information about the cairo-commit mailing list