Struct gdk4::DNDEvent

source ·
pub struct DNDEvent { /* private fields */ }
Expand description

An event related to drag and drop operations.

Implementations§

source§

impl DNDEvent

source

pub fn as_ptr(&self) -> *mut GdkDNDEvent

Return the inner pointer to the underlying C value.

source

pub unsafe fn from_glib_ptr_borrow<'a>( ptr: *const *const GdkDNDEvent ) -> &'a Self

Borrows the underlying C value.

source§

impl DNDEvent

source

pub fn drop(&self) -> Option<Drop>

Gets the Drop object from a DND event.

§Returns

the drop

source§

impl DNDEvent

source

pub fn upcast(self) -> Event

source

pub fn upcast_ref(&self) -> &Event

Methods from Deref<Target = Event>§

source

pub fn as_ptr(&self) -> *mut GdkEvent

Return the inner pointer to the underlying C value.

source

pub const NONE: Option<&'static Event> = None

source

pub fn axes(&self) -> Option<Vec<f64>>

Extracts all axis values from an event.

To find out which axes are used, use DeviceTool::axes() on the device tool returned by device_tool().

§Returns

true on success, otherwise false

§axes

the array of values for all axes

source

pub fn axis(&self, axis_use: AxisUse) -> Option<f64>

Extract the axis value for a particular axis use from an event structure.

To find out which axes are used, use DeviceTool::axes() on the device tool returned by device_tool().

§axis_use

the axis use to look for

§Returns

true if the specified axis was found, otherwise false

§value

location to store the value found

source

pub fn device(&self) -> Option<Device>

Returns the device of an event.

§Returns

a Device

source

pub fn device_tool(&self) -> Option<DeviceTool>

Returns a DeviceTool representing the tool that caused the event.

If the was not generated by a device that supports different tools (such as a tablet), this function will return None.

Note: the DeviceTool will be constant during the application lifetime, if settings must be stored persistently across runs, see DeviceTool::serial().

§Returns

The current device tool

source

pub fn display(&self) -> Option<Display>

Retrieves the display associated to the @self.

§Returns

a Display

source

pub fn event_sequence(&self) -> EventSequence

Returns the event sequence to which the event belongs.

Related touch events are connected in a sequence. Other events typically don’t have event sequence information.

§Returns

the event sequence that the event belongs to

source

pub fn event_type(&self) -> EventType

Retrieves the type of the event.

§Returns

a EventType

source

pub fn history(&self) -> Vec<TimeCoord>

Retrieves the history of the device that @self is for, as a list of time and coordinates.

The history includes positions that are not delivered as separate events to the application because they occurred in the same frame as @self.

Note that only motion and scroll events record history, and motion events do it only if one of the mouse buttons is down, or the device has a tool.

§Returns

an array of time and coordinates

source

pub fn modifier_state(&self) -> ModifierType

Returns the modifier state field of an event.

§Returns

the modifier state of @self

source

pub fn is_pointer_emulated(&self) -> bool

Returns whether this event is an ‘emulated’ pointer event.

Emulated pointer events typically originate from a touch events.

§Returns

true if this event is emulated

source

pub fn position(&self) -> Option<(f64, f64)>

Extract the event surface relative x/y coordinates from an event.

This position is in surface coordinates.

§Returns
§x

location to put event surface x coordinate

§y

location to put event surface y coordinate

source

pub fn seat(&self) -> Option<Seat>

Returns the seat that originated the event.

§Returns

a Seat.

source

pub fn surface(&self) -> Option<Surface>

Extracts the surface associated with an event.

§Returns

The Surface associated with the event

source

pub fn time(&self) -> u32

Returns the timestamp of @self.

Not all events have timestamps. In that case, this function returns GDK_CURRENT_TIME.

§Returns

timestamp field from @self

source

pub fn triggers_context_menu(&self) -> bool

Returns whether a Event should trigger a context menu, according to platform conventions.

