Gtk.GestureSingle¶
- Subclasses:
Gtk.GestureDrag
,Gtk.GestureLongPress
,Gtk.GestureMultiPress
,Gtk.GestureStylus
,Gtk.GestureSwipe
Methods¶
- Inherited:
Gtk.Gesture (19), Gtk.EventController (5), GObject.Object (37)
- Structs:
|
|
|
|
|
|
|
Virtual Methods¶
- Inherited:
Properties¶
- Inherited:
Name |
Type |
Flags |
Short Description |
---|---|---|---|
r/w/en |
Button number to listen to |
||
r/w/en |
Whether the gesture is exclusive |
||
r/w/en |
Whether the gesture handles only touch events |
Signals¶
- Inherited:
Fields¶
- Inherited:
Class Details¶
- class Gtk.GestureSingle(**kwargs)¶
- Bases:
- Abstract:
No
- Structure:
Gtk.GestureSingle
is a subclass ofGtk.Gesture
, 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 throughGtk.GestureSingle.get_current_sequence
() while the gesture is being interacted with.By default gestures react to both
Gdk.BUTTON_PRIMARY
and touch events,Gtk.GestureSingle.set_touch_only
() can be used to change the touch behavior. Callers may also specify a different mouse button number to interact with throughGtk.GestureSingle.set_button
(), or react to any mouse button by setting 0. While the gesture is active, the button being currently pressed can be known throughGtk.GestureSingle.get_current_button
().- get_button()[source]¶
- Returns:
The button number, or 0 for any button
- Return type:
Returns the button number self listens for, or 0 if self reacts to any button press.
New in version 3.14.
- get_current_button()[source]¶
- Returns:
The current button number
- Return type:
Returns the button number currently interacting with self, or 0 if there is none.
New in version 3.14.
- get_current_sequence()[source]¶
- Returns:
the current sequence
- Return type:
Returns the event sequence currently interacting with self. This is only meaningful if
Gtk.Gesture.is_active
() returnsTrue
.New in version 3.14.
- get_exclusive()[source]¶
- Returns:
Whether the gesture is exclusive
- Return type:
Gets whether a gesture is exclusive. For more information, see
Gtk.GestureSingle.set_exclusive
().New in version 3.14.
- get_touch_only()[source]¶
-
Returns
True
if the gesture is only triggered by touch events.New in version 3.14.
- set_button(button)[source]¶
- Parameters:
button (
int
) – button number to listen to, or 0 for any button
Sets the button number self listens to. If non-0, every button press from a different button number will be ignored. Touch events implicitly match with button 1.
New in version 3.14.
- set_exclusive(exclusive)[source]¶
-
Sets whether self 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.
New in version 3.14.
- set_touch_only(touch_only)[source]¶
- Parameters:
touch_only (
bool
) – whether self handles only touch events
If touch_only is
True
, self will only handle events of typeGdk.EventType.TOUCH_BEGIN
,Gdk.EventType.TOUCH_UPDATE
orGdk.EventType.TOUCH_END
. IfFalse
, mouse events will be handled too.New in version 3.14.
Property Details¶
- Gtk.GestureSingle.props.button¶
- Name:
button
- Type:
- Default Value:
1
- Flags:
Mouse button number to listen to, or 0 to listen for any button.
New in version 3.14.
- Gtk.GestureSingle.props.exclusive¶
- Name:
exclusive
- Type:
- Default Value:
- Flags:
Whether the gesture is exclusive. Exclusive gestures only listen to pointer and pointer emulated events.
New in version 3.14.