Trait ClickActionExt

Source
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

Trait containing all ClickAction methods.

§Implementors

ClickAction

Required Methods§

Source

fn get_button(&self) -> u32

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

Source

fn get_coords(&self) -> (f32, f32)

Retrieves the screen coordinates of the button press.

§press_x

return location for the X coordinate, or None

§press_y

return location for the Y coordinate, or None

Source

fn get_state(&self) -> ModifierType

Retrieves the modifier state of the click action.

§Returns

the modifier state parameter, or 0

Source

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.

Source

fn get_property_held(&self) -> bool

Whether the clickable actor has the pointer grabbed

Source

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.

Source

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.

Source

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.

Source

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.

Source

fn get_property_pressed(&self) -> bool

Whether the clickable actor should be in “pressed” state

Source

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

Source

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

Source

fn connect_property_held_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId

Source

fn connect_property_long_press_duration_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId

Source

fn connect_property_long_press_threshold_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId

Source

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.

Implementors§