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

## Functions

ClutterConstraint * | clutter_snap_constraint_new ()
void | clutter_snap_constraint_set_source ()
ClutterActor * | clutter_snap_constraint_get_source ()
void | clutter_snap_constraint_set_edges ()
void | clutter_snap_constraint_get_edges ()
void | clutter_snap_constraint_set_offset ()
gfloat | clutter_snap_constraint_get_offset ()

## Properties

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

## Types and Values

enum | ClutterSnapEdge
| ClutterSnapConstraint

## Object Hierarchy

        GObject
        ╰── GInitiallyUnowned
            ╰── ClutterActorMeta
                ╰── ClutterConstraint
                    ╰── ClutterSnapConstraint

## 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

## Functions

### 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` .

#### Parameters

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

#### Parameters

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()`

#### Parameters

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.

#### Parameters

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`

#### Parameters

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

#### Parameters

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()`

#### Parameters

constraint | a ClutterSnapConstraint |

#### Returns

the offset, in pixels

Since: 1.6

## Types and Values

### enum ClutterSnapEdge

The edge to snap

#### Members

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

## Property Details

### The `“from-edge”` property

      “from-edge”                ClutterSnapEdge

The edge of the ClutterActor that should be snapped

Flags: Read / Write / Construct

Default value: CLUTTER_SNAP_EDGE_RIGHT

Since: 1.6

### The `“offset”` property

      “offset”                   gfloat

The offset, in pixels, between “from-edge” and “to-edge”

Flags: Read / Write / Construct

Default value: 0

Since: 1.6

### The `“source”` property

      “source”                   ClutterActor *

The ClutterActor used as the source for the constraint

Flags: Read / Write / Construct

Since: 1.6

### The `“to-edge”` property

      “to-edge”                  ClutterSnapEdge

The edge of the “source” that should be snapped

Flags: Read / Write / Construct

Default value: CLUTTER_SNAP_EDGE_RIGHT

Since: 1.6