pub trait GestureExt: 'static {
Show 26 methods fn bounding_box(&self) -> Option<Rectangle>; fn bounding_box_center(&self) -> Option<(f64, f64)>; fn device(&self) -> Option<Device>; fn group(&self) -> Vec<Gesture>; fn last_event(&self, sequence: Option<&EventSequence>) -> Option<Event>; fn last_updated_sequence(&self) -> Option<EventSequence>; fn point(&self, sequence: Option<&EventSequence>) -> Option<(f64, f64)>; fn sequence_state(&self, sequence: &EventSequence) -> EventSequenceState; fn sequences(&self) -> Vec<EventSequence>; fn window(&self) -> Option<Window>; fn group_with(&self, gesture: &impl IsA<Gesture>); fn handles_sequence(&self, sequence: Option<&EventSequence>) -> bool; fn is_active(&self) -> bool; fn is_grouped_with(&self, other: &impl IsA<Gesture>) -> bool; fn is_recognized(&self) -> bool; fn set_sequence_state(
        &self,
        sequence: &EventSequence,
        state: EventSequenceState
    ) -> bool; fn set_state(&self, state: EventSequenceState) -> bool; fn set_window(&self, window: Option<&Window>); fn ungroup(&self); fn n_points(&self) -> u32; fn connect_begin<F: Fn(&Self, Option<&EventSequence>) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId; fn connect_cancel<F: Fn(&Self, Option<&EventSequence>) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId; fn connect_end<F: Fn(&Self, Option<&EventSequence>) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId; fn connect_sequence_state_changed<F: Fn(&Self, Option<&EventSequence>, EventSequenceState) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId; fn connect_update<F: Fn(&Self, Option<&EventSequence>) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId; fn connect_window_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
}
Expand description

Required Methods

If there are touch sequences being currently handled by self, this function returns true and fills in rect with the bounding box containing all active touches. Otherwise, false will be returned.

Note: This function will yield unexpected results on touchpad gestures. Since there is no correlation between physical and pixel distances, these will look as if constrained in an infinitely small area, rect width and height will thus be 0 regardless of the number of touchpoints.

Returns

true if there are active touches, false otherwise

rect

bounding box containing all active touches.

If there are touch sequences being currently handled by self, this function returns true and fills in x and y with the center of the bounding box containing all active touches. Otherwise, false will be returned.

Returns

false if no active touches are present, true otherwise

x

X coordinate for the bounding box center

y

Y coordinate for the bounding box center

Returns the master gdk::Device that is currently operating on self, or None if the gesture is not being interacted.

Returns

a gdk::Device, or None

Returns all gestures in the group of self

Returns

The list of GtkGestures, free with g_list_free()

Returns the last event that was processed for sequence.

Note that the returned pointer is only valid as long as the sequence is still interpreted by the self. If in doubt, you should make a copy of the event.

sequence

a gdk::EventSequence

Returns

The last event from sequence

Returns the gdk::EventSequence that was last updated on self.

Returns

The last updated sequence

If sequence is currently being interpreted by self, this function returns true and fills in x and y with the last coordinates stored for that event sequence. The coordinates are always relative to the widget allocation.

sequence

a gdk::EventSequence, or None for pointer events

Returns

true if sequence is currently interpreted

x

return location for X axis of the sequence coordinates

y

return location for Y axis of the sequence coordinates

Returns the sequence state, as seen by self.

sequence

a gdk::EventSequence

Returns

The sequence state in self

Returns the list of GdkEventSequences currently being interpreted by self.

Returns

A list of GdkEventSequences, the list elements are owned by GTK+ and must not be freed or modified, the list itself must be deleted through g_list_free()

Returns the user-defined window that receives the events handled by self. See set_window() for more information.

Returns

the user defined window, or None if none

Adds gesture to the same group than self. Gestures are by default isolated in their own groups.

When gestures are grouped, the state of GdkEventSequences is kept in sync for all of those, so calling set_sequence_state(), on one will transfer the same value to the others.

Groups also perform an “implicit grabbing” of sequences, if a gdk::EventSequence state is set to EventSequenceState::Claimed on one group, every other gesture group attached to the same Widget will switch the state for that sequence to EventSequenceState::Denied.

gesture

