pub trait ClickActionExt: 'static {
Show 16 methods
// Required methods
fn get_button(&self) -> u32;
fn get_coords(&self) -> (f32, f32);
fn get_state(&self) -> ModifierType;
fn release(&self);
fn get_property_held(&self) -> bool;
fn get_property_long_press_duration(&self) -> i32;
fn set_property_long_press_duration(&self, long_press_duration: i32);
fn get_property_long_press_threshold(&self) -> i32;
fn set_property_long_press_threshold(&self, long_press_threshold: i32);
fn get_property_pressed(&self) -> bool;
fn connect_clicked<F: Fn(&Self, &Actor) + 'static>(
&self,
f: F,
) -> SignalHandlerId;
fn connect_long_press<F: Fn(&Self, &Actor, LongPressState) -> bool + 'static>(
&self,
f: F,
) -> SignalHandlerId;
fn connect_property_held_notify<F: Fn(&Self) + 'static>(
&self,
f: F,
) -> SignalHandlerId;
fn connect_property_long_press_duration_notify<F: Fn(&Self) + 'static>(
&self,
f: F,
) -> SignalHandlerId;
fn connect_property_long_press_threshold_notify<F: Fn(&Self) + 'static>(
&self,
f: F,
) -> SignalHandlerId;
fn connect_property_pressed_notify<F: Fn(&Self) + 'static>(
&self,
f: F,
) -> SignalHandlerId;
}Expand description
Required Methods§
Retrieves the button that was pressed.
- 1 - left mouse button in a right-handed configuration, or the right mouse button in a left-handed configuration
- 2 - scroll wheel button
- 3 - right mouse button in a right-handed configuration, or the left mouse button in a left-handed configuration
§Returns
the button value
Sourcefn get_coords(&self) -> (f32, f32)
fn get_coords(&self) -> (f32, f32)
Sourcefn get_state(&self) -> ModifierType
fn get_state(&self) -> ModifierType
Sourcefn release(&self)
fn release(&self)
Emulates a release of the pointer button, which ungrabs the pointer
and unsets the ClickAction:pressed state.
This function will also cancel the long press gesture if one was initiated.
This function is useful to break a grab, for instance after a certain amount of time has passed.
Sourcefn get_property_held(&self) -> bool
fn get_property_held(&self) -> bool
Whether the clickable actor has the pointer grabbed
Sourcefn get_property_long_press_duration(&self) -> i32
fn get_property_long_press_duration(&self) -> i32
The minimum duration of a press for it to be recognized as a long press gesture, in milliseconds.
A value of -1 will make the ClickAction use the value of
the Settings:long-press-duration property.
Sourcefn set_property_long_press_duration(&self, long_press_duration: i32)
fn set_property_long_press_duration(&self, long_press_duration: i32)
The minimum duration of a press for it to be recognized as a long press gesture, in milliseconds.
A value of -1 will make the ClickAction use the value of
the Settings:long-press-duration property.
Sourcefn get_property_long_press_threshold(&self) -> i32
fn get_property_long_press_threshold(&self) -> i32
The maximum allowed distance that can be covered (on both axes) before a long press gesture is cancelled, in pixels.
A value of -1 will make the ClickAction use the value of
the Settings:dnd-drag-threshold property.
Sourcefn set_property_long_press_threshold(&self, long_press_threshold: i32)
fn set_property_long_press_threshold(&self, long_press_threshold: i32)
The maximum allowed distance that can be covered (on both axes) before a long press gesture is cancelled, in pixels.
A value of -1 will make the ClickAction use the value of
the Settings:dnd-drag-threshold property.
Sourcefn get_property_pressed(&self) -> bool
fn get_property_pressed(&self) -> bool
Whether the clickable actor should be in “pressed” state
Sourcefn connect_clicked<F: Fn(&Self, &Actor) + 'static>(
&self,
f: F,
) -> SignalHandlerId
fn connect_clicked<F: Fn(&Self, &Actor) + 'static>( &self, f: F, ) -> SignalHandlerId
The ::clicked signal is emitted when the Actor to which
a ClickAction has been applied should respond to a
pointer button press and release events
§actor
the Actor attached to the action
Sourcefn connect_long_press<F: Fn(&Self, &Actor, LongPressState) -> bool + 'static>(
&self,
f: F,
) -> SignalHandlerId
fn connect_long_press<F: Fn(&Self, &Actor, LongPressState) -> bool + 'static>( &self, f: F, ) -> SignalHandlerId
The ::long-press signal is emitted during the long press gesture handling.
This signal can be emitted multiple times with different states.
The LongPressState::Query state will be emitted on button presses,
and its return value will determine whether the long press handling
should be initiated. If the signal handlers will return true, the
LongPressState::Query state will be followed either by a signal
emission with the LongPressState::Activate state if the long press
constraints were respected, or by a signal emission with the
LongPressState::Cancel state if the long press was cancelled.
It is possible to forcibly cancel a long press detection using
ClickActionExt::release.
§actor
the Actor attached to the action
§state
the long press state
§Returns
Only the LongPressState::Query state uses the
returned value of the handler; other states will ignore it
fn connect_property_held_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId
fn connect_property_long_press_duration_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId
fn connect_property_long_press_threshold_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId
fn connect_property_pressed_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.