docs: Add more comments on how allocate() works
authorElliot Smith <elliot.smith@intel.com>
Fri, 28 Jan 2011 16:43:22 +0000 (16:43 +0000)
committerElliot Smith <elliot.smith@intel.com>
Mon, 31 Jan 2011 10:08:08 +0000 (10:08 +0000)
Add some extra description to the allocate() function,
explaining how the allocation has to be adjusted to
coordinates relative to the actor as a whole, before
applying to the single child actor it is composed from.

doc/cookbook/examples/cb-button.c

index d168743..20ee6e5 100644 (file)
@@ -162,7 +162,14 @@ cb_button_allocate (ClutterActor          *actor,
   /* set the allocation for the whole button */
   CLUTTER_ACTOR_CLASS (cb_button_parent_class)->allocate (actor, box, flags);
 
-  /* make the child (the ClutterBox) fill the parent */
+  /* make the child (the ClutterBox) fill the parent;
+   * note that this allocation box is relative to the
+   * coordinates of the whole button actor, so we can't just
+   * use the box passed into this function; instead, it
+   * is adjusted to span the whole of the actor, from its
+   * top-left corner (0,0) to its bottom-right corner
+   * (width,height)
+   */
   child_box.x1 = 0.0;
   child_box.y1 = 0.0;
   child_box.x2 = clutter_actor_box_get_width (box);