Skip to main content

gdk/
event_dnd.rs

1// Take a look at the license at the top of the repository in the LICENSE file.
2
3use crate::ffi;
4use glib::translate::*;
5
6/// Generated during DND operations.
7#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
8pub struct EventDND(crate::Event);
9
10event_wrapper!(EventDND, GdkEventDND);
11event_subtype!(
12    EventDND,
13    ffi::GDK_DRAG_ENTER
14        | ffi::GDK_DRAG_LEAVE
15        | ffi::GDK_DRAG_MOTION
16        | ffi::GDK_DRAG_STATUS
17        | ffi::GDK_DROP_START
18        | ffi::GDK_DROP_FINISHED
19);
20
21impl EventDND {
22    #[doc(alias = "get_context")]
23    pub fn context(&self) -> Option<crate::DragContext> {
24        unsafe { from_glib_none(self.as_ref().context) }
25    }
26
27    #[doc(alias = "get_time")]
28    pub fn time(&self) -> u32 {
29        self.as_ref().time
30    }
31
32    #[doc(alias = "get_root")]
33    pub fn root(&self) -> (i16, i16) {
34        let x_root = self.as_ref().x_root;
35        let y_root = self.as_ref().y_root;
36        (x_root, y_root)
37    }
38}