ClutterSnapConstraint

## ClutterSnapConstraint ClutterSnapConstraint — A constraint snapping two actors together |

## Synopsis

    enum                ClutterSnapEdge;
                        ClutterSnapConstraint;
    ClutterConstraint * clutter_snap_constraint_new         (ClutterActor *source,
                                                             ClutterSnapEdge from_edge,
                                                             ClutterSnapEdge to_edge,
                                                             gfloat offset);
    void                clutter_snap_constraint_set_source  (ClutterSnapConstraint *constraint,
                                                             ClutterActor *source);
    ClutterActor *      clutter_snap_constraint_get_source  (ClutterSnapConstraint *constraint);
    void                clutter_snap_constraint_set_edges   (ClutterSnapConstraint *constraint,
                                                             ClutterSnapEdge from_edge,
                                                             ClutterSnapEdge to_edge);
    void                clutter_snap_constraint_get_edges   (ClutterSnapConstraint *constraint,
                                                             ClutterSnapEdge *from_edge,
                                                             ClutterSnapEdge *to_edge);
    void                clutter_snap_constraint_set_offset  (ClutterSnapConstraint *constraint,
                                                             gfloat offset);
    gfloat              clutter_snap_constraint_get_offset  (ClutterSnapConstraint *constraint);

## Object Hierarchy

      GObject
       +----GInitiallyUnowned
             +----ClutterActorMeta
                   +----ClutterConstraint
                         +----ClutterSnapConstraint

## Properties

      "from-edge"                ClutterSnapEdge       : Read / Write / Construct
      "offset"                   gfloat                : Read / Write / Construct
      "source"                   ClutterActor*         : Read / Write / Construct
      "to-edge"                  ClutterSnapEdge       : Read / Write / Construct

## Description

ClutterSnapConstraint is a constraint the snaps the edges of two actors together, expanding the actor's allocation if necessary.

An offset can be applied to the constraint, to provide spacing.

ClutterSnapConstraint is available since Clutter 1.6

## Details

### enum ClutterSnapEdge

    typedef enum {
      CLUTTER_SNAP_EDGE_TOP,
      CLUTTER_SNAP_EDGE_RIGHT,
      CLUTTER_SNAP_EDGE_BOTTOM,
      CLUTTER_SNAP_EDGE_LEFT
    } ClutterSnapEdge;

The edge to snap

`CLUTTER_SNAP_EDGE_TOP` | the top edge
`CLUTTER_SNAP_EDGE_RIGHT` | the right edge
`CLUTTER_SNAP_EDGE_BOTTOM` | the bottom edge
`CLUTTER_SNAP_EDGE_LEFT` | the left edge

Since 1.6

### ClutterSnapConstraint

    typedef struct _ClutterSnapConstraint ClutterSnapConstraint;

ClutterSnapConstraint is an opaque structure whose members cannot be directly accesses

Since 1.6

### clutter_snap_constraint_new ()

    ClutterConstraint * clutter_snap_constraint_new         (ClutterActor *source,
                                                             ClutterSnapEdge from_edge,
                                                             ClutterSnapEdge to_edge,
                                                             gfloat offset);

Creates a new ClutterSnapConstraint that will snap a ClutterActor to the `edge` of `source`, with the given `offset`.

`source` : | the ClutterActor to use as the source of the constraint, or `NULL`. [allow-none]
`from_edge` : | the edge of the actor to use in the constraint
`to_edge` : | the edge of `source` to use in the constraint
`offset` : | the offset to apply to the constraint, in pixels
Returns : | the newly created ClutterSnapConstraint

Since 1.6

### clutter_snap_constraint_set_source ()

    void                clutter_snap_constraint_set_source  (ClutterSnapConstraint *constraint,
                                                             ClutterActor *source);

Sets the source ClutterActor for the constraint

`constraint` : | a ClutterSnapConstraint
`source` : | a ClutterActor, or `NULL` to unset the source. [allow-none]

Since 1.6

### clutter_snap_constraint_get_source ()

    ClutterActor *      clutter_snap_constraint_get_source  (ClutterSnapConstraint *constraint);

Retrieves the ClutterActor set using `clutter_snap_constraint_set_source()`

`constraint` : | a ClutterSnapConstraint
Returns : | a pointer to the source actor. [transfer none]

Since 1.6

### clutter_snap_constraint_set_edges ()

    void                clutter_snap_constraint_set_edges   (ClutterSnapConstraint *constraint,
                                                             ClutterSnapEdge from_edge,
                                                             ClutterSnapEdge to_edge);

Sets the edges to be used by the `constraint`

The `from_edge` is the edge on the ClutterActor to which `constraint` has been added. The `to_edge` is the edge of the ClutterActor inside the "source" property.

`constraint` : | a ClutterSnapConstraint
`from_edge` : | the edge on the actor
`to_edge` : | the edge on the source

Since 1.6

### clutter_snap_constraint_get_edges ()

    void                clutter_snap_constraint_get_edges   (ClutterSnapConstraint *constraint,
                                                             ClutterSnapEdge *from_edge,
                                                             ClutterSnapEdge *to_edge);

Retrieves the edges used by the `constraint`

`constraint` : | a ClutterSnapConstraint
`from_edge` : | return location for the actor's edge, or `NULL`. [out]
`to_edge` : | return location for the source's edge, or `NULL`. [out]

Since 1.6

### clutter_snap_constraint_set_offset ()

    void                clutter_snap_constraint_set_offset  (ClutterSnapConstraint *constraint,
                                                             gfloat offset);

Sets the offset to be applied to the constraint

`constraint` : | a ClutterSnapConstraint
`offset` : | the offset to apply, in pixels

Since 1.6

### clutter_snap_constraint_get_offset ()

    gfloat              clutter_snap_constraint_get_offset  (ClutterSnapConstraint *constraint);

Retrieves the offset set using `clutter_snap_constraint_set_offset()`

`constraint` : | a ClutterSnapConstraint
Returns : | the offset, in pixels

Since 1.6

## Property Details

### The `"from-edge"` property

      "from-edge"                ClutterSnapEdge       : Read / Write / Construct

The edge of the ClutterActor that should be snapped

Default value: CLUTTER_SNAP_EDGE_RIGHT

Since 1.6

### The `"offset"` property

      "offset"                   gfloat                : Read / Write / Construct

The offset, in pixels, between "from-edge" and "to-edge"

Default value: 0

Since 1.6

### The `"source"` property

      "source"                   ClutterActor*         : Read / Write / Construct

The ClutterActor used as the source for the constraint

Since 1.6

### The `"to-edge"` property

      "to-edge"                  ClutterSnapEdge       : Read / Write / Construct

The edge of the "source" that should be snapped

Default value: CLUTTER_SNAP_EDGE_RIGHT

Since 1.6