gdk/
event_selection.rs

1// Copyright 2016, The Gtk-rs Project Developers.
2// See the COPYRIGHT file at the top-level directory of this distribution.
3// Licensed under the MIT license, see the LICENSE file or <http://opensource.org/licenses/MIT>
4
5use gdk_sys;
6use glib::translate::*;
7
8#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
9pub struct EventSelection(::Event);
10
11event_wrapper!(EventSelection, GdkEventSelection);
12event_subtype!(
13    EventSelection,
14    gdk_sys::GDK_SELECTION_CLEAR | gdk_sys::GDK_SELECTION_NOTIFY | gdk_sys::GDK_SELECTION_REQUEST
15);
16
17impl EventSelection {
18    pub fn get_selection(&self) -> ::Atom {
19        unsafe { from_glib_none(self.as_ref().selection as *mut _) }
20    }
21
22    pub fn get_target(&self) -> ::Atom {
23        unsafe { from_glib_none(self.as_ref().target as *mut _) }
24    }
25
26    pub fn get_property(&self) -> ::Atom {
27        unsafe { from_glib_none(self.as_ref().property as *mut _) }
28    }
29
30    pub fn get_time(&self) -> u32 {
31        self.as_ref().time
32    }
33
34    pub fn get_requestor(&self) -> Option<::Window> {
35        unsafe { from_glib_none(self.as_ref().requestor) }
36    }
37}