The right mouse button typically triggers context menus.

This function should always be used instead of simply checking for event->button == GDK_BUTTON_SECONDARY.

§Returns

true if the event should trigger a context menu.

source

pub fn is<T: EventKind>(&self) -> bool

source

pub fn type_(&self) -> Type

source

pub fn downcast_ref<T: EventKind>(&self) -> Option<&T>

source

pub fn angle(&self, event: impl AsRef<Event>) -> Option<f64>

Returns the relative angle from @event1 to @event2.

The relative angle is the angle between the X axis and the line through both events’ positions. The rotation direction for positive angles is from the positive X axis towards the positive Y axis.

This assumes that both events have X/Y information. If not, this function returns false.

§event1

first Event

§event2

second Event

§Returns

true if the angle could be calculated.

§angle

return location for the relative angle between both events

source

pub fn center(&self, event: impl AsRef<Event>) -> Option<(f64, f64)>

Returns the point halfway between the events’ positions.

This assumes that both events have X/Y information. If not, this function returns false.

§event1

first Event

§event2

second Event

§Returns

true if the center could be calculated.

§x

return location for the X coordinate of the center

§y

return location for the Y coordinate of the center

source

pub fn distance(&self, event: impl AsRef<Event>) -> Option<f64>

Returns the distance between the event locations.

This assumes that both events have X/Y information. If not, this function returns false.

§event1

first Event

§event2

second Event

§Returns

true if the distance could be calculated.

§distance

return location for the distance

Trait Implementations§

source§

impl AsRef<Event> for DNDEvent

source§

fn as_ref(&self) -> &Event

Converts this type into a shared reference of the (usually inferred) input type.
source§

impl Clone for DNDEvent

source§

fn clone(&self) -> Self

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for DNDEvent

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Deref for DNDEvent

§

type Target = Event

The resulting type after dereferencing.
source§

fn deref(&self) -> &Self::Target

Dereferences the value.
source§

impl EventKind for DNDEvent

source§

fn event_types() -> &'static [EventType]

source§

impl StaticType for DNDEvent

source§

fn static_type() -> Type

Returns the type identifier of Self.

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> FromGlibContainerAsVec<<T as GlibPtrDefault>::GlibType, *const GList> for T

source§

unsafe fn from_glib_none_num_as_vec(ptr: *const GList, num: usize) -> Vec<T>

source§

unsafe fn from_glib_container_num_as_vec(_: *const GList, _: usize) -> Vec<T>

source§

unsafe fn from_glib_full_num_as_vec(_: *const GList, _: usize) -> Vec<T>

source§

impl<T> FromGlibContainerAsVec<<T as GlibPtrDefault>::GlibType, *const GPtrArray> for T

source§

unsafe fn from_glib_none_num_as_vec(ptr: *const GPtrArray, num: usize) -> Vec<T>

source§

unsafe fn from_glib_container_num_as_vec( _: *const GPtrArray, _: usize ) -> Vec<T>

source§

unsafe fn from_glib_full_num_as_vec(_: *const GPtrArray, _: usize) -> Vec<T>

source§

impl<T> FromGlibContainerAsVec<<T as GlibPtrDefault>::GlibType, *const GSList> for T

source§

unsafe fn from_glib_none_num_as_vec(ptr: *const GSList, num: usize) -> Vec<T>

source§

unsafe fn from_glib_container_num_as_vec(_: *const GSList, _: usize) -> Vec<T>

source§

unsafe fn from_glib_full_num_as_vec(_: *const GSList, _: usize) -> Vec<T>

source§

impl<T> FromGlibContainerAsVec<<T as GlibPtrDefault>::GlibType, *mut GList> for T

source§

unsafe fn from_glib_none_num_as_vec(ptr: *mut GList, num: usize) -> Vec<T>

source§

unsafe fn from_glib_container_num_as_vec(ptr: *mut GList, num: usize) -> Vec<T>

source§

