Gtk.GestureSingle
Gtk.GestureSingle — Base class for mouse/single-touch gestures
Object Hierarchy:
GObject
╰── Gtk.EventController
╰── Gtk.Gesture
╰── Gtk.GestureSingle
├── Gtk.GestureDrag
├── Gtk.GestureLongPress
├── Gtk.GestureMultiPress
╰── Gtk.GestureSwipe
Functions:
- get_exclusive
(self) -> bool
- set_exclusive
(self, exclusive:bool)
- get_touch_only
(self) -> bool
- set_touch_only
(self, touch_only:bool)
- get_button
(self) -> int
- set_button
(self, button:int)
- get_current_button
(self) -> int
- get_current_sequence
(self) -> Gdk.EventSequence or None
Description:
Gtk.GestureSingle
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.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 through Gtk.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 through Gtk.GestureSingle::get_current_button()
.
Function Details:
get_exclusive()
get_exclusive (self) -> bool
Gets whether a gesture is exclusive. For more information, seeGtk.GestureSingle:set_exclusive()
.
Returns: Whether the gesture is exclusive
Since: 3.14
set_exclusive()
set_exclusive (self, exclusive:bool)
Sets whether gesture
is exclusive. An exclusive gesture willonly handle pointer and "pointer emulated" touch events, so atany given time, there is only one sequence able to interact withthose.
- Since: 3.14
get_touch_only()
get_touch_only (self) -> bool
Returns True
if the gesture is only triggered by touch events.
Returns:
True
if the gesture only handles touch eventsSince: 3.14
set_touch_only()
set_touch_only (self, touch_only:bool)
If touch_only
is True
, gesture
will only handle events of typeGDK_TOUCH_BEGIN, GDK_TOUCH_UPDATE or GDK_TOUCH_END. If FALSE
,mouse events will be handled too.
- Since: 3.14
get_button()
get_button (self) -> int
Returns the button number gesture
listens for, or 0 if gesture
reacts to any button press.
Returns: The button number, or 0 for any button
Since: 3.14
set_button()
set_button (self, button:int)
Sets the button number gesture
listens to. If non-0, everybutton press from a different button number will be ignored.Touch events implicitly match with button 1.
- Since: 3.14
get_current_button()
get_current_button (self) -> int
Returns the button number currently interacting with gesture
, or 0 if thereis none.
Returns: The current button number
Since: 3.14
get_current_sequence()
get_current_sequence (self) -> Gdk.EventSequence or None
Returns the event sequence currently interacting with gesture
.This is only meaningful if `Gtk.Gesture:is_active
()returns
True`.
Returns: the current sequence.
Since: 3.14