From a32f7811447addd100bb5919ee5e0f3d1157097f Mon Sep 17 00:00:00 2001 From: Emmanuele Bassi Date: Tue, 16 Nov 2010 17:18:50 +0000 Subject: [PATCH] docs: Break down the constraints example --- clutter/clutter-constraint.c | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/clutter/clutter-constraint.c b/clutter/clutter-constraint.c index 1c309b2c4..5945b2598 100644 --- a/clutter/clutter-constraint.c +++ b/clutter/clutter-constraint.c @@ -55,6 +55,37 @@ * The example below uses various #ClutterConstraints to * lay out three actors on a resizable stage. Only the central actor has * an explicit size, and no actor has an explicit position. + * + * The #ClutterRectangle with #ClutterActor:name + * layerA is explicitly sized to 100 pixels by 25 + * pixels, and it's added to the #ClutterStage; + * two #ClutterAlignConstraints are used + * to anchor layerA to the center of the stage, + * by using 0.5 as the alignment #ClutterAlignConstraint:factor on + * both the X and Y axis. + * the #ClutterRectangle with #ClutterActor:name + * layerB is added to the #ClutterStage with + * no explicit size; + * the #ClutterActor:x and #ClutterActor:width + * of layerB are bound to the same properties + * of layerA using two #ClutterBindConstraint + * objects, thus keeping layerB aligned to + * layerA; + * the top edge of layerB is + * snapped together with the bottom edge of layerA; + * the bottom edge of layerB is also snapped + * together with the bottom edge of the #ClutterStage; an offset is + * given to the two #ClutterSnapConstraints to allow for some + * padding; since layerB is snapped between two + * different #ClutterActors, its height is stretched to match + * the gap; + * the #ClutterRectangle with #ClutterActor:name + * layerC mirrors layerB, + * snapping the top edge of the #ClutterStage to the top edge of + * layerC and the top edge of + * layerA to the bottom edge of + * layerC;/simpara> + * * * FIXME: MISSING XINCLUDE CONTENT * @@ -62,6 +93,9 @@ * Constraints * * + * You can try resizing interactively the #ClutterStage and verify + * that the three #ClutterActors maintain the same position and + * size relative to each other, and to the #CLutterStage. * * It's important to note that Clutter does not avoid loops * or competing constraints; if two or more #ClutterConstraints