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