Gtk.GestureSingle

g GObject.Object GObject.Object Gtk.EventController Gtk.EventController GObject.Object->Gtk.EventController Gtk.Gesture Gtk.Gesture Gtk.EventController->Gtk.Gesture Gtk.GestureSingle Gtk.GestureSingle Gtk.Gesture->Gtk.GestureSingle

Subclasses:

Gtk.DragSource, Gtk.GestureClick, Gtk.GestureDrag, Gtk.GestureLongPress, Gtk.GestureStylus, Gtk.GestureSwipe

Methods

Inherited:

Gtk.Gesture (17), Gtk.EventController (13), GObject.Object (37)

Structs:

GObject.ObjectClass (5)

get_button ()

get_current_button ()

get_current_sequence ()

get_exclusive ()

get_touch_only ()

set_button (button)

set_exclusive (exclusive)

set_touch_only (touch_only)

Virtual Methods

Inherited:

GObject.Object (7)

Properties

Inherited:

Gtk.Gesture (1), Gtk.EventController (4)

Name

Type

Flags

Short Description

button

int

r/w/en

exclusive

bool

r/w/en

touch-only

bool

r/w/en

Signals

Inherited:

Gtk.Gesture (5), GObject.Object (1)

Fields

Inherited:

Gtk.Gesture (5), GObject.Object (1)

Class Details

class Gtk.GestureSingle(**kwargs)
Bases:

Gtk.Gesture

Abstract:

No

Structure:

Gtk.GestureSingleClass

GtkGestureSingle is a GtkGestures subclass optimized for singe-touch and mouse gestures.

Under interaction, these gestures stick to the first interacting sequence, which is accessible through [method`Gtk`.GestureSingle.get_current_sequence] while the gesture is being interacted with.

By default gestures react to both Gdk.BUTTON_PRIMARY and touch events. [method`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 [method`Gtk`.GestureSingle.set_button], or react to any mouse button by setting it to 0. While the gesture is active, the button being currently pressed can be known through [method`Gtk`.GestureSingle.get_current_button].

get_button()[source]
Returns:

The button number, or 0 for any button

Return type:

int

Returns the button number self listens for.

If this is 0, the gesture reacts to any button press.

get_current_button()[source]
Returns:

The current button number

Return type:

int

Returns the button number currently interacting with self, or 0 if there is none.

get_current_sequence()[source]
Returns:

the current sequence

Return type:

Gdk.EventSequence or None

Returns the event sequence currently interacting with self.

This is only meaningful if [method`Gtk`.Gesture.is_active] returns True.

get_exclusive()[source]
Returns:

Whether the gesture is exclusive

Return type:

bool

Gets whether a gesture is exclusive.

For more information, see [method`Gtk`.GestureSingle.set_exclusive].

get_touch_only()[source]
Returns:

True if the gesture only handles touch events

Return type:

bool

Returns True if the gesture is only triggered by touch events.

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.

set_exclusive(exclusive)[source]
Parameters:

exclusive (bool) – True to make self exclusive

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.

set_touch_only(touch_only)[source]
Parameters:

touch_only (bool) – whether self handles only touch events

Sets whether to handle only touch events.

If touch_only is True, self will only handle events of type Gdk.EventType.TOUCH_BEGIN, Gdk.EventType.TOUCH_UPDATE or Gdk.EventType.TOUCH_END. If False, mouse events will be handled too.

Property Details

Gtk.GestureSingle.props.button
Name:

button

Type:

int

Default Value:

1

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

Mouse button number to listen to, or 0 to listen for any button.

Gtk.GestureSingle.props.exclusive
Name:

exclusive

Type:

bool

Default Value:

False

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

Whether the gesture is exclusive.

Exclusive gestures only listen to pointer and pointer emulated events.

Gtk.GestureSingle.props.touch_only
Name:

touch-only

Type:

bool

Default Value:

False

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

Whether the gesture handles only touch events.