[−][src]Trait gtk::prelude::GestureExt
Trait containing all Gesture methods.
Implementors
Required methods
fn get_bounding_box(&self) -> Option<Rectangle>
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.
rect
bounding box containing all active touches.
Returns
true if there are active touches, false otherwise
fn get_bounding_box_center(&self) -> Option<(f64, f64)>
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.
x
X coordinate for the bounding box center
y
Y coordinate for the bounding box center
Returns
false if no active touches are present, true otherwise
fn get_device(&self) -> Option<Device>
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
fn get_group(&self) -> Vec<Gesture>
Returns all gestures in the group of self
Returns
The list
of GtkGestures, free with glib::List::free
fn get_last_event(&self, sequence: Option<&EventSequence>) -> Option<Event>
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
fn get_last_updated_sequence(&self) -> Option<EventSequence>
fn get_point(&self, sequence: Option<&EventSequence>) -> Option<(f64, f64)>
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
x
return location for X axis of the sequence coordinates
y
return location for Y axis of the sequence coordinates
Returns
true if sequence is currently interpreted
fn get_sequence_state(&self, sequence: &EventSequence) -> EventSequenceState
Returns the sequence state, as seen by self.
sequence
a gdk::EventSequence
Returns
The sequence state in self
fn get_sequences(&self) -> Vec<EventSequence>
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 glib::List::free
fn get_window(&self) -> Option<Window>
Returns the user-defined window that receives the events
handled by self. See GestureExt::set_window for more
information.
Returns
the user defined window, or None if none
fn group<P: IsA<Gesture>>(&self, gesture: &P)
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 GestureExt::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
fn handles_sequence(&self, sequence: Option<&EventSequence>) -> bool
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
fn is_active(&self) -> bool
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
fn is_grouped_with<P: IsA<Gesture>>(&self, other: &P) -> bool
Returns true if both gestures pertain to the same group.
other
another Gesture
Returns
whether the gestures are grouped
fn is_recognized(&self) -> bool
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 Gesture::check
returned true for the sequences being currently interpreted.
Returns
true if gesture is recognized
fn set_sequence_state(
&self,
sequence: &EventSequence,
state: EventSequenceState
) -> bool
&self,
sequence: &EventSequence,
state: EventSequenceState
) -> bool
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 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
fn set_state(&self, state: EventSequenceState) -> bool
Sets the state of all sequences that self is currently
interacting with. See GestureExt::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
fn set_window<P: IsA<Window>>(&self, window: Option<&P>)
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::get_widget.
window
a gdk::Window, or None
fn ungroup(&self)
Separates self into an isolated group.
fn get_property_n_points(&self) -> u32
The number of touch points that trigger recognition on this gesture,
fn connect_begin<F: Fn(&Self, &EventSequence) + 'static>(
&self,
f: F
) -> SignalHandlerId
&self,
f: F
) -> SignalHandlerId
This signal is emitted when the gesture is recognized. This means the
number of touch sequences matches Gesture:n-points, and the 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
fn connect_cancel<F: Fn(&Self, &EventSequence) + 'static>(
&self,
f: F
) -> SignalHandlerId
&self,
f: F
) -> SignalHandlerId
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 GestureExt::set_sequence_state).
gesture must forget everything about sequence as a reaction to this signal.
sequence
the gdk::EventSequence that was cancelled
fn connect_end<F: Fn(&Self, &EventSequence) + 'static>(
&self,
f: F
) -> SignalHandlerId
&self,
f: F
) -> SignalHandlerId
This signal is emitted when gesture either stopped recognizing the event
sequences as something to be handled (the Gesture::check handler returned
false), or the number of touch sequences became higher or lower than
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 Gesture:n-points). This situation may be detected
by checking through GestureExt::handles_sequence.
sequence
the gdk::EventSequence that made gesture recognition to finish
fn connect_sequence_state_changed<F: Fn(&Self, &EventSequence, EventSequenceState) + 'static>(
&self,
f: F
) -> SignalHandlerId
&self,
f: F
) -> SignalHandlerId
This signal is emitted whenever a sequence state changes. See
GestureExt::set_sequence_state to know more about the expectable
sequence lifetimes.
sequence
the gdk::EventSequence that was cancelled
state
the new sequence state
fn connect_update<F: Fn(&Self, &EventSequence) + 'static>(
&self,
f: F
) -> SignalHandlerId
&self,
f: F
) -> SignalHandlerId
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
fn connect_property_window_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId
&self,
f: F
) -> SignalHandlerId
Implementors
impl<O: IsA<Gesture>> GestureExt for O[src]
fn get_bounding_box(&self) -> Option<Rectangle>[src]
fn get_bounding_box_center(&self) -> Option<(f64, f64)>[src]
fn get_device(&self) -> Option<Device>[src]
fn get_group(&self) -> Vec<Gesture>[src]
fn get_last_event(&self, sequence: Option<&EventSequence>) -> Option<Event>[src]
fn get_last_updated_sequence(&self) -> Option<EventSequence>[src]
fn get_point(&self, sequence: Option<&EventSequence>) -> Option<(f64, f64)>[src]
fn get_sequence_state(&self, sequence: &EventSequence) -> EventSequenceState[src]
fn get_sequences(&self) -> Vec<EventSequence>[src]
fn get_window(&self) -> Option<Window>[src]
fn group<P: IsA<Gesture>>(&self, gesture: &P)[src]
fn handles_sequence(&self, sequence: Option<&EventSequence>) -> bool[src]
fn is_active(&self) -> bool[src]
fn is_grouped_with<P: IsA<Gesture>>(&self, other: &P) -> bool[src]
fn is_recognized(&self) -> bool[src]
fn set_sequence_state(
&self,
sequence: &EventSequence,
state: EventSequenceState
) -> bool[src]
&self,
sequence: &EventSequence,
state: EventSequenceState
) -> bool
fn set_state(&self, state: EventSequenceState) -> bool[src]
fn set_window<P: IsA<Window>>(&self, window: Option<&P>)[src]
fn ungroup(&self)[src]
fn get_property_n_points(&self) -> u32[src]
fn connect_begin<F: Fn(&Self, &EventSequence) + 'static>(
&self,
f: F
) -> SignalHandlerId[src]
&self,
f: F
) -> SignalHandlerId
fn connect_cancel<F: Fn(&Self, &EventSequence) + 'static>(
&self,
f: F
) -> SignalHandlerId[src]
&self,
f: F
) -> SignalHandlerId
fn connect_end<F: Fn(&Self, &EventSequence) + 'static>(
&self,
f: F
) -> SignalHandlerId[src]
&self,
f: F
) -> SignalHandlerId
fn connect_sequence_state_changed<F: Fn(&Self, &EventSequence, EventSequenceState) + 'static>(
&self,
f: F
) -> SignalHandlerId[src]
&self,
f: F
) -> SignalHandlerId
fn connect_update<F: Fn(&Self, &EventSequence) + 'static>(
&self,
f: F
) -> SignalHandlerId[src]
&self,
f: F
) -> SignalHandlerId
fn connect_property_window_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId[src]
&self,
f: F
) -> SignalHandlerId