Top |
Functions
Object Hierarchy
GObject ╰── GtkEventController ╰── GtkGesture ╰── GtkGestureSingle ├── GtkGestureDrag ├── GtkGestureLongPress ├── GtkGestureMultiPress ╰── GtkGestureSwipe
Description
GtkGestureSingle is a subclass of GtkGesture, optimized (although
not restricted) for dealing with mouse and single-touch gestures. Under
interaction, these gestures stick to the first interacting sequence, which
is accessible through gtk_gesture_single_get_current_sequence()
while the
gesture is being interacted with.
By default gestures react to both GDK_BUTTON_PRIMARY
and touch
events, gtk_gesture_single_set_touch_only()
can be used to change the
touch behavior. Callers may also specify a different mouse button number
to interact with through gtk_gesture_single_set_button()
, or react to any
mouse button by setting 0. While the gesture is active, the button being
currently pressed can be known through gtk_gesture_single_get_current_button()
.
Functions
gtk_gesture_single_get_exclusive ()
gboolean
gtk_gesture_single_get_exclusive (GtkGestureSingle *gesture
);
Gets whether a gesture is exclusive. For more information, see
gtk_gesture_single_set_exclusive()
.
Since 3.14
gtk_gesture_single_set_exclusive ()
void gtk_gesture_single_set_exclusive (GtkGestureSingle *gesture
,gboolean exclusive
);
Sets whether gesture
is exclusive. An exclusive gesture will
only handle pointer and "pointer emulated" touch events, so at
any given time, there is only one sequence able to interact with
those.
Since 3.14
gtk_gesture_single_get_touch_only ()
gboolean
gtk_gesture_single_get_touch_only (GtkGestureSingle *gesture
);
Returns TRUE
if the gesture is only triggered by touch events.
Since 3.14
gtk_gesture_single_set_touch_only ()
void gtk_gesture_single_set_touch_only (GtkGestureSingle *gesture
,gboolean touch_only
);
If touch_only
is TRUE
, gesture
will only handle events of type
GDK_TOUCH_BEGIN, GDK_TOUCH_UPDATE or GDK_TOUCH_END. If FALSE
,
mouse events will be handled too.
Since 3.14
gtk_gesture_single_get_button ()
guint
gtk_gesture_single_get_button (GtkGestureSingle *gesture
);
Returns the button number gesture
listens for, or 0 if gesture
reacts to any button press.
Since 3.14
gtk_gesture_single_set_button ()
void gtk_gesture_single_set_button (GtkGestureSingle *gesture
,guint button
);
Sets the button number gesture
listens to. If non-0, every
button press from a different button number will be ignored.
Touch events implicitly match with button 1.
Since 3.14
gtk_gesture_single_get_current_button ()
guint
gtk_gesture_single_get_current_button (GtkGestureSingle *gesture
);
Returns the button number currently interacting with gesture
, or 0 if there
is none.
Since 3.14
gtk_gesture_single_get_current_sequence ()
GdkEventSequence *
gtk_gesture_single_get_current_sequence
(GtkGestureSingle *gesture
);
Returns the event sequence currently interacting with gesture
.
This is only meaningful if gtk_gesture_is_active()
returns TRUE
.
Since 3.14
Property Details
The “button”
property
“button” guint
Mouse button number to listen to, or 0 to listen for any button.
Flags: Read / Write
Default value: 1
Since 3.14
The “exclusive”
property
“exclusive” gboolean
Whether the gesture is exclusive. Exclusive gestures only listen to pointer and pointer emulated events.
Flags: Read / Write
Default value: FALSE
Since 3.14
The “touch-only”
property
“touch-only” gboolean
Whether the gesture handles only touch events.
Flags: Read / Write
Default value: FALSE
Since 3.14