pub trait DragActionExt: 'static {
Show 25 methods
// Required methods
fn get_drag_area(&self) -> Option<Rect>;
fn get_drag_axis(&self) -> DragAxis;
fn get_drag_handle(&self) -> Option<Actor>;
fn get_drag_threshold(&self) -> (u32, u32);
fn get_motion_coords(&self) -> (f32, f32);
fn get_press_coords(&self) -> (f32, f32);
fn set_drag_area(&self, drag_area: Option<&Rect>);
fn set_drag_axis(&self, axis: DragAxis);
fn set_drag_handle<P: IsA<Actor>>(&self, handle: Option<&P>);
fn set_drag_threshold(&self, x_threshold: i32, y_threshold: i32);
fn get_property_drag_area_set(&self) -> bool;
fn get_property_x_drag_threshold(&self) -> i32;
fn set_property_x_drag_threshold(&self, x_drag_threshold: i32);
fn get_property_y_drag_threshold(&self) -> i32;
fn set_property_y_drag_threshold(&self, y_drag_threshold: i32);
fn connect_drag_begin<F: Fn(&Self, &Actor, f32, f32, ModifierType) + 'static>(
&self,
f: F,
) -> SignalHandlerId;
fn connect_drag_end<F: Fn(&Self, &Actor, f32, f32, ModifierType) + 'static>(
&self,
f: F,
) -> SignalHandlerId;
fn connect_drag_motion<F: Fn(&Self, &Actor, f32, f32) + 'static>(
&self,
f: F,
) -> SignalHandlerId;
fn connect_drag_progress<F: Fn(&Self, &Actor, f32, f32) -> bool + 'static>(
&self,
f: F,
) -> SignalHandlerId;
fn connect_property_drag_area_notify<F: Fn(&Self) + 'static>(
&self,
f: F,
) -> SignalHandlerId;
fn connect_property_drag_area_set_notify<F: Fn(&Self) + 'static>(
&self,
f: F,
) -> SignalHandlerId;
fn connect_property_drag_axis_notify<F: Fn(&Self) + 'static>(
&self,
f: F,
) -> SignalHandlerId;
fn connect_property_drag_handle_notify<F: Fn(&Self) + 'static>(
&self,
f: F,
) -> SignalHandlerId;
fn connect_property_x_drag_threshold_notify<F: Fn(&Self) + 'static>(
&self,
f: F,
) -> SignalHandlerId;
fn connect_property_y_drag_threshold_notify<F: Fn(&Self) + 'static>(
&self,
f: F,
) -> SignalHandlerId;
}
Expand description
Required Methods§
Sourcefn get_drag_area(&self) -> Option<Rect>
fn get_drag_area(&self) -> Option<Rect>
Sourcefn get_drag_axis(&self) -> DragAxis
fn get_drag_axis(&self) -> DragAxis
Sourcefn get_drag_handle(&self) -> Option<Actor>
fn get_drag_handle(&self) -> Option<Actor>
Retrieves the drag handle set by DragActionExt::set_drag_handle
§Returns
a Actor
, used as the drag
handle, or None
if none was set
Sourcefn get_drag_threshold(&self) -> (u32, u32)
fn get_drag_threshold(&self) -> (u32, u32)
Retrieves the values set by DragActionExt::set_drag_threshold
.
If the DragAction:x-drag-threshold
property or the
DragAction:y-drag-threshold
property have been set to -1 then
this function will return the default drag threshold value as stored
by the Settings:dnd-drag-threshold
property of Settings
.
§x_threshold
return location for the horizontal drag threshold value, in pixels
§y_threshold
return location for the vertical drag threshold value, in pixels
Sourcefn get_motion_coords(&self) -> (f32, f32)
fn get_motion_coords(&self) -> (f32, f32)
Sourcefn get_press_coords(&self) -> (f32, f32)
fn get_press_coords(&self) -> (f32, f32)
Sourcefn set_drag_area(&self, drag_area: Option<&Rect>)
fn set_drag_area(&self, drag_area: Option<&Rect>)
Sets drag_area
to constrain the dragging of the actor associated
with self
, so that it position is always within drag_area
, expressed
in parent’s coordinates.
If drag_area
is None
, the actor is not constrained.
§drag_area
a Rect
Sourcefn set_drag_axis(&self, axis: DragAxis)
fn set_drag_axis(&self, axis: DragAxis)
Sourcefn set_drag_threshold(&self, x_threshold: i32, y_threshold: i32)
fn set_drag_threshold(&self, x_threshold: i32, y_threshold: i32)
Sets the horizontal and vertical drag thresholds that must be
cleared by the pointer before self
can begin the dragging.
If x_threshold
or y_threshold
are set to -1 then the default
drag threshold stored in the Settings:dnd-drag-threshold
property of Settings
will be used.
§x_threshold
a distance on the horizontal axis, in pixels, or
-1 to use the default drag threshold from Settings
§y_threshold
a distance on the vertical axis, in pixels, or
-1 to use the default drag threshold from Settings
Sourcefn get_property_drag_area_set(&self) -> bool
fn get_property_drag_area_set(&self) -> bool
Whether the DragAction:drag-area
property has been set.
Sourcefn get_property_x_drag_threshold(&self) -> i32
fn get_property_x_drag_threshold(&self) -> i32
The horizontal threshold, in pixels, that the cursor must travel in order to begin a drag action.
When set to a positive value, DragAction
will only emit
DragAction::drag-begin
if the pointer has moved
horizontally at least of the given amount of pixels since
the button press event.
When set to -1, DragAction
will use the default threshold
stored in the Settings:dnd-drag-threshold
property of
Settings
.
When read, this property will always return a valid drag threshold, either as set or the default one.
Sourcefn set_property_x_drag_threshold(&self, x_drag_threshold: i32)
fn set_property_x_drag_threshold(&self, x_drag_threshold: i32)
The horizontal threshold, in pixels, that the cursor must travel in order to begin a drag action.
When set to a positive value, DragAction
will only emit
DragAction::drag-begin
if the pointer has moved
horizontally at least of the given amount of pixels since
the button press event.
When set to -1, DragAction
will use the default threshold
stored in the Settings:dnd-drag-threshold
property of
Settings
.
When read, this property will always return a valid drag threshold, either as set or the default one.
Sourcefn get_property_y_drag_threshold(&self) -> i32
fn get_property_y_drag_threshold(&self) -> i32
The vertical threshold, in pixels, that the cursor must travel in order to begin a drag action.
When set to a positive value, DragAction
will only emit
DragAction::drag-begin
if the pointer has moved
vertically at least of the given amount of pixels since
the button press event.
When set to -1, DragAction
will use the value stored
in the Settings:dnd-drag-threshold
property of
Settings
.
When read, this property will always return a valid drag threshold, either as set or the default one.
Sourcefn set_property_y_drag_threshold(&self, y_drag_threshold: i32)
fn set_property_y_drag_threshold(&self, y_drag_threshold: i32)
The vertical threshold, in pixels, that the cursor must travel in order to begin a drag action.
When set to a positive value, DragAction
will only emit
DragAction::drag-begin
if the pointer has moved
vertically at least of the given amount of pixels since
the button press event.
When set to -1, DragAction
will use the value stored
in the Settings:dnd-drag-threshold
property of
Settings
.
When read, this property will always return a valid drag threshold, either as set or the default one.
Sourcefn connect_drag_begin<F: Fn(&Self, &Actor, f32, f32, ModifierType) + 'static>(
&self,
f: F,
) -> SignalHandlerId
fn connect_drag_begin<F: Fn(&Self, &Actor, f32, f32, ModifierType) + 'static>( &self, f: F, ) -> SignalHandlerId
The ::drag-begin signal is emitted when the DragAction
starts the dragging
The emission of this signal can be delayed by using the
DragAction:x-drag-threshold
and
DragAction:y-drag-threshold
properties
§actor
the Actor
attached to the action
§event_x
the X coordinate (in stage space) of the press event
§event_y
the Y coordinate (in stage space) of the press event
§modifiers
the modifiers of the press event
Sourcefn connect_drag_end<F: Fn(&Self, &Actor, f32, f32, ModifierType) + 'static>(
&self,
f: F,
) -> SignalHandlerId
fn connect_drag_end<F: Fn(&Self, &Actor, f32, f32, ModifierType) + 'static>( &self, f: F, ) -> SignalHandlerId
The ::drag-end signal is emitted at the end of the dragging, when the pointer button’s is released
This signal is emitted if and only if the DragAction::drag-begin
signal has been emitted first
§actor
the Actor
attached to the action
§event_x
the X coordinate (in stage space) of the release event
§event_y
the Y coordinate (in stage space) of the release event
§modifiers
the modifiers of the release event
Sourcefn connect_drag_motion<F: Fn(&Self, &Actor, f32, f32) + 'static>(
&self,
f: F,
) -> SignalHandlerId
fn connect_drag_motion<F: Fn(&Self, &Actor, f32, f32) + 'static>( &self, f: F, ) -> SignalHandlerId
The ::drag-motion signal is emitted for each motion event after
the DragAction::drag-begin
signal has been emitted.
The components of the distance between the press event and the
latest motion event are computed in the actor’s coordinate space,
to take into account eventual transformations. If you want the
stage coordinates of the latest motion event you can use
DragActionExt::get_motion_coords
.
The default handler of the signal will call ActorExt::move_by
either on actor
or, if set, of DragAction:drag-handle
using
the delta_x
and delta_y
components of the dragging motion. If you
want to override the default behaviour, you can connect to the
DragAction::drag-progress
signal and return false
from the
handler.
§actor
the Actor
attached to the action
§delta_x
the X component of the distance between the press event that began the dragging and the current position of the pointer, as of the latest motion event
§delta_y
the Y component of the distance between the press event that began the dragging and the current position of the pointer, as of the latest motion event
Sourcefn connect_drag_progress<F: Fn(&Self, &Actor, f32, f32) -> bool + 'static>(
&self,
f: F,
) -> SignalHandlerId
fn connect_drag_progress<F: Fn(&Self, &Actor, f32, f32) -> bool + 'static>( &self, f: F, ) -> SignalHandlerId
The ::drag-progress signal is emitted for each motion event after
the DragAction::drag-begin
signal has been emitted.
The components of the distance between the press event and the
latest motion event are computed in the actor’s coordinate space,
to take into account eventual transformations. If you want the
stage coordinates of the latest motion event you can use
DragActionExt::get_motion_coords
.
The default handler will emit DragAction::drag-motion
,
if DragAction::drag-progress
emission returns true
.
§actor
the Actor
attached to the action
§delta_x
the X component of the distance between the press event that began the dragging and the current position of the pointer, as of the latest motion event
§delta_y
the Y component of the distance between the press event that began the dragging and the current position of the pointer, as of the latest motion event
§Returns
true
if the drag should continue, and false
if it should be stopped.
fn connect_property_drag_area_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId
fn connect_property_drag_area_set_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId
fn connect_property_drag_axis_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId
fn connect_property_drag_handle_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId
fn connect_property_x_drag_threshold_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId
fn connect_property_y_drag_threshold_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.