### Class

# Clutter ClickAction

#### Description [src]

    class Clutter.ClickAction : Clutter.Action {
      parent_instance: ClutterAction
    }

Action for clickable actors

`ClutterClickAction` is a sub-class of `ClutterAction` that implements the logic for clickable actors, by using the low level events of `ClutterActor`, such as `ClutterActor::button-press-event` and `ClutterActor::button-release-event`, to synthesize the high level `ClutterClickAction::clicked` signal.

To use `ClutterClickAction` you just need to apply it to a `ClutterActor` using `clutter_actor_add_action()` and connect to the `ClutterClickAction::clicked` signal:

      ClutterAction *action = clutter_click_action_new ();

      clutter_actor_add_action (actor, action);

      g_signal_connect (action, "clicked", G_CALLBACK (on_clicked), NULL);

`ClutterClickAction` also supports long press gestures: a long press is activated if the pointer remains pressed within a certain threshold (as defined by the `ClutterClickAction:long-press-threshold` property) for a minimum amount of time (as the defined by the `ClutterClickAction:long-press-duration` property). The `ClutterClickAction::long-press` signal is emitted multiple times, using different `ClutterLongPressState` values; to handle long presses you should connect to the `ClutterClickAction::long-press` signal and handle the different states:

      static gboolean
      on_long_press (ClutterClickAction    *action,
                     ClutterActor          *actor,
                     ClutterLongPressState  state)
      {
        switch (state)
          {
          case CLUTTER_LONG_PRESS_QUERY:
            // return TRUE if the actor should support long press
            // gestures, and FALSE otherwise; this state will be
            // emitted on button presses
            return TRUE;

          case CLUTTER_LONG_PRESS_ACTIVATE:
            // this state is emitted if the minimum duration has
            // been reached without the gesture being cancelled.
            // the return value is not used
            return TRUE;

          case CLUTTER_LONG_PRESS_CANCEL:
            // this state is emitted if the long press was cancelled;
            // for instance, the pointer went outside the actor or the
            // allowed threshold, or the button was released before
            // the minimum duration was reached. the return value is
            // not used
            return FALSE;
          }
      }

#### Ancestors

- ClutterAction
- ClutterActorMeta
- GInitiallyUnowned
- GObject

#### Constructors

###### clutter_click_action_new

Creates a new `ClutterClickAction` instance.

#### Instance methods

###### clutter_click_action_get_button

Retrieves the button that was pressed.

###### clutter_click_action_get_coords

Retrieves the screen coordinates of the button press.

###### clutter_click_action_get_state

Retrieves the modifier state of the click action.

###### clutter_click_action_release

Emulates a release of the pointer button, which ungrabs the pointer and unsets the `ClutterClickAction:pressed` state.

##### Methods inherited from ClutterAction (1)

###### clutter_action_get_phase

No description available.

##### Methods inherited from ClutterActorMeta (5)

###### clutter_actor_meta_get_actor

Retrieves a pointer to the `ClutterActor` that owns `meta`.

###### clutter_actor_meta_get_enabled

Retrieves whether `meta` is enabled.

###### clutter_actor_meta_get_name

Retrieves the name set using `clutter_actor_meta_set_name()`

###### clutter_actor_meta_set_enabled

Sets whether `meta` should be enabled or not.

###### clutter_actor_meta_set_name

Sets the name of `meta`.

##### Methods inherited from GObject (43)

Please see GObject for a full list of methods.

#### Properties

###### Clutter.ClickAction:held

Whether the clickable actor has the pointer grabbed.

###### Clutter.ClickAction:long-press-duration

The minimum duration of a press for it to be recognized as a long press gesture, in milliseconds.

###### Clutter.ClickAction:long-press-threshold

The maximum allowed distance that can be covered (on both axes) before a long press gesture is cancelled, in pixels.

###### Clutter.ClickAction:pressed

Whether the clickable actor should be in “pressed” state.

##### Properties inherited from ClutterActorMeta (3)

###### Clutter.ActorMeta:actor

The `ClutterActor` attached to the `ClutterActorMeta` instance.

###### Clutter.ActorMeta:enabled

Whether or not the `ClutterActorMeta` is enabled.

###### Clutter.ActorMeta:name

The unique name to access the `ClutterActorMeta`.

#### Signals

###### Clutter.ClickAction::clicked

The signal is emitted when the `ClutterActor` to which a `ClutterClickAction` has been applied should respond to a pointer button press and release events.

###### Clutter.ClickAction::long-press

The signal is emitted during the long press gesture handling.

##### Signals inherited from GObject (1)

###### GObject::notify

The notify signal is emitted on an object when one of its properties has its value set through g_object_set_property(), g_object_set(), et al.

#### Class structure

    struct ClutterClickActionClass {
      void (* clicked) (
        ClutterClickAction* action,
        ClutterActor* actor
      );
      gboolean (* long_press) (
        ClutterClickAction* action,
        ClutterActor* actor,
        ClutterLongPressState state
      );
      void (* _clutter_click_action1) (
    void
      );
      void (* _clutter_click_action2) (
    void
      );
      void (* _clutter_click_action3) (
    void
      );
      void (* _clutter_click_action4) (
    void
      );
      void (* _clutter_click_action5) (
    void
      );
      void (* _clutter_click_action6) (
    void
      );
      void (* _clutter_click_action7) (
    void
      );

    }

The `ClutterClickActionClass` structure contains only private data.

###### Class members

`clicked: void (* clicked) ( ClutterClickAction* action, ClutterActor* actor )`
  No description available.
`long_press: gboolean (* long_press) ( ClutterClickAction* action, ClutterActor* actor, ClutterLongPressState state )`
  No description available.
`_clutter_click_action1: void (* _clutter_click_action1) ( void )`
  No description available.
`_clutter_click_action2: void (* _clutter_click_action2) ( void )`
  No description available.
`_clutter_click_action3: void (* _clutter_click_action3) ( void )`
  No description available.
`_clutter_click_action4: void (* _clutter_click_action4) ( void )`
  No description available.
`_clutter_click_action5: void (* _clutter_click_action5) ( void )`
  No description available.
`_clutter_click_action6: void (* _clutter_click_action6) ( void )`
  No description available.
`_clutter_click_action7: void (* _clutter_click_action7) ( void )`
  No description available.

#### Virtual methods

###### Clutter.ClickActionClass.clicked

No description available.

###### Clutter.ClickActionClass.long_press

No description available.