Action enabling dragging on actors
<clutter-drag-action>
is a sub-class of <clutter-action>
that implements all the necessary logic for dragging actors.
The simplest usage of <clutter-drag-action>
consists in adding it
to a <clutter-actor>
and setting it as reactive; for instance,
the following code:
clutter_actor_add_action (actor, clutter_drag_action_new ()); clutter_actor_set_reactive (actor, TRUE);
will automatically result in the actor moving to follow the pointer whenever the pointer's button is pressed over the actor and moved across the stage.
The <clutter-drag-action>
will signal the begin and the end of a
dragging through the <"drag-begin">
and <"drag-end">
signals, respectively. Each pointer motion during a drag will also
result in the <"drag-motion">
signal to be emitted.
It is also possible to set another <clutter-actor>
as the dragged
actor by calling clutter-drag-action-set-drag-handle
from within
a handle of the <"drag-begin">
signal. The drag handle must be
parented and exist between the emission of <"drag-begin">
and
<"drag-end">
.
The example program above allows dragging the rectangle around the stage
using a <clutter-drag-action>
. When pressing the
"Shift") key the actor that is going to be dragged is a separate
rectangle, and when the drag ends, the original rectangle will be
animated to the final coordinates.
<clutter-drag-action>
is available since Clutter 1.4
<clutter-action>
)Creates a new
<clutter-drag-action>
instance
- ret
- the newly created
<clutter-drag-action>
Since 1.4
<clutter-drag-action>
) (handle <clutter-actor>
)Sets the actor to be used as the drag handle.
- action
- a
<clutter-drag-action>
- handle
- a
<clutter-actor>
, or ‘#f
’ to unset.Since 1.4
<clutter-drag-action>
) ⇒ (ret <clutter-actor>
)Retrieves the drag handle set by
clutter-drag-action-set-drag-handle
- action
- a
<clutter-drag-action>
- ret
- a
<clutter-actor>
, used as the drag handle, or ‘#f
’ if none was set.Since 1.4