a Gesture

Returns true if self is currently handling events corresponding to sequence.

sequence

a gdk::EventSequence or None

Returns

true if self is handling sequence, false otherwise

Returns true if the gesture is currently active. A gesture is active meanwhile there are touch sequences interacting with it.

Returns

true if gesture is active

Returns true if both gestures pertain to the same group.

other

another Gesture

Returns

whether the gestures are grouped

Returns true if the gesture is currently recognized. A gesture is recognized if there are as many interacting touch sequences as required by self, and signal::Gesture::check returned true for the sequences being currently interpreted.

Returns

true if gesture is recognized

Sets the state of sequence in self. Sequences start in state EventSequenceState::None, and whenever they change state, they can never go back to that state. Likewise, sequences in state EventSequenceState::Denied cannot turn back to a not denied state. With these rules, the lifetime of an event sequence is constrained to the next four:

  • None
  • None → Denied
  • None → Claimed
  • None → Claimed → Denied

Note: Due to event handling ordering, it may be unsafe to set the state on another gesture within a signal::Gesture::begin signal handler, as the callback might be executed before the other gesture knows about the sequence. A safe way to perform this could be:

static void
first_gesture_begin_cb (GtkGesture       *first_gesture,
                        GdkEventSequence *sequence,
                        gpointer          user_data)
{
  gtk_gesture_set_sequence_state (first_gesture, sequence, GTK_EVENT_SEQUENCE_CLAIMED);
  gtk_gesture_set_sequence_state (second_gesture, sequence, GTK_EVENT_SEQUENCE_DENIED);
}

static void
second_gesture_begin_cb (GtkGesture       *second_gesture,
                         GdkEventSequence *sequence,
                         gpointer          user_data)
{
  if (gtk_gesture_get_sequence_state (first_gesture, sequence) == GTK_EVENT_SEQUENCE_CLAIMED)
    gtk_gesture_set_sequence_state (second_gesture, sequence, GTK_EVENT_SEQUENCE_DENIED);
}

If both gestures are in the same group, just set the state on the gesture emitting the event, the sequence will be already be initialized to the group’s global state when the second gesture processes the event.

sequence

a gdk::EventSequence

state

the sequence state

Returns

true if sequence is handled by self, and the state is changed successfully

Sets the state of all sequences that self is currently interacting with. See set_sequence_state() for more details on sequence states.

state

the sequence state

Returns

true if the state of at least one sequence was changed successfully

Sets a specific window to receive events about, so self will effectively handle only events targeting window, or a child of it. window must pertain to EventControllerExt::widget().

window

a gdk::Window, or None

Separates self into an isolated group.

The number of touch points that trigger recognition on this gesture,

This signal is emitted when the gesture is recognized. This means the number of touch sequences matches property::Gesture::n-points, and the signal::Gesture::check handler(s) returned true.

Note: These conditions may also happen when an extra touch (eg. a third touch on a 2-touches gesture) is lifted, in that situation sequence won’t pertain to the current set of active touches, so don’t rely on this being true.

sequence

the gdk::EventSequence that made the gesture to be recognized

This signal is emitted whenever a sequence is cancelled. This usually happens on active touches when EventControllerExt::reset() is called on gesture (manually, due to grabs…), or the individual sequence was claimed by parent widgets’ controllers (see set_sequence_state()).

gesture must forget everything about sequence as a reaction to this signal.

sequence

the gdk::EventSequence that was cancelled

This signal is emitted when gesture either stopped recognizing the event sequences as something to be handled (the signal::Gesture::check handler returned false), or the number of touch sequences became higher or lower than property::Gesture::n-points.

Note: sequence might not pertain to the group of sequences that were previously triggering recognition on gesture (ie. a just pressed touch sequence that exceeds property::Gesture::n-points). This situation may be detected by checking through handles_sequence().

sequence

the gdk::EventSequence that made gesture recognition to finish

This signal is emitted whenever a sequence state changes. See set_sequence_state() to know more about the expectable sequence lifetimes.

sequence

the gdk::EventSequence that was cancelled

state

the new sequence state

This signal is emitted whenever an event is handled while the gesture is recognized. sequence is guaranteed to pertain to the set of active touches.

sequence

the gdk::EventSequence that was updated

Implementors