unsafe fn from_glib_full_num_as_vec(ptr: *mut GList, num: usize) -> Vec<T>

source§

impl<T> FromGlibContainerAsVec<<T as GlibPtrDefault>::GlibType, *mut GPtrArray> for T

source§

unsafe fn from_glib_none_num_as_vec(ptr: *mut GPtrArray, num: usize) -> Vec<T>

source§

unsafe fn from_glib_container_num_as_vec( ptr: *mut GPtrArray, num: usize ) -> Vec<T>

source§

unsafe fn from_glib_full_num_as_vec(ptr: *mut GPtrArray, num: usize) -> Vec<T>

source§

impl<T> FromGlibContainerAsVec<<T as GlibPtrDefault>::GlibType, *mut GSList> for T

source§

unsafe fn from_glib_none_num_as_vec(ptr: *mut GSList, num: usize) -> Vec<T>

source§

unsafe fn from_glib_container_num_as_vec(ptr: *mut GSList, num: usize) -> Vec<T>

source§

unsafe fn from_glib_full_num_as_vec(ptr: *mut GSList, num: usize) -> Vec<T>

source§

impl<T> FromGlibPtrArrayContainerAsVec<<T as GlibPtrDefault>::GlibType, *const GList> for T

source§

unsafe fn from_glib_none_as_vec(ptr: *const GList) -> Vec<T>

source§

unsafe fn from_glib_container_as_vec(_: *const GList) -> Vec<T>

source§

unsafe fn from_glib_full_as_vec(_: *const GList) -> Vec<T>

source§

impl<T> FromGlibPtrArrayContainerAsVec<<T as GlibPtrDefault>::GlibType, *const GPtrArray> for T

source§

unsafe fn from_glib_none_as_vec(ptr: *const GPtrArray) -> Vec<T>

source§

unsafe fn from_glib_container_as_vec(_: *const GPtrArray) -> Vec<T>

source§

unsafe fn from_glib_full_as_vec(_: *const GPtrArray) -> Vec<T>

source§

impl<T> FromGlibPtrArrayContainerAsVec<<T as GlibPtrDefault>::GlibType, *const GSList> for T

source§

unsafe fn from_glib_none_as_vec(ptr: *const GSList) -> Vec<T>

source§

unsafe fn from_glib_container_as_vec(_: *const GSList) -> Vec<T>

source§

unsafe fn from_glib_full_as_vec(_: *const GSList) -> Vec<T>

source§

impl<T> FromGlibPtrArrayContainerAsVec<<T as GlibPtrDefault>::GlibType, *mut GList> for T

source§

unsafe fn from_glib_none_as_vec(ptr: *mut GList) -> Vec<T>

source§

unsafe fn from_glib_container_as_vec(ptr: *mut GList) -> Vec<T>

source§

unsafe fn from_glib_full_as_vec(ptr: *mut GList) -> Vec<T>

source§

impl<T> FromGlibPtrArrayContainerAsVec<<T as GlibPtrDefault>::GlibType, *mut GPtrArray> for T

source§

unsafe fn from_glib_none_as_vec(ptr: *mut GPtrArray) -> Vec<T>

source§

unsafe fn from_glib_container_as_vec(ptr: *mut GPtrArray) -> Vec<T>

source§

unsafe fn from_glib_full_as_vec(ptr: *mut GPtrArray) -> Vec<T>

source§

impl<T> FromGlibPtrArrayContainerAsVec<<T as GlibPtrDefault>::GlibType, *mut GSList> for T

source§

unsafe fn from_glib_none_as_vec(ptr: *mut GSList) -> Vec<T>

source§

unsafe fn from_glib_container_as_vec(ptr: *mut GSList) -> Vec<T>

source§

unsafe fn from_glib_full_as_vec(ptr: *mut GSList) -> Vec<T>

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> StaticTypeExt for T
where T: StaticType,

source§

fn ensure_type()

Ensures that the type has been registered with the type system.
source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T> TransparentType for T

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.