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

Damon Chaplin commit at pdx.freedesktop.org
Mon Feb 26 17:01:45 PST 2007


Committed by: damon

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

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

	* src/goocanvasitem.[hc]: changed get_item_at method to get_items_at
	which returns a list of found items rather than a single found item.

	* src/goocanvasitemsimple.[hc]: changed get_item_at() method to
	is_item_at() which just returns a boolean, and updated to new API.

	* src/goocanvas.c (goo_canvas_get_item_at): updated to use new API.
	(goo_canvas_get_items_at): new function to return list of found items.

	* src/goocanvastable.c (goo_canvas_table_get_items_at): 
	* src/goocanvasgroup.c (goo_canvas_group_get_items_at):
	* src/goocanvasimage.c (goo_canvas_image_is_item_at): 
	* src/goocanvaspolyline.c (goo_canvas_polyline_is_item_at): 
	* src/goocanvastext.c (goo_canvas_text_is_item_at): 
	* src/goocanvaswidget.c (goo_canvas_widget_is_item_at): 
	* docs/creating-items.xml: 
	* demo/demo-item.c (goo_demo_item_is_item_at): updated for new API.



Index: demo-item.c
===================================================================
RCS file: /cvs/cairo/goocanvas/demo/demo-item.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- demo-item.c	17 Feb 2007 13:48:37 -0000	1.4
+++ demo-item.c	27 Feb 2007 01:01:38 -0000	1.5
@@ -105,27 +105,27 @@
 
 
 /* Hit detection. This should check if the given coordinate (in the item's
-   coordinate space) is within the item. If it is it should return the item,
-   otherwise it should return NULL. */
-static GooCanvasItem*
-goo_demo_item_get_item_at (GooCanvasItemSimple *simple,
-			   gdouble              x,
-			   gdouble              y,
-			   cairo_t             *cr,
-			   gboolean             is_pointer_event)
+   coordinate space) is within the item. If it is it should return TRUE,
+   otherwise it should return FALSE. */
+static gboolean
+goo_demo_item_is_item_at (GooCanvasItemSimple *simple,
+			  gdouble              x,
+			  gdouble              y,
+			  cairo_t             *cr,
+			  gboolean             is_pointer_event)
 {
   GooDemoItem *demo_item = (GooDemoItem*) simple;
 
   if (x < demo_item->x || (x > demo_item->x + demo_item->width)
       || y < demo_item->y || (y > demo_item->y + demo_item->height))
-    return NULL;
+    return FALSE;
 
-  return (GooCanvasItem*) simple;
+  return TRUE;
 }
 
 
 /* The class initialization function. Here we set the class' update(), paint()
-   and get_item_at() methods. */
+   and is_item_at() methods. */
 static void
 goo_demo_item_class_init (GooDemoItemClass *klass)
 {
@@ -133,7 +133,7 @@
 
   simple_class->simple_update        = goo_demo_item_update;
   simple_class->simple_paint         = goo_demo_item_paint;
-  simple_class->simple_get_item_at   = goo_demo_item_get_item_at;
+  simple_class->simple_is_item_at    = goo_demo_item_is_item_at;
 }
 
 



More information about the cairo-commit mailing list