GtkGestureLongPress

GtkGestureLongPress — "Press and Hold" gesture

Properties

double delay-factor Read / Write

Signals

void cancelled Run Last
void pressed Run Last

Types and Values

Object Hierarchy

    GObject
    ╰── GtkEventController
        ╰── GtkGesture
            ╰── GtkGestureSingle
                ╰── GtkGestureLongPress

Includes

#include <gtk/gtk.h>

Description

GtkGestureLongPress is a GtkGesture implementation able to recognize long presses, triggering the “pressed” after the timeout is exceeded.

If the touchpoint is lifted before the timeout passes, or if it drifts too far of the initial press point, the “cancelled” signal will be emitted.

Functions

gtk_gesture_long_press_new ()

GtkGesture *
gtk_gesture_long_press_new (void);

Returns a newly created GtkGesture that recognizes long presses.

Returns

a newly created GtkGestureLongPress

gtk_gesture_long_press_set_delay_factor ()

void
gtk_gesture_long_press_set_delay_factor
                               (GtkGestureLongPress *gesture,
                                double delay_factor);

Applies the given delay factor. The default long press time will be multiplied by this value. Valid values are in the range [0.5..2.0].

Parameters

gesture

A GtkGestureLongPress

delay_factor

The delay factor to apply

gtk_gesture_long_press_get_delay_factor ()

double
gtk_gesture_long_press_get_delay_factor
                               (GtkGestureLongPress *gesture);

Returns the delay factor as set by gtk_gesture_long_press_set_delay_factor().

Parameters

Returns

the delay factor

Types and Values

GtkGestureLongPress

typedef struct _GtkGestureLongPress GtkGestureLongPress;

Property Details

The “delay-factor” property

  “delay-factor”             double

Factor by which to modify the default timeout.

Owner: GtkGestureLongPress

Flags: Read / Write

Allowed values: [0.5,2]

Default value: 1

Signal Details

The “cancelled” signal

void
user_function (GtkGestureLongPress *gesture,
               gpointer             user_data)

This signal is emitted whenever a press moved too far, or was released before “pressed” happened.

Parameters

gesture

the object which received the signal

user_data

user data set when the signal handler was connected.

Flags: Run Last

The “pressed” signal

void
user_function (GtkGestureLongPress *gesture,
               double               x,
               double               y,
               gpointer             user_data)

This signal is emitted whenever a press goes unmoved/unreleased longer than what the GTK defaults tell.

Parameters

gesture

the object which received the signal

x

the X coordinate where the press happened, relative to the widget allocation

y

the Y coordinate where the press happened, relative to the widget allocation

user_data

user data set when the signal handler was connected.

Flags: Run Last

© 2005–2020 The GNOME Project
Licensed under the GNU Lesser General Public License version 2.1 or later.
https://developer.gnome.org/gtk4/4.0/GtkGestureLongPress.html