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