Top |
GObject ╰── GtkEventController ╰── GtkGesture ╰── GtkGestureSingle ╰── GtkGestureSwipe
GtkGestureSwipe is a GtkGesture implementation able to recognize swipes, after a press/move/.../move/release sequence happens, the “swipe” signal will be emitted, providing the velocity and directionality of the sequence at the time it was lifted.
If the velocity is desired in intermediate points,
gtk_gesture_swipe_get_velocity()
can be called on eg. a
“update” handler.
All velocities are reported in pixels/sec units.
GtkGesture *
gtk_gesture_swipe_new (GtkWidget *widget
);
Returns a newly created GtkGesture that recognizes swipes.
Since: 3.14
gboolean gtk_gesture_swipe_get_velocity (GtkGestureSwipe *gesture
,gdouble *velocity_x
,gdouble *velocity_y
);
If the gesture is recognized, this function returns TRUE
and fill in
velocity_x
and velocity_y
with the recorded velocity, as per the
last event(s) processed.
gesture |
||
velocity_x |
return value for the velocity in the X axis, in pixels/sec. |
[out] |
velocity_y |
return value for the velocity in the Y axis, in pixels/sec. |
[out] |
Since: 3.14
“swipe”
signalvoid user_function (GtkGestureSwipe *gesture, double velocity_x, double velocity_y, gpointer user_data)
This signal is emitted when the recognized gesture is finished, velocity and direction are a product of previously recorded events.
gesture |
object which received the signal |
|
velocity_x |
velocity in the X axis, in pixels/sec |
|
velocity_y |
velocity in the Y axis, in pixels/sec |
|
user_data |
user data set when the signal handler was connected. |
Flags: Run Last
Since: 3.14