gdk/event_selection.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 when a selection is requested or ownership of a selection
6/// is taken over by another client application.
7#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
8pub struct EventSelection(crate::Event);
9
10event_wrapper!(EventSelection, GdkEventSelection);
11event_subtype!(
12 EventSelection,
13 ffi::GDK_SELECTION_CLEAR | ffi::GDK_SELECTION_NOTIFY | ffi::GDK_SELECTION_REQUEST
14);
15
16impl EventSelection {
17 #[doc(alias = "get_selection")]
18 pub fn selection(&self) -> crate::Atom {
19 unsafe { from_glib_none(self.as_ref().selection as *mut _) }
20 }
21
22 #[doc(alias = "get_target")]
23 pub fn target(&self) -> crate::Atom {
24 unsafe { from_glib_none(self.as_ref().target as *mut _) }
25 }
26
27 #[doc(alias = "get_property")]
28 pub fn property(&self) -> crate::Atom {
29 unsafe { from_glib_none(self.as_ref().property as *mut _) }
30 }
31
32 #[doc(alias = "get_time")]
33 pub fn time(&self) -> u32 {
34 self.as_ref().time
35 }
36
37 #[doc(alias = "get_requestor")]
38 pub fn requestor(&self) -> Option<crate::Window> {
39 unsafe { from_glib_none(self.as_ref().requestor) }
40 }